Skip to content

Quickstart

akougkas edited this page Sep 26, 2026 · 2 revisions

clio-coder wiki

Clio Coder is an open-source coding-agent harness for terminal, headless, ACP, and local GUI use, built on the Pi SDK. Typed tools support source reading, editing, search, execution, verification, and bounded worker dispatch. Action classes, autonomy settings, and safety policy determine which calls require operator approval. Session ledgers and run receipts retain execution evidence.

The codebase is organized by domain: src/domains/** implements dispatch, session, context, providers, safety, evidence, and memory; src/engine/** isolates model APIs and the Pi boundary; src/interactive/** supplies the terminal interface; src/tools/** defines the tool surface; and src/cli/** supplies command-line entry points. The worker protocol (src/worker) and composition root (src/entry) connect these layers.

Content pages include front matter naming their sources, symbols, and tests. Start with architecture, dispatch, project context, or safety.

Source installation

To inspect this developing reference alongside its source, build the v057 development branch:

git clone --branch v057 https://github.com/iowarp/clio-coder.git
cd clio-coder
pnpm install --frozen-lockfile
pnpm run install:local

The product release number and wiki version are independent. See the installation guide for requirements and other installation methods.

Pages

  • apps/clio-coder-gui/
    • Clio Coder GUI Client — The browser frontend for Clio Coder: a React SPA with React Router, TanStack Query, and pure decision modules for composer, approval, tool presentation, and Markdown rendering. The client separates pure policy (tested under node:test) from declarative components, and communicates with a local ACP server through a typed HTTP contract.
    • Apps clio coder gui server — The loopback Node.js backend that supervises ACP sessions, runs the Clio CLI, offloads blocking work to worker threads, and persists state for the Clio Coder GUI.
    • Apps clio coder gui tests — The GUI test suite splits into pure-logic node:test files that exercise client decision models and HTTP-harness integration tests that drive the ACP fixture child, plus the JSON-RPC fixture subprocess that simulates the engine.
  • Architecture — How Clio Coder composes its entry points, domain modules, tool surface, and worker runtime into a single coding agent process, and the static import rules that keep those layers decoupled.
  • Command-line surfaces — The argument-parsing and subcommand-dispatch entry point for every Clio Coder CLI surface, the configure wizard and target-selection flows, the headless main-agent runner, and the fleet authoring/execution and read-only run-viewer commands.
  • Core: settings schema, layered configuration, bus contracts, safe exec, and session routing — The shared foundation modules under src/core that every domain depends on: the one strict settings schema and its layered merge, the event-bus channel registry with payload contracts, the sandboxed subprocess runner, the session-local routing state machine, and the workspace file enumerator.
  • domains/
    • Domains agents — The agents domain loads and validates worker recipes, normalizes their specs, and exposes a catalog for dispatch, plus the typed result contracts and fleet-contract machinery that bound what each worker may claim and change.
    • Config Domain — The config domain owns the single strict startup settings snapshot, watches settings files for changes, classifies each changed leaf into a hot-reload / next-turn / restart-required bucket, and dispatches bus events so other domains can observe the new value without importing the config internals.
    • Context Domain — The context domain owns project handbook management, codemap indexing, bounded orientation, wiki generation, external agent-rule adoption, and the working-set eviction policies that control what the model sees on each request.
    • Dispatch domain — How Clio resolves, admits, executes, and finalizes worker runs: the dispatch bundle's contract, routing decisions, fleet execution, and gate-decision persistence.
    • Domains evidence — How Clio builds and reads forensic evidence bundles: the fixed eight-file layout, the canonical five-axis trust model, provenance admission, export-boundary redaction, and the CLI, tool, and observability entry points.
    • Domains extensions — The harness extension contract: extensions declare command tools and hook declarations in a strict manifest, the operator runtime forks a private child process to inject the API, and a generation-stamped snapshot system pairs extension packages with middleware hooks so no reader sees state from two generations. Compatibility and integrity checks gate every package before it can run.
    • Domains gateway — The MCP gateway: JSON-RPC 2.0 framing over stdio, the one-process client that spawns and manages MCP servers, the trust model for project-declared servers, and the metadata cache for tool catalogs.
    • Domains interop — How Clio detects installed coding agents (Claude Code, Codex, OpenCode, Pi, Antigravity and others), projects their resources into portable Clio packages, and wires them as ACP delegation peers behind an explicit consent record.
    • Domains lifecycle — Diagnose an install with clio-coder doctor, migrate versioned state through runPending, and detect the install method so an upgrade never offers npm-global reinstall to a source checkout.
    • Domains memory — Session-scoped task memory bank for background intervention, durable approved memory store for cross-session retrieval, and the promotion bridge between them.
    • Middleware Domain — The unified hook-based effect layer that observes five lifecycle events (before_tool, after_tool, turn_start, turn_end, on_compaction), evaluates ordered registrations, and emits effects that steer tool admission, reminders, continuations, and operator notices.
    • Domains mux — The pane multiplexing layer: the herdr socket client, dock controller for managed panes, Yazi file-manager integration, protocol floors, and the ownership rule that confines every mutating call to panes Clio created.
    • Domains observability — The observability domain folds dispatch bus events, session cost tracking, and forensic evidence builds into a single bounded snapshot consumed by product surfaces. It owns the live projection, the SQLite trace mirror, the cost tracker, and the out-of-turn usage ledger.
    • Domains plugins — How plugins are discovered, verified against recorded digests, installed into user or project scopes, and projected as resource roots for skills, prompts, agents, and fleets.
    • Prompt Compiler — How prompt fragments are loaded from disk, compiled into a stable system prompt, and cached for prefix reuse.
    • Domains providers — How Clio registers runtimes, probes targets, merges model capabilities, resolves runtime targets with context-window and thinking diagnostics, and stores credentials safely.
    • Domains quota — How Clio reads Anthropic, Codex, and Antigravity subscription usage into shared snapshots, caches them with a 5-minute TTL instead of a background timer, and feeds the footer, welcome banner, and usage overlay.
    • Domains resources — How Clio discovers, loads, and validates skills, prompt templates, and library packages, and the plan/apply/verify lifecycle that installs and removes them.
    • Domains safety — The safety domain classifies tool calls into action classes, evaluates them against damage-control rules, path policies, and project policy, maps them to autonomy dispositions, and audits every decision to a daily-rotated NDJSON ledger.
    • Domains scheduling — The scheduling domain owns three things: the session cost budget that scores spend against a ceiling, the fleet node registry that turns N machines into one pinnable capacity pool, and the local-capacity resolver that sizes worker concurrency under fleet.concurrency.
    • Domains session — The session domain owns the persistence vocabulary (SessionEntry union), the lifecycle manager, context token accounting, the compaction pipeline, the task board store, and the pure validating continuity fold. It defines what a session is on disk and how a turn flows from append to durable replay.
    • Vendored Tool Registry and Resolution — How Clio pins external terminal programs (herdr, yazi, croc), downloads and verifies them on request, and resolves them through a PATH-first ladder; including the dependency-free zip/tar.gz archive readers.
  • Engine — The worker-subprocess engine boundary: the unified loop guard, the pi-agent worker runtime with its Claude SDK and external-CLI branches, per-provider request payload patches, the Claude tool-safety mediator, and the session JSONL ledger.
  • engine/
    • Engine acp — Agent Client Protocol v1 server and delegation client for Clio, including the stdio JSON-RPC transport, permission mediation, headless command catalog, and ACP peer lifecycle.
    • Engine apis — The engine's provider API layer: two registered providers (OpenAI-completions and Ollama-native), a shared capacity-aware residency reconciler for local runtimes, a degraded-inference watchdog, and per-runtime adapters for LM Studio, llama.cpp router, and Ollama.
  • Entry point — The composition root that wires all domain bundles, resolves boot options, coordinates extension reloads, and activates the panes extension for interactive sessions.
  • Interactive — The terminal user interface that hosts the chat loop, the streaming transcript, the status footer, the theme, and the export/view surfaces, and how events flow through its composition root.
  • interactive/
    • Interactive overlays — The TUI's modal and full-screen overlay panels — the shared list browser, the Library browser with its plan/review/apply lifecycle, the Settings Center, the model picker, the ask-user interview, and the session-tree navigator — and how they take keyboard ownership, enforce their boundaries, and release them.
    • Interactive renderers — Pure functions that transform session data, tool results, and worker answers into terminal-styled text rows for the Clio TUI.
  • Scripts — Checkout-only tooling under scripts/: the drift/lint gate, the library and skill pinning pipeline, the release qualification gate, the Pi API surface diff, and the two operator-run benches.
  • tests/
    • Contract tests — The contract test suite that guards Clio's behavioral invariants, covering state isolation, dispatch routing, engine lifecycle, smoke tests of the built binary, ACP boundary behavior, and import-boundary enforcement.
    • Tests extended — The tests/extended suite: how the full end-to-end behavior of the TUI, compaction lifecycle, library import/browser, dispatch board, configure wizard, and rendering invariants is exercised under pnpm run test:full, and the isolation harness they share.
  • Tools — The tool system through which the model reads and mutates the world: registration, placement, lazy loading, observation reservation, and the individual tool implementations for context, gateway, code navigation, dispatch orchestration, monitoring, and script execution.
  • tools/
    • Tools data — Streaming inspection, selection, and validation of CSV/TSV, JSON, and JSON Lines files, exposed through the data tool; results carry explicit view flags and typed refusals.
    • Tools verify — The verify tool is a single EXECUTE entry point for declared verification: it lists package scripts, project catalog checks, and toolchain-derived checks, and runs one by exact id. It executes commands through safe-exec and attaches a three-part judgement (execution, validation, scientific validity) to every result.
  • Worker runtime — The worker subprocess runtime: NDJSON protocol, spec contract, control-lane steering, attestation frames, and the boundary invariants that keep the bulk lane and control lane separated.

Task routing

Area Page Sources Symbols Tests Validate
Clio Coder GUI Client Clio Coder GUI Client apps/clio-coder-gui/client/main.tsx, apps/clio-coder-gui/client/chat/tool-presentation.ts, apps/clio-coder-gui/client/chat/composer-model.ts, … presentTool, DraftStore, submitIntent, … apps/clio-coder-gui/tests/chat-tools.test.ts, apps/clio-coder-gui/tests/chat-composer.test.ts, … pnpm run check:gui && pnpm run test:gui
Apps clio coder gui server Apps clio coder gui server apps/clio-coder-gui/server/main.ts, apps/clio-coder-gui/server/app.ts, apps/clio-coder-gui/server/acp/supervisor.ts, … — apps/clio-coder-gui/tests/boundaries.test.ts, apps/clio-coder-gui/tests/worker-rpc.test.ts, … pnpm --filter @iowarp/clio-coder-gui test
Apps clio coder gui tests Apps clio coder gui tests apps/clio-coder-gui/client/chat/composer-model.ts, apps/clio-coder-gui/client/chat/turns.ts, apps/clio-coder-gui/client/chat/diff-model.ts, … — apps/clio-coder-gui/tests/chat-composer.test.ts, apps/clio-coder-gui/tests/chat-turns.test.ts, … pnpm run test:gui
Architecture Architecture src/core/domain-loader.ts, src/entry/orchestrator.ts, src/cli/index.ts, … bootOrchestrator, loadDomains, createGatewayTool, … tests/contracts/domain-lifecycle.test.ts, tests/boundaries/check-boundaries.ts, … node --import tsx tests/boundaries/check-boundaries.ts
Command-line surfaces Command-line surfaces src/cli/index.ts, src/cli/run.ts, src/cli/modes/print.ts, … — tests/extended-smoke/cli-core.test.ts, tests/contracts/targets-use-unused-model.test.ts, … node --import tsx tests/boundaries/check-boundaries.ts, …
Core: settings schema, layered configuration, bus contracts, safe exec, and session routing Core: settings schema, layered configuration, bus contracts, safe exec, and session routing src/core/config.ts, src/core/defaults.ts, src/core/settings-layers.ts, … ClioSettings, DEFAULT_SETTINGS, readStrictLayeredSettings, … tests/contracts/settings-controls.test.ts, tests/contracts/safe-exec-streaming.test.ts —
Domains agents Domains agents src/domains/agents/index.ts, src/domains/agents/spec.ts, src/domains/agents/recipe.ts, … AgentsDomainModule, AgentsContract, AgentRecipe, … tests/contracts/worker-boundary.test.ts, tests/contracts/dispatch-admission.test.ts, … pnpm test
Config Domain Config Domain src/domains/config/index.ts, src/domains/config/extension.ts, src/domains/config/contract.ts, … ConfigDomainModule, createConfigDomainModule, createConfigBundle, … tests/extended/config-mutation-admission.test.ts, tests/contracts/configuration-reference.test.ts pnpm run test:file -- tests/extended/config-mutation-admission.test.ts
Context Domain Context Domain src/domains/context/index.ts, src/domains/context/extension.ts, src/domains/context/contract.ts, … ContextContract, ContextDomainModule, createContextBundle, … tests/contracts/context-pressure.test.ts, tests/extended/context-map-seed.test.ts npx pnpm run test:file -- tests/contracts/context-pressure.test.ts tests/extended/context-map-seed.test.ts
Dispatch domain Dispatch domain src/domains/dispatch/index.ts, src/domains/dispatch/extension.ts, src/domains/dispatch/types.ts, … DispatchDomainModule, createDispatchDomainModule, createDispatchBundle, … tests/contracts/dispatch-admission.test.ts, tests/contracts/dispatch-routing-deterministic.test.ts, … pnpm run ci
Domains evidence Domains evidence src/domains/evidence/index.ts, src/domains/evidence/build.ts, src/domains/evidence/store.ts, … buildEvidence, EVIDENCE_FILES, inspectEvidence, … tests/contracts/evidence-tool.test.ts, tests/contracts/evidence-bundle-files.test.ts pnpm run test:file -- tests/contracts/evidence-tool.test.ts tests/contracts/evidence-bundle-files.test.ts
Domains extensions Domains extensions src/domains/extensions/types.ts, src/domains/extensions/discovery.ts, src/domains/extensions/command-schema.ts, … — tests/contracts/extension-resources.test.ts, tests/contracts/harness-extensions.test.ts, … pnpm test:file -- tests/contracts/extension-resources.test.ts
Domains gateway Domains gateway src/domains/gateway/mcp/index.ts, src/domains/gateway/mcp/protocol.ts, src/domains/gateway/mcp/client.ts, … createMcpStdioClient, McpClient, McpError, … tests/contracts/gateway-mcp.test.ts, tests/contracts/mcp-config-trust.test.ts, … pnpm run test:file -- tests/contracts/gateway-mcp.test.ts
Domains interop Domains interop src/domains/interop/index.ts, src/domains/interop/registry.ts, src/domains/interop/detect.ts, … INTEROP_AGENT_KINDS, detectInteropAgents, discoverInteropInventory, … tests/extended/interop-boundary.test.ts, tests/extended/interop-adoption.test.ts, … pnpm run test:file -- tests/extended/interop-boundary.test.ts
Domains lifecycle Domains lifecycle src/domains/lifecycle/index.ts, src/domains/lifecycle/doctor.ts, src/domains/lifecycle/migrations/index.ts, … runDoctor, runDoctorFleetChecks, runDoctorInteropChecks, … tests/contracts/upgrade-command.test.ts, tests/contracts/update-check.test.ts, … pnpm run test:file -- tests/contracts/upgrade-command.test.ts, …
Domains memory Domains memory src/domains/memory/index.ts, src/domains/memory/task-bank.ts, src/domains/memory/task-memory-policy.ts, … TaskMemoryBank, runTaskMemoryPolicy, proposeMemoryPromotion, … tests/extended/memory-scope.test.ts, tests/extended/memory-session-isolation.test.ts pnpm run test:file -- tests/extended/memory-scope.test.ts, …
Middleware Domain Middleware Domain src/domains/middleware/index.ts, src/domains/middleware/extension.ts, src/domains/middleware/runtime.ts, … — tests/contracts/middleware-hooks.test.ts pnpm test:file -- tests/contracts/middleware-hooks.test.ts
Domains mux Domains mux src/domains/mux/index.ts, src/domains/mux/contract.ts, src/domains/mux/socket-client.ts, … createMuxRuntime, createMuxClient, createDockController, … tests/contracts/panes-tool.test.ts, tests/extended/panes-watch.test.ts, … pnpm test -- --grep panes
Domains observability Domains observability src/domains/observability/index.ts, src/domains/observability/extension.ts, src/domains/observability/projection.ts, … — tests/contracts/observability-wiring.test.ts, tests/contracts/trace-store-legacy-tables.test.ts pnpm run test:file -- tests/contracts/observability-wiring.test.ts, …
Domains plugins Domains plugins src/domains/plugins/index.ts, src/domains/plugins/state.ts, src/domains/plugins/discovery.ts, … — tests/contracts/plugin-engine.test.ts, tests/extended/library-lifecycle.test.ts pnpm run test -- tests/contracts/plugin-engine.test.ts
Prompt Compiler Prompt Compiler src/domains/prompts/compiler.ts, src/domains/prompts/fragment-loader.ts, src/domains/prompts/extension.ts, … compile, compileWorker, loadFragments, … tests/contracts/self-knowledge-prompt.test.ts, tests/contracts/headless-approval-prompt.test.ts, … pnpm run test:file -- tests/contracts/self-knowledge-prompt.test.ts, …
Domains providers Domains providers src/domains/providers/index.ts, src/domains/providers/extension.ts, src/domains/providers/runtime-resolution.ts, … ProvidersDomainModule, createProvidersDomainModule, createProvidersBundle, … tests/contracts/capability-precedence.test.ts, tests/contracts/auth-storage-durability.test.ts, … —
Domains quota Domains quota src/domains/quota/registry.ts, src/domains/quota/service.ts, src/domains/quota/cache.ts, … createQuotaService, createQuotaCache, createQuotaSummaryFeed, … tests/contracts/quota-presentation.test.ts, tests/contracts/quota-tui.test.ts, … pnpm run test:file -- tests/contracts/quota-presentation.test.ts
Domains resources Domains resources src/domains/resources/index.ts, src/domains/resources/extension.ts, src/domains/resources/loader.ts, … ResourcesDomainModule, createResourcesBundle, createResourcesLoader, … tests/contracts/skills-catalog-view.test.ts, tests/contracts/skill-install.test.ts, … pnpm run test:file -- tests/contracts/skills-catalog-view.test.ts
Domains safety Domains safety src/domains/safety/index.ts, src/domains/safety/extension.ts, src/domains/safety/contract.ts, … — tests/contracts/safety-gates.test.ts, tests/contracts/test-runner-vocabulary.test.ts, … pnpm run test:file -- tests/contracts/safety-gates.test.ts, …
Domains scheduling Domains scheduling src/domains/scheduling/index.ts, src/domains/scheduling/contract.ts, src/domains/scheduling/extension.ts, … SchedulingDomainModule, createSchedulingBundle, createBudgetState, … tests/contracts/local-capacity.test.ts, tests/extended/fleet-lifecycle.test.ts pnpm run test:file -- tests/contracts/local-capacity.test.ts
Domains session Domains session src/domains/session/index.ts, src/domains/session/entries.ts, src/domains/session/extension.ts, … SessionEntry, SessionContract, SessionDomainModule, … tests/contracts/continuity-fold.test.ts, tests/extended/task-board-done.test.ts pnpm run test:file -- tests/contracts/continuity-fold.test.ts, …
Vendored Tool Registry and Resolution Vendored Tool Registry and Resolution src/domains/toolchain/registry.ts, src/domains/toolchain/install.ts, src/domains/toolchain/resolve.ts, … — apps/clio-coder-gui/tests/http-toolchain.test.ts, tests/contracts/doctor-yazi-repair.test.ts pnpm run test:gui
Engine Engine src/engine/loop-guard.ts, src/engine/worker-runtime.ts, src/engine/claude/sdk-runtime.ts, … createLoopGuardRegistration, startWorkerRun, startClaudeSdkWorkerRun, … tests/contracts/read-only-research-synthesis-budget.test.ts, tests/contracts/worker-boundary.test.ts, … node --import tsx --test tests/contracts/read-only-research-synthesis-budget.test.ts tests/contracts/worker-boundary.test.ts
Engine acp Engine acp src/engine/acp/server.ts, src/engine/acp/transport.ts, src/engine/acp/adapter.ts, … serveClioAcpAgent, createAcpHandshake, startAcpDelegationRun, … tests/contracts/acp-v1-basics.test.ts, tests/contracts/acp-permission-options.test.ts, … node --import tsx --import ./tests/harness/tmp-root.ts --test tests/contracts/acp-v1-basics.test.ts
Engine apis Engine apis src/engine/apis/index.ts, src/engine/apis/openai-completions.ts, src/engine/apis/ollama-native.ts, … — tests/contracts/lmstudio-load-profile.test.ts, tests/extended/ollama-residency.test.ts —
Entry point Entry point src/entry/orchestrator.ts, src/entry/boot-options.ts, src/entry/extension-reload.ts, … bootOrchestrator, BootOptions, createExtensionReloadCoordinator, … tests/extended/extension-reload-coordinator.test.ts, tests/contracts/cli-ignored-flags.test.ts, … pnpm run test:file -- tests/contracts/cli-ignored-flags.test.ts, …
Interactive Interactive src/interactive/index.ts, src/interactive/interactive-application.ts, src/interactive/chat-loop.ts, … startInteractive, createInteractiveApplication, createChatLoop, … tests/contracts/footer-active-statuses.test.ts, tests/contracts/context-live-budget.test.ts pnpm test:file tests/contracts/footer-active-statuses.test.ts, …
Interactive overlays Interactive overlays src/interactive/overlays/list-overlay.ts, src/interactive/overlays/library.ts, src/interactive/overlays/library-model.ts, … openListOverlay, ListOverlayView, openLibraryOverlay, … tests/contracts/overlay-render-fit.test.ts, tests/contracts/tui-library-ergonomics.test.ts, … node --import tsx --import ./tests/harness/tmp-root.ts --test tests/contracts/overlay-render-fit.test.ts tests/contracts/tui-library-ergonomics.test.ts
Interactive renderers Interactive renderers src/interactive/renderers/tool-execution.ts, src/interactive/renderers/worker-entry.ts, src/interactive/renderers/worker-answer.ts, … renderToolExecution, renderToolSubline, renderToolPreview, … tests/contracts/provider-error-presentation.test.ts, tests/contracts/worker-card-mutation-report.test.ts, … pnpm test
Scripts Scripts scripts/check-hygiene.ts, scripts/pin-skills.ts, scripts/pin-library.ts, … pinSkillsCatalog, generateLibraryMarketplace, renderLibraryMarketplace, … tests/contracts/configuration-reference.test.ts, tests/contracts/release-boundary.test.ts, … node --import tsx scripts/check-hygiene.ts
Contract tests Contract tests tests/harness/tmp-root.ts, tests/harness/scratch-env.ts, tests/harness/dispatch.ts, … registerFauxFromEnv, isolateClioEnv, makeScratchHome, … tests/contracts/dispatch-routing-deterministic.test.ts, tests/contracts/engine-lifecycle.test.ts, … pnpm test
Tests extended Tests extended src/interactive/dispatch-board.ts, src/interactive/overlays/library.ts, src/interactive/welcome-dashboard.ts, … createDispatchBoardStore, createDispatchBoardView, openLibraryOverlay, … tests/extended/rendering-invariants.test.ts, tests/extended/compaction-controls.test.ts, … pnpm run test:full
Tools Tools src/tools/registry.ts, src/tools/bootstrap.ts, src/tools/surface.ts, … ToolRegistry, ToolSpec, ToolSurface, … tests/contracts/run-script.test.ts, tests/contracts/code-nav.test.ts, … pnpm test
Tools data Tools data src/tools/data/index.ts, src/tools/data/shared.ts, src/tools/data/csv.ts, … inspectData, selectData, validateData, … tests/contracts/data-csv.test.ts, tests/contracts/data-json.test.ts, … pnpm run test:file -- tests/contracts/data-csv.test.ts, …
Tools verify Tools verify src/tools/verify/index.ts, src/tools/verify/catalog.ts, src/tools/verify/scripts.ts, … verifyTool, DeclaredCheck, DeclaredCheckKind, … tests/contracts/verify-numeric.test.ts, tests/contracts/verify-toolchain-checks.test.ts, … pnpm run test:file -- tests/contracts/verify-numeric.test.ts tests/contracts/verify-toolchain-checks.test.ts tests/extended/verify-perf.test.ts
Worker runtime Worker runtime src/worker/entry.ts, src/worker/protocol.ts, src/worker/spec-contract.ts, … WORKER_PROTOCOL_VERSION, CONTROL_FRAME_PREFIX, WorkerAttestation, … tests/contracts/worker-boundary.test.ts, tests/contracts/ledger-tool.test.ts, … —

Clone this wiki locally