feat: Wave 2 — project knowledge system (decisions + pitfalls)#140
feat: Wave 2 — project knowledge system (decisions + pitfalls)#140
Conversation
Add structured knowledge extraction and injection so agents learn from past architectural decisions and known pitfalls across sessions. - Create `.memory/knowledge/decisions.md` (ADR-NNN) and `pitfalls.md` (PF-NNN) - Inject TL;DR headers at session start (~30-50 tokens) - Coder reads decisions before implementation, Reviewer checks pitfalls - /implement records ADRs, /code-review + /debug + /resolve record pitfalls - Both base and Teams command variants updated - createMemoryDir() now creates knowledge/ subdirectory - 8 new tests (246 total), all passing
| module structure, and architectural conventions relevant to this task. | ||
| 4. Document findings with file:path references. | ||
| 5. Document findings with file:path references. | ||
| 5. Report completion: SendMessage(type: "message", recipient: "team-lead", |
There was a problem hiding this comment.
Duplicate step numbering: Step 5 appears twice consecutively. The "Report completion: SendMessage" step should be numbered 6, not 5, since step 2 was inserted above it.
Suggested fix:
5. Document findings with file:path references.
6. Report completion: SendMessage(type: "message", recipient: "team-lead",This issue affects all four explorer prompts (architecture, integration, reusable-code, edge-case). Use consistent sequential numbering (2-6) after inserting the new knowledge-reading step.
shared/agents/reviewer.md
Outdated
| 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. | ||
|
|
||
| 1.5. **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. | ||
|
|
There was a problem hiding this comment.
Non-standard step numbering: Using "1.5" breaks sequential integer numbering used throughout the codebase. Agents may interpret this as a sub-step rather than a full responsibility.
Suggested fix: Renumber to use sequential integers (1, 2, 3, ..., 11) since you're inserting a new responsibility between steps 1 and 2. All subsequent steps would be incremented accordingly.
Alternative: If fractional numbering is intentional for non-breaking additions, document this convention in CLAUDE.md.
| You are reviewing PR #{pr_number} on branch {branch} (base: {base_branch}). | ||
| 1. Read your skill: `Read ~/.claude/skills/security-patterns/SKILL.md` | ||
| 2. Read review methodology: `Read ~/.claude/skills/review-methodology/SKILL.md` | ||
| 2.5. Read `.memory/knowledge/pitfalls.md` if it exists. Check for known pitfall patterns in the diff. |
There was a problem hiding this comment.
Non-standard step numbering: Step "2.5" is inserted between sequential steps, breaking the standard integer pattern. Agents may not recognize this as a full sequential step in the review process.
Suggested fix: Renumber all steps sequentially (2 → 3, old 3 → 4, etc.) so the pitfall-reading step is step 3 and subsequent steps follow consecutively. Apply this consistently across all four reviewer teammate prompts in this file.
Code Review SummaryInline Comments Created (High Confidence ≥80%)I've created targeted inline comments for critical findings:
Additional High-Confidence Findings (Consolidated)Architectural Issues (88-85% confidence):
Lock Specification Inconsistency (82-85% confidence):
Test Coverage Gaps (80% confidence):
Missing Integration (80% confidence):
Performance (Low impact, 80% confidence):
Documentation (80% confidence):
Verification Checklist
AssessmentBlocking Issues: 3 (step numbering issues and lock inconsistencies) Recommendation: CHANGES_REQUESTED Created by Claude Code — Analysis based on 9 review reports (Architecture, Performance, Tests, Regression, Documentation, TypeScript, Security, Complexity, Consistency) |
Batch 1 — Mechanical fixes: - Fix duplicate step 5→6 in 4 explorer prompts (implement-teams.md) - Fix fractional 2.5→3 renumbering in 4 reviewer prompts (code-review-teams.md) - Fix fractional 1.5→2 renumbering in reviewer.md responsibilities - Update stale counts: 24→31 skills, 8→17 plugins (file-organization.md) - Add missing ambient-prompt.sh to hooks listing (file-organization.md) Batch 2 — DRY extraction via knowledge-persistence skill: - Create shared/skills/knowledge-persistence/SKILL.md with canonical procedure (ADR/PF formats, lock protocol, capacity cap, dedup, TL;DR update) - Replace 8 inline extraction procedures with skill references in implement, code-review, debug, resolve (base + teams variants) - Register skill in 4 plugin manifests (plugin.json + plugins.ts) Batch 3 — Hook improvements: - Collapse head+sed+grep into single sed -n for TL;DR extraction - Guard section joins to prevent leading newlines when Section 1 skipped Batch 4 — Quick fixes: - Add TL;DR-only rationale comment to skimmer.md step 6 - Log createMemoryDir errors in verbose mode instead of silent catch - Add 3 hook integration tests (TL;DR injection, no leading newlines, no knowledge section when files absent) Issues dismissed: #9 (TL;DR sanitization — trust model), #10 (integrity verification — instruction-enforced), #17 (mkdir failure test — low value), #18 (phase ordering cosmetic), #19 (intentional scope exclusion)
Code Review Resolution StatusCommit Fixed (14 issues)
Deferred (3 issues)
Dismissed (2 issues)
Verification
|
…eMemoryDir failure test - /specify: Add Phase 2.5 to read decisions.md + pitfalls.md before exploration. Constraints and Failure Modes explorers now receive prior decisions and known pitfalls as context. - /self-review: Phase 0 reads knowledge files. Simplifier and Scrutinizer receive KNOWLEDGE_CONTEXT to check for reintroduced pitfall patterns and verify architectural consistency. - Add createMemoryDir failure test (file blocking mkdir path). Resolves review issues #17 and #19 from PR #140.
Follow-up: Additional Resolutions (b52b8b1)After discussing the deferred/dismissed issues:
Confirmed deferred (after discussion):
Confirmed non-issue:
Tests: 250/250 pass ✅ |
The base specify.md got Phase 2.5 (knowledge read) but the teams variant was missed. Both now read decisions.md + pitfalls.md before exploration.
…mmands Eliminates all Phase X.5 numbering introduced by the knowledge-recording phases, replacing with sequential integers and shifting subsequent phases. Files: specify, implement, code-review, debug, resolve (base + teams variants)
…istency (#145) ## Summary Post-merge cleanup for the Wave 2 project knowledge system (#99). Addresses consistency audit findings from #142 and code review findings from #140. - Add `knowledge-persistence` skill with full extraction procedure, lock protocol, loading instructions, and examples - Add knowledge awareness (Load Project Knowledge phase) to `/debug`, `/specify`, `/self-review` commands - Add pitfall recording phase to `/code-review` and `/resolve` commands - Renumber fractional phases (1.5, 2.5) to sequential integers across all 12 command files - Fix CLAUDE.md stale skill count (31→32), add skill to architecture reference - Remove conditional "(if available)" phrasing from knowledge loading phases - Add `createMemoryDir` failure test for missing directory edge case - Resolve 14 code review findings from PR #140 ## Files Changed (28 files, +814/-227) **New files (2):** `knowledge-persistence/SKILL.md`, `knowledge-persistence/references/examples.md` **Commands (12):** All 6 command pairs updated with knowledge phases + sequential numbering **Agents (3):** coder, reviewer, skimmer — knowledge context references **Plugins (4):** plugin.json manifest updates for knowledge-persistence skill **Tests (1):** +230 lines of memory/migration tests **Docs (4):** CLAUDE.md, skills-architecture, file-organization, docs-framework ## Test plan - [x] `npm run build` passes (32 skills, 17 plugins) - [x] `npm test` passes (250 tests, 13 test files) - [x] Grep confirms zero "(if available)" in knowledge-related contexts - [ ] Manual: verify `/debug` loads pitfalls.md before hypothesis generation - [ ] Manual: verify `/specify` passes knowledge context to explore agents --------- Co-authored-by: Dean Sharon <deanshrn@gmain.com>
Summary
Closes #99. Implements the Project Knowledge system — structured extraction of architectural decisions (ADR-NNN) and known pitfalls (PF-NNN) from command flows, with lightweight injection at session start.
.memory/knowledge/:decisions.md(append-only ADRs) andpitfalls.md(area-specific gotchas)head -1), graceful degradation if files missing/implement→ Phase 11.5 records ADRs;/code-review→ Phase 4.5,/debug→ Phase 4.5/7.5,/resolve→ Phase 5.5 record pitfallscreateMemoryDir()now createsknowledge/subdirectoryKey design choices
Test plan
npm run buildpasses (31 skills, 17 plugins)npm test— 246/246 tests pass/implementwith architectural decisions, verify ADR appended/code-reviewon branch with issues, verify PF appended