Repository navigation
Claude Code as a provider, a task program and a crew seat - #2505
Merged
Merged
Conversation
Adds the claude program (internal/claudecode): codeaf starts the installed, signed-in claude CLI in the run's worktree with stream-json output, turns its tool calls into steps and its result into the ending. codeaf holds no Claude credential and sends nothing to Anthropic itself.
internal/claudeagent speaks the Agent SDK's control protocol to the person's own claude CLI: stream-json both ways, initialize, can_use_tool, interrupt, set_model, resume. The claude program now hears the task's messages mid-run, interrupts on stop, refuses pushes and publishes even over a user hook, and ends when Claude Code has answered everything and gone quiet.
… on the person's own sign-in A conversation or crew member on claude-code/* is a live Claude Code session in its folder, driven over stream-json as T3 Code does: a correction typed mid-turn is written into the running turn instead of cutting it, the session id is kept so a restart resumes it, and a conversation moved off and back hands Claude Code what it missed. Toolless small jobs are one-shot claude -p calls, so a codeaf with only Claude Code connected still names and summarises. A Worker pinned to Claude Code hands tasks to the claude program. providers.list gains the agent kind; keys.check reports the version and plan.
…he unlocks from a defer
… fits the fixed prefix Reading Claude Code's sign-in starts the program, and providers.list sits in front of models.list, so the reading now happens in the background and provider.changed redraws the row when it lands. The claude program's guide moves to programguide beside the others and is cut, with the sec guide's description, so four programs fit the prefix budget.
A conversation seated on Claude Code now holds codeaf's belt as mcp__codeaf__* tools answered through the control protocol, so it can propose a task, reach crew members and read the manual. Pictures on the newest message go to it as image blocks. The manual says what is still missing: approvals, effort, a tool list fixed at session start.
…ix its context weight Each step Claude Code runs itself is handed up the stream when it finishes and recorded as codeaf's own call and result, so the page draws it, the conversation keeps it and the next model reads it. codeaf's skills reach it as a session plugin, so it makes canvases, and its commands carry the conversation's agent identity. Its input is reported as what the turn's last call read, not the turn's sum, which had made codeaf compact a three-line conversation.
A turn now gives Claude Code every user-role message since the last answer, so codeaf's session note is no longer read as the person's words and their real message is no longer dropped. `codeaf connect claude-code` and the chat's /connect row run the app's connect: no key, three models with Claude's window.
A request that takes over a running turn says so at once, so codeaf's first-reply watch does not cut it during a long command; and one that carries nothing new only watches the turn again, rather than sending the person's newest message a second time.
It needs no key, so on a machine without the claude program its row could only say it is missing; /connect still lists it everywhere. This keeps the setup list flat at 40x10.
… installed, as setup does
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
The person's own signed-in Claude Code, driven the way T3 Code drives it (
claudeover stream-json with the control protocol,CLAUDE_CODE_ENTRYPOINT), in three places:claude(internal/claudecode): a task handed to Claude Code on a branch; messages typed on the task reach it mid-run; outward commands (push, PR, release, publish) refused on the wire via--disallowedTools, over the person's own hooks.claude-code(internal/claudemodel, kindagent, no key): a conversation or crew member onclaude-code/opus|sonnet|haikuis a live Claude Code session in its folder. Toolless small jobs (titles, summaries) are one-shotclaude -p, so codeaf with only Claude Code connected works with no OpenRouter key.claudeprogram.T3 Code parity, checked live:
sleep 12 && …did not stop it; both files made, one answer.--resumed after an engine restart (live: code word recalled across two engine processes).Wire:
providers.listgains kindagent;keys.checkreportsFound Claude Code <version> · signed in · <plan>;keys.setconnects with no key.Desk: Agent-Field/codeaf-desk#325.
Verified live (this laptop, Claude Max plan)
connect → models.list → conversation turn (file written) → crew member started on
claude-code/haikureports finished → steer mid-turn → resume across restart → Claude Code callsmcp__codeaf__manualandmcp__codeaf__propose_task; the task is proposed and queued.codeaf's tools on Claude Code
codeaf's belt is served to the Claude Code session as an in-process SDK MCP server (
--mcp-configtypesdk, answered over the control protocol'smcp_message), less the tools it has its own of. A call becomes atool_callsdelta, so codeaf's turn loop runs it with its own row; the next request answers the waiting MCP call and the same Claude turn continues. Pictures on the newest message go as image blocks (unit-tested, not yet live).Claude Code's own steps, in codeaf's format
Each step Claude Code runs itself (Bash, Read, Edit, MultiEdit, Write, Grep, Glob, LS, WebFetch, WebSearch) is handed up the stream when its result arrives, as a
codeaf_stepsdelta →provider.StreamStepsRan→session.recordStepsRan, and recorded as codeaf's own call and result (bash,read,edit, …) with its took line. So the page draws rows, a reopened chat redraws them, and the next model reads them in its history. Nothing is run twice. Ids carryclaude_code_, so the transport never re-tells Claude Code its own history.Canvas and skills
Conversations and tasks on Claude Code load the skills kept for codeaf and other programs (
.codeaf/skills,.agents/skills, Codex, Cursor…) as a session plugin (--plugin-dir, links, not copies), shown ascodeaf:<name>. The turn's request context carriesCODEAF_AGENT_DIDto the session, so a canvas it makes belongs to the conversation. Live: "mock up a landing page for Ember on a canvas" →codeaf:workaf-canvasloaded →canvas new/frame add/put/look→ canvas member is the conversation'sdid:key:….Fixed along the way (found live)
codeaf connect claude-code/ chat/connecttreated it as a key service (bare row, 128k window, local chat refused turns). Both now run the app's connect.claudeis installed.Verified live
codeaf chat): multi-turn, steering lands once (queued_command×1), file-change line.codeaf serve+chat --at, own relay): turns 1–3, steering,manualrow, context ≈ 51k.Not done / limits
/rewinddoes not put back files Claude Code changed (stated in the manual).--hostover ssh not exercised (the box's ssh codeaf predates this).Checks
make pr-ready BASE=origin/app/v3— pass onc6b458a22(laws + touched packages incl. tui3, session, provider, codeaf).🤖 Generated with Claude Code