An open-source AI agent built to multiply your productivity.
Desktop app · Site · CLI · Server · ACP Server · Agent Core · Development
This project is under active development. Behavior and APIs may change between releases.
简体中文 · 繁體中文 · 日本語 · 한국어 · Deutsch · Français · Español · Português do Brasil · Русский
Spirit Agent is a tool-using coding agent that runs against a real project root. The same runtime powers a native desktop workspace and a terminal UI. Shared logic lives in TypeScript packages; hosts add platform-specific execution, discovery, and UI.
┌───────────────────────────────────────────────────────┐
│ Hosts │
│ ┌────────────────────────┐ ┌────────────────┐ │
│ │ Desktop CLI │ │ ACP Server │ │
│ │ (Electron) (Rust) │ │ stdio / ndJSON │ │
│ └──────┬────────────┬────┘ └────────┬───────┘ │
│ └────────────┘ │ │
│ ▼ │ │
│ packages/server │ │
│ sessions, streaming, approvals │ │
│ │ │ │
│ ▼ │ │
│ packages/host-internal │ │
│ discovery, tools, workspace ◀──────┘ │
│ │ │
│ ▼ │
│ packages/agent-core │
│ runtime, prompts, tool contracts │
└───────────────────────────────────────────────────────┘
packages/agent-core is the single source of agent semantics in this repository. Hosts consume it.
- Turn machine — streaming assistant output, tool rounds, compaction, and context usage tracking.
- Agent / Plan / Ask / Debug modes — full tool access, planning-only workflows, read-only Q&A with edit tools stripped at the contract layer, or structured debugging with log-point hypotheses.
- Subagents —
subagentdelegates focused work to child runs with their own tool surface. - Loop control — optional
finish_taskwhen multitask-style looping is enabled. - Rewind-friendly history — message archive formats designed for host-side rollback and resubmit.
Agent Core routes inference through multiple transports behind one runtime:
| Transport | Typical providers |
|---|---|
| OpenAI-compatible | OpenAI, DeepSeek, Moonshot, MiniMax, Volcengine, custom endpoints |
| Open Responses | OpenAI, SpaceXAI, Vercel AI Gateway, OpenRouter, Alibaba (Bailian) |
| Anthropic | Claude via Messages API |
Provider-native capabilities (for example web search on Open Responses, Alibaba built-in search and code interpreter) are injected through the request tools field.
Built-in tools are defined once in Agent Core (name, description, JSON Schema). Hosts implement execution:
- Workspace —
read_file,write_file/create_file/edit_file/delete_file,apply_patch(V4A on supported transports),glob,grep,ls - Shell —
shellwith host-controlled approval - Web —
web_fetch; search via provider tools or host search where configured - Delegation —
subagent - Planning —
create_plan, session TODO tools (todo_list,todo_write) - Multimodal —
generate_image,generate_video - Dreams —
dream_list,dream_read,dream_record,dream_update,dream_deletefor workspace memory summaries - LSP — language-server diagnostics surfaced after edits
Agent Core owns how the model sees project context:
- Rules —
AGENTS.md,.spirit/rule.md, and user rule slots merged into system sections. - Skills — catalog and active-skill injection; hosts discover files on disk.
- MCP — Model Context Protocol client, registry, and tool/resource/prompt bridging.
- Mode prompts — Agent, Plan, Ask, and Debug boundaries without re-listing tools in system text.
- Smoke suites — contract, runtime, and live provider checks under
packages/agent-core/src/smoke. - Eval harness — scenario comparison and judging for prompt or tool-definition changes (
pnpm run eval:comparefrom the repo root).
@spiritagent/agent-core is published to npm; packages/host-internal holds shared host-side discovery, extensions, marketplace, workspace helpers, and LSP orchestration used by Desktop.
The Desktop app is the primary graphical host: a workspace-bound IDE surface with a conversational agent.
- Docked panels — file explorer with Monaco editor, embedded terminal (Electron), Git changes and history, in-app browser for local dev servers.
- Sessions — multi-conversation history, worktree-per-session workflows, tool approval, subagent viewer, structured questionnaires, context usage, and rewind.
- Configuration — model providers and API keys, Skills and Rules, MCP servers, extensions marketplace, Dreams (beta), LSP, themes, and UI locale (10 languages including English, 简体中文, 繁體中文, 日本語, 한국어, Deutsch, Français, Español, Português do Brasil, and Русский).
- Platforms — Electron on Windows, macOS, and Linux; optional web host with remote pairing.
See apps/desktop/README.md for Desktop-specific development and layout.
The marketing and docs site is a Next.js + Fumadocs app (@spiritagent/site), deployed on Vercel.
pnpm run dev:siteSee apps/site/README.md for local development and the Vercel Git switch checklist.
The Rust CLI (spirit-agent) provides a terminal-first host with an optional Ratatui UI. It connects to the shared Spirit Server daemon over WebSocket and suits scripting, SSH sessions, and minimal environments.
pnpm run dev:cli # cargo run -p spirit-agentpackages/server (@spiritagent/server, bin spirit-server / spirit serve) is the shared daemon backend for first-party hosts. Instead of embedding a runtime in-process, CLI and Desktop attach to the same daemon over WebSocket (JSON-RPC 2.0) — so a session started in the terminal streams live into Desktop, and vice versa.
- Single source of truth — sessions, streaming events, tool execution, and approval queues live in the daemon; clients render and send input.
- Random-port instances — binds
127.0.0.1on an OS-assigned port and registers under{spiritDataDir}/server/instances/; clients attach to a live instance or spawn one.spirit-server ps/killmanage instances. - Bearer auth — home-level token at
{spiritDataDir}/server.token(mode 0600), accepted viaAuthorizationheader or?token=query;spirit-server rotate-tokenrotates it for new connections. - No new dependencies — the WebSocket layer (RFC 6455) is implemented in-package.
The CLI and Desktop are daemon-only for agent execution (see Epic #274). Desktop Web Host clients receive authenticated snapshot pushes from the Desktop host while agent execution remains in the daemon. Remote access (--hostname 0.0.0.0) is reserved for a future phase and off by default.
packages/acp-server is a thin adapter that exposes Spirit Agent as an Agent Client Protocol (ACP) server over stdio / ndJSON. Any ACP-compatible editor — such as Zed or JetBrains Junie — can connect to Spirit Agent as its AI coding engine without bespoke integration.
- Terminal Auth —
initializeadvertises atype: "terminal"auth method; clients runspirit-agent-acp --setupfor interactive provider configuration, then callauthenticatebeforesession/new. - Protocol surface —
initialize,authenticate,logout,session/new,session/prompt,session/cancel,session/close,session/set_mode. - Streaming & thinking — real-time
agent_message_chunkstreaming andagent_thought_chunkfor model reasoning output. - Permission bridge — tool approval via ACP
request_permissionwith allow-once / always-allow / reject options. - Slash commands — workspace and user Skills are advertised as
available_commands_update; typing/skill-nameactivates the skill and injects its instructions into the system prompt. - Local execution — tools run in-process via
NodeHostToolService(no JSON-RPC peer over stdio, which is reserved for ACP ndJSON).
- Build the server:
pnpm run build:acp-server - Add to your Zed
settings.json(no API key inenv):
"agent_servers": {
"Spirit Agent": {
"command": "node",
"args": ["path/to/packages/acp-server/dist/src/stdio-entry.js"]
}
}- When the client prompts for authentication, choose Run in terminal. It spawns
--setup, where you pick a provider, enter credentials, and select a model. - Setup writes to the shared Spirit data directory (
config.json+ OS keyring — same store as Desktop/CLI). After setup completes, the client callsauthenticate, thensession/new.
Manual setup (outside the editor):
node path/to/packages/acp-server/dist/src/stdio-entry.js --setup| Environment variable | Required | Description |
|---|---|---|
SPIRIT_ACP_WORKSPACE |
No | Workspace root (default: cwd from client) |
SPIRIT_ACP_DATA_DIR |
No | Spirit data directory (default: %APPDATA%/SpiritAgent or ~/.spirit-agent) |
Requirements: Node.js 24+, pnpm 11+ (enable via corepack enable). Rust toolchain required for CLI builds.
| Command | Description |
|---|---|
pnpm install |
Install workspace dependencies (run once at repo root) |
pnpm run dev:desktop |
Build shared packages and start Desktop (Vite + Electron) |
pnpm run dev:desktop:web |
Desktop renderer with browser web host |
pnpm run dev:site |
Start the marketing/docs site (Next.js) |
pnpm run dev:cli |
CLI with TUI |
pnpm run build |
Production build of agent-core, host-internal, server, acp-server, Desktop, and site |
pnpm run eval:compare |
Run eval comparison after agent-core changes |
apps/
desktop/ Electron + React host
site/ Marketing and docs site (Next.js, Vercel)
cli/ Rust CLI and TUI
packages/
agent-core/ Agent runtime, prompts, tool definitions, transports, MCP, eval
host-internal/ Shared host discovery, tools, extensions, LSP helpers
server/ Shared daemon backend (WebSocket + JSON-RPC) for CLI / Desktop / Web
acp-server/ ACP (Agent Client Protocol) server adapter for editor integration
scripts/ Release, eval, and repo automation
See CONTRIBUTING.md to get started. For architecture boundaries, commit conventions, and agent-core guidelines, also read AGENTS.md. To report security issues, see SECURITY.md.