thought-cabinet 0.1.4 → 0.1.9
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/README.md +52 -315
- package/dist/index.js +708 -389
- package/dist/index.js.map +1 -1
- package/dist/installer-RE5BSCVX.js +75 -0
- package/dist/installer-RE5BSCVX.js.map +1 -0
- package/docs/CLI.md +282 -0
- package/docs/HOOKS.md +260 -0
- package/docs/WORKTREES.md +163 -0
- package/package.json +17 -4
- package/scripts/postinstall.cjs +17 -0
- package/src/agent-assets/agents/code-simplifier.md +0 -3
- package/src/agent-assets/skills/commit/SKILL.md +36 -0
- package/src/agent-assets/skills/creating-plan/SKILL.md +2 -2
- package/src/agent-assets/skills/implementing-plan/SKILL.md +2 -1
- package/src/agent-assets/skills/iterating-plan/SKILL.md +11 -11
- package/src/agent-assets/skills/researching-codebase/SKILL.md +2 -3
- package/src/agent-assets/skills/validating-plan/SKILL.md +1 -1
- package/.thought-cabinet/hooks.json +0 -14
- package/dist/installer-LJ3SJXPW.js +0 -37
- package/dist/installer-LJ3SJXPW.js.map +0 -1
- package/src/agent-assets/commands/commit.md +0 -35
- package/src/agent-assets/commands/create_plan.md +0 -7
- package/src/agent-assets/commands/implement_plan.md +0 -6
- package/src/agent-assets/commands/iterate_plan.md +0 -7
- package/src/agent-assets/commands/research_codebase.md +0 -7
- package/src/agent-assets/commands/validate_plan.md +0 -6
- package/src/agent-assets/settings.template.json +0 -7
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Thought Cabinet
|
|
2
2
|
|
|
3
|
-
A CLI tool that
|
|
3
|
+
A CLI tool that gives AI coding agents persistent, structured memory through filesystem-based notes and version-controlled knowledge sharing.
|
|
4
4
|
|
|
5
5
|
## Why Thought Cabinet?
|
|
6
6
|
|
|
@@ -18,81 +18,58 @@ Thought Cabinet solves these by providing:
|
|
|
18
18
|
- **Structured workflows**: Slash commands guide agents through research → plan → implement → validate
|
|
19
19
|
- **Team sharing**: Thoughts sync via git, enabling knowledge sharing
|
|
20
20
|
|
|
21
|
-
##
|
|
22
|
-
|
|
23
|
-
### Thoughts as Memory
|
|
24
|
-
|
|
25
|
-
The `thoughts/` directory is a filesystem-based memory system for AI agents:
|
|
26
|
-
|
|
27
|
-
```
|
|
28
|
-
thoughts/
|
|
29
|
-
├── {user}/ → Personal notes (your learnings, scratchpad)
|
|
30
|
-
├── shared/ → Team-shared knowledge
|
|
31
|
-
│ ├── research/ → Codebase research documents
|
|
32
|
-
│ └── plans/ → Implementation plans
|
|
33
|
-
└── global/ → Cross-repository thoughts
|
|
34
|
-
```
|
|
21
|
+
## Quick Start
|
|
35
22
|
|
|
36
|
-
|
|
23
|
+
```bash
|
|
24
|
+
cd your-project
|
|
37
25
|
|
|
38
|
-
|
|
26
|
+
# 1. Install
|
|
27
|
+
npm install -g thought-cabinet
|
|
39
28
|
|
|
40
|
-
|
|
29
|
+
# 2. Initialize thoughts in your project
|
|
30
|
+
thc init
|
|
41
31
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
3. **Implement** → Execute the plan systematically
|
|
45
|
-
4. **Validate** → Verify against success criteria
|
|
32
|
+
# 3. Install skills to your AI agent
|
|
33
|
+
thc agent init
|
|
46
34
|
|
|
47
|
-
|
|
35
|
+
# 4. Use skills in your agent session (e.g. Claude Code)
|
|
36
|
+
> /researching-codebase How does the authentication system work?
|
|
37
|
+
> /creating-plan Add OAuth2 support based on the research
|
|
38
|
+
> /implementing-plan thoughts/shared/plans/add-oauth.md
|
|
39
|
+
> /validating-plan thoughts/shared/plans/add-oauth.md
|
|
40
|
+
```
|
|
48
41
|
|
|
49
|
-
|
|
42
|
+
## Skills
|
|
50
43
|
|
|
51
|
-
|
|
52
|
-
- Clean separation between research (main branch) and implementation (worktree)
|
|
53
|
-
- Easy cleanup and merge when done
|
|
44
|
+
Skills are installed by `thc agent init` and invoked as slash commands in your agent session:
|
|
54
45
|
|
|
55
|
-
|
|
46
|
+
| Skill | Description |
|
|
47
|
+
| ----------------------- | --------------------------------------------------------------------- |
|
|
48
|
+
| `/researching-codebase` | Deep-dive into codebase, save findings to `thoughts/shared/research/` |
|
|
49
|
+
| `/creating-plan` | Create implementation plan with phases and success criteria |
|
|
50
|
+
| `/iterating-plan` | Refine existing plans based on feedback |
|
|
51
|
+
| `/implementing-plan` | Execute plan phase-by-phase with verification |
|
|
52
|
+
| `/validating-plan` | Verify implementation against plan's success criteria |
|
|
53
|
+
| `/commit` | Create git commits with clear, descriptive messages |
|
|
56
54
|
|
|
57
|
-
|
|
58
|
-
npm install -g thought-cabinet
|
|
59
|
-
```
|
|
55
|
+
**Typical workflow**: research the codebase to build understanding, create a plan, iterate until the plan is solid, implement it, then validate the result.
|
|
60
56
|
|
|
61
|
-
##
|
|
57
|
+
## Core Concepts
|
|
62
58
|
|
|
63
|
-
|
|
59
|
+
### Thoughts as Memory
|
|
64
60
|
|
|
65
|
-
|
|
61
|
+
The `thoughts/` directory is a filesystem-based memory system for AI agents:
|
|
66
62
|
|
|
67
|
-
```bash
|
|
68
|
-
cd your-project
|
|
69
|
-
thc agent init
|
|
70
63
|
```
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
Options:
|
|
79
|
-
```bash
|
|
80
|
-
thc agent init --all # Copy all files without prompting
|
|
81
|
-
thc agent init --force # Overwrite existing .claude directory
|
|
82
|
-
thc agent init --name codebuddy # Use alternative agent (codebuddy)
|
|
64
|
+
thoughts/
|
|
65
|
+
├── {user}/ → Personal notes (your learnings, scratchpad)
|
|
66
|
+
├── shared/ → Team-shared knowledge
|
|
67
|
+
│ ├── research/ → Codebase research documents
|
|
68
|
+
│ └── plans/ → Implementation plans
|
|
69
|
+
└── global/ → Cross-repository thoughts
|
|
83
70
|
```
|
|
84
71
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
These commands guide the AI through each phase of development:
|
|
88
|
-
|
|
89
|
-
| Command | Purpose |
|
|
90
|
-
|---------|---------|
|
|
91
|
-
| `/research_codebase` | Deep-dive into codebase, save findings to `thoughts/shared/research/` |
|
|
92
|
-
| `/create_plan` | Create implementation plan with phases and success criteria |
|
|
93
|
-
| `/iterate_plan` | Refine existing plans based on feedback |
|
|
94
|
-
| `/implement_plan` | Execute plan phase-by-phase with verification |
|
|
95
|
-
| `/validate_plan` | Verify implementation against plan's success criteria |
|
|
72
|
+
All thoughts are version-controlled via a dedicated git repository, separate from your code. Sync with `thc sync`.
|
|
96
73
|
|
|
97
74
|
### Context Offloading
|
|
98
75
|
|
|
@@ -108,264 +85,24 @@ AI agents have limited context windows. Thought Cabinet offloads context to the
|
|
|
108
85
|
└─────────────────┘ └─────────────────────────────┘
|
|
109
86
|
```
|
|
110
87
|
|
|
111
|
-
|
|
112
|
-
- `/create_plan` produces detailed plans that persist across sessions
|
|
113
|
-
- The AI can reference previous research without re-exploring the entire codebase
|
|
114
|
-
|
|
115
|
-
### Filesystem-Based Memory
|
|
116
|
-
|
|
117
|
-
Unlike conversation history that disappears, thoughts persist:
|
|
118
|
-
|
|
119
|
-
```bash
|
|
120
|
-
# Research from last week is still available
|
|
121
|
-
cat thoughts/shared/research/2024-01-05-payment-system.md
|
|
122
|
-
|
|
123
|
-
# Plans from past features inform new ones
|
|
124
|
-
ls thoughts/shared/plans/
|
|
125
|
-
|
|
126
|
-
# Personal learnings accumulate
|
|
127
|
-
cat thoughts/yourusername/gotchas.md
|
|
128
|
-
```
|
|
129
|
-
|
|
130
|
-
All thoughts are git-tracked, so you can:
|
|
131
|
-
- Share knowledge with team members via `thc sync`
|
|
132
|
-
- See how understanding evolved over time
|
|
133
|
-
- Recover context even after months
|
|
134
|
-
|
|
135
|
-
## The Worktree + tmux + Parallel Workflow
|
|
136
|
-
|
|
137
|
-
For complex features, Thought Cabinet enables a powerful parallel workflow:
|
|
138
|
-
|
|
139
|
-
### Phase 1: Research & Planning (Main Branch)
|
|
140
|
-
|
|
141
|
-
```bash
|
|
142
|
-
# In your main branch, start Claude Code
|
|
143
|
-
cd your-project
|
|
144
|
-
claude
|
|
145
|
-
|
|
146
|
-
# Research the codebase
|
|
147
|
-
> /research_codebase
|
|
148
|
-
> How does the authentication system work?
|
|
149
|
-
|
|
150
|
-
# Create an implementation plan
|
|
151
|
-
> /create_plan
|
|
152
|
-
> Add OAuth2 support based on the research
|
|
153
|
-
|
|
154
|
-
# Iterate until the plan is solid
|
|
155
|
-
> /iterate_plan thoughts/shared/plans/add-oauth.md
|
|
156
|
-
```
|
|
157
|
-
|
|
158
|
-
### Phase 2: Create Worktree
|
|
159
|
-
|
|
160
|
-
```bash
|
|
161
|
-
# Create isolated worktree with tmux session
|
|
162
|
-
thc worktree add add-oauth
|
|
163
|
-
|
|
164
|
-
# This creates:
|
|
165
|
-
# - New git worktree at ../your-project-add-oauth/
|
|
166
|
-
# - Dedicated tmux session (thc-add-oauth)
|
|
167
|
-
# - Thoughts initialized and synced in worktree
|
|
168
|
-
```
|
|
169
|
-
|
|
170
|
-
### Phase 3: Parallel Implementation (Worktree)
|
|
171
|
-
|
|
172
|
-
In the worktree's tmux session:
|
|
173
|
-
|
|
174
|
-
```bash
|
|
175
|
-
# Start Claude Code in the worktree
|
|
176
|
-
claude
|
|
177
|
-
|
|
178
|
-
# Implement the plan (the plan persists from main branch!)
|
|
179
|
-
> /implement_plan thoughts/shared/plans/add-oauth.md
|
|
180
|
-
|
|
181
|
-
# Validate against success criteria
|
|
182
|
-
> /validate_plan thoughts/shared/plans/add-oauth.md
|
|
183
|
-
```
|
|
184
|
-
|
|
185
|
-
**Parallel work**: While implementation runs, you can continue other work in the main branch. Multiple worktrees can run simultaneously.
|
|
186
|
-
|
|
187
|
-
### Phase 4: Merge & Cleanup
|
|
188
|
-
|
|
189
|
-
```bash
|
|
190
|
-
# Back in main branch
|
|
191
|
-
thc worktree merge add-oauth
|
|
192
|
-
|
|
193
|
-
# This:
|
|
194
|
-
# - Rebases the feature branch
|
|
195
|
-
# - Fast-forward merges to target
|
|
196
|
-
# - Cleans up worktree and tmux session
|
|
197
|
-
# - Syncs thoughts
|
|
198
|
-
```
|
|
199
|
-
|
|
200
|
-
### Workflow Diagram
|
|
201
|
-
|
|
202
|
-
```
|
|
203
|
-
Main Branch Worktree (parallel)
|
|
204
|
-
│
|
|
205
|
-
├── /research_codebase
|
|
206
|
-
│ └── writes to thoughts/shared/research/
|
|
207
|
-
│
|
|
208
|
-
├── /create_plan
|
|
209
|
-
│ └── writes to thoughts/shared/plans/
|
|
210
|
-
│
|
|
211
|
-
├── /iterate_plan (until ready)
|
|
212
|
-
│
|
|
213
|
-
├── thc worktree add ──────────────────┐
|
|
214
|
-
│ │
|
|
215
|
-
│ (continue other work here) ├── /implement_plan
|
|
216
|
-
│ │ └── reads plan, writes code
|
|
217
|
-
│ │
|
|
218
|
-
│ ├── /validate_plan
|
|
219
|
-
│ │ └── verifies success criteria
|
|
220
|
-
│ │
|
|
221
|
-
├── thc worktree merge ←───────────────┘
|
|
222
|
-
│
|
|
223
|
-
▼
|
|
224
|
-
```
|
|
225
|
-
|
|
226
|
-
## Quick Start
|
|
227
|
-
|
|
228
|
-
### Initialize Thoughts
|
|
229
|
-
|
|
230
|
-
```bash
|
|
231
|
-
cd your-project
|
|
232
|
-
thc init
|
|
233
|
-
```
|
|
234
|
-
|
|
235
|
-
This sets up:
|
|
236
|
-
- A global thoughts repository (default: `~/thoughts`)
|
|
237
|
-
- Directory structure for this project
|
|
238
|
-
- Git hooks for protection and auto-sync
|
|
239
|
-
- Symlinks in `thoughts/` directory
|
|
240
|
-
|
|
241
|
-
### Basic Usage
|
|
242
|
-
|
|
243
|
-
```bash
|
|
244
|
-
# Edit thoughts directly
|
|
245
|
-
vim thoughts/yourusername/notes.md
|
|
246
|
-
|
|
247
|
-
# Sync changes
|
|
248
|
-
thc sync
|
|
249
|
-
|
|
250
|
-
# Check status
|
|
251
|
-
thc status
|
|
252
|
-
```
|
|
253
|
-
|
|
254
|
-
### Worktree Commands
|
|
255
|
-
|
|
256
|
-
```bash
|
|
257
|
-
# Create worktree with tmux session
|
|
258
|
-
thc worktree add feature-name
|
|
259
|
-
|
|
260
|
-
# List active worktrees
|
|
261
|
-
thc worktree list
|
|
262
|
-
|
|
263
|
-
# Merge and cleanup
|
|
264
|
-
thc worktree merge feature-name
|
|
265
|
-
```
|
|
88
|
+
Research and plans are written to disk. The agent reads back only what it needs, freeing context for active work.
|
|
266
89
|
|
|
267
|
-
## CLI
|
|
90
|
+
## CLI Overview
|
|
268
91
|
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
thc
|
|
273
|
-
thc
|
|
274
|
-
thc agent init
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
### Thoughts Management
|
|
278
|
-
|
|
279
|
-
```bash
|
|
280
|
-
thc init # Initialize thoughts for current repository
|
|
281
|
-
thc sync # Sync thoughts to repository
|
|
282
|
-
thc status # Show status of thoughts repository
|
|
283
|
-
thc destroy # Remove thoughts setup from repository
|
|
284
|
-
thc prune # Clean up stale repository mappings
|
|
285
|
-
```
|
|
286
|
-
|
|
287
|
-
### Worktree Management
|
|
288
|
-
|
|
289
|
-
```bash
|
|
290
|
-
thc worktree add <name> # Create worktree + tmux session
|
|
291
|
-
thc worktree list # List worktrees and sessions
|
|
292
|
-
thc worktree merge <name> # Merge and cleanup worktree
|
|
293
|
-
```
|
|
294
|
-
|
|
295
|
-
### Profiles
|
|
296
|
-
|
|
297
|
-
Use different thoughts repositories for different contexts (work, personal):
|
|
298
|
-
|
|
299
|
-
```bash
|
|
300
|
-
thc profile create <name> # Create a new profile
|
|
301
|
-
thc profile list # List all profiles
|
|
302
|
-
thc init --profile work # Initialize with specific profile
|
|
303
|
-
```
|
|
304
|
-
|
|
305
|
-
### Configuration
|
|
306
|
-
|
|
307
|
-
```bash
|
|
308
|
-
thc config # View configuration
|
|
309
|
-
thc config --edit # Edit configuration
|
|
310
|
-
```
|
|
311
|
-
|
|
312
|
-
Configuration is stored in `~/.config/thought-cabinet/config.json`.
|
|
313
|
-
|
|
314
|
-
## Hooks
|
|
315
|
-
|
|
316
|
-
### Custom Hooks
|
|
317
|
-
|
|
318
|
-
Configure hooks in `.thought-cabinet/hooks.json` to run commands on events:
|
|
319
|
-
|
|
320
|
-
```json
|
|
321
|
-
{
|
|
322
|
-
"hooks": {
|
|
323
|
-
"PostWorktreeAdd": [
|
|
324
|
-
{
|
|
325
|
-
"hooks": [
|
|
326
|
-
{ "type": "command", "command": "npm install", "timeout": 300 }
|
|
327
|
-
]
|
|
328
|
-
}
|
|
329
|
-
]
|
|
330
|
-
}
|
|
331
|
-
}
|
|
332
|
-
```
|
|
333
|
-
|
|
334
|
-
**Available events:**
|
|
335
|
-
- `PreWorktreeAdd`, `PostWorktreeAdd` - Worktree creation
|
|
336
|
-
- `PreWorktreeMerge`, `PostWorktreeMerge` - Worktree merge
|
|
337
|
-
- `PostThoughtsInit`, `PostThoughtsDestroy`, `PostThoughtsSync` - Thoughts lifecycle
|
|
338
|
-
|
|
339
|
-
### Git Hooks
|
|
340
|
-
|
|
341
|
-
Automatically installed git hooks:
|
|
342
|
-
- **pre-commit**: Prevents accidental commits of `thoughts/` directory
|
|
343
|
-
- **post-commit**: Auto-syncs thoughts after each commit
|
|
344
|
-
|
|
345
|
-
## Directory Structure
|
|
346
|
-
|
|
347
|
-
```
|
|
348
|
-
your-project/
|
|
349
|
-
└── thoughts/
|
|
350
|
-
├── yourusername/ → Personal notes for this project
|
|
351
|
-
├── shared/ → Team-shared notes
|
|
352
|
-
│ ├── research/ → Codebase research documents
|
|
353
|
-
│ └── plans/ → Implementation plans
|
|
354
|
-
├── global/ → Cross-project thoughts
|
|
355
|
-
└── searchable/ → Hard links for grep/ripgrep
|
|
356
|
-
```
|
|
92
|
+
| Command | Description |
|
|
93
|
+
| ---------------- | ------------------------------------------------- |
|
|
94
|
+
| `thc init` | Initialize thoughts for current repository |
|
|
95
|
+
| `thc sync` | Sync thoughts to git repository |
|
|
96
|
+
| `thc status` | Show thoughts repository status |
|
|
97
|
+
| `thc agent init` | Install skills and agents to your AI coding agent |
|
|
98
|
+
| `thc config` | View or edit configuration |
|
|
357
99
|
|
|
358
|
-
|
|
100
|
+
See [docs/CLI.md](docs/CLI.md) for the full command reference with all flags and options.
|
|
359
101
|
|
|
360
|
-
|
|
361
|
-
- Always run `/research_codebase` before planning complex features
|
|
362
|
-
- Use `/create_plan` to make implementation explicit and verifiable
|
|
363
|
-
- Implement in worktrees for maximum throughput
|
|
364
|
-
- Run `/validate_plan` before merging to catch deviations
|
|
102
|
+
## Advanced Topics
|
|
365
103
|
|
|
366
|
-
**
|
|
367
|
-
-
|
|
368
|
-
- Use `thc prune` to clean up stale mappings
|
|
104
|
+
- **[Worktrees](docs/WORKTREES.md)** — Parallel development with git worktrees and tmux sessions
|
|
105
|
+
- **[Hooks](docs/HOOKS.md)** — Custom hooks that run on thought and worktree lifecycle events
|
|
369
106
|
|
|
370
107
|
## License
|
|
371
108
|
|
|
@@ -373,5 +110,5 @@ Apache-2.0
|
|
|
373
110
|
|
|
374
111
|
## Credits
|
|
375
112
|
|
|
376
|
-
-
|
|
377
|
-
-
|
|
113
|
+
- The name "Thought Cabinet" is from CRPG [Disco Elysium](https://en.wikipedia.org/wiki/Disco_Elysium) created by Robert Kurvitz, Aleksander Rostov, Helen Hindpere and others
|
|
114
|
+
- The thoughts system is based on [humanlayer](https://github.com/humanlayer/humanlayer)
|