Chat agent does not know its own repository or workspace, wasting turns rediscovering them #1178

Closed
opened 2026-10-27 13:39:20 +00:00 by sam · 0 comments
Owner

Asked to raise a GitHub issue, the agent spent roughly eight tool calls working out where it lives: pwd, a find over /home/sam/projects returning 139 lines, git remote -v, a grep over RELEASING.md returning 92 lines, and a failed read of a README that does not exist. It eventually located the repository and filed the issue correctly, but every one of those calls was rediscovering a fact the daemon already knows.

Sam's words: "Yep, thats frustrating AF!"

Why this is worth fixing structurally

It is not only slow and expensive. It is a correctness risk: an agent that has to guess which checkout it is looking at can act on the wrong one, and on this host more than one archie-core checkout exists. It also degrades every task that begins with orientation rather than work.

What to do

internal/gateway/BuildSystemPrompt renders templates/archie.md.tpl, which already carries an <env> block. Per CLAUDE.md that template is the single place instruction precedence, core rules and the <tools>/<env> blocks live -- personas are the STYLE layer only, so this belongs in the template, never in a persona string.

Put the facts the daemon already holds into <env>: the configured workspace path, the repositories under management with their forge and default branch, and the identity in use. Configuration is the source of truth ([repos] entries, chat.workspace); do not have the prompt claim anything the daemon cannot confirm, and do not hardcode paths.

Note the same rule that governs <tools> applies here: the block must be built from what the daemon actually has, because a prompt that names a repository the agent cannot reach is worse than silence -- the model will confidently act on it.

Acceptance Criteria

The chat agent knows its workspace path, managed repositories and identity without probing the filesystem; the block is rendered from live configuration rather than hardcoded; an empty or unconfigured value renders as explicitly unknown rather than as a plausible-looking default; a task that previously required filesystem archaeology to orient completes without it; tests assert the block reflects configuration and omits nothing the daemon knows.

Close reason

Rendered workspace, managed repos and operator identity into chat prompt block from live config (chat.workspace, [repos] forge+default branch, chat.operator). Added RepoEnv + SystemPromptConfig fields, wired config through TurnRunnerConfig->prepareTurn, added prompt and chatRepoEnv tests; explicit unknown handling for unset values. Gate: build/vet/lint clean; gateway+archied tests pass.


Imported from beads archie-core-8qpa · GitHub #632 · type feature · priority P2 · created 2026-08-24 · closed 2026-09-05

Asked to raise a GitHub issue, the agent spent roughly eight tool calls working out where it lives: `pwd`, a `find` over /home/sam/projects returning 139 lines, `git remote -v`, a grep over RELEASING.md returning 92 lines, and a failed `read` of a README that does not exist. It eventually located the repository and filed the issue correctly, but every one of those calls was rediscovering a fact the daemon already knows. Sam's words: "Yep, thats frustrating AF!" ## Why this is worth fixing structurally It is not only slow and expensive. It is a correctness risk: an agent that has to guess which checkout it is looking at can act on the wrong one, and on this host more than one archie-core checkout exists. It also degrades every task that begins with orientation rather than work. ## What to do internal/gateway/BuildSystemPrompt renders templates/archie.md.tpl, which already carries an `<env>` block. Per CLAUDE.md that template is the single place instruction precedence, core rules and the `<tools>`/`<env>` blocks live -- personas are the STYLE layer only, so this belongs in the template, never in a persona string. Put the facts the daemon already holds into `<env>`: the configured workspace path, the repositories under management with their forge and default branch, and the identity in use. Configuration is the source of truth ([repos] entries, chat.workspace); do not have the prompt claim anything the daemon cannot confirm, and do not hardcode paths. Note the same rule that governs `<tools>` applies here: the block must be built from what the daemon actually has, because a prompt that names a repository the agent cannot reach is worse than silence -- the model will confidently act on it. ## Acceptance Criteria The chat agent knows its workspace path, managed repositories and identity without probing the filesystem; the block is rendered from live configuration rather than hardcoded; an empty or unconfigured value renders as explicitly unknown rather than as a plausible-looking default; a task that previously required filesystem archaeology to orient completes without it; tests assert the block reflects configuration and omits nothing the daemon knows. ### Close reason Rendered workspace, managed repos and operator identity into chat prompt <env> block from live config (chat.workspace, [repos] forge+default branch, chat.operator). Added RepoEnv + SystemPromptConfig fields, wired config through TurnRunnerConfig->prepareTurn, added prompt and chatRepoEnv tests; explicit unknown handling for unset values. Gate: build/vet/lint clean; gateway+archied tests pass. --- _Imported from beads `archie-core-8qpa` · GitHub #632 · type feature · priority P2 · created 2026-08-24 · closed 2026-09-05_
sam added the mediumfeature labels 2026-10-27 13:39:20 +00:00
sam self-assigned this 2026-10-27 13:39:20 +00:00
sam closed this issue 2026-10-27 13:39:20 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: sam/archie#1178