@massu/core 1.13.1 → 1.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +61 -2
- package/commands/_shared-preamble.md +15 -10
- package/commands/_shared-references/verification-table.md +9 -5
- package/commands/massu-checkpoint.md +31 -15
- package/commands/massu-data.md +24 -10
- package/commands/massu-golden-path/references/phase-5.5-production-verify.md +1 -1
- package/commands/massu-production-verify.md +7 -2
- package/commands/massu-rollback.md +26 -8
- package/commands/massu-security.md +29 -10
- package/dist/cli.js +979 -206
- package/dist/hooks/classify-failure.js +46 -0
- package/dist/hooks/cost-tracker.js +46 -0
- package/dist/hooks/incident-pipeline.js +46 -0
- package/dist/hooks/post-tool-use.js +46 -0
- package/dist/hooks/pre-compact.js +46 -0
- package/dist/hooks/quality-event.js +46 -0
- package/dist/hooks/session-end.js +702 -5
- package/dist/hooks/session-start.js +612 -56
- package/dist/hooks/user-prompt.js +296 -14
- package/package.json +3 -3
- package/commands/massu-autoresearch/references/eval-runner.md +0 -84
- package/commands/massu-autoresearch/references/safety-rails.md +0 -125
- package/commands/massu-autoresearch/references/scoring-protocol.md +0 -151
- package/commands/massu-autoresearch.md +0 -258
- package/commands/massu-command-health.md +0 -132
- package/commands/massu-command-improve.md +0 -232
- package/commands/massu-infra-audit.md +0 -187
|
@@ -1,151 +0,0 @@
|
|
|
1
|
-
# Scoring Protocol
|
|
2
|
-
|
|
3
|
-
## Score Calculation
|
|
4
|
-
|
|
5
|
-
```
|
|
6
|
-
score = (passing_checks / total_checks) * 100
|
|
7
|
-
```
|
|
8
|
-
|
|
9
|
-
Each eval check is binary: pass (true) or fail (false). No partial credit. No weighting.
|
|
10
|
-
|
|
11
|
-
---
|
|
12
|
-
|
|
13
|
-
## Baseline Measurement
|
|
14
|
-
|
|
15
|
-
Before any edits, establish the baseline:
|
|
16
|
-
|
|
17
|
-
1. Run the eval subagent 3 times with the same fixture and current command file
|
|
18
|
-
2. Score each run independently
|
|
19
|
-
3. Take the **median** score as the baseline
|
|
20
|
-
4. Log as iteration 0 in `autoresearch-runs.jsonl`
|
|
21
|
-
|
|
22
|
-
The median (not mean) accounts for subagent output variability without being skewed by a single outlier run.
|
|
23
|
-
|
|
24
|
-
**Note**: Only the baseline uses 3 runs. Per-iteration evals use a single run as an intentional cost tradeoff — running 3 evals per iteration would triple token usage. The single-run approach works because the simplicity gate and convergence criterion (3 consecutive passes) provide noise resistance.
|
|
25
|
-
|
|
26
|
-
---
|
|
27
|
-
|
|
28
|
-
## Accept/Reject Threshold
|
|
29
|
-
|
|
30
|
-
After each iteration edit:
|
|
31
|
-
|
|
32
|
-
- `score_after > score_before` → candidate for KEEP (subject to simplicity gate)
|
|
33
|
-
- `score_after == score_before` → DISCARD (no improvement = no noise-driven drift) — **exception**: if `net_delta < 0` (deletion), proceed to simplicity gate instead
|
|
34
|
-
- `score_after < score_before` → DISCARD (regression)
|
|
35
|
-
|
|
36
|
-
**Strict greater-than** is required for non-deletion edits. Equal scores are rejected to prevent random walk drift where the command changes without improving. The one exception is deletion edits (`net_delta < 0`) which maintain score — these proceed to the simplicity gate where the "deletion bonus" rule applies.
|
|
37
|
-
|
|
38
|
-
---
|
|
39
|
-
|
|
40
|
-
## Simplicity Gate
|
|
41
|
-
|
|
42
|
-
After scoring, before accepting a KEEP candidate:
|
|
43
|
-
|
|
44
|
-
1. Count `checks_improved`: how many checks flipped from false to true
|
|
45
|
-
2. Calculate `net_delta`: lines_added - lines_removed in the edit
|
|
46
|
-
3. Apply the simplicity criterion:
|
|
47
|
-
|
|
48
|
-
| checks_improved | net_delta | Decision | Log action |
|
|
49
|
-
|----------------|-----------|----------|------------|
|
|
50
|
-
| >= 2 | any | KEEP | `"kept"` |
|
|
51
|
-
| == 1 | > 0 | **REJECT** | `"rejected_complexity"` |
|
|
52
|
-
| == 1 | <= 0 | KEEP | `"kept"` |
|
|
53
|
-
| == 0 | < 0 | KEEP (if score maintained) | `"kept"` (simplification) |
|
|
54
|
-
| == 0 | >= 0 | DISCARD | `"discarded"` |
|
|
55
|
-
|
|
56
|
-
**Deletion bonus**: If `net_delta < 0` (change removes lines) AND `score_after >= score_before`, ALWAYS KEEP. Karpathy: "Improvement from deleting code = definitely keep."
|
|
57
|
-
|
|
58
|
-
---
|
|
59
|
-
|
|
60
|
-
## Convergence
|
|
61
|
-
|
|
62
|
-
The loop converges when score >= target (default 90%) for **3 consecutive iterations** where each iteration includes running an eval and scoring. The 3-consecutive requirement applies to iterations that produce a score (KEEP or DISCARD), not CRASH iterations. Three consecutive readings at target eliminates the possibility of a lucky single run.
|
|
63
|
-
|
|
64
|
-
---
|
|
65
|
-
|
|
66
|
-
## Score Logging Format
|
|
67
|
-
|
|
68
|
-
Append one JSONL line per iteration to `.claude/metrics/autoresearch-runs.jsonl`:
|
|
69
|
-
|
|
70
|
-
```json
|
|
71
|
-
{
|
|
72
|
-
"command": "[target command name]",
|
|
73
|
-
"iteration": 1,
|
|
74
|
-
"timestamp": "2026-03-20T10:30:00Z",
|
|
75
|
-
"score_before": 62.5,
|
|
76
|
-
"score_after": 75.0,
|
|
77
|
-
"action": "kept",
|
|
78
|
-
"edit_type": "add_worked_example",
|
|
79
|
-
"edit_summary": "Added before/after example for gap analysis section",
|
|
80
|
-
"checks": {
|
|
81
|
-
"has_executive_summary": true,
|
|
82
|
-
"has_score_table": true,
|
|
83
|
-
"has_massu_comparison": true,
|
|
84
|
-
"has_gap_analysis": false,
|
|
85
|
-
"has_action_items": true,
|
|
86
|
-
"has_source_credibility": true,
|
|
87
|
-
"mentions_specific_commands": true,
|
|
88
|
-
"has_implementation_path": false
|
|
89
|
-
},
|
|
90
|
-
"lines_added": 8,
|
|
91
|
-
"lines_removed": 2,
|
|
92
|
-
"net_delta": 6,
|
|
93
|
-
"cumulative_kept": 1,
|
|
94
|
-
"cumulative_discarded": 0,
|
|
95
|
-
"cumulative_crashed": 0,
|
|
96
|
-
"cumulative_rejected": 0,
|
|
97
|
-
"escalation_level": 0,
|
|
98
|
-
"consecutive_reverts": 0
|
|
99
|
-
}
|
|
100
|
-
```
|
|
101
|
-
|
|
102
|
-
### Field Definitions
|
|
103
|
-
|
|
104
|
-
| Field | Type | Description |
|
|
105
|
-
|-------|------|-------------|
|
|
106
|
-
| `command` | string | Target command name (e.g., "massu-article-review") |
|
|
107
|
-
| `iteration` | number | 0 = baseline, 1+ = edit iterations |
|
|
108
|
-
| `timestamp` | string | ISO 8601 timestamp |
|
|
109
|
-
| `score_before` | number\|null | Score percentage before this iteration's edit. `null` for baseline (iteration 0) since there is no prior score. |
|
|
110
|
-
| `score_after` | number | Score percentage after this iteration's edit |
|
|
111
|
-
| `action` | string | One of: `"baseline"`, `"kept"`, `"discarded"`, `"crashed"`, `"rejected_complexity"` |
|
|
112
|
-
| `edit_type` | string\|null | `null` for baseline/dry-run. Otherwise one of: `"add_rule"`, `"add_example"`, `"add_worked_example"`, `"restructure"`, `"promote"`, `"ban_pattern"`, `"merge_sections"`, `"split_section"`, `"reorder"`, `"simplify"` |
|
|
113
|
-
| `edit_summary` | string | One-line human-readable description of the change |
|
|
114
|
-
| `checks` | object | Map of check_id to boolean pass/fail |
|
|
115
|
-
| `lines_added` | number | Lines added by this edit |
|
|
116
|
-
| `lines_removed` | number | Lines removed by this edit |
|
|
117
|
-
| `net_delta` | number | `lines_added - lines_removed` |
|
|
118
|
-
| `cumulative_kept` | number | Running total of kept changes this run |
|
|
119
|
-
| `cumulative_discarded` | number | Running total of discarded changes this run |
|
|
120
|
-
| `cumulative_crashed` | number | Running total of crashed evals this run |
|
|
121
|
-
| `cumulative_rejected` | number | Running total of complexity-rejected edits this run |
|
|
122
|
-
| `escalation_level` | number | Current escalation level (0-3) |
|
|
123
|
-
| `consecutive_reverts` | number | Current consecutive revert count (resets on KEEP) |
|
|
124
|
-
|
|
125
|
-
---
|
|
126
|
-
|
|
127
|
-
## Final Summary Format
|
|
128
|
-
|
|
129
|
-
After the loop exits, produce a summary:
|
|
130
|
-
|
|
131
|
-
```
|
|
132
|
-
Score Trajectory:
|
|
133
|
-
[iteration 0] 62.5% (baseline)
|
|
134
|
-
[iteration 1] 75.0% KEPT "Added worked example for gap analysis"
|
|
135
|
-
[iteration 2] 75.0% DISCARD "Tried adding source credibility template"
|
|
136
|
-
[iteration 3] 87.5% KEPT "Promoted source credibility to mandatory section"
|
|
137
|
-
...
|
|
138
|
-
|
|
139
|
-
Per-Check Progression:
|
|
140
|
-
Check Baseline Final
|
|
141
|
-
has_executive_summary PASS PASS
|
|
142
|
-
has_score_table PASS PASS
|
|
143
|
-
has_massu_comparison PASS PASS
|
|
144
|
-
has_gap_analysis FAIL PASS <-- improved
|
|
145
|
-
has_action_items PASS PASS
|
|
146
|
-
has_source_credibility FAIL PASS <-- improved
|
|
147
|
-
mentions_specific_commands PASS PASS
|
|
148
|
-
has_implementation_path FAIL FAIL (hardest check)
|
|
149
|
-
```
|
|
150
|
-
|
|
151
|
-
This summary shows the optimization journey and identifies which checks responded to edits and which are structurally difficult.
|
|
@@ -1,258 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: massu-autoresearch
|
|
3
|
-
description: "When user wants autonomous command optimization, says 'autoresearch', 'optimize this command', 'run overnight improvement loop', or wants Karpathy-style iterative prompt optimization"
|
|
4
|
-
allowed-tools: Bash(*), Read(*), Write(*), Edit(*), Grep(*), Glob(*), Agent(*), Task(*)
|
|
5
|
-
---
|
|
6
|
-
name: massu-autoresearch
|
|
7
|
-
|
|
8
|
-
**Shared rules**: Read `.claude/commands/_shared-preamble.md` for POST-COMPACTION (CR-12), ENTERPRISE-GRADE (CR-14), AWS SECRETS (CR-5) rules.
|
|
9
|
-
|
|
10
|
-
# Massu Autoresearch: Autonomous Command Optimization Loop
|
|
11
|
-
|
|
12
|
-
## Objective
|
|
13
|
-
|
|
14
|
-
Iteratively improve a target command file by scoring output against an eval checklist, keeping improvements (git commit), reverting failures (git checkout), and repeating until convergence. Based on Karpathy's autoresearch pattern (42K GitHub stars).
|
|
15
|
-
|
|
16
|
-
---
|
|
17
|
-
|
|
18
|
-
## ARGUMENTS
|
|
19
|
-
|
|
20
|
-
```
|
|
21
|
-
/massu-autoresearch [command-name] # Default: 20 iterations, 90% target
|
|
22
|
-
/massu-autoresearch [command-name] --max-iterations N # Custom iteration cap
|
|
23
|
-
/massu-autoresearch [command-name] --target-score N # Custom target (default 90)
|
|
24
|
-
/massu-autoresearch [command-name] --no-limit # NEVER STOP mode (cost cap only)
|
|
25
|
-
```
|
|
26
|
-
|
|
27
|
-
**Arguments from $ARGUMENTS**: {{ARGUMENTS}}
|
|
28
|
-
|
|
29
|
-
---
|
|
30
|
-
|
|
31
|
-
## THREE-FILE ARCHITECTURE
|
|
32
|
-
|
|
33
|
-
| Role | File | Mutable? |
|
|
34
|
-
|------|------|----------|
|
|
35
|
-
| **Target** (train.py) | `.claude/commands/[command].md` (or `[command]/[command].md` for folder-based) | YES — agent edits this |
|
|
36
|
-
| **Eval** (prepare.py) | `.claude/evals/[command].md` | **NO — IMMUTABLE** |
|
|
37
|
-
| **Instructions** (program.md) | This file | **NO — agent follows this** |
|
|
38
|
-
|
|
39
|
-
The target command is the ONLY file the agent may edit. The eval checklist and these instructions are READ-ONLY.
|
|
40
|
-
|
|
41
|
-
---
|
|
42
|
-
|
|
43
|
-
## NON-NEGOTIABLE RULES
|
|
44
|
-
|
|
45
|
-
1. **ONE change per iteration** — single-variable perturbation only. Never batch multiple edits.
|
|
46
|
-
2. **NEVER edit the eval file** — `.claude/evals/[command].md` is immutable during runs.
|
|
47
|
-
3. **NEVER edit lines containing CR-*/VR-* references** — these encode incident-learned safety rules. See `references/safety-rails.md` for protected line patterns.
|
|
48
|
-
4. **ALWAYS backup before first iteration** — save original to `.claude/metrics/backups/[command]-autoresearch-[timestamp].md.bak`
|
|
49
|
-
5. **git commit on improvement / git checkout on regression** — tristate handling (see below).
|
|
50
|
-
6. **Tristate results**: KEEP / DISCARD / CRASH — crashes do NOT count toward stagnation.
|
|
51
|
-
7. **NEVER STOP mode** (when `--no-limit` passed): "Once the experiment loop has begun, do NOT pause to ask the human if you should continue." Run until convergence, cost cap (500K tokens), or manual interrupt (Ctrl+C). Default mode uses `--max-iterations` cap.
|
|
52
|
-
|
|
53
|
-
---
|
|
54
|
-
|
|
55
|
-
## TRISTATE RESULTS
|
|
56
|
-
|
|
57
|
-
Every iteration produces one of three outcomes:
|
|
58
|
-
|
|
59
|
-
| Outcome | Condition | Action |
|
|
60
|
-
|---------|-----------|--------|
|
|
61
|
-
| **KEEP** | `score_after > score_before` AND passes simplicity gate | `git add [target] && git commit -m "autoresearch([cmd]): [summary]"` — new baseline |
|
|
62
|
-
| **DISCARD** | `score_after <= score_before` OR fails simplicity gate | `git checkout -- [target]` — revert to baseline |
|
|
63
|
-
| **CRASH** | Eval subagent errored or produced unparseable output | Log the crash. Do NOT count toward stagnation. Retry once with simplified edit. If still failing, count as DISCARD. |
|
|
64
|
-
|
|
65
|
-
Crash handling details: see `references/safety-rails.md`.
|
|
66
|
-
|
|
67
|
-
---
|
|
68
|
-
|
|
69
|
-
## SIMPLICITY CRITERION
|
|
70
|
-
|
|
71
|
-
Apply the simplicity gate per `references/scoring-protocol.md`. Key principle (Karpathy): "Marginal improvement + added complexity = reject. Improvement from deleting code = definitely keep."
|
|
72
|
-
|
|
73
|
-
---
|
|
74
|
-
|
|
75
|
-
## "THINK HARDER" GRADUATED ESCALATION
|
|
76
|
-
|
|
77
|
-
Replaces CR-37 immediate bail. When stuck, escalate before giving up. Consecutive revert counter resets to 0 after any KEEP.
|
|
78
|
-
|
|
79
|
-
| Level | Trigger |
|
|
80
|
-
|-------|---------|
|
|
81
|
-
| **Level 1** | 3 consecutive reverts |
|
|
82
|
-
| **Level 2** | 5 consecutive reverts |
|
|
83
|
-
| **Level 3** | 8 consecutive reverts |
|
|
84
|
-
| **BAIL** | 10 consecutive reverts |
|
|
85
|
-
|
|
86
|
-
Per-level strategies: see `references/safety-rails.md`.
|
|
87
|
-
|
|
88
|
-
---
|
|
89
|
-
|
|
90
|
-
## CONVERGENCE CRITERIA
|
|
91
|
-
|
|
92
|
-
The loop stops when ANY of these conditions is met:
|
|
93
|
-
|
|
94
|
-
| Condition | Default | Overridable? |
|
|
95
|
-
|-----------|---------|-------------|
|
|
96
|
-
| Score >= target for 3 consecutive iterations | 90% | `--target-score N` |
|
|
97
|
-
| Max iterations reached | 20 | `--max-iterations N` or `--no-limit` |
|
|
98
|
-
| Stagnation bail (10 consecutive reverts after Level 3) | Always active | Not overridable |
|
|
99
|
-
| Cost cap (estimated cumulative token usage) | 500K tokens | Not overridable |
|
|
100
|
-
|
|
101
|
-
---
|
|
102
|
-
|
|
103
|
-
## LOOP CONTROLLER
|
|
104
|
-
|
|
105
|
-
### Initialization (runs once)
|
|
106
|
-
|
|
107
|
-
1. **Parse arguments**: Extract command name, max iterations, target score, no-limit flag
|
|
108
|
-
2. **Validate files exist**:
|
|
109
|
-
- Target: `.claude/commands/[command].md` (or `.claude/commands/[command]/[command].md` for folder-based)
|
|
110
|
-
- Eval: `.claude/evals/[command].md`
|
|
111
|
-
- Fixture: `.claude/evals/fixtures/[command]/input-01.md`
|
|
112
|
-
3. **Resolve target path**: Determine actual file — `.claude/commands/[command].md` (flat) or `.claude/commands/[command]/[command].md` (folder-based). Store as `TARGET_PATH` for all git operations.
|
|
113
|
-
4. **Create git branch**: `git checkout -b autoresearch/[command]-[YYYY-MM-DD]` (if exists, append `-2`, `-3`, etc.)
|
|
114
|
-
5. **Create backup**: Copy target to `.claude/metrics/backups/[command]-autoresearch-[timestamp].md.bak`
|
|
115
|
-
6. **Measure baseline**: Run eval 3 times, take median score. Log as `"iteration":0` in `autoresearch-runs.jsonl`
|
|
116
|
-
7. **Initialize state**: `consecutive_reverts = 0`, `escalation_level = 0`, `cumulative_kept = 0`, `cumulative_discarded = 0`, `cumulative_crashed = 0`, `cumulative_rejected = 0`
|
|
117
|
-
|
|
118
|
-
### Per-Iteration Loop
|
|
119
|
-
|
|
120
|
-
For each iteration `i` from 1 to max_iterations (or unlimited if `--no-limit`):
|
|
121
|
-
|
|
122
|
-
**Step 1: Read current state**
|
|
123
|
-
- Read target command file (current version after any prior keeps)
|
|
124
|
-
- Read eval checklist (immutable)
|
|
125
|
-
- Read fixture input
|
|
126
|
-
- Review failing checks from previous iteration (or baseline)
|
|
127
|
-
|
|
128
|
-
**Step 2: Hypothesize improvement**
|
|
129
|
-
Based on failing checks and escalation level, choose ONE edit:
|
|
130
|
-
- What check are we targeting?
|
|
131
|
-
- What edit type? (add rule, add example, restructure, promote, ban pattern)
|
|
132
|
-
- What specific change? (exact text to add/modify)
|
|
133
|
-
|
|
134
|
-
**Step 3: Apply edit**
|
|
135
|
-
- Use Edit tool to make ONE change to the target file
|
|
136
|
-
- Count lines added and removed
|
|
137
|
-
|
|
138
|
-
**Step 4: Run eval**
|
|
139
|
-
Read `references/eval-runner.md` for the eval subagent protocol.
|
|
140
|
-
|
|
141
|
-
Spawn an eval subagent with:
|
|
142
|
-
- The CURRENT target command text (after edit)
|
|
143
|
-
- The eval checklist
|
|
144
|
-
- The fixture input
|
|
145
|
-
|
|
146
|
-
Extract: score percentage, per-check results, failing check names.
|
|
147
|
-
|
|
148
|
-
**Step 5: Score and decide**
|
|
149
|
-
- Compare `score_after` to `score_before` (baseline or last kept score)
|
|
150
|
-
- Apply simplicity criterion
|
|
151
|
-
- Determine outcome: KEEP, DISCARD, CRASH, or REJECTED_COMPLEXITY
|
|
152
|
-
|
|
153
|
-
**Step 6: Act on decision**
|
|
154
|
-
|
|
155
|
-
| Decision | Git Action | State Update |
|
|
156
|
-
|----------|-----------|--------------|
|
|
157
|
-
| KEEP | `git add [target] && git commit` | `score_before = score_after`, `consecutive_reverts = 0`, `cumulative_kept += 1` |
|
|
158
|
-
| DISCARD | `git checkout -- [target]` | `consecutive_reverts += 1`, `cumulative_discarded += 1` |
|
|
159
|
-
| CRASH | Log crash, retry once simplified | `cumulative_crashed += 1` (consecutive_reverts unchanged) |
|
|
160
|
-
| REJECTED_COMPLEXITY | `git checkout -- [target]` | `consecutive_reverts += 1`, `cumulative_rejected += 1` |
|
|
161
|
-
|
|
162
|
-
**Step 7: Log iteration**
|
|
163
|
-
Append to `.claude/metrics/autoresearch-runs.jsonl`. See `references/scoring-protocol.md` for format.
|
|
164
|
-
|
|
165
|
-
**Step 8: Check convergence**
|
|
166
|
-
- If score >= target for 3 consecutive scored iterations (KEEP or DISCARD, not CRASH): CONVERGED — exit loop. If baseline already >= target, run 3 verification iterations to confirm before converging.
|
|
167
|
-
- If consecutive_reverts triggers escalation level change: log escalation
|
|
168
|
-
- If consecutive_reverts >= 10 (after Level 3): STAGNATION — exit loop
|
|
169
|
-
- If max iterations reached: MAX_ITERATIONS — exit loop
|
|
170
|
-
|
|
171
|
-
**Step 9: Update session state**
|
|
172
|
-
Update `session-state/CURRENT.md` with current iteration count, score, and status.
|
|
173
|
-
|
|
174
|
-
**Step 10: Continue**
|
|
175
|
-
Return to Step 1.
|
|
176
|
-
|
|
177
|
-
---
|
|
178
|
-
|
|
179
|
-
## FINAL REPORT
|
|
180
|
-
|
|
181
|
-
After the loop exits (any reason), produce:
|
|
182
|
-
|
|
183
|
-
```
|
|
184
|
-
AUTORESEARCH COMPLETE — [command]
|
|
185
|
-
|
|
186
|
-
Reason: [CONVERGED / MAX_ITERATIONS / STAGNATION / COST_CAP]
|
|
187
|
-
Iterations: [N]
|
|
188
|
-
Branch: autoresearch/[command]-[date]
|
|
189
|
-
|
|
190
|
-
Score Progression:
|
|
191
|
-
Baseline: [X]% ([N/M] checks)
|
|
192
|
-
Final: [Y]% ([N/M] checks)
|
|
193
|
-
Delta: [+/-Z]%
|
|
194
|
-
|
|
195
|
-
Results:
|
|
196
|
-
Kept: [N] commits
|
|
197
|
-
Discarded: [N] reverts
|
|
198
|
-
Crashed: [N] transient failures
|
|
199
|
-
Rejected: [N] complexity rejections
|
|
200
|
-
|
|
201
|
-
Net Lines: [+/-N] across all kept changes
|
|
202
|
-
Highest Escalation: Level [0-3]
|
|
203
|
-
|
|
204
|
-
Kept Changes:
|
|
205
|
-
1. [iteration N] [edit summary] (+X checks)
|
|
206
|
-
2. [iteration N] [edit summary] (+X checks)
|
|
207
|
-
...
|
|
208
|
-
|
|
209
|
-
Still Failing:
|
|
210
|
-
- [check_name]: [brief description of why it's hard]
|
|
211
|
-
...
|
|
212
|
-
|
|
213
|
-
Next Steps:
|
|
214
|
-
- Review changes: git log autoresearch/[command]-[date]
|
|
215
|
-
- Merge if satisfied: git merge autoresearch/[command]-[date]
|
|
216
|
-
- Or cherry-pick specific commits
|
|
217
|
-
```
|
|
218
|
-
|
|
219
|
-
---
|
|
220
|
-
|
|
221
|
-
## SESSION STATE
|
|
222
|
-
|
|
223
|
-
Update `session-state/CURRENT.md` after each iteration:
|
|
224
|
-
|
|
225
|
-
```
|
|
226
|
-
AUTHORIZED_COMMAND: massu-autoresearch
|
|
227
|
-
Target: [command]
|
|
228
|
-
Branch: autoresearch/[command]-[date]
|
|
229
|
-
Iteration: [N]/[max]
|
|
230
|
-
Current Score: [X]%
|
|
231
|
-
Consecutive Reverts: [N]
|
|
232
|
-
Escalation Level: [0-3]
|
|
233
|
-
```
|
|
234
|
-
|
|
235
|
-
---
|
|
236
|
-
|
|
237
|
-
## Skill Contents
|
|
238
|
-
|
|
239
|
-
This skill is a folder. The following files are available for reference:
|
|
240
|
-
|
|
241
|
-
| File | Purpose | Read When |
|
|
242
|
-
|------|---------|-----------|
|
|
243
|
-
| `references/eval-runner.md` | Eval subagent spawn protocol | Before running any eval |
|
|
244
|
-
| `references/safety-rails.md` | Protected lines, backup, branch, cost cap, crash handling, escalation | Before any edit or on error |
|
|
245
|
-
| `references/scoring-protocol.md` | Score calculation, accept/reject, JSONL format, final summary | Before scoring or logging |
|
|
246
|
-
|
|
247
|
-
---
|
|
248
|
-
|
|
249
|
-
## START NOW
|
|
250
|
-
|
|
251
|
-
1. Parse `{{ARGUMENTS}}` for command name, flags
|
|
252
|
-
2. Validate target + eval + fixture exist
|
|
253
|
-
3. Create branch `autoresearch/[command]-[date]`
|
|
254
|
-
4. Backup target file
|
|
255
|
-
5. Measure baseline (3 eval runs, median)
|
|
256
|
-
6. Enter iteration loop
|
|
257
|
-
7. On exit: produce final report
|
|
258
|
-
8. **DO NOT ask "should I continue?" between iterations — just continue.**
|
|
@@ -1,132 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: massu-command-health
|
|
3
|
-
description: "When user asks about command quality, says 'how are my commands', 'command health', or wants to see which slash commands have quality issues"
|
|
4
|
-
allowed-tools: Bash(*), Read(*)
|
|
5
|
-
---
|
|
6
|
-
name: massu-command-health
|
|
7
|
-
|
|
8
|
-
# Massu Command Health: Quality Score Dashboard
|
|
9
|
-
|
|
10
|
-
## Purpose
|
|
11
|
-
|
|
12
|
-
Read `.claude/metrics/command-scores.jsonl` and display a summary of command quality over time. This is a READ-ONLY command — it does not modify anything.
|
|
13
|
-
|
|
14
|
-
---
|
|
15
|
-
|
|
16
|
-
## Data Sources
|
|
17
|
-
|
|
18
|
-
### Quality Scores
|
|
19
|
-
Each line in `.claude/metrics/command-scores.jsonl` is a JSON object:
|
|
20
|
-
|
|
21
|
-
```json
|
|
22
|
-
{"command":"massu-create-plan","timestamp":"2026-03-18T14:30:00","scores":{"items_have_acceptance_criteria":true,"references_real_tables":true,"ui_items_have_paths":false,"has_vr_types":true,"explicit_counts":true},"pass_rate":"4/5","input_summary":"knowledge-graph-phase-5"}
|
|
23
|
-
```
|
|
24
|
-
|
|
25
|
-
### Invocation Frequency
|
|
26
|
-
Each line in `.claude/metrics/command-invocations.jsonl` tracks when a command was used:
|
|
27
|
-
|
|
28
|
-
### Autoresearch Runs
|
|
29
|
-
Each line in `.claude/metrics/autoresearch-runs.jsonl` tracks autonomous optimization iterations:
|
|
30
|
-
```json
|
|
31
|
-
{"command":"massu-article-review","iteration":5,"timestamp":"ISO8601","score_before":75,"score_after":87.5,"action":"kept","edit_summary":"Added worked example for gap analysis"}
|
|
32
|
-
```
|
|
33
|
-
|
|
34
|
-
```json
|
|
35
|
-
{"skill":"massu-create-plan","timestamp":"2026-03-18T14:30:00Z"}
|
|
36
|
-
```
|
|
37
|
-
|
|
38
|
-
---
|
|
39
|
-
|
|
40
|
-
## Output Format
|
|
41
|
-
|
|
42
|
-
```
|
|
43
|
-
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
44
|
-
COMMAND HEALTH — [date]
|
|
45
|
-
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
46
|
-
|
|
47
|
-
OVERVIEW
|
|
48
|
-
Total scored runs: [N]
|
|
49
|
-
Commands tracked: [N]
|
|
50
|
-
Date range: [earliest] — [latest]
|
|
51
|
-
|
|
52
|
-
SCORECARD
|
|
53
|
-
Command Last 5 avg Trend Weakest check Runs
|
|
54
|
-
─────────────────────────────────────────────────────────────────────────────────────
|
|
55
|
-
massu-create-plan 80% = ui_items_have_paths (40%) 12
|
|
56
|
-
massu-loop 90% ^ memory_persisted (60%) 8
|
|
57
|
-
massu-article-review 100% = — 5
|
|
58
|
-
massu-plan 75% v zero_gaps_at_exit (50%) 6
|
|
59
|
-
massu-debug 85% = regression_test_added (60%) 4
|
|
60
|
-
|
|
61
|
-
Trend: ^ improving (last 3 > prior 3) v declining = stable
|
|
62
|
-
|
|
63
|
-
USAGE (last 7 days from command-invocations.jsonl)
|
|
64
|
-
Command Invocations/week
|
|
65
|
-
─────────────────────────────────────────
|
|
66
|
-
massu-create-plan 12
|
|
67
|
-
massu-debug 8
|
|
68
|
-
massu-loop 6
|
|
69
|
-
massu-bearings 5
|
|
70
|
-
massu-commit 4
|
|
71
|
-
(or "No invocation data yet")
|
|
72
|
-
|
|
73
|
-
ALERTS (commands below 60% on last 3 runs)
|
|
74
|
-
! massu-plan — 50% on last 3 runs. Weakest: zero_gaps_at_exit
|
|
75
|
-
(or "No alerts — all commands above threshold")
|
|
76
|
-
|
|
77
|
-
CHECK DETAIL (per-command breakdown, last 10 runs)
|
|
78
|
-
massu-create-plan:
|
|
79
|
-
items_have_acceptance_criteria 9/10 (90%)
|
|
80
|
-
references_real_tables 8/10 (80%)
|
|
81
|
-
ui_items_have_paths 4/10 (40%) <-- weakest
|
|
82
|
-
has_vr_types 7/10 (70%)
|
|
83
|
-
explicit_counts 9/10 (90%)
|
|
84
|
-
|
|
85
|
-
[repeat for each command with data]
|
|
86
|
-
|
|
87
|
-
AUTORESEARCH (from autoresearch-runs.jsonl)
|
|
88
|
-
Command Last run Iterations Score: start -> end
|
|
89
|
-
─────────────────────────────────────────────────────────────────────────
|
|
90
|
-
massu-article-review 2026-03-19 12 62% -> 87%
|
|
91
|
-
(or "No autoresearch runs yet")
|
|
92
|
-
|
|
93
|
-
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
94
|
-
```
|
|
95
|
-
|
|
96
|
-
---
|
|
97
|
-
|
|
98
|
-
## Logic
|
|
99
|
-
|
|
100
|
-
1. Read `.claude/metrics/command-scores.jsonl` AND `.claude/metrics/command-invocations.jsonl`
|
|
101
|
-
2. If both empty: display "No command data recorded yet. Scores and invocations accumulate automatically as you use commands."
|
|
102
|
-
3. Parse each line as JSON
|
|
103
|
-
4. Group scores by `command`, group invocations by `skill`
|
|
104
|
-
5. For each command:
|
|
105
|
-
- Count total runs
|
|
106
|
-
- Calculate average pass rate for last 5 runs
|
|
107
|
-
- Calculate trend (compare last 3 avg vs prior 3 avg)
|
|
108
|
-
- Find weakest check (lowest pass rate across all runs)
|
|
109
|
-
- Per-check breakdown for last 10 runs
|
|
110
|
-
6. Sort by average pass rate (lowest first — worst commands at top)
|
|
111
|
-
7. Flag any command below 60% on last 3 runs as an ALERT
|
|
112
|
-
8. Read `.claude/metrics/autoresearch-runs.jsonl` — group by command, find last run's iteration range, extract start/end scores, display in AUTORESEARCH section
|
|
113
|
-
|
|
114
|
-
---
|
|
115
|
-
|
|
116
|
-
## Arguments
|
|
117
|
-
|
|
118
|
-
Optional: command name to show detail for just one command.
|
|
119
|
-
|
|
120
|
-
```
|
|
121
|
-
/massu-command-health # Full dashboard
|
|
122
|
-
/massu-command-health massu-create-plan # Detail for one command
|
|
123
|
-
```
|
|
124
|
-
|
|
125
|
-
---
|
|
126
|
-
|
|
127
|
-
## START NOW
|
|
128
|
-
|
|
129
|
-
1. Read `.claude/metrics/command-scores.jsonl`
|
|
130
|
-
2. Parse and aggregate scores
|
|
131
|
-
3. Display dashboard in the format above
|
|
132
|
-
4. Do NOT modify any files
|