@hanzlaa/rcode 3.6.3 → 3.6.5
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hanzlaa/rcode",
|
|
3
|
-
"version": "3.6.
|
|
3
|
+
"version": "3.6.5",
|
|
4
4
|
"description": "rcode — the AI team that never forgets. Persistent memory, specialist agents, and slash commands for AI IDEs. Works in Claude Code, Cursor, Gemini, VS Code, and Antigravity.",
|
|
5
5
|
"main": "cli/index.js",
|
|
6
6
|
"bin": {
|
package/rihal/commands/audit.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: rihal-audit
|
|
3
|
-
description: Single audit entry point — asks what to audit (phase, milestone, UAT, code, fix, work, lens) and dispatches to the right subroute. Honours .rihal/config.yaml mode.
|
|
4
|
-
argument-hint: "[phase | milestone | uat | code | fix | work | lens [<1-15> | all]] [...subroute args]"
|
|
3
|
+
description: Single audit entry point — asks what to audit (plans, phase, milestone, UAT, code, fix, work, lens) and dispatches to the right subroute. Honours .rihal/config.yaml mode.
|
|
4
|
+
argument-hint: "[plans | phase | milestone | uat | code | fix | work | lens [<1-15> | all]] [--report] [...subroute args]"
|
|
5
5
|
allowed-tools: Read, Write, Bash, AskUserQuestion
|
|
6
6
|
---
|
|
7
7
|
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: rihal-debug
|
|
3
|
-
|
|
4
|
-
description: Root-cause debugging via the scientific method.
|
|
3
|
+
description: Root-cause debugging via the scientific method. Enforces investigate-before-fix, structured hypothesis iteration, multi-component evidence gathering, and architectural escalation after 3 failed fixes.
|
|
5
4
|
triggers:
|
|
6
5
|
# English
|
|
7
6
|
- "debug this"
|
|
@@ -12,11 +11,15 @@ triggers:
|
|
|
12
11
|
- "track this down"
|
|
13
12
|
- "narrow down the bug"
|
|
14
13
|
- "scientific method"
|
|
14
|
+
- "bug fix"
|
|
15
|
+
- "something is broken"
|
|
15
16
|
# Roman Urdu / Hindi
|
|
16
17
|
- "kharab kyu hai"
|
|
17
18
|
- "bug dhoondo"
|
|
18
19
|
- "fix karo bug"
|
|
19
20
|
- "theek karo"
|
|
21
|
+
- "kya masla hai"
|
|
22
|
+
- "kyu kaam nahi kar raha"
|
|
20
23
|
# Arabic native
|
|
21
24
|
- "صحّح هذا"
|
|
22
25
|
- "ما المشكلة"
|
|
@@ -29,29 +32,136 @@ user-invocable: false
|
|
|
29
32
|
@.rihal/references/karpathy-guidelines.md
|
|
30
33
|
|
|
31
34
|
|
|
35
|
+
## The Iron Law
|
|
36
|
+
|
|
37
|
+
```
|
|
38
|
+
NO FIXES WITHOUT ROOT CAUSE INVESTIGATION FIRST.
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
If you have not completed Phase 1, you cannot propose a fix. "It seems to work" is a red flag — keep investigating until the mechanism is clear. Symptom fixes are failure.
|
|
42
|
+
|
|
32
43
|
## Overview
|
|
33
44
|
|
|
34
|
-
Debugging is investigation, not pattern-matching. Each iteration narrows the problem space — never widens it. The skill enforces a written hypothesis, an experiment that distinguishes "yes" from "no", and a captured observation. Random fixes
|
|
45
|
+
Debugging is investigation, not pattern-matching. Each iteration narrows the problem space — never widens it. The skill enforces a written hypothesis, an experiment that distinguishes "yes" from "no", and a captured observation. Random fixes are not allowed — the bug must be understood before the fix is written.
|
|
46
|
+
|
|
47
|
+
## Phase 1 — Root Cause Investigation
|
|
48
|
+
|
|
49
|
+
**BEFORE attempting ANY fix:**
|
|
50
|
+
|
|
51
|
+
1. **Reproduce consistently.** Write the exact steps. If not reproducible, make it reproducible first — anything else is guessing.
|
|
52
|
+
|
|
53
|
+
2. **Read the error carefully.** Don't skim stack traces. Note file paths, line numbers, error codes. They often contain the exact answer.
|
|
54
|
+
|
|
55
|
+
3. **Check recent changes.** `git diff`, recent commits, new dependencies, config changes, environment differences.
|
|
56
|
+
|
|
57
|
+
4. **Gather evidence in multi-component systems.**
|
|
58
|
+
|
|
59
|
+
When the system has multiple layers (API → service → DB, CI → build → signing, frontend → backend → queue):
|
|
60
|
+
|
|
61
|
+
Add diagnostic instrumentation at EACH component boundary BEFORE proposing fixes:
|
|
62
|
+
```
|
|
63
|
+
For EACH boundary:
|
|
64
|
+
- Log what data enters the component
|
|
65
|
+
- Log what data exits the component
|
|
66
|
+
- Verify env/config propagation
|
|
67
|
+
- Check state at each layer
|
|
68
|
+
|
|
69
|
+
Run ONCE to gather evidence showing WHERE it breaks.
|
|
70
|
+
THEN identify the failing component.
|
|
71
|
+
THEN investigate that specific component.
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
Example:
|
|
75
|
+
```bash
|
|
76
|
+
# Layer 1: incoming request
|
|
77
|
+
console.log('[L1] body:', req.body, 'userId:', req.user?.id)
|
|
78
|
+
|
|
79
|
+
# Layer 2: service call
|
|
80
|
+
console.log('[L2] args to createTask:', args)
|
|
81
|
+
|
|
82
|
+
# Layer 3: DB query
|
|
83
|
+
console.log('[L3] Prisma input:', data)
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
This reveals which layer fails — not guessing.
|
|
35
87
|
|
|
36
|
-
|
|
88
|
+
5. **Trace data flow backward.** Where does the bad value originate? What called this function with that bad value? Keep tracing up until you find the source. Fix at source, not at symptom.
|
|
37
89
|
|
|
38
|
-
|
|
39
|
-
2. **State the hypothesis.** "I think the bug is in <component>; specifically <mechanism>." One sentence, falsifiable.
|
|
40
|
-
3. **Design the experiment.** What single test, log line, or dataflow change would distinguish a true hypothesis from a false one?
|
|
41
|
-
4. **Run it. Capture the observation.** Console output verbatim, screenshot, stack trace, network response — whatever the experiment produced.
|
|
42
|
-
5. **Update the hypothesis.** Either confirmed (now narrow to the next layer) or refuted (form a new hypothesis based on what was observed).
|
|
43
|
-
6. **Stop conditions:** the bug is reproducible from a unit test (then hand to `rihal-prove-it`), OR the root cause is a known external constraint (e.g. third-party API behaviour) that you record in `incidents/known-issues.md`.
|
|
44
|
-
7. **Never apply a fix without understanding why it works.** "It seems to fix it" is a red flag — keep investigating until the mechanism is clear.
|
|
90
|
+
## Phase 2 — Pattern Analysis
|
|
45
91
|
|
|
46
|
-
|
|
92
|
+
Before forming a hypothesis, find the comparison point:
|
|
93
|
+
|
|
94
|
+
1. **Find working examples.** Locate similar code in the same codebase that works. What's different?
|
|
95
|
+
2. **Read reference implementations completely.** Don't skim — partial understanding guarantees bugs.
|
|
96
|
+
3. **List every difference**, however small. Don't assume "that can't matter."
|
|
97
|
+
4. **Check assumptions.** What config, environment, or state does this code assume?
|
|
98
|
+
|
|
99
|
+
## Phase 3 — Hypothesis and Experiment
|
|
100
|
+
|
|
101
|
+
Scientific method:
|
|
102
|
+
|
|
103
|
+
1. **State ONE hypothesis.** "I think X is the root cause because Y." Write it down. Be specific, not vague.
|
|
104
|
+
2. **Design the minimal experiment.** What single test, log line, or code change would confirm or refute this hypothesis?
|
|
105
|
+
3. **Run it. Capture the observation verbatim.** Console output, stack trace, network response — whatever was produced.
|
|
106
|
+
4. **Update.** Confirmed → Phase 4. Refuted → form a new hypothesis based on what was observed. Do NOT add more fixes on top.
|
|
107
|
+
|
|
108
|
+
## Phase 4 — Implementation
|
|
109
|
+
|
|
110
|
+
1. **Create a failing test first.** Simplest possible reproduction. Use `rihal-prove-it` for writing the test that locks the fix in.
|
|
111
|
+
2. **Implement ONE fix.** Address the root cause identified. No "while I'm here" improvements. No bundled refactors.
|
|
112
|
+
3. **Verify.** Test passes. No other tests broken. Issue actually resolved.
|
|
113
|
+
4. **If fix doesn't work:** STOP. Count fix attempts.
|
|
114
|
+
- < 3 attempts: return to Phase 1 with new information.
|
|
115
|
+
- **≥ 3 attempts: STOP — this is an architectural problem.**
|
|
116
|
+
|
|
117
|
+
## Architectural Escalation (after 3 failed fixes)
|
|
118
|
+
|
|
119
|
+
Pattern that signals architectural problem:
|
|
120
|
+
- Each fix reveals new coupling or shared state in a different place
|
|
121
|
+
- Fixes require "massive refactoring" to implement
|
|
122
|
+
- Each fix creates new symptoms elsewhere
|
|
123
|
+
|
|
124
|
+
When this pattern appears:
|
|
125
|
+
1. Stop attempting fixes
|
|
126
|
+
2. Ask: is this pattern fundamentally sound, or are we continuing through inertia?
|
|
127
|
+
3. Discuss with the user before attempting more fixes
|
|
128
|
+
4. Consider `/rihal-council` for a cross-functional review
|
|
129
|
+
|
|
130
|
+
## Sentry / Observability Integration
|
|
47
131
|
|
|
48
132
|
If the project has Sentry (`@sentry/*` in `package.json` or `sentry-sdk` in Python):
|
|
49
133
|
|
|
50
|
-
- Quote the actual Sentry issue ID and stack trace in the hypothesis
|
|
51
|
-
-
|
|
52
|
-
- Check
|
|
134
|
+
- Quote the actual Sentry issue ID and stack trace in the hypothesis
|
|
135
|
+
- Read breadcrumbs for the chain of events leading to the error
|
|
136
|
+
- Check "first seen / last seen" — recurring or one-off matters
|
|
53
137
|
- Cross-reference with deployment timestamps to identify regressions
|
|
54
138
|
|
|
139
|
+
## Red Flags — STOP and return to Phase 1
|
|
140
|
+
|
|
141
|
+
If you catch yourself thinking any of these:
|
|
142
|
+
- "Quick fix for now, investigate later"
|
|
143
|
+
- "Just try changing X and see if it works"
|
|
144
|
+
- "Add multiple changes and run tests"
|
|
145
|
+
- "It's probably X, let me fix that"
|
|
146
|
+
- "I don't fully understand but this might work"
|
|
147
|
+
- "It seems to fix it"
|
|
148
|
+
- "One more fix attempt" (when already tried 2+)
|
|
149
|
+
- Proposing solutions before tracing data flow
|
|
150
|
+
- Each fix reveals a new problem in a different place
|
|
151
|
+
|
|
152
|
+
**ALL of these mean: STOP. Return to Phase 1.**
|
|
153
|
+
|
|
154
|
+
## Common Rationalizations
|
|
155
|
+
|
|
156
|
+
| Excuse | Reality |
|
|
157
|
+
|--------|---------|
|
|
158
|
+
| "Issue is simple, don't need process" | Simple bugs have root causes too. Process is fast for simple bugs. |
|
|
159
|
+
| "Emergency, no time for process" | Systematic debugging is FASTER than guess-and-check thrashing. |
|
|
160
|
+
| "Just try this first, then investigate" | First fix sets the pattern. Do it right from the start. |
|
|
161
|
+
| "Multiple fixes at once saves time" | Can't isolate what worked. Causes new bugs. |
|
|
162
|
+
| "I see the problem, let me fix it" | Seeing symptoms ≠ understanding root cause. |
|
|
163
|
+
| "One more fix attempt" (after 2+) | 3+ failures = architectural problem. Escalate, don't fix again. |
|
|
164
|
+
|
|
55
165
|
## Output Format
|
|
56
166
|
|
|
57
167
|
```
|
|
@@ -59,9 +169,12 @@ Reproduction:
|
|
|
59
169
|
<exact steps>
|
|
60
170
|
<observed vs expected>
|
|
61
171
|
|
|
172
|
+
Phase 1 — Evidence
|
|
173
|
+
<what layers were instrumented and what they showed>
|
|
174
|
+
|
|
62
175
|
Iteration 1
|
|
63
|
-
Hypothesis: <falsifiable claim>
|
|
64
|
-
Experiment: <
|
|
176
|
+
Hypothesis: <falsifiable claim — "I think X because Y">
|
|
177
|
+
Experiment: <the single test/log that would confirm or refute>
|
|
65
178
|
Observation: <verbatim output>
|
|
66
179
|
Outcome: confirmed | refuted | partial
|
|
67
180
|
|
|
@@ -69,26 +182,30 @@ Iteration N
|
|
|
69
182
|
...
|
|
70
183
|
|
|
71
184
|
Root cause:
|
|
72
|
-
<one paragraph
|
|
185
|
+
<one paragraph — the actual mechanism, not the symptom>
|
|
73
186
|
|
|
74
187
|
Fix scope:
|
|
75
|
-
<minimum change that
|
|
188
|
+
<minimum change that addresses the cause>
|
|
76
189
|
|
|
77
190
|
Regression test:
|
|
78
|
-
<hand
|
|
191
|
+
<hand to rihal-prove-it — the test that locks the fix in>
|
|
79
192
|
```
|
|
80
193
|
|
|
81
|
-
Do NOT include: "tried X and it seems to work"
|
|
194
|
+
Do NOT include: "tried X and it seems to work" · speculative "maybe it's caching" · broad refactors disguised as bug fixes.
|
|
82
195
|
|
|
83
196
|
## Examples
|
|
84
197
|
|
|
85
|
-
**Happy path** — "Login fails for Arabic usernames" → reproduce: POST `/login` with `محمد` returns 500 →
|
|
198
|
+
**Happy path** — "Login fails for Arabic usernames" → reproduce: POST `/login` with `محمد` returns 500 → Phase 1: hex-dump log of raw request body → observation: UTF-8 bytes, but Postgres driver re-encodes as Latin-1 → root cause: `client_encoding` mismatch → fix: pin `client_encoding=utf8` in connection string → regression test asserts non-ASCII login returns 200.
|
|
199
|
+
|
|
200
|
+
**Multi-component** — "Tasks not appearing after creation" → instrument three layers: controller logs input, service logs DB call args, DB query logs row count → observation: service receives correct args, DB returns `rowCount: 0` → hypothesis: wrong table name in query → confirmed → one-line fix, regression test added.
|
|
201
|
+
|
|
202
|
+
**Edge case — flaky test** — Passes locally, fails in CI 30% of the time → hypothesis: race condition → experiment: `--runInBand` → still flaky → next hypothesis: filesystem timing → experiment: `await fs.stat` after write → confirmed → fix.
|
|
86
203
|
|
|
87
|
-
**
|
|
204
|
+
**Negative — shotgun fix** — "I added a try/catch around the whole function and now it doesn't crash." Refuse. The exception is silently swallowed; the bug still exists. Restore the throw and form a real hypothesis.
|
|
88
205
|
|
|
89
|
-
**
|
|
206
|
+
**Architectural escalation** — Three separate fixes attempted (missing await, wrong env var, stale cache) — each fix exposed a new problem elsewhere. Stop. The async data-flow design is wrong. Escalate to `/rihal-council` before attempting Fix #4.
|
|
90
207
|
|
|
91
208
|
## Memory Bank Hooks
|
|
92
209
|
|
|
93
|
-
- **Reads:** `.rihal/memory/incidents/known-issues.md` (
|
|
94
|
-
- **Writes:** append
|
|
210
|
+
- **Reads:** `.rihal/memory/incidents/known-issues.md` (prior debugging context), `.rihal/memory/project/stack.md` (Sentry presence, observability tools)
|
|
211
|
+
- **Writes:** append root cause to `.rihal/memory/incidents/post-mortems/YYYYMMDD-<slug>.md` when resolved; remove from `known-issues.md` once fix is verified in production
|
|
@@ -0,0 +1,255 @@
|
|
|
1
|
+
# Workflow: rihal-audit plans
|
|
2
|
+
|
|
3
|
+
<purpose>
|
|
4
|
+
Forward-looking planning integrity audit. Reads every SPRINT.md, ROADMAP.md,
|
|
5
|
+
REQUIREMENTS.md, and STATE.md in the current milestone and checks for:
|
|
6
|
+
1. Structural completeness — phases with no sprints, sprints with no tasks, tasks missing must_haves
|
|
7
|
+
2. Status consistency — STATE.md current pointers vs actual sprint/phase status
|
|
8
|
+
3. Dependency integrity — depends_on and requirements references that don't resolve
|
|
9
|
+
4. Next action recommendation — one concrete /rihal-* command to run next
|
|
10
|
+
|
|
11
|
+
Unlike /rihal-audit-milestone (backward-looking), this audit is forward-looking:
|
|
12
|
+
it checks *planned* items before they are executed.
|
|
13
|
+
</purpose>
|
|
14
|
+
|
|
15
|
+
## Step 0 — Usage check
|
|
16
|
+
|
|
17
|
+
If `$ARGUMENTS` contains `--help` or `-h`:
|
|
18
|
+
|
|
19
|
+
```
|
|
20
|
+
/rihal-audit plans [--report] [--strict]
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
**Examples:**
|
|
24
|
+
```
|
|
25
|
+
/rihal-audit plans
|
|
26
|
+
/rihal-audit plans --report
|
|
27
|
+
/rihal-audit plans --strict
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
STOP — do not proceed.
|
|
31
|
+
|
|
32
|
+
## Step 1 — Locate planning root
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
PLANNING=".planning"
|
|
36
|
+
ROADMAP="$PLANNING/ROADMAP.md"
|
|
37
|
+
STATE="$PLANNING/STATE.md"
|
|
38
|
+
REQS="$PLANNING/REQUIREMENTS.md"
|
|
39
|
+
PHASES_DIR="$PLANNING/phases"
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
If `$PLANNING` does not exist:
|
|
43
|
+
```
|
|
44
|
+
⚠ No .planning/ directory found.
|
|
45
|
+
Run /rihal-new-milestone to start a milestone.
|
|
46
|
+
```
|
|
47
|
+
STOP.
|
|
48
|
+
|
|
49
|
+
If `$ROADMAP` does not exist:
|
|
50
|
+
```
|
|
51
|
+
⚠ No ROADMAP.md found at $ROADMAP.
|
|
52
|
+
Run /rihal-new-milestone to define goals.
|
|
53
|
+
```
|
|
54
|
+
STOP.
|
|
55
|
+
|
|
56
|
+
## Step 2 — Collect all sprint files
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
SPRINT_FILES=$(find "$PHASES_DIR" -name "*-SPRINT.md" | sort)
|
|
60
|
+
PHASE_DIRS=$(find "$PHASES_DIR" -mindepth 1 -maxdepth 1 -type d | sort)
|
|
61
|
+
SPRINT_COUNT=$(echo "$SPRINT_FILES" | grep -c . || echo 0)
|
|
62
|
+
PHASE_COUNT=$(echo "$PHASE_DIRS" | grep -c . || echo 0)
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
Read STATE.md and extract:
|
|
66
|
+
- `current_phase` — the phase ID listed as current
|
|
67
|
+
- `current_sprint` — the sprint ID listed as current (if any)
|
|
68
|
+
- `milestone` — the active milestone name
|
|
69
|
+
|
|
70
|
+
Read ROADMAP.md and extract every numbered phase entry (lines like `## Phase NN` or
|
|
71
|
+
table rows with phase IDs). Store as `$ROADMAP_PHASES`.
|
|
72
|
+
|
|
73
|
+
Read REQUIREMENTS.md (if it exists) and extract every requirement ID
|
|
74
|
+
(e.g. `HIST-1`, `AUTH-3`) from headings or definition lines. Store as `$KNOWN_REQS`.
|
|
75
|
+
|
|
76
|
+
## Step 3 — Run checks
|
|
77
|
+
|
|
78
|
+
Initialize counters: `ERRORS=0`, `WARNINGS=0`. Build a findings array.
|
|
79
|
+
|
|
80
|
+
### Check A — Structural completeness
|
|
81
|
+
|
|
82
|
+
**A1. Phase directories with no sprint file**
|
|
83
|
+
|
|
84
|
+
For each directory in `$PHASE_DIRS`:
|
|
85
|
+
- If `find "$phase_dir" -name "*-SPRINT.md" | wc -l` returns 0
|
|
86
|
+
- AND no SUMMARY.md exists in that directory (i.e. not yet completed)
|
|
87
|
+
- → WARN: `Phase {phase_id} has no SPRINT.md — run /rihal-plan to create one`
|
|
88
|
+
|
|
89
|
+
**A2. Sprint files with no tasks**
|
|
90
|
+
|
|
91
|
+
For each file in `$SPRINT_FILES`:
|
|
92
|
+
- Read the file and check if a `<tasks>` block exists
|
|
93
|
+
- If `<tasks>` block is empty (no `<task` entries inside it)
|
|
94
|
+
- → WARN: `Sprint {sprint_id} has no tasks — run /rihal-sprint-planning to add stories`
|
|
95
|
+
|
|
96
|
+
**A3. Tasks missing must_haves / acceptance criteria**
|
|
97
|
+
|
|
98
|
+
For each sprint file:
|
|
99
|
+
- Parse the YAML frontmatter block (`---` ... `---`)
|
|
100
|
+
- Check if `must_haves` key is present and non-empty
|
|
101
|
+
- If missing or empty AND the sprint status is not `completed`
|
|
102
|
+
- → WARN: `Sprint {sprint_id} missing must_haves — add acceptance criteria before executing`
|
|
103
|
+
|
|
104
|
+
**A4. ROADMAP phases with no matching directory**
|
|
105
|
+
|
|
106
|
+
For each phase ID in `$ROADMAP_PHASES`:
|
|
107
|
+
- Check if a directory matching that ID exists in `$PHASES_DIR`
|
|
108
|
+
- If not, and the phase is not marked as skipped/cancelled in ROADMAP
|
|
109
|
+
- → ERROR: `ROADMAP lists Phase {id} but no directory exists — run /rihal-add-phase {id}`
|
|
110
|
+
|
|
111
|
+
### Check B — Status consistency
|
|
112
|
+
|
|
113
|
+
**B1. STATE.md current_phase points to a non-existent or completed phase**
|
|
114
|
+
|
|
115
|
+
Read `current_phase` from STATE.md.
|
|
116
|
+
|
|
117
|
+
If the phase directory does not exist:
|
|
118
|
+
- → ERROR: `STATE.md current_phase={id} but that phase directory does not exist`
|
|
119
|
+
|
|
120
|
+
If a SUMMARY.md exists in that phase directory (meaning it was completed and closed):
|
|
121
|
+
- → WARN: `STATE.md current_phase={id} is already completed (has SUMMARY.md) — run /rihal-next to advance`
|
|
122
|
+
|
|
123
|
+
**B2. STATE.md current_sprint points to a sprint where all tasks are done**
|
|
124
|
+
|
|
125
|
+
If STATE.md has a `current_sprint` value:
|
|
126
|
+
- Find the matching SPRINT.md file
|
|
127
|
+
- Count tasks with `status: done` vs total tasks
|
|
128
|
+
- If all tasks are done and sprint status is not `completed`
|
|
129
|
+
- → WARN: `Sprint {sprint_id} all tasks done but not closed — run /rihal-verify-phase to close it`
|
|
130
|
+
|
|
131
|
+
**B3. Phase directories with a SUMMARY.md but no entry in ROADMAP as completed**
|
|
132
|
+
|
|
133
|
+
For each phase in `$PHASE_DIRS`:
|
|
134
|
+
- If SUMMARY.md exists, the phase is done
|
|
135
|
+
- Check that ROADMAP.md reflects this (status column or checkmark)
|
|
136
|
+
- If ROADMAP still shows it as active/planned
|
|
137
|
+
- → WARN: `Phase {id} has SUMMARY.md (complete) but ROADMAP shows it as active — update ROADMAP`
|
|
138
|
+
|
|
139
|
+
### Check C — Dependency integrity
|
|
140
|
+
|
|
141
|
+
**C1. depends_on references non-existent sprint**
|
|
142
|
+
|
|
143
|
+
For each sprint file:
|
|
144
|
+
- Read the `depends_on` list from the YAML frontmatter
|
|
145
|
+
- For each entry in `depends_on`, check if a SPRINT.md with that phase/sprint ID exists
|
|
146
|
+
- If not found
|
|
147
|
+
- → ERROR: `Sprint {sprint_id} depends_on {missing_id} which does not exist`
|
|
148
|
+
|
|
149
|
+
**C2. requirements references unknown requirement ID**
|
|
150
|
+
|
|
151
|
+
For each sprint file:
|
|
152
|
+
- Read the `requirements` list from YAML frontmatter
|
|
153
|
+
- For each requirement ID, check if it appears in `$KNOWN_REQS` (from REQUIREMENTS.md)
|
|
154
|
+
- If REQUIREMENTS.md exists but the ID is missing
|
|
155
|
+
- → WARN: `Sprint {sprint_id} references unknown requirement {req_id} — add it to REQUIREMENTS.md`
|
|
156
|
+
|
|
157
|
+
**C3. Wave ordering: sprint with depends_on in a later wave**
|
|
158
|
+
|
|
159
|
+
For each sprint file:
|
|
160
|
+
- Read `wave` and `depends_on` from YAML frontmatter
|
|
161
|
+
- For each dependency, find the wave of the dependency sprint
|
|
162
|
+
- If dependency wave >= current sprint's wave
|
|
163
|
+
- → ERROR: `Sprint {sprint_id} (wave {w}) depends on {dep_id} (wave {dw}) — circular or forward dependency`
|
|
164
|
+
|
|
165
|
+
## Step 4 — Build findings report
|
|
166
|
+
|
|
167
|
+
Format all findings into severity groups:
|
|
168
|
+
|
|
169
|
+
```
|
|
170
|
+
RIHAL ► AUDIT PLANS
|
|
171
|
+
|
|
172
|
+
Scanned: {PHASE_COUNT} phases, {SPRINT_COUNT} sprints
|
|
173
|
+
Milestone: {milestone}
|
|
174
|
+
|
|
175
|
+
━━━ ERRORS ({error_count}) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
176
|
+
{each ERROR finding, prefixed with ✗}
|
|
177
|
+
|
|
178
|
+
━━━ WARNINGS ({warning_count}) ━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
179
|
+
{each WARNING finding, prefixed with ⚠}
|
|
180
|
+
|
|
181
|
+
━━━ CLEAN ({clean_count}) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
182
|
+
{each passing check, prefixed with ✓}
|
|
183
|
+
|
|
184
|
+
━━━ NEXT ACTION ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
185
|
+
{recommendation — see Step 5}
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
If zero errors and zero warnings:
|
|
189
|
+
```
|
|
190
|
+
✓ All planning checks passed. Plans are coherent and ready to execute.
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
## Step 5 — Recommend next action
|
|
194
|
+
|
|
195
|
+
Pick exactly ONE recommended next command based on highest-priority finding:
|
|
196
|
+
|
|
197
|
+
| Condition (checked in order) | Recommendation |
|
|
198
|
+
|---|---|
|
|
199
|
+
| Any ERROR from Check C (dependency) | `/rihal-plan` — fix dependency before executing |
|
|
200
|
+
| Any ERROR from Check A4 (ROADMAP phase missing) | `/rihal-add-phase {id}` — create the missing phase |
|
|
201
|
+
| Any WARN from B1 (current_phase completed) | `/rihal-next` — advance to the next phase |
|
|
202
|
+
| Any WARN from B2 (sprint all-done not closed) | `/rihal-verify-phase` — close the current sprint |
|
|
203
|
+
| Any WARN from A1 (phase with no sprint) | `/rihal-plan` — create sprint plan for the earliest unplanned phase |
|
|
204
|
+
| Any WARN from A2 (sprint no tasks) | `/rihal-sprint-planning {sprint_id}` — groom the empty sprint |
|
|
205
|
+
| Any WARN from A3 (missing must_haves) | `/rihal-create-story` — add acceptance criteria |
|
|
206
|
+
| Any WARN from C2 (unknown requirement) | edit `REQUIREMENTS.md` — define the missing requirement |
|
|
207
|
+
| No findings | `/rihal-execute` — plans are clean, execute the next sprint |
|
|
208
|
+
|
|
209
|
+
Print as:
|
|
210
|
+
```
|
|
211
|
+
► Recommended next step:
|
|
212
|
+
{command}
|
|
213
|
+
{one-line reason}
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
## Step 6 — Save report (if --report flag)
|
|
217
|
+
|
|
218
|
+
If `--report` is in `$ARGUMENTS`, write findings to:
|
|
219
|
+
```
|
|
220
|
+
.planning/audit-plans-{YYYY-MM-DD}.md
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
Format:
|
|
224
|
+
```markdown
|
|
225
|
+
# Plan Audit — {milestone}
|
|
226
|
+
|
|
227
|
+
**Date:** {ISO-DATE}
|
|
228
|
+
**Phases scanned:** {count}
|
|
229
|
+
**Sprints scanned:** {count}
|
|
230
|
+
**Errors:** {count}
|
|
231
|
+
**Warnings:** {count}
|
|
232
|
+
|
|
233
|
+
## Findings
|
|
234
|
+
|
|
235
|
+
{all findings with severity}
|
|
236
|
+
|
|
237
|
+
## Next Action
|
|
238
|
+
|
|
239
|
+
{recommendation}
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
## Success Criteria
|
|
243
|
+
|
|
244
|
+
- [ ] Runs without modification on any project with `.planning/` + ROADMAP.md
|
|
245
|
+
- [ ] Zero false positives on phases that have SUMMARY.md (already completed)
|
|
246
|
+
- [ ] Dependency check correctly resolves phase/sprint IDs from file paths
|
|
247
|
+
- [ ] Exactly one "next action" command printed at end
|
|
248
|
+
- [ ] `--report` writes a dated file under `.planning/`
|
|
249
|
+
|
|
250
|
+
## On Error
|
|
251
|
+
|
|
252
|
+
- `.planning/` missing → prompt to run `/rihal-new-milestone`
|
|
253
|
+
- ROADMAP.md missing → prompt to run `/rihal-new-milestone`
|
|
254
|
+
- No sprint files found → report as WARNING and recommend `/rihal-plan`
|
|
255
|
+
- REQUIREMENTS.md missing → skip C2 check silently (not all projects use it)
|
package/rihal/workflows/audit.md
CHANGED
|
@@ -18,6 +18,7 @@ If `$ARGUMENTS` contains `--help` or `-h`:
|
|
|
18
18
|
|
|
19
19
|
```
|
|
20
20
|
/rihal-audit # interactive — asks what to audit
|
|
21
|
+
/rihal-audit plans [--report] # → audit-plans (structural + status + deps check)
|
|
21
22
|
/rihal-audit phase [<NN>] # → /rihal-verify-phase
|
|
22
23
|
/rihal-audit milestone [--strict] # → /rihal-audit-milestone (with synth fallback)
|
|
23
24
|
/rihal-audit uat # → /rihal-audit-uat
|
|
@@ -30,6 +31,8 @@ If `$ARGUMENTS` contains `--help` or `-h`:
|
|
|
30
31
|
**Examples:**
|
|
31
32
|
```
|
|
32
33
|
/rihal-audit
|
|
34
|
+
/rihal-audit plans
|
|
35
|
+
/rihal-audit plans --report
|
|
33
36
|
/rihal-audit milestone --strict
|
|
34
37
|
/rihal-audit phase 03
|
|
35
38
|
/rihal-audit lens security
|
|
@@ -45,7 +48,7 @@ DISCUSS=$($TOOL config-get workflow.discuss_mode 2>/dev/null || echo "adaptive")
|
|
|
45
48
|
```
|
|
46
49
|
|
|
47
50
|
Parse `$ARGUMENTS`:
|
|
48
|
-
- First word ∈ {phase, milestone, uat, code, fix, work, lens} → set `$TARGET`, drop it from args, jump to Step 4.
|
|
51
|
+
- First word ∈ {plans, phase, milestone, uat, code, fix, work, lens} → set `$TARGET`, drop it from args, jump to Step 4.
|
|
49
52
|
- Empty or unrecognised → continue to Step 2.
|
|
50
53
|
|
|
51
54
|
## Step 2 — Detect project state
|
|
@@ -68,7 +71,7 @@ as `(no data — skip)`.
|
|
|
68
71
|
## Step 3 — Ask user (guided mode only)
|
|
69
72
|
|
|
70
73
|
If `$MODE` is `yolo`, skip this step and pick the most relevant target
|
|
71
|
-
automatically (priority: `work` if dirty branch, else `
|
|
74
|
+
automatically (priority: `work` if dirty branch, else `plans` if PLANS>0
|
|
72
75
|
and SUMMARIES<PLANS, else `milestone` if SUMMARIES>0, else `code`).
|
|
73
76
|
|
|
74
77
|
Otherwise call AskUserQuestion:
|
|
@@ -78,13 +81,14 @@ Question:
|
|
|
78
81
|
What do you want to audit?
|
|
79
82
|
|
|
80
83
|
Options:
|
|
81
|
-
1.
|
|
82
|
-
2.
|
|
83
|
-
3.
|
|
84
|
-
4.
|
|
85
|
-
5.
|
|
86
|
-
6.
|
|
87
|
-
7.
|
|
84
|
+
1. plans — planning integrity: completeness, status, deps ({PLANS} sprints)
|
|
85
|
+
2. phase — verify a single phase against its PLAN ({PLANS} plans)
|
|
86
|
+
3. milestone — cross-phase milestone goal coverage ({SUMMARIES} summaries)
|
|
87
|
+
4. uat — outstanding UAT / verification items ({UAT_FILES} files)
|
|
88
|
+
5. code-quality — Karpathy 4-principle code review (current diff)
|
|
89
|
+
6. auto-fix — audit then auto-fix findings (uses #1–5 output)
|
|
90
|
+
7. work — verify current branch / WIP ({ON_BRANCH}, dirty={DIRTY})
|
|
91
|
+
8. lens — 15-lens methodology audit (security, perf, tests…)
|
|
88
92
|
0. cancel
|
|
89
93
|
```
|
|
90
94
|
|
|
@@ -98,6 +102,7 @@ sub-workflow.
|
|
|
98
102
|
|
|
99
103
|
| target | precondition | failure message |
|
|
100
104
|
|---|---|---|
|
|
105
|
+
| plans | `.planning/ROADMAP.md` exists | `No ROADMAP.md. Run /rihal-new-milestone first.` |
|
|
101
106
|
| phase | at least one `.planning/phases/*/PLAN.md` or `*-SPRINT.md` | `No plan file found. Run /rihal-plan first.` |
|
|
102
107
|
| milestone | ROADMAP.md exists | `No ROADMAP.md. Run /rihal-new-milestone first.` |
|
|
103
108
|
| uat | at least one UAT*.md exists | `No UAT files yet. Run /rihal-execute on a phase first.` |
|
|
@@ -140,6 +145,7 @@ Run the target's slash command, forwarding remaining args:
|
|
|
140
145
|
|
|
141
146
|
| target | dispatch |
|
|
142
147
|
|---|---|
|
|
148
|
+
| plans | execute `@.rihal/workflows/audit-plans.md` inline |
|
|
143
149
|
| phase | `/rihal-verify-phase $REST_ARGS` |
|
|
144
150
|
| milestone | `/rihal-audit-milestone $REST_ARGS` |
|
|
145
151
|
| uat | `/rihal-audit-uat $REST_ARGS` |
|