fix(builtin): include cwd in system prompt

Agent was wasting turns exploring the filesystem because it didn't
know its working directory. Now the system prompt includes:
'Your working directory is: /path/to/cwd'
This commit is contained in:
2026-05-23 21:27:24 +08:00
parent f07a6daa30
commit 3c1f4a6dfa
@@ -63,6 +63,8 @@ export function buildBuiltinMessages(ctx: AgentContext): ChatMessage[] {
"", "",
"## Workflow", "## Workflow",
"", "",
`Your working directory is: ${process.cwd()}`,
"",
"You have tools available (read_file, write_file, run_command). " + "You have tools available (read_file, write_file, run_command). " +
"Use them to complete your task — read files, run commands, make changes as needed. " + "Use them to complete your task — read files, run commands, make changes as needed. " +
"When you are done, output your final response with the YAML frontmatter block as specified above. " + "When you are done, output your final response with the YAML frontmatter block as specified above. " +