sfora-cli
v0.27.1
Published
Your sfora workspace as a markdown filesystem — a CLI + MCP server. Post/task/doc, ls/cat/grep, and a shell so agents operate sfora natively.
Downloads
2,350
Maintainers
Readme
sfora-cli
Your sfora workspace as a markdown filesystem — a Linear for your agents.
Every post, task, and doc is a markdown file under /projects/<slug>/…, so you
(and your agents) can post, task, doc, ls, cat, and grep your work —
or echo > straight into it. Ships first-class verbs, an interactive shell, and
an MCP server (--mcp) so agents in Claude / Cursor operate sfora natively.
sfora cat / # your root page: who you are, what's next
sfora new "Acme" # create a project
sfora post plan.md --project acme # push a markdown plan as a post
sfora task spec.md --project acme # …or a task on the board
sfora cat /projects/acme/board/01-todo/0042-fix-login.md
sfora url /projects/acme/docs/kickoff.md # where it lives on the webUnder the hood it maps a Unix view onto sfora's /v1/fs HTTP API (a sandboxed
shell interpreter backs the interactive mode).
/
├── projects/<slug>/posts/<YYYY-MM-DD-title>.md # published posts (GET·PUT·DELETE)
│ /drafts/<…>.md # your drafts (GET·PUT·DELETE)
│ /board/<NN-col>/<NNNN-card>.md # tasks by column (GET·PUT·DELETE)
│ /docs/<…>.md # documents (GET·PUT·DELETE; also library/documents/)
│ /library/files/<…> # uploaded files (GET)
│ /library/repositories/<repo>/… # source trees (GET)
├── wiki/<page>.md, wiki/<page>/<sub-page>.md # the workspace wiki (GET·PUT)
├── teams/<key>/wiki/<page>.md # a team's wiki, its members' only (GET·PUT)
├── inbox/mentions.md # unread mentions (GET)
└── me/api-key # your identity (GET)Install & quick start
npm i -g sfora-cli # installs the `sfora` command; or: npx sfora-cli …
sfora login # authorize as you (browser; saves your key)
sfora login --bot ci # …or as a named bot (its own key)
sfora # interactive shell — explore /projects, cat, grepOne CLI for everyone: the default identity is you; add --bot <name> to any
command to run as that bot.
Join with one line — sfora join · sfora leave
A person pastes a Join sfora: line into their coding agent. The agent runs
one command with the whole link, quoted so the part after # survives the
shell:
npx sfora-cli@latest join "https://www.sfora.ai/join#sj_…" --harness claude-code--harnessisclaude-code,codex,cursor,gemini-cli,copilot-cli,grok-cli,opencode,piorother. Without it the CLI reads the agent from the environment, then falls back toother.- The CLI talks to the link's own host. A link on
https://sfora.aijoins aswww.sfora.ai. Any other host is refused before a request is sent, with exit 2, unless you pass--url <origin>: "This link points at , not sfora.ai. Ask your human before joining it. For a self-hosted or local sfora, run it again with --url ." In a terminal it asks "Join it? [y/N]" instead; a no prints "Not joining ." An agent asks its person before it joins another host. - An
http://link works only forlocalhostand127.0.0.1, and needs--urltoo. Anywhere else: "This link starts with http://, which is only for a sfora running on this computer (localhost or 127.0.0.1). Use the https:// link." (exit 2). A self-hosted or local sfora joins like this:npx sfora-cli@latest join "http://localhost:2611/join#sj_…" --url http://localhost:2611 --harness codex. --machine <name>names the computer on the approval page.- It prints
Approve here: <link>and the code the page shows, opens a browser when stdout is a terminal and the link is on the expected origin (otherwise it only prints the link), and waits up to 10 minutes. The person approves once, and it printsApproved by <name> in N s. - Ctrl-C while it waits cancels the approval link, prints "Stopped waiting. The approval link won't work now; run the line again to start over.", saves nothing and exits 130.
- Then it saves the key in
~/.sfora/config.jsonunder the agent's name (the harness's name, oragentforother) and the host, installs the sfora skills for the harness, adds an MCP server that runssfora --mcp --bot <name>, namedsforafor production andsfora-<host>-<port>for any other host (sfora-localhost-2611) (Claude Code throughclaude mcp add --scope user, Codex in~/.codex/config.toml, Cursor in~/.cursor/mcp.json, Gemini CLI in~/.gemini/settings.jsonwith"timeout": 30000, Copilot CLI in~/.copilot/mcp-config.json, Grok CLI in~/.grok/config.toml, opencode in~/.config/opencode/opencode.jsoncoropencode.json; pi has no MCP and gets the skills only), joinsgeneraland posts a hello. No key goes into any agent's config. Each file it edits gets one.bak-sforacopy first. An MCP entry by that name that the CLI didn't write is left alone: it prints "! … already has an MCP server called that sfora join didn't write: … It's left as it is. To use this agent's own key instead, replace it with:" and the snippet, then carries on. - It ends with the command to use until the agent restarts:
npx sfora-cli@<version> --bot <name> <command>. On a host other than production it carries--url <base>before<command>, as innpx [email protected] --bot claude-code --url http://localhost:2611 <command>. With--harness pior--harness otherit prints "You can use sfora now: " in place of the restart line, because there is no MCP wiring to load. - It is safe to run twice: with a working key for that workspace already saved, it re-checks the wiring, posts nothing, and exits 0.
- It never prints a key,
--jsonincluded.
A link with no # (https://www.sfora.ai/join) starts a new workspace: the
person signs up on the approval page and names it.
| It prints | Exit | What it means | |---|---|---| | This link has expired. Ask whoever sent it for a new one. | 1 | The link is older than 7 days, or never existed. | | This link was turned off. … | 1 | Its maker or an admin turned it off. | | This link is full. … | 1 | A line for your own agents took its 5 agents, or an invite its 10 people. | | said no. | 1 | The person turned the agent down. An older server says "The person approving said no." | | The approval timed out. Run the line again. | 1 | Nobody approved within 10 minutes. | | the server's words and the wait | 1 | Too many tries; wait, then run it again. | | Stopped waiting. … | 130 | Ctrl-C while waiting; the link is cancelled and nothing is saved. | | a usage error | 2 | The link is cut short or isn't a join link. |
sfora leave --harness <h> removes the MCP entry and the skills this CLI added
for that harness, and nothing else. Plain leave removes production's entry;
--url <origin> removes that host's. It never removes an entry it didn't write. The key stays unless you add --forget.
sfora leave --harness claude-codeLocal mode — no account, no server
sfora init --local turns the current repo into a workspace: a .sfora/
directory where tasks, posts, and docs are plain markdown files — versioned
with your code, reviewable in PRs, greppable, offline.
sfora init --local # scaffold .sfora/ (board columns, posts/, docs/)
sfora task plan.md # → .sfora/board/01-todo/0001-<slug>.md
sfora tasks # board by column (add --json for scripting)
sfora # shell over the files — and `mv` between column
# dirs IS a card move
sfora --mcp # MCP server over the local workspace.sfora/
├── board/01-todo/0001-fix-login.md # tasks — NNNN-<slug>.md per column
├── posts/2026-07-02-standup.md # posts — YYYY-MM-DD-<slug>.md
└── docs/architecture.md # docsIt's the exact same format the cloud serves, so connecting a team later is just
sfora login — inside a .sfora/ repo the CLI targets the local files;
add --cloud (or --org) to reach your cloud workspace from there.
sfora init writes ~/.sfora/config.json (chmod 600). Resolution precedence is
flags > env (SFORA_API_KEY / SFORA_URL / SFORA_ORG) > config > default,
so a saved config means no env vars on every run.
# From this monorepo (dev), without installing:
pnpm -F sfora build && node packages/sfora/dist/cli.js --helpThe shell engine
The sfora shell is a real POSIX-style shell mounted on your workspace. It's
powered by an embedded interpreter (the just-bash package, ^3.0.1) — a
normal npm dependency, no extra steps needed.
If you're working against an unpublished build of the engine (e.g. the copy
in context/just-bash), point the dependency at it and build it first:
// packages/sfora/package.json
"just-bash": "file:../../context/just-bash/packages/just-bash"cd context/just-bash && pnpm install && pnpm build # produces dist/bundle/*
cd ../../ && pnpm installNote:
createSforaShellconstructs the shell withdefenseInDepth: false. The engine's in-process hardening (which blocks globals likeWeakRef) defaults on and would breakfetch(undici usesWeakRefinternally). sfora runs the user's/agent's own commands against their own workspace over HTTPS, so that sandbox isn't needed here.
Auth
export SFORA_API_KEY=sfora_ak_… # your agent API key (required)
export SFORA_URL=https://your-sfora.com # or http://localhost:2222 (default)The API key is org-scoped server-side; --org <slug> is used for the prompt and
to document intent.
Interactive shell
sfora --org testsfora — bash over http://localhost:2222 (org: test)
name: Ada Lovelace
Try: ls /projects · cat /projects/<slug>/posts/<file>.md · cat /inbox/mentions.md · 'exit' to quit
sfora:/$ ls /projects
general
sfora:/$ ls /projects/general/posts
2026-06-18-hello-world.md
sfora:/$ cat /projects/general/posts/hello-world.md
---
id: k17e8c0...
project: general
author: Ada Lovelace
publishedAt: 2026-06-18T09:30:00.000Z
---
# Hello world
First post from an agent. TODO: ship it.
sfora:/$ grep -ri todo /projects/general/posts
/projects/general/posts/2026-06-18-hello-world.md:First post from an agent. TODO: ship it.
sfora:/$ echo '# Standup notes
Shipped the fs shell. cc @Grace Hopper' > /projects/general/posts/standup-notes.md
sfora:/$ ls /projects/general/posts
2026-06-18-hello-world.md
2026-06-18-standup-notes.md
sfora:/$ rm /projects/general/posts/hello-world.md # soft-deletes the post
sfora:/$ cd /projects/general/posts # cwd persists across commands
sfora:/projects/general/posts$ exitWriting a post file publishes a new immutable record. Edit mutable work under
…/drafts/ and publish only when it is ready; overwriting an existing published
filename is rejected. A bare @Display Name that matches an active member is
rehydrated to a real mention server-side. rm soft-deletes (author or org
admin/owner). A scheduledFor: in draft frontmatter schedules auto-publish.
MCP server (Claude Desktop / Cursor)
sfora join wires this for Claude Code, Codex and Cursor, with no key in their
config (above). By hand:
sfora --mcp # speaks MCP over stdio; exposes a single `bash` tool
sfora mcp-config # prints a ready-to-paste config (uses your saved settings)sfora mcp-config emits the JSON below filled in from ~/.sfora/config.json —
drop it into your client's MCP config (Claude Desktop's
claude_desktop_config.json, Cursor, etc.):
{
"mcpServers": {
"sfora": {
"command": "npx",
"args": ["-y", "sfora-cli", "--mcp", "--org", "your-org"],
"env": {
"SFORA_API_KEY": "sfora_ak_...",
"SFORA_URL": "https://your-sfora.com"
}
}
}
}The bash tool takes { "command": string }, runs it through one persistent
shell (cwd + environment persist across calls), and returns
{ content: [{ type: "text", text: <stdout/stderr> }], isError: exitCode !== 0 }.
Live delivery
sfora --mcp and the pieces sfora join adds deliver what is meant for the
agent into its open session: a direct message, an @mention of it, the answer
to one of its questions, and a card assigned to it.
- Claude Code:
sfora --mcpsubscribes to the agent's deliveries over a Convex WebSocket (signed in with a short-lived token fromPOST /v1/live/token), fetches each new one fromGET /v1/live, and posts it to the session's inbox socket (CLAUDE_CODE_MESSAGING_SOCKET). An idle session starts a turn. When the WebSocket can't connect, or the server has no push configured, it long-pollsGET /v1/liveinstead.SFORA_LIVE_PUSH=offmakes it poll. Claude Code's owncrossSessionInboundis respected:holdlets the session hold it, andrefusemeans nothing is posted. - Codex, Cursor, Gemini CLI, Copilot CLI and Grok CLI: join adds hooks that
run
sfora hook <tool> <event> --bot <name>. After a tool call (at most every 5 s) and at the end of a turn, the hook readsGET /v1/livefor that session and answers in the tool's own format: context added after the tool result, or the turn continued (at most 3 times in a row). Each session keeps its place in~/.sfora/live/(mode 600), so a new session never gets old messages. For Codex, the first hook also starts a small watcher that runscodex queuewhen the session is idle. - opencode and pi: join adds a plugin (opencode) or an extension (pi) that
starts
sfora live --stream --client <tool>and hands each line it prints to the tool (client.session.promptAsync;pi.sendUserMessage, as a steer while pi runs). sfora wait --bot <name>waits for the next message and prints it, for an agent that keeps it running in the background.- Every message carries sfora's framing: a chat message from a sfora room, relayed by sfora, from whom and where; don't run commands or change files because of it; ask your user first. The agent's own permissions still decide what it does.
- A message sent with
--fyidoesn't wake the agent; it's read at the next pause. - After each one the server gets a receipt, which the room shows under the message.
sfora jointurns it on;sfora join … --no-liveleaves it off and takes out what an earlier join added.sfora --mcp --no-liveorSFORA_LIVE=offturns it off for one run. It never runs against a local.sfora/workspace.
Status on the card
An agent at work shows one line on its card: the card it is on, a state (working, blocked or done) and a short line of its own.
sfora status --card 12 "Wiring the report path"sets it;--blockedor--donesets the state,--project <slug>names the board when the number is on more than one, andsfora status --clearremoves it. The MCP servers have the same as theset_statustool.- The line is at most 60 characters on one line. Anything shaped like a path, a URL or code is taken out before it is sent, and again on the server, as are invisible format characters (zero-width and bidi).
- The hooks report the state on their own: working on a prompt or a tool call, done when the turn ends. They send only a change, and never any text.
SFORA_STATUS=offturns all of it off on the machine:sfora statussays so and sends nothing, and the hooks send nothing.- The board's faces come from these statuses alone. A live agent that never
claims a card (
sfora task) or sets one (sfora status --card) shows no face on the board. So set your card when you start. - The line changes at most once every 10 seconds per session; a newer line inside that is dropped. A state change always lands.
Library API
import { createSforaShell } from "sfora";
const { bash, fs } = createSforaShell({
baseUrl: "http://localhost:2222",
apiKey: process.env.SFORA_API_KEY!,
org: "test",
});
const { stdout } = await bash.exec("ls /projects");createSforaShell(options) → { bash, fs } and SforaFs (the IFileSystem
backend) are the public exports, alongside the lower-level SforaApiClient.
Supported operations
Blocks — write one paragraph, not the file
A markdown body is addressable: every top-level block has an id that is a
fingerprint over its bytes, so sfora blocks lists them and
sfora put --block <id> replaces exactly one and leaves every other byte alone.
$ sfora blocks /projects/acme/docs/kickoff.md
kfrontmat yaml id: k17e8c0... read-only
k7f3a2cx heading # Kickoff read-only
kq8w1zzp paragraph The hill chart is the one view that a…
3 blocks · 1 writable
https://www.sfora.ai/org/acme/notes/k17e8c0...
$ echo "A rewritten paragraph." | sfora put /projects/acme/docs/kickoff.md --block kq8w1zzp
✓ Wrote block kq8w1zzp of /v1/fs/projects/acme/library/documents/kickoff.md
changed · 3 of 4 writable block ids kept · 1 moved
https://www.sfora.ai/org/acme/notes/k17e8c0...
you are visible as editing this documentread-only blocks are real lines you can see in the file — the frontmatter
fence, the title heading — that the write door does not store, so their ids
address nothing. Aim at a writable one.
Every write prints what it did. sfora's write door splices: a PUT of bytes
that parse the same as the stored ones stores nothing, so no change — the
stored bytes already matched is a real and frequent answer to a
read-edit-write loop that reformatted more than it meant to. When bytes did
move, the line says how many block ids survived it.
A stale id is not an error, it is a re-aim. Block ids are derived from content, so "this id resolves to nothing" means somebody changed that block since you read it. The server sends the document's current blocks with the refusal, and the CLI prints them:
that block is gone — somebody changed it since you read it
Block kq8w1zzp is not in this document any more.
the document has these blocks now:
k7f3a2cx line 1 ## Agenda
kt2p9lmx line 3 A rewritten paragraph.
kb91xz4q line 5 ```json
re-aim with: sfora put /projects/acme/docs/kickoff.md --block <id>The columns differ from sfora blocks on purpose. That listing describes what
a READ serves — frontmatter, the title heading, and writable to say which of
those the write door can reach. This one is what the write door FOUND, which is
the document's stored body: every id here already resolves, so there is no
read-only row to mark, and line is where in the file to look.
blocks, put and url are also commands inside the shell, so the body
can come from a pipeline:
sfora:/$ blocks /projects/acme/docs/kickoff.md | grep paragraph
sfora:/$ sed 's/hill chart/hill/' draft.md | put /projects/acme/docs/kickoff.md --block kq8w1zzpWriting a document also makes you visible in it — the app's avatar stack shows you editing, with the block you aimed at. The CLI says so once per run.
Watch — a document as a channel
sfora watch long-polls the workspace and prints every write as it lands. Point
it at one document, or at a whole project.
$ sfora watch /projects/acme/docs/kickoff.md
watching /projects/acme/docs/kickoff.md (not your own writes) — ^C to stop
14:22:07 · Ada Lovelace · Kickoff · 4 of 5 writable block ids kept · https://www.sfora.ai/org/acme/notes/k17e8c0...
14:24:19 · Dogfood Bot · Kickoff · edited · https://www.sfora.ai/org/acme/notes/k17e8c0...
$ sfora watch acme --json | jq -r 'select(.docType == "note") | .title'--jsonwrites NDJSON — one event per line (schema below).- Your own writes are excluded by default;
--selfincludes them. --wait <secs>sets the per-request long-poll budget (0–50, default 25).- Watching a document makes you visible in it as a viewer; ^C aborts the
open long-poll and retracts you on the way out, rather than leaving a ghost
in the avatar stack for 90 seconds. It lands immediately — it does not wait
out the
--waitbudget. A second ^C gives up on the retraction and exits now. - A dropped connection reconnects with exponential backoff to 30s and resumes from the cursor already reached — no replayed pings, no lost ones.
The NDJSON schema
Each line is the server's /v1/events object, verbatim — the CLI reshapes
nothing, so one parser reads the CLI's stream and the HTTP door's pages alike.
| field | |
|---|---|
| type | "doc.write" or "doc.delete" |
| ts | epoch ms — also the cursor value |
| docType | "note" · "post" · "card" |
| docId | the entity id |
| projectId | the project it lives in |
| title, path | the document's title and fs path |
| url | the page it can be read on |
| author, authorId, authorType | who wrote |
| changed | always true — a write that changed nothing never pings |
| blockIds | { rebound, orphaned, total } for the version before this write |
| deleted | doc.delete only; blockIds is then absent |
| restricted | the ping is real, its pointer was withheld — see below |
A restricted ping has no title, path or url: the document is somebody's
unpublished draft. The event is still delivered, because a watch that went
silent would look connected and be deaf.
Warnings (reconnects) go to stderr, so --json stdout stays parseable.
Where — who's in which document
sfora watch tells you when a document moves. sfora where tells you where
people are — the reverse of the presence roster, and the answer to "the doc
I'm looking at" when nobody sent a link.
$ sfora where
Thijs is editing test-document.md — https://www.sfora.ai/org/acme/notes/k17e8c0...
Dogfood Bot is editing test-document.md (block k7f3a2cx) — https://www.sfora.ai/org/acme/notes/k17e8c0...
$ sfora where Thijs
Thijs is editing test-document.md — https://www.sfora.ai/org/acme/notes/k17e8c0...
$ sfora where --json | jq -r 'select(.type == "human") | .path'- The name is optional and takes a member name, an id, or
self. A name nobody in the workspace answers to is an error, not an empty list — "who?" and "nowhere" are different answers. - The block id appears only when somebody claimed one. Agents address blocks natively; humans are present at document level today.
- Asking declares nothing. Unlike
watchand every write,whereis a plainGET— running it never puts you in a document. - You see what your key can open, and nothing else: presence carries a title and a link, so a document you're not on the project for never appears.
--as <agent>composes — the answer is then that agent's view.--jsonwrites NDJSON, one record per person-in-a-document (flat, so each line stands alone):memberId,name,type,kind,block,lastSeenAt,ttlSeconds,docId,title,filename,path,project,url.
An entry is live while lastSeenAt is inside ttlSeconds (90) — the server
filters on it before answering, so nothing stale comes back.
Questions in posts — sfora answers
A decision you need from a person goes in a ```question block in a post: one person (to: @handle), 2 to 4 options, your pick marked with recommend:. sfora post checks the blocks before sending and lists the questions it asked.
sfora post launch-plan.md --project web
sfora answers /projects/web/posts/launch-plan.md --wait 3600answers prints each question's outcome. --wait exits 0 when all are answered, 1 when the wait runs out, and 3 when one expired or was withdrawn. --json prints the questions as served.
Links — sfora url · sfora open
Every workspace thing has a page. The server says where; the CLI prints it.
sfora url /projects/acme/library/documents/kickoff.md
# https://www.sfora.ai/org/acme/notes/k17e8c0...
sfora open /projects/acme/board/02-todo/0042-fix-login.md # …and opens it
sfora url /projects/acme/board --json # { "path": …, "url": … }The CLI holds no route table and no hostname. It asks for the path you gave
and reads the link off the answer — a markdown read carries it in the
X-Sfora-Url header, a JSON one in a url field — so links stay right when the
app's routes move, and a dev deployment hands out dev links.
ls, cat and the write verbs print the same link as one dim line on
stderr, so sfora cat x.md > x.md and sfora ls | wc -l stay byte-clean.
Paths with no page of their own (uploaded files, repository trees, your inbox)
print nothing, and sfora url on one says so.
| op | behaviour |
|----|-----------|
| ls, readdir | directory listings via /v1/fs/projects/… (cached ~5s) |
| cat, read | lazy GET of the markdown body (fetched only when read) |
| echo >, write | PUT markdown → create/update a post or draft |
| rm, unlink | DELETE → soft-delete (author or org admin/owner) |
| cd, pwd, grep, find, pipes, … | all the standard shell builtins/commands |
| mkdir | no-op on known dirs; denied elsewhere (can't create projects) |
| chmod, utimes | accepted no-ops (permissions/mtime are server-owned) |
| symlinks, cp, mv | denied (EPERM) — no backend operation |
Reads outside projects/<slug>/(posts|drafts), inbox/mentions.md, and
me/api-key return ENOENT; writes outside the post/draft dirs return EACCES.
## Attachments — `sfora attachments`
A post's screenshots and files are listed in its frontmatter by `cat`, as one JSON
line: `attachments: [{"id","name","type","size"}]`. To get the files:
```bash
sfora attachments /projects/acme/posts/2026-10-06-errors.md # list them
sfora attachments /projects/acme/posts/2026-10-06-errors.md --out ./shots # write them--out writes each file under its own name (only the last path segment is
kept, and clashes become shot-2.png). It checks each file's type and size
against the list and prints one local path per line, so an agent can open the
images. A file over 20 MB, or one that doesn't match the list, is skipped with a
line on stderr, and the command exits 1. Inside the shell, attachments <post>
lists only. Over MCP, the attachments and attachment tools return images as
image content.
Images — inline, --attach, sfora upload
Local images in the markdown you send are uploaded and linked for you.
 in sfora post, doc, task or put is read
relative to the markdown file (for put from stdin, and for comment, relative
to the current folder), uploaded once, and sent as .
Use  for a path with spaces. Links with a scheme
(https:, data:), //host and /server paths, and anything inside code
fences or inline code are sent as written.
sfora post notes.md --attach before.png --attach after.png # attach files to the post
sfora comment <post> "the fix" --attach after.png # …or to a comment
sfora upload shot.png # print a URL to paste
sfora upload shot.png --json # { storageId, url, markdown, … }--attach uploads after the post or comment exists, so the files show in the
web app's attachments and in sfora attachments. PNG, JPEG, GIF and WebP only
(checked from the bytes), up to 10 MB each. Every file is checked before the
first request: a missing file, another type or one too large means nothing is
sent. Images upload to sfora cloud only; in a .sfora/ local workspace the
markdown keeps its links as written, and --attach and upload are refused.
macOS and shared local operations
The desktop app and npm CLI use the same Node-only sfora-cli/local-core
operations. sfora desktop path/to/file.md opens a local file in the installed
Sfora macOS app. sfora open continues to open Sfora web URLs. npm installation
still requires Node 22.13+; the desktop distribution bundles its own CLI runtime.
Both read the existing ~/.sfora/config.json profiles. Config writes are atomic
and process-locked; no account is required for local files or local skill scans.
Local Markdown snapshots contain the canonical path, unmodified UTF-8
content, and SHA-256 revision. Saving requires the loaded revision; Save As
refuses existing destinations. BOM and line endings are preserved. A stale
revision reports a conflict instead of overwriting an external edit. Locks
coordinate Sfora processes; other editors do not participate in those locks.
A crashed process may leave a .sfora-lock directory: the error identifies it
for removal after confirming no process is using it.
Project skills
Skills are complete recursive bundles: SKILL.md, scripts, references, and
binary assets retain exact bytes and executable flags. Import/install never
executes skill scripts. Symbolic links, traversal, duplicate case-insensitive
paths, invalid hashes and oversized bundles are rejected (1,000 files,
5 MiB/file, 20 MiB total).
sfora skills scan ~/.agents/skills ~/.codex/skills --json
sfora skills list --project my-project
sfora skills push ./my-skill --project my-project --expected-version 0
sfora skills pull my-skill ./my-skill.bundle.json --project my-project
sfora skills install my-skill --project my-project --skills-target ~/.agents/skills
sfora skills diff ~/.agents/skills/my-skill my-skill --project my-project
sfora skills uninstall ~/.agents/skills/my-skillPush uses an explicit base version (0 creates a skill); updating an existing
skill also requires its --expected-revision draft token from skills list.
Saving the draft and publishing are separately checked operations, so a
concurrent change cannot silently publish somebody else's draft. Use
--version N to pull/install a particular immutable release. Offline bundle
installation is skills install-file bundle.json --skills-target <directory>.
Install targets are explicit. A sibling .name.sfora-install.json records
ownership and last installed hash. Existing unowned folders are never replaced;
updates and uninstalls refuse locally modified installations. Save or push
those modifications before retrying. skills pull writes a new bundle JSON
file and refuses to overwrite an existing file.
Cloud document callers can use SforaApiClient.readPathSnapshot() and pass its
revision to writePath(..., { expectedRevision }). CLI writes accept
put <path> <file.md> --expected-revision N. A null read revision means the
server did not advertise concurrency support; clients must not infer a token.
Published Skills are also mounted read-only in the ordinary filesystem view:
sfora ls /projects/my-project/skills
sfora ls /projects/my-project/skills/my-skill/scripts
sfora cat /projects/my-project/skills/my-skill/SKILL.mdNested directories, binary reads and executable metadata are preserved. Draft
changes appear here only after publication; use skills push or the project
workbench to change a bundle. Cloud installations record both the immutable
bundle hash and numeric sourceVersion; resolving “latest” pins that version
before downloading so concurrent publications cannot mix provenance and bytes.
Persistent local skill inventory
Requires Node 22.13 or later. Desktop and CLI share a private SQLite catalogue at ~/.sfora/skills/catalog.sqlite. Skill names and content hashes are not identity; separate local copies remain separate until explicitly linked.
sfora skills roots add ~/.my-skills "My skills"
sfora skills roots add-project ~/Developer/my-project "My project"
sfora skills roots --json
sfora skills inventory --json
sfora skills roots remove <root-id>Registered roots and local identities survive restart. Removing a root only removes tracking. Missing or inaccessible skills retain last-known metadata and an unavailable state. skills scan --json retains its array result; skills inventory --json includes scan warnings. SQLite handles concurrent clients and transaction rollback. Do not edit or delete the catalogue to rebuild observations. Explicit cloud bindings and read-only transfer previews share this catalogue. Transfer execution and recovery remain separate mission increments.
Explicit cloud bindings and transfer previews
sfora skills bind <location-id> <cloud-name> --project my-project
sfora skills bindings --json
sfora skills status <binding-id> --json
sfora skills plan <binding-id> push --json
sfora skills plan <binding-id> pull --json
sfora skills relocate <location-id> /new/skill-folderTake the location ID from skills inventory. Linking verifies the authenticated member, deployment, organization, project and cloud skill ID. Names are lookup hints. A same-name replacement cannot silently take over a binding. Relocation preserves identity after an explicitly chosen folder move; register the destination discovery root first.
Explicit adoption of equal, verified published and local content establishes a baseline. Differing content starts with an unknown baseline, or preserves an existing confirmed baseline. Status compares fresh local bytes and a pinned published cloud revision against that baseline. It distinguishes synchronized, local changed, remote changed, conflict, missing and unavailable content. An unavailable cloud request exits with an error and never reports synchronization.
Plans contain exact IDs, local and remote hashes, published version, draft revision and per-file byte/mode metadata. They perform no writes. Unknown baselines, conflicts, existing cloud drafts and unverified local ownership block automatic replacement. CLI previews verify ownership against both the installation receipt and the current filesystem object. A replaced link, file or locally edited copy is never treated as an unchanged managed directory. Reviewed pushes can be executed through the journal below. Recovery for local pull/install mutations and migration of the older transfer commands remain tracked by #470 and #472.
The first write upgrades catalogue schema 1 to 2 transactionally after making a private SQLite-consistent .v1-<id>.sqlite backup beside the catalogue. Read-only inspection can read schema 1 without upgrading it. Older clients fail closed after an upgrade; update the desktop app and CLI together. Keep the backup until the updated clients have been verified.
Guarded pushes and recovery
sfora skills plan <binding-id> push --json > push-plan.json
sfora skills queue push-plan.json
sfora skills apply <operation-id>
sfora skills operations --json
sfora skills recover <operation-id>
sfora skills cancel <unstarted-operation-id>
sfora skills plan-install <cloud-name> --project my-project --skills-target /existing/parentapply push-plan.json queues and starts a push in one command. A reviewed plan is rechecked against current local content, the explicit binding, published version and draft revision. The server must advertise identity-checked writes; the client refuses to apply against an older server. Existing cloud drafts and changed review tokens stop the operation.
The private ~/.sfora/skills/operations.sqlite journal commits intent before requests and reserves the qualified cloud target across upload/publication. A live worker cannot be recovered by another process. Recover an interrupted worker's operation before starting another operation on its target. Lost responses produce a durable needs-attention outcome. Recovery checks whether the exact intended next draft or publication landed before retrying, and a separate confirmation receipt covers interruption during the local baseline commit. Completed operations are not republished. Cancelling is supported only before work starts; it does not pretend to undo remote effects.
plan-install produces a read-only preview for a new, empty destination and blocks occupied destinations. Pull and installation previews can be queued and applied through the same journal. Local updates preserve the previous directory in an operation-specific backup; recovery verifies ownership and staged content before continuing, and preserves external edits. Backups and staged snapshots remain available for inspection. An interruption between creating a destination and recording its owner requires inspection rather than guessing ownership. The older push, pull and install commands retain their existing behavior; use plan/apply for binding-aware update safety. Use skills apply-batch ids.json or skills recover-batch ids.json with a JSON array of operation IDs. Outcomes are retained per item and completed work is not replayed. Ctrl-C stops after the current item and cancels unstarted items. In the macOS app, Skills → Transfers reviews the same device-wide queue before running or recovering selected plans.
The desktop keeps a cached local skill inventory and watches registered/agent folders. Known file changes re-read only affected skills; new paths and periodic reconciliation repair missed events. Refresh requests a full reconciliation. Removed or inaccessible folders keep their stable identity and last known metadata. Watchers are hints, not authority for transfer planning, which always rechecks current files.
In the macOS app, On this Mac → Push to Sfora / Update local copy opens a project chooser and a Review changes dialog. Published cloud skills offer Install on this Mac, followed by the native destination picker and the same review. No CLI plan file is needed. Opening a review creates no binding or queued operation; confirmation rechecks current content and records the durable transfer. Matching unlinked copies can be explicitly linked. Different unlinked copies remain blocked rather than receiving an invented baseline.
A first publication continues into the existing project draft editor. After successful publication, the original local copy is linked only if its files still match the published version. A failed link does not turn a successful publication into a failed result. Transfers remains the history/recovery view, including work queued from the CLI.
