Skip to content

Delete the duplicated fallback system prompt once PromptAssembler is the only prompt path #1327

Closed

Description

@malibio

Overview

The agent's system prompt content exists in two places: the graph-seeded prompt nodes assembled by PromptAssembler, and a hardcoded fallback_system_prompt() that duplicates the same rules inline. The code comment on the fallback explicitly states it is an intentional, temporary duplication to be deleted once PromptAssembler is wired everywhere. This issue removes the duplication.

Problem Statement

  • fallback_system_prompt() in packages/agent/src/local_agent/prompt_templates.rs contains an inline copy of the TOOL STRATEGY / RESPONSE RULES content.
  • The canonical content lives in graph-seeded prompt nodes built by seed_prompt_nodes() and composed by PromptAssembler in packages/agent/src/prompt_assembler.rs.
  • The two can drift; the inline rules are an acknowledged stopgap (see the doc comment on fallback_system_prompt).

Proposed Solution

Confirm PromptAssembler is the only prompt-assembly path used in production (the agent loop selects: test override → graph assembler → fallback). Remove fallback_system_prompt() and its inline rule duplication. Retain only the minimal EMERGENCY_FALLBACK_PROMPT (in prompt_assembler.rs) for the corrupted/empty-database case, since that is a genuine safety net rather than a duplicate of the seeded rules.

Acceptance Criteria

  • Verified that production inference always uses PromptAssembler (no code path depends on fallback_system_prompt)
  • fallback_system_prompt() and its inline TOOL STRATEGY / RESPONSE RULES duplication are deleted
  • The minimal EMERGENCY_FALLBACK_PROMPT remains for the corrupted/empty-DB case
  • Any tests asserting on fallback_system_prompt are updated or removed appropriately
  • Code passes `bun run quality:fix`
  • Tests pass (`bun run test:all`)

Technical Specifications

Reference Files

  • Fallback to delete: `packages/agent/src/local_agent/prompt_templates.rs` (`fallback_system_prompt`)
  • Canonical assembler + emergency fallback: `packages/agent/src/prompt_assembler.rs` (`seed_prompt_nodes`, `EMERGENCY_FALLBACK_PROMPT`)
  • Selection logic: `packages/agent/src/local_agent/agent_loop.rs` (system prompt: override → assembler → fallback)

Parallelization

Scoped to prompt assembly. It deletes a function in prompt_templates.rs and touches the fallback branch in agent_loop.rs. It does not change message types, the tool registry, or daemon wiring, so it runs in parallel with the related issues. Coordinate the small agent_loop.rs edit with concurrent work in that file.

Activity

  1. malibio commented on Jun 5, 2026

    @malibio
    CollaboratorAuthor

    Frontend baseline: 134 test files passed, 3844 tests passed.

  2. self-assigned this
    on Jun 5, 2026
  3. added a commit that references this issue on Jun 5, 2026
    c578a93
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions