loki-mode 7.45.0 → 7.46.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.
Files changed (45) hide show
  1. package/README.md +16 -12
  2. package/SKILL.md +5 -5
  3. package/VERSION +1 -1
  4. package/autonomy/CONSTITUTION.md +9 -2
  5. package/autonomy/lib/sentrux-gate.sh +1 -1
  6. package/autonomy/loki +2 -2
  7. package/autonomy/run.sh +355 -92
  8. package/dashboard/__init__.py +1 -1
  9. package/dashboard/registry.py +156 -62
  10. package/dashboard/server.py +9 -10
  11. package/docs/COMPARISON.md +10 -10
  12. package/docs/COMPETITIVE-ANALYSIS.md +1 -1
  13. package/docs/INSTALLATION.md +2 -2
  14. package/docs/P0-SWEEP-PLAN.md +163 -0
  15. package/docs/architecture/STATE-MACHINES.md +18 -19
  16. package/docs/architecture/bmad-loki-voice-agent-council-analysis.md +1 -1
  17. package/docs/auto-claude-comparison.md +14 -11
  18. package/docs/certification/01-core-concepts/lesson.md +12 -11
  19. package/docs/certification/01-core-concepts/quiz.md +6 -6
  20. package/docs/certification/05-troubleshooting/lesson.md +23 -13
  21. package/docs/certification/05-troubleshooting/quiz.md +3 -3
  22. package/docs/certification/answer-key.md +2 -2
  23. package/docs/certification/certification-exam.md +9 -9
  24. package/docs/competitive/bolt-new-analysis.md +1 -1
  25. package/docs/competitive/emergence-others-analysis.md +9 -9
  26. package/docs/competitive/replit-lovable-analysis.md +3 -3
  27. package/docs/cursor-comparison.md +15 -12
  28. package/docs/dashboard-guide.md +9 -7
  29. package/docs/prd-purple-lab-platform-v2.md +1 -1
  30. package/docs/prd-purple-lab-platform.md +3 -3
  31. package/docs/show-hn-post.md +2 -2
  32. package/loki-ts/dist/loki.js +2 -2
  33. package/mcp/__init__.py +1 -1
  34. package/package.json +2 -2
  35. package/plugins/loki-mode/.claude-plugin/plugin.json +2 -2
  36. package/plugins/loki-mode/README.md +1 -1
  37. package/references/magic-rarv-integration.md +1 -1
  38. package/references/quality-control.md +5 -5
  39. package/references/sdlc-phases.md +1 -2
  40. package/skills/00-index.md +1 -1
  41. package/skills/artifacts.md +1 -1
  42. package/skills/healing.md +1 -1
  43. package/skills/magic-modules.md +3 -3
  44. package/skills/quality-gates.md +52 -39
  45. package/skills/testing.md +1 -1
@@ -36,7 +36,7 @@ format: "markdown"
36
36
  contents:
37
37
  - Phase name and duration
38
38
  - Tasks completed (from queue)
39
- - Quality gate results (9 gates)
39
+ - Quality gate results (8 gates)
40
40
  - Coverage metrics
41
41
  - Known issues / TODOs
42
42
  ```
package/skills/healing.md CHANGED
@@ -43,7 +43,7 @@ friction_detection:
43
43
  rule: "Before 'fixing' any quirk, verify it is not an undocumented business rule"
44
44
  action: "Document in .loki/healing/friction-map.json"
45
45
  classification:
46
- business_rule: "Keep and document. Gate 10 blocks removal."
46
+ business_rule: "Keep and document. The backward-compatibility / legacy-healing auditor (healing mode) blocks removal."
47
47
  true_bug: "Fix with characterization test proving the fix."
48
48
  unknown: "Keep until classified. NEVER remove unknown friction."
49
49
  ```
@@ -84,8 +84,8 @@ The combination means: specs drive generation, debate drives quality, and the re
84
84
 
85
85
  ### With Quality Gates
86
86
 
87
- - Gate 11 (documentation coverage) now includes component docs -- each spec becomes part of COMPONENTS.md
88
- - Gate 5 (test coverage) applies to generated tests in `.loki/magic/generated/tests/`
87
+ - Gate 7 (documentation coverage) now includes component docs -- each spec becomes part of COMPONENTS.md
88
+ - Gate 2 (test suite) applies to generated tests in `.loki/magic/generated/tests/`
89
89
  - A new healing-style hook blocks merging when a component's spec has been manually edited but the implementation was not regenerated
90
90
 
91
91
  ---
@@ -190,7 +190,7 @@ loki magic diff Button
190
190
  |-------|-------------|
191
191
  | `skills/healing.md` | Healing-style hooks protect spec edits; friction-map tracks manually edited generated files |
192
192
  | `skills/documentation.md` | Component specs feed COMPONENTS.md; registry feeds ARCHITECTURE.md |
193
- | `skills/quality-gates.md` | Gate 11 includes component doc coverage; debate block = gate failure |
193
+ | `skills/quality-gates.md` | Gate 7 includes component doc coverage; Magic Modules debate (gate 8) block = gate failure |
194
194
  | `skills/agents.md` | `component-designer`, `a11y-auditor` agent types map to personas |
195
195
  | `skills/testing.md` | Generated Vitest and Playwright tests execute under the normal test gates |
196
196
  | `skills/artifacts.md` | Generated components count as artifacts and flow through the artifact pipeline |
@@ -2,25 +2,42 @@
2
2
 
3
3
  **Never ship code without passing all quality gates.**
4
4
 
5
- ## The 11 Quality Gates
6
-
7
- 1. **Input Guardrails** - Validate scope, detect injection, check constraints (OpenAI SDK)
8
- 2. **Static Analysis** - CodeQL, ESLint/Pylint, type checking
9
- 3. **Blind Review System** - 3 reviewers in parallel, no visibility of each other's findings
10
- 4. **Anti-Sycophancy Check** - If unanimous approval, run Devil's Advocate reviewer
11
- 5. **Output Guardrails** - Validate code quality, spec compliance, no secrets (tripwire on fail)
12
- 6. **Severity-Based Blocking** - Critical/High/Medium = BLOCK; Low/Cosmetic = TODO comment
13
- 7. **Test Coverage Gates** - Unit: 100% pass, >80% coverage; Integration: 100% pass
14
- 8. **Mock Detector** - Classifies internal vs external mocks; flags tests that never import source code, tautological assertions, and high internal mock ratios
15
- 9. **Test Mutation Detector** - Detects assertion value changes alongside implementation changes (test fitting), low assertion density, and missing pass/fail tracking
16
- 10. **Backward Compatibility** - Behavioral preservation, friction safety, institutional knowledge retention (healing mode)
17
- 11. **Documentation Coverage** - README exists, docs freshness within 10 commits, API docs for packages
18
-
19
- ## Gate 10: Backward Compatibility & Behavioral Preservation (v6.67.0)
20
-
21
- **Triggered when:** `LOKI_HEAL_MODE=true` or `loki heal` is active, or diff touches files flagged in `.loki/healing/friction-map.json`.
22
-
23
- **Purpose:** Prevent accidental removal of institutional logic or behavioral changes to legacy code without explicit documentation.
5
+ ## The 8 Quality Gates
6
+
7
+ Every gate below is wired into the orchestration loop (`autonomy/run.sh`) and
8
+ blocks completion when it fails. The table lists exactly what each gate detects,
9
+ what it does NOT detect (so you never over-trust a green gate), its opt-out flag,
10
+ and its blocking behavior. Transcribe this list verbatim; do not recompute it.
11
+
12
+ | # | Gate | Detects | Does NOT detect | Blocking | Opt-out flag |
13
+ |---|------|---------|-----------------|----------|--------------|
14
+ | 1 | Static Analysis | CodeQL, ESLint/Pylint, type-checker findings on the diff | Logic bugs that pass the linters | Yes (severity ladder) | `PHASE_STATIC_ANALYSIS=false` |
15
+ | 2 | Test Suite (pass/fail) | Whether the project test runner passes or fails (red blocks) | Coverage % (not measured in this release) | Yes (red blocks) | `PHASE_UNIT_TESTS=false` |
16
+ | 3 | Blind Code Review (3-reviewer council + severity blocking) | Correctness/security/design issues via 3 blind reviewers; Critical/High block, Medium/Low advisory | Issues none of the 3 reviewers surface | Yes (Crit/High block) | `PHASE_CODE_REVIEW=false` |
17
+ | 4 | Anti-Sycophancy / Devil's Advocate (on unanimous PASS) | Sycophantic unanimous approvals: a Devil's Advocate re-review on a unanimous PASS; its Crit/High findings block | Problems the Devil's Advocate reviewer also misses | Yes (DA Crit/High block) | `LOKI_GATE_DEVILS_ADVOCATE=false` |
18
+ | 5 | Mock Integrity Detector | Tautological assertions, internal-mock ratio, tests that do not import source (`tests/detect-mock-problems.sh`); HIGH blocks | Semantic correctness of mocks (whether a mock faithfully models the real dependency) | Yes (HIGH blocks) | `LOKI_GATE_MOCK=false` |
19
+ | 6 | Test Mutation Detector | Assertion-value churn alongside implementation changes (test-fitting), low assertion density (`tests/detect-test-mutations.sh`); HIGH blocks | Logically-correct-but-weak assertions | Yes (HIGH blocks) | `LOKI_GATE_MUTATION=false` |
20
+ | 7 | Documentation Coverage | README presence, docs freshness within 10 commits, API docs for exported symbols in packages | Whether the docs are accurate or useful | Yes | `LOKI_GATE_DOC_COVERAGE=false` |
21
+ | 8 | Magic Modules Debate | Spec-vs-implementation debate findings on generated Magic Modules; BLOCK-severity findings block | Issues outside the Magic Modules debate scope | Yes (BLOCK severity) | `LOKI_GATE_MAGIC_DEBATE=false` |
22
+
23
+ **Severity-based blocking** ties the review gates together: any Critical or High
24
+ finding blocks completion. Medium, Low, and cosmetic findings are advisory and
25
+ become TODO comments rather than blockers. It is the block policy inside code
26
+ review (gate 3), not a separate gate function.
27
+
28
+ **Follow-up (later release):** real coverage measurement (Fix A). Today gate 2
29
+ decides purely on the test runner's pass/fail; the coverage percentage is not
30
+ measured.
31
+
32
+ ### Conditional auditor (not numbered): Backward Compatibility (v6.67.0)
33
+
34
+ This is a healing-mode SPECIALIST reviewer, not one of the 8 loop gates. It fires
35
+ only when `LOKI_HEAL_MODE=true`, when `loki heal` is active, or when the diff
36
+ touches files flagged in `.loki/healing/friction-map.json`. Greenfield projects
37
+ skip it entirely. To suppress on a healing project, set `LOKI_HEAL_MODE=false`.
38
+
39
+ **Purpose:** Prevent accidental removal of institutional logic or behavioral
40
+ changes to legacy code without explicit documentation.
24
41
 
25
42
  **Checks:**
26
43
  1. **Friction Safety** - If modified code matches a friction-map entry, verify `safe_to_remove` is true or `classification` is `true_bug`
@@ -36,14 +53,9 @@
36
53
  - Missing adapter for replaced component = **High** (BLOCK)
37
54
  - Behavioral baseline mismatch without documentation = **Medium** (BLOCK)
38
55
 
39
- **Disabling**: gate 10 only fires when `LOKI_HEAL_MODE=true` or
40
- `.loki/healing/friction-map.json` exists in the project root (v7.4.20).
41
- Greenfield projects skip the auditor entirely. To suppress on a healing
42
- project, set `LOKI_HEAL_MODE=false`.
43
-
44
56
  ---
45
57
 
46
- ## Gate 11: Documentation Coverage (v6.75.0)
58
+ ## Gate 7: Documentation Coverage (v6.75.0)
47
59
 
48
60
  **Triggers when:** Diff touches public APIs, new files added, library/package releases
49
61
 
@@ -61,25 +73,27 @@ project, set `LOKI_HEAL_MODE=false`.
61
73
 
62
74
  **Disabling (not recommended for packages):**
63
75
  ```bash
64
- LOKI_GATE_DOC_COVERAGE=false # Disable gate 11
76
+ LOKI_GATE_DOC_COVERAGE=false # Disable gate 7
65
77
  ```
66
78
 
67
79
  ---
68
80
 
69
- ## Gate 8 and 9: Automated Test Integrity
81
+ ## Gates 5 and 6: Automated Test Integrity
70
82
 
71
- Gates 8 (Mock Detector) and 9 (Test Mutation Detector) run during the VERIFY phase and are enabled by default.
83
+ Gate 5 (Mock Integrity Detector) and gate 6 (Test Mutation Detector) run during
84
+ the VERIFY phase and are enabled by default (opt-out, never opt-in).
72
85
 
73
86
  **How they run:**
74
- - Gate 8 runs `tests/detect-mock-problems.sh` against all test files in the project
75
- - Gate 9 runs `tests/detect-test-mutations.sh` against recent commits (default: last 5, or use `--commit HASH` for targeted checks)
87
+ - Gate 5 runs `tests/detect-mock-problems.sh` against all test files in the project
88
+ - Gate 6 runs `tests/detect-test-mutations.sh` against recent commits (default: last 5, or use `--commit HASH` for targeted checks)
76
89
  - Both produce findings at HIGH/MEDIUM/LOW severity levels
77
- - HIGH findings = automatic FAIL (same as other blocking gates)
90
+ - HIGH findings = automatic FAIL (same as other blocking gates); MED/LOW route to the findings-injection file for the next iteration rather than blocking
78
91
 
79
- **Disabling**: gates 8 and 9 are baked into the test pipeline (the bash
80
- scripts at `tests/detect-mock-problems.sh` and
81
- `tests/detect-test-mutations.sh`); they have no env-var toggle today.
82
- Skip the gate by not running the script in your CI.
92
+ **Disabling:**
93
+ ```bash
94
+ LOKI_GATE_MOCK=false # Disable gate 5 (Mock Integrity Detector)
95
+ LOKI_GATE_MUTATION=false # Disable gate 6 (Test Mutation Detector)
96
+ ```
83
97
 
84
98
  ---
85
99
 
@@ -647,12 +661,12 @@ velocity_quality_balance:
647
661
  before_commit:
648
662
  - static_analysis: "Run ESLint/Pylint/CodeQL - warnings must not increase"
649
663
  - complexity_check: "Cyclomatic complexity must not increase >10%"
650
- - test_coverage: "Coverage must not decrease"
664
+ - test_suite: "Tests must pass (coverage % not measured in this release)"
651
665
 
652
666
  thresholds:
653
667
  max_new_warnings: 0 # Zero tolerance for new warnings
654
668
  max_complexity_increase: 10% # Per file, per commit
655
- min_coverage: 80% # Never drop below
669
+ coverage_target: 80% # Target/threshold only; not measured this release (Fix A follow-up)
656
670
 
657
671
  if_threshold_violated:
658
672
  action: "BLOCK commit, fix before proceeding"
@@ -665,7 +679,6 @@ velocity_quality_balance:
665
679
  .loki/metrics/quality/
666
680
  +-- warnings.json # Static analysis warning count over time
667
681
  +-- complexity.json # Cyclomatic complexity per file
668
- +-- coverage.json # Test coverage percentage
669
682
  +-- velocity.json # Lines added/commits per hour
670
683
  +-- ratio.json # Quality/Velocity ratio (must stay positive)
671
684
  ```
@@ -872,7 +885,7 @@ Task(prompt="Stage 2: Check code quality ONLY...")
872
885
  |----------|--------|
873
886
  | Critical | BLOCK - fix immediately |
874
887
  | High | BLOCK - fix before commit |
875
- | Medium | BLOCK - fix before merge |
888
+ | Medium | Advisory - TODO comment, fix recommended |
876
889
  | Low | TODO comment, fix later |
877
890
  | Cosmetic | Note, optional fix |
878
891
 
package/skills/testing.md CHANGED
@@ -10,7 +10,7 @@
10
10
  6. If you believe a test expectation is incorrect, document WHY and flag for council review. Do not silently change it.
11
11
  7. Every test file must have at least one assertion per tested function.
12
12
 
13
- Gate 8 (mock detector) and Gate 9 (mutation detector) enforce rules 3-5 automatically.
13
+ Gate 5 (mock integrity detector) and Gate 6 (mutation detector) enforce rules 3-5 automatically.
14
14
  Violations result in automatic FAIL during VERIFY phase.
15
15
 
16
16
  ---