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,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.
@@ -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",
@@ -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",
@@ -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",
@@ -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",
@@ -21,8 +21,9 @@
21
21
  "simplifier"
22
22
  ],
23
23
  "skills": [
24
+ "agent-teams",
24
25
  "implementation-patterns",
25
- "security-patterns",
26
- "agent-teams"
26
+ "knowledge-persistence",
27
+ "security-patterns"
27
28
  ]
28
29
  }
@@ -1,6 +1,7 @@
1
1
  ---
2
2
  name: Simplifier
3
3
  description: Simplifies and refines code for clarity, consistency, and maintainability while preserving all functionality. Focuses on recently modified code unless instructed otherwise.
4
+ skills: core-patterns
4
5
  model: inherit
5
6
  ---
6
7
 
@@ -59,4 +60,34 @@ Your refinement process:
59
60
  5. Verify the refined code is simpler and more maintainable
60
61
  6. Document only significant changes that affect understanding
61
62
 
62
- You operate autonomously and proactively, refining code immediately after it's written or modified without requiring explicit requests. Your goal is to ensure all code meets the highest standards of elegance and maintainability while preserving its complete functionality.
63
+ You operate autonomously and proactively, refining code immediately after it's written or modified without requiring explicit requests. Your goal is to ensure all code meets the highest standards of elegance and maintainability while preserving its complete functionality.
64
+
65
+ ## Output
66
+
67
+ Return structured completion status:
68
+
69
+ ```markdown
70
+ ## Simplification Report
71
+
72
+ ### Changes Applied
73
+ - {file}: {description of simplification}
74
+
75
+ ### Changes Skipped
76
+ - {reason not simplified — would change behavior / already clean}
77
+
78
+ ### Files Modified
79
+ - {file} ({change description})
80
+ ```
81
+
82
+ ## Boundaries
83
+
84
+ **Escalate to orchestrator:**
85
+ - Changes that would alter observable behavior or break tests
86
+ - Simplifications requiring new dependencies or architectural changes
87
+ - Files outside the recently modified scope (unless instructed)
88
+
89
+ **Handle autonomously:**
90
+ - Naming improvements, dead code removal, nesting reduction
91
+ - Import sorting and organization
92
+ - Redundant abstraction elimination
93
+ - Comment cleanup (remove obvious, keep non-obvious)
@@ -150,7 +150,14 @@ Aggregate from all Resolvers:
150
150
  - **Deferred**: High-risk issues marked for tech debt
151
151
  - **Blocked**: Issues that couldn't be fixed
152
152
 
153
- ### Phase 6: Simplify
153
+ ### Phase 6: Record Pitfalls (from tech debt deferrals)
154
+
155
+ For each issue deferred as TECH_DEBT:
156
+ 1. Read `~/.claude/skills/knowledge-persistence/SKILL.md` and follow its extraction procedure to record pitfalls to `.memory/knowledge/pitfalls.md`
157
+ 2. Source field: `/resolve {branch}`
158
+ 3. Skip entirely if no TECH_DEBT deferrals
159
+
160
+ ### Phase 7: Simplify
154
161
 
155
162
  If any fixes were made, spawn Simplifier agent to refine the changed code:
156
163
 
@@ -161,7 +168,7 @@ FILES_CHANGED: {list of files modified by Resolvers}
161
168
  Simplify and refine the fixes for clarity and consistency"
162
169
  ```
163
170
 
164
- ### Phase 7: Manage Tech Debt
171
+ ### Phase 8: Manage Tech Debt
165
172
 
166
173
  If any issues were deferred, spawn Git agent:
167
174
 
@@ -173,7 +180,7 @@ TIMESTAMP: {timestamp}
173
180
  Note: Deferred issues from resolution are already in resolution-summary.{timestamp}.md"
174
181
  ```
175
182
 
176
- ### Phase 8: Report
183
+ ### Phase 9: Report
177
184
 
178
185
  **Write the resolution summary** to `.docs/reviews/{branch-slug}/resolution-summary.{timestamp}.md` using Write tool, then display:
179
186
 
@@ -228,13 +235,15 @@ Note: Deferred issues from resolution are already in resolution-summary.{timesta
228
235
  ├─ Phase 5: Collect results
229
236
  │ └─ Aggregate fixed, false positives, deferred, blocked
230
237
 
231
- ├─ Phase 6: Simplify
238
+ ├─ Phase 6: Record Pitfalls (inline, from tech debt deferrals)
239
+
240
+ ├─ Phase 7: Simplify
232
241
  │ └─ Simplifier agent (refine fixes)
233
242
 
234
- ├─ Phase 7: Git agent (manage-debt)
243
+ ├─ Phase 8: Git agent (manage-debt)
235
244
  │ └─ Add deferred items to Tech Debt Backlog
236
245
 
237
- └─ Phase 8: Display resolution summary
246
+ └─ Phase 9: Display resolution summary
238
247
  ```
239
248
 
240
249
  ## Edge Cases
@@ -258,7 +267,7 @@ Note: Deferred issues from resolution are already in resolution-summary.{timesta
258
267
 
259
268
  ## Output Artifact
260
269
 
261
- Written by orchestrator in Phase 8 to `.docs/reviews/{branch-slug}/resolution-summary.{timestamp}.md`:
270
+ Written by orchestrator in Phase 9 to `.docs/reviews/{branch-slug}/resolution-summary.{timestamp}.md`:
262
271
 
263
272
  ```markdown
264
273
  # Resolution Summary
@@ -90,7 +90,14 @@ Aggregate from all Resolvers:
90
90
  - **Deferred**: High-risk issues marked for tech debt
91
91
  - **Blocked**: Issues that couldn't be fixed
92
92
 
93
- ### Phase 6: Simplify
93
+ ### Phase 6: Record Pitfalls (from tech debt deferrals)
94
+
95
+ For each issue deferred as TECH_DEBT:
96
+ 1. Read `~/.claude/skills/knowledge-persistence/SKILL.md` and follow its extraction procedure to record pitfalls to `.memory/knowledge/pitfalls.md`
97
+ 2. Source field: `/resolve {branch}`
98
+ 3. Skip entirely if no TECH_DEBT deferrals
99
+
100
+ ### Phase 7: Simplify
94
101
 
95
102
  If any fixes were made, spawn Simplifier agent to refine the changed code:
96
103
 
@@ -101,7 +108,7 @@ FILES_CHANGED: {list of files modified by Resolvers}
101
108
  Simplify and refine the fixes for clarity and consistency"
102
109
  ```
103
110
 
104
- ### Phase 7: Manage Tech Debt
111
+ ### Phase 8: Manage Tech Debt
105
112
 
106
113
  If any issues were deferred, spawn Git agent:
107
114
 
@@ -113,7 +120,7 @@ TIMESTAMP: {timestamp}
113
120
  Note: Deferred issues from resolution are already in resolution-summary.{timestamp}.md"
114
121
  ```
115
122
 
116
- ### Phase 8: Report
123
+ ### Phase 9: Report
117
124
 
118
125
  **Write the resolution summary** to `.docs/reviews/{branch-slug}/resolution-summary.{timestamp}.md` using Write tool, then display:
119
126
 
@@ -167,13 +174,15 @@ Note: Deferred issues from resolution are already in resolution-summary.{timesta
167
174
  ├─ Phase 5: Collect results
168
175
  │ └─ Aggregate fixed, false positives, deferred, blocked
169
176
 
170
- ├─ Phase 6: Simplify
177
+ ├─ Phase 6: Record Pitfalls (inline, from tech debt deferrals)
178
+
179
+ ├─ Phase 7: Simplify
171
180
  │ └─ Simplifier agent (refine fixes)
172
181
 
173
- ├─ Phase 7: Git agent (manage-debt)
182
+ ├─ Phase 8: Git agent (manage-debt)
174
183
  │ └─ Add deferred items to Tech Debt Backlog
175
184
 
176
- └─ Phase 8: Display resolution summary
185
+ └─ Phase 9: Display resolution summary
177
186
  ```
178
187
 
179
188
  ## Edge Cases
@@ -197,7 +206,7 @@ Note: Deferred issues from resolution are already in resolution-summary.{timesta
197
206
 
198
207
  ## Output Artifact
199
208
 
200
- Written by orchestrator in Phase 8 to `.docs/reviews/{branch-slug}/resolution-summary.{timestamp}.md`:
209
+ Written by orchestrator in Phase 9 to `.docs/reviews/{branch-slug}/resolution-summary.{timestamp}.md`:
201
210
 
202
211
  ```markdown
203
212
  # Resolution Summary
@@ -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.
@@ -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",
@@ -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
+ "self-review",
13
+ "simplifier",
14
+ "scrutinizer",
15
+ "quality"
16
+ ],
8
17
  "agents": [
9
18
  "simplifier",
10
19
  "scrutinizer",
@@ -1,6 +1,7 @@
1
1
  ---
2
2
  name: Simplifier
3
3
  description: Simplifies and refines code for clarity, consistency, and maintainability while preserving all functionality. Focuses on recently modified code unless instructed otherwise.
4
+ skills: core-patterns
4
5
  model: inherit
5
6
  ---
6
7
 
@@ -59,4 +60,34 @@ Your refinement process:
59
60
  5. Verify the refined code is simpler and more maintainable
60
61
  6. Document only significant changes that affect understanding
61
62
 
62
- You operate autonomously and proactively, refining code immediately after it's written or modified without requiring explicit requests. Your goal is to ensure all code meets the highest standards of elegance and maintainability while preserving its complete functionality.
63
+ You operate autonomously and proactively, refining code immediately after it's written or modified without requiring explicit requests. Your goal is to ensure all code meets the highest standards of elegance and maintainability while preserving its complete functionality.
64
+
65
+ ## Output
66
+
67
+ Return structured completion status:
68
+
69
+ ```markdown
70
+ ## Simplification Report
71
+
72
+ ### Changes Applied
73
+ - {file}: {description of simplification}
74
+
75
+ ### Changes Skipped
76
+ - {reason not simplified — would change behavior / already clean}
77
+
78
+ ### Files Modified
79
+ - {file} ({change description})
80
+ ```
81
+
82
+ ## Boundaries
83
+
84
+ **Escalate to orchestrator:**
85
+ - Changes that would alter observable behavior or break tests
86
+ - Simplifications requiring new dependencies or architectural changes
87
+ - Files outside the recently modified scope (unless instructed)
88
+
89
+ **Handle autonomously:**
90
+ - Naming improvements, dead code removal, nesting reduction
91
+ - Import sorting and organization
92
+ - Redundant abstraction elimination
93
+ - Comment cleanup (remove obvious, keep non-obvious)
@@ -21,8 +21,9 @@ Detect changed files and build context:
21
21
  2. Else run `git diff --name-only HEAD` + `git diff --name-only --cached` to get staged + unstaged
22
22
  3. If no changes found, report "No changes to review" and exit
23
23
  4. Build TASK_DESCRIPTION from recent commit messages or branch name
24
+ 5. Read `.memory/knowledge/pitfalls.md` and `.memory/knowledge/decisions.md`. Pass as KNOWLEDGE_CONTEXT to Simplifier and Scrutinizer — known pitfalls help identify reintroduced issues, prior decisions help validate architectural consistency.
24
25
 
25
- **Extract:** FILES_CHANGED (list), TASK_DESCRIPTION (string)
26
+ **Extract:** FILES_CHANGED (list), TASK_DESCRIPTION (string), KNOWLEDGE_CONTEXT (string, optional)
26
27
 
27
28
  ### Phase 1: Simplifier (Code Refinement)
28
29
 
@@ -31,7 +32,9 @@ Spawn Simplifier agent to refine code for clarity and consistency:
31
32
  Task(subagent_type="Simplifier", run_in_background=false):
32
33
  "TASK_DESCRIPTION: {task_description}
33
34
  FILES_CHANGED: {files_changed}
34
- Simplify and refine the code for clarity and consistency while preserving functionality"
35
+ KNOWLEDGE_CONTEXT: {knowledge_context or 'None'}
36
+ Simplify and refine the code for clarity and consistency while preserving functionality.
37
+ If knowledge context is provided, verify no known pitfall patterns are being reintroduced."
35
38
 
36
39
  **Wait for completion.** Simplifier commits changes directly.
37
40
 
@@ -42,7 +45,9 @@ Spawn Scrutinizer agent for quality evaluation and fixing:
42
45
  Task(subagent_type="Scrutinizer", run_in_background=false):
43
46
  "TASK_DESCRIPTION: {task_description}
44
47
  FILES_CHANGED: {files_changed}
45
- Evaluate against 9-pillar framework. Fix P0/P1 issues. Return structured report."
48
+ KNOWLEDGE_CONTEXT: {knowledge_context or 'None'}
49
+ Evaluate against 9-pillar framework. Fix P0/P1 issues. Return structured report.
50
+ If knowledge context is provided, check whether any known pitfall patterns are being reintroduced and verify architectural consistency with prior decisions."
46
51
 
47
52
  **Wait for completion.** Extract: STATUS (PASS|FIXED|BLOCKED), changes_made (bool)
48
53
 
@@ -93,7 +98,8 @@ Display summary:
93
98
  /self-review (orchestrator)
94
99
 
95
100
  ├─ Phase 0: Context gathering
96
- └─ Git diff for changed files
101
+ ├─ Git diff for changed files
102
+ │ └─ Read project knowledge (decisions.md + pitfalls.md)
97
103
 
98
104
  ├─ Phase 1: Simplifier
99
105
  │ └─ Code refinement (commits directly)