Skip to content

Commit 8a2d77b

Browse files
feat(plugins): add StackMemory plugin for Claude Code
Adds a Claude Code plugin with slash commands for StackMemory: - /sm-status, /sm-capture, /sm-restore - Session handoffs - /sm-decision, /sm-memory - Record context - /sm-context, /sm-tasks, /sm-log, /sm-clear - Management Also adds `stackmemory setup-plugins` CLI command to install plugins to ~/.claude/plugins/ via symlink.
1 parent b1f96dc commit 8a2d77b

File tree

13 files changed

+530
-0
lines changed

13 files changed

+530
-0
lines changed
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"name": "stackmemory",
3+
"version": "1.0.0",
4+
"description": "StackMemory integration for Claude Code - context persistence, session handoffs, and memory management",
5+
"author": {
6+
"name": "StackMemory",
7+
"url": "https://github.com/stackmemoryai/stackmemory"
8+
}
9+
}

plugins/stackmemory/README.md

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
# StackMemory Plugin for Claude Code
2+
3+
Context persistence and session handoffs for Claude Code.
4+
5+
## Installation
6+
7+
### Option 1: Via StackMemory CLI
8+
9+
```bash
10+
stackmemory setup-plugins
11+
```
12+
13+
### Option 2: Manual Symlink
14+
15+
```bash
16+
ln -s "$(npm root -g)/@stackmemoryai/stackmemory/plugins/stackmemory" ~/.claude/plugins/stackmemory
17+
```
18+
19+
### Option 3: Copy
20+
21+
```bash
22+
cp -r plugins/stackmemory ~/.claude/plugins/
23+
```
24+
25+
## Commands
26+
27+
| Command | Description |
28+
|---------|-------------|
29+
| `/sm-status` | Show StackMemory status and context |
30+
| `/sm-capture` | Capture work state for session handoff |
31+
| `/sm-restore` | Restore context from last handoff |
32+
| `/sm-decision` | Record a key decision |
33+
| `/sm-memory` | Store a memory/observation |
34+
| `/sm-context` | Manage context frames |
35+
| `/sm-tasks` | Manage tasks |
36+
| `/sm-log` | View activity log |
37+
| `/sm-clear` | Clear context with ledger |
38+
| `/sm-help` | Show plugin help |
39+
40+
## Workflow
41+
42+
### Starting a Session
43+
44+
```
45+
/sm-restore
46+
```
47+
48+
Loads the last captured handoff context.
49+
50+
### During Work
51+
52+
```
53+
/sm-decision "Use PostgreSQL for persistence"
54+
/sm-memory "User prefers TypeScript"
55+
```
56+
57+
Record important decisions and observations.
58+
59+
### Ending a Session
60+
61+
```
62+
/sm-capture
63+
```
64+
65+
Captures current state for the next session.
66+
67+
## Integration with MCP
68+
69+
StackMemory also provides an MCP server for Claude Desktop:
70+
71+
```bash
72+
stackmemory setup-mcp
73+
```
74+
75+
This registers tools like `context_add`, `decision_record`, `memory_store` that can be called directly by Claude.
76+
77+
## Learn More
78+
79+
- [StackMemory Documentation](https://github.com/stackmemoryai/stackmemory)
80+
- [Claude Code Plugins](https://docs.anthropic.com/claude-code/plugins)
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
---
2+
description: "Capture current work state for session handoff"
3+
argument-hint: "[--no-commit] [--copy] [--basic]"
4+
allowed-tools: ["Bash(stackmemory capture:*)"]
5+
---
6+
7+
# StackMemory Capture
8+
9+
Capture the current work state for handoff to a future session:
10+
11+
```!
12+
stackmemory capture $ARGUMENTS
13+
```
14+
15+
Options:
16+
- `--no-commit` - Skip git commit
17+
- `--copy` - Copy handoff prompt to clipboard
18+
- `--basic` - Use basic format instead of enhanced
19+
20+
The capture includes:
21+
- Active context frames
22+
- Recent decisions
23+
- Git status and last commit
24+
- In-progress tasks
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
---
2+
description: "Clear context with ledger preservation"
3+
argument-hint: "[--save] [--restore] [--check]"
4+
allowed-tools: ["Bash(stackmemory clear:*)"]
5+
---
6+
7+
# StackMemory Clear
8+
9+
Manage context clearing with ledger preservation:
10+
11+
## Check context usage
12+
```!
13+
stackmemory clear --check
14+
```
15+
16+
## Save to ledger before clearing
17+
```!
18+
stackmemory clear --save
19+
```
20+
21+
## Restore from ledger
22+
```!
23+
stackmemory clear --restore
24+
```
25+
26+
The ledger system preserves important context across /clear operations,
27+
allowing continuity between conversation resets.
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
---
2+
description: "Manage context frames and stack"
3+
argument-hint: "<subcommand> [args]"
4+
allowed-tools: ["Bash(stackmemory context:*)", "Bash(stackmemory ctx:*)"]
5+
---
6+
7+
# StackMemory Context
8+
9+
Manage the context stack:
10+
11+
## View current context
12+
```!
13+
stackmemory context show
14+
```
15+
16+
## Load recent context
17+
```!
18+
stackmemory context load --recent
19+
```
20+
21+
## Add context observation
22+
```!
23+
stackmemory context add observation "User is working on auth feature"
24+
```
25+
26+
## Add context decision
27+
```!
28+
stackmemory context add decision "Use JWT for authentication"
29+
```
30+
31+
## Clear context (with preservation)
32+
```!
33+
stackmemory context clear --save
34+
```
35+
36+
Subcommands:
37+
- `show` - Display current context stack
38+
- `load` - Load context from storage
39+
- `add` - Add observation or decision
40+
- `clear` - Clear context with optional ledger save
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
---
2+
description: "Record a key decision for session context"
3+
argument-hint: "<decision> [--reason <why>]"
4+
allowed-tools: ["Bash(stackmemory decision:*)"]
5+
---
6+
7+
# StackMemory Decision
8+
9+
Record a key decision for session context and future handoffs:
10+
11+
```!
12+
stackmemory decision add $ARGUMENTS
13+
```
14+
15+
Examples:
16+
- `stackmemory decision add "Use PostgreSQL for persistence"`
17+
- `stackmemory decision add "Switch to ESM modules" --reason "Better tree shaking"`
18+
19+
Decisions are captured in handoffs and help future sessions understand context.
20+
21+
To list decisions:
22+
```!
23+
stackmemory decision list
24+
```
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
---
2+
description: "Show StackMemory plugin help"
3+
---
4+
5+
# StackMemory Plugin Help
6+
7+
StackMemory provides context persistence and session handoffs for Claude Code.
8+
9+
## Available Commands
10+
11+
### Session Handoffs
12+
- `/sm-capture` - Capture current work state for handoff
13+
- `/sm-restore` - Restore context from last handoff
14+
- `/sm-status` - Show current StackMemory status
15+
16+
### Context Management
17+
- `/sm-context` - Manage context frames and stack
18+
- `/sm-decision` - Record key decisions
19+
- `/sm-memory` - Store memories and observations
20+
- `/sm-clear` - Clear context with ledger preservation
21+
22+
### Task Management
23+
- `/sm-tasks` - Manage tasks (list, add, update)
24+
25+
### Activity
26+
- `/sm-log` - View recent activity log
27+
28+
## Quick Start
29+
30+
1. At session start: `/sm-restore` to load previous context
31+
2. During work: `/sm-decision` to record key decisions
32+
3. Before ending: `/sm-capture` to save state for next session
33+
34+
## Full CLI
35+
36+
For full CLI documentation:
37+
```bash
38+
stackmemory --help
39+
```
40+
41+
## Configuration
42+
43+
Initialize in a project:
44+
```bash
45+
stackmemory init
46+
```
47+
48+
Set up MCP server for Claude Desktop:
49+
```bash
50+
stackmemory setup-mcp
51+
```
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
---
2+
description: "View recent activity log"
3+
argument-hint: "[--limit N] [--type <type>]"
4+
allowed-tools: ["Bash(stackmemory log:*)", "Bash(stackmemory history:*)"]
5+
---
6+
7+
# StackMemory Log
8+
9+
View recent activity:
10+
11+
## Recent activity (default 10 items)
12+
```!
13+
stackmemory log recent
14+
```
15+
16+
## More items
17+
```!
18+
stackmemory log recent --limit 20
19+
```
20+
21+
## Filter by type
22+
```!
23+
stackmemory log recent --type decision
24+
```
25+
26+
Types:
27+
- `decision` - Recorded decisions
28+
- `observation` - Observations
29+
- `task` - Task changes
30+
- `context` - Context operations
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
---
2+
description: "Store a memory for session context"
3+
argument-hint: "<memory> [--type <observation|pattern|preference>]"
4+
allowed-tools: ["Bash(stackmemory memory:*)"]
5+
---
6+
7+
# StackMemory Memory
8+
9+
Store a memory for session context:
10+
11+
```!
12+
stackmemory memory add $ARGUMENTS
13+
```
14+
15+
Memory types:
16+
- `observation` - Something noticed during work
17+
- `pattern` - A recurring pattern identified
18+
- `preference` - A user or project preference
19+
20+
Examples:
21+
- `stackmemory memory add "User prefers concise responses"`
22+
- `stackmemory memory add "Tests run slowly on this machine" --type observation`
23+
24+
To list memories:
25+
```!
26+
stackmemory memory list
27+
```
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
---
2+
description: "Restore context from last session handoff"
3+
allowed-tools: ["Bash(stackmemory restore:*)"]
4+
---
5+
6+
# StackMemory Restore
7+
8+
Restore context from the last captured handoff:
9+
10+
```!
11+
stackmemory restore
12+
```
13+
14+
This will:
15+
1. Load the last handoff document
16+
2. Display the session context
17+
3. Show any uncommitted changes
18+
4. Copy the prompt to clipboard (unless --no-copy)
19+
20+
Use this at the start of a new session to resume where you left off.

0 commit comments

Comments
 (0)