Skip to content

Add the Claude Managed Agents harness - #229

Open
klesse413 wants to merge 1 commit into
yc-software:mainfrom
klesse413:cma-harness
Open

Add the Claude Managed Agents harness#229
klesse413 wants to merge 1 commit into
yc-software:mainfrom
klesse413:cma-harness

Conversation

@klesse413

@klesse413 klesse413 commented Aug 5, 2026

Copy link
Copy Markdown

we'd like to add claude managed agents (CMA, anthropic's sessions API for server-hosted agents) as a harness option.

given this is a meaty change, proposing the code changes directly and including what i would have otherwise included in adr in pr description.

why add another claude harness
qm runs on a brain/hands split: the model reasons somewhere, and tools run on the user's own durable sandbox. every harness so far is a local loop that wasn't designed for that split, so qm makes it work by wrapping the loop and swapping its tools for bridged ones. CMA's harness outside sandbox architecture fits qm's architecture natively. the brain is a hosted session on anthropic's servers, the hands are the user's sandbox, and tool calls come back to qm to run there, with the user's credentials, under the same command policy and approvals as the other harnesses. Claude is able to use its native bash tool, and it executes on the user's sandbox through the same bridged execute path.

advantages of cma
reliability comes from the split architecture itself. the conversation lives in the session store on anthropic's side and tools run in qm's sandbox, so there's no in-process loop to lose: a redeploy of qm mid-task can't drop the conversation, and a turn sends just one new message instead of the whole history. performance comes from the model working with its own tools: claude uses its own bash tool rather than a stand-in like the claude code harness needs to use. the adapter is just an http client, so there's no harness runtime to operate. and every session has a live trace in the claude console, which makes debugging an agent much easier.

cmaturndiagram

tradeoffs
the API is beta. changing the model, effort, or system prompt rotates the session, reseeded from qm's log so nothing is lost. steering queues between turns. and the conversation exists on both sides, since qm's log is the source of truth.

testing & verification
tests mock the CMA API at the http boundary and cover turn flow, resume and rotation, strict gate on both tool routes, work-queue lease, aborts, and retries. qm check verifies the environment and its key against the live API before any deploy.

Screenshot 2026-08-04 at 2 34 52 PM Screenshot 2026-08-04 at 2 54 17 PM

View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.

}
}

function toolOptions(opts: ClaudeHarnessOptions, turn?: HarnessTurnInput): PiToolsOptions {

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

felt not great to add a 4th exact copy, so refactored all of them to use the pi copy. but would be happy to remove this change if the copies are intentional

@Sibigi

Sibigi commented Aug 5, 2026 via email

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants