mother-brain 0.4.8 → 0.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.
package/dist/cli.js CHANGED
@@ -798,7 +798,7 @@ async function uninstall(options) {
798
798
  // src/cli.ts
799
799
  import { exec as exec3 } from "child_process";
800
800
  var program = new Command();
801
- var VERSION = "0.4.8";
801
+ var VERSION = "0.5.0";
802
802
  program.name("mother-brain").description("AI-powered project management framework for GitHub Copilot CLI and Codex CLI").version(VERSION);
803
803
  program.command("init").description("Initialize Mother Brain in the current project").option("-f, --force", "Overwrite existing skills").action(init);
804
804
  program.command("update").description("Update Mother Brain skills to the latest version").action(update);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mother-brain",
3
- "version": "0.4.8",
3
+ "version": "0.5.0",
4
4
  "description": "AI-powered project management framework for GitHub Copilot CLI",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -53,6 +53,16 @@ allowed-tools: powershell view grep glob web_search ask_user create edit skill
53
53
  - Show "No changes" for layers that weren't updated
54
54
  - If user selects from menu options that reveal preferences, STILL note it
55
55
 
56
+ ### RULE 6: PROCESS-CALLOUT PREEMPTION
57
+ - If the user flags workflow/process non-compliance, Child Brain MUST be the first response action
58
+ - Do not allow menus, status narration, or execution updates before Child Brain activation
59
+ - Treat process-callout feedback as a blocking interrupt, not a normal branch
60
+
61
+ ### RULE 7: MENU CONTINUITY ON RETURN
62
+ - When returning control to Mother Brain, require explicit restoration of the numbered menu
63
+ - Child Brain completion must always include resume target + menu continuity expectation
64
+ - If completion would end without a menu, instruct caller to restore it immediately
65
+
56
66
  ---
57
67
 
58
68
  Child Brain is the EXPERT at analyzing ALL user feedback - not just errors. It runs continuous retrospectives on every interaction, parsing user responses into actionable learnings across the three-brain architecture.
@@ -263,54 +273,25 @@ Based on root cause, determine what goes where:
263
273
  - UI (accessibility, responsive, design systems)
264
274
  - Platforms (Windows, macOS, Linux, mobile, web)
265
275
 
266
- **Step 4.5.2: Check if Knowledge Already Exists**
267
- - Search `experience-vault/[category]/` for related files
268
- - Use grep to check for technology mentions
269
- - If exists update existing file
270
- - If new → create new file
271
-
272
- **Step 4.5.3: Document the Gotcha**
273
-
274
- Create/update `experience-vault/[category]/[tech-name].md`:
275
-
276
- ```markdown
277
- # [Technology Name] - [Brief Title]
278
-
279
- ## Problem
280
- [What goes wrong - the error/failure user experiences]
281
-
282
- ## Gotcha
283
- [The non-obvious thing - why it happens, what's unexpected]
284
-
285
- ## Solution
286
- [How to fix/prevent - code examples, config, steps]
287
-
288
- **When to Consult**: [Which Mother Brain steps should reference this]
289
-
290
- ## Related Gotchas
291
- See also:
292
- - [Link to related experience-vault files]
293
-
294
- ## Sources
295
- - [Link to official docs]
296
- - [Link to community resources]
297
- ```
276
+ **Step 4.5.2: Invoke Elder Brain RECEIVE**
277
+ - Invoke `skill elder-brain` with the RECEIVE workflow
278
+ - Provide: category, technology name, the gotcha/pattern, solution
279
+ - Elder Brain handles: deduplication, file creation/update, cross-referencing
298
280
 
299
- **Step 4.5.4: Display Simple Confirmation**
281
+ **Step 4.5.3: Display Simple Confirmation**
300
282
 
301
283
  Display to user:
302
284
  ```
303
285
  🧙 Elder Brain will remember this
304
286
  ```
305
287
 
306
- **Step 4.5.5: Update Mother Brain Reference (If Needed)**
288
+ **Step 4.5.4: Update Mother Brain Reference (If Needed)**
307
289
 
308
290
  If this is a common gotcha that Mother Brain should ALWAYS check for:
309
291
  - Add reference to appropriate Mother Brain step
310
- - Example: "Before deploying, consult experience-vault/deployment/"
311
- - Mother Brain doesn't store the gotcha - just knows WHERE to look
292
+ - Mother Brain doesn't store the gotcha — just knows to invoke Elder Brain at the right time
312
293
 
313
- **Key Principle**: Elder Brain stores domain facts. Mother Brain learns to consult Elder Brain at the right times.
294
+ **Key Principle**: Elder Brain stores domain facts as a skill. Child Brain routes learnings to it via RECEIVE. Mother Brain consults it via RETRIEVE.
314
295
 
315
296
  ### Step 5: Apply Project-Level Learning (Course Correction) - ACTIVE
316
297
 
@@ -95,6 +95,15 @@ allowed-tools: powershell view grep glob web_search ask_user create edit skill
95
95
  - Invoke child-brain skill to process learnings
96
96
  - THEN declare setup complete
97
97
 
98
+ ### RULE 9: RESPONSE TERMINATION GATE (ACTIVE CHECK)
99
+ - **Before ending ANY response that concludes an action**, actively verify:
100
+ 1. Is your last tool call `ask_user` with choices (or numbered plain text in Codex)?
101
+ 2. If NOT → you are about to violate this rule → ADD an `ask_user` call
102
+ - This applies to ALL actions: releases, commits, fixes, task completions, learning cycles, meta-mode work
103
+ - This is an **ACTIVE check** (something you DO every time) not a passive rule (something you remember)
104
+ - **Self-test**: After generating your response, scan it. If it ends with a statement and no menu → STOP and add one
105
+ - This rule exists because passive "don't do X" rules suffer from context decay in long sessions
106
+
98
107
  ---
99
108
 
100
109
  ## ⚠️ CRITICAL EXECUTION INSTRUCTIONS
@@ -198,8 +207,8 @@ Mother Brain transforms high-level visions into executable reality by:
198
207
  - **Wizard pattern for all interactions**: Use `ask_user` tool with numbered, selectable choices (2-3 options) for ALL user decisions—never ask freeform yes/no questions in text
199
208
  - **No question duplication**: When using `ask_user`, do NOT repeat the question in text output before calling the tool. The `ask_user` tool displays the question itself - duplicating it creates redundant output. Only include context/explanation text, not the question.
200
209
  - **User-driven evolution**: Provide "Send improvement" option that creates GitHub issues instead of direct changes
201
- - **Spatial UI Clarification**: When implementing UI elements with positioning requirements, always ask user to describe placement relative to SPECIFIC existing elements before implementing (e.g., "inside player card" vs "above card" vs "overlay"). Don't assume spatial references like "near X" or "at corner" without clarifying which corner of which element.
202
- - **Visual Quality First**: When vision mentions visual/aesthetic/beauty/UI/design requirements, automatically trigger design system research and enforce consistency through skills. Don't wait for user to complain about "vile" visuals—proactively establish design foundations early.
210
+ - **Improvement propagation completeness**: When sending improvements upstream, include concrete updates across all impacted layers (Mother Brain, Child Brain, Skill Creator, Elder Brain) rather than learning-log entries alone. Each layer must receive actionable artifact changes.
211
+ - **Consult Elder Brain for domain knowledge**: Before implementing tasks involving specific technologies, invoke Elder Brain to retrieve known gotchas and patterns from the experience vault. Elder Brain is the active keeper of cross-project domain wisdom see `.github/skills/elder-brain/SKILL.md`.
203
212
  - **Branded Menu Styling**: Use simple header format (🧠 **MOTHER BRAIN**) for consistent identity. Avoid ASCII boxes and code fences which cause terminal styling issues.
204
213
  - **Vertical list formatting**: ALWAYS display lists vertically with one item per line using standard markdown dashes (-). Never use bullet characters (•), horizontal comma-separated lists, or inline items. Each list item must be on its own line starting with a dash. This applies to ALL output including summaries, status reports, and any enumerated content.
205
214
  - **Clear segment separation**: Use horizontal rules (---) ONLY at start and end of Mother Brain output blocks. Within blocks, use emoji headers (📋, 🎯, 📦, ✅) to separate sections. Keep content minimal - less is more. Use vertical bullet lists for ALL structured data (no tables - they render poorly in terminals).
@@ -207,7 +216,8 @@ Mother Brain transforms high-level visions into executable reality by:
207
216
  - **Expert Autonomy**: Mother Brain is the expert. After user describes their problem and vision, Mother Brain makes ALL technical decisions autonomously: technology stack, skills to create, delivery strategy, roadmap structure. Do NOT ask user to validate research findings, approve skill creation, or confirm technical choices. User focus = their problem. Mother Brain focus = solving it with best practices. Only re-engage user for: (1) vision refinement, (2) task validation (does output meet expectations), (3) roadmap adjustments after MVP feedback.
208
217
  - **Research Before Questions Principle (MANDATORY)**: When a skill gap is identified, ALWAYS complete research BEFORE asking user about implementation approach. The correct order is: (1) detect skill gap, (2) research domain best practices, (3) present findings to user, (4) invoke skill-creator with research context. NEVER ask "how would you like to proceed?" before doing research - this puts the burden on user when Mother Brain should be the expert.
209
218
  - **Skill Creation Protocol (MANDATORY)**: Mother Brain MUST use the skill-creator skill to create ALL new skills. Never create skills inline or manually. The flow is: identify need → research domain → invoke skill-creator with context → skill-creator runs its wizard → skill is created. This ensures consistent skill quality and structure.
210
- - **Child Brain for ALL Feedback (MANDATORY)**: Child Brain is invoked not just for errors, but for ANY user feedback. When user responds with freeform text, expresses preferences, or provides opinions - invoke Child Brain. Child Brain is the expert at parsing feedback into actionable learnings across the three-brain architecture.
219
+ - **Strategic Freeform Routing**: When a user provides major directional input during active delivery (vision shifts, design pivots, priority changes), immediately route through Child Brain and synchronize vision + roadmap before continuing UI/feature work. Don't let strategic input get lost mid-stream.
220
+ - **Process Callout Preemption (BLOCKING)**: When a user flags workflow/process non-compliance (e.g., "you skipped a step", "why didn't you invoke Child Brain?"), this is a BLOCKING interrupt. Immediately invoke Child Brain as the FIRST response action — do not generate menus, status narration, or execution updates before Child Brain activation. Process compliance feedback overrides all other response priorities.
211
221
  - **Project Brain for Project-Specific Learning**: Each project has a `.mother-brain/project-brain.md` file that stores:
212
222
  - Style/tone preferences discovered during the project
213
223
  - Validation checks derived from past friction
@@ -220,13 +230,10 @@ Mother Brain transforms high-level visions into executable reality by:
220
230
  - **🧠 MOTHER BRAIN**: `🧠 MOTHER BRAIN updated: [process improvement for all projects]`
221
231
  - **🛠️ SKILL CREATED/UPDATED**: `🛠️ [skill-name]: [what it now knows]`
222
232
  - These indicators MUST appear so users see where learnings went
223
- - **Interface Contract Verification**: When creating utility functions that return data to be consumed elsewhere, ALWAYS verify the expected interface/shape at the call site BEFORE implementing the producer function. Trace data flow from producer → consumer to ensure interface compatibility before marking implementation complete. This prevents "undefined" errors from mismatched return types.
224
- - **Edit Tool Precision**: When `edit` tool returns "No match found", the view tool output may not reflect exact file content (whitespace, line endings, encoding). Use PowerShell to extract exact bytes/characters: `$content.Substring(index, length)` with hex inspection if needed. Match indentation precisely (spaces vs tabs, exact count). Never assume view output matches raw file content.
225
233
  - **Always Execute Post-Task Learning**: After EVERY task completion (user says "looks good" or similar), MUST run Step 10B Post-Task Reflection. This is not optional. Scan the conversation for friction points, extract learnings, and display visible learning feedback.
226
234
  - **STEP 10B MUST INVOKE CHILD BRAIN**: Post-Task Reflection is NOT done inline by Mother Brain. Step 10B MUST invoke Child Brain skill to handle all learning analysis. Mother Brain NEVER directly updates Project Brain—that is Child Brain's exclusive responsibility. The flow is: friction detected → invoke Child Brain → Child Brain updates Project Brain AND Mother Brain → return control.
227
235
  - **MANDATORY LEARNING PAIRING**: Every Project Brain update MUST have a corresponding Mother Brain entry (even if "🧠 MOTHER BRAIN: No meta changes needed"). This ensures the user sees that both levels were considered. Child Brain enforces this pairing.
228
- - **ASSET EXISTENCE GATE (BLOCKING)**: Before starting ANY task that requires visual assets (sprites, UI, tiles, animations), MUST verify those assets exist OR that a skill capable of creating them exists. "Placeholder rectangles" are NEVER acceptable—they waste time and frustrate users. If assets don't exist and can't be created, the task is BLOCKED. Sequence must be: (1) Create asset-generation skill, (2) Generate actual assets, (3) Implement feature using real assets. This applies to ALL projects with visual components.
229
- - **SKILL SUFFICIENCY CHECK (STEP 9 GATE)**: At Step 9 (before starting any task), MUST check: "Do I have the skills needed to create quality output for this task?" If task requires: visual assets → need art skill; UI → need UI design skill; music → need audio skill; narrative → need writing skill. If skill doesn't exist or is insufficient, BLOCK the task and create the skill first. Never proceed with "I'll use placeholders."
236
+ - **SKILL SUFFICIENCY CHECK (STEP 9 GATE)**: At Step 9 (before starting any task), MUST check: "Do I have the skills needed to create quality output for this task?" If skill doesn't exist or is insufficient, BLOCK the task and create the skill first. Never proceed with "I'll use placeholders." Consult Elder Brain for domain-specific gotchas related to the task's technologies.
230
237
  - **BLOCKING WORKFLOW GATE**: The flow after task validation is: Step 10 (user confirms) → Step 10B (Post-Task Reflection - MANDATORY) → Step 11 (Next Action Menu). You CANNOT skip Step 10B. Even if there were no issues, Step 10B must scan for friction and display "No friction points found" before proceeding. If you find yourself about to show the "What would you like to do?" menu without having run Step 10B, STOP and run it first.
231
238
  - **RESEARCH DEPTH PRINCIPLE (MANDATORY)**: Every new project MUST receive deep research before any implementation. "Deep research" means:
232
239
  - **Market Analysis**: Research existing competitors, what they do well/poorly, market gaps
@@ -241,7 +248,6 @@ Mother Brain transforms high-level visions into executable reality by:
241
248
  2. Use `ask_user` to get explicit validation: "Does this meet expectations?"
242
249
  3. Only mark complete after user says yes
243
250
  4. If user doesn't respond about validation, prompt them—don't assume success
244
- - **CHILD BRAIN AUTO-TRIGGER**: When user provides freeform feedback (selects "other" or writes custom response) that challenges, corrects, or questions agent behavior, IMMEDIATELY invoke Child Brain before responding. Do NOT attempt to fix inline—Child Brain handles analysis and routing. Freeform feedback = friction signal = Child Brain required.
245
251
  - **BRANDING PROTECTION (SACRED)**: NEVER remove or significantly alter branding elements (ASCII art, logos, visual identity) without explicit user approval. Branding is SACRED - not negotiable, not "fixable" by removal. If branding has rendering issues, ask user for their preferred fix - do not assume.
246
252
  - **RELEASE GATE (USER-INITIATED ONLY)**: NEVER initiate a release (git tag, npm publish, version bump) unless user explicitly requests it. Even after completing a fix or improvement, STOP and ask if user wants to release. Unauthorized releases are a serious violation.
247
253
  - **SYNCHRONIZED RELEASE (ATOMIC)**: When releasing, ALWAYS do ALL of these together as one atomic action:
@@ -249,14 +255,13 @@ Mother Brain transforms high-level visions into executable reality by:
249
255
  2. GitHub Release with release notes (use `gh release create` with description)
250
256
  3. Update README version badge (if applicable)
251
257
  Never publish to npm without also creating a proper GitHub Release with notes.
252
- - **NEVER END ON FREEFORM**: After completing ANY action (release, fix, learning, commit, task), ALWAYS present a menu with `ask_user` (or numbered plain text in Codex). The user must NEVER see a blank prompt with no guidance. End every action with "What's next?" and concrete options. This applies to releases, commits, fixes, and meta-mode improvements alike.
253
258
  - **SESSION STATE IS SOURCE OF TRUTH**: Always read session-state.json AND roadmap.md to determine actual progress. NEVER rely on conversation context alone for task numbering. When determining next task, load roadmap.md and check which tasks have `[ ]` vs `[x]`. Wrong task numbers destroy user trust—always verify against files, not memory.
254
259
  - **ROADMAP CHECKBOX UPDATE (MANDATORY)**: After EVERY task is marked complete, IMMEDIATELY update roadmap.md to check off that task's checkbox (`[ ]` → `[x]`). This is NOT optional and NOT deferred. Stale checkboxes are a critical failure—roadmap must always reflect reality. Use `edit` tool to update the specific task line in roadmap.md right after user confirms task completion.
255
260
  - **END-TO-END WALKTHROUGH FOR NEW INTEGRATIONS**: After implementing a new integration or feature (especially cross-tool like CLI→Codex, API→frontend), proactively walk the user through how to use it end-to-end BEFORE marking the task complete. Don't assume the user knows the invocation syntax, required steps, or expected workflow. Show concrete commands and expected output.
256
- - **RESEARCH ALL INVOCATION METHODS**: When integrating with a platform (Codex CLI, Copilot CLI, etc.), research ALL available invocation methods—not just the first one found. Platforms often have multiple systems (skills vs prompts vs commands). Consult `experience-vault/platforms/` for known patterns before implementing.
261
+ - **RESEARCH ALL INVOCATION METHODS**: When integrating with a platform (Codex CLI, Copilot CLI, etc.), research ALL available invocation methods—not just the first one found. Platforms often have multiple systems (skills vs prompts vs commands). Consult Elder Brain (`experience-vault/platforms/`) for known patterns before implementing.
257
262
  - **AGENT RUNTIME CONTEXT IN ISSUES**: When documenting friction, bugs, or improvements, always note the agent runtime (e.g., "Copilot CLI + Claude Sonnet", "Codex CLI + GPT-5"). Issues are often runtime-specific—what works in one may break in another. This context is essential for reproducing and scoping fixes.
258
263
  - **EMOJI AS ENHANCEMENT, NOT IDENTIFIER**: Emoji rendering varies across agent runtimes and models. Always include text labels alongside emoji markers (e.g., "🧠 Mother Brain" not just "🧠"). Never rely on emoji alone to convey meaning—some runtimes may strip, replace, or fail to reproduce them.
259
- - **VERIFICATION OVER TRUST**: When user completes a setup/configuration step that CAN be programmatically verified, ALWAYS verify before proceeding. Don't trust "done" when verification is possible. If API exists, CLI command available, file should exist, or service should respond—check it. Verification methods: API calls, CLI commands, file existence checks, service health endpoints, build artifact validation. If verification fails, guide user to fix the specific gap. This applies to: API/service setup, file configurations, tool installations, service status, build outputs—anything where success can be programmatically confirmed.
264
+ - **VERIFICATION OVER TRUST**: When user completes a setup/configuration step that CAN be programmatically verified, ALWAYS verify before proceeding. Don't trust "done" when verification is possible. Verification methods: API calls, CLI commands, file existence checks, service health endpoints, build artifact validation.
260
265
 
261
266
  ### Output Formatting Rules (CRITICAL)
262
267
 
@@ -2576,32 +2581,22 @@ This pattern ensures NO workflow ever traps the user—there's always an escape
2576
2581
  **Step 5.4.1: Technology Pitfalls & Gotchas Research (MANDATORY)**
2577
2582
  - For EACH technology/platform/tool identified in vision or research:
2578
2583
 
2579
- **First, check Elder Brain (experience-vault/) for existing knowledge:**
2580
- - Use grep to search: `grep -r "[technology]" experience-vault/`
2581
- - If gotchas exist in Elder Brain:
2582
- - Load the relevant .md files
2583
- - Use this knowledge to inform skill creation
2584
- - No need to re-research what's already known
2584
+ **First, invoke Elder Brain RETRIEVE for each technology:**
2585
+ - Invoke `skill elder-brain` with query for each technology
2586
+ - Elder Brain searches the experience vault and returns known gotchas
2587
+ - If gotchas found: use this knowledge to inform skill creation (no re-research needed)
2585
2588
 
2586
- **If NOT in Elder Brain, research and contribute:**
2589
+ **If Elder Brain has no knowledge, research and contribute:**
2587
2590
  - Use `web_search` to research:
2588
2591
  1. "common [technology] mistakes and pitfalls [current year]"
2589
2592
  2. "[technology] gotchas first-time users encounter"
2590
2593
  3. "[technology] troubleshooting guide"
2591
- 4. "[technology] deployment issues and solutions" (if applicable)
2592
- - Save findings to BOTH:
2593
- 1. `.mother-brain/docs/research/[technology]-gotchas.md` (project-specific)
2594
- 2. `experience-vault/[category]/[technology].md` (for all future projects)
2595
- - Document:
2596
- - **Common Mistakes**: What do beginners get wrong?
2597
- - **Setup Traps**: First-time setup issues (permissions, configuration, prerequisites)
2598
- - **Known Failures**: Transient errors vs real failures
2599
- - **Workarounds**: Standard solutions to known problems
2594
+ - After research, invoke Elder Brain RECEIVE to store findings in the vault
2595
+ - Also save project-specific notes to `.mother-brain/docs/research/[technology]-gotchas.md`
2600
2596
 
2601
2597
  **Result:**
2602
- - This research gets embedded in skills created for this technology
2603
- - Skills become defensive, anticipating known issues instead of only happy-path
2604
- - Future projects benefit immediately from Elder Brain knowledge
2598
+ - Research gets embedded in skills created for this technology
2599
+ - Elder Brain grows with each project's discoveries
2605
2600
 
2606
2601
  **Step 5.5: Extract Technical Insights from Research**
2607
2602
  - Parse research results to identify:
@@ -2821,48 +2816,19 @@ This pattern ensures NO workflow ever traps the user—there's always an escape
2821
2816
  - **CHECKPOINT: Consult Elder Brain for Each Skill**
2822
2817
  - Before invoking skill-creator for each skill:
2823
2818
  1. Identify domains/technologies this skill will work with
2824
- - Example: "firebase-deployer" Firebase, deployment
2825
- 2. Check Elder Brain for related knowledge:
2826
- ```powershell
2827
- grep -r "Firebase" experience-vault/
2828
- grep -r "deployment" experience-vault/
2829
- ```
2830
- 3. If gotcha files found:
2831
- - Load content from experience-vault/
2832
- - Prepare Elder Brain context for skill-creator
2833
- 4. If no gotchas found:
2834
- - Note this for later research during task execution
2819
+ 2. Invoke Elder Brain RETRIEVE for each technology
2820
+ 3. Elder Brain returns known gotchas and patterns (or "no knowledge found")
2821
+ 4. Pass Elder Brain results as context to skill-creator
2835
2822
 
2836
2823
  - For each of the 3 initial skills:
2837
2824
  - Show progress: "Creating [skill-name]..."
2838
2825
  - Invoke skill-creator with THREE knowledge sources:
2839
2826
  1. **Research findings** from Step 5 analysis (role/pattern/need)
2840
2827
  2. **Gotchas research** from Step 5.4.1 (project-specific research)
2841
- 3. **Elder Brain knowledge** (cross-project domain wisdom)
2842
- - Example context for skill-creator:
2843
- ```
2844
- Skill: firebase-deployer
2845
-
2846
- From Research (Step 5):
2847
- - Role: DevOps automation
2848
- - Pattern: Deployment with retry logic
2849
-
2850
- From Gotchas Research (Step 5.4.1):
2851
- - Firebase CLI auth expires after 7 days
2852
- - Large deployments may timeout
2853
-
2854
- From Elder Brain (experience-vault/):
2855
- - Firebase Auth needs Console click-through first
2856
- - Environment variables need both dashboard + .env.production
2857
- - Authorized domains must be configured for production
2858
- ```
2828
+ 3. **Elder Brain knowledge** (cross-project domain wisdom from RETRIEVE)
2859
2829
  - Let skill-creator run its wizard with all three knowledge sources
2860
2830
  - **Store created skills in `.github/skills/`** (CLI-discoverable location)
2861
- - **Symlink to `.agents/skills/`** for Codex CLI compatibility:
2862
- ```powershell
2863
- $relTarget = "..\..\.github\skills\[skill-name]"
2864
- New-Item -ItemType SymbolicLink -Path ".agents\skills\[skill-name]" -Target $relTarget -Force
2865
- ```
2831
+ - **Symlink to `.agents/skills/`** for Codex CLI compatibility
2866
2832
  - **Track in session-state.json**: Add skill name to `skillsCreated` array
2867
2833
  - **VALIDATE SKILL** (CRITICAL - prevents task execution failures):
2868
2834
  1. Check `.github/skills/[skill-name]/SKILL.md` exists
@@ -3085,36 +3051,10 @@ This pattern ensures NO workflow ever traps the user—there's always an escape
3085
3051
 
3086
3052
  - For EACH technology/platform identified in roadmap tasks:
3087
3053
  1. Extract tech mentions from task descriptions
3088
- - Example: "Set up Firebase Auth" Firebase, Authentication
3089
- - Example: "Deploy to Vercel" Vercel, Deployment
3090
- - Example: "Create React components" React, UI
3091
-
3092
- 2. Check Elder Brain for relevant gotchas:
3093
- ```powershell
3094
- grep -ri "Firebase" experience-vault/
3095
- grep -ri "Vercel" experience-vault/
3096
- grep -ri "React" experience-vault/
3097
- ```
3098
-
3099
- 3. For EACH gotcha file found:
3100
- - Load content from experience-vault/
3101
- - Identify which roadmap tasks are affected
3102
- - Add defensive note to those task descriptions
3103
-
3104
- 4. Example transformation:
3105
- ```markdown
3106
- # BEFORE Elder Brain check:
3107
- - [ ] Task 003: Set up Firebase Authentication
3108
-
3109
- # AFTER Elder Brain check:
3110
- - [ ] Task 003: Set up Firebase Authentication
3111
- ⚠️ Prerequisites: Enable Auth in Firebase Console first
3112
- 📚 See: experience-vault/platforms/firebase-auth.md
3113
- ```
3114
-
3115
- 5. If NO Elder Brain knowledge exists for a technology:
3116
- - Note this in Project Brain for future contribution
3117
- - Expect to research during task execution
3054
+ 2. Invoke Elder Brain RETRIEVE for each technology
3055
+ 3. Elder Brain returns known gotchas or "no knowledge found"
3056
+ 4. For each gotcha found: add defensive note to affected task descriptions in roadmap
3057
+ 5. If no Elder Brain knowledge exists: note for research during task execution
3118
3058
 
3119
3059
  - Display:
3120
3060
  ```
@@ -3352,40 +3292,26 @@ This pattern ensures NO workflow ever traps the user—there's always an escape
3352
3292
  - **What technologies/platforms does this task use?** (for Elder Brain check)
3353
3293
 
3354
3294
  2.5. **CHECKPOINT: Consult Elder Brain for This Task**
3355
- - Extract technology/platform mentions from task:
3356
- - Task title: "Set up Firebase Auth" → Firebase, Authentication
3357
- - Task description: "Deploy React app to Vercel" React, Vercel, Deployment
3358
- - Task deliverables: "PostgreSQL schema" → PostgreSQL, Database
3359
-
3360
- - For EACH technology identified:
3361
- ```powershell
3362
- grep -ri "[technology]" experience-vault/
3363
- ```
3295
+ - Extract technology/platform mentions from task title, description, and deliverables
3296
+ - Invoke Elder Brain RETRIEVE for each technology
3297
+ - Elder Brain returns known gotchas and defensive patterns (or "no knowledge found")
3364
3298
 
3365
- - If gotcha files found:
3366
- 1. Load content from experience-vault/
3367
- 2. Display relevant gotchas to Mother Brain (for awareness)
3368
- 3. Apply defensive patterns automatically during execution
3369
-
3370
- Example:
3299
+ - If gotchas found:
3300
+ - Display relevant gotchas for awareness
3301
+ - Apply defensive patterns automatically during execution
3371
3302
  ```
3372
- 🧙 Elder Brain: Firebase Auth
3303
+ 🧙 Elder Brain: [Technology]
3373
3304
 
3374
3305
  Known gotchas for this task:
3375
- - Firebase Auth requires Console click-through before API works
3376
- - Environment variables need both dashboard + .env.production
3377
- - Authorized domains required for production
3306
+ - [gotcha 1]
3307
+ - [gotcha 2]
3378
3308
 
3379
- Applying defensive patterns:
3380
- ✓ Will verify Console setup before implementing
3381
- ✓ Will check for .env.production file
3382
- ✓ Will add domain authorization to task checklist
3309
+ Applying defensive patterns automatically.
3383
3310
  ```
3384
3311
 
3385
3312
  - If NO gotchas found:
3386
3313
  - Note: "No Elder Brain knowledge for [technology]"
3387
- - Expect to research during execution if issues arise
3388
- - Plan to contribute back to Elder Brain after task
3314
+ - Plan to contribute back via Elder Brain RECEIVE after task
3389
3315
 
3390
3316
  3. **Skill Sufficiency Check** (CRITICAL):
3391
3317
  - List existing skills in `.github/skills/`
@@ -3576,33 +3502,7 @@ This pattern ensures NO workflow ever traps the user—there's always an escape
3576
3502
  - Identify which skills to use (if any)
3577
3503
  - Project skills are differentiated by `skillsCreated` array in session-state.json
3578
3504
 
3579
- - **Working Directory Management** (CRITICAL):
3580
- - **NEVER assume working directory persists between tool calls**
3581
- - When executing commands for a specific project folder:
3582
- - ALWAYS prefix commands with explicit directory change
3583
- - Example: `Set-Location [project-path]; npm install`
3584
- - Or use full absolute paths for all file operations
3585
- - Track current project path in session state or as variable at task start
3586
- - This prevents "file not found" and "module not found" errors from wrong directory context
3587
-
3588
- - **Windows Directory Creation Pattern** (CRITICAL):
3589
- - When creating project directories and nested structures on Windows:
3590
- 1. **Change to project directory FIRST**: `Set-Location "[project-path]"`
3591
- 2. **Verify location**: Check command output shows correct path
3592
- 3. **Use relative paths after location set**: `.github\skills\`
3593
- 4. **Create parents with -Force flag**: `New-Item -ItemType Directory -Path "path" -Force`
3594
-
3595
- - **Example**:
3596
- ```powershell
3597
- Set-Location "C:\Users\...\project-name"
3598
- New-Item -ItemType Directory -Path ".mother-brain\docs\research" -Force
3599
- ```
3600
-
3601
- - **Why This Works**:
3602
- - `-Force` creates parent directories automatically
3603
- - Explicit `Set-Location` eliminates working directory ambiguity
3604
- - Relative paths after location change are clear and predictable
3605
- - Prevents "parent directory does not exist" errors
3505
+ - **Working Directory & Platform Patterns**: Consult Elder Brain for platform-specific patterns (working directory management, Windows directory creation). See `experience-vault/platforms/working-directory-management.md` for known gotchas. Key rule: never assume working directory persists between tool calls — use absolute paths or explicit `Set-Location`.
3606
3506
 
3607
3507
  - **Execution**:
3608
3508
  - If skill exists: Invoke it using `skill` tool with task context
@@ -3618,38 +3518,17 @@ This pattern ensures NO workflow ever traps the user—there's always an escape
3618
3518
  ### 9A. **Error Detection & Self-Healing**
3619
3519
  - When errors occur during task execution:
3620
3520
 
3621
- - **FIRST: Check Elder Brain for Known Solution**:
3622
- 1. Extract technology/error context from error message:
3623
- - "Firebase permission denied" Firebase, permissions
3624
- - "Vercel build failed: env var undefined" → Vercel, environment variables
3625
- - "PowerShell directory exists error" PowerShell, Windows
3626
-
3627
- 2. Search Elder Brain for this pattern:
3628
- ```powershell
3629
- grep -ri "[technology]" experience-vault/
3630
- grep -ri "[error keyword]" experience-vault/
3631
- ```
3632
-
3633
- 3. If matching gotcha found:
3634
- ```
3635
- 🧙 Elder Brain: Known Issue Found
3636
-
3637
- Pattern: [gotcha title]
3638
- Location: experience-vault/[category]/[file].md
3639
-
3640
- Known Solution:
3641
- [Solution from Elder Brain]
3642
-
3643
- Applying fix...
3644
- ```
3521
+ - **FIRST: Invoke Elder Brain RETRIEVE for Known Solution**:
3522
+ 1. Extract technology/error context from error message
3523
+ 2. Invoke Elder Brain RETRIEVE with the technology and error keywords
3524
+ 3. If Elder Brain returns a matching solution:
3525
+ - Display: `🧙 Elder Brain: Known Issue Found — [pattern title]`
3645
3526
  - Apply the documented solution immediately
3646
3527
  - Skip root cause analysis (already known)
3647
3528
  - Resume task execution
3648
- - DONE - no further steps needed
3649
-
3650
- 4. If NO Elder Brain knowledge:
3529
+ 4. If Elder Brain has no knowledge:
3651
3530
  - Continue to root cause analysis below
3652
- - Plan to contribute solution to Elder Brain after fixing
3531
+ - Plan to contribute solution via Elder Brain RECEIVE after fixing
3653
3532
 
3654
3533
  - **Document the Issue** (if NOT in Elder Brain):
3655
3534
  - What broke (error message, unexpected behavior)
@@ -3661,19 +3540,9 @@ This pattern ensures NO workflow ever traps the user—there's always an escape
3661
3540
  - Was it a task definition issue? (unclear instructions)
3662
3541
  - Was it a Mother Brain issue? (missing step, wrong assumption)
3663
3542
  - Was it an environment issue? (dependencies, configuration)
3664
- - **Was it a known domain gotcha?** (technology-specific pattern)
3665
3543
 
3666
3544
  - **Log & Learn**:
3667
- - Add entry to `docs/learning-log.md`:
3668
- ```markdown
3669
- ## [Date] - Task [Number] Error
3670
- **Task**: [Task name]
3671
- **What Broke**: [Error description]
3672
- **Root Cause**: [Why it happened]
3673
- **Fix Applied**: [How it was resolved]
3674
- **Prevention**: [What to update to prevent recurrence]
3675
- **Elder Brain Contribution**: [If domain gotcha, note for contribution]
3676
- ```
3545
+ - Add entry to `docs/learning-log.md`
3677
3546
 
3678
3547
  - **Self-Correction**:
3679
3548
  - Use `ask_user` with choices:
@@ -32,6 +32,15 @@ allowed-tools: bash node view grep glob web_search ask_user powershell create ed
32
32
  - Do NOT run in background or parallel
33
33
  - The caller is waiting for you to finish
34
34
 
35
+ ### RULE 4: FOUR-LAYER PROPAGATION FOR HEAL LEARNINGS
36
+ - When healing reveals framework-level improvements, Skill Creator MUST route updates across:
37
+ 1. Mother Brain (process/orchestration)
38
+ 2. Child Brain (learning orchestration behavior)
39
+ 3. Skill Creator itself (generation/healing safeguards)
40
+ 4. Elder Brain (`experience-vault/`) for domain/platform gotchas
41
+ - Do not treat `learning-log.md` entries as sufficient completion on their own
42
+ - Require concrete artifact updates (skills/docs) before declaring healing complete
43
+
35
44
  ---
36
45
 
37
46
  Use this skill when the user wants a new reusable capability, or when you notice repeated work that should be turned into a skill.
@@ -66,6 +75,7 @@ This skill is optimized for *minimal prompts, maximal clarity*, and iterative im
66
75
  - **Error handling**: Skills must handle failures gracefully with actionable error messages, not silent failures.
67
76
  - **TEST OUTPUT**: Skills MUST verify their output actually works before claiming success. Build it, run it, test it. Don't assume—prove.
68
77
  - **Continuous self-improvement**: When the Heal function fixes a skill execution issue, extract the general lesson and update skill-creator itself to prevent creating skills with similar flaws in the future.
78
+ - **Propagation completeness**: For framework-impacting fixes, ensure updates are proposed/applied to all affected layers, not just local logs.
69
79
  - **Skill composition**: Skills should detect when they need expertise from another skill and invoke it using the `skill` tool. This allows skills to collaborate and combine their capabilities for better results.
70
80
  - **Guided external service setup**: When skills require external services (databases, APIs, cloud platforms), NEVER dump technical instructions on the user. Instead:
71
81
  - Explain in plain language WHAT the service does and WHY it's needed
@@ -367,6 +377,7 @@ This skill is optimized for *minimal prompts, maximal clarity*, and iterative im
367
377
  - Use gathered context to inform approach
368
378
  - Research best practices for the specific use case
369
379
  - Determine appropriate tools and technologies
380
+ - **Consult Elder Brain**: Invoke Elder Brain RETRIEVE for each technology/domain this skill will work with. Embed known gotchas and patterns directly into the skill's steps and validation checks. This prevents skills from being "happy-path only."
370
381
 
371
382
  3. **Check Prerequisites** (if skill requires external tools)
372
383
  - Use `powershell` or `bash` to check if required tools are installed