Expand description
Claude Code’s stream-json implementation of AI6’s AgentHandler contract.
§ai6-agent-claude
ai6-agent-claude implements AI6’s Guatiao AgentHandler for Claude Code. It uses
Claude’s stream-json interface over an AI6-owned terminal Run, preserving Claude’s
provider ID for resume.
§Features
- Establishes initial context as provider system instructions before sending the Mission prompt.
- Resumes an existing Claude Run and accepts later Cable/message text.
- Connects to the AI6 per-Run Cable MCP endpoint using environment-substituted Streamable HTTP configuration; the bearer token is not included in process arguments.
- Converts provider stream events into AI6
AgentEventvalues. - Reports a usage or rate limit, with its reset time when Claude gives one, as an
AgentEventof kindlimitso AI6 can park the Run instead of failing it. - Reports the tokens and cost of a finished turn, names the tools an assistant message calls,
and passes a Mission spend ceiling to Claude Code as
--max-budget-usd. - Holds a shell command that pushes to a protected ref, merges or releases until green ink
covers it, through a
PreToolUsehook (ai6 green-ink gate) passed with--settings. - Runs a Mission under
--permission-mode dontAskwith an explicit list of tools: reading, editing inside the working directory, AI6’s MCP servers and, atfieldand00clearance, commands. An Agent’shandler_settings(allowed_tools,denied_tools) change it, and a turn’s refused calls are reported as an event of kinddenied. - Leaves out the working directory’s own settings and
.mcp.jsonunless AI6 allows them (--setting-sources user --strict-mcp-config), so a checkout cannot add hooks or MCP servers to an Agent. - Starts an answer-only Run (
AgentStart::answer_only, for a Chief of Staff review) with--restricted, no built-in tools and no MCP servers, so it can read and answer and do nothing else.
§Installation
This crate builds both the Rust library and the Guatiao-loadable dynamic library. The
Guatiao provider entry point and ClaudeHandler implementation ship together.
§API overview
| Module | Purpose |
|---|---|
ai6_agent_claude | ClaudeHandler, ClaudeConfig and stream-json Run implementation |
§Development
Run cargo fmt --all --check, cargo test -p ai6-agent-claude,
cargo clippy --workspace --all-targets --all-features -- -D warnings, and
cargo build -p ai6-agent-claude from the AI6 workspace root. Workspace-wide Clippy keeps
the AI6 provider dependency’s feature-gated library code in its intended build context.
§License
MPL-2.0. See LICENSE.
Structs§
- Claude
Config - Claude Code AgentHandler configuration.
- Claude
Handler - Starts and resumes Claude Code streams for AI6 Agent Runs.
Constants§
- RECORD_
FORMAT - The format of Claude Code’s Run transcript.
Statics§
- guatiao_
declares - What this library declares, read by a scanner as data.
Functions§
- guatiao_
library_ ⚠entry - The symbol a
guatiaohost loads this library by.