Docs menu

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:

FlagDescription
--dry-runPreview what your workbench will do without making changes
--autoNo 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=stdioRun 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
--previewLaunch MCP Inspector to explore all active tools
--shareOpen 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
FlagDescription
--modelsFilter results to models only
--agentsFilter results to agents only
--verifyVerify 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]
FlagDescription
--sourceSource type for orientation content
--fileFile input for orientation
--modeOrientation mode
--fileSuffixFile 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
FlagDescription
--non-interactiveAuto-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_KEY is not supported — the Anthropic API is not OpenAI-compatible. To use Claude models, set OPENROUTER_API_KEY instead.

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).

CommandWhat it does
fai mcp installAdd a third-party MCP server to every detected agent's config
fai mcp uninstallRemove one again
fai mcp previewOpen MCP Inspector against an installed or ad-hoc server
fai mcp generateWrite .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>
FlagDescription
--outputDirectory to write skill files into (default: .claude/commands)
--serverMCP 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>]
FlagDescription
--nameServer name/key in configs (default: URL hostname)
--auth-envProject 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
--authBearer auth token. Only with --global or --session: at project level it's refused
--auth-headerCustom auth header name to send the token in (e.g. LANGSMITH-API-KEY)
--taskDeno task name or command for auto-start on fai boot
--globalWrite each agent's user-level config and the ~/.fai registry instead of the project's
--sessionInstall 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
FlagDescription
--globalTarget the global registry (~/.fai)
--sessionTarget the active fAI session
--remove-taskAlso 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
FlagDescription
--hostMCP server URL for ad-hoc preview (no registry lookup)
--auth-envName 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]
FlagDescription
--scopeScope for the petname
--listList all petnames
--removeRemove 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:

FlagDescription
--statusFilter by session status (active, sealed, archived)
--jsonOutput as JSON

sessions [id] capture flags:

FlagDescription
--fileFile to capture
--modeCapture mode
--fileSuffixFile suffix for capture
--sourceSource type
--agentTypeAgent 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.

FlagDescription
--intervalSeconds 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
FlagDescription
--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:

ModeWhat it servesDefault port
WebModeYour own request handler: pages, assets, anything. GET /health is reserved4969
APIModeEach 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 wrong4968
MCPModeThe same tools, as MCP tools. Over HTTP, GET /health answers without an MCP session, and "Stateless": true in --config gives each request its own serverstdio (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
FlagDescription
--jsonPrint 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
SubcommandDescription
onEnable usage analytics
offDisable usage analytics
statusShow 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>
FlagDescription
--sourceSource path for compaction

On fathym.com: fAI →

On this page