planflow-ai 1.1.4 → 1.1.6

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 (42) hide show
  1. package/.claude/commands/brain.md +9 -11
  2. package/.claude/commands/heartbeat.md +120 -0
  3. package/.claude/commands/learn.md +324 -47
  4. package/.claude/commands/setup.md +36 -4
  5. package/.claude/resources/core/_index.md +32 -2
  6. package/.claude/resources/core/autopilot-mode.md +6 -2
  7. package/.claude/resources/core/brain-capture.md +89 -71
  8. package/.claude/resources/core/heartbeat.md +117 -0
  9. package/.claude/resources/core/project-memory.md +69 -0
  10. package/.claude/resources/core/project-tasklist.md +65 -0
  11. package/.claude/resources/patterns/_index.md +2 -1
  12. package/.claude/resources/patterns/brain-patterns.md +11 -18
  13. package/.claude/resources/skills/_index.md +5 -3
  14. package/.claude/resources/skills/brain-skill.md +4 -7
  15. package/.claude/resources/skills/learn-skill.md +84 -0
  16. package/.claude/resources/skills/setup-skill.md +62 -4
  17. package/README.md +46 -0
  18. package/dist/cli/commands/heartbeat.d.ts +9 -0
  19. package/dist/cli/commands/heartbeat.d.ts.map +1 -0
  20. package/dist/cli/commands/heartbeat.js +145 -0
  21. package/dist/cli/commands/heartbeat.js.map +1 -0
  22. package/dist/cli/daemon/heartbeat-daemon.d.ts +9 -0
  23. package/dist/cli/daemon/heartbeat-daemon.d.ts.map +1 -0
  24. package/dist/cli/daemon/heartbeat-daemon.js +184 -0
  25. package/dist/cli/daemon/heartbeat-daemon.js.map +1 -0
  26. package/dist/cli/daemon/heartbeat-parser.d.ts +21 -0
  27. package/dist/cli/daemon/heartbeat-parser.d.ts.map +1 -0
  28. package/dist/cli/daemon/heartbeat-parser.js +136 -0
  29. package/dist/cli/daemon/heartbeat-parser.js.map +1 -0
  30. package/dist/cli/handlers/shared.d.ts +10 -0
  31. package/dist/cli/handlers/shared.d.ts.map +1 -1
  32. package/dist/cli/handlers/shared.js +252 -16
  33. package/dist/cli/handlers/shared.js.map +1 -1
  34. package/dist/cli/index.js +8 -0
  35. package/dist/cli/index.js.map +1 -1
  36. package/dist/cli/types.d.ts +18 -0
  37. package/dist/cli/types.d.ts.map +1 -1
  38. package/package.json +3 -2
  39. package/rules/core/brain-capture.mdc +19 -10
  40. package/rules/patterns/brain-patterns.mdc +6 -11
  41. package/templates/shared/AGENTS.md.template +1 -3
  42. package/templates/shared/CLAUDE.md.template +3 -5
@@ -48,12 +48,13 @@ MODES:
48
48
  Guided: Asks structured questions about work, insights, meetings, decisions
49
49
 
50
50
  BRAIN STRUCTURE:
51
- flow/brain/
52
- ├── index.md # Brain index (always loaded at session start)
53
- ├── features/ # Feature history and context
54
- ├── errors/ # Reusable error patterns
55
- ├── decisions/ # Decision records
56
- └── sessions/ # Daily activity logs
51
+ flow/brain/ # Per-project brain
52
+ ├── index.md # Brain index (loaded at session start)
53
+ ├── features/ # Feature history and context
54
+ └── errors/ # Reusable error patterns
55
+
56
+ ~/plan-flow/brain/daily/ # Global daily logs (cross-project)
57
+ └── YYYY-MM-DD.md
57
58
 
58
59
  RELATED COMMANDS:
59
60
  /setup Creates brain directory structure
@@ -69,7 +70,7 @@ RELATED COMMANDS:
69
70
  | ------------------------ | -------------------------------------------------------- |
70
71
  | **Brain Only** | ONLY write to `flow/brain/` - no source code, no config |
71
72
  | **Wiki-Links** | All cross-references use `[[kebab-case-name]]` format |
72
- | **Index Caps** | Max 5 errors, 3 decisions, 3 cross-project in index |
73
+ | **Index Caps** | Max 5 errors, 3 cross-project in index |
73
74
  | **No Code** | Brain is for knowledge capture, never write source code |
74
75
  | **Complete and Stop** | After writing entry, STOP and wait for user |
75
76
 
@@ -99,7 +100,7 @@ What would you like to capture? You can:
99
100
  Check if `flow/brain/` exists. If not, create:
100
101
 
101
102
  ```bash
102
- mkdir -p flow/brain/features flow/brain/errors flow/brain/decisions flow/brain/sessions
103
+ mkdir -p flow/brain/features flow/brain/errors
103
104
  ```
104
105
 
105
106
  Check if `flow/brain/index.md` exists. If not, create initial index:
@@ -113,9 +114,6 @@ _No features tracked yet._
113
114
  ## Recent Errors
114
115
  _No errors captured yet._
115
116
 
116
- ## Recent Decisions
117
- _No decisions recorded yet._
118
-
119
117
  ## Cross-Project Patterns
120
118
  _No cross-project patterns yet._
121
119
  ```
@@ -0,0 +1,120 @@
1
+ ---
2
+ description: Manage scheduled automated tasks via the heartbeat daemon
3
+ ---
4
+
5
+ # Heartbeat: Scheduled Task Automation
6
+
7
+ ## Command Description
8
+
9
+ Manage the heartbeat daemon — a cron-like automation system that runs scheduled tasks defined in `flow/heartbeat.md`. Tasks can include research, feature creation, execution, and pushing to repos.
10
+
11
+ **Config**: `flow/heartbeat.md`
12
+ **Daemon**: `npx plan-flow heartbeat start|stop|status`
13
+
14
+ ---
15
+
16
+ ## Help
17
+
18
+ **If the user invokes this command with `-help`, display only this section and stop:**
19
+
20
+ ```
21
+ /heartbeat - Scheduled Task Automation
22
+
23
+ DESCRIPTION:
24
+ Manage the heartbeat daemon for automated scheduled tasks.
25
+ Tasks are defined in flow/heartbeat.md with human-readable schedules.
26
+
27
+ USAGE:
28
+ /heartbeat -add Add a new scheduled task interactively
29
+ /heartbeat -remove Remove an existing scheduled task
30
+ /heartbeat -list List all scheduled tasks with status
31
+ /heartbeat -help Show this help
32
+
33
+ CLI COMMANDS:
34
+ npx plan-flow heartbeat start Start the daemon
35
+ npx plan-flow heartbeat stop Stop the daemon
36
+ npx plan-flow heartbeat status Show daemon status
37
+
38
+ SCHEDULE SYNTAX:
39
+ daily at {HH:MM AM/PM} Run once daily at the specified time
40
+ every {N} hours Run every N hours
41
+ every {N} minutes Run every N minutes
42
+ weekly on {day} at {HH:MM} Run weekly on a specific day
43
+
44
+ EXAMPLE TASKS:
45
+ daily at 10:00 PM - research about topic X, create md files and add to brain
46
+ every 6 hours - check for new issues and update tasklist
47
+ weekly on Monday at 9:00 AM - generate weekly summary report
48
+
49
+ RELATED COMMANDS:
50
+ /flow Toggle autopilot mode
51
+ /brain Manual brain entry
52
+ ```
53
+
54
+ ---
55
+
56
+ ## Critical Rules
57
+
58
+ | Rule | Description |
59
+ |------|-------------|
60
+ | **File-Based Config** | All tasks are defined in `flow/heartbeat.md` |
61
+ | **No Direct Execution** | This command manages tasks, not executes them — the daemon handles execution |
62
+ | **Confirm Before Remove** | Always confirm before removing a scheduled task |
63
+ | **Complete and Stop** | After adding/removing/listing, STOP and wait for user input |
64
+
65
+ ---
66
+
67
+ ## Instructions
68
+
69
+ ### /heartbeat -add
70
+
71
+ 1. Ask the user for:
72
+ - **Task name**: Short descriptive name (kebab-case)
73
+ - **Schedule**: Using human-readable syntax (see help)
74
+ - **Command**: What the daemon should execute
75
+ - **Description**: What this task does
76
+ 2. Add the task to `flow/heartbeat.md` using the task template
77
+ 3. Confirm the addition
78
+
79
+ ### /heartbeat -remove
80
+
81
+ 1. List all tasks in `flow/heartbeat.md`
82
+ 2. Ask the user which task to remove
83
+ 3. Confirm before removing
84
+ 4. Remove the task entry from the file
85
+
86
+ ### /heartbeat -list
87
+
88
+ 1. Read `flow/heartbeat.md`
89
+ 2. Display all tasks with their schedule, status, and description
90
+
91
+ ---
92
+
93
+ ## Context Optimization
94
+
95
+ ### Reference Codes for Heartbeat
96
+
97
+ | Code | Description | When to Expand |
98
+ |------|-------------|----------------|
99
+ | COR-HB-1 | Heartbeat file format and schedule syntax | Creating or editing heartbeat tasks |
100
+ | COR-HB-2 | Daemon architecture and CLI commands | Starting/stopping the daemon |
101
+
102
+ ---
103
+
104
+ ## Brain Capture
105
+
106
+ <!-- brain-capture
107
+ skill: heartbeat
108
+ captures:
109
+ - task name and schedule added/removed
110
+ - daemon start/stop events
111
+ -->
112
+
113
+ ---
114
+
115
+ ## Related Resources
116
+
117
+ | Resource | Purpose |
118
+ |----------|---------|
119
+ | `resources/core/heartbeat.md` | File format rules and daemon architecture |
120
+ | `resources/core/_index.md` | Index of core rules with reference codes |
@@ -1,34 +1,60 @@
1
1
  ---
2
- description: Extract reusable patterns from the current session and save them to the project
2
+ description: Extract reusable patterns from the current session, or learn about a topic with step-by-step teaching
3
3
  ---
4
4
 
5
- # Learn: Session Pattern Extraction
5
+ # Learn: Session Pattern Extraction & Teaching Mode
6
6
 
7
7
  ## Command Description
8
8
 
9
- This command analyzes the current session for reusable patterns — error resolutions, debugging techniques, workarounds, project-specific conventions — and saves them to `flow/resources/` as learned pattern files with `[[wiki-links]]` for Obsidian compatibility.
9
+ This command has two modes:
10
10
 
11
- **Output**: Pattern files in `flow/resources/learned-{pattern-name}.md`.
11
+ 1. **Pattern Extraction** (`/learn` with no arguments): Analyzes the current session for reusable patterns and saves them to `flow/resources/`.
12
+ 2. **Teaching Mode** (`/learn <topic>` or `/learn about <topic>`): **Teaches** the user about a topic with a structured step-by-step curriculum. The AI becomes a teacher — it researches the topic, designs a curriculum, and walks the user through each step interactively. Curricula are stored **globally** at `~/plan-flow/brain/learns/` so they can be reused across all projects.
13
+
14
+ **Output**:
15
+ - Pattern mode: `flow/resources/learned-{pattern-name}.md`
16
+ - Teaching (general knowledge): `~/plan-flow/brain/learns/{topic-kebab}.md` (global, indexed with `LRN-*` codes, reusable across projects)
17
+ - Teaching (project implementation): `flow/brain/learning/{topic-kebab}.md` (project-local, specific to this project's stack)
18
+ - Teaching (both): General part saved globally + implementation part saved locally
12
19
 
13
20
  ---
14
21
 
22
+ ## Mode Detection (CRITICAL — read this first)
23
+
24
+ **IMPORTANT**: The user's input after `/learn` determines which mode to use. Get this right.
25
+
26
+ | User Input | Mode | What To Do |
27
+ |------------|------|------------|
28
+ | `/learn` (no arguments) | **Pattern Extraction** | Scan session for reusable patterns (Steps 1-4 below) |
29
+ | `/learn about <topic>` | **Teaching Mode** | Create a step-by-step curriculum to TEACH the user about `<topic>` |
30
+ | `/learn <topic>` (any text after /learn) | **Teaching Mode** | Same as above — treat any argument as a topic to teach |
31
+ | `/learn -help` | Help | Show help and stop |
32
+
33
+ **Rule**: If the user provides ANY topic after `/learn`, you are in **Teaching Mode**. The ONLY way to trigger Pattern Extraction is `/learn` with no arguments.
34
+
35
+ **Teaching Mode means**: You are a TEACHER. You create a structured curriculum and teach the user step by step. You do NOT extract patterns from the session. You do NOT create `learned-*.md` files. You CREATE a curriculum and TEACH.
36
+
37
+ ---
15
38
 
16
39
  ## Help
17
40
 
18
41
  **If the user invokes this command with `-help`, display only this section and stop:**
19
42
 
20
43
  ```
21
- /learn - Extract Reusable Patterns
44
+ /learn - Extract Patterns & Teaching Mode
22
45
 
23
46
  DESCRIPTION:
24
- Analyzes the current session for reusable patterns and saves them
25
- to flow/resources/ as learned pattern files with [[wiki-links]].
47
+ Two modes: extract reusable patterns from the current session,
48
+ or learn about a topic with step-by-step teaching.
26
49
 
27
50
  USAGE:
28
- /learn Analyze session and suggest patterns
51
+ /learn Analyze session and suggest patterns to extract
52
+ /learn about <topic> Teach me about <topic> step by step
53
+ /learn <topic> Same as above — teach me about <topic>
29
54
  /learn -help Show this help
30
55
 
31
- WHAT GETS EXTRACTED:
56
+ PATTERN EXTRACTION MODE (/learn):
57
+ Extracts:
32
58
  - Error resolutions (how you fixed a tricky bug)
33
59
  - Debugging techniques (steps to diagnose an issue)
34
60
  - Workarounds (non-obvious solutions to platform/tool limitations)
@@ -36,16 +62,23 @@ WHAT GETS EXTRACTED:
36
62
  - Architecture insights (structural decisions made during work)
37
63
  - Integration patterns (how services/APIs were connected)
38
64
 
39
- WHAT DOES NOT GET EXTRACTED:
65
+ Does NOT extract:
40
66
  - Trivial fixes (typos, missing imports, obvious syntax errors)
41
67
  - One-time issues unlikely to recur
42
68
  - Generic knowledge available in documentation
43
- - Patterns already captured in existing learned files
44
69
 
45
- OUTPUT:
46
- - Saves to flow/resources/learned-{pattern-name}.md
47
- - Creates [[wiki-links]] to related brain entries
48
- - One pattern per file
70
+ Output: flow/resources/learned-{pattern-name}.md
71
+
72
+ TEACHING MODE (/learn about <topic>):
73
+ Intelligently teaches you about a topic. For tools/libraries,
74
+ asks if you want general knowledge, project implementation,
75
+ or both. Adapts to your pace — skip what you know, go deeper
76
+ where you need it. Uses web search for up-to-date docs.
77
+
78
+ Completed curricula are saved globally and reused across projects.
79
+
80
+ Output: ~/plan-flow/brain/learns/{topic-kebab}.md (global)
81
+ Index: ~/plan-flow/brain/learns/_index.md (LRN-* codes)
49
82
 
50
83
  RELATED COMMANDS:
51
84
  /brain Capture meeting notes, ideas, brainstorms
@@ -160,40 +193,284 @@ If multiple patterns were found, repeat Steps 3-4 for each one.
160
193
 
161
194
  ---
162
195
 
163
- ## Flow Diagram
196
+ ## Teaching Mode (`/learn about <topic>`)
197
+
198
+ When the user provides a topic (e.g., `/learn about langfuse`, `/learn docker`, `/learn graphql subscriptions`), you become a **teacher**. Your job is to intelligently understand what the user wants to learn and deliver it interactively.
199
+
200
+ **You are NOT extracting patterns. You are TEACHING the user something new.**
201
+
202
+ ### Step 0: Classify the Topic (CRITICAL — do this first)
203
+
204
+ Before designing any curriculum, classify the topic to determine the right learning approach:
205
+
206
+ | Topic Type | Examples | How to Detect |
207
+ |------------|----------|---------------|
208
+ | **Integrable tool/library** | Langfuse, Sentry, Stripe, Prisma, Redis | Has an SDK/package that could be installed in a project |
209
+ | **Platform/service** | AWS, Vercel, Docker, Kubernetes | Infrastructure or deployment related |
210
+ | **Concept/pattern** | MCP protocol, event sourcing, CQRS, microservices | Abstract idea, no single package to install |
211
+ | **Language/framework feature** | TypeScript generics, React Server Components | Part of a language or framework the project may use |
212
+
213
+ ### Step 1: Ask the User What They Want (for integrable topics)
214
+
215
+ **If the topic is an integrable tool/library/platform**, ask the user before proceeding:
216
+
217
+ ```markdown
218
+ I can teach you about **{topic}** in different ways:
219
+
220
+ 1. **General knowledge** — What is {topic}? How does it work? Core concepts and architecture.
221
+ → Saved globally (reusable across all your projects)
222
+
223
+ 2. **Project implementation** — How to integrate {topic} into THIS project ({detected-stack}). Hands-on setup, configuration, and usage.
224
+ → Saved to this project only
225
+
226
+ 3. **Both** — Start with fundamentals, then apply to your project step by step.
227
+ → General part saved globally + implementation part saved to this project
228
+
229
+ Which approach would you prefer?
230
+ ```
231
+
232
+ **If the topic is a concept/pattern** (not directly integrable), skip this question and go straight to curriculum design — concepts are always taught as general knowledge (saved globally) contextualized with project examples.
233
+
234
+ ### Storage Rules Based on Approach
235
+
236
+ | Approach | Where to Save | Why |
237
+ |----------|---------------|-----|
238
+ | **General knowledge** | `~/plan-flow/brain/learns/{topic}.md` (global) | Generic knowledge reusable across all projects |
239
+ | **Project implementation** | `flow/brain/learning/{topic}.md` (project-local) | Contains project-specific paths, config, and stack details |
240
+ | **Both** | Global file for general steps + project-local file for implementation steps | Separates reusable knowledge from project-specific setup |
241
+ | **Concept/pattern** | `~/plan-flow/brain/learns/{topic}.md` (global) | Concepts are inherently cross-project |
242
+
243
+ **For "both" approach**: Create two linked files:
244
+ - `~/plan-flow/brain/learns/{topic}.md` — General knowledge steps (auto-indexed with `LRN-*`)
245
+ - `flow/brain/learning/{topic}-implementation.md` — Project implementation steps (linked via `[[{topic}]]` wiki-link back to the global file)
246
+
247
+ ### Step 2: Research the Topic
248
+
249
+ Before designing the curriculum:
250
+
251
+ 1. **Use web search** to get up-to-date information (official docs, latest version, recent changes)
252
+ 2. **Read the project's stack** from `flow/brain/index.md` and `flow/references/tech-foundation.md`
253
+ 3. **Check existing learns** at `~/plan-flow/brain/learns/_index.md` — if the topic already exists, offer to resume, expand, or start fresh
254
+
255
+ ### Step 3: Design an Adaptive Curriculum
256
+
257
+ Design the curriculum based on the user's chosen approach:
258
+
259
+ **For general knowledge:**
260
+ - Focus on concepts, architecture, how it works under the hood
261
+ - Use generic examples (not tied to the project)
262
+ - Cover: what it is → why it matters → core concepts → how it works → advanced features → ecosystem
263
+
264
+ **For project implementation:**
265
+ - Focus on hands-on integration into the current project
266
+ - Use the project's actual stack, file structure, and conventions
267
+ - Cover: installation → configuration → basic usage → integration with existing code → testing → production considerations
268
+
269
+ **For both (hybrid):**
270
+ - Start with 2-3 conceptual steps (what + why + core concepts)
271
+ - Transition to 3-4 implementation steps (setup + integrate + test + deploy)
272
+ - Mark the transition clearly: "Now let's apply this to your project"
273
+
274
+ **Curriculum rules:**
275
+ - 3-7 steps, progressing from simple → complex
276
+ - Each step should be self-contained and confirmable
277
+ - Include code examples relevant to the chosen approach
278
+ - Reference official docs with links when possible
279
+
280
+ ### Step 4: Present Overview and Teach
281
+
282
+ 1. **Present the full curriculum outline** for user approval
283
+ 2. **For each step:**
284
+ - Present clear explanations with examples
285
+ - For implementation steps: show actual code snippets for the project's stack
286
+ - Wait for user confirmation (`next`, `done`, or questions)
287
+ - **Be adaptive**: if the user asks a question, answer it thoroughly. If they want to go deeper on something, explore it. If they want to skip something they already know, skip it.
288
+ - Mark the step as completed
289
+
290
+ ### Step 5: Dynamic Teaching Behaviors
291
+
292
+ During teaching, be smart about these situations:
293
+
294
+ | Situation | What to Do |
295
+ |-----------|------------|
296
+ | User asks a tangent question | Answer it, then ask if they want to continue or explore further |
297
+ | User says "I already know this" | Skip to the next step, offer to adjust remaining curriculum |
298
+ | User asks for more depth | Expand the current step with more detail, examples, or edge cases |
299
+ | User asks for a code example | Provide a concrete example using the project's actual stack and conventions |
300
+ | User seems confused | Rephrase with simpler language, add an analogy, or break into smaller sub-steps |
301
+ | User asks "how would this work in my project?" | Switch to project-contextualized explanation using the detected stack |
302
+ | User says "done" or "that's enough" | Wrap up early — save what was completed so far with status `partial` |
303
+
304
+ ### Step 6: Save and Index
305
+
306
+ After all steps are confirmed (or user stops early):
307
+
308
+ **For general knowledge / concept:**
309
+ 1. Save to `~/plan-flow/brain/learns/{topic-kebab}.md`
310
+ 2. Auto-index with `LRN-*` codes in `~/plan-flow/brain/learns/_index.md`
311
+ 3. Update `flow/brain/index.md` with `## Global Learns` section
312
+
313
+ **For project implementation:**
314
+ 1. Ensure `flow/brain/learning/` exists
315
+ 2. Save to `flow/brain/learning/{topic-kebab}.md`
316
+ 3. No global indexing (project-local only)
317
+ 4. Update `flow/brain/index.md` with a reference under `## Project Learns`
318
+
319
+ **For both:**
320
+ 1. Save general steps to `~/plan-flow/brain/learns/{topic-kebab}.md` → auto-index with `LRN-*`
321
+ 2. Save implementation steps to `flow/brain/learning/{topic-kebab}-implementation.md`
322
+ 3. Add `[[{topic-kebab}]]` wiki-link in the project file pointing to the global file
323
+ 4. Update `flow/brain/index.md` with both global and project references
324
+
325
+ ### Teaching Restrictions
326
+
327
+ | Rule | Description |
328
+ |------|-------------|
329
+ | **Ask First** | For integrable topics, ask general vs implementation vs both BEFORE designing curriculum |
330
+ | **Research First** | Use web search for up-to-date docs before teaching |
331
+ | **Be Adaptive** | Adjust depth, pace, and focus based on user responses |
332
+ | **Smart Storage** | General knowledge → global (`~/plan-flow/brain/learns/`). Project implementation → local (`flow/brain/learning/`). Both → split across both. |
333
+ | **Auto-Index** | Global learns are automatically indexed with `LRN-*` codes (no user action needed) |
334
+ | **No Code Changes** | Teaching mode does NOT write source code or modify project configs |
335
+ | **Complete and Stop** | After teaching completes (or user stops), STOP and wait for user input |
336
+
337
+ ### Curriculum Template
338
+
339
+ ```markdown
340
+ # Learning: {Topic}
341
+
342
+ **Started**: {YYYY-MM-DD}
343
+ **Status**: {in-progress|completed|partial}
344
+ **Approach**: {general|implementation|hybrid}
345
+ **Projects**: [[{project-name}]]
346
+
347
+ ## Overview
348
+
349
+ {Brief description of what this curriculum covers and at what level}
350
+
351
+ ## Curriculum
352
+
353
+ ### Step 1: {Title}
354
+ - **Status**: {pending|completed|skipped}
355
+ - **Content**: {explanation with examples}
356
+
357
+ ### Step 2: {Title}
358
+ - **Status**: {pending|completed|skipped}
359
+ - **Content**: {explanation}
360
+
361
+ ...
362
+
363
+ ## Key Takeaways
364
+
365
+ {Summary of the most important things learned — filled after completion}
366
+
367
+ ## Notes
368
+
369
+ {Questions asked during learning, tangents explored, insights gained}
370
+
371
+ ## Projects Using This
372
+ - [[{project-name}]]
373
+ ```
374
+
375
+ ### Learns Index Template (`~/plan-flow/brain/learns/_index.md`)
376
+
377
+ ```markdown
378
+ # Global Learns Index
379
+
380
+ ## Overview
381
+
382
+ Shared learning curricula accumulated across all projects. Use reference codes to load specific sections on-demand.
383
+
384
+ **Total Files**: X files
385
+ **Reference Codes**: LRN-{ABBR}-1 through LRN-{ABBR}-N
386
+ **Last Updated**: YYYY-MM-DD
387
+
388
+ ---
389
+
390
+ ## Reference Codes
391
+
392
+ ### MCP (`mcp.md`)
393
+
394
+ | Code | Description | Lines |
395
+ |------|-------------|-------|
396
+ | LRN-MCP-1 | What is MCP and why it matters | 10-35 |
397
+ | LRN-MCP-2 | MCP server architecture | 36-70 |
398
+ | LRN-MCP-3 | Building your first MCP server | 71-120 |
399
+
400
+ ---
401
+
402
+ ## When to Expand
403
+
404
+ | Code | Expand When |
405
+ |------|-------------|
406
+ | LRN-MCP-1 | Need to understand MCP fundamentals |
407
+ | LRN-MCP-2 | Designing an MCP server |
408
+
409
+ ---
410
+
411
+ ## Projects Using Learns
412
+
413
+ | Learn | Projects |
414
+ |-------|----------|
415
+ | mcp | [[project-1]], [[project-2]] |
416
+ ```
417
+
418
+ ### Reference Code Convention for Learns
419
+
420
+ | Learn File | Code Prefix | Example Codes |
421
+ |---|---|---|
422
+ | `mcp.md` | `LRN-MCP` | LRN-MCP-1, LRN-MCP-2, LRN-MCP-3 |
423
+ | `docker.md` | `LRN-DK` | LRN-DK-1, LRN-DK-2 |
424
+ | `graphql.md` | `LRN-GQ` | LRN-GQ-1, LRN-GQ-2 |
425
+ | Other `<name>.md` | `LRN-XX` | Use first 2-3 consonants or unique abbreviation |
426
+
427
+ ### Reference Codes for Teaching
428
+
429
+ | Code | Description | When to Expand |
430
+ |------|-------------|----------------|
431
+ | SKL-LRN-3 | Teaching mode restrictions and workflow | Starting teaching mode |
432
+ | SKL-LRN-4 | Curriculum template and global storage | Generating curriculum |
433
+ | SKL-LRN-5 | Learns index template and LRN-* code convention | Updating learns index |
434
+
435
+ ---
436
+
437
+ ## Flow Diagrams
438
+
439
+ ### Pattern Extraction Flow (`/learn` with no args)
440
+
441
+ ```
442
+ /learn (no args)
443
+ |
444
+ v
445
+ Scan session for patterns → Filter trivial → Draft pattern → User confirms → Save to flow/resources/
446
+ ```
447
+
448
+ ### Teaching Flow (`/learn <topic>`)
164
449
 
165
450
  ```
166
- +------------------------------------------+
167
- | /learn COMMAND |
168
- +------------------------------------------+
169
- |
170
- v
171
- +------------------------------------------+
172
- | Step 1: Review Session |
173
- | - Scan conversation for patterns |
174
- | - Categorize by priority |
175
- +------------------------------------------+
176
- |
177
- v
178
- +------------------------------------------+
179
- | Step 2: Filter Patterns |
180
- | - Skip trivial/one-time/generic |
181
- | - Check existing learned files |
182
- +------------------------------------------+
183
- |
184
- v
185
- +------------------------------------------+
186
- | Step 3: Draft Pattern File |
187
- | - Use template with [[wiki-links]] |
188
- | - Present to user for confirmation |
189
- +------------------------------------------+
190
- |
191
- v
192
- +------------------------------------------+
193
- | Step 4: Save Approved Pattern |
194
- | - Write to flow/resources/learned-*.md |
195
- | - Show confirmation |
196
- +------------------------------------------+
451
+ /learn <topic>
452
+ |
453
+ v
454
+ Classify topic type
455
+ |
456
+ ├── Integrable tool/library? ──→ Ask: general / implementation / both?
457
+ | |
458
+ ├── Concept/pattern? ──────────→ Skip question, go to research
459
+ |
460
+ v
461
+ Research (web search + project context + existing learns)
462
+ |
463
+ v
464
+ Design adaptive curriculum (3-7 steps)
465
+ |
466
+ v
467
+ Present overview → User approves
468
+ |
469
+ v
470
+ Teach step by step (adaptive: skip / deep dive / tangent / rephrase)
471
+ |
472
+ v
473
+ Save to ~/plan-flow/brain/learns/ Auto-index LRN-* codes → Link to project
197
474
  ```
198
475
 
199
476
  ---
@@ -399,7 +399,7 @@ See: `.claude/resources/skills/setup-skill.md`
399
399
  If the `flow/` folder doesn't exist, create it:
400
400
 
401
401
  ```bash
402
- mkdir -p flow/archive flow/brain/features flow/brain/errors flow/brain/decisions flow/brain/sessions flow/contracts flow/discovery flow/plans flow/references flow/reviewed-code flow/reviewed-pr
402
+ mkdir -p flow/archive flow/brain/features flow/brain/errors flow/contracts flow/discovery flow/plans flow/references flow/reviewed-code flow/reviewed-pr
403
403
  ```
404
404
 
405
405
  **Add `.gitkeep` files**:
@@ -416,7 +416,6 @@ flow/
416
416
  ├── brain/ # Automatic knowledge capture (Obsidian-compatible)
417
417
  │ ├── features/ # Feature history and context
418
418
  │ ├── errors/ # Reusable error patterns
419
- │ ├── decisions/ # Decision records
420
419
  │ └── sessions/ # Daily activity logs
421
420
  ├── contracts/ # Integration contracts
422
421
  ├── discovery/ # Discovery documents
@@ -454,7 +453,6 @@ flow/
454
453
  ├── brain/ # Automatic knowledge capture (Obsidian-compatible)
455
454
  │ ├── features/ # Feature history and context
456
455
  │ ├── errors/ # Reusable error patterns
457
- │ ├── decisions/ # Decision records
458
456
  │ └── sessions/ # Daily activity logs
459
457
  ├── contracts/ # Integration contracts
460
458
  ├── discovery/ # Discovery documents
@@ -711,6 +709,39 @@ When executing this command:
711
709
 
712
710
  ---
713
711
 
712
+ ## Global Pattern Sync
713
+
714
+ After generating pattern files in Step 8, sync **generic** patterns to the global brain at `~/plan-flow/brain/patterns/`.
715
+
716
+ ### What to Sync
717
+
718
+ | Local Pattern File | Global Target | Sync? |
719
+ |---|---|---|
720
+ | `.claude/resources/frameworks/<fw>-patterns.md` | `~/plan-flow/brain/patterns/<fw>.md` | Yes — framework best practices are generic |
721
+ | `.claude/resources/libraries/<lib>-patterns.md` | `~/plan-flow/brain/patterns/<lib>.md` | Yes — library patterns are generic |
722
+ | `.claude/resources/project/project-patterns.md` | — | No — project-specific paths and structure |
723
+
724
+ ### Sync Process
725
+
726
+ For each framework and library pattern file generated:
727
+
728
+ 1. Check if `~/plan-flow/brain/patterns/<name>.md` already exists
729
+ 2. **If it does NOT exist**:
730
+ - Copy the pattern file, but strip project-specific file paths and code examples that reference specific project directories
731
+ - Keep generic best practices, conventions, allowed/forbidden patterns
732
+ - Add a `## Projects Using This` section at the bottom: `- [[project-name]]`
733
+ 3. **If it ALREADY exists**:
734
+ - Read the existing global file
735
+ - Append any NEW sections or patterns not already present (do NOT overwrite existing content — it may contain knowledge from other projects)
736
+ - Add `[[project-name]]` to the `## Projects Using This` section if not already listed
737
+ 4. Use kebab-case for file names: `nextjs.md`, `typescript.md`, `zod.md`, `react-query.md`
738
+
739
+ ### Example
740
+
741
+ If setup generates `.claude/resources/frameworks/nextjs-patterns.md`, create or update `~/plan-flow/brain/patterns/nextjs.md` with the generic patterns, linked to the project via `[[project-name]]`.
742
+
743
+ ---
744
+
714
745
  ## Brain Capture
715
746
 
716
747
  After setup completes successfully, append a brain-capture block to the session file. See `.claude/resources/core/brain-capture.md` for processing rules.
@@ -726,11 +757,12 @@ data:
726
757
  project_name: [detected project name]
727
758
  stack: [language + framework]
728
759
  patterns_generated: [count of pattern files created]
760
+ patterns_synced_to_global: [list of global pattern files created/updated]
729
761
  files_created: [list of generated files]
730
762
  -->
731
763
  ```
732
764
 
733
- Write to `flow/brain/sessions/YYYY-MM-DD.md` and update `flow/brain/index.md` if this is a new project setup.
765
+ Write to `~/plan-flow/brain/daily/YYYY-MM-DD.md` and update `flow/brain/index.md` if this is a new project setup.
734
766
 
735
767
  ---
736
768