11---
2- description : Capture a memory (decision, learning, context, preference, or pattern ) to the git-backed memory system
3- argument-hint : " [type] content to capture "
2+ description : Capture a memory (decision, learning, blocker, progress, etc. ) to the git-backed memory system
3+ argument-hint : " [namespace] <summary> -- <content> "
44allowed-tools : ["Bash", "Write", "Read", "AskUserQuestion"]
55---
66
@@ -17,83 +17,122 @@ You will help the user capture a memory. The memory will be stored as a git note
1717** Arguments format** : ` $ARGUMENTS `
1818
1919Parse the arguments:
20- 1 . If first word is a known type (` decision ` , ` learning ` , ` context ` , ` preference ` , ` pattern ` ), use it as the memory type
21- 2 . Everything else is the memory content
22- 3 . If no type specified, auto-detect based on content patterns:
23- - Contains "decided", "chose", "will use" → ` decision `
24- - Contains "learned", "discovered", "TIL", "found out" → ` learning `
25- - Contains "remember", "note that", "keep in mind" → ` context `
26- - Contains "prefer", "always", "never", "should" → ` preference `
27- - Contains "pattern", "recurring", "often" → ` pattern `
28- - Default → ` context `
20+ 1 . If first word matches a known namespace, use it as the namespace
21+ 2 . Look for ` -- ` separator: text before is summary, text after is content
22+ 3 . If no ` -- ` separator, use the entire text as both summary (truncated) and content
23+
24+ ** Valid namespaces** : ` decisions ` , ` learnings ` , ` blockers ` , ` progress ` , ` reviews ` , ` patterns ` , ` retrospective ` , ` inception ` , ` elicitation ` , ` research `
25+
26+ If no namespace specified, auto-detect based on content patterns:
27+ - Contains "decided", "chose", "will use" → ` decisions `
28+ - Contains "learned", "discovered", "TIL", "found out" → ` learnings `
29+ - Contains "blocked", "stuck", "cannot", "impediment" → ` blockers `
30+ - Contains "completed", "finished", "milestone" → ` progress `
31+ - Contains "pattern", "recurring", "often" → ` patterns `
32+ - Default → ` learnings `
2933
3034### Step 2: Validate Content
3135
3236If ` $ARGUMENTS ` is empty or very short (< 10 characters):
3337- Use AskUserQuestion to prompt for the memory content
3438- Question: "What would you like to capture?"
35- - Options: provide example prompts for each memory type
39+ - Provide examples for each memory type
3640
3741### Step 3: Capture the Memory
3842
3943Use Bash to invoke the Python library:
4044
4145``` bash
42- python3 -c "
46+ uv run python3 -c "
4347from git_notes_memory import get_capture_service
4448
4549capture = get_capture_service()
46- memory = capture.capture_$TYPE (
50+ result = capture.capture(
51+ namespace='$NAMESPACE ',
52+ summary='''$SUMMARY ''',
4753 content='''$CONTENT ''',
48- source='command',
4954)
50- print(f'✅ Captured as {memory.namespace}: {memory.id[:8]}...')
51- print(f' Summary: {memory.title or memory.content[:60]}...')
55+
56+ if result.success:
57+ print(f'Captured as {result.memory.namespace}: {result.memory.id[:16]}...')
58+ print(f'Summary: {result.memory.summary}')
59+ if result.warning:
60+ print(f'Warning: {result.warning}')
61+ else:
62+ print(f'Capture failed')
5263"
5364```
5465
5566Replace:
56- - ` $TYPE ` with the memory type method: ` capture_decision ` , ` capture_learning ` , ` capture_context ` , ` capture_preference ` , ` capture_pattern `
57- - ` $CONTENT ` with the user's content (escape quotes properly)
67+ - ` $NAMESPACE ` with the detected namespace
68+ - ` $SUMMARY ` with a one-line summary (max 100 chars, escape quotes)
69+ - ` $CONTENT ` with the full content (escape quotes)
5870
5971### Step 4: Confirm to User
6072
6173Show the result:
6274```
63- ✅ Memory captured!
75+ Memory captured!
6476
65- **Type **: decision
66- **ID**: abc12345...
77+ **Namespace **: decisions
78+ **ID**: decisions:abc123:0
6779**Summary**: Use PostgreSQL for the main database...
6880
6981This memory will be available for recall in future sessions.
7082Use `/memory:recall` to retrieve it.
7183```
7284
73- ## Memory Types Reference
74-
75- | Type | Use For | Example |
76- | ------| ---------| ---------|
77- | ` decision ` | Architectural or design decisions | "Use PostgreSQL for JSONB support" |
78- | ` learning ` | New knowledge or discoveries | "pytest fixtures can be module-scoped" |
79- | ` context ` | Project-specific information | "This project uses tabs for indentation" |
80- | ` preference ` | User preferences | "Prefer functional style over classes" |
81- | ` pattern ` | Recurring patterns | "Error handling follows Result pattern" |
85+ ## Namespace Reference
86+
87+ | Namespace | Use For | Example |
88+ | -----------| ---------| ---------|
89+ | ` decisions ` | Architectural or design decisions | "Use PostgreSQL for JSONB support" |
90+ | ` learnings ` | New knowledge or discoveries | "pytest fixtures can be module-scoped" |
91+ | ` blockers ` | Obstacles and impediments | "API rate limiting blocking progress" |
92+ | ` progress ` | Milestones and completions | "Completed Phase 1 implementation" |
93+ | ` reviews ` | Code review findings | "Found SQL injection in auth module" |
94+ | ` patterns ` | Recurring patterns | "Error handling follows Result pattern" |
95+ | ` retrospective ` | Post-mortems and retrospectives | "Project completed successfully" |
96+ | ` inception ` | Problem statements and scope | "Building a memory plugin for Claude" |
97+ | ` elicitation ` | Requirements clarifications | "Must support offline mode" |
98+ | ` research ` | External findings | "Evaluated 3 embedding models" |
99+
100+ ## Convenience Methods
101+
102+ For structured captures, the library also provides:
103+ - ` capture_decision(spec, summary, context, rationale, alternatives) ` - Decisions with rationale
104+ - ` capture_blocker(spec, summary, description, impact) ` - Blockers with impact
105+ - ` capture_learning(summary, insight, context) ` - Learnings with context
106+ - ` capture_progress(spec, summary, milestone, details) ` - Progress updates
107+ - ` capture_pattern(summary, pattern_type, evidence, confidence) ` - Patterns
108+ - ` capture_review(spec, summary, findings, verdict) ` - Code reviews
82109
83110## Error Handling
84111
85112If the capture fails:
861131 . Check if we're in a git repository: ` git rev-parse --git-dir `
87- 2 . Check if the library is installed: ` python3 -c "import git_notes_memory" `
114+ 2 . Check if the library is installed: ` uv run python3 -c "import git_notes_memory"`
881153 . Show helpful error message with recovery action
89116
90117## Examples
91118
92- ** User** : ` /memory:capture decision Use Redis for session storage due to built-in expiration `
93- ** Action** : Capture as decision type
119+ ** User** : ` /memory:capture decisions Use Redis for session storage -- Due to built-in expiration and cluster support `
120+ ** Action** : Capture as decisions namespace with structured content
94121
95122** User** : ` /memory:capture TIL you can use pytest -k to filter tests by name `
96- ** Action** : Auto-detect as learning (contains "TIL")
123+ ** Action** : Auto-detect as learnings (contains "TIL"), content becomes both summary and body
97124
98125** User** : ` /memory:capture This project requires Python 3.10+ `
99- ** Action** : Auto-detect as context (general information)
126+ ** Action** : Auto-detect as learnings (general information)
127+
128+ ## Memory Capture Reminder
129+
130+ After successfully capturing a memory, remind the user:
131+
132+ ```
133+ 💡 **Pro tip**: You can capture memories inline using markers:
134+ - `[remember] <insight>` - Captures a learning
135+ - `[capture] <decision>` - Captures any type of memory
136+ - `@memory <content>` - Same as [capture]
137+
138+ These markers work anywhere in your message and are automatically processed.
0 commit comments