Skip to content

Extract invest-gate subagent #35

@gringolito

Description

@gringolito

What

Extract the INVEST validation logic into a dedicated subagent at agents/invest-gate.md. Update every command that currently inlines INVEST validation to delegate to this agent.

Why

INVEST validation appears verbatim across add-backlog-item.md, migrate-backlog.md, refine-backlog-item.md, and validate-backlog.md. Any wording drift between copies is a real bug — refinement and creation can disagree on what "ready" means. Pulling the prompt into a subagent collapses 4 copies into 1, gives the orchestrator commands cleaner context, and lets us pin a cheap model (haiku) since the check is mechanical (six pass/fail letters with one-line justifications).

Sub-issue of #34.

In Scope

  • Create agents/invest-gate.md with frontmatter:
    • name: invest-gate
    • model: haiku
    • effort: low
    • disallowedTools: Write, Edit (read-only validator)
    • description: Returns PASS/FAIL per INVEST letter for a given issue body, with one-line reasoning per criterion. Invoke when a backlog item needs gating.
  • Body of the agent file: clear input contract (issue body text + optional metadata), explicit output schema (per-letter PASS/FAIL + reasoning + overall verdict), and the canonical INVEST table from the project docs as the rubric.
  • Update callers:
    • commands/add-backlog-item.md — replace inline INVEST check with delegation to invest-gate.
    • commands/migrate-backlog.md — same.
    • commands/refine-backlog-item.md — same. The pre-removal validation gate becomes an invest-gate call.
    • commands/validate-backlog.md — same. The INVEST-related part of the audit calls the agent per item.
  • Cross-reference: see Re-validate effort label in /refine-backlog-item pre-removal gate #12 (re-validate effort label in pre-removal gate) and Expand /refine-backlog to include issues with incomplete metadata #19 (refine-backlog incomplete metadata) — the contract here may need to flex to satisfy those callers.

Out of Scope

  • Other agents (separate sub-issues).
  • Adding new INVEST criteria or relaxing existing ones.
  • Refactoring the issue body shape (### What/### Why/etc.).

Acceptance Criteria

  • agents/invest-gate.md exists with the frontmatter above.
  • All four caller commands delegate to invest-gate and contain no inline INVEST prompt logic.
  • Output schema is documented in the agent body and consistent across callers.
  • In a scratch repo, /add-backlog-item for a deliberately under-specified item produces a per-letter FAIL report from invest-gate.
  • claude --debug shows the agent registered.
  • Existing CLAUDE.md consistency greps still pass.

INVEST Notes

  • Independent — agent design is self-contained; callers update mechanically.
  • Negotiable — model pinning may move from haiku to sonnet if smoke testing shows gaps.
  • Valuable — eliminates the largest single source of drift across command files.
  • Estimable — S.
  • Small — one new file, four small caller edits.
  • Testable — scratch-repo smoke test in Acceptance Criteria above.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    Status

    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions