Skip to content

Extending ​

Add an agent, a sandbox, a grader or a reporter by adding a file that implements a port, then registering it. No switch on an agent or sandbox name in core/.

AddWhereRegister
an agentsrc/adapters/agents/<id>/, which implements AgentAdapter (and if needed prepare, sandboxAccess, details)one line in agents in src/cli/registry.ts; the factory receives --auth, --out and the env
a sandboxsrc/adapters/sandboxes/<id>/, which implements Sandbox, with its isolation level and if needed Workspace.wrapone line in sandboxes; srt stays the default, defaultSandboxes holds the exceptions
an auth profilean entry in the agent's profiles, e.g. CLAUDE_AUTH_PROFILES in claude-code/credentials.tsnothing: the factory passes its profiles to resolveCredential
a grader, a fixturea function that returns a Grader (with prepare(workspace) if it compares to the state before the agent) / a Fixturenothing: pass it to .expect() / .fixture()
a suite formata SuiteLoader in src/loaders/the loaders array in src/loaders/index.ts
a reportera Reporter classthe reporters list in src/cli/run.ts
a report format (--report, --format)write(report, path) and path(ctrfFile) in src/reporters/<format>.tsone line in reportFormats in src/cli/registry.ts
a file derived from the CTRF, outside the CLIa CtrfSink (report, ctrfFile) => written path, like markdownSummary, htmlReportsinks of the CtrfReporter
  • A grader specific to one agent is allowed, named as such: noToolNamed("…", "mcp__claude_ai_").
  • A new output fed by run events is a Reporter (src/ports/reporter.ts). A file derived from a CTRF is a ReportFormat: it also works on an archived run (proctor report).
  • The conformance test: adding OpenCode produces no diff in src/core/, src/ports/ or src/adapters/mcp-stub/.

MCP stubs in a new agent ​

How a stub answers lives in src/ports/mcp-stub-rules.mjs; the stub program, its configuration and its call log live in src/adapters/mcp-stub/. Neither knows an agent. An agent adapter that runs AgentRunInput.mcpStubs only fills this table.

ObligationHow
Declare each stub as a stdio MCP servermaterializeStubs(input.mcpStubs, workspace) in prepare, then each entry { name, command, args } in the agent's own MCP configuration
Load only the declared serversthe agent's own switch
Let every permission level call a stub without approvalthe agent's own allow-list: a stub has no side effect
Run the stub inside the trial sandboxlet the agent spawn it; sandboxAccess(input) adds STUB_RUNTIME_DIR to readablePaths when input.mcpStubs is not empty
Fail a trial whose stub did not serve, mark the calls a stub answered (ToolCall.mcp)after the run, collectStubCalls(entries, workspace, toolCalls, parseToolName), where parseToolName reads (stub, tool) from the agent's own naming of MCP tools

See Architecture for the layers and their import boundaries.