Skip to content

docs: teach gaze-reporter agent to use fix_strategy and assess testability - #51

Merged
jflowers merged 2 commits into
unbound-force:mainfrom
jflowers:reporter-fix-strategy-awareness
Mar 15, 2026
Merged

jflowers merged 2 commits into
unbound-force:mainfrom
jflowers:reporter-fix-strategy-awareness

Conversation

@jflowers

Copy link
Copy Markdown
Collaborator

Summary

  • Teach the gaze-reporter agent to consume fix_strategy and fix_strategy_counts from CRAP JSON output
  • Add testability assessment: for add_tests functions, the agent examines source file signatures and recommends interface extraction when concrete external types are detected
  • Prompt-only change -- no Go code modified

Motivation

Issue #50 identified that functions needing architecture changes (interface extraction, DI) before testing can't be detected mechanically without type-signature analysis. Rather than adding a complex static analysis feature to the CRAP engine, this teaches the AI agent to perform the assessment at report time using the Read tool.

When the agent encounters a function with fix_strategy: "add_tests", it reads the source file and checks if the function takes concrete external types (*http.Client, *sql.DB, *exec.Cmd). If so, it recommends refactoring before writing tests: "Refactor [function] to accept an interface instead of [concrete type], then add tests."

Changes

Two additions to internal/scaffold/assets/agents/gaze-reporter.md:

  1. Remediation Breakdown in CRAP mode: show fix_strategy_counts when present
  2. Fix Strategy Awareness in recommendations: map each strategy to specific guidance, with source-file inspection for testability barriers

Related

…ility

Update the gaze-reporter agent prompt to:
- Consume fix_strategy and fix_strategy_counts from CRAP JSON
- Show Remediation Breakdown in CRAP mode reports
- For add_tests functions, examine source file signatures via Read
  tool and recommend interface extraction when concrete external
  types are detected (addressing the 'needs architecture change'
  scenario from unbound-force#50)
- Map each fix_strategy to specific recommendation language

This leverages AI judgment for coupling assessment rather than
requiring static analysis in the CRAP scoring engine.
Sync the gaze-reporter prompt to all three locations:
- internal/scaffold/assets/agents/gaze-reporter.md (canonical)
- .opencode/agents/gaze-reporter.md (scaffold drift parity)
- internal/aireport/assets/agents/gaze-reporter.md (aireport drift parity)

Add retroactive openspec change artifacts (proposal, design, specs,
tasks) per the spec-first development requirement.
@jflowers
jflowers force-pushed the reporter-fix-strategy-awareness branch from 6ceea56 to d48e1c5 Compare March 15, 2026 14:33
@jflowers
jflowers merged commit a0b2485 into unbound-force:main Mar 15, 2026
5 checks passed
@jflowers
jflowers deleted the reporter-fix-strategy-awareness branch November 15, 2026 21:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

1 participant