Expand description
trusty-code — per-project Claude-Code-compatible MPM orchestration harness.
§Why
Each Claude-Code project needs a harness that is already wired to its
own .claude configuration: agents, skills, MCP connections, CLAUDE.md,
and permissions. trusty-code fills that role as an original, purpose-built
coding harness. It is the Claude-Code-native orchestration entry point —
driven by API, CLI, or TUI — that runs the PM main-loop, enforces the
mandatory workflow, and delegates authority to typed sub-agents according to
MPM protocols. Its non-coding sibling, trusty-agents, is a
separately-installable general-purpose orchestration platform for
personal-productivity workflows; the two share architectural DNA but
trusty-code is not extracted from it. Tracked under epic #2052.
§Design constraints
- Claude-Code compatible — reads
.claude/config, agents, skills, MCP descriptors,CLAUDE.md, and permission grants exactly as Claude Code does. - API / CLI / TUI driven — no hooks support (hooks are a Claude Code
shell-level feature;
tcodeoperates above that layer via its event bus). - Per-agent model routing — each agent may specify its own model, independently choosing between AWS Bedrock models and OpenRouter models.
- Single-instance per project — one
tcode serveprocess per.claude/root; multiple CLI or TUI clients may attach to it. - No
unwrap()in library code — all fallible paths use?withthiserror-derived error types (once errors exist to derive); application entry points useanyhow::Result.
§What
Phase 1 public surface (leaf/protocol modules, per #640):
events— process-global broadcast event bus.ipc— NDJSON IPC protocol for PM ↔ sub-agent communication.perf— per-phase latency + token/cost instrumentation.intent— pure-Rust heuristic intent classifier.progress— real-time phase progress reporter.build_info— monotonic build counter + version banner.
Phase 2 public surface (tools layer, per #641):
tools—ToolExecutor/AgentRunner/SearchProvidertraits,ToolRegistrydispatcher,DelegateToAgentTool,ToolResult.rbac—ServiceTier,UserIdentity, access-control helpers.
Phase 3 public surface (agents + LLM layer, per #642):
agents—AgentConfigTOML schema,discover_agents,load_all_agents.identity—CallerIdentity,RecallCeilingfor memory scoping.logging— tracing init helpers (init_tracing,init_tracing_for_test).
§Test
cargo test -p trusty-code — all modules carry their own unit tests.
Modules§
- agent_
loop - Multi-turn agent loop driving an LLM through tool calls to completion.
- agents
- Agent configuration loading.
- build_
info - Build and version tracking.
- catchup
- DOC-28 catch-up context injection for the PM prompt (#1762, PR2).
- cli_
client - Thin JSON-RPC client the
tcodeCLI binary drives against its own spawnedtcode serve --stdiochild (#2060, vision spec §4.4 “CLI as Thin Client” / Axiom 3 “API-First”). - events
- Process-wide broadcast event bus for real-time UI streaming.
- identity
- Caller identity hierarchy for memory scoping.
- intent
- Pure-Rust heuristic intent classifier for PM fast-pathing.
- ipc
- NDJSON IPC protocol for PM ↔ sub-agent communication.
- jsonrpc
- JSON-RPC 2.0 core: wire types (re-exported from
trusty_common::mcp) plus the tcode-specificRouter/RpcErrorextensibility seam. - llm
- LLM transports for trusty-code.
- logging
- Tracing and logging initialisation.
- memory_
envelope - Shared trusty-memory
tools/callenvelope helpers (#2424). - mode
- Harness mode selection:
daily-driver(default, token-efficiency consumption point) vsparity(full-schema benchmark mode) — #2059, vision spec §5.9. - perf
- Per-phase latency + token/cost instrumentation.
- progress
- Real-time phase progress reporter to stderr.
- project_
context - Project-context ingestion — load
CLAUDE.mdfor prompt injection (#1033). - prompt
- System-prompt assembly layer implementing the parity spec.
- provider
- Provider abstraction and per-agent model routing.
- rbac
- Role-based access control for tool execution.
- redundant_
run - Redundant full-suite test re-run suppression (#2682): the complement to
verify_gate— it stops the suite running MORE than it needs to. - run_
task tcode run-taskend-to-end execution layer (#1034, #1035).- runner
- In-process agent runner — the runtime execution layer (per #1029).
- serve
tcode servedaemon: STDIO + HTTP JSON-RPC transports + proof-of-life methods.- session
- Daemon-owned session model + attach/detach protocol (#2054, Axiom 4).
- skills
- Progressive-disclosure skill discovery for
.claude/skills/(#2069, vision spec §5.3, Resolved Decision #7). - task
- Daemon-owned task execution:
task.run+ background agent-loop orchestration (#2056, M1 control-plane cut line). - tools
- Tool system: traits, registry, and the delegate tool.
- verify_
gate - Verify-before-finish gate (#2279): rejects a premature
finish_taskwith a recoverable retry when a named test command was never run.
Constants§
- VERSION
- Version string, re-exported so integration tests can assert it without hard-coding the constant.