wogiflow 2.1.3 → 2.3.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/.claude/commands/wogi-audit.md +189 -3
- package/.claude/commands/wogi-onboard.md +30 -8
- package/.claude/commands/wogi-review.md +86 -13
- package/.claude/commands/wogi-start.md +66 -21
- package/.claude/docs/claude-code-compatibility.md +28 -0
- package/.workflow/templates/claude-md.hbs +32 -2
- package/package.json +1 -1
- package/scripts/flow-api-index.js +128 -63
- package/scripts/flow-audit.js +158 -1
- package/scripts/flow-function-index.js +65 -63
- package/scripts/flow-pattern-extractor.js +1 -1
- package/scripts/flow-progress-tracker.js +289 -0
- package/scripts/flow-prompt-capture.js +263 -170
- package/scripts/flow-scanner-base.js +200 -7
- package/scripts/flow-skill-generator.js +1 -0
- package/scripts/flow-standards-learner.js +167 -3
- package/scripts/flow-task-checkpoint.js +2 -0
- package/scripts/flow-template-extractor.js +1 -1
- package/scripts/flow-version-check.js +1 -0
- package/scripts/hooks/core/commit-log-gate.js +146 -0
- package/scripts/hooks/core/post-compact.js +81 -8
- package/scripts/hooks/core/task-completed.js +19 -0
- package/scripts/hooks/entry/claude-code/post-tool-use.js +60 -0
- package/scripts/hooks/entry/claude-code/pre-tool-use.js +27 -0
- package/scripts/registries/component-registry.js +141 -4
|
@@ -31,6 +31,32 @@ The audit system has **two layers**:
|
|
|
31
31
|
1. **Runtime script** (`flow-audit.js`) — provides helper functions for file scanning, TODO finding, dependency checking, and score calculation.
|
|
32
32
|
2. **AI instructions** (this document) — describe the 7-agent parallel analysis, scoring, and post-audit workflow. You (the AI) orchestrate the full audit.
|
|
33
33
|
|
|
34
|
+
## Progress Tracking
|
|
35
|
+
|
|
36
|
+
At each step checkpoint, display a progress bar AND update the progress state file:
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
node node_modules/wogiflow/scripts/flow-progress-tracker.js update '{"taskId":"audit","command":"/wogi-audit","phase":"Agents","phaseNum":2,"totalPhases":6,"step":"Agent 5/7 complete","stepNum":5,"totalSteps":7}'
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
**Phase mapping for /wogi-audit:**
|
|
43
|
+
| Phase | phaseNum | Description |
|
|
44
|
+
|-------|----------|-------------|
|
|
45
|
+
| 1 | Gather Files | Scan project files |
|
|
46
|
+
| 2 | Agents | 7 parallel agents (sub-steps = agents) |
|
|
47
|
+
| 3 | Consolidate | Score calculation |
|
|
48
|
+
| 4 | Pattern Promotion | AI clustering + cross-reference + gaps |
|
|
49
|
+
| 5 | Report | Display formatted report |
|
|
50
|
+
| 6 | Persist | Save to last-audit.json |
|
|
51
|
+
|
|
52
|
+
**Display at each agent completion:**
|
|
53
|
+
```
|
|
54
|
+
━━━ PROGRESS: [████░░░░░░] 35% Step 2: Audit Agents ━━━
|
|
55
|
+
Agent 5/7 complete (Architecture, Dependencies, Duplication, Performance, Consistency done)
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
On audit completion, clear progress: `node node_modules/wogiflow/scripts/flow-progress-tracker.js clear`
|
|
59
|
+
|
|
34
60
|
## How It Works
|
|
35
61
|
|
|
36
62
|
### Step 1: Gather Project Files
|
|
@@ -291,14 +317,146 @@ Top 5 Quick Wins (highest impact, lowest effort):
|
|
|
291
317
|
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
292
318
|
```
|
|
293
319
|
|
|
320
|
+
### Step 4.5: Pattern Promotion Analysis (MANDATORY)
|
|
321
|
+
|
|
322
|
+
After displaying the report, run pattern promotion analysis **before** offering post-audit actions. This step has 3 phases.
|
|
323
|
+
|
|
324
|
+
#### Phase 1: AI Semantic Clustering
|
|
325
|
+
|
|
326
|
+
Launch a single Agent (`subagent_type=Explore`, `model="sonnet"`) with ALL findings from the 7 audit agents:
|
|
327
|
+
|
|
328
|
+
```
|
|
329
|
+
You are a pattern clustering judge. You receive findings from 7 audit agents.
|
|
330
|
+
Your job is to semantically group findings that describe the SAME underlying issue.
|
|
331
|
+
|
|
332
|
+
IMPORTANT: This is semantic matching, not string matching.
|
|
333
|
+
"Missing try-catch", "no error handling", and "unprotected JSON.parse" are the SAME pattern.
|
|
334
|
+
"Inconsistent naming" and "mixed camelCase and snake_case" are the SAME pattern.
|
|
335
|
+
|
|
336
|
+
For the findings below, produce a JSON array of clusters:
|
|
337
|
+
|
|
338
|
+
[findings from all 7 agents pasted here]
|
|
339
|
+
|
|
340
|
+
Output format (ONLY output valid JSON, no markdown):
|
|
341
|
+
[
|
|
342
|
+
{
|
|
343
|
+
"patternId": "kebab-case-id",
|
|
344
|
+
"category": "architecture|code-style|security|performance|consistency|dependencies|tech-debt",
|
|
345
|
+
"description": "One sentence describing the underlying issue",
|
|
346
|
+
"severity": "HIGH|MEDIUM|LOW",
|
|
347
|
+
"isSystemic": true/false (true if 5+ files affected),
|
|
348
|
+
"instanceCount": N,
|
|
349
|
+
"instances": [{"file": "path", "detail": "brief description"}]
|
|
350
|
+
}
|
|
351
|
+
]
|
|
352
|
+
|
|
353
|
+
Rules:
|
|
354
|
+
- Merge findings that describe the same root cause, even if different agents worded them differently
|
|
355
|
+
- patternId must be stable: same issue should produce the same ID across audits
|
|
356
|
+
- severity: HIGH if 5+ files, MEDIUM if 3-4, LOW if 1-2
|
|
357
|
+
- Do NOT create a cluster for single-file, one-off issues — only patterns (2+ instances)
|
|
358
|
+
- Maximum 20 clusters (if more, merge the most similar)
|
|
359
|
+
```
|
|
360
|
+
|
|
361
|
+
Parse the AI output as JSON. If parsing fails, log a warning and skip to Step 5.
|
|
362
|
+
|
|
363
|
+
#### Phase 2: Cross-Reference & Promotion
|
|
364
|
+
|
|
365
|
+
Run the promote command with the clustered findings:
|
|
366
|
+
|
|
367
|
+
```bash
|
|
368
|
+
node node_modules/wogiflow/scripts/flow-audit.js promote '<clusters-json>'
|
|
369
|
+
```
|
|
370
|
+
|
|
371
|
+
This automatically:
|
|
372
|
+
1. Checks each pattern against `decisions.md` — marks `ENFORCEMENT_GAP` if a rule already exists
|
|
373
|
+
2. Records/increments patterns in `feedback-patterns.md`
|
|
374
|
+
3. Auto-promotes to `decisions.md` when count reaches threshold (default: 3)
|
|
375
|
+
4. Detects `RECURRING` patterns by comparing with `last-audit.json`
|
|
376
|
+
|
|
377
|
+
Display the promotion summary in the report:
|
|
378
|
+
|
|
379
|
+
```
|
|
380
|
+
━━━ PATTERN PROMOTION ━━━
|
|
381
|
+
Patterns found: N
|
|
382
|
+
- Promoted to rules: N (auto-promoted to decisions.md)
|
|
383
|
+
- Tracking: N (count below threshold)
|
|
384
|
+
- Enforcement gaps: N (rule exists, still violated!)
|
|
385
|
+
- New patterns: N (first occurrence)
|
|
386
|
+
- Recurring: N (seen in previous audit)
|
|
387
|
+
|
|
388
|
+
[For each ENFORCEMENT_GAP]:
|
|
389
|
+
⚠ ENFORCEMENT GAP: "pattern description"
|
|
390
|
+
Rule in: ## Section > ### Rule Name
|
|
391
|
+
Still violated in N files
|
|
392
|
+
|
|
393
|
+
[For each PROMOTED]:
|
|
394
|
+
✓ PROMOTED: "pattern description" (N occurrences → decisions.md)
|
|
395
|
+
|
|
396
|
+
[For each SYSTEMIC (5+ files)]:
|
|
397
|
+
! SYSTEMIC: "pattern description" (N files affected)
|
|
398
|
+
Consider creating an immediate rule
|
|
399
|
+
```
|
|
400
|
+
|
|
401
|
+
#### Phase 3: Enforcement Gap Investigation (on demand)
|
|
402
|
+
|
|
403
|
+
This phase runs ONLY if enforcement gaps were found AND the user selects it from post-audit actions.
|
|
404
|
+
|
|
405
|
+
For each `ENFORCEMENT_GAP` pattern, launch an Agent (`subagent_type=Explore`, `model="sonnet"`):
|
|
406
|
+
|
|
407
|
+
```
|
|
408
|
+
You are investigating why a rule in decisions.md is still being violated.
|
|
409
|
+
|
|
410
|
+
THE RULE (from decisions.md):
|
|
411
|
+
[insert ruleText from promotion results]
|
|
412
|
+
|
|
413
|
+
THE VIOLATIONS (files still violating this rule):
|
|
414
|
+
[insert instances array from cluster]
|
|
415
|
+
|
|
416
|
+
Investigate WHY this rule was violated. Check:
|
|
417
|
+
1. Is the rule too vague? Does it say WHAT to do but not HOW?
|
|
418
|
+
2. Is the rule too long or buried in a large section? Key constraint might be lost in noise.
|
|
419
|
+
3. Is the rule outdated? Does it reference patterns/APIs that have changed?
|
|
420
|
+
4. Is the rule in the wrong section? Might be overlooked if categorized poorly.
|
|
421
|
+
5. Does the rule have programmatic enforcement? Or is it text-only with no automated checks?
|
|
422
|
+
6. Does the rule conflict with another rule or common practice in the codebase?
|
|
423
|
+
7. Does the code predate the rule? (Check git blame dates vs rule creation date if available)
|
|
424
|
+
|
|
425
|
+
Output format (ONLY output valid JSON):
|
|
426
|
+
{
|
|
427
|
+
"rootCause": "TOO_VAGUE|TOO_LONG|OUTDATED|WRONG_SCOPE|NO_ENFORCEMENT|CONTRADICTORY|PRE_EXISTING",
|
|
428
|
+
"explanation": "2-3 sentences explaining what's wrong",
|
|
429
|
+
"recommendation": "REWRITE|SPLIT|ADD_TO_STANDARDS_GATE|BACKFILL|NO_ACTION",
|
|
430
|
+
"suggestedFix": "If REWRITE or SPLIT: the improved rule text. If ADD_TO_STANDARDS_GATE: the pattern to add. If BACKFILL: description of cleanup needed."
|
|
431
|
+
}
|
|
432
|
+
```
|
|
433
|
+
|
|
434
|
+
Display investigation results:
|
|
435
|
+
|
|
436
|
+
```
|
|
437
|
+
━━━ ENFORCEMENT GAP INVESTIGATION ━━━
|
|
438
|
+
[For each gap]:
|
|
439
|
+
Pattern: "description"
|
|
440
|
+
Root cause: TOO_VAGUE — "The rule says to handle errors but doesn't specify the pattern"
|
|
441
|
+
Recommendation: REWRITE
|
|
442
|
+
Suggested fix: [improved rule text]
|
|
443
|
+
|
|
444
|
+
Actions available:
|
|
445
|
+
- Apply suggested rewrites to decisions.md
|
|
446
|
+
- Create backfill cleanup tasks in ready.json
|
|
447
|
+
- Add patterns to standards gate for programmatic enforcement
|
|
448
|
+
```
|
|
449
|
+
|
|
294
450
|
### Step 5: Post-Audit Actions
|
|
295
451
|
|
|
296
|
-
After displaying the report, offer these options using AskUserQuestion:
|
|
452
|
+
After displaying the report and promotion summary, offer these options using AskUserQuestion:
|
|
297
453
|
|
|
298
454
|
1. **Create tasks** — Convert high-priority findings to stories/tasks in ready.json
|
|
299
455
|
2. **Add to tech debt** — Add findings to `.workflow/state/tech-debt.json` via `/wogi-debt`
|
|
300
456
|
3. **Save report** — Persist to `.workflow/audits/YYYY-MM-DD-audit.md`
|
|
301
|
-
4. **Create rules** —
|
|
457
|
+
4. **Create rules** — Manually promote specific patterns via `/wogi-decide`
|
|
458
|
+
5. **Investigate enforcement gaps** — Run Phase 3 investigation for all `ENFORCEMENT_GAP` patterns
|
|
459
|
+
6. **Apply all promotions** — Batch-confirm all auto-promoted rules (already written by Phase 2)
|
|
302
460
|
|
|
303
461
|
### Step 6: Persist Report
|
|
304
462
|
|
|
@@ -323,7 +481,35 @@ Regardless of user choice, always save the audit results to `.workflow/state/las
|
|
|
323
481
|
"medium": 18,
|
|
324
482
|
"low": 19
|
|
325
483
|
},
|
|
326
|
-
"topFindings": [...]
|
|
484
|
+
"topFindings": [...],
|
|
485
|
+
"patterns": [
|
|
486
|
+
{
|
|
487
|
+
"patternId": "missing-error-handling",
|
|
488
|
+
"category": "security",
|
|
489
|
+
"description": "Functions missing try-catch around I/O operations",
|
|
490
|
+
"instanceCount": 7,
|
|
491
|
+
"severity": "HIGH",
|
|
492
|
+
"status": "ENFORCEMENT_GAP",
|
|
493
|
+
"count": 5,
|
|
494
|
+
"isSystemic": true
|
|
495
|
+
}
|
|
496
|
+
],
|
|
497
|
+
"enforcementGaps": [
|
|
498
|
+
{
|
|
499
|
+
"patternId": "json-parse-safety",
|
|
500
|
+
"ruleLocation": "## Coding Standards",
|
|
501
|
+
"rootCause": "TOO_VAGUE",
|
|
502
|
+
"recommendation": "REWRITE",
|
|
503
|
+
"suggestedFix": "..."
|
|
504
|
+
}
|
|
505
|
+
],
|
|
506
|
+
"promotions": {
|
|
507
|
+
"promoted": 2,
|
|
508
|
+
"tracking": 5,
|
|
509
|
+
"gaps": 1,
|
|
510
|
+
"new": 3,
|
|
511
|
+
"recurring": 4
|
|
512
|
+
}
|
|
327
513
|
}
|
|
328
514
|
```
|
|
329
515
|
|
|
@@ -530,14 +530,36 @@ Display:
|
|
|
530
530
|
|
|
531
531
|
Display: ` Data-fetching hooks... ✓ react-query, 80 useGet* hooks`
|
|
532
532
|
|
|
533
|
-
15. **
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
533
|
+
15. **Run registry-manager scan (comprehensive registry population):**
|
|
534
|
+
|
|
535
|
+
**CRITICAL**: This step replaces manual AI-driven app-map population. The registry
|
|
536
|
+
manager runs ALL active scanners (components, functions, APIs, schemas, services)
|
|
537
|
+
with recursive directory traversal and glob-based discovery. This ensures no
|
|
538
|
+
subdirectory components, co-located hooks, or separated-export API functions are missed.
|
|
539
|
+
|
|
540
|
+
```javascript
|
|
541
|
+
// Run the full registry scan — this handles recursion, glob patterns, and all export patterns
|
|
542
|
+
const { execSync } = require('child_process');
|
|
543
|
+
try {
|
|
544
|
+
execSync('node node_modules/wogiflow/scripts/flow-registry-manager.js scan', {
|
|
545
|
+
cwd: projectRoot,
|
|
546
|
+
stdio: 'inherit',
|
|
547
|
+
timeout: 60000
|
|
548
|
+
});
|
|
549
|
+
} catch (err) {
|
|
550
|
+
console.warn('Registry manager scan failed, falling back to individual scanners:', err.message);
|
|
551
|
+
// Individual scanners from steps 13-14 already ran as fallback
|
|
552
|
+
}
|
|
553
|
+
```
|
|
554
|
+
|
|
555
|
+
The component scanner generates `app-map.md` from scan results (grouped by category/directory).
|
|
556
|
+
The function scanner discovers co-located hooks via glob patterns (`src/**/hooks`, etc.).
|
|
557
|
+
The API scanner handles all export patterns including separated `const + export default`.
|
|
558
|
+
|
|
559
|
+
Display: ` Registry scan... ✓ All registries populated (components, functions, APIs)`
|
|
560
|
+
|
|
561
|
+
**NOTE**: If the registry manager scan succeeds, it supersedes the individual scanner runs
|
|
562
|
+
from steps 13-14. The scanners are idempotent — running them twice just refreshes the same data.
|
|
541
563
|
|
|
542
564
|
16. **Extract file templates:**
|
|
543
565
|
```javascript
|
|
@@ -23,6 +23,31 @@ Auto-detects when to use multi-pass (4 sequential passes) vs parallel (3 agents)
|
|
|
23
23
|
/wogi-review --skip-optimization # Skip solution optimization suggestions
|
|
24
24
|
```
|
|
25
25
|
|
|
26
|
+
## Progress Tracking
|
|
27
|
+
|
|
28
|
+
At each phase checkpoint, display a progress bar AND update the progress state file:
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
node node_modules/wogiflow/scripts/flow-progress-tracker.js update '{"taskId":"wf-XXX","command":"/wogi-review","phase":"AI Review","phaseNum":2,"totalPhases":5,"step":"Agent 3/6 complete","stepNum":3,"totalSteps":6}'
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
**Standard format for each checkpoint:**
|
|
35
|
+
```
|
|
36
|
+
━━━ PROGRESS: [████░░░░░░] 40% Phase 2: AI Review ━━━
|
|
37
|
+
Agent 3/6 complete
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
**Phase mapping for /wogi-review:**
|
|
41
|
+
| Phase | phaseNum | Description |
|
|
42
|
+
|-------|----------|-------------|
|
|
43
|
+
| 1 | Verification Gates | Syntax, lint, tests |
|
|
44
|
+
| 2 | AI Review | N agents (sub-steps = agents) |
|
|
45
|
+
| 3 | Standards + Promotion | Compliance check + pattern learning |
|
|
46
|
+
| 4 | Optimization | Solution suggestions |
|
|
47
|
+
| 5 | Post-Review | Fix routing, learning, archive |
|
|
48
|
+
|
|
49
|
+
On review completion, clear progress: `node node_modules/wogiflow/scripts/flow-progress-tracker.js clear`
|
|
50
|
+
|
|
26
51
|
## Review Phases (v5.0)
|
|
27
52
|
|
|
28
53
|
```
|
|
@@ -695,7 +720,20 @@ Or if the runtime script is not available, manually check:
|
|
|
695
720
|
- `naming-conventions.md` - File names (kebab-case), catch variables (`err` not `e`)
|
|
696
721
|
- `security-patterns.md` - Raw JSON.parse, unprotected fs.readFileSync
|
|
697
722
|
|
|
698
|
-
**3.3.
|
|
723
|
+
**3.3. Pattern Promotion on Violations**:
|
|
724
|
+
|
|
725
|
+
After running the standards check, feed any violations through the pattern promotion pipeline (same infrastructure as `/wogi-audit` Step 4.5):
|
|
726
|
+
|
|
727
|
+
1. **Cluster violations by pattern**: Group findings that describe the same underlying issue. For review (smaller scope than audit), simple grouping by violation `type` + `category` is sufficient — no AI clustering agent needed.
|
|
728
|
+
|
|
729
|
+
2. **Cross-reference with learning pipeline**: For each cluster, call `flow-audit.js promote` or use the learner directly:
|
|
730
|
+
- Check `decisions.md` — if a rule exists for this pattern, it's an **ENFORCEMENT_GAP**
|
|
731
|
+
- Record/increment in `feedback-patterns.md` via `recordAuditPattern()`
|
|
732
|
+
- Auto-promote to `decisions.md` if count reaches threshold (default 3)
|
|
733
|
+
|
|
734
|
+
3. **Flag enforcement gaps**: When a violation matches an existing rule in `decisions.md`, this is critical — the rule exists but the AI still violated it. Mark as `ENFORCEMENT_GAP` and include in the report.
|
|
735
|
+
|
|
736
|
+
**3.4. Display Phase 3 results**:
|
|
699
737
|
```
|
|
700
738
|
═══════════════════════════════════════
|
|
701
739
|
PHASE 3: STANDARDS COMPLIANCE [3/5]
|
|
@@ -705,6 +743,13 @@ PHASE 3: STANDARDS COMPLIANCE [3/5]
|
|
|
705
743
|
✗ naming-conventions: 1 violation [MUST FIX]
|
|
706
744
|
→ src/utils.ts:45 - Catch variable "e" should be "err"
|
|
707
745
|
|
|
746
|
+
Pattern Learning:
|
|
747
|
+
Patterns tracked: N
|
|
748
|
+
- ENFORCEMENT_GAP: 1 (rule exists, still violated!)
|
|
749
|
+
⚠ "err in catch blocks" — rule in ## Coding Standards, violated in src/utils.ts
|
|
750
|
+
- Tracked: 1 (security-json-parse-safety: 2/3 toward promotion)
|
|
751
|
+
- Promoted: 0
|
|
752
|
+
|
|
708
753
|
Summary: N checks, M violations (X must-fix, Y warnings)
|
|
709
754
|
|
|
710
755
|
✓ Phase 3 complete. Proceeding to Phase 4...
|
|
@@ -770,10 +815,11 @@ Phase Results:
|
|
|
770
815
|
Phase 1 (Verification): 4/4 gates passed
|
|
771
816
|
Phase 2 (AI Review): M findings from N agents
|
|
772
817
|
Phase 2.5 (Git Claims): X verified, Y missing, Z unplanned
|
|
773
|
-
Phase 3 (Standards): N checks, M violations
|
|
818
|
+
Phase 3 (Standards): N checks, M violations, P patterns tracked
|
|
774
819
|
Phase 4 (Optimization): N suggestions
|
|
775
820
|
|
|
776
821
|
Total Findings: N (X critical, Y high, Z medium, W low)
|
|
822
|
+
Pattern Learning: P patterns tracked, M promoted, G enforcement gaps
|
|
777
823
|
Phases: 5/5 executed
|
|
778
824
|
```
|
|
779
825
|
|
|
@@ -867,22 +913,48 @@ After the fix loop completes (Options 1/2), or immediately (Option 4), handle un
|
|
|
867
913
|
|
|
868
914
|
**Learning signal detection:**
|
|
869
915
|
|
|
870
|
-
After completing fixes,
|
|
871
|
-
1. If 3+ findings share the same `category` or `file` → log to `feedback-patterns.md`
|
|
872
|
-
2. Display warning suggesting `/wogi-decide` to create a preventive rule
|
|
916
|
+
After completing fixes, feed ALL findings (not just standards violations) through the pattern promotion pipeline:
|
|
873
917
|
|
|
874
|
-
**
|
|
918
|
+
1. **Cluster all findings by category + type** — group findings that describe the same underlying pattern
|
|
919
|
+
2. **Run promotion pipeline** for each cluster:
|
|
920
|
+
- Check `decisions.md` for enforcement gaps (rule exists, still violated)
|
|
921
|
+
- Record/increment in `feedback-patterns.md` via the standards learner
|
|
922
|
+
- Auto-promote to `decisions.md` when count reaches threshold
|
|
923
|
+
3. **Enforcement gap investigation** — for any `ENFORCEMENT_GAP` patterns, launch an Agent (subagent_type=Explore, model=sonnet) to investigate WHY the rule was violated:
|
|
924
|
+
- Read the specific rule from `decisions.md`
|
|
925
|
+
- Read the violating code
|
|
926
|
+
- Classify root cause: `TOO_VAGUE` | `TOO_LONG` | `OUTDATED` | `NO_ENFORCEMENT` | `CONTRADICTORY` | `PRE_EXISTING`
|
|
927
|
+
- Recommend action: `REWRITE` | `SPLIT` | `ADD_TO_STANDARDS_GATE` | `BACKFILL` | `NO_ACTION`
|
|
928
|
+
- Display investigation results with suggested fixes
|
|
929
|
+
|
|
930
|
+
4. **Display learning summary**:
|
|
931
|
+
```
|
|
932
|
+
━━━ PATTERN LEARNING ━━━
|
|
933
|
+
Patterns from this review: N
|
|
934
|
+
- Promoted to rules: M (auto-promoted to decisions.md)
|
|
935
|
+
- Tracking: K (count below threshold)
|
|
936
|
+
- Enforcement gaps: G (rule exists, still violated!)
|
|
937
|
+
[For each gap]:
|
|
938
|
+
⚠ "pattern description" — Root cause: TOO_VAGUE
|
|
939
|
+
Recommendation: REWRITE — [suggested improved rule text]
|
|
940
|
+
```
|
|
941
|
+
|
|
942
|
+
5. **Offer gap resolution**: If enforcement gaps were found, offer to apply suggested rewrites to `decisions.md` immediately — fixing the rule while the violation is fresh in context.
|
|
943
|
+
|
|
944
|
+
**Update `last-review.json`**: Set `"triaged": true` on the review after all findings are addressed (fixed, deferred, or dismissed). Include `patterns` and `enforcementGaps` arrays in the saved review (same schema as `last-audit.json`).
|
|
875
945
|
|
|
876
946
|
**Config toggles** (all in `config.originTaskTracing`):
|
|
877
947
|
- `annotateCompletedTasks: false` → Skip same-session detection, all findings create standalone tasks
|
|
878
948
|
- `traceOrigin: false` → No `originTask` field on fix tasks
|
|
879
|
-
- `learningSignal.enabled: false` → No pattern detection
|
|
949
|
+
- `learningSignal.enabled: false` → No pattern detection or promotion
|
|
880
950
|
- `sameSessionWindow: "2h"` → Time window for same-session detection (default: 2 hours)
|
|
881
951
|
|
|
882
|
-
**5.4. Learning capture**:
|
|
883
|
-
|
|
884
|
-
-
|
|
885
|
-
-
|
|
952
|
+
**5.4. Learning capture (ENHANCED — uses audit promotion pipeline)**:
|
|
953
|
+
The learning capture now uses the same infrastructure as `/wogi-audit` Step 4.5:
|
|
954
|
+
- `flow-standards-learner.js`: `recordAuditPattern()`, `checkEnforcementGap()`, `promoteToDecisions()`
|
|
955
|
+
- `flow-audit.js`: `promoteAuditPatterns()` for batch processing
|
|
956
|
+
|
|
957
|
+
This ensures that patterns discovered during code review feed into the same promotion pipeline as audit findings — a violation found 2x in audits and 1x in review reaches the threshold of 3 and auto-promotes.
|
|
886
958
|
|
|
887
959
|
**5.5. Archive review report**:
|
|
888
960
|
- Save review report to `.workflow/reviews/YYYY-MM-DD-HHMMSS-review.md`
|
|
@@ -902,8 +974,9 @@ Findings: N total
|
|
|
902
974
|
Fixed: M | Tasks Created: Z | Annotated: A | Dismissed: W
|
|
903
975
|
Saved to: .workflow/state/last-review.json
|
|
904
976
|
|
|
905
|
-
|
|
906
|
-
|
|
977
|
+
Pattern Learning:
|
|
978
|
+
Patterns tracked: N | Promoted: M | Enforcement gaps: G
|
|
979
|
+
[If gaps found]: Gap fixes applied to decisions.md
|
|
907
980
|
|
|
908
981
|
Run /wogi-review-fix --pending to batch-process deferred items.
|
|
909
982
|
|
|
@@ -341,30 +341,75 @@ After implementing all scenarios, BEFORE quality gates:
|
|
|
341
341
|
|
|
342
342
|
**Anti-pattern: "Dead service"** — a service that exists, compiles, is imported somewhere, but its critical method is never called by the thing that should trigger it. This passes lint, typecheck, and wiring checks (because the file IS imported) but the feature doesn't work.
|
|
343
343
|
|
|
344
|
-
### Step 3.55:
|
|
344
|
+
### Step 3.55: Inventory-Based Verification (for "remove/fix/replace all X" tasks)
|
|
345
345
|
|
|
346
|
-
**Activates when**: The task involves removing, cleaning up, or
|
|
346
|
+
**Activates when**: The task involves removing, cleaning up, fixing, or replacing ALL instances of something (e.g., "remove all mock data", "fix all console.log", "replace all hardcoded URLs", "remove all deprecated APIs").
|
|
347
347
|
|
|
348
|
-
**
|
|
348
|
+
**The problem this solves**: Pattern-based search (grep, regex) only finds instances that match a naming convention. Semantic variants — inline hardcoded arrays, helper functions that wrap the target, useState initializers with fake data, constants not named with the expected prefix — are invisible to pattern search. In practice, pattern search finds ~60-70% of instances. The AI then declares "done" and the remaining 30-40% persist undetected. This has caused repeated false completions (3-4x on a single project).
|
|
349
349
|
|
|
350
|
-
**
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
350
|
+
**Core principle**: For each file in scope, ask **"does anything in this file serve the PURPOSE of [what we're removing]?"** — regardless of what it's named. Reason about function, not strings.
|
|
351
|
+
|
|
352
|
+
**Procedure (3 phases — ALL mandatory)**:
|
|
353
|
+
|
|
354
|
+
#### Phase A: Pre-Implementation Inventory (BEFORE any code changes)
|
|
355
|
+
|
|
356
|
+
1. **Identify all files in scope** — every file that could contain instances of [X]. Use both:
|
|
357
|
+
- Pattern search (grep/glob) for syntactic matches
|
|
358
|
+
- File-by-file reading of components/pages/modules that CONSUME data related to [X]
|
|
359
|
+
|
|
360
|
+
2. **For each file, answer the semantic question**: "Does anything in this file serve the purpose of [what we're removing]?" Examples by task type:
|
|
361
|
+
|
|
362
|
+
| Task Type | Semantic Question | What Pattern Search Misses |
|
|
363
|
+
|-----------|-------------------|---------------------------|
|
|
364
|
+
| Remove mock data | "Where does this component get its displayed data? Is it from an API call or a local constant/array/useState?" | Inline arrays (`const customers = [{...}]`), useState initializers (`useState([...POLICY_DATA])`), export constants not named `MOCK_*` |
|
|
365
|
+
| Remove console.log | "What in this file produces output to any channel?" | `console.warn`, `console.debug`, `debugger`, `alert()`, custom logger wrappers |
|
|
366
|
+
| Replace hardcoded URLs | "What string values in this file resolve to network addresses?" | URLs built from concatenation, template literals, env var fallbacks with hardcoded defaults |
|
|
367
|
+
| Remove deprecated API | "What in this file provides the same FUNCTIONALITY as the deprecated API?" | Wrapper functions, polyfills, compatibility shims, re-implementations |
|
|
368
|
+
| Fix all raw JSON.parse | "What in this file deserializes JSON?" | Utility functions that call JSON.parse internally, library wrappers |
|
|
369
|
+
|
|
370
|
+
3. **Produce a numbered inventory** and display it to the user:
|
|
371
|
+
```
|
|
372
|
+
━━━ PRE-IMPLEMENTATION INVENTORY ━━━
|
|
373
|
+
Found N instances of [X] across M files:
|
|
374
|
+
|
|
375
|
+
1. [file:lines] — [description] [TYPE: syntactic|semantic]
|
|
376
|
+
2. [file:lines] — [description] [TYPE: syntactic|semantic]
|
|
377
|
+
...
|
|
378
|
+
|
|
379
|
+
Total: N instances (S syntactic, M semantic)
|
|
380
|
+
Confirm inventory is complete before proceeding? [Y/adjust]
|
|
381
|
+
```
|
|
382
|
+
|
|
383
|
+
4. **Wait for user confirmation** that the inventory is complete. If the user identifies missing items, add them. This step is CRITICAL — it commits the AI to a concrete scope that can be verified later.
|
|
384
|
+
|
|
385
|
+
#### Phase B: Implementation
|
|
386
|
+
|
|
387
|
+
5. Implement the removal/fix/replacement for EVERY item in the inventory. Each inventory item becomes a trackable unit of work.
|
|
388
|
+
|
|
389
|
+
#### Phase C: Post-Implementation Re-Inventory (AFTER all changes)
|
|
390
|
+
|
|
391
|
+
6. **Re-run the SAME semantic scan** from Phase A on the SAME set of files. Use the same questions — do NOT downgrade to pattern-only search.
|
|
392
|
+
|
|
393
|
+
7. **Diff the inventories**:
|
|
394
|
+
```
|
|
395
|
+
━━━ POST-IMPLEMENTATION VERIFICATION ━━━
|
|
396
|
+
Re-scanned M files for [X]:
|
|
397
|
+
|
|
398
|
+
1. [file:lines] — [description] → REMOVED ✓
|
|
399
|
+
2. [file:lines] — [description] → REMOVED ✓
|
|
400
|
+
3. [file:lines] — [description] → STILL PRESENT ✗
|
|
401
|
+
...
|
|
402
|
+
|
|
403
|
+
Result: N/N removed (0 remaining)
|
|
404
|
+
```
|
|
405
|
+
|
|
406
|
+
8. **If ANY items remain** → task is NOT done. Fix the remaining items and re-verify. Do NOT proceed to quality gates with remaining items.
|
|
407
|
+
|
|
408
|
+
9. **If new instances are discovered** during re-scan that weren't in the original inventory → add them, fix them, and note them as "discovered during verification."
|
|
409
|
+
|
|
410
|
+
**Why this works**: The inventory creates a concrete, numbered checklist BEFORE implementation. The AI cannot claim "done" when the post-inventory shows items still present — the evidence is in the conversation. The pre/post diff is unfakeable.
|
|
411
|
+
|
|
412
|
+
**Skip conditions**: Tasks that target a specific file or a small known set (e.g., "remove the mock import in Dashboard.tsx") don't need the full inventory — they're scoped enough already. The inventory is for "all X" / "every X" / "clean up X everywhere" tasks.
|
|
368
413
|
|
|
369
414
|
### Step 3.6: Integration Wiring Validation (MANDATORY)
|
|
370
415
|
|
|
@@ -68,6 +68,8 @@ flow parallel check # See available parallel tasks
|
|
|
68
68
|
| 1.9.1+ | 2.1.72+ | ExitWorktree, Agent model param, effort levels, /plan description, fd auto-approval, prompt cache fix |
|
|
69
69
|
| 1.9.5+ | 2.1.73+ | SessionStart double-fire fix, hook context pollution fix, modelOverrides, subagent model fix on Bedrock/Vertex |
|
|
70
70
|
| 1.9.5+ | 2.1.74+ | SessionEnd timeout fix, managed policy ask rules, autoMemoryDirectory, Agent tool routing gate fix |
|
|
71
|
+
| 2.0.0+ | 2.1.76+ | PostCompact hook, Elicitation/ElicitationResult events, deferred tool schema fix |
|
|
72
|
+
| 2.1.0+ | 2.1.77+ | PreToolUse allow/deny separation, 128k output tokens, worktree sparse checkout, compaction circuit breaker |
|
|
71
73
|
|
|
72
74
|
### Environment Variables (2.1.19+)
|
|
73
75
|
|
|
@@ -161,6 +163,8 @@ await cancelTask('wf-123', 'superseded', false);
|
|
|
161
163
|
| SessionEnd | session-end.js | Request logging, progress update |
|
|
162
164
|
| TaskCompleted | task-completed.js | Move task to recentlyCompleted |
|
|
163
165
|
| ConfigChange | config-change.js | Re-sync bridge on mid-session config changes |
|
|
166
|
+
| InstructionsLoaded | instructions-loaded.js | Package check, rule conflicts, auto-onboard |
|
|
167
|
+
| PostCompact | post-compact.js | Re-inject state after context compaction (2.1.76+) |
|
|
164
168
|
|
|
165
169
|
### Features in Latest Release
|
|
166
170
|
|
|
@@ -209,6 +213,29 @@ await cancelTask('wf-123', 'superseded', false);
|
|
|
209
213
|
- **Plugin install/marketplace fixes**: Fixed `/plugin install` for marketplace plugins with local sources, and marketplace update not syncing git submodules. WogiFlow's plugin system is internal (not marketplace-based), so no direct impact.
|
|
210
214
|
- **`--plugin-dir` override change**: Local dev copies now override installed marketplace plugins with the same name. Useful for WogiFlow plugin development workflows.
|
|
211
215
|
|
|
216
|
+
### Features in 2.1.76+
|
|
217
|
+
|
|
218
|
+
- **PostCompact hook**: New hook event that fires after context compaction completes. WogiFlow uses this to re-inject critical state (active task, workflow phase, durable session progress) and re-arm the routing-pending flag. Fully implemented in `scripts/hooks/core/post-compact.js` and registered in `settings.json`.
|
|
219
|
+
- **MCP elicitation support**: MCP servers can now request structured input mid-task via interactive dialogs (form fields or browser URL). New `Elicitation` and `ElicitationResult` hooks available for intercepting/overriding responses. WogiFlow lists these in `UNUSED_SUPPORTED_EVENTS` — not yet implemented but ready for future use (e.g., interactive clarification forms during task triage).
|
|
220
|
+
- **Deferred tools schema fix after compaction**: Previously, tools loaded via `ToolSearch` lost their input schemas after compaction, causing array and number parameters to be rejected with type errors. Now fixed. WogiFlow sessions using deferred MCP tools are no longer affected.
|
|
221
|
+
- **Auto-compaction circuit breaker**: Auto-compaction now stops after 3 consecutive failures instead of retrying indefinitely. WogiFlow's PostCompact hook tracks compaction frequency and warns when multiple compactions occur in quick succession, indicating potential circuit breaker activation.
|
|
222
|
+
- **`/effort` slash command**: New command to set model effort level. WogiFlow already maps task levels to effort (L3→low, L2→medium, L1/L0→high) — this provides a manual override path.
|
|
223
|
+
- **`-n`/`--name` CLI flag**: Set a display name for the session at startup. Can be used with WogiFlow task IDs for clearer session identification.
|
|
224
|
+
- **`worktree.sparsePaths` setting**: New setting for `claude --worktree` in large monorepos to check out only needed directories via git sparse-checkout. WogiFlow documents this in the worktree comparison table but does not auto-configure it — users should set `sparsePaths` in their Claude Code config for monorepo projects.
|
|
225
|
+
|
|
226
|
+
### Features in 2.1.77+
|
|
227
|
+
|
|
228
|
+
- **PreToolUse "allow" no longer bypasses deny rules**: Previously, a PreToolUse hook returning `permissionDecision: "allow"` would bypass explicit deny rules (including enterprise managed settings). Now `allow` only means "this hook permits it" — deny rules from permissions/managed settings still apply independently. WogiFlow's routing gate returns `allow` after routing is complete and `deny` when routing is pending. This fix is CORRECT behavior for WogiFlow — our `allow` should never have overridden user/enterprise deny rules. No code change needed.
|
|
229
|
+
- **Compound bash "Always Allow" fix**: "Always Allow" on compound bash commands (e.g., `cd src && npm test`) now saves a single rule for the full string instead of per-subcommand, preventing dead rules and repeated permission prompts. WogiFlow's generated permission rules in `claude-bridge.js` use single-command patterns (e.g., `Bash(npm install *)`) so this fix does not affect WogiFlow-generated permissions. Users who manually "Always Allow" compound commands will see improved behavior.
|
|
230
|
+
- **Increased output token limits**: Default max output for Opus 4.6 increased to 64k tokens. Upper bound for both Opus 4.6 and Sonnet 4.6 increased to 128k tokens. WogiFlow's model registry updated: `claude-sonnet-4-6.maxOutputTokens` changed from 64000 to 128000. Opus 4.6 was already at 128000.
|
|
231
|
+
- **Background agent partial results preserved**: Killing a background agent now preserves its partial results in conversation context. WogiFlow's explore phase agents (5-6 launched in parallel) benefit — if one agent is killed or times out, its partial findings are still available.
|
|
232
|
+
- **Agent tool resume parameter removed**: The Agent tool no longer accepts a `resume` parameter. Use `SendMessage({to: agentId})` to continue a previously spawned agent. WogiFlow does not use the `resume` parameter (confirmed by codebase search). `SendMessage` now auto-resumes stopped agents in the background instead of returning an error.
|
|
233
|
+
- **Improved `claude plugin validate`**: Now checks skill, agent, and command frontmatter plus hooks/hooks.json, catching YAML parse errors and schema violations. WogiFlow should periodically run this to catch frontmatter issues.
|
|
234
|
+
- **`--resume` truncation fix**: Fixed `--resume` silently truncating recent conversation history due to a race between memory-extraction writes and the main transcript. Improves reliability of session resumption for WogiFlow durable sessions.
|
|
235
|
+
- **Stale worktree cleanup race condition fix**: Fixed a race condition where stale-worktree cleanup could delete an agent worktree just resumed from a previous crash. WogiFlow's parallel execution with worktree isolation benefits from improved safety.
|
|
236
|
+
- **Memory growth fix**: Fixed progress messages surviving compaction in long-running sessions. Reduces memory pressure during long WogiFlow bulk-loop sessions.
|
|
237
|
+
- **Faster startup on macOS**: ~60ms faster by reading keychain credentials in parallel. Faster `--resume` on fork-heavy sessions — up to 45% faster loading and ~100-150MB less peak memory. Benefits WogiFlow sessions with heavy hook context.
|
|
238
|
+
|
|
212
239
|
### Simple Mode Naming Distinction
|
|
213
240
|
|
|
214
241
|
Claude Code's `CLAUDE_CODE_SIMPLE` environment variable (which enables a simplified tool set) is **unrelated** to WogiFlow's `loops.simpleMode` (a lightweight task completion loop using string detection). They are separate features that happen to share the word "simple":
|
|
@@ -229,6 +256,7 @@ Both can be active simultaneously without conflict.
|
|
|
229
256
|
| Squash merge | No (manual) | Yes (`squashOnMerge` config) |
|
|
230
257
|
| Task linking | No | Yes (links to task ID) |
|
|
231
258
|
| Cleanup | Prompted on session exit | Auto after 24h (`autoCleanupHours`) |
|
|
259
|
+
| Sparse checkout | Yes (`worktree.sparsePaths` setting, 2.1.76+) | Not supported — relies on Claude Code native |
|
|
232
260
|
|
|
233
261
|
WogiFlow detects native worktrees and avoids nesting. When launched with `--worktree`, WogiFlow uses the native worktree as-is.
|
|
234
262
|
|
|
@@ -142,7 +142,7 @@ See `.claude/docs/commands.md` for complete command reference.
|
|
|
142
142
|
| "show tasks", "what's ready", "available tasks" | `/wogi-ready` |
|
|
143
143
|
| "project status", "show status", "where are we" | `/wogi-status` |
|
|
144
144
|
| "check health", "workflow health", "is everything ok" | `/wogi-health` |
|
|
145
|
-
| "wrap up", "end session", "that's all" | `/wogi-session-end` |
|
|
145
|
+
| "wrap up", "end session", "that's all" | `/wogi-session-end` (**intent-check required** — see note below) |
|
|
146
146
|
| "compact context", "save context", "running low on context" | `/wogi-pre-compact` |
|
|
147
147
|
| "show roadmap", "what's planned", "future work", "deferred items" | `/wogi-roadmap` |
|
|
148
148
|
| "debug this", "investigate hypotheses", "competing theories", "parallel debug" | `/wogi-debug-hypothesis` |
|
|
@@ -162,6 +162,14 @@ See `.claude/docs/commands.md` for complete command reference.
|
|
|
162
162
|
|
|
163
163
|
**IMPORTANT**: When a user's message matches one of these patterns, immediately invoke the Skill tool with the corresponding command. Do not ask for confirmation. These `/wogi-*` commands satisfy the mandatory routing requirement — you do NOT also need to invoke `/wogi-start` when a detection match exists. `/wogi-start` is the fallback for messages that don't match this table.
|
|
164
164
|
|
|
165
|
+
**Session-end intent check**: `/wogi-session-end` requires extra care. Phrases like "wrap up", "that's all", "let's finish with this" often mean "finish this topic" not "end the entire session." Only invoke `/wogi-session-end` when the user clearly intends to **stop working entirely** — not when they're concluding one topic before moving to another. Examples:
|
|
166
|
+
- "that's all for today, thanks" → session-end (clear finality)
|
|
167
|
+
- "let's wrap up this task and move on to the auth bug" → NOT session-end (continuing work)
|
|
168
|
+
- "I'm done" → session-end (if no follow-up topic mentioned)
|
|
169
|
+
- "let's finish with that and then do X" → NOT session-end (next topic follows)
|
|
170
|
+
|
|
171
|
+
When in doubt, route through `/wogi-start` which will classify correctly.
|
|
172
|
+
|
|
165
173
|
## CRITICAL: Universal Entry Point — ALL Requests
|
|
166
174
|
|
|
167
175
|
**ALL user messages MUST go through a `/wogi-*` command. No direct handling. No self-classification.**
|
|
@@ -274,7 +282,29 @@ Before closing any task, ensure all required gates pass (per `config.json → qu
|
|
|
274
282
|
|
|
275
283
|
## Context Management
|
|
276
284
|
|
|
277
|
-
|
|
285
|
+
Context compaction happens automatically — WogiFlow persists all critical state to disk continuously, and the PostCompact hook restores it after compaction. You do NOT need to manually run `/wogi-pre-compact` before compaction.
|
|
286
|
+
|
|
287
|
+
**What survives compaction automatically** (via PostCompact hook + state files):
|
|
288
|
+
- Active task ID, title, type, and acceptance criteria
|
|
289
|
+
- Which criteria are completed vs pending (from durable-session.json)
|
|
290
|
+
- Current workflow phase
|
|
291
|
+
- Changed files list (from task-checkpoint.json)
|
|
292
|
+
- Last request-log entry number
|
|
293
|
+
- Routing enforcement (re-armed automatically)
|
|
294
|
+
|
|
295
|
+
**`/wogi-pre-compact` is optional** — use it only when you want a detailed summary for a very long session. It is NOT required for state safety.
|
|
296
|
+
|
|
297
|
+
**For L1+ tasks**: The pre-task context estimator (Step 0.25) checks if the task fits in remaining context. If it doesn't → compact BEFORE starting to avoid mid-task compaction.
|
|
298
|
+
|
|
299
|
+
## Compact Instructions
|
|
300
|
+
|
|
301
|
+
When compacting this conversation, preserve the following WogiFlow state:
|
|
302
|
+
- The current task ID and title from `.workflow/state/ready.json` inProgress array
|
|
303
|
+
- Which acceptance criteria are done vs pending
|
|
304
|
+
- The current workflow phase (routing, exploring, coding, validating, completing)
|
|
305
|
+
- The list of files changed in this session
|
|
306
|
+
- Any spec decisions or architectural choices made during this session
|
|
307
|
+
- Read `.workflow/state/task-checkpoint.json` after compaction for full state recovery
|
|
278
308
|
|
|
279
309
|
## Continuous Learning
|
|
280
310
|
|