release: real cwd in system prompt (#597)
Merged
SW
5mo ago+131+131+012345678901234567890123456789-10-10-01234567890123456789
Summary
handleChatWorkflowStreamreuses the already-connected sandbox to read realworkingDirectoryinstead of hardcodingDEFAULT_WORKING_DIRECTORYrunAgentStepbuilds a dynamic system prompt via newbuildAgentSystemPrompt(...)— adds an Environment section ("Working directory:.(workspace root), Use workspace-relative paths") so the agent knows it's in a sandbox without runningpwdon every turn- Wire format matches open-agents byte-for-byte for the cwd portion
- Branch-handling scope dropped: branch is always
mainin api's deployment, so per-session branch templating doesn't add information today (re-addable when meaningful per-session branches land)
Cutover progress
| # | Bundle | Status |
|---|---|---|
| 1 | C per-message cost/usage | ✅ |
| 2 | B subagent live progress + transcript | ✅ |
| 3 | A.7 real cwd in system prompt | ✅ this release |
| 4 | A.6 Anthropic prompt cache control | pending |
| 5 | A.4 forward Privy JWT as recoupAccessToken | pending |
Test plan
- 7 unit tests; full suite 3119/3119 pass
- E2E on preview: prompt "what's your cwd?" with no tools allowed returns "
.(workspace root)" (vs prod "system prompt does not contain") - Cross-validated against open-agents production — cwd answer matches byte-for-byte
🤖 Generated with Claude Code
Summary by cubic
Send the real sandbox working directory in the agent’s system prompt so the model knows it’s in the workspace without running pwd. The handler reads cwd from the connected sandbox and runAgentStep builds the prompt via buildAgentSystemPrompt.
- New Features
handleChatWorkflowStreamconnects the sandbox and uses itsworkingDirectory; falls back to the default if connect fails.runAgentStepusesbuildAgentSystemPromptto add an Environment section: "Working directory:.(workspace root); Use workspace-relative paths".- Matches open-agents wire format for the
cwdportion; removed branch templating (branch is alwaysmain).