liteagents 2.4.6 → 2.5.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 (39) hide show
  1. package/CHANGELOG.md +10 -33
  2. package/README.md +33 -15
  3. package/docs/LONG_TERM_MEMORY.md +449 -0
  4. package/installer/cli.js +10 -10
  5. package/package.json +2 -2
  6. package/packages/ampcode/AGENT.md +3 -1
  7. package/packages/ampcode/agents/context-builder.md +14 -12
  8. package/packages/ampcode/commands/docs-builder/templates.md +29 -0
  9. package/packages/ampcode/commands/docs-builder.md +261 -58
  10. package/packages/ampcode/commands/friction/friction.js +2168 -0
  11. package/packages/ampcode/commands/friction.md +139 -0
  12. package/packages/ampcode/commands/remember.md +110 -0
  13. package/packages/claude/CLAUDE.md +3 -1
  14. package/packages/claude/agents/context-builder.md +7 -4
  15. package/packages/claude/commands/friction/friction.js +2168 -0
  16. package/packages/claude/commands/friction.md +139 -0
  17. package/packages/claude/commands/remember.md +110 -0
  18. package/packages/claude/skills/docs-builder/SKILL.md +261 -58
  19. package/packages/claude/skills/docs-builder/references/templates.md +29 -0
  20. package/packages/droid/AGENTS.md +3 -1
  21. package/packages/droid/commands/docs-builder/templates.md +29 -0
  22. package/packages/droid/commands/docs-builder.md +261 -58
  23. package/packages/droid/commands/friction/friction.js +2168 -0
  24. package/packages/droid/commands/friction.md +139 -0
  25. package/packages/droid/commands/remember.md +110 -0
  26. package/packages/droid/droids/context-builder.md +15 -13
  27. package/packages/opencode/AGENTS.md +3 -1
  28. package/packages/opencode/agent/context-builder.md +14 -12
  29. package/packages/opencode/command/docs-builder/templates.md +29 -0
  30. package/packages/opencode/command/docs-builder.md +261 -58
  31. package/packages/opencode/command/friction/friction.js +2168 -0
  32. package/packages/opencode/command/friction.md +139 -0
  33. package/packages/opencode/command/remember.md +110 -0
  34. package/packages/opencode/opencode.jsonc +8 -0
  35. package/packages/subagentic-manual.md +33 -15
  36. package/packages/ampcode/README.md +0 -17
  37. package/packages/claude/README.md +0 -23
  38. package/packages/droid/README.md +0 -17
  39. package/packages/opencode/README.md +0 -17
@@ -0,0 +1,139 @@
1
+ ---
2
+ name: friction
3
+ description: Analyze session behavior patterns
4
+ usage: /friction <sessions-path>
5
+ argument-hint: <sessions-path>
6
+ ---
7
+
8
+ Analyze Claude Code session logs for friction signals, behavioral patterns, and failure antigens.
9
+
10
+ **Guardrails**
11
+ - Favor straightforward, minimal implementations first and add complexity only when requested or clearly required.
12
+ - Keep changes tightly scoped to the requested outcome.
13
+
14
+ **Argument: sessions-path (required)**
15
+
16
+ Path to the Claude Code sessions directory containing JSONL files.
17
+ - Example: `/friction ~/.claude/projects/-home-hamr-PycharmProjects-aurora/`
18
+ - If no argument provided, ask the user for the path. Do NOT guess.
19
+
20
+ **What it does**
21
+
22
+ Runs friction analysis on session JSONL files and writes results to `.claude/friction/` in the current project.
23
+
24
+ **Steps**
25
+
26
+ 1. **Validate path**
27
+ - The argument `$ARGUMENTS` is the sessions path
28
+ - Verify the path exists and contains `.jsonl` files
29
+ - If path doesn't exist or has no JSONL files, tell the user and stop
30
+ - Count total session files found
31
+
32
+ 2. **Run friction.js** (bundled at `commands/friction/friction.js`)
33
+ - Look for friction.js in order:
34
+ 1. `~/.claude/commands/friction/friction.js` (installed)
35
+ 2. `packages/claude/commands/friction/friction.js` (package development)
36
+ - If found, run: `node <path-to-friction.js> "$ARGUMENTS"`
37
+ - If it does NOT exist anywhere, fall back to running the analysis manually (step 3)
38
+ - If friction.js succeeds, skip to step 7
39
+
40
+ 3. **Manual analysis fallback** (only if friction.js not available)
41
+ - For each `.jsonl` session file in the path:
42
+ - Read the file
43
+ - Extract signals using these patterns:
44
+
45
+ | Signal | Weight | How to detect |
46
+ |---|---|---|
47
+ | `user_intervention` | 10 | User message contains `/stash` |
48
+ | `session_abandoned` | 10 | Last 3 turns have friction > 15 and no `exit_success` |
49
+ | `false_success` | 8 | LLM text contains "done"/"complete"/"fixed" AND next tool result has error |
50
+ | `no_resolution` | 8 | Session has `exit_error` signals but no `exit_success` after them |
51
+ | `tool_loop` | 6 | Same tool called 3+ times with identical arguments |
52
+ | `rapid_exit` | 6 | <3 turns AND ends with error |
53
+ | `interrupt_cascade` | 5 | Multiple `request_interrupted` within 60 seconds |
54
+ | `user_curse` | 5 | User message matches profanity patterns |
55
+ | `request_interrupted` | 2.5 | Turn has `is_interrupted: true` or ESC/Ctrl+C signal |
56
+ | `exit_error` | 1 | Tool result has non-zero exit code |
57
+ | `repeated_question` | 1 | User asks same question twice (fuzzy match) |
58
+ | `long_silence` | 0.5 | >10 minute gap between turns |
59
+ | `user_negation` | 0.5 | User message starts with "no", "wrong", "didn't work" |
60
+ | `compaction` | 0.5 | System message indicates context compaction |
61
+
62
+ 4. **Score each session**
63
+ - Accumulate weighted signal scores (no subtraction, only accumulation)
64
+ - Track peak friction score
65
+ - Classify session quality:
66
+ - **BAD**: has `user_intervention` or `session_abandoned`
67
+ - **FRICTION**: has `user_curse` or `false_success`
68
+ - **ROUGH**: peak friction >= 15, no intervention
69
+ - **OK**: low friction, completed normally
70
+ - **ONE-SHOT**: single turn, not interactive (filter out)
71
+
72
+ 5. **Aggregate stats**
73
+ - Count sessions by quality
74
+ - Calculate BAD rate
75
+ - Identify worst and best sessions
76
+ - Daily trend if sessions span multiple days
77
+
78
+ 6. **Extract antigen candidates from BAD sessions**
79
+ - For each BAD session, extract:
80
+ - Anchor signal (what triggered BAD classification)
81
+ - Tool sequence around the failure
82
+ - Error messages
83
+ - Pattern description
84
+ - Write as antigen candidates
85
+
86
+ 7. **Write output to `.claude/friction/`**
87
+ - Create `.claude/friction/` directory if it doesn't exist
88
+ - Write these files:
89
+ - `friction_analysis.json` — per-session breakdown (quality, peak, signals)
90
+ - `friction_summary.json` — aggregate stats, verdict, daily trend
91
+ - `friction_raw.jsonl` — all raw signals with timestamps
92
+ - `antigen_candidates.json` — raw extracted failure patterns
93
+ - `antigen_clusters.json` — clustered patterns (primary artifact for /remember)
94
+ - `antigen_review.md` — human-readable clustered review
95
+
96
+ 8. **Report to user**
97
+ - Sessions analyzed count
98
+ - BAD / FRICTION / ROUGH / OK counts
99
+ - BAD rate percentage
100
+ - Worst session ID and peak friction
101
+ - Path to `antigen_review.md` for review
102
+ - Remind: run `/remember` to consolidate into project memory
103
+
104
+ **Output format for antigen_review.md**
105
+
106
+ ```markdown
107
+ # Friction Antigen Clusters
108
+
109
+ Generated: [date]
110
+ BAD sessions: [count] | Raw candidates: [count] | Clusters: [count]
111
+
112
+ ## Cluster Summary
113
+
114
+ | # | Signal | Tool Pattern | Count | Sessions | Score | Median Peak |
115
+ |---|--------|-------------|-------|----------|-------|-------------|
116
+ | 1 | false_success | Bash,Bash | 35 | 23 | 280 | 73 |
117
+ | 2 | user_intervention | (none) | 34 | 24 | 340 | 65 |
118
+
119
+ ## Cluster 1: false_success | Bash,Bash
120
+
121
+ **Occurrences:** 35 across 23 sessions | **Score:** 280
122
+
123
+ ### User Context (what the user said)
124
+ > [actual user quote from session]
125
+
126
+ ### Errors
127
+ [error messages if any]
128
+
129
+ ### Files involved
130
+ - [file paths]
131
+ ```
132
+
133
+ **File locations**
134
+ - Design doc: `docs/02-features/memory/LONG_TERM_MEMORY.md`
135
+ - Input: JSONL session files from `$ARGUMENTS` path
136
+ - Output: `.claude/friction/` (project-local)
137
+ - JS script: `commands/friction/friction.js` (bundled alongside this command)
138
+ - Python equivalent: `scripts/friction.py` (aurora users, same logic)
139
+ - Manual fallback: built into this command if friction.js unavailable
@@ -0,0 +1,110 @@
1
+ ---
2
+ name: remember
3
+ description: Consolidate stashes + friction into project memory
4
+ usage: /remember
5
+ ---
6
+
7
+ Consolidate session stashes and friction analysis into a single project-local MEMORY.md, then inject into CLAUDE.md.
8
+
9
+ **Guardrails**
10
+ - Favor straightforward, minimal implementations first and add complexity only when requested or clearly required.
11
+ - Keep changes tightly scoped to the requested outcome.
12
+
13
+ **What it does**
14
+
15
+ Reads all raw material (`.claude/stash/*.md` + `.claude/friction/antigen_clusters.json`), extracts durable facts, episodes, and behavioral preferences into a single `.claude/memory/MEMORY.md`, then injects a managed memory section into `CLAUDE.md`.
16
+
17
+ **Steps**
18
+
19
+ 1. **Gather sources**
20
+ - Read all `.claude/stash/*.md` files in the current project
21
+ - Check for friction output at `.claude/friction/antigen_clusters.json` (preferred) or `.claude/friction/antigen_review.md` (fallback)
22
+ - Read existing `.claude/memory/MEMORY.md` if it exists — create dir if missing
23
+ - Read processed manifest at `.claude/memory/.processed` — skip already-processed stashes
24
+ - If no unprocessed stashes, report "nothing to consolidate" and stop
25
+
26
+ 2. **Extract from unprocessed stashes** (use Task tool with sonnet model for each)
27
+ - For each unprocessed stash, call sonnet to extract:
28
+ - **FACTS** (atomic, one-line): stable preferences, decisions, corrections, explicit "remember this"
29
+ - **EPISODE** (3-5 bullet narrative): what was the goal, what was tried, outcome, lesson
30
+ - **SKIP**: code details, file paths, errors, mechanical steps, LLM responses
31
+ - Collect all new facts and episodes
32
+
33
+ 3. **Merge into MEMORY.md**
34
+ - Read existing `.claude/memory/MEMORY.md` and parse its three sections (## Facts, ## Episodes, ## Preferences)
35
+ - **Facts section**: call sonnet with existing facts + newly extracted facts
36
+ - Rules: new updates replace old, contradictions keep new version, duplicates dropped
37
+ - Keep facts atomic, one line each
38
+ - **Episodes section**: append new episode entries (append-only, timestamped, no dedup)
39
+ - **Preferences section**: only update if friction output exists (step 4)
40
+ - Write merged result to `.claude/memory/MEMORY.md` in this format:
41
+
42
+ ```markdown
43
+ # Project Memory
44
+ > Auto-generated by /remember. Do not edit manually.
45
+
46
+ ## Facts
47
+ - [atomic fact 1]
48
+ - [atomic fact 2]
49
+
50
+ ## Episodes
51
+ ### YYYY-MM-DD - [title]
52
+ - [bullet narrative]
53
+
54
+ ### YYYY-MM-DD - [title]
55
+ - [bullet narrative]
56
+
57
+ ## Preferences
58
+ ### High Confidence
59
+ - [pattern] (evidence: [count] observations)
60
+
61
+ ### Medium Confidence
62
+ - [pattern] (evidence: [count] observations)
63
+
64
+ ### Low Confidence
65
+ - [pattern] (evidence: [count] observations)
66
+ ```
67
+
68
+ 4. **Distill friction into preferences** (only if friction output exists)
69
+ - Read `.claude/friction/antigen_clusters.json` — this contains clustered failure patterns with counts, user_context quotes, and tool sequences
70
+ - For the **top 10 clusters** (by score), extract the `contexts` field — these are the actual user messages that show behavioral patterns
71
+ - Call sonnet with:
72
+ - The top 10 clusters (signal, tool_pattern, count, sessions, contexts, errors)
73
+ - Existing Preferences section from MEMORY.md
74
+ - Extract BEHAVIORAL preferences (patterns demonstrated, not stated) — the user_context quotes are the primary evidence
75
+ - Confidence tiers:
76
+ - **High Confidence**: 5+ observations — available via @MEMORY.md
77
+ - **Medium Confidence**: 3+ observations — observing, not loaded
78
+ - **Low Confidence**: <3 observations — needs more data
79
+ - Promote/demote based on new evidence
80
+ - Update the Preferences section in MEMORY.md
81
+
82
+ 5. **Inject memory reference into CLAUDE.md**
83
+ - Compose the section between `<!-- MEMORY:START -->` and `<!-- MEMORY:END -->` markers:
84
+ ```
85
+ <!-- MEMORY:START -->
86
+ @MEMORY.md
87
+ <!-- MEMORY:END -->
88
+ ```
89
+ - The `@MEMORY.md` reference points to `.claude/memory/MEMORY.md` — Claude loads the full file directly, so no inline duplication is needed
90
+ - If CLAUDE.md already has MEMORY markers, replace the section between them
91
+ - If CLAUDE.md has no MEMORY markers, append the section at the end
92
+ - If no CLAUDE.md exists, create one with just the memory section
93
+
94
+ 6. **Update processed manifest**
95
+ - Append paths of newly processed stashes to `.claude/memory/.processed`
96
+
97
+ 7. **Report to user**
98
+ - Number of stashes processed
99
+ - Facts count (total, new)
100
+ - Episodes count (total, new)
101
+ - Preferences count by confidence tier
102
+ - Confirm MEMORY.md and CLAUDE.md updated
103
+
104
+ **File locations (all project-local)**
105
+ - Memory file: `.claude/memory/MEMORY.md` (single source of truth, referenced as @MEMORY.md)
106
+ - Stash files: `.claude/stash/*.md`
107
+ - Friction output: `.claude/friction/antigen_clusters.json` (clustered patterns with user contexts)
108
+ - Friction fallback: `.claude/friction/antigen_review.md` (human-readable clusters)
109
+ - Processed manifest: `.claude/memory/.processed`
110
+ - Output: `CLAUDE.md` (managed MEMORY section with @MEMORY.md reference)
@@ -1,13 +1,13 @@
1
1
  ---
2
2
  name: docs-builder
3
- description: Create comprehensive project documentation with structured /docs hierarchy
3
+ description: Create or reorganize project documentation with structured /docs hierarchy
4
4
  usage: /docs-builder
5
5
  auto_trigger: false
6
6
  ---
7
7
 
8
8
  # Documentation Architecture Skill
9
9
 
10
- Create systematic /docs structure following this 5-tier hierarchy:
10
+ Create or reorganize `/docs` following a 5-tier hierarchy:
11
11
 
12
12
  ```
13
13
  /docs
@@ -16,91 +16,294 @@ Create systematic /docs structure following this 5-tier hierarchy:
16
16
  ├── 02-features/ # HOW features are designed & built
17
17
  ├── 03-logs/ # MEMORY (what changed over time)
18
18
  ├── 04-process/ # HOW to work with this system
19
+ ├── archive/ # Old/unclear docs preserved here
19
20
  └── README.md # Navigation guide
20
21
  ```
21
22
 
22
- ## Workflow
23
+ ---
24
+
25
+ ## Step 1: Detect Mode
26
+
27
+ Check if `/docs` exists and has content:
28
+
29
+ ```bash
30
+ find docs -name "*.md" 2>/dev/null | wc -l
31
+ ```
32
+
33
+ - **0 files** → **Fresh Mode** (skip to Step 3)
34
+ - **1+ files** → **Existing Mode** (continue to Step 2)
35
+
36
+ ---
37
+
38
+ ## Step 2: Existing Mode - Analyze First
39
+
40
+ ### 2.1 Inventory
41
+
42
+ List all markdown files:
43
+ ```bash
44
+ find docs -name "*.md" -exec wc -l {} \; | sort -n
45
+ ```
46
+
47
+ ### 2.2 Read and Categorize
48
+
49
+ **For each file**, read first 50-100 lines and categorize:
50
+
51
+ | Category | Criteria | Action |
52
+ |----------|----------|--------|
53
+ | **KEEP** | Evergreen guides, references, architecture, troubleshooting | Move to appropriate tier |
54
+ | **CONSOLIDATE** | Duplicate/overlapping content | Merge into one, originals to archive |
55
+ | **ARCHIVE** | Work logs, status reports, old phase docs, unclear purpose | Move to `/docs/archive/` |
56
+
57
+ ### 2.3 Categorization Heuristics
58
+
59
+ **Likely KEEP/MOVE:**
60
+ - Filename contains: GUIDE, REFERENCE, HOWTO, ARCHITECTURE, COMMANDS, TROUBLESHOOTING, QUICKSTART
61
+ - Content: Has TOC, structured sections, explains "how to" or "what is"
62
+ - Purpose: Teaches something reusable
63
+
64
+ **Likely ARCHIVE:**
65
+ - Filename contains: REPORT, STATUS, SUMMARY, FIX_, PHASE_, SPRINT_, _LOG, DRAFT, WIP, OLD, TEMP
66
+ - Filename has dates: 2024-01-15-meeting.md
67
+ - Located in: archive/, old/, reports/, fixes/, phases/
68
+ - Content: Dated entries, task IDs, one-time status updates
69
+ - Under ~20 lines and looks like placeholder
70
+
71
+ **When uncertain → ARCHIVE** (can always recover later)
72
+
73
+ ### 2.4 Present Plan to User
23
74
 
24
- ### 1. Discover Project
25
- - Scan: README, existing /docs, package.json/pyproject.toml, src/, tests/
26
- - Map existing docs: commands/ → where? development/ → where?
27
- - Ask: "What's built? What's planned? What's missing?"
75
+ Before making changes, show categorization:
76
+
77
+ ```
78
+ KEEP Move to new structure (X files):
79
+ - guides/COMMANDS.md → 02-features/cli/COMMANDS.md
80
+ - reference/CONFIG.md → 04-process/reference/CONFIG.md
81
+ ...
82
+
83
+ CONSOLIDATE (X groups):
84
+ - architecture.md + ARCHITECTURE.md → 00-context/system-state.md
85
+ ...
86
+
87
+ ARCHIVE (X files):
88
+ - PHASE1_STATUS.md
89
+ - FIX_SUMMARY_2024.md
90
+ - reports/old-metrics.md
91
+ ...
92
+ ```
93
+
94
+ **Wait for user approval before proceeding.**
95
+
96
+ ### 2.5 Execute Reorganization
97
+
98
+ 1. Create directory structure (including archive):
99
+ ```bash
100
+ mkdir -p docs/{00-context,01-product,02-features,03-logs,04-process,archive}
101
+ ```
102
+
103
+ 2. Move ARCHIVE files first:
104
+ ```bash
105
+ mv docs/old-file.md docs/archive/
106
+ ```
107
+
108
+ 3. Move KEEP files to appropriate tiers
109
+
110
+ 4. For CONSOLIDATE: read both files, merge content into new file, move originals to archive
111
+
112
+ 5. Remove empty old directories
113
+
114
+ ---
115
+
116
+ ## Step 3: Create Structure
117
+
118
+ ### 3.1 Create Directories
28
119
 
29
- ### 2. Create Directories
30
120
  ```bash
31
- mkdir -p docs/{00-context,01-product,02-features,03-logs,04-process}
121
+ mkdir -p docs/{00-context,01-product,02-features,03-logs,04-process,archive}
32
122
  ```
33
123
 
34
- ### 3. Create Files with TodoWrite
124
+ ### 3.2 Required Files
125
+
126
+ Create these files (see `references/templates.md` for content):
127
+
128
+ **00-context/** (4 files):
129
+ - [ ] `blueprint.md` - Overarching project artifact (see below)
130
+ - [ ] `vision.md` - Product purpose & boundaries
131
+ - [ ] `assumptions.md` - Constraints, risks, unknowns
132
+ - [ ] `system-state.md` - What's currently built
35
133
 
36
- Track progress:
37
- - [ ] 00-context (3 files: vision.md, assumptions.md, system-state.md)
38
- - [ ] 01-product (1 file: prd.md)
39
- - [ ] 02-features (per feature discovered: feature-spec.md, tech-design.md, dev-tasks.md, test-plan.md)
40
- - [ ] 03-logs (5 files: implementation-log.md, decisions-log.md, bug-log.md, validation-log.md, insights.md)
41
- - [ ] 04-process (3 files: dev-workflow.md, definition-of-done.md, llm-prompts.md)
42
- - [ ] docs/README.md
134
+ **01-product/** (1 file):
135
+ - [ ] `prd.md` - Product requirements
43
136
 
44
- Mark each **completed** before next.
137
+ **02-features/** (per feature):
138
+ - [ ] `feature-<name>/` subdirectories as needed
139
+ - [ ] Or flat files for simpler projects
45
140
 
46
- For detailed templates, see: `references/templates.md`
141
+ **03-logs/** (5 files):
142
+ - [ ] `implementation-log.md`
143
+ - [ ] `decisions-log.md`
144
+ - [ ] `bug-log.md`
145
+ - [ ] `validation-log.md`
146
+ - [ ] `insights.md`
47
147
 
48
- ### 4. Integrate with Existing Docs
148
+ **04-process/** (3+ files):
149
+ - [ ] `dev-workflow.md`
150
+ - [ ] `definition-of-done.md`
151
+ - [ ] `llm-prompts.md`
49
152
 
50
- **If CLAUDE.md/KNOWLEDGE_BASE.md exist**:
51
- Update KNOWLEDGE_BASE.md to reference new structure:
153
+ **Root:**
154
+ - [ ] `README.md` - Navigation guide
155
+
156
+ ---
157
+
158
+ ## Step 4: Populate Files
159
+
160
+ ### Content Sources
161
+
162
+ Pull content from:
163
+ - Project README.md
164
+ - Package files (package.json, pyproject.toml)
165
+ - Existing code comments/docstrings
166
+ - Existing docs being reorganized
167
+
168
+ ### For Existing Mode
169
+
170
+ When moving files:
171
+ - Update any internal links to match new locations
172
+ - Merge duplicate content thoughtfully
173
+ - Preserve useful information, don't just copy-paste
174
+
175
+ ---
176
+
177
+ ## Step 5: Integration
178
+
179
+ **If CLAUDE.md exists:**
180
+ Add or update documentation pointer:
52
181
  ```markdown
53
- ## Project Documentation
54
- Full /docs structure with context, product, features, logs, process
55
- → `docs/README.md`
182
+ ## Documentation
183
+ See `docs/README.md` for full documentation structure.
56
184
  ```
57
185
 
58
- **If existing /docs subdirs exist**:
59
- - Don't delete - add migration note in docs/README.md
60
- - Reference existing content where relevant
61
- - Note in system-state.md that migration in progress
186
+ **If KNOWLEDGE_BASE.md exists:**
187
+ Update to reference new structure with quick links.
62
188
 
63
- ### 5. Validate
189
+ ---
190
+
191
+ ## Step 6: Validate
64
192
 
65
193
  ```bash
66
- # Check structure
67
- ls -la docs/{00-context,01-product,02-features,03-logs,04-process}
194
+ # Check structure exists
195
+ ls -la docs/{00-context,01-product,02-features,03-logs,04-process,archive}
196
+
197
+ # Verify minimum files
198
+ test -f docs/00-context/blueprint.md && echo "✓ blueprint.md"
199
+ test -f docs/00-context/vision.md && echo "✓ vision.md"
200
+ test -f docs/00-context/system-state.md && echo "✓ system-state.md"
201
+ test -f docs/01-product/prd.md && echo "✓ prd.md"
202
+ test -f docs/README.md && echo "✓ README.md"
68
203
 
69
- # Count minimum files
70
- find docs/00-context -name "*.md" | wc -l # >= 3
204
+ # Count files per tier
205
+ find docs/00-context -name "*.md" | wc -l # >= 4
71
206
  find docs/03-logs -name "*.md" | wc -l # >= 5
72
207
  find docs/04-process -name "*.md" | wc -l # >= 3
73
- test -f docs/01-product/prd.md && echo "✓ PRD exists"
74
- test -f docs/README.md && echo "✓ README exists"
75
208
  ```
76
209
 
210
+ ---
211
+
212
+ ## Blueprint: The Overarching Project Artifact
213
+
214
+ `docs/00-context/blueprint.md` is the **one and only** high-level project document. It answers: what is this project, what's built, what's planned, where is it headed.
215
+
216
+ **When to create:** Always. blueprint.md is the first file created in 00-context/. It is required for both Fresh and Existing modes.
217
+
218
+ **Content sources:**
219
+ - Root `README.md` — project identity, purpose, stats
220
+ - `package.json` / `pyproject.toml` — tech stack, dependencies
221
+ - Existing docs — features implemented vs planned
222
+ - Code structure — what modules/packages exist
223
+
224
+ **Structure:**
225
+
226
+ ```markdown
227
+ # [Project Name] Blueprint
228
+
229
+ ## Identity
230
+ [What this project IS in 2-3 sentences. Sourced from README.]
231
+
232
+ ## Status
233
+ | Area | Status | Notes |
234
+ |------|--------|-------|
235
+ | [feature/module] | implemented / in-progress / planned | [brief] |
236
+
237
+ ## Architecture
238
+ [High-level structure: packages, modules, entry points. No ASCII trees — use tables or flat lists.]
239
+
240
+ ## Implemented
241
+ [What works today. Group by feature area. Be specific.]
242
+
243
+ ## Planned
244
+ [What's next. Ordered by priority. Include design docs if they exist.]
245
+
246
+ ## Future Direction
247
+ [Where does this project want to be? North star. 3-5 bullets max.]
248
+
249
+ ## Key Decisions
250
+ [Major architectural choices already made. Link to decisions-log if it exists.]
251
+ ```
252
+
253
+ **Rules for blueprint.md:**
254
+ - Keep it under 150 lines — it's an overview, not a manual
255
+ - Update it when features ship or plans change
256
+ - It is the FIRST document a new contributor or LLM should read
257
+ - No duplication with vision.md (vision = WHY, blueprint = WHAT + WHERE)
258
+
259
+ ---
260
+
77
261
  ## Rules
78
262
 
79
- **DO**:
80
- - Complete one section fully before next
81
- - Use TodoWrite to track progress
82
- - Populate files (don't leave empty templates)
83
- - Use discovered content from project
84
- - Create feature-<name>/ for each major feature found
85
- - Initialize all 5 log files with format
86
- - Mark todos completed immediately after finishing
87
-
88
- **DON'T**:
89
- - Skip sections
90
- - Create empty placeholders
91
- - Duplicate content across files
92
- - Delete existing docs
93
- - Forget to validate at end
263
+ **DO:**
264
+ - Read files before categorizing (don't guess from filename alone)
265
+ - Present plan to user before bulk changes
266
+ - Archive instead of delete
267
+ - Complete one section before moving to next
268
+ - Populate files with real content (not empty templates)
269
+ - Preserve original files in archive when consolidating
270
+
271
+ **DON'T:**
272
+ - Delete any files (archive instead)
273
+ - Move files without reading them first
274
+ - Make bulk changes without user approval
275
+ - Create empty placeholder files
276
+ - Skip the analysis phase for existing docs
277
+
278
+ ---
94
279
 
95
280
  ## Success Criteria
96
281
 
97
- All 5 tier directories created
98
- Minimum files in each (00-context: 3, 01-product: 1, 03-logs: 5, 04-process: 3)
282
+ Mode correctly detected (fresh vs existing)
283
+ For existing: categorization presented and approved
284
+ ✅ All 5 tier directories created (+ archive)
285
+ ✅ Minimum files in each tier
99
286
  ✅ Files populated with project-specific content
100
- Feature folders created for discovered features
101
- ✅ docs/README.md complete with navigation
102
- ✅ Integration with CLAUDE.md/KNOWLEDGE_BASE.md done
287
+ Archive contains old/unclear docs (not deleted)
288
+ ✅ docs/README.md with navigation
103
289
  ✅ Validation checks pass
104
- ✅ All todos marked completed
105
290
 
106
- Complete when /docs structure is fully populated and navigable.
291
+ ---
292
+
293
+ ## Quick Reference
294
+
295
+ ### Tier Mapping
296
+
297
+ | Old Location | New Location |
298
+ |--------------|--------------|
299
+ | guides/, howto/ | 02-features/ or 04-process/ |
300
+ | reference/, api/ | 04-process/reference/ |
301
+ | architecture/ | 00-context/ |
302
+ | commands/ | 02-features/cli/ |
303
+ | development/ | 04-process/development/ |
304
+ | troubleshooting/ | 04-process/troubleshooting/ |
305
+ | reports/, status/, phases/ | archive/ |
306
+
307
+ ### File Templates
308
+
309
+ See: `references/templates.md`
@@ -2,6 +2,35 @@
2
2
 
3
3
  Detailed templates for each file in the /docs structure.
4
4
 
5
+ ## 00-context/blueprint.md
6
+
7
+ ```markdown
8
+ # [Project Name] Blueprint
9
+
10
+ ## Identity
11
+ [What this project IS in 2-3 sentences. Sourced from README.]
12
+
13
+ ## Status
14
+ | Area | Status | Notes |
15
+ |------|--------|-------|
16
+ | [feature/module] | implemented / in-progress / planned | [brief] |
17
+
18
+ ## Architecture
19
+ [High-level structure: packages, modules, entry points. Tables or flat lists, no ASCII trees.]
20
+
21
+ ## Implemented
22
+ [What works today. Group by feature area. Be specific about what ships.]
23
+
24
+ ## Planned
25
+ [What's next. Ordered by priority. Link to design docs if they exist.]
26
+
27
+ ## Future Direction
28
+ [Where does this project want to be? North star. 3-5 bullets max.]
29
+
30
+ ## Key Decisions
31
+ [Major architectural choices already made. Brief rationale. Link to decisions-log if available.]
32
+ ```
33
+
5
34
  ## 00-context/vision.md
6
35
 
7
36
  ```markdown
@@ -22,7 +22,7 @@ These subagents are available when using Claude Code CLI. Droid can reference th
22
22
  | system-architect | Architect | Use for system design, architecture documents, technology selection, API design, and infrastructure planning |
23
23
  | ui-designer | UX Expert | Use for UI/UX design, wireframes, prototypes, front-end specifications, and user experience optimization |
24
24
 
25
- ## Droid Commands (20 total)
25
+ ## Droid Commands (22 total)
26
26
 
27
27
  | ID | Description | Usage | Auto |
28
28
  |---|---|---|---|
@@ -32,9 +32,11 @@ These subagents are available when using Claude Code CLI. Droid can reference th
32
32
  | debug | Debug an issue systematically using structured investigation techniques | /debug <issue-description> | - |
33
33
  | docs-builder | Create comprehensive project documentation with structured /docs hierarchy | /docs-builder | false |
34
34
  | explain | Explain code for someone new to the codebase | /explain <code-section> | - |
35
+ | friction | Analyze session logs for failure patterns and behavioral signals | /friction <sessions-path> | - |
35
36
  | git-commit | Analyze changes and create intelligent git commits | /git-commit | - |
36
37
  | optimize | Analyze and optimize performance issues | /optimize <target-area> | - |
37
38
  | refactor | Refactor code while maintaining behavior and tests | /refactor <code-section> | - |
39
+ | remember | Consolidate stashes + friction into project memory | /remember | - |
38
40
  | review | Comprehensive code review including quality, tests, and architecture | /review | - |
39
41
  | root-cause-tracing | Systematically traces bugs backward through call stack to identify source | /root-cause-tracing <issue-description> | false |
40
42
  | security | Security vulnerability scan and analysis | /security | - |