devflow-kit 1.4.0 → 1.6.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 (95) hide show
  1. package/CHANGELOG.md +51 -0
  2. package/README.md +7 -3
  3. package/dist/commands/ambient.js +1 -1
  4. package/dist/commands/init.js +31 -2
  5. package/dist/commands/list.d.ts +21 -0
  6. package/dist/commands/list.js +71 -3
  7. package/dist/plugins.js +24 -24
  8. package/dist/utils/manifest.d.ts +45 -0
  9. package/dist/utils/manifest.js +100 -0
  10. package/dist/utils/post-install.js +6 -1
  11. package/package.json +1 -1
  12. package/plugins/devflow-accessibility/.claude-plugin/plugin.json +1 -1
  13. package/plugins/devflow-ambient/.claude-plugin/plugin.json +25 -4
  14. package/plugins/devflow-ambient/README.md +48 -29
  15. package/plugins/devflow-ambient/agents/coder.md +135 -0
  16. package/plugins/devflow-ambient/agents/reviewer.md +165 -0
  17. package/plugins/devflow-ambient/agents/scrutinizer.md +80 -0
  18. package/plugins/devflow-ambient/agents/shepherd.md +94 -0
  19. package/plugins/devflow-ambient/agents/simplifier.md +93 -0
  20. package/plugins/devflow-ambient/agents/skimmer.md +93 -0
  21. package/plugins/devflow-ambient/agents/validator.md +86 -0
  22. package/plugins/devflow-ambient/skills/ambient-router/SKILL.md +72 -28
  23. package/plugins/devflow-ambient/skills/ambient-router/references/skill-catalog.md +40 -34
  24. package/plugins/devflow-ambient/skills/debug-orchestration/SKILL.md +69 -0
  25. package/plugins/devflow-ambient/skills/implementation-orchestration/SKILL.md +92 -0
  26. package/plugins/devflow-ambient/skills/plan-orchestration/SKILL.md +71 -0
  27. package/plugins/devflow-audit-claude/.claude-plugin/plugin.json +10 -1
  28. package/plugins/devflow-audit-claude/commands/audit-claude.md +4 -0
  29. package/plugins/devflow-code-review/.claude-plugin/plugin.json +2 -1
  30. package/plugins/devflow-code-review/agents/reviewer.md +47 -9
  31. package/plugins/devflow-code-review/agents/synthesizer.md +12 -5
  32. package/plugins/devflow-code-review/commands/code-review-teams.md +43 -30
  33. package/plugins/devflow-code-review/commands/code-review.md +14 -2
  34. package/plugins/devflow-code-review/skills/knowledge-persistence/SKILL.md +128 -0
  35. package/plugins/devflow-code-review/skills/knowledge-persistence/references/examples.md +44 -0
  36. package/plugins/devflow-core-skills/.claude-plugin/plugin.json +2 -1
  37. package/plugins/devflow-core-skills/skills/docs-framework/SKILL.md +7 -1
  38. package/plugins/devflow-core-skills/skills/search-first/SKILL.md +133 -0
  39. package/plugins/devflow-core-skills/skills/search-first/references/evaluation-criteria.md +101 -0
  40. package/plugins/devflow-core-skills/skills/test-driven-development/SKILL.md +6 -5
  41. package/plugins/devflow-debug/.claude-plugin/plugin.json +5 -3
  42. package/plugins/devflow-debug/agents/synthesizer.md +211 -0
  43. package/plugins/devflow-debug/commands/debug-teams.md +28 -14
  44. package/plugins/devflow-debug/commands/debug.md +26 -12
  45. package/plugins/devflow-debug/skills/knowledge-persistence/SKILL.md +128 -0
  46. package/plugins/devflow-debug/skills/knowledge-persistence/references/examples.md +44 -0
  47. package/plugins/devflow-frontend-design/.claude-plugin/plugin.json +1 -1
  48. package/plugins/devflow-go/.claude-plugin/plugin.json +1 -1
  49. package/plugins/devflow-implement/.claude-plugin/plugin.json +2 -1
  50. package/plugins/devflow-implement/agents/coder.md +21 -13
  51. package/plugins/devflow-implement/agents/simplifier.md +32 -1
  52. package/plugins/devflow-implement/agents/skimmer.md +5 -0
  53. package/plugins/devflow-implement/agents/synthesizer.md +12 -5
  54. package/plugins/devflow-implement/commands/implement-teams.md +73 -60
  55. package/plugins/devflow-implement/commands/implement.md +45 -40
  56. package/plugins/devflow-implement/skills/knowledge-persistence/SKILL.md +128 -0
  57. package/plugins/devflow-implement/skills/knowledge-persistence/references/examples.md +44 -0
  58. package/plugins/devflow-java/.claude-plugin/plugin.json +1 -1
  59. package/plugins/devflow-python/.claude-plugin/plugin.json +1 -1
  60. package/plugins/devflow-react/.claude-plugin/plugin.json +1 -1
  61. package/plugins/devflow-resolve/.claude-plugin/plugin.json +4 -3
  62. package/plugins/devflow-resolve/agents/simplifier.md +32 -1
  63. package/plugins/devflow-resolve/commands/resolve-teams.md +16 -7
  64. package/plugins/devflow-resolve/commands/resolve.md +16 -7
  65. package/plugins/devflow-resolve/skills/knowledge-persistence/SKILL.md +128 -0
  66. package/plugins/devflow-resolve/skills/knowledge-persistence/references/examples.md +44 -0
  67. package/plugins/devflow-rust/.claude-plugin/plugin.json +1 -1
  68. package/plugins/devflow-self-review/.claude-plugin/plugin.json +10 -1
  69. package/plugins/devflow-self-review/agents/simplifier.md +32 -1
  70. package/plugins/devflow-self-review/commands/self-review.md +10 -4
  71. package/plugins/devflow-specify/.claude-plugin/plugin.json +1 -1
  72. package/plugins/devflow-specify/agents/skimmer.md +5 -0
  73. package/plugins/devflow-specify/agents/synthesizer.md +12 -5
  74. package/plugins/devflow-specify/commands/specify-teams.md +27 -20
  75. package/plugins/devflow-specify/commands/specify.md +26 -19
  76. package/plugins/devflow-typescript/.claude-plugin/plugin.json +1 -1
  77. package/scripts/hooks/ambient-prompt +8 -7
  78. package/scripts/hooks/session-start-memory +33 -3
  79. package/shared/agents/coder.md +21 -13
  80. package/shared/agents/reviewer.md +47 -9
  81. package/shared/agents/simplifier.md +32 -1
  82. package/shared/agents/skimmer.md +5 -0
  83. package/shared/agents/synthesizer.md +12 -5
  84. package/shared/skills/ambient-router/SKILL.md +72 -28
  85. package/shared/skills/ambient-router/references/skill-catalog.md +40 -34
  86. package/shared/skills/debug-orchestration/SKILL.md +69 -0
  87. package/shared/skills/docs-framework/SKILL.md +7 -1
  88. package/shared/skills/implementation-orchestration/SKILL.md +92 -0
  89. package/shared/skills/knowledge-persistence/SKILL.md +128 -0
  90. package/shared/skills/knowledge-persistence/references/examples.md +44 -0
  91. package/shared/skills/plan-orchestration/SKILL.md +71 -0
  92. package/shared/skills/search-first/SKILL.md +133 -0
  93. package/shared/skills/search-first/references/evaluation-criteria.md +101 -0
  94. package/shared/skills/test-driven-development/SKILL.md +6 -5
  95. package/plugins/devflow-ambient/commands/ambient.md +0 -110
@@ -0,0 +1,92 @@
1
+ ---
2
+ name: implementation-orchestration
3
+ description: Agent orchestration for IMPLEMENT intent — pre-flight, Coder, quality gates
4
+ user-invocable: false
5
+ allowed-tools: Read, Grep, Glob, Bash, Task, AskUserQuestion
6
+ ---
7
+
8
+ # Implementation Orchestration
9
+
10
+ Agent pipeline for IMPLEMENT intent in ambient ORCHESTRATED mode. Pre-flight checks, plan synthesis, Coder execution, and quality gates.
11
+
12
+ This is a lightweight variant of `/implement` for ambient ORCHESTRATED mode. Excluded: strategy selection (single/sequential/parallel Coders), retry loops, PR creation, knowledge loading.
13
+
14
+ ## Iron Law
15
+
16
+ > **QUALITY GATES ARE NON-NEGOTIABLE**
17
+ >
18
+ > Every Coder output passes through Validator → Simplifier → Scrutinizer → re-Validate → Shepherd.
19
+ > Skipping a gate because "it looks fine" is never acceptable. The pipeline runs to completion
20
+ > or halts on failure — there is no shortcut.
21
+
22
+ ---
23
+
24
+ ## Phase 1: Pre-flight — Branch Safety
25
+
26
+ Detect branch type before spawning Coder:
27
+
28
+ - **Work branches** (`feat/`, `fix/`, `chore/`, `refactor/`, `docs/` prefix): proceed on current branch.
29
+ - **Protected branches** (`main`, `master`, `develop`, `release/*`, `staging`, `production`): ask user via AskUserQuestion with 2-3 suggested branch names following `{type}/{ticket}-{slug}` convention. Include ticket number if available from conversation context.
30
+ - **If user declines branch creation**: proceed on the protected branch. Respect the user's choice.
31
+
32
+ ## Phase 2: Plan Synthesis
33
+
34
+ Synthesize conversation context into a structured EXECUTION_PLAN for Coder:
35
+
36
+ - **If a plan exists** in conversation context (from plan mode — accepted in-session or injected after "accept and clear") → use the plan as-is.
37
+ - **Otherwise** → synthesize from conversation: what to build, files/modules affected, constraints, decisions made during discussion.
38
+
39
+ Format as structured markdown with: Goal, Steps, Files, Constraints, Decisions.
40
+
41
+ ## Phase 3: Coder Execution
42
+
43
+ Record git SHA before first Coder: `git rev-parse HEAD`
44
+
45
+ Spawn `Task(subagent_type="Coder")` with input variables:
46
+ - **TASK_ID**: Generated from timestamp (e.g., `task-2026-03-19_1430`)
47
+ - **TASK_DESCRIPTION**: From conversation context
48
+ - **BASE_BRANCH**: Current branch (or newly created branch from Phase 1)
49
+ - **EXECUTION_PLAN**: From Phase 2
50
+ - **PATTERNS**: Codebase patterns from conversation context
51
+ - **CREATE_PR**: `false` (commit only, no push)
52
+ - **DOMAIN**: Inferred from files in scope (`backend`, `frontend`, `tests`, `fullstack`)
53
+
54
+ **Execution strategy**: Single sequential Coder by default. Parallel Coders only when tasks are self-contained — zero shared contracts, no integration points, different files/modules with no imports between them.
55
+
56
+ If Coder returns **BLOCKED**, halt the pipeline and report to user.
57
+
58
+ ## Phase 4: FILES_CHANGED Detection
59
+
60
+ After Coder completes, detect changed files:
61
+
62
+ ```bash
63
+ git diff --name-only {starting_sha}...HEAD
64
+ ```
65
+
66
+ Pass FILES_CHANGED to all quality gate agents.
67
+
68
+ ## Phase 5: Quality Gates
69
+
70
+ Run sequentially — each gate must pass before the next:
71
+
72
+ 1. `Task(subagent_type="Validator")` (build + typecheck + lint + tests) — retry up to 2× on failure (Coder fixes between retries)
73
+ 2. `Task(subagent_type="Simplifier")` — code clarity and maintainability pass on FILES_CHANGED
74
+ 3. `Task(subagent_type="Scrutinizer")` — 9-pillar quality evaluation on FILES_CHANGED
75
+ 4. `Task(subagent_type="Validator")` (re-validate after Simplifier/Scrutinizer changes)
76
+ 5. `Task(subagent_type="Shepherd")` — verify implementation matches original request — retry up to 2× if misalignment found
77
+
78
+ If any gate exhausts retries, halt pipeline and report what passed and what failed.
79
+
80
+ ## Phase 6: Completion
81
+
82
+ Report results:
83
+ - Commits created (from Coder)
84
+ - Files changed
85
+ - Quality gate results (pass/fail per gate)
86
+ - No push — user decides when to push
87
+
88
+ ## Error Handling
89
+
90
+ - **Coder BLOCKED**: Halt immediately, report blocker to user
91
+ - **Validator fails after retries**: Report specific failures, halt pipeline
92
+ - **Shepherd misalignment after retries**: Report misalignment details, let user decide next steps
@@ -0,0 +1,71 @@
1
+ ---
2
+ name: plan-orchestration
3
+ description: Agent orchestration for PLAN intent — codebase orientation, design exploration, gap validation
4
+ user-invocable: false
5
+ allowed-tools: Read, Grep, Glob, Bash, Task, AskUserQuestion
6
+ ---
7
+
8
+ # Plan Orchestration
9
+
10
+ Agent pipeline for PLAN intent in ambient ORCHESTRATED mode. Codebase orientation, targeted exploration, architecture design, and gap validation.
11
+
12
+ This is a lightweight variant of the Plan phase in `/implement` for ambient ORCHESTRATED mode.
13
+
14
+ ## Iron Law
15
+
16
+ > **PLANS WITHOUT CODEBASE GROUNDING ARE FANTASIES**
17
+ >
18
+ > Orient before architecting. Every design decision must reference existing patterns,
19
+ > real file structures, and actual integration points. A plan that ignores the codebase
20
+ > will fail on contact with implementation.
21
+
22
+ ---
23
+
24
+ ## Phase 1: Orient
25
+
26
+ Spawn `Task(subagent_type="Skimmer")` to get codebase overview relevant to the planning question:
27
+
28
+ - Existing patterns and conventions in the affected area
29
+ - File structure and module boundaries
30
+ - Test patterns and coverage approach
31
+ - Related prior implementations (similar features, analogous patterns)
32
+
33
+ ## Phase 2: Explore
34
+
35
+ Based on Skimmer findings, spawn 2-3 `Task(subagent_type="Explore")` agents **in a single message** (parallel execution):
36
+
37
+ - **Integration explorer**: Examine integration points — APIs, shared types, module boundaries the plan must respect
38
+ - **Pattern explorer**: Find existing implementations of similar features to follow as templates
39
+ - **Constraint explorer**: Identify constraints — test infrastructure, build system, CI requirements, deployment concerns
40
+
41
+ Adjust explorer focus based on the specific planning question.
42
+
43
+ ## Phase 3: Design
44
+
45
+ Spawn `Task(subagent_type="Plan")` with combined Skimmer + Explore findings:
46
+
47
+ - Design implementation approach with file-level specificity
48
+ - Reference existing patterns discovered in Phase 1-2
49
+ - Include: architecture decisions, file changes, new files needed, test strategy
50
+ - Flag any areas where existing patterns conflict with the proposed approach
51
+
52
+ ## Phase 4: Validate
53
+
54
+ Main session reviews the plan for:
55
+
56
+ - **Gaps**: Missing files, unhandled edge cases, integration points not addressed
57
+ - **Risks**: Areas where the plan deviates from existing patterns, potential regressions
58
+ - **Ambiguities**: Design choices that need user input
59
+
60
+ Present plan to user with identified risks. Use AskUserQuestion for any ambiguous design choices.
61
+
62
+ ## Output
63
+
64
+ Structured plan ready to feed into IMPLEMENT/ORCHESTRATED if user proceeds:
65
+
66
+ - Goal and scope
67
+ - Architecture decisions with rationale
68
+ - File-level change list (create/modify/delete)
69
+ - Test strategy
70
+ - Risks and mitigations
71
+ - Open questions (if any)
@@ -4,7 +4,16 @@
4
4
  "author": {
5
5
  "name": "Dean0x"
6
6
  },
7
- "version": "1.4.0",
7
+ "version": "1.6.0",
8
+ "homepage": "https://github.com/dean0x/devflow",
9
+ "repository": "https://github.com/dean0x/devflow",
10
+ "license": "MIT",
11
+ "keywords": [
12
+ "audit",
13
+ "claude-md",
14
+ "best-practices",
15
+ "lint"
16
+ ],
8
17
  "agents": [],
9
18
  "skills": []
10
19
  }
@@ -1,3 +1,7 @@
1
+ ---
2
+ description: Audit CLAUDE.md files against Anthropic best practices
3
+ ---
4
+
1
5
  # Command: /audit-claude
2
6
 
3
7
  ## Description
@@ -4,7 +4,7 @@
4
4
  "author": {
5
5
  "name": "Dean0x"
6
6
  },
7
- "version": "1.4.0",
7
+ "version": "1.6.0",
8
8
  "homepage": "https://github.com/dean0x/devflow",
9
9
  "repository": "https://github.com/dean0x/devflow",
10
10
  "license": "MIT",
@@ -28,6 +28,7 @@
28
28
  "database-patterns",
29
29
  "dependencies-patterns",
30
30
  "documentation-patterns",
31
+ "knowledge-persistence",
31
32
  "performance-patterns",
32
33
  "regression-patterns",
33
34
  "review-methodology",
@@ -42,12 +42,38 @@ The orchestrator provides:
42
42
  ## Responsibilities
43
43
 
44
44
  1. **Load focus skill** - Read the pattern skill file for your focus area from the table above. This gives you detection rules and patterns specific to your review type.
45
- 2. **Identify changed lines** - Get diff against base branch (main/master/develop)
46
- 3. **Apply 3-category classification** - Sort issues by where they occur
47
- 4. **Apply focus-specific analysis** - Use pattern skill detection rules from the loaded skill file
48
- 5. **Assign severity** - CRITICAL, HIGH, MEDIUM, LOW based on impact
49
- 6. **Generate report** - File:line references with suggested fixes
50
- 7. **Determine merge recommendation** - Based on blocking issues
45
+ 2. **Check known pitfalls** - If `.memory/knowledge/pitfalls.md` exists, read it. Check if any pitfall Areas overlap with files in the current diff. Verify the Resolution was applied. Flag if a known pitfall pattern is being reintroduced.
46
+ 3. **Identify changed lines** - Get diff against base branch (main/master/develop)
47
+ 4. **Apply 3-category classification** - Sort issues by where they occur
48
+ 5. **Apply focus-specific analysis** - Use pattern skill detection rules from the loaded skill file
49
+ 6. **Assign severity** - CRITICAL, HIGH, MEDIUM, LOW based on impact
50
+ 7. **Assess confidence** - Assign 0-100% confidence to each finding (see Confidence Scale below)
51
+ 8. **Filter by confidence** - Only report findings ≥80% in main sections; lower-confidence items go to Suggestions
52
+ 9. **Consolidate similar issues** - Group related findings to reduce noise (see Consolidation Rules)
53
+ 10. **Generate report** - File:line references with suggested fixes
54
+ 11. **Determine merge recommendation** - Based on blocking issues
55
+
56
+ ## Confidence Scale
57
+
58
+ Assess how certain you are that each finding is a real issue (not a false positive):
59
+
60
+ | Range | Label | Meaning |
61
+ |-------|-------|---------|
62
+ | 90-100% | Certain | Clearly a bug, vulnerability, or violation — no ambiguity |
63
+ | 80-89% | High | Very likely an issue, but minor chance of false positive |
64
+ | 60-79% | Medium | Plausible issue, but depends on context you may not fully see |
65
+ | < 60% | Low | Possible concern, but likely a matter of style or interpretation |
66
+
67
+ <!-- Confidence threshold also in: shared/agents/synthesizer.md, plugins/devflow-code-review/commands/code-review.md -->
68
+ **Threshold**: Only report findings with ≥80% confidence in Blocking, Should-Fix, and Pre-existing sections. Findings with 60-79% confidence go to the Suggestions section. Findings < 60% are dropped entirely.
69
+
70
+ ## Consolidation Rules
71
+
72
+ Before writing your report, apply these noise reduction rules:
73
+
74
+ 1. **Group similar issues** — If 3+ instances of the same pattern appear (e.g., "missing error handling" in multiple functions), consolidate into 1 finding listing all locations rather than N separate findings
75
+ 2. **Skip stylistic preferences** — Do not flag formatting, naming style, or code organization choices unless they violate explicit project conventions found in CLAUDE.md, .editorconfig, or linter configs
76
+ 3. **Skip issues in unchanged code** — Pre-existing issues in lines you did NOT change should only be reported if CRITICAL severity (security vulnerabilities, data loss risks)
51
77
 
52
78
  ## Issue Categories (from review-methodology)
53
79
 
@@ -76,17 +102,29 @@ Report format for `{output_path}`:
76
102
 
77
103
  ### CRITICAL
78
104
  **{Issue}** - `file.ts:123`
105
+ **Confidence**: {n}%
79
106
  - Problem: {description}
80
107
  - Fix: {suggestion with code}
81
108
 
109
+ **{Issue Title} ({N} occurrences)** — Confidence: {n}%
110
+ - `file1.ts:12`, `file2.ts:45`, `file3.ts:89`
111
+ - Problem: {description of the shared pattern}
112
+ - Fix: {suggestion that applies to all occurrences}
113
+
82
114
  ### HIGH
83
- {issues...}
115
+ {issues with **Confidence**: {n}% each...}
84
116
 
85
117
  ## Issues in Code You Touched (Should Fix)
86
- {issues with file:line...}
118
+ {issues with file:line and **Confidence**: {n}% each...}
87
119
 
88
120
  ## Pre-existing Issues (Not Blocking)
89
- {informational issues...}
121
+ {informational issues with **Confidence**: {n}% each...}
122
+
123
+ ## Suggestions (Lower Confidence)
124
+
125
+ {Max 3 items with 60-79% confidence. Brief description only — no code fixes.}
126
+
127
+ - **{Issue}** - `file.ts:456` (Confidence: {n}%) — {brief description}
90
128
 
91
129
  ## Summary
92
130
  | Category | CRITICAL | HIGH | MEDIUM | LOW |
@@ -128,10 +128,14 @@ Analyze 3 axes to determine strategy:
128
128
  Synthesize outputs from multiple Reviewer agents. Apply strict merge rules.
129
129
 
130
130
  **Process:**
131
- 1. Read all review reports from `${REVIEW_BASE_DIR}/*-report.*.md`
132
- 2. Categorize issues into 3 buckets (from review-methodology)
133
- 3. Count by severity (CRITICAL, HIGH, MEDIUM, LOW)
134
- 4. Determine merge recommendation based on blocking issues
131
+ 1. Read all review reports from `${REVIEW_BASE_DIR}/*.md` (exclude your own output `review-summary.*.md`)
132
+ 2. Extract confidence percentages from each finding
133
+ 3. Apply confidence-aware aggregation: when multiple reviewers flag the same file:line, boost confidence by 10% per additional reviewer (cap at 100%)
134
+ <!-- Confidence threshold also in: shared/agents/reviewer.md, plugins/devflow-code-review/commands/code-review.md -->
135
+ 4. Maintain ≥80% confidence threshold in final output
136
+ 5. Categorize issues into 3 buckets (from review-methodology)
137
+ 6. Count by severity (CRITICAL, HIGH, MEDIUM, LOW)
138
+ 7. Determine merge recommendation based on blocking issues
135
139
 
136
140
  **Issue Categories:**
137
141
  - **Blocking** (Category 1): Issues in YOUR changes - CRITICAL/HIGH must block
@@ -172,7 +176,10 @@ Report format:
172
176
  | Pre-existing | - | - | {n} | {n} | {n} |
173
177
 
174
178
  ## Blocking Issues
175
- {List with file:line and suggested fix}
179
+ {List with file:line, confidence %, and suggested fix}
180
+
181
+ ## Suggestions (Lower Confidence)
182
+ {Max 5 items across all reviewers with 60-79% confidence. Brief descriptions only.}
176
183
 
177
184
  ## Action Plan
178
185
  1. {Priority fix}
@@ -85,39 +85,42 @@ Spawn review teammates with self-contained prompts:
85
85
  You are reviewing PR #{pr_number} on branch {branch} (base: {base_branch}).
86
86
  1. Read your skill: `Read ~/.claude/skills/security-patterns/SKILL.md`
87
87
  2. Read review methodology: `Read ~/.claude/skills/review-methodology/SKILL.md`
88
- 3. Get the diff: `git diff {base_branch}...HEAD`
89
- 4. Apply the 6-step review process from review-methodology
90
- 5. Focus: injection, auth bypass, crypto misuse, OWASP vulnerabilities
91
- 6. Classify each finding: 🔴 BLOCKING / ⚠️ SHOULD-FIX / ℹ️ PRE-EXISTING
92
- 7. Include file:line references for every finding
93
- 8. Write your report: `Write to .docs/reviews/{branch_slug}/security.md`
94
- 9. Report completion: SendMessage(type: "message", recipient: "team-lead", summary: "Security review done")
88
+ 3. Read `.memory/knowledge/pitfalls.md` if it exists. Check for known pitfall patterns in the diff.
89
+ 4. Get the diff: `git diff {base_branch}...HEAD`
90
+ 5. Apply the 6-step review process from review-methodology
91
+ 6. Focus: injection, auth bypass, crypto misuse, OWASP vulnerabilities
92
+ 7. Classify each finding: 🔴 BLOCKING / ⚠️ SHOULD-FIX / ℹ️ PRE-EXISTING
93
+ 8. Include file:line references for every finding
94
+ 9. Write your report: `Write to .docs/reviews/{branch_slug}/security.md`
95
+ 10. Report completion: SendMessage(type: "message", recipient: "team-lead", summary: "Security review done")
95
96
 
96
97
  - Name: "architecture-reviewer"
97
98
  Prompt: |
98
99
  You are reviewing PR #{pr_number} on branch {branch} (base: {base_branch}).
99
100
  1. Read your skill: `Read ~/.claude/skills/architecture-patterns/SKILL.md`
100
101
  2. Read review methodology: `Read ~/.claude/skills/review-methodology/SKILL.md`
101
- 3. Get the diff: `git diff {base_branch}...HEAD`
102
- 4. Apply the 6-step review process from review-methodology
103
- 5. Focus: SOLID violations, coupling, layering issues, modularity problems
104
- 6. Classify each finding: 🔴 BLOCKING / ⚠️ SHOULD-FIX / ℹ️ PRE-EXISTING
105
- 7. Include file:line references for every finding
106
- 8. Write your report: `Write to .docs/reviews/{branch_slug}/architecture.md`
107
- 9. Report completion: SendMessage(type: "message", recipient: "team-lead", summary: "Architecture review done")
102
+ 3. Read `.memory/knowledge/pitfalls.md` if it exists. Check for known pitfall patterns in the diff.
103
+ 4. Get the diff: `git diff {base_branch}...HEAD`
104
+ 5. Apply the 6-step review process from review-methodology
105
+ 6. Focus: SOLID violations, coupling, layering issues, modularity problems
106
+ 7. Classify each finding: 🔴 BLOCKING / ⚠️ SHOULD-FIX / ℹ️ PRE-EXISTING
107
+ 8. Include file:line references for every finding
108
+ 9. Write your report: `Write to .docs/reviews/{branch_slug}/architecture.md`
109
+ 10. Report completion: SendMessage(type: "message", recipient: "team-lead", summary: "Architecture review done")
108
110
 
109
111
  - Name: "performance-reviewer"
110
112
  Prompt: |
111
113
  You are reviewing PR #{pr_number} on branch {branch} (base: {base_branch}).
112
114
  1. Read your skill: `Read ~/.claude/skills/performance-patterns/SKILL.md`
113
115
  2. Read review methodology: `Read ~/.claude/skills/review-methodology/SKILL.md`
114
- 3. Get the diff: `git diff {base_branch}...HEAD`
115
- 4. Apply the 6-step review process from review-methodology
116
- 5. Focus: N+1 queries, memory leaks, algorithm issues, I/O bottlenecks
117
- 6. Classify each finding: 🔴 BLOCKING / ⚠️ SHOULD-FIX / ℹ️ PRE-EXISTING
118
- 7. Include file:line references for every finding
119
- 8. Write your report: `Write to .docs/reviews/{branch_slug}/performance.md`
120
- 9. Report completion: SendMessage(type: "message", recipient: "team-lead", summary: "Performance review done")
116
+ 3. Read `.memory/knowledge/pitfalls.md` if it exists. Check for known pitfall patterns in the diff.
117
+ 4. Get the diff: `git diff {base_branch}...HEAD`
118
+ 5. Apply the 6-step review process from review-methodology
119
+ 6. Focus: N+1 queries, memory leaks, algorithm issues, I/O bottlenecks
120
+ 7. Classify each finding: 🔴 BLOCKING / ⚠️ SHOULD-FIX / ℹ️ PRE-EXISTING
121
+ 8. Include file:line references for every finding
122
+ 9. Write your report: `Write to .docs/reviews/{branch_slug}/performance.md`
123
+ 10. Report completion: SendMessage(type: "message", recipient: "team-lead", summary: "Performance review done")
121
124
 
122
125
  - Name: "quality-reviewer"
123
126
  Prompt: |
@@ -128,13 +131,14 @@ Spawn review teammates with self-contained prompts:
128
131
  - `Read ~/.claude/skills/test-patterns/SKILL.md`
129
132
  - `Read ~/.claude/skills/regression-patterns/SKILL.md`
130
133
  2. Read review methodology: `Read ~/.claude/skills/review-methodology/SKILL.md`
131
- 3. Get the diff: `git diff {base_branch}...HEAD`
132
- 4. Apply the 6-step review process from review-methodology
133
- 5. Focus: complexity, test gaps, pattern violations, regressions, naming
134
- 6. Classify each finding: 🔴 BLOCKING / ⚠️ SHOULD-FIX / ℹ️ PRE-EXISTING
135
- 7. Include file:line references for every finding
136
- 8. Write your report: `Write to .docs/reviews/{branch_slug}/quality.md`
137
- 9. Report completion: SendMessage(type: "message", recipient: "team-lead", summary: "Quality review done")
134
+ 3. Read `.memory/knowledge/pitfalls.md` if it exists. Check for known pitfall patterns in the diff.
135
+ 4. Get the diff: `git diff {base_branch}...HEAD`
136
+ 5. Apply the 6-step review process from review-methodology
137
+ 6. Focus: complexity, test gaps, pattern violations, regressions, naming
138
+ 7. Classify each finding: 🔴 BLOCKING / ⚠️ SHOULD-FIX / ℹ️ PRE-EXISTING
139
+ 8. Include file:line references for every finding
140
+ 9. Write your report: `Write to .docs/reviews/{branch_slug}/quality.md`
141
+ 10. Report completion: SendMessage(type: "message", recipient: "team-lead", summary: "Quality review done")
138
142
 
139
143
  [Add conditional perspectives based on Phase 1 — follow same pattern:
140
144
  explicit skill path, diff command, output path, SendMessage for completion]
@@ -212,7 +216,14 @@ Include confidence levels from debate consensus."
212
216
  {Key exchanges that changed findings}
213
217
  ```
214
218
 
215
- ### Phase 5: Cleanup and Report
219
+ ### Phase 5: Record Pitfalls (if blocking issues found)
220
+
221
+ If the review summary contains CRITICAL or HIGH blocking issues:
222
+ 1. Read `~/.claude/skills/knowledge-persistence/SKILL.md` and follow its extraction procedure to record pitfalls to `.memory/knowledge/pitfalls.md`
223
+ 2. Source field: `/code-review {branch}`
224
+ 3. Skip entirely if no CRITICAL/HIGH blocking issues
225
+
226
+ ### Phase 6: Cleanup and Report
216
227
 
217
228
  Shut down all review teammates explicitly:
218
229
 
@@ -257,7 +268,9 @@ Display results:
257
268
  │ ├─ Git agent (comment-pr with consensus findings)
258
269
  │ └─ Lead writes review-summary with confidence levels
259
270
 
260
- └─ Phase 5: Cleanup and display results
271
+ ├─ Phase 5: Record Pitfalls (inline, if blocking issues)
272
+
273
+ └─ Phase 6: Cleanup and display results
261
274
  ```
262
275
 
263
276
  ## Principles
@@ -95,7 +95,10 @@ IMPORTANT: Write report to .docs/reviews/{branch-slug}/{focus}.md using Write to
95
95
  Task(subagent_type="Git", run_in_background=false):
96
96
  "OPERATION: comment-pr
97
97
  Read reviews from .docs/reviews/{branch-slug}/
98
- Create inline PR comments, deduplicate, consolidate skipped into summary"
98
+ <!-- Confidence threshold also in: shared/agents/reviewer.md, shared/agents/synthesizer.md -->
99
+ Create inline PR comments for findings with ≥80% confidence only.
100
+ Lower-confidence suggestions (60-79%) go in the summary comment, not as inline comments.
101
+ Deduplicate findings across reviewers, consolidate skipped into summary."
99
102
  ```
100
103
 
101
104
  **Synthesizer Agent**:
@@ -114,6 +117,13 @@ Display results from all agents:
114
117
  - PR comments created/skipped (from Git)
115
118
  - Artifact paths
116
119
 
120
+ ### Phase 5: Record Pitfalls (if blocking issues found)
121
+
122
+ If the review summary contains CRITICAL or HIGH blocking issues:
123
+ 1. Read `~/.claude/skills/knowledge-persistence/SKILL.md` and follow its extraction procedure to record pitfalls to `.memory/knowledge/pitfalls.md`
124
+ 2. Source field: `/code-review {branch}`
125
+ 3. Skip entirely if no CRITICAL/HIGH blocking issues
126
+
117
127
  ## Architecture
118
128
 
119
129
  ```
@@ -139,7 +149,9 @@ Display results from all agents:
139
149
  │ ├─ Git agent (comment-pr)
140
150
  │ └─ Synthesizer agent (mode: review)
141
151
 
142
- └─ Phase 4: Display results
152
+ ├─ Phase 4: Display results
153
+
154
+ └─ Phase 5: Record Pitfalls (inline, if blocking issues)
143
155
  ```
144
156
 
145
157
  ## Principles
@@ -0,0 +1,128 @@
1
+ ---
2
+ name: knowledge-persistence
3
+ description: >-
4
+ This skill should be used when recording architectural decisions or pitfalls
5
+ to project knowledge files, or when loading prior decisions and known pitfalls
6
+ for context during investigation, specification, or review.
7
+ user-invocable: false
8
+ allowed-tools: Read, Write, Bash
9
+ ---
10
+
11
+ # Knowledge Persistence
12
+
13
+ Record architectural decisions and pitfalls to `.memory/knowledge/` files. This is the single source of truth for the extraction procedure — commands reference this skill instead of inlining the steps.
14
+
15
+ ## Iron Law
16
+
17
+ > **SINGLE SOURCE OF TRUTH**
18
+ >
19
+ > All knowledge extraction follows this procedure exactly. Commands never inline
20
+ > their own extraction steps — they read this skill and follow it.
21
+
22
+ ---
23
+
24
+ ## File Locations
25
+
26
+ ```
27
+ .memory/knowledge/
28
+ ├── decisions.md # ADR entries (append-only)
29
+ └── pitfalls.md # PF entries (area-specific gotchas)
30
+ ```
31
+
32
+ ## File Formats
33
+
34
+ ### decisions.md (ADR entries)
35
+
36
+ **Template header** (create if file missing):
37
+ ```
38
+ <!-- TL;DR: 0 decisions. Key: -->
39
+ # Architectural Decisions
40
+
41
+ Append-only. Status changes allowed; deletions prohibited.
42
+ ```
43
+
44
+ **Entry format**:
45
+ ```markdown
46
+ ## ADR-{NNN}: {Title}
47
+
48
+ - **Date**: {YYYY-MM-DD}
49
+ - **Status**: Accepted
50
+ - **Context**: {Why this decision was needed}
51
+ - **Decision**: {What was decided}
52
+ - **Consequences**: {Tradeoffs and implications}
53
+ - **Source**: {command and identifier, e.g. `/implement TASK-123`}
54
+ ```
55
+
56
+ ### pitfalls.md (PF entries)
57
+
58
+ **Template header** (create if file missing):
59
+ ```
60
+ <!-- TL;DR: 0 pitfalls. Key: -->
61
+ # Known Pitfalls
62
+
63
+ Area-specific gotchas, fragile areas, and past bugs.
64
+ ```
65
+
66
+ **Entry format**:
67
+ ```markdown
68
+ ## PF-{NNN}: {Short description}
69
+
70
+ - **Area**: {file paths or module names}
71
+ - **Issue**: {What goes wrong}
72
+ - **Impact**: {Consequences if hit}
73
+ - **Resolution**: {How to fix or avoid}
74
+ - **Source**: {command and identifier, e.g. `/code-review branch-name`}
75
+ ```
76
+
77
+ ---
78
+
79
+ ## Extraction Procedure
80
+
81
+ Follow these steps when recording decisions or pitfalls:
82
+
83
+ 1. **Read** the target file (`.memory/knowledge/decisions.md` or `.memory/knowledge/pitfalls.md`). If it doesn't exist, create it with the template header above.
84
+ 2. **Check capacity** — count `## ADR-` or `## PF-` headings. If >=50, log "Knowledge base at capacity — skipping new entry" and stop.
85
+ 3. **Find next ID** — find highest NNN via regex (`/^## ADR-(\d+)/` or `/^## PF-(\d+)/`), default to 0. Increment by 1.
86
+ 4. **Deduplicate** (pitfalls only) — skip if an entry with the same Area + Issue already exists.
87
+ 5. **Append** the new entry using the format above.
88
+ 6. **Update TL;DR** — rewrite the `<!-- TL;DR: ... -->` comment on line 1 to reflect the new count and key topics.
89
+
90
+ ## Lock Protocol
91
+
92
+ When writing, use a mkdir-based lock:
93
+ - Lock path: `.memory/.knowledge.lock`
94
+ - Timeout: 30 seconds (fail if lock not acquired)
95
+ - Stale recovery: if lock directory is >60 seconds old, remove it and retry
96
+ - Release lock after write completes (remove lock directory)
97
+
98
+ ## Loading Knowledge for Context
99
+
100
+ When a command needs prior knowledge as input (not recording):
101
+
102
+ 1. Read `.memory/knowledge/decisions.md` if it exists
103
+ 2. Read `.memory/knowledge/pitfalls.md` if it exists
104
+ 3. Pass content as context to downstream agents — prior decisions constrain scope, known pitfalls inform investigation
105
+
106
+ If neither file exists, skip silently. No error, no empty-file creation.
107
+
108
+ ## Operation Budget
109
+
110
+ Recording: do inline (no agent spawn), 2-3 Read/Write operations total.
111
+ Loading: 1-2 Read operations, pass as context string.
112
+
113
+ ---
114
+
115
+ ## Extended References
116
+
117
+ For entry examples and status lifecycle details:
118
+ - `references/examples.md` - Full decision and pitfall entry examples
119
+
120
+ ---
121
+
122
+ ## Success Criteria
123
+
124
+ - [ ] Entry appended with correct sequential ID
125
+ - [ ] No duplicate pitfalls (same Area + Issue)
126
+ - [ ] TL;DR comment updated with current count
127
+ - [ ] Lock acquired before write, released after
128
+ - [ ] Capacity limit (50) respected
@@ -0,0 +1,44 @@
1
+ # Knowledge Persistence Examples
2
+
3
+ ## Decision Entry Example
4
+
5
+ ```markdown
6
+ ## ADR-001: Use mkdir-based locks for concurrent session serialization
7
+
8
+ - **Date**: 2026-03-03
9
+ - **Status**: Accepted
10
+ - **Context**: Multiple Claude Code sessions can run on the same project simultaneously (different terminals, SSH, etc.). Memory writes must serialize to prevent corruption.
11
+ - **Decision**: Use `mkdir` as an atomic lock primitive. Lock directory at `.memory/.knowledge.lock`. 30-second timeout with 60-second stale recovery.
12
+ - **Consequences**: Simple, cross-platform, no external dependencies. Cannot detect holder PID if lock is stale — relies on age-based recovery. Sufficient for low-contention writes.
13
+ - **Source**: `/implement #99`
14
+ ```
15
+
16
+ ## Pitfall Entry Example
17
+
18
+ ```markdown
19
+ ## PF-001: Orphaned teams variants silently skipped
20
+
21
+ - **Area**: plugins/devflow-*/commands/*-teams.md, src/cli/installer
22
+ - **Issue**: The installer iterates base `.md` files and looks up matching `-teams.md` variants. A `-teams.md` file without a corresponding base `.md` is silently ignored during installation.
23
+ - **Impact**: Teams variant appears committed but never installs. Users on `--teams` mode silently get no command.
24
+ - **Resolution**: Always create the base `.md` file first. CI should validate that every `-teams.md` has a matching base file.
25
+ - **Source**: `/code-review feat/agent-teams`
26
+ ```
27
+
28
+ ## Status Lifecycle (Decisions Only)
29
+
30
+ Decisions support status transitions:
31
+ - `Accepted` — current, in effect
32
+ - `Superseded by ADR-NNN` — replaced by a newer decision
33
+ - `Deprecated` — no longer relevant, kept for history
34
+
35
+ Pitfalls have no status field — they remain until manually removed.
36
+
37
+ ## Deduplication Logic (Pitfalls Only)
38
+
39
+ Before appending a new pitfall, check existing entries:
40
+ 1. Extract `Area` and `Issue` from the new entry
41
+ 2. Compare against all existing `PF-*` entries
42
+ 3. If both Area AND Issue match an existing entry (case-insensitive substring), skip
43
+
44
+ This prevents recording the same gotcha from multiple review cycles.