feat(agents): per-type system_prompt_template in agents.json #451

Closed
opened 2026-04-27 13:48:58 +00:00 by claude-desktop · 0 comments
Collaborator

User story

As an operator, I want each agent type's system prompt to live as a template string in agents.json, with ${repo}, ${issue_number}, ${forgejo_url}, etc. interpolated, so that I can tune behaviour per role (e.g. "be terse", "always write tests first", "prefer Python") with no code edit.

Why: the prompt in agent-runner.ts:142 is hardcoded, identical for every agent type. Different roles need different framing — designer needs Penpot-specific guidance, reviewer needs review-specific framing, dev should be told to keep PRs small.

Acceptance criteria

Schema

  • agents.json::types.<TYPE>.system_prompt_template: string added
  • Template syntax: ${var} for safe interpolation; escape unknown vars (don't crash, render literally)
  • Available vars documented inline: repo, issue_number, forgejo_url, agent_name, agent_type, pr_number (when review-mode), parent_pr (when set)
  • Per-type defaults preserve current prompt text verbatim

Code

  • agent-runner.ts:142 reads template from resolved agent config, interpolates, falls back to current prompt if template missing
  • Test covering var interpolation, missing-var passthrough, and type-not-set fallback

Config sample

  • config/agents.json updated with the 6 default templates (boss/dev/reviewer/designer/design-reviewer/foreman)

Out of scope

  • Per-instance prompt override (a future extension — single template per type for now)
  • Prompt editor UI (Phase 4c)
  • Skill definitions / appendices (already a separate mechanism)

References

  • apps/server/src/domain/agent/agent-runner.ts:142
  • Audit category 1 (MED)
## User story As an operator, I want each agent type's system prompt to live as a template string in `agents.json`, with `${repo}`, `${issue_number}`, `${forgejo_url}`, etc. interpolated, so that I can tune behaviour per role (e.g. "be terse", "always write tests first", "prefer Python") with no code edit. **Why:** the prompt in `agent-runner.ts:142` is hardcoded, identical for every agent type. Different roles need different framing — designer needs Penpot-specific guidance, reviewer needs review-specific framing, dev should be told to keep PRs small. ## Acceptance criteria ### Schema - [ ] `agents.json::types.<TYPE>.system_prompt_template: string` added - [ ] Template syntax: `${var}` for safe interpolation; escape unknown vars (don't crash, render literally) - [ ] Available vars documented inline: `repo`, `issue_number`, `forgejo_url`, `agent_name`, `agent_type`, `pr_number` (when review-mode), `parent_pr` (when set) - [ ] Per-type defaults preserve current prompt text verbatim ### Code - [ ] `agent-runner.ts:142` reads template from resolved agent config, interpolates, falls back to current prompt if template missing - [ ] Test covering var interpolation, missing-var passthrough, and type-not-set fallback ### Config sample - [ ] `config/agents.json` updated with the 6 default templates (boss/dev/reviewer/designer/design-reviewer/foreman) ## Out of scope - Per-instance prompt override (a future extension — single template per type for now) - Prompt editor UI (Phase 4c) - Skill definitions / appendices (already a separate mechanism) ## References - `apps/server/src/domain/agent/agent-runner.ts:142` - Audit category 1 (MED)
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
charles/claude-hooks#451
No description provided.