# Goal: [Name] ## Fitness Function ```bash # Run this to get the current score: [command] ``` ### Metric Definition ``` score = [formula] ``` | Component | What it measures | |-----------|------------------| | **[name]** | [description] | ### Metric Mutability - [ ] **Locked** — Agent cannot modify scoring code - [ ] **Split** — Agent can improve the instrument but not the outcome definition - [ ] **Open** — Agent can modify everything including how success is measured ## Operating Mode - [ ] **Converge** — Stop when criteria met - [ ] **Continuous** — Run until human interrupts - [ ] **Supervised** — Pause at gates for approval ### Stopping Conditions Stop and report when ANY of: - [condition 1] - [condition 2] - [max iterations] iterations completed - [external dependency] becomes unavailable ## Bootstrap 1. [step] 2. [step] 3. Record the baseline: Starting score: [N] ## Improvement Loop ``` repeat: 0. Read iterations.jsonl if it exists — note what's been tried and what worked 1. [measure command] > /tmp/before.json 2. Read scores and component breakdowns 3. Pick highest-impact action from Action Catalog 4. Make the change 5. If verifiable: run targeted test 6. [measure command] > /tmp/after.json 7. Compare: if improved without regression, commit 8. If regressed or unchanged, revert 9. Append to iterations.jsonl: before/after scores, action taken, result, one-sentence note 10. Continue ``` #### If using dual scores: Insert a decision step between steps 2 and 3 above: > If [instrument metric] < [threshold]: fix the instrument first. > If [instrument metric] >= [threshold]: work on [outcome metric]. Commit messages: `[S:NN→NN] component: what you did` ## Iteration Log File: `iterations.jsonl` (append-only, one JSON object per line) ```jsonl {"iteration":1,"before":62,"after":65,"action":"Add tests for /api/users","result":"kept","note":"3 new integration tests, coverage +3%"} {"iteration":2,"before":65,"after":65,"action":"Refactor auth middleware","result":"reverted","note":"broke session handling, no score change"} ``` ## Action Catalog ### [Component 1] (target: [value]) | Action | Impact | How | |--------|--------|-----| | Add integration test for /api/users | +3 pts | Write test, run, verify coverage increases | | Fix N+1 query in orders endpoint | +5 pts | Add `.joinedload()`, benchmark before/after, confirm no API change | | Handle edge case for empty cart checkout | +2 pts | Add validation in `checkout.ts`, add test, run suite | ### [Component 2] (target: [value]) | Action | Impact | How | |--------|--------|-----| | Tune linter rule for false positives on acronyms | +2 pts | Add vocab file with project-specific terms, re-run linter, verify precision improves | | Add missing prop documentation for Modal | +4 pts | Read source types, generate prop table, paste into docs, verify with prop-check script | | Precompile validation schemas at build time | +3 pts | Run `ajv --compile` in build step, load compiled validators at startup, benchmark cold start | ## Constraints 1. **[constraint]** — [why] 2. **[constraint]** — [why] ## File Map | File | Role | Editable? | |------|------|-----------| | [file] | [role] | Yes / No / Written by [tool] only | ## When to Stop ``` Starting score: NN.N Ending score: NN.N Iterations: N Changes made: (list) Remaining gaps: (list) Next actions: (what a human or future agent should do next) ```