Capture comprehensive problem-solving narratives from our work sessions, documenting not just the solution but the entire journey of discovery.
This command captures the full narrative of problem-solving: what we thought was true, what we discovered was actually true, the troubleshooting journey, and the lessons learned. This narrative format makes it easy to harvest insights for updating documentation, commands, or pipelines.
# Interactive mode - guides you through the narrative
bun ${PAI_DIR}/commands/capture-learning.ts
# Direct mode with full narrative (all 6 arguments)
bun ${PAI_DIR}/commands/capture-learning.ts "problem" "initial assumption" "actual reality" "troubleshooting steps" "solution" "key takeaway"When you say any of these, I'll capture our learning:
- "Great job, log this"
- "Nice work, make a record"
- "Document this"
- "Capture this learning"
- "Save this for later"
- "That worked!"
The command captures a complete story with these elements:
- The Problem - What issue did we encounter?
- Initial Assumption - "We thought this was true..."
- Actual Reality - "What we realized was actually true..."
- Troubleshooting Journey - Steps we took to discover the truth
- The Solution - What finally worked
- The Takeaway - "So now we know..." or "So now we do it this way..."
This narrative approach helps us:
- Remember the journey, not just the destination
- Understand WHY the solution works
- Recognize similar patterns in future problems
- Update our mental models and documentation
- Share knowledge effectively with others
Files are saved to: ${PAI_DIR}/context/learnings/
Named with format: YYYY-MM-DD-problem-description.md
Each file contains:
- Full narrative story
- Before/after comparison
- Technical details and commands used
- Actionable takeaways for future reference
A captured learning looks like this:
# Learning: Fixed TypeScript Module Resolution Error
## The Full Story
### The Problem We Encountered
TypeScript couldn't find our custom modules...
### What We Initially Thought
We thought the tsconfig paths were incorrectly configured...
### What We Discovered Was Actually True
The issue was actually with the module resolution strategy...
### The Journey: Troubleshooting Steps
1. Checked tsconfig.json paths
2. Verified file locations
3. Tested different module resolution strategies...
### The Solution That Worked
Changed moduleResolution from "node" to "bundler"...
## The Lesson Learned
**So now we know:** TypeScript's module resolution depends on the bundler being used...The TypeScript implementation for this command is in capture-learning.ts.
The command:
- Prompts for all 6 narrative elements if not provided
- Creates a structured markdown file in
${PAI_DIR}/context/learnings/ - Names files with date and problem description
- Generates a comprehensive learning narrative