COMMANDS
Commands
Install
deno run -A jsr:@fathym/fai/install
Installs fAI globally. Deno is required. After install, fai is available on your PATH.
fai
Start fAI in this project. It opens a session, starts its MCP servers, points each detected agent at your context, and captures your agents' work while it runs.
fai
Flags:
| Flag | Description |
|---|---|
--dry-run | Preview what your workbench will do without making changes |
--auto | No prompts and no session picker. Continues this project's most recently started session (one started or used in this folder), or creates one if there is none. Use --sessionId to pick one |
--mcp-session=stdio | Run the session MCP server over stdio, for MCP clients that start fAI themselves. Pair with --auto |
--mcp-session=<port> | Serve the session MCP server on this port instead of 4967. If the port is taken, fAI uses a free one and prints its address |
--mcp=<port> | Serve the general MCP server on this port instead of 4966. If the port is taken, fAI treats the general server as already running there and doesn't start another |
--preview | Launch MCP Inspector to explore all active tools |
--share | Open a public relay tunnel - share your workbench remotely |
--sessionId <id> | Skip the session picker and open a specific session |
fai detect
Scan for AI tools, local models, and synthesis providers installed on your system.
fai detect
fai detect --models
fai detect --agents
fai detect --verify
| Flag | Description |
|---|---|
--models | Filter results to models only |
--agents | Filter results to agents only |
--verify | Verify each detected item is reachable |
fai orient
Orient an AI agent with your project context. Generates the agent's context file from your current workbench state.
fai orient
fai orient [content]
| Flag | Description |
|---|---|
--source | Source type for orientation content |
--file | File input for orientation |
--mode | Orientation mode |
--fileSuffix | File suffix to use for generated context file |
fai synthesize
Configure your synthesis provider - the AI model that distills session captures into project knowledge.
fai synthesize
fai synthesize --non-interactive
| Flag | Description |
|---|---|
--non-interactive | Auto-configure without prompts |
--context-window <tokens> | Token budget per synthesis step. Overrides the provider default; match it to your model's context |
Supported providers: ollama, lmstudio, localai, azure-openai, openrouter, groq, openai, a custom OpenAI-compatible endpoint, or capture-only
Note:
ANTHROPIC_API_KEYis not supported — the Anthropic API is not OpenAI-compatible. To use Claude models, setOPENROUTER_API_KEYinstead.
See Local Models → for setup with Ollama, LM Studio, and cloud API keys.
fai mcp
Manage other MCP servers: install them into every detected agent, generate
skill files, and inspect them. These commands don't control fAI's own two
servers - those start with fai and fai serve (see MCP Server).
| Command | What it does |
|---|---|
fai mcp install | Add a third-party MCP server to every detected agent's config |
fai mcp uninstall | Remove one again |
fai mcp preview | Open MCP Inspector against an installed or ad-hoc server |
fai mcp generate | Write .md skill files from fAI's prompts |
fai mcp generate
Generate .md skill files from the fAI MCP server's prompts.
fai mcp generate
fai mcp generate --output <dir>
| Flag | Description |
|---|---|
--output | Directory to write skill files into (default: .claude/commands) |
--server | MCP server binary to connect to (default: the current fai binary) |
Connects to the general server (fai serve --mcp=stdio), lists all prompts, and writes one .md file per
prompt. Prompt / separators map to subdirectories: holonic/explain →
<output>/holonic/explain.md. Claude Code reads .claude/commands/ as slash
commands.
This runs automatically in the background on each fai session start for
Claude Code.
fai mcp install
Install a third-party MCP server into all detected coding agent config files.
fai mcp install <url> [--name <name>] [--auth-env <NAME> | --global --auth <token>] [--task <cmd>]
| Flag | Description |
|---|---|
--name | Server name/key in configs (default: URL hostname) |
--auth-env | Project level: the name of an environment variable holding the token. fAI writes a reference to the variable, not the token, and the agent reads it at runtime |
--auth | Bearer auth token. Only with --global or --session: at project level it's refused |
--auth-header | Custom auth header name to send the token in (e.g. LANGSMITH-API-KEY) |
--task | Deno task name or command for auto-start on fai boot |
--global | Write each agent's user-level config and the ~/.fai registry instead of the project's |
--session | Install only for the active fAI session; removed when the session ends |
Where it writes. With no flag, fAI writes each agent's project config file
(.mcp.json for Claude Code, .cursor/mcp.json, .vscode/mcp.json,
.gemini/settings.json, .junie/mcp/mcp.json) and the project registry at
.fai/mcp-servers.json. Agents without a project file get their user-level file,
and the output names them.
Tokens. A project file can end up committed, so fAI won't write a token into
one: --auth at project level is refused. Use --auth-env instead. Claude Code,
Cursor and Gemini can read the variable at runtime; agents that can't are skipped,
and the output says so. To give those agents the token, install with
--global --auth, which keeps it in your user-level config.
fai mcp install https://mcp.example.com/api --name my-server --auth-env MY_SERVER_TOKEN
fai mcp install https://mcp.example.com/api --name my-server --global --auth sk-abc123
fai mcp install http://localhost:3000/mcp --name github --task "npx @mcp/server-github"
With --task, the server auto-starts on each fai session. At project level, a
value that isn't already a deno task is added to your project's deno config as
fai:mcp:<name>, and the file's comments and formatting stay as they were. With
--global, the value is stored as given and no project file changes, so pass
the full command if the server should start in every project: a bare task name
only starts where that project defines it. If the project you're in doesn't
define the task, fAI skips it and says which task is missing.
--auth-env and the project-level refusal of --auth are in fAI 0.0.885 and
later.
fai mcp uninstall
Remove a third-party MCP server from every detected agent's config and from fAI's registry.
fai mcp uninstall <name>
fai mcp uninstall # pick from installed servers
| Flag | Description |
|---|---|
--global | Target the global registry (~/.fai) |
--session | Target the active fAI session |
--remove-task | Also remove the fai:mcp:<name> deno task (default: on) |
fai mcp preview
Launch MCP Inspector to preview an installed or ad-hoc MCP server.
fai mcp preview # interactive selector
fai mcp preview <mcpName> # named server
fai mcp preview --host https://host.mcp/server # ad-hoc
| Flag | Description |
|---|---|
--host | MCP server URL for ad-hoc preview (no registry lookup) |
--auth-env | Name of an environment variable holding the bearer token. The token stays off every command line |
--auth was removed in fAI 0.0.885: it put the token on the command line and in
your shell history. Use --auth-env instead.
When no flags or name are provided, shows an interactive selector of installed servers. If the selected server has an auto-start task, it is spawned automatically. Inspector runs until Ctrl+C.
fai petname
Manage memorable names for sessions.
fai petname
fai petname [name] [meaning]
| Flag | Description |
|---|---|
--scope | Scope for the petname |
--list | List all petnames |
--remove | Remove a petname |
fai sessions
Work with session history.
fai sessions list
fai sessions list --status <status>
fai sessions list --json
fai sessions [id] capture [content]
fai sessions [id] watch
sessions list flags:
| Flag | Description |
|---|---|
--status | Filter by session status (active, sealed, archived) |
--json | Output as JSON |
sessions [id] capture flags:
| Flag | Description |
|---|---|
--file | File to capture |
--mode | Capture mode |
--fileSuffix | File suffix for capture |
--source | Source type |
--agentType | Agent type context |
sessions [id] watch:
Captures a session's agent logs on a loop, the same way fai does while it
runs, until you press Ctrl+C. Use it to keep a session capturing without the
full fai start-up. With no [id], it uses FAI_SESSION_ID or asks you to
pick a session.
| Flag | Description |
|---|---|
--interval | Seconds between reads (default: 30) |
fai serve
Start fAI's general MCP server on its own, with no session. It serves fAI's
workflow prompts, docs, and skills, and appears in agent configs as fai-g.
fai serve # HTTP on port 4966
fai serve --mcp=4970 # HTTP on a port you pick
fai serve --mcp=stdio # stdio, for MCP clients that start it themselves
fai serve --share # HTTP plus a public tunnel
If the port is taken, fai serve tells you and exits instead of waiting. When
another program holds it, you get an error naming the port and exit code 1. When
fAI's own general server holds it, it says the server is already running on that
port and exits with 0.
fai already starts this server alongside your session, so you only need
fai serve when you want the prompts without a session. See
Running the loop with fAI's MCP.
fai run
Run a workbench: a TypeScript file whose default export is a workbench built with
Workbench() from @fathym/fai/workbenches.
fai run path/to/workbench.ts
fai run path/to/workbench.ts --mode API
fai run path/to/workbench.ts --mode API --config ./api.json
| Flag | Description |
|---|---|
--mode <name> | Which of the workbench's modes to start. Required when it declares more than one; with one, it's picked for you |
--config <json or file> | Input for that mode, as inline JSON or a .json, .yaml or .toml file |
--deno-config <path> | The workbench's deno.json(c). Found by walking up from the file when you leave it out |
The file can also be a published package: a jsr:, npm: or http(s): specifier
(fAI 0.0.885 and later). For example, Fathym's sample API workbench:
fai run jsr:@fathym/sample-api-workbench@0.0.5 --mode API
When the workbench
has its own deno.json(c), fAI runs it in a separate process with that config, so
its imports resolve the way its project expects.
Modes
A workbench declares its modes with .Modes({...}). The key you give each one is
the name you pass to --mode. The built-in modes:
| Mode | What it serves | Default port |
|---|---|---|
WebMode | Your own request handler: pages, assets, anything. GET /health is reserved | 4969 |
APIMode | Each method of the tools the workbench declares with .Tools({...}), as POST /{tool}/{method} (both lowercased), plus GET /openapi.json and GET /health. A request body that doesn't match the method's input gets a 400 listing what's wrong | 4968 |
MCPMode | The same tools, as MCP tools. Over HTTP, GET /health answers without an MCP session, and "Stateless": true in --config gives each request its own server | stdio (http uses 4967) |
If the Web or API port is taken, the next free one is used. These servers don't add authentication of their own: run them locally, or put them behind something that does.
A workbench with one Web mode:
import { WebMode, Workbench } from 'jsr:@fathym/fai@0.0.909/workbenches';
async function serve(req: Request): Promise<Response> {
const url = new URL(req.url);
if (url.pathname === '/') {
return new Response('<h1>UI Workbench</h1>', {
headers: { 'Content-Type': 'text/html' },
});
}
return new Response('Not Found', { status: 404 });
}
export default Workbench('ui-sample')
.Modes({ Web: WebMode({ handler: serve }) });
fai run ui-sample.ts starts it. It declares one mode, so there's no --mode.
To host a workbench for a team rather than on your own machine, see OpenX.
fai workbenches describe
Check a workbench and list its modes, and the settings each one takes, without starting it (fAI 0.0.885 and later).
fai workbenches describe path/to/workbench.ts
fai workbenches describe jsr:@fathym/sample-api-workbench@0.0.5 --json
fai workbenches describe path/to/workbench.ts --out describe.json
| Flag | Description |
|---|---|
--json | Print the description as JSON |
--out <file> | Also write the JSON description to this file |
--deno-config <path> | The workbench's deno.json(c). Found by walking up from a local file when you leave it out |
--timeout <seconds> | How long to wait before giving up (default 120) |
The workbench is loaded in a locked-down process. It doesn't see your environment
variables, and a file that writes to disk or reaches the network while loading is
reported as not valid rather than allowed to. It exits with 0 when the workbench is valid, 2
when it isn't (with the reasons), and 1 when describing it failed for another
reason, such as a timeout. For a clean JSON file, use --out.
fai telemetry
Turn anonymous usage analytics on or off, or check the current setting.
fai telemetry on
fai telemetry off
fai telemetry status
| Subcommand | Description |
|---|---|
on | Enable usage analytics |
off | Disable usage analytics |
status | Show whether analytics are on and your device ID prefix |
Analytics are on by default. See Privacy and Telemetry for what's sent and every way to turn it off.
fai uninstall
Remove fAI from your system.
fai uninstall
fai workstreams compact
Compact workstream history.
fai workstreams compact
fai workstreams compact --source <path>
| Flag | Description |
|---|---|
--source | Source path for compaction |
On fathym.com: fAI →