fix(agent): load agents_md on the claude harness via CLAUDE.md#5000
fix(agent): load agents_md on the claude harness via CLAUDE.md#5000mmabrouk wants to merge 1 commit into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Design-doc-only PR (the implementation code is being stripped; this is the claude-harness Feedback I need before implementing: OK with the approach? For the claude harness, materialize the agent's instructions as Approve and I'll implement. |
a022d7c to
c1928f1
Compare
c1928f1 to
3abd36a
Compare
| persona-level instructions, mirroring Pi's two-layer split (AGENTS.md preamble + | ||
| append_system persona). This is A plus B, so it inherits B's block. | ||
|
|
||
| **Chosen: A.** It alone makes `agents_md` actually take effect on claude, with a one-line, |
|
The runner half of this fix is now open as #5007 (base This PR (#5000) now carries the SDK half: the |
… runner) Both halves of the agents_md/CLAUDE.md fix on one PR: - SDK half: interfaces.py filename mirror + test_environment_lifecycle.py. - Runner half: harness-aware instructions file in the runner (claude -> CLAUDE.md, every other harness -> AGENTS.md), on the renamed services/runner path (services/runner/src/engines/sandbox_agent/workspace.ts + its test). This folds in the runner half that was on the stale services/agent path in #5007 (now closed). Rebased onto big-agents f8765a9. Claude-Session: https://claude.ai/code/session_01WSp2LqKrEtXnm2fsPWuQWa
71ec91a to
58606a9
Compare
|
Rebased onto big-agents
#5007 (which had the runner half on the stale |
The bug
A
harness: claudeagent ignored its owninstructions.agents_md. Configure one with"You are a text summarizer, summarize the text, no questions back", paste a bare paragraph,
and it replies like the Claude Code CLI ("Is there something I can help with, a coding
task?") instead of summarizing.
It is a filename mismatch, not a dropped field:
agents_mdto a file namedAGENTS.mdin the run cwd, for everyharness (
services/agent/src/engines/sandbox_agent/workspace.ts).@anthropic-ai/claude-agent-sdk, whose memory loader auto-loadsCLAUDE.md/.claude/CLAUDE.md/CLAUDE.local.mdonly. It never readsAGENTS.md.settingSources: ["user","project","local"], so a rootCLAUDE.mdwould load. But none was written.Net effect: for claude the instructions were written to disk and never read, so the agent
fell through to Claude Code's default coding persona. Pi is unaffected — Pi reads
AGENTS.md.The fix
Choose the instructions filename by harness in the file-materialization step:
CLAUDE.md(the name the loader reads)AGENTS.md(unchanged)The filename is a materialization detail, not a wire detail — the wire already carries the
neutral
agentsMdstring and says nothing about a filename. So this lands in the runner(the sidecar), the wire contract and golden fixtures are untouched, and the Python harness
mapper does not change. The SDK's own materialization mirror (
Harness._provisioning) getsthe same one-line rule so both paths agree.
Before / after (claude harness)
AGENTS.mdCLAUDE.mdOut of scope (deliberately)
Delivering
agents_mdas an appended system prompt so it overrides the coding persona forverb-less input is a separate, larger fix:
sandbox-agent0.4.2 strips_metafromsessionInit, so the runner can't reach the adapter's append hook today. This PR makesagents_md"considered as project memory" (the "ignored" bug); the persona-strength lever istracked in the design doc.
Tests
services/agent/tests/unit/sandbox-agent-workspace.test.ts— new claude cases assertCLAUDE.md(and noAGENTS.md) on local + Daytona; existing Pi cases still assertAGENTS.md. Full runner suite: 402 passing;tsc --noEmitclean.sdks/python/oss/tests/pytest/unit/agents/test_environment_lifecycle.py— new claude caseasserts
_provisioningreturns{"CLAUDE.md": ...}. Full agents unit suite: 454 passing(wire golden unchanged).
Verifying live
The sidecar image bakes the runner, so this is only live after a sidecar rebuild/restart.
After redeploy: create a
harness: claudeagent whose instructions are a summarizer persona,send a bare paragraph with no instruction verb, and confirm it summarizes instead of asking
"how can I help?".
Design doc:
docs/design/agent-workflows/projects/builder-agent-reliability/agentsmd-claude-fix/README.mdhttps://claude.ai/code/session_01WSp2LqKrEtXnm2fsPWuQWa