@tyroneross/build-loop 0.35.0 → 0.36.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 (151) hide show
  1. package/.agents/plugins/marketplace.json +1 -1
  2. package/.claude-plugin/marketplace.json +3 -3
  3. package/.claude-plugin/plugin.json +2 -2
  4. package/.codex-plugin/plugin.json +1 -1
  5. package/AGENTS.md +67 -14
  6. package/README.md +208 -299
  7. package/agents/advisor.md +2 -0
  8. package/agents/alignment-checker.md +2 -0
  9. package/agents/api-assessor.md +3 -1
  10. package/agents/architecture-scout.md +2 -0
  11. package/agents/assessment-orchestrator.md +2 -0
  12. package/agents/build-orchestrator.md +13 -8
  13. package/agents/database-assessor.md +107 -3
  14. package/agents/design-contract-specialist.md +2 -0
  15. package/agents/fact-checker.md +2 -0
  16. package/agents/fix-critique.md +26 -5
  17. package/agents/frontend-assessor.md +3 -1
  18. package/agents/implementer.md +2 -0
  19. package/agents/independent-auditor.md +2 -0
  20. package/agents/mock-scanner.md +2 -0
  21. package/agents/optimize-runner.md +2 -0
  22. package/agents/overfitting-reviewer.md +2 -0
  23. package/agents/performance-assessor.md +3 -1
  24. package/agents/plan-critic.md +2 -0
  25. package/agents/promotion-reviewer.md +2 -0
  26. package/agents/recurring-pattern-detector.md +4 -1
  27. package/agents/retrospective-synthesizer.md +14 -0
  28. package/agents/root-cause-investigator.md +39 -2
  29. package/agents/scope-auditor.md +2 -0
  30. package/agents/security-reviewer.md +3 -0
  31. package/agents/self-improvement-architect.md +2 -0
  32. package/agents/synthesis-critic.md +2 -0
  33. package/agents/transcript-pattern-miner.md +2 -0
  34. package/agents/ui-validator.md +2 -0
  35. package/assets/build-loop-plugin-icon.png +0 -0
  36. package/bin/build-loop-install.js +234 -0
  37. package/commands/run.md +1 -1
  38. package/hooks/git/pre-commit +40 -0
  39. package/hooks/git/pre-push +35 -10
  40. package/hooks/hooks.json +42 -5
  41. package/hooks/pre-edit-architecture.sh +2 -2
  42. package/hooks/route-guard.sh +15 -0
  43. package/hooks/route_guard.py +221 -0
  44. package/hooks/session-start-extensions.sh +10 -0
  45. package/hooks/session-start-git-hooks.sh +6 -1
  46. package/hooks/session-start-rally-point.sh +23 -1
  47. package/hooks/test_session_start_rally_version.sh +123 -0
  48. package/package.json +7 -2
  49. package/plugin-artifacts/codex/.codex-plugin/plugin.json +1 -1
  50. package/plugin-artifacts/codex/AGENTS.md +67 -14
  51. package/plugin-artifacts/codex/README.md +208 -299
  52. package/plugin-artifacts/codex/assets/build-loop-plugin-icon.png +0 -0
  53. package/plugin-artifacts/codex/references/backlog-system.md +285 -0
  54. package/plugin-artifacts/codex/references/capability-routing.md +49 -0
  55. package/plugin-artifacts/codex/references/coordination-rules.md +271 -2
  56. package/plugin-artifacts/codex/references/memory-systems.md +25 -2
  57. package/plugin-artifacts/codex/references/memory.md +14 -0
  58. package/plugin-artifacts/codex/references/model-tier-mapping.md +45 -6
  59. package/plugin-artifacts/codex/references/phase-1-assess.md +19 -1
  60. package/plugin-artifacts/codex/references/phase-2-plan.md +9 -1
  61. package/plugin-artifacts/codex/references/phase-3-execute.md +1 -1
  62. package/plugin-artifacts/codex/references/phase-4-review.md +20 -1
  63. package/plugin-artifacts/codex/references/phase-5-iterate.md +4 -3
  64. package/plugin-artifacts/codex/references/phase-6-learn.md +2 -0
  65. package/plugin-artifacts/codex/references/verify-dispatch.md +85 -0
  66. package/plugin-artifacts/codex/skills/build-loop/SKILL.md +19 -10
  67. package/plugin-artifacts/codex/skills/build-loop/fallbacks.md +1 -1
  68. package/plugin-artifacts/codex/skills/build-loop/references/capability-routing.md +49 -0
  69. package/plugin-artifacts/codex/skills/build-loop/references/experiment-results-template.md +101 -0
  70. package/plugin-artifacts/codex/skills/build-loop/references/memory.md +14 -0
  71. package/plugin-artifacts/codex/skills/build-loop/references/output-style.md +98 -5
  72. package/plugin-artifacts/codex/skills/build-loop/references/phase-1-assess.md +19 -1
  73. package/plugin-artifacts/codex/skills/build-loop/references/phase-2-plan.md +9 -1
  74. package/plugin-artifacts/codex/skills/build-loop/references/phase-3-execute.md +1 -1
  75. package/plugin-artifacts/codex/skills/build-loop/references/phase-4-review.md +20 -1
  76. package/plugin-artifacts/codex/skills/build-loop/references/phase-5-iterate.md +4 -3
  77. package/plugin-artifacts/codex/skills/build-loop/references/phase-6-learn.md +2 -0
  78. package/plugin-artifacts/codex/skills/build-loop/references/verify-dispatch.md +85 -0
  79. package/scripts/build_codex_plugin_artifact.py +7 -0
  80. package/scripts/embed_backend.py +17 -13
  81. package/scripts/lessons_index/query.py +1 -1
  82. package/scripts/memory_graph/__init__.py +2 -2
  83. package/scripts/sync_navgator_lessons.py +4 -4
  84. package/skills/api-registry-bridge/SKILL.md +1 -1
  85. package/skills/auto-decision-capture/SKILL.md +4 -3
  86. package/skills/auto-finding-capture/SKILL.md +119 -0
  87. package/skills/build-loop/SKILL.md +19 -10
  88. package/skills/build-loop/fallbacks.md +1 -1
  89. package/skills/build-loop/references/capability-routing.md +49 -0
  90. package/skills/build-loop/references/experiment-results-template.md +101 -0
  91. package/skills/build-loop/references/memory.md +14 -0
  92. package/skills/build-loop/references/output-style.md +98 -5
  93. package/skills/build-loop/references/phase-1-assess.md +19 -1
  94. package/skills/build-loop/references/phase-2-plan.md +9 -1
  95. package/skills/build-loop/references/phase-3-execute.md +1 -1
  96. package/skills/build-loop/references/phase-4-review.md +20 -1
  97. package/skills/build-loop/references/phase-5-iterate.md +4 -3
  98. package/skills/build-loop/references/phase-6-learn.md +2 -0
  99. package/skills/build-loop/references/verify-dispatch.md +85 -0
  100. package/skills/debug-loop/SKILL.md +4 -2
  101. package/skills/debugging-memory/SKILL.md +24 -12
  102. package/skills/{debugging/assess/SKILL.md → debugging-memory/references/assess.md} +6 -13
  103. package/skills/{debugging/memory/SKILL.md → debugging-memory/references/search.md} +10 -17
  104. package/skills/{debugging/store/SKILL.md → debugging-memory/references/store.md} +5 -13
  105. package/skills/debugging-memory/references/subagent-integration.md +3 -3
  106. package/skills/defenseclaw-bridge/SKILL.md +1 -1
  107. package/skills/{loop-builder → focused-loop-builder}/SKILL.md +6 -6
  108. package/skills/ibr-bridge/SKILL.md +1 -1
  109. package/skills/knowledge/SKILL.md +13 -2
  110. package/skills/{knowledge-review/SKILL.md → knowledge/references/review-mode.md} +8 -20
  111. package/skills/logging-tracer/SKILL.md +20 -4
  112. package/skills/model-bakeoff/SKILL.md +44 -0
  113. package/skills/model-tiering/SKILL.md +55 -20
  114. package/skills/optimize/SKILL.md +2 -2
  115. package/skills/prd-bridge/SKILL.md +1 -1
  116. package/skills/recursive-retrospective/SKILL.md +46 -0
  117. package/skills/recursive-retrospective/references/01-retrospective.md +136 -0
  118. package/skills/recursive-retrospective/references/02-learning-capture.md +72 -0
  119. package/skills/recursive-retrospective/references/03-judge.md +45 -0
  120. package/skills/research/SKILL.md +1 -1
  121. package/skills/root-cause-analysis/SKILL.md +42 -0
  122. package/skills/security-methodology/SKILL.md +10 -1
  123. package/skills/security-scan/SKILL.md +55 -0
  124. package/skills/spec-writing/SKILL.md +42 -1
  125. package/skills/sync-skills/SKILL.md +8 -7
  126. package/commands/assess.md +0 -41
  127. package/commands/compose-handoff.md +0 -113
  128. package/commands/debug.md +0 -20
  129. package/commands/debugger-detail.md +0 -34
  130. package/commands/debugger-scan.md +0 -15
  131. package/commands/debugger-status.md +0 -20
  132. package/commands/debugger.md +0 -32
  133. package/commands/optimize-run.md +0 -31
  134. package/commands/promote-experiment.md +0 -129
  135. package/commands/rally-point.md +0 -301
  136. package/commands/research-run.md +0 -22
  137. package/commands/review-knowledge.md +0 -16
  138. package/commands/self-review.md +0 -51
  139. package/commands/setup-memory.md +0 -32
  140. package/commands/start-prd.md +0 -57
  141. package/commands/test.md +0 -34
  142. package/commands/verify-plan.md +0 -39
  143. package/skills/debugging/debug-loop/SKILL.md +0 -231
  144. package/skills/logging-tracer-bridge/SKILL.md +0 -70
  145. /package/skills/{loop-builder → focused-loop-builder}/presets/active-project-evidence.yaml +0 -0
  146. /package/skills/{loop-builder → focused-loop-builder}/presets/generic-artifact-loop.yaml +0 -0
  147. /package/skills/{loop-builder → focused-loop-builder}/presets/presentation-audit.yaml +0 -0
  148. /package/skills/{loop-builder → focused-loop-builder}/presets/research-synthesis.yaml +0 -0
  149. /package/skills/{loop-builder → focused-loop-builder}/presets/source-ingestion-raw-data-audit.yaml +0 -0
  150. /package/skills/{loop-builder → focused-loop-builder}/references/spec-format.md +0 -0
  151. /package/skills/{loop-builder → focused-loop-builder}/scripts/loop_builder.py +0 -0
@@ -0,0 +1,46 @@
1
+ ---
2
+ name: recursive-retrospective
3
+ description: Run a recursive-learning retrospective on an app/agent/plugin/build-loop project — analyze build history, behavior, and current state to extract reusable learning objects and encode them into memory, agents, skills, plugins, evals, preflights, and approval gates. Use after a substantial build, when reviewing a project's trajectory, when deciding preserve/refine/redirect/reset, or when converting a session into durable system improvement. Discovery-first (observe behavior → cluster patterns → encode learning); RCA is one module, not the whole job.
4
+ user-invocable: false
5
+ ---
6
+
7
+ # Recursive Learning Retrospective
8
+
9
+ A three-stage pipeline that turns a project's history into durable, encoded system improvement. Discovery-first: observe revealed behavior, cluster patterns, then encode learning — categories are seed scaffolds, never closed taxonomies (preserve emergent findings).
10
+
11
+ > **v2 (2026-06-18) — test-validated.** This revision was hardened against a live run: the full pipeline was executed on a real project (ross-labs-astro) and scored by an independent judge at 4.27/5, "Accept with revisions." The judge's penalties are fixed here (see Changelog). The v1 structure (peer draft `feat/recursive-retrospective@1c24d4a`) is preserved; only the validated fixes are layered on.
12
+
13
+ ## When to use
14
+ - After a substantial build/session, to extract what the system should learn.
15
+ - When deciding whether to preserve / refine / redirect / reset a mid-build project.
16
+ - To convert a retrospective into concrete learning objects (memory, agent rules, skills, plugin/app behavior, evals, preflights, approval gates).
17
+ - NOT only for failures — RCA is one diagnostic module used when there are failures, regressions, steering loops, brittle decisions, or outcome gaps.
18
+
19
+ ## The pipeline
20
+ 1. **Run** — `references/01-retrospective.md` (Prompt 1): the recursive-learning retrospective. Produces maturity classification, spec→current→desired comparison, behavior/workflow discovery, steering mining, learning objects, a selective RCA module, preflight/hard-gate analysis, a counterfactual simulation, a prioritized (ordinal) roadmap, layered recommendations, a from-scratch option, emergent patterns, and an executive summary.
21
+ 2. **Capture** — `references/02-learning-capture.md` (Prompt 2): a PACKAGER/DEDUPER of Prompt 1's §7 + §12. It does not re-extract from scratch; it dedupes the learning objects Prompt 1 already produced, adds only net-new ones it missed (flagged), and emits the copy-ready encoding package.
22
+ 3. **Judge** — `references/03-judge.md` (Prompt 3): an INDEPENDENT evaluator scores the retrospective on 11 criteria and returns accept / accept-with-revisions / reject. It MUST verify headline claims against source before scoring evidence grounding.
23
+
24
+ ## Operating rules (carried through all three stages)
25
+ - **Discovery flexibility:** start from evidence before classification; add/rename/split/merge categories when evidence requires; use Other/Emergent; preserve unexpected findings.
26
+ - **Density governor:** reward density, not completeness. Collapse a low-signal section to a single line; omit a conditional section entirely when it yields no non-obvious finding. A shorter retrospective that drops empty scaffolding scores HIGHER than an exhaustive one. Do not pad a section to look complete.
27
+ - **Cross-reference, don't restate:** assign each finding a stable id (LO-1, RCA-1, …) once, then reference the id in later sections instead of repeating the finding.
28
+ - **Evidence discipline:** separate explicit statements from revealed behavior; mark unknowns `UNKNOWN — evidence not available` and unverified claims `TAG:INFERRED`.
29
+ - **Memory discipline:** do not encode one-off comments as durable memory unless explicitly framed durable or recurring.
30
+ - **Appropriate autonomy + approval authority:** the dispatching (main) agent holds approval for this pipeline's own outputs — SAFE, reversible encodes (memory / note / skill-source / agent-instruction) auto-persist under that authority and are never bounced to the human. Reserve human gates for the hard-gate taxonomy only: security, privacy, cost, live/production deploy, irreversible/destructive actions, or promoting an experimental artifact into a globally runtime-active skill/agent.
31
+ - **No false precision:** rank by ordinal priority (P0/P1/P2) with qualitative justification; do not emit multiplied point-scores that imply a calibration the inputs cannot support.
32
+
33
+ ## Model tiering
34
+ - Stage 1 (retrospective = assessment) and Stage 3 (judge = verification verdict) are Frontier-tier work (Fable) per the model org. Stage 3 MUST run in a context independent of Stage 1's author (external evaluator). Frontier-unavailable → Thinking-tier (Opus) fallback, never Code tier.
35
+ - Stage 2 (capture) can run at the executor tier.
36
+
37
+ ## Output homes
38
+ - Retrospective + learning-object package → the project's retrospective lane and (for cross-project learning) build-loop-memory via the canonical `memory_writer.py`.
39
+ - Learning objects with encoding target = memory / project-note / skill-source / agent-instruction are SAFE + reversible: the **dispatching (main) agent approves them and they persist automatically** — do not bounce a medium-confidence memory note to the human. Human approval is reserved for the hard-gate taxonomy only (security / privacy / cost / live-deploy / irreversible-destructive / promoting an experimental artifact into a globally runtime-active skill or agent).
40
+
41
+ ## Changelog (v1 → v2; each fix traces to the live judge run)
42
+ - **Density governor + conditional sections** — judge flagged §11 (counterfactual) and the near-1:1 §5 behavior→LO mapping as forced-completeness padding. §11 and parts of §5/§15 are now conditional; the density rule is explicit in the operating rules and acceptance criteria.
43
+ - **Ordinal priority replaces the multiply formula** — judge flagged `(F×I×R×C)/Difficulty` point-scores (250, 200, 160) as false precision. §12 now ranks P0/P1/P2 with F/I/R/C/Difficulty kept as qualitative justification columns only.
44
+ - **Cross-reference rule** — judge flagged §5/§6/§7/§15 reformatting the same findings 3–4×. Findings now carry ids and are referenced, not restated.
45
+ - **Prompt 2 reframed as packager/deduper** — Prompt 1 §7 already emits a full learning-object table; v1 Prompt 2 re-extracted from scratch (double work, divergence risk). v2 Prompt 2 ingests §7+§12 and dedupes.
46
+ - **Prompt 3 mandates verification** — in the live test the judge only verified facts because it was told to. v2 §1 (evidence grounding) requires independent tool-verification of ≥3 headline claims when source is available, and caps the grounding score at 3 if verification was possible but skipped.
@@ -0,0 +1,136 @@
1
+ # Recursive Learning Retrospective for Apps, Agents, Plugins, and Build Systems
2
+
3
+ > v2 (2026-06-18) — fixes validated by a live run (ross-labs-astro; independent judge 4.27/5). Changes vs v1: density governor, conditional sections, cross-reference-don't-restate, ordinal priority (no multiply formula). See SKILL.md changelog.
4
+
5
+ ## Role
6
+
7
+ You are a recursive learning architect for app, agent, plugin, and build-loop systems.
8
+
9
+ Your job is to analyze a project's build history, current state, user interactions, agent behavior, tooling behavior, and implementation choices to extract reusable learning that can improve future builds.
10
+
11
+ This is not primarily a root cause analysis. RCA is only one diagnostic module, used when there are failures, regressions, steering loops, brittle decisions, or outcome gaps. The broader goal is to identify what the system should learn and how that learning should be encoded into apps, agents, plugins, skills, memory, evals, workflows, and approval gates.
12
+
13
+ ## Core Objective
14
+
15
+ Analyze the project as a recursive learning opportunity. Answer:
16
+
17
+ 1. What was the project trying to accomplish?
18
+ 2. What was actually built?
19
+ 3. Where is the project today?
20
+ 4. What project maturity state best describes it?
21
+ 5. What user behaviors, agent behaviors, workflow patterns, and system gaps emerged?
22
+ 6. What did the user explicitly state?
23
+ 7. What did the user reveal through behavior, corrections, approvals, rejections, or repeated steering?
24
+ 8. Which patterns are project-specific?
25
+ 9. Which patterns are reusable across projects?
26
+ 10. Which findings should become memory, skills, agent instructions, app features, plugin behavior, evals, preflight checks, or approval gates?
27
+ 11. Which hard gates still require human approval?
28
+ 12. What should the system do differently next time?
29
+
30
+ ## Core Mental Model
31
+
32
+ Project evidence → Behavior patterns → Learning objects → System encoding → Future automation improvement.
33
+
34
+ Do not stop at diagnosis. For every meaningful finding, identify whether it should become: Persistent user memory · Project memory · Agent instruction · Skill · Plugin behavior · App feature · Eval or quality gate · Preflight question · Approval rule · Architecture default · Do-not-store item · No action.
35
+
36
+ ## Discovery Flexibility + Density Guardrail
37
+
38
+ All categories here are seed structures, not closed taxonomies. Rules:
39
+ 1. Start with evidence before classification.
40
+ 2. Do not force observations into predefined buckets.
41
+ 3. Add emergent categories when the evidence requires it.
42
+ 4. Preserve unexpected findings.
43
+ 5. Separate explicit statements from revealed behavior.
44
+ 6. Separate reusable patterns from project-specific decisions.
45
+ 7. Mark unsupported claims as UNKNOWN — evidence not available.
46
+ 8. Mark plausible but unverified claims as TAG:INFERRED.
47
+ 9. Do not encode one-off comments as durable memory unless the user explicitly framed them as durable.
48
+ 10. Do not optimize around the current implementation unless it is validated.
49
+ 11. Optimize for future system learning, not just project completion.
50
+ 12. Prefer appropriate autonomy over maximum autonomy.
51
+ 13. Do not recommend automation where human approval, reversibility, privacy, security, or cost constraints require a gate.
52
+ 14. **Density over completeness.** Collapse a low-signal section to one line; OMIT a conditional section that yields no non-obvious finding (say "omitted — no signal"). Do not pad to look complete. A shorter retrospective that drops empty scaffolding is BETTER than an exhaustive one.
53
+ 15. **Assign ids, then cross-reference.** Give each finding a stable id (LO-n, RCA-n, SC-n for steering cluster). After first statement, reference the id — never restate the same finding in §5/§6/§7/§15.
54
+ 16. **Banned closures.** Do not close a finding on: human error · agent error · be more careful · edge case · quirk · cosmetic · one-off · works now · "fixed in code" without prevention. These are dismissals, not learning objects.
55
+
56
+ ## 1. Source Coverage
57
+ Table: Source | Available? (Yes/No/Partial) | Used for | Confidence (High/Med/Low). Rows: Initial specs · Current repo · NavGator analysis · Build Loop memory · Agent logs · User chats · CI/tests/evals · Deployment/env config · App/plugin behavior.
58
+ Then: strongest evidence · weakest evidence · missing evidence · overall confidence (High/Medium/Low) · whether output is final, directional, or exploratory.
59
+
60
+ ## 2. Project Maturity and Learning Posture
61
+ Classify before recommending fixes. Seed states (add hybrid/custom if needed): Near-done/high-quality · Directionally-right/mid-build · Partial/fragile · Misaligned/wrong-foundation · Prototype/exploration — each with a learning posture.
62
+ Table: Dimension | Assessment | Evidence | Confidence. Dimensions: Product direction · Architecture · UX/workflow · Agent workflow · Memory use · Verification · Release readiness.
63
+ Then state: **Project maturity state** · **Recommended posture** (Preserve/Refine/Redirect/Reset/Continue exploring) · **Primary learning opportunity** · **Risk of locking in current design** · **Risk of over-redesigning**.
64
+ Note: when an area is shipping live but non-functional, classify it as a defect, not a "mid-build" state — do not let a maturity label soften a live integrity gap.
65
+
66
+ ## 3. Spec → Current State → Desired Outcome
67
+ Table: Area | Initial intent | Current state | Desired outcome | Gap | Confidence. Areas: Core job-to-be-done · User workflow · Architecture · Data model · Memory model · Agent behavior · Plugin/tool behavior · UI/UX · Verification/evals · Permissions/hard gates.
68
+ Then `## Where the Project Stands Today` — maturity, strengths, gaps, preserve/refine/redirect/reset. If current state diverges from stated intent, surface that drift explicitly as a finding.
69
+
70
+ ## 4. Preserve / Refine / Redirect / Reset Test
71
+ Table: Area | Current quality | Recommended action (Preserve/Refine/Replace/Defer/Explore) | Rationale | Evidence. Areas: Core product concept · User workflow · Architecture · Data model · Memory model · Agent orchestration · UI/UX · Verification/evals.
72
+ Decision rules: Preserve when validated/coherent/aligned · Refine when directionally right but needs cleanup · Replace when recurring failure/brittleness/steering/misalignment · Defer when evidence insufficient or not milestone-relevant · Explore when multiple plausible designs remain and the project isn't mature enough to lock.
73
+
74
+ ## 5. Behavior and Workflow Discovery
75
+ Identify patterns from actual behavior, not just explicit statements. Mine from: corrections/approvals/hesitations/rejections, repeated clarifications, scope changes, agent plans/mistakes, tool calls, build sequence, testing gaps, memory usage/non-usage, permission/key blockers, plugin/app behavior, recovery attempts.
76
+ Sequence: Observed behavior → Repeated pattern → Revealed preference or constraint → System implication → Learning object.
77
+ **Behavior Inventory** (assign each row an LO-id): Observed behavior | Evidence | Pattern type (Explicit pref/Revealed pref/Workflow/Decision/Intervention/Failure escape/Success/Other) | What it reveals | System implication | Learning object id.
78
+ **Workflow Pattern Clustering** (CLUSTER — do not emit one row per behavior; group behaviors that share a trigger/sequence): Workflow pattern | Trigger | Typical sequence | User/system behavior | Failure or success mode | Reusable? (Yes/No/Mixed).
79
+ Density: only list behaviors that change a conclusion. A behavior that maps 1:1 to a single LO with no clustering value should be a reference, not its own row.
80
+
81
+ ## 6. Steering and Interaction Pattern Mining
82
+ Explicit user steering: corrections, clarifications, approvals, rejections, scope changes, taste feedback, architecture feedback, quality-bar feedback, permission/key approvals, "not this, more like that", repeated interventions.
83
+ Table: Steering moment | Trigger | User input | What it revealed | Specific or reusable? (Specific/Reusable/Mixed) | Could it have been predicted earlier? (Yes/No/Partial).
84
+ Then cluster (assign SC-ids): Steering cluster | Repeated evidence | Underlying preference or constraint | System implication | Capture target (Memory/Agent instruction/Skill/Eval/Preflight/Approval gate/No action).
85
+
86
+ ## 7. Recursive Learning Objects (canonical LO table)
87
+ This is the canonical source of learning objects; later stages consume it by id. A learning object = a specific, reusable system improvement encodable into memory, app behavior, plugin logic, agent instructions, skills, evals, or process.
88
+ **Learning Object Table:** LO-id | Learning object | Evidence | Type (Explicit/Revealed/Inferred/Failure/Success/Hard gate) | Scope (Cross-project/Project-specific/Local only) | Encoding target (Memory/Agent/Skill/Plugin/App/Eval/Preflight/Approval gate) | Confidence | Store/apply? (Yes/No/Needs approval) | Already-encoded? (cite memory id if it exists).
89
+ **Fix strength (rank the encoding target).** Prefer stronger system levers over weaker ones, in order: eliminate the failure mode > substitute a safer mechanism > engineer a forcing function (gate/schema/type/permission) > standardize/simplify > automate detection/containment > checklist/redundancy > train/document. A doc/reminder is the weakest target and is insufficient alone unless risk is low and no stronger lever is feasible.
90
+ **Actuator (anti-dormancy).** For every LO whose target is store/apply, name not just the lever (where the fix lands) but the **actuator** — what makes it fire (e.g. "CI blocks merge on schema fail", "prompt-linter rejects missing acceptance criteria"). An LO with no actuator is a dormant fix; flag it as such.
91
+ Encoding-target reference (examples, not quotas): **Memory** (preferences, decisions, architecture defaults, taste patterns, steering patterns, hard gates, approval rules, failure/success patterns). **Agent instruction** (stop&replan on weak architecture evidence; don't ask what memory answers; verify end-to-end before features; surface hard gates early; preserve optionality mid-build). **Skill** (spec ingestion, maturity assessment, behavior mining, NavGator review, UI/taste extraction, permission preflight, release-readiness, memory update). **Plugin/app** (intake checklist, maturity classifier, approval dashboard, hard-gate profile, task ledger, handoff view, memory-candidate review, readiness score, verification dashboard). **Eval/check** (spec coverage, architecture readiness, route/dataflow consistency, UX state completeness, permission readiness, end-to-end journey, memory-update quality, recursive-learning capture). **Preflight** (only when not reliably inferable). **Approval gate** (security/privacy/cost/deployment/irreversible, or taste with no durable prior memory).
92
+
93
+ ## 8. Diagnostic RCA Module (selective)
94
+ Use RCA ONLY for major gaps/failures/regressions/repeated steering loops/brittle architecture/verification escapes/misaligned outcomes. Not on every minor issue. Expect 1–3 RCAs for a typical session; if you find yourself writing more than ~4, you are over-applying it.
95
+ For each RCA, make the **escape path** explicit, not just the cause: did the control that should have caught this exist? did it fire? if it fired, was it ignored / misread / bypassed / too weak? (This is where "the decision existed but was never encoded as code/gate" failures surface.) For a full L2 diagnosis, delegate to the `root-cause-analysis` skill rather than expanding this module.
96
+ Per major issue `## RCA-n: [Issue]`: Symptom · Expected · Actual · Evidence (files/logs/chats/tests/commits/screenshots/NavGator) · Creation path · Escape path (why it survived planning/implementation/review/testing/interaction) · Root cause category (Spec/context/planning/memory/code/tool/agent/eval/permission/UX/external dependency/other) · Learning object (LO-id) · Encoding target · Preserve/refine/replace implication · Residual risk · Confidence.
97
+
98
+ ## 9. Early Discovery and Preflight Improvements
99
+ Don't recommend asking what's reliably answerable from memory/repo/prior behavior/specs/tooling.
100
+ Table: Missed early question or preflight check | Later issue it would have prevented | Best answer source (User/Memory/Repo/NavGator/Heuristic/External service) | Should become default? (Yes/No/Conditional).
101
+ Group: Always ask · Ask only if memory missing · Infer from repo/spec · Infer from prior behavior · Detect through tooling · Do not ask unless blocked.
102
+
103
+ ## 10. Hard Gates and Pre-Capturable Inputs
104
+ Table: Hard gate | Why approval needed | Can it be captured in advance? (Yes/No/Partial) | Recommended system behavior. Consider: API keys, OAuth, paid accounts, prod deploys, destructive ops, repo access, private data, legal/privacy, external services, security-sensitive actions, irreversible design decisions, taste with no prior memory.
105
+ **Preflight Profile:** Accounts/services · API keys · Permissions · Deployment target · Repo access · Data/privacy constraints · Allowed autonomous actions · Actions requiring approval · Design/taste defaults · Testing expectations · Release criteria.
106
+
107
+ ## 11. Counterfactual Recursive Learning Simulation — CONDITIONAL
108
+ Include ONLY the phases where better recursive learning would have changed the outcome; omit phases that would just restate "it was fine." If fewer than ~3 phases carry a real counterfactual, replace the table with a one-paragraph summary. Do not emit a full 12-phase table by default.
109
+ Table (selected phases only): Phase | What happened | What should happen next time | Learning object (LO-id) | Encoding target | Human needed? (Yes/No/Gate only). Candidate phases: Intake · Spec clarification · Memory retrieval · NavGator/repo review · Architecture planning · Agent routing · Implementation · Verification · UI/taste review · Permission handling · Release readiness · Memory update.
110
+
111
+ ## 12. Learning-to-System Update Roadmap (ordinal — no point-scores)
112
+ Rank the LOs from §7 by ORDINAL priority. Keep Frequency/Impact/Reusability/Difficulty/Confidence as qualitative justification columns (High/Med/Low), but DO NOT multiply them into a point score — a multiplied number implies a calibration the inputs cannot support.
113
+ Table: Rank | LO-id | Encoding target | Lever (where the fix lands) | Actuator (what makes it fire) | Frequency (H/M/L) | Impact (H/M/L) | Reusability (H/M/L) | Difficulty (H/M/L) | Confidence (H/M/L) | Priority (P0/P1/P2) | Recommendation.
114
+ Group P0 (encode immediately) / P1 (next) / P2 (monitor/defer). Within a group, list highest-leverage first; ties need no resolution.
115
+
116
+ ## 13. Recommendations by System Layer
117
+ State acceptance criteria for each non-trivial recommendation so it is verifiable.
118
+ **A. App-level** (intake flow, maturity classifier, approval dashboard, learning-object review, memory-candidate review, build status, task ledger, release-readiness dashboard, verification workflow, error recovery).
119
+ **B. Agent-level** (orchestrator instructions, routing, stop/replan triggers, reviewer/QA agent, memory/context agent, security/permission agent, UI/taste agent, handoff protocol).
120
+ **C. Plugin/tool** (NavGator integration, repo map, route/dataflow tracing, CI/test inspection, permission/key discovery, screenshot/UX review, deployment-readiness checks).
121
+ **D. Memory** table: Memory | Scope (Cross-project/Project/Local only) | Evidence | Update trigger | Approval needed?
122
+ **E. Skill** table: Skill | Purpose | Trigger | Inputs | Outputs | Success criteria.
123
+ **F. Eval** table: Eval | Catches | Runs when | Pass criteria | Failure action.
124
+
125
+ ## 14. From-Scratch Recursive Learning Architecture
126
+ Include one option NOT anchored on the current app. Describe: product concept · control plane · agent architecture · plugin/tool architecture · memory architecture · learning-object schema · permission model · eval model · user review model · feedback loop · tradeoffs vs evolving current.
127
+ Table: Dimension | Current-system evolution | From-scratch recursive learning system | Tradeoff. Dimensions: Product model · Agent orchestration · Plugin/tool layer · Memory · Learning-object schema · Permissions · Verification · UX.
128
+
129
+ ## 15. Emergent Patterns
130
+ Table: Pattern | Evidence | Why it matters | Recommended system response. Only patterns not already captured by an LO/SC id above. Do not omit a meaningful finding because it doesn't fit earlier categories; do not duplicate one that does.
131
+
132
+ ## 16. Executive Summary
133
+ `# Executive Summary` → `## Bottom line` (1–2 sentences) → `## Project maturity and posture` (Maturity state / Recommended posture / Reason) → `## Most important recursive learning findings` (cite LO/RCA ids) → `## Highest-value learning objects to encode` (P0 ids) → `## Recommended system updates` → `## Hard gates that remain human-controlled` → `## What to do next`.
134
+
135
+ ## Acceptance Criteria
136
+ Successful only if it: treats the task as recursive learning (not just RCA); uses RCA only where it adds diagnostic value (≤~4 RCAs); compares initial intent / current build / desired outcome and surfaces any drift; classifies maturity before recommending preserve/redesign and does not soften a live defect with a maturity label; identifies behavior+workflow patterns from evidence (clustered, not 1:1); separates explicit from revealed preferences; converts findings into concrete learning objects with ids; assigns each an encoding target; ranks by ordinal priority WITHOUT a multiplied point-score; preserves emergent findings without duplicating id'd ones; calls out hard gates needing approval; includes one from-scratch option; marks unknowns and inferred claims clearly; **rewards density — omits low-signal/conditional sections rather than padding them, and cross-references ids instead of restating findings.**
@@ -0,0 +1,72 @@
1
+ # Recursive Learning Object Capture Prompt
2
+
3
+ > v2 (2026-06-18) — reframed as a PACKAGER/DEDUPER of Prompt 1's output, not a fresh re-extraction. Validated against the live run: Prompt 1 §7 already emits a full learning-object table, so re-extracting from scratch duplicated work and risked divergence. v2 ingests §7+§12 and only adds net-new objects.
4
+
5
+ ## Role
6
+ You are a recursive learning and memory architect for apps, agents, plugins, and build-loop systems. Take the learning objects Prompt 1 already produced and turn them into a clean, deduplicated, copy-ready encoding package. **Not every learning object should become memory.** Decide what to encode, where, and what NOT to store.
7
+
8
+ ## Primary input (required)
9
+ `[PASTE PROMPT 1 §7 LEARNING OBJECT TABLE + §12 ROADMAP HERE]` — these are the canonical learning objects, already id'd (LO-n) and ordinally prioritized.
10
+ Optional secondary input (only to fill gaps Prompt 1 missed): `[PASTE RETROSPECTIVE BODY / RCA / USER INTERACTION HISTORY / SPEC / NAVGATOR / REPO SUMMARY HERE]`
11
+
12
+ ## Operating mode — dedupe first, extract second
13
+ 1. **Ingest** every LO from Prompt 1 by id. Do not re-derive them; carry the id forward.
14
+ 2. **Dedupe**: merge LOs that are the same object stated twice; note merges (`LO-3 ⊇ LO-7`).
15
+ 3. **Reconcile with existing memory**: for each LO, check whether it is already encoded (Prompt 1's "Already-encoded?" column / a memory lookup). If already encoded, the action is "verify it fires," not "store again."
16
+ 4. **Add net-new ONLY if Prompt 1 missed it.** Flag every net-new object `[NET-NEW vs Prompt 1]` with the evidence that justifies it. If you are adding many net-new objects, that is a signal Prompt 1 under-ran — say so rather than silently re-extracting.
17
+ 5. **Classify and package** (below).
18
+
19
+ ## Evidence rules
20
+ Per object: Explicit (stated) · Revealed (repeated behavior) · Project-specific · Cross-project · TAG:INFERRED · Do not encode (too weak/transient/sensitive/project-bound/duplicative).
21
+ **Do not store globally unless ≥1 is true:** (1) user explicitly framed it durable; (2) recurred across interactions; (3) materially affects future build-loop decisions; (4) it's a hard gate / permission / safety constraint; (5) validated reusable workflow pattern; (6) recurring failure or success mode.
22
+
23
+ ## 1. Reconciled Learning Object Inventory
24
+ Table: LO-id | Learning object | Source (Prompt1 / NET-NEW) | Evidence type (Explicit/Revealed/Inferred/Failure/Success/Hard gate) | Scope (Cross-project/Project-specific/Local only) | Encoding target (Memory/Agent/Skill/Plugin/App/Eval/Preflight/Approval gate/Project note/Do not encode) | Already-encoded? (memory id or No) | Encode action (Store / Verify-fires / Needs approval / Do not encode).
25
+
26
+ ## 2. Cross-Project User Preferences
27
+ Table: Preference | Evidence | Applies to (UI/Architecture/Agent behavior/Communication/Testing/Product strategy/Other) | Stability (High/Med/Low) | Recommended encoding (Memory/Agent rule/Preflight/No encode). Only preferences with explicit statements or repeated behavior.
28
+
29
+ ## 3. Revealed Workflow Patterns
30
+ Carry from Prompt 1 §5 clusters; do not re-mine. Table: Workflow pattern | Evidence | Reusable? (Yes/No/Mixed) | System implication | Encoding target.
31
+
32
+ ## 4. Project-Specific Learning
33
+ Table: Project-specific learning | Evidence | Why it matters | Expiration or review trigger.
34
+
35
+ ## 5. Agent Instructions
36
+ Table: Agent rule | Trigger | Expected behavior | Evidence | Scope. Evidence-supported only.
37
+
38
+ ## 6. Plugin and Tool Behavior Updates
39
+ Table: Tool/plugin behavior | Trigger | Expected behavior | Evidence | Priority (P0/P1/P2).
40
+
41
+ ## 7. App Feature Opportunities
42
+ Table: App feature | Problem it solves | Evidence | User value | Priority (P0/P1/P2).
43
+
44
+ ## 8. Skills to Create or Reuse
45
+ Table: Skill | Purpose | Trigger | Inputs | Outputs | Success criteria.
46
+
47
+ ## 9. Evals and Quality Gates
48
+ Table: Eval or gate | Catches | Runs when | Pass criteria | Failure action.
49
+
50
+ ## 10. Hard Gates and Approval Rules
51
+ Table: Gate | Why approval needed | Can be pre-captured? (Yes/No/Partial) | Encoding target (Memory/Preflight/Approval gate/Project note) | Build Loop behavior.
52
+
53
+ ## 11. Do-Not-Encode List
54
+ Table: Finding | Why not encode? (Too weak/Project-specific/Sensitive/Temporary/Duplicative/Unverified) | Safer handling (Project note/Ignore/Ask user/Recheck later).
55
+
56
+ ## 12. Final Learning Object Package
57
+ `# Recommended Learning Object Updates` with sections: Cross-project memories · Project-specific memories · Agent instructions · Skills to create or reuse · Plugin/tool behavior updates · App feature opportunities · Evals and quality gates · Preflight checks · Approval gates · Do not encode.
58
+ For each item: **LO-id** · **Learning object** · **Evidence** · **Scope** (Cross-project/Project-specific/Local only) · **Encoding target** · **Confidence** (High/Med/Low) · **Already-encoded?** (memory id or No) · **Approval needed before storing or applying?** (Yes/No).
59
+
60
+ **Approval authority (default = automatic).** Memory / project-note / skill-source / agent-instruction encodes are SAFE and reversible: the **dispatching (main) agent grants approval and they persist automatically** — confidence level alone (e.g. Med) does NOT trigger a human gate, and a medium-confidence memory note must NOT be bounced to the user. Set **Approval needed = Yes (human)** ONLY for the hard-gate taxonomy: security, privacy, cost, live/production deploy, irreversible/destructive actions, or promoting an experimental artifact into a globally runtime-active skill/agent that changes behavior for future sessions. Everything else is `encode: yes` and auto-applies under the dispatching agent's authority.
61
+ Items with encoding target = memory and "Store" action are written via the canonical `memory_writer.py`; do not hand-write memory files.
62
+
63
+ > Keep-both reconciliation (consolidation): §1-12 = v2.1 packager/deduper (RCA levers); §13 = machine-readable emit loop-closer (from feat/retro-emit-learning-objects). Neither overwrites the other.
64
+
65
+ ## 13. Machine-readable emit (closes the auto-draft loop)
66
+ Also write the inventory to `.build-loop/learning-objects.json` — a JSON array, one object per §1 learning object. Exact fields (the converter skips entries that don't match):
67
+ - `title` (str) · `evidence` (list of str) · `encoding_target` (one of `skill`, `agent`, `memory`, `eval`, `gate`, `preflight`, `approval`, `project_note`, `do_not_encode`) · `scope` (`cross-project`|`project-specific`|`local`) · `confidence` (`high`|`med`|`low`) · `encode` (`yes`|`no`|`needs_approval`) · optional `trigger` (when/where it applies) and `purpose`.
68
+
69
+ Phase 6 Learn feeds this to `scripts/learning_to_draft.py`: `skill`/`agent` objects with `encode: yes` auto-draft via `self-improvement-architect`; `eval`/`gate`/`preflight`/`approval` objects become routable Prevention-Pattern enforcement specs (condition → behavior → lever → actuator → verifying artifact). This file is the contract that turns a captured finding into an action with no human re-keying.
70
+
71
+ ## Acceptance Criteria
72
+ Successful only if it: ingests Prompt 1's LOs by id rather than re-extracting; dedupes and flags merges; reconciles against existing memory (Store vs Verify-fires); flags every net-new object as `[NET-NEW vs Prompt 1]` with justifying evidence; separates explicit from revealed and cross-project from project-specific; avoids encoding transient/weak findings; captures hard gates & approval rules; includes a do-not-encode list; produces a copy-ready package keyed by LO-id; routes memory writes through `memory_writer.py`; and ALSO writes the `.build-loop/learning-objects.json` emit (§13) so the auto-draft loop closes.
@@ -0,0 +1,45 @@
1
+ # Recursive Learning Retrospective Judge Prompt
2
+
3
+ > v2 (2026-06-18) — adds a MANDATORY verification step to evidence grounding. In the live test the judge only verified facts because it was instructed to; left implicit, a judge grades grounding from plausibility. v2 requires independent tool-verification of headline claims when source is available, and penalizes false precision.
4
+
5
+ ## Role
6
+ You are an external evaluator for recursive learning retrospectives across apps, agents, plugins, and build-loop systems. Judge whether the retrospective is evidence-grounded, behavior-aware, flexible, and useful for improving future system behavior. **Do not reward length.** Reward accuracy, evidence quality, useful pattern discovery, and clear system-encoding recommendations.
7
+
8
+ > You MUST run in a context INDEPENDENT of the retrospective's author. If you authored or co-authored the retrospective, decline — a self-review is not an independent verdict.
9
+
10
+ ## Input
11
+ `[PASTE RETROSPECTIVE OUTPUT HERE]`
12
+ Optional (strongly preferred — enables verification): `[PASTE INITIAL SPEC / NAVGATOR SUMMARY / USER STEERING / REPO PATH / AGENT LOG SUMMARY HERE]`, and read-only tool access to the project repo + memory.
13
+
14
+ ## Mandatory verification gate (run BEFORE scoring)
15
+ If the retrospective makes checkable factual claims AND you have access to the source (repo, memory, logs, commits):
16
+ - Independently verify **at least 3 headline/load-bearing claims** with tools (grep, git show, file reads). Pick the claims the analysis most depends on.
17
+ - Record what you checked and the result (verified / refuted / could-not-check).
18
+ - A claim that drives a P0 recommendation MUST be among those you check.
19
+ **Scoring constraint:** if verification was possible but you skipped it, cap criterion 1 (Evidence grounding) at **3**. If any headline claim is refuted, criterion 1 cannot exceed **2** and the verdict cannot be Accept.
20
+ If the source is genuinely unavailable, say so and grade grounding on internal consistency + the retrospective's own confidence markers.
21
+
22
+ ## Scoring
23
+ Each criterion 1–5: 5 Excellent (complete, evidence-grounded, decision-useful) · 4 Strong (minor gaps) · 3 Adequate (useful but missing nuance/evidence) · 2 Weak (significant gaps/overclaims/poor structure) · 1 Poor (unreliable/generic/unsupported).
24
+
25
+ ## Criteria (score each 1–5 with rationale)
26
+ 1. **Evidence grounding** — cites specific evidence; distinguishes known/unknown/inferred; avoids unsupported conclusions; identifies evidence gaps. (Subject to the verification gate above — ground this score in what you actually checked.)
27
+ 2. **Recursive learning orientation** — identifies what the system should learn; converts findings to learning objects; assigns encoding targets; doesn't stop at diagnosis.
28
+ 3. **Spec vs current-state comparison** — reconstructs initial spec; assesses current implementation; identifies gaps; doesn't conflate current with desired; surfaces drift.
29
+ 4. **Project maturity judgment** — classifies maturity before recommending; avoids locking suboptimal mid-build designs; avoids needless redesign of near-done; does NOT use a maturity label to soften a live defect; explains posture with evidence.
30
+ 5. **Behavior and workflow discovery** — identifies corrections/approvals/clarifications/redirects; distinguishes expressed vs revealed; mines workflow not just comments; CLUSTERS rather than emitting 1:1 behavior→LO rows.
31
+ 6. **Diagnostic RCA quality** — RCA only where useful (penalize RCA-on-everything AND too-few-when-warranted); each RCA explains creation + escape path; system-level causes not just symptoms; produces a learning object + encoding target.
32
+ 7. **Pattern discovery flexibility** — adds emergent categories; preserves unexpected findings; avoids overfitting to seed taxonomies; distinguishes one-off from reusable. Penalize count-targeting (suspiciously uniform N-per-section).
33
+ 8. **System-encoding quality** — memory recs appropriate/not overbroad; agent instructions specific; skill recs procedural/reusable; plugin/app recs concrete WITH acceptance criteria; evals/gates measurable.
34
+ 9. **Hard gates and approval logic** — identifies keys/permissions/accounts/deploy approvals/privacy/security/destructive; distinguishes capturable preflight from real-time approval; avoids unsafe automation.
35
+ 10. **Counterfactual simulation** — includes only phases with a real counterfactual (penalize a padded full-phase table); identifies where learning reduces intervention; marks where human gates remain; doesn't pretend uncertain automation is reliable.
36
+ 11. **Recommendation quality** — ORDINAL priority (P0/P1/P2) with qualitative justification; PENALIZE false precision (multiplied point-scores implying uncalibrated accuracy); clear ranking; improves end-to-end quality; includes both current-system evolution and a from-scratch option.
37
+
38
+ ## Density check (applies across all criteria)
39
+ Penalize forced-completeness padding and restated findings. A concise retrospective that omits low-signal sections and cross-references ids should score HIGHER than an exhaustive one that fills every scaffold.
40
+
41
+ ## Output Format
42
+ `# Judge Evaluation` → `## Verification performed` (what you checked + result; or why unavailable) → `## Overall score` [avg]/5 → `## Summary judgment` (2–4 sentences) → `## Scores by criterion` (table: Criterion | Score | Rationale, all 11) → `## Top strengths` (1–3) → `## Highest-risk gaps` (1–3) → `## Required fixes before trusting the output` (1–3) → `## Optional improvements` (1–3) → `## Final verdict` (Accept / Accept with revisions / Reject and rerun).
43
+
44
+ ## Acceptance Criteria
45
+ Successful only if it: runs the verification gate (or justifies why it cannot) and grounds criterion 1 in checked claims; scores each criterion clearly with rationale; identifies concrete fixes; flags unsupported/refuted claims; penalizes RCA-only outputs; penalizes overfitting/count-targeting; penalizes unsafe/overbroad automation; penalizes false-precision scoring and padding; penalizes recommendations optimizing local steps over end-to-end outcomes; gives a clear accept/revise/reject verdict.
@@ -100,7 +100,7 @@ against a source before the packet states it. An unverifiable atom is labeled
100
100
  - Standalone: `/build-loop:research-run [topic]`
101
101
  - From build-loop: orchestrator routes RESEARCH-intent requests here instead of the full loop
102
102
  - During normal build-loop runs: `scripts/research_trigger.py` decides whether this skill should run, which depth to use, where to persist the packet, and whether current/external claims are blocked until cited. See `references/research-trigger-policy.md`.
103
- - After packet: user decides — `/build-loop:run` to implement, `/build-loop:optimize-run` to optimize, or shelve
103
+ - After packet: user decides — `/build-loop:run` to implement or optimize (say "optimize <target>"), or shelve
104
104
 
105
105
  ## State
106
106
 
@@ -0,0 +1,42 @@
1
+ ---
2
+ name: root-cause-analysis
3
+ description: Blameless root-cause analysis that produces durable system levers, not blame or one-off patches. Use AFTER a failure/regression/wrong-output/near-miss when you need to explain why it existed AND why it escaped controls, then land the smallest system change that prevents recurrence. Tiered L0/L1/L2 by impact. Distinct from debug-loop (which fixes the live bug); this is what debug-loop's report step and the recursive-retrospective §8 delegate to. Agent-invoked (no dedicated command); the design is optimized for agent use: structured tiered (L0/L1/L2) output, primarily reached by delegation from debug-loop, recursive-retrospective, and the RCA agents; a human can still reach it by natural-language request after a failure. NOT for searching/storing past incidents — that is `debugging-memory` (`{op:search|store}`).
4
+ user-invocable: false
5
+ ---
6
+
7
+ # Root Cause Analysis
8
+
9
+ Diagnose failures without blame, identify durable system levers, and produce corrective actions that prevent recurrence. A valid RCA explains BOTH the **creation path** (why the bad condition existed) and the **escape path** (why it reached the user/repo/system despite controls). The goal is the smallest durable system change that would have prevented, detected, contained, or reversed the failure — not assigning fault.
10
+
11
+ ## Boundary (read first — avoids overlap)
12
+ - `debug-loop` / `debugging-memory` = **live, find-and-fix THIS bug now** (iterative investigate→fix→verify).
13
+ - `root-cause-analysis` (this) = **blameless post-failure analysis** → durable lever + actuator + regression artifact + spread check. It runs *after* the fix, or on a class/pattern, and is what debug-loop's report phase and `recursive-retrospective` §8 should invoke instead of carrying their own mini-RCA.
14
+
15
+ ## The three prompts (modular)
16
+ 1. **General RCA** — `references/root-cause-analysis/01-rca.md`: any failure. Tiered L0 (log) / L1 (mini) / L2 (full).
17
+ 2. **Agentic Coding RCA** — `references/root-cause-analysis/02-agentic-rca.md`: extension of Prompt 1 for AI-coding-agent failures (attribution gate, agentic failure modes, loop-fix vs code-repair). It is Prompt 1 **+ deltas**, not a restatement.
18
+ 3. **Mini-RCA** — `references/root-cause-analysis/03-mini-rca.md`: lightweight L1 for low-risk issues.
19
+ 4. **Judge** — `references/root-cause-analysis/04-judge.md`: independent evaluator with a mandatory verification gate (a claim is `FACT` only if checked against source). NEW vs the source suite — closes the "labeled FACT but never verified" gap.
20
+
21
+ ## Hardening applied (vs the source RCA suite)
22
+ - **Level↔schema binding.** L0 = 3 fields; L1 = Mini-RCA; only L2 uses the full schema. The full output schema does NOT apply to L0/L1 (the source "use this exact structure" fought the tiering).
23
+ - **Density governor.** Omit a section that yields no signal; never pad an empty table. Shorter-with-signal beats exhaustive.
24
+ - **Verify-before-FACT.** A causal claim may be tagged `FACT` only if independently checked against its cited source this session; otherwise `INFERENCE`/`ASSUMPTION`.
25
+ - **Tool-bound spread check.** "Where else could this happen?" is a `grep`/NavGator-impact job, not prose — run the scan and cite hits.
26
+ - **Owner optional in agent contexts.** The owner of a durable fix is often a gate/hook, not a person; `actuator` + `regression artifact` are the real closure, not `owner`/`due-date`.
27
+ - **Mini-RCA tree-escalation.** If a second independent contributor appears, escalate from the linear four-whys to the L2 causal map.
28
+
29
+ ## Native strengths preserved (the reason this suite is worth keeping)
30
+ - **Creation path + escape path** duality (control existed? fired? ignored/misread/bypassed/too weak?).
31
+ - **Action Strength Hierarchy** (eliminate > substitute > forcing-function > standardize > automate-detection > checklist > train/doc). "Be more careful" / docs-as-sole-fix is banned unless risk is low and no stronger lever is feasible.
32
+ - **Lever + Actuator** (where the fix lands vs what makes it fire) — the dormant-fix antidote.
33
+ - **Banned closures**: human error · agent error · be more careful · edge case · quirk · cosmetic · one-off · works now · "fixed in code" without prevention.
34
+ - **Regression artifact** proving old-behavior-fails / new-behavior-passes.
35
+ - **First Attribution Gate** (agentic): check task/context/loop/tool/codebase/verification/review BEFORE blaming the agent.
36
+
37
+ ## Model tiering
38
+ - L2 RCA + the judge are Frontier-tier (Fable); judge MUST run independent of the analysis author. Frontier-unavailable → Opus fallback, never Code tier.
39
+ - L0/L1 can run at the executor tier.
40
+
41
+ ## Output homes
42
+ - Corrective actions with a memory/rule target route through the canonical `memory_writer.py`; regression artifacts (tests/evals/policy/checklist) commit in-repo.
@@ -17,7 +17,7 @@ This is the canon the `security-reviewer` agent grades against, and the canon th
17
17
  - **Auto-loaded** by `skills/defenseclaw-bridge/SKILL.md` after Phase 3 Execute when the build produced agent-builder-style artifacts (`tool-contract.md`, `agent-manifest.md`, `guardrail.md`).
18
18
  - **User-invocable** standalone: ask "what are the security concerns for this design", "give me the OWASP threat model for this", "which ASI risks does this surface", and the orchestrator should `Skill("build-loop:security-methodology")`.
19
19
 
20
- This skill is **knowledge only**. It writes nothing. It performs no scans. The grading logic lives in `security-reviewer`; the runtime mapping lives in `defenseclaw-bridge`.
20
+ This skill is **knowledge only**. It writes nothing. It performs no scans. The **deterministic, always-on scan** lives in `skills/security-scan/` (script `scripts/security_scan.py`) — the model-independent arm that runs before every push via the `pre_bash_dispatch.sh` gate and is user-invocable during planning; it catches the greppable classes (secrets, secret-in-logs, injection, missing rate-limit/headers) and cites the same matrix rows. The LLM **grading** (judgment layer) lives in `security-reviewer`; the runtime mapping lives in `defenseclaw-bridge`.
21
21
 
22
22
  ## What this skill ships
23
23
 
@@ -103,3 +103,12 @@ The orchestrator scans the goal text for keywords matching these classes and ins
103
103
  - ⚠️ MITRE ATLAS technique enumeration is summarized, not re-authored. Always check `https://atlas.mitre.org/` for the current technique catalog before citing a specific technique in a finding.
104
104
  - ⚠️ NIST AI 600-1 is a profile, not a regulation. Regulatory regimes (EU AI Act, US executive orders, sectoral rules) cite NIST but add their own requirements. This skill does not track regulatory regimes; pair with project-specific legal review when one applies.
105
105
  - ⚠️ The cross-source matrix has known gaps. ASI07 (insecure inter-agent communication) does not have a clean DefenseClaw mapping because the runtime control surface for A2A trust is still an industry-open problem. The matrix marks this row `(gap)` rather than papering over it.
106
+
107
+ ## Required sweeps for app+DB security passes (LO-5) + risk-presentation default (SC-1)
108
+
109
+ **Two sweeps are REQUIRED, not optional, whenever a pass covers an app that has both HTTP routes and a database** — access-control review and data-integrity review are different lenses and neither is a superset of the other (proven both ways, atomize-ai 2026-06-30: an OWASP/access-control review missed a destructive `onDelete: Cascade`; a schema/secrets DB-RCA missed 4 unauthenticated mutation routes + a fail-open auth bug).
110
+
111
+ 1. **Route-auth enumeration** — walk **every** `app/api/**/route.ts` (or the framework equivalent) handler; confirm each mutating/DDL endpoint has an auth guard, AND that the guard **fails closed** when its secret env is unset (the `token !== process.env.X` bypass when `X` is undefined → `undefined !== undefined` is false → passes). Owned by `security-reviewer` (OWASP A01). Do not sample — enumerate.
112
+ 2. **Destructive-FK / data-integrity sweep** — grep the schema for `onDelete: Cascade` (and `SetNull`), missing FK indexes, and merge/delete paths that destroy rather than reassign. Owned by `database-assessor`. A cascade that silently deletes user data is a security/integrity finding even when every route is authed.
113
+
114
+ **Risk-presentation default (SC-1 — bounded-risk user posture).** Lead every security finding with a **blast-radius verdict** (who/what is reachable, and from where — public vs. private-and-unpushed vs. inert-behind-a-schema-gate). When exposure is **proven contained**, present hardening (rotation, revokes, extra gates) as **recommended-but-deferrable**, not a hard blocker. Hard-gate ONLY when the blast radius is **unbounded, public, or unproven**. Rationale: this operator gates hardening on demonstrated blast radius, not on the existence of a risk — forcing rotation when exposure is provably private wastes cycles. This is a *presentation/gating* default, never a reason to skip a sweep or under-report a finding. See user-preference `feedback_security_blast_radius_first`.
@@ -0,0 +1,55 @@
1
+ ---
2
+ name: build-loop:security-scan
3
+ description: "Run before any feature push, during Phase 2 planning, or whenever an agent wants a security pass. Executes a deterministic, model-independent OWASP scanner (scripts/security_scan.py) over the repo — catches the common greppable classes: secrets in source, secrets/tokens in logs, SQL/command/eval injection, public mutating endpoints without rate limiting, missing security headers, prompt-injection sinks — and maps each finding to OWASP Web/LLM/Agentic IDs. The judgment layer (authz logic, tenant scoping, tool-permission scope, agent goal-drift) escalates to the security-reviewer agent + the security-methodology canon."
4
+ version: 0.1.0
5
+ user-invocable: false
6
+ ---
7
+
8
+ <!-- SPDX-FileCopyrightText: 2025-2026 Tyrone Ross, Jr <46267523+tyroneross@users.noreply.github.com> | SPDX-License-Identifier: Apache-2.0 -->
9
+
10
+ # Security Scan
11
+
12
+ The deterministic, **model-independent** complement to the two existing security artifacts:
13
+ - `agents/security-reviewer.md` — the LLM judgment grader (Fable-pinned; unavailable when Fable is down).
14
+ - `skills/security-methodology/` — the OWASP/NIST/ATLAS canon, knowledge-only ("performs no scans").
15
+
16
+ This skill RUNS: a stdlib-only Python scanner, no model, no network, no Fable dependency. It exists because of a **named, observed failure** — a GitHub OAuth `access_token` was logged to `console.log` in middleware, shipped, and went unnoticed across five commits. Root cause: detection was gated on a judgment flag (`riskSurfaceChange`) + a single model-pinned agent, with **no always-on deterministic backstop**. Secret-in-logs is a greppable class; it should be caught on every push regardless of any flag.
17
+
18
+ ## When to run
19
+
20
+ 1. **Before any feature push (always-on gate).** `scripts/hooks/pre_bash_dispatch.sh` routes `git push` through the scanner and HARD-BLOCKS the push on HIGH+ findings (mirrors the commit auditor). Invoke it explicitly too when pushing outside a build-loop project.
21
+ 2. **During Phase 2 planning.** Run it over the files/area you're about to change to surface existing security debt before adding to it.
22
+ 3. **Whenever any agent wants a security pass.** It's a plain script — any orchestrator or agent can call it (agent-callable; not a user-facing slash command, so `user-invocable: false`).
23
+
24
+ ## Run it
25
+
26
+ ```
27
+ python3 "${CLAUDE_PLUGIN_ROOT}/scripts/security_scan.py" --path <repo> [--fail-on {low,medium,high,critical}] [--json]
28
+ ```
29
+
30
+ - **Exit 0** = nothing at/above threshold · **Exit 1** = found something at/above threshold (this is what gates the pre-push hook).
31
+ - Default threshold is **HIGH**. `--json` emits machine output.
32
+ - Suppress a *confirmed* false positive with an inline `// nosec: <reason>` (JS/TS) or `# nosec: <reason>` (Python/shell) on the flagged line.
33
+
34
+ ## What it catches (DET layer — the greppable 80/20)
35
+
36
+ | Check | Severity | OWASP |
37
+ |---|---|---|
38
+ | Hardcoded provider keys / PEM private keys / `SECRET=…literal`; git-tracked `.env`/`.dev.vars` | HIGH | A07 / LLM06 |
39
+ | **Secret-in-logs** — `console/print` of a token/secret var or a token-labeled response body | HIGH | A09 / LLM06 |
40
+ | SQL built via string interpolation; `eval`/`new Function`; `child_process.exec`+concat; `shell=True`; `innerHTML=`/`dangerouslySetInnerHTML` with a var | HIGH | A03 / LLM05 / ASI05 |
41
+ | `fetch`/`requests` with a non-constant URL (SSRF) | MEDIUM | A10 |
42
+ | Public POST/PUT/PATCH/DELETE endpoint that emails/writes-DB with no rate-limit keyword | MEDIUM | A06 / LLM10 |
43
+ | Missing `_headers`/CSP at the project level | LOW | A02 |
44
+ | User/tool input concatenated into a `*prompt`/`system` var; wildcard tool perms (`tools:["*"]`) | MEDIUM | LLM01 / LLM06 / ASI02 |
45
+
46
+ ## What it does NOT catch — escalate to the JUDGE layer
47
+
48
+ The scanner is the deterministic 80/20. For the judgment risks — data-ownership/authz logic, RAG/tenant scoping, tool-permission scope vs task need, agent goal-drift, approval gates before destructive actions, supply-chain trust — load `Skill("build-loop:security-methodology")`, and when the change crosses a security boundary dispatch the `security-reviewer` agent. Scanner findings and agent findings both cite the same `references/cross-source-matrix.md` rows, so they compose into one report.
49
+
50
+ ## Interpreting findings
51
+
52
+ - **HIGH** → fix before push (the gate blocks). If it's a genuine false positive, annotate with `// nosec: <reason>`; if you must ship anyway, `BUILD_LOOP_HOOKS=off` bypasses the gate for that command (use sparingly, it's logged in the diff intent).
53
+ - **MEDIUM / LOW** → advisory. Route to `.build-loop/backlog/` rather than blocking. Rate-limiting and headers gaps live here.
54
+
55
+ Sources for every ID: `skills/security-methodology/references/owasp-{web,llm,agentic}-top-10.md` (current as of OWASP Web 2025 RC1, LLM v2.0 2025, Agentic 2026). The scanner is the enforcement arm; the methodology skill is the citation trail.
@@ -27,7 +27,7 @@ A skill that walks a completeness checklist before producing a build-loop-compat
27
27
 
28
28
  ---
29
29
 
30
- ## The 17-Item Checklist
30
+ ## The Completeness Checklist
31
31
 
32
32
  Walk every item before writing a single line of the plan body. For each item, record the answer (or "N/A with reason") inline in a `<!-- checklist -->` HTML comment block at the top of the plan file so the critic can verify it.
33
33
 
@@ -74,6 +74,8 @@ If the plan introduces any paid API call, the F-criteria table must include a ro
74
74
 
75
75
  If no paid API calls, write "N/A."
76
76
 
77
+ > **Adding an external service?** The integration also needs an **env-var manifest** — see **Item 19** (gated: fires only when the change adds a new external service/integration). It names every required env var, sources the names via live research, and checks secrets-vault availability. Keeps items 4–18 unrenumbered.
78
+
77
79
  ---
78
80
 
79
81
  ### Item 4 — Discoverability surfaces
@@ -332,6 +334,44 @@ Each value must be exactly one of `script | haiku | sonnet | opus | frontier`. O
332
334
 
333
335
  ---
334
336
 
337
+ ### Item 19 — Env-var manifest (gated: only when adding a new external service)
338
+
339
+ **Gate:** this item fires only when the change **adds** an external service or integration (a new third-party API, auth provider, database, payment processor, email/SMS sender, object store, analytics, etc.). If the change adds no new external service, write "N/A: no new external service" and skip the rest. (Topically this belongs with Items 2–3; it is numbered 19 to avoid renumbering the existing checklist.)
340
+
341
+ **Why:** ported from the `prd-builder` skill (scoped here to integration-adding build-loop changes) to prevent two recurring failure classes — (1) the app builds and runs but auth / DB / payments silently don't work because the env vars were never named, and (2) **fabricated env-var names** for a service the model has never actually wired.
342
+
343
+ **Prompt:** for every required env var the change introduces, name it and source it. Produce a manifest row per var:
344
+
345
+ - **Name** — the exact env-var name.
346
+ - **Tier** — `Required` | `Optional` | `Optional-but-recommended`.
347
+ - **What it does** — one line.
348
+ - **Where to obtain it** — the dashboard/console page or doc URL the user goes to.
349
+
350
+ **How to check:**
351
+
352
+ 1. **Source the names via live research — never from memory, never fabricated.** For each new service, resolve the real env-var names from official docs: Context7 MCP (`resolve-library-id` → `query-docs`) first, else WebSearch for the provider's current setup/quickstart docs (T1/T2 only). If a name cannot be verified from a T1/T2 source, it becomes an Open Question (Item 11), never a guessed value.
353
+
354
+ 2. **Secrets-vault availability check.** For each env var in the manifest, invoke the `secrets-vault` skill's load-by-name (`secrets-vault load <name>`) to detect availability:
355
+ - If present → mark `available in secrets-vault — load with \`secrets-vault load <name>\``.
356
+ - If absent → add the var to a **Pre-build checklist** with "obtain before build" guidance (the obtain link from the manifest row), so the missing credential surfaces before Execute rather than at runtime.
357
+
358
+ 3. Record the manifest (or the `N/A: no new external service` answer) inline in the `<!-- checklist -->` block, same as every other item.
359
+
360
+ **Example (good):**
361
+
362
+ ```markdown
363
+ Item 19 — Env-var manifest:
364
+ | Name | Tier | What it does | Where to obtain |
365
+ |---|---|---|---|
366
+ | STRIPE_SECRET_KEY | Required | Server-side Stripe API auth | dashboard.stripe.com → Developers → API keys |
367
+ | STRIPE_WEBHOOK_SECRET | Required | Verifies webhook signatures | dashboard.stripe.com → Webhooks → signing secret |
368
+ Secrets-vault: STRIPE_SECRET_KEY available (`secrets-vault load STRIPE_SECRET_KEY`); STRIPE_WEBHOOK_SECRET absent → Pre-build checklist (obtain before build).
369
+ ```
370
+
371
+ If the change adds no new external service, write "N/A: no new external service."
372
+
373
+ ---
374
+
335
375
  ## Frontmatter fields used by routing
336
376
 
337
377
  These fields appear in plan or chunk frontmatter and affect orchestrator routing decisions. They are validated by `scripts/plan_verify.py`.
@@ -369,6 +409,7 @@ Item 14 — Handoff document: <answer>
369
409
  Item 15 — Synthesis dimensions: <answer>
370
410
  Item 16 — Risk reason: <answer>
371
411
  Item 17 — UI input/output contract: <answer>
412
+ Item 19 — Env-var manifest: <answer or "N/A: no new external service">
372
413
  -->
373
414
 
374
415
  ## Goal
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: build-loop:sync-skills
3
- description: Use when the user asks to "check skill drift", "sync skills", or "update architecture skills", or when Phase 1 Assess detects stale source_hash values. Walks skills/architecture/ and skills/debugging/, recomputes source_hash, reports drift. Read-only.
3
+ description: Use when the user asks to "check skill drift", "sync skills", or "update architecture skills", or when Phase 1 Assess detects stale source_hash values. Walks skills/architecture/, recomputes source_hash, reports drift. Read-only.
4
4
  version: 0.1.0
5
5
  user-invocable: false
6
6
  ---
@@ -9,7 +9,7 @@ user-invocable: false
9
9
 
10
10
  # Sync-Skills — Drift Detection for Native Copies
11
11
 
12
- Build-loop's `skills/architecture/` and `skills/debugging/` skills are copied from canonical upstream repos (NavGator, claude-code-debugger). Each carries a `source:` path and `source_hash:` SHA-256 in its frontmatter. This skill recomputes the hash from the canonical source file and reports any drift.
12
+ Build-loop's `skills/architecture/` skills are copied from the canonical upstream repo (NavGator). Each carries a `source:` path and `source_hash:` SHA-256 in its frontmatter. This skill recomputes the hash from the canonical source file and reports any drift. (The former `skills/debugging/` skills were folded into the `debugging-memory` skill on 2026-07 and are no longer drift-checked — native/adapted, no canonical upstream.)
13
13
 
14
14
  **Read-only.** Never auto-updates a skill — surfaces a list of skills that need refresh and a one-line refresh command.
15
15
 
@@ -58,7 +58,7 @@ def find_canonical(rel_path):
58
58
 
59
59
  drift = []
60
60
  checked = 0
61
- for tree in ["skills/architecture", "skills/debugging"]:
61
+ for tree in ["skills/architecture"]:
62
62
  for skill_md in (ROOT / tree).rglob("SKILL.md"):
63
63
  fm = read_frontmatter(skill_md)
64
64
  src = fm.get("source")
@@ -119,10 +119,11 @@ PY
119
119
  - `skills/architecture/rules/SKILL.md`
120
120
  - `skills/architecture/dead/SKILL.md`
121
121
  - `skills/architecture/review/SKILL.md`
122
- - `skills/debugging/memory/SKILL.md`
123
- - `skills/debugging/store/SKILL.md`
124
- - `skills/debugging/assess/SKILL.md`
125
- - `skills/debugging/debug-loop/SKILL.md`
122
+
123
+ (The former `skills/debugging/{memory,store,assess}` skills were folded into the
124
+ `debugging-memory` skill's op reference files on 2026-07, pool-consolidation Inc 5;
125
+ they are native/adapted with no canonical upstream, so drift-detection for them is
126
+ retired. `debug-loop` lives at `skills/debug-loop/` and was never drift-checked.)
126
127
 
127
128
  ## Sibling Skills
128
129