thought-cabinet 0.1.8 → 0.1.10

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  # Thought Cabinet
2
2
 
3
- A CLI tool that integrates AI coding agents into structured development workflows through filesystem-based memory and context management.
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,75 +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
- ## Core Concepts
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
- ```
35
-
36
- All thoughts are version-controlled via a dedicated git repository, separate from your code.
37
-
38
- ### Structured Workflows
39
-
40
- Instead of asking an AI to "implement feature X" directly, Thought Cabinet encourages a disciplined workflow:
41
-
42
- 1. **Research** → Understand the codebase deeply
43
- 2. **Plan** → Design the implementation with explicit phases
44
- 3. **Implement** → Execute the plan systematically
45
- 4. **Validate** → Verify against success criteria
21
+ ## Quick Start
46
22
 
47
- ### Worktree Isolation
23
+ ```bash
24
+ cd your-project
48
25
 
49
- Each feature gets its own git worktree with a dedicated tmux session, enabling:
26
+ # 1. Install
27
+ npm install -g thought-cabinet
50
28
 
51
- - Parallel development on multiple features
52
- - Clean separation between research (main branch) and implementation (worktree)
53
- - Easy cleanup and merge when done
29
+ # 2. Initialize thoughts in your project
30
+ thc init
54
31
 
55
- ## Installation
32
+ # 3. Install skills to your AI agent
33
+ thc agent init
56
34
 
57
- ```bash
58
- npm install -g thought-cabinet
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
59
40
  ```
60
41
 
61
- ## Claude Code Integration
62
-
63
- Thought Cabinet provides slash commands, agents, and skills that integrate with Claude Code. Install them via `thc agent init`.
42
+ ## Skills
64
43
 
65
- ### Installing Agent Configuration
44
+ Skills are installed by `thc agent init` and invoked as slash commands in your agent session:
66
45
 
67
- ```bash
68
- cd your-project
69
- thc agent init
70
- ```
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 |
71
54
 
72
- This interactively discovers and installs assets to your agent's config directory (e.g. `.claude/`):
55
+ **Typical workflow**: research the codebase to build understanding, create a plan, iterate until the plan is solid, implement it, then validate the result.
73
56
 
74
- - **Agents** - Specialized sub-agents for code analysis and research
75
- - **Skills** - Extended capabilities like structured workflows and document generation
57
+ ## Core Concepts
76
58
 
77
- Assets are installed via **symlink** by default: a canonical copy is stored in `.thought-cabinet/` (project) or `~/.config/thought-cabinet/` (global), and symlinks are created in the agent's config directory. This means updating the canonical copy updates all agents at once.
59
+ ### Thoughts as Memory
78
60
 
79
- ### Slash Commands
61
+ The `thoughts/` directory is a filesystem-based memory system for AI agents:
80
62
 
81
- These commands guide the AI through each phase of development:
63
+ ```
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
70
+ ```
82
71
 
83
- | Command | Purpose |
84
- | -------------------- | --------------------------------------------------------------------- |
85
- | `/research_codebase` | Deep-dive into codebase, save findings to `thoughts/shared/research/` |
86
- | `/create_plan` | Create implementation plan with phases and success criteria |
87
- | `/iterate_plan` | Refine existing plans based on feedback |
88
- | `/implement_plan` | Execute plan phase-by-phase with verification |
89
- | `/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`.
90
73
 
91
74
  ### Context Offloading
92
75
 
@@ -102,270 +85,24 @@ AI agents have limited context windows. Thought Cabinet offloads context to the
102
85
  └─────────────────┘ └─────────────────────────────┘
103
86
  ```
104
87
 
105
- - `/research_codebase` writes comprehensive analysis to disk, then only the relevant sections are read when needed
106
- - `/create_plan` produces detailed plans that persist across sessions
107
- - The AI can reference previous research without re-exploring the entire codebase
108
-
109
- ### Filesystem-Based Memory
110
-
111
- Unlike conversation history that disappears, thoughts persist:
112
-
113
- ```bash
114
- # Research from last week is still available
115
- cat thoughts/shared/research/2024-01-05-payment-system.md
116
-
117
- # Plans from past features inform new ones
118
- ls thoughts/shared/plans/
119
-
120
- # Personal learnings accumulate
121
- cat thoughts/yourusername/gotchas.md
122
- ```
123
-
124
- All thoughts are git-tracked, so you can:
125
-
126
- - Share knowledge with team members via `thc sync`
127
- - See how understanding evolved over time
128
- - Recover context even after months
129
-
130
- ## The Worktree + tmux + Parallel Workflow
131
-
132
- For complex features, Thought Cabinet enables a powerful parallel workflow:
133
-
134
- ### Phase 1: Research & Planning (Main Branch)
135
-
136
- ```bash
137
- # In your main branch, start Claude Code
138
- cd your-project
139
- claude
140
-
141
- # Research the codebase
142
- > /research_codebase
143
- > How does the authentication system work?
144
-
145
- # Create an implementation plan
146
- > /create_plan
147
- > Add OAuth2 support based on the research
148
-
149
- # Iterate until the plan is solid
150
- > /iterate_plan thoughts/shared/plans/add-oauth.md
151
- ```
152
-
153
- ### Phase 2: Create Worktree
154
-
155
- ```bash
156
- # Create isolated worktree with tmux session
157
- thc worktree add add-oauth
158
-
159
- # This creates:
160
- # - New git worktree at ../your-project-add-oauth/
161
- # - Dedicated tmux session (thc-add-oauth)
162
- # - Thoughts initialized and synced in worktree
163
- ```
164
-
165
- ### Phase 3: Parallel Implementation (Worktree)
166
-
167
- In the worktree's tmux session:
168
-
169
- ```bash
170
- # Start Claude Code in the worktree
171
- claude
172
-
173
- # Implement the plan (the plan persists from main branch!)
174
- > /implement_plan thoughts/shared/plans/add-oauth.md
175
-
176
- # Validate against success criteria
177
- > /validate_plan thoughts/shared/plans/add-oauth.md
178
- ```
179
-
180
- **Parallel work**: While implementation runs, you can continue other work in the main branch. Multiple worktrees can run simultaneously.
181
-
182
- ### Phase 4: Merge & Cleanup
183
-
184
- ```bash
185
- # Back in main branch
186
- thc worktree merge add-oauth
187
-
188
- # This:
189
- # - Rebases the feature branch
190
- # - Fast-forward merges to target
191
- # - Cleans up worktree and tmux session
192
- # - Syncs thoughts
193
- ```
194
-
195
- ### Workflow Diagram
196
-
197
- ```
198
- Main Branch Worktree (parallel)
199
-
200
- ├── /research_codebase
201
- │ └── writes to thoughts/shared/research/
202
-
203
- ├── /create_plan
204
- │ └── writes to thoughts/shared/plans/
205
-
206
- ├── /iterate_plan (until ready)
207
-
208
- ├── thc worktree add ──────────────────┐
209
- │ │
210
- │ (continue other work here) ├── /implement_plan
211
- │ │ └── reads plan, writes code
212
- │ │
213
- │ ├── /validate_plan
214
- │ │ └── verifies success criteria
215
- │ │
216
- ├── thc worktree merge ←───────────────┘
217
-
218
-
219
- ```
220
-
221
- ## Quick Start
222
-
223
- ### Initialize Thoughts
224
-
225
- ```bash
226
- cd your-project
227
- thc init
228
- ```
229
-
230
- This sets up:
231
-
232
- - A global thoughts repository (default: `~/thoughts`)
233
- - Directory structure for this project
234
- - Git hooks for protection and auto-sync
235
- - Symlinks in `thoughts/` directory
236
-
237
- ### Basic Usage
238
-
239
- ```bash
240
- # Edit thoughts directly
241
- vim thoughts/yourusername/notes.md
242
-
243
- # Sync changes
244
- thc sync
245
-
246
- # Check status
247
- thc status
248
- ```
249
-
250
- ### Worktree Commands
251
-
252
- ```bash
253
- # Create worktree with tmux session
254
- thc worktree add feature-name
255
-
256
- # List active worktrees
257
- thc worktree list
258
-
259
- # Merge and cleanup
260
- thc worktree merge feature-name
261
- ```
262
-
263
- ## CLI Commands
264
-
265
- ### Agent Configuration
266
-
267
- ```bash
268
- thc agent init # Interactively install agents and skills
269
- thc agent init --all # Install all without prompting (symlink mode)
270
- thc agent init --force # Overwrite existing installations
271
- thc agent init --agent cursor # Install for a specific agent
272
- thc agent init --global # Install to global scope
273
- ```
274
-
275
- ### Thoughts Management
276
-
277
- ```bash
278
- thc init # Initialize thoughts for current repository
279
- thc sync # Sync thoughts to repository
280
- thc status # Show status of thoughts repository
281
- thc destroy # Remove thoughts setup from repository
282
- thc prune # Clean up stale repository mappings
283
- ```
284
-
285
- ### Worktree Management
286
-
287
- ```bash
288
- thc worktree add <name> # Create worktree + tmux session
289
- thc worktree list # List worktrees and sessions
290
- thc worktree merge <name> # Merge and cleanup worktree
291
- ```
292
-
293
- ### Profiles
294
-
295
- Use different thoughts repositories for different contexts (work, personal):
296
-
297
- ```bash
298
- thc profile create <name> # Create a new profile
299
- thc profile list # List all profiles
300
- thc init --profile work # Initialize with specific profile
301
- ```
302
-
303
- ### Configuration
304
-
305
- ```bash
306
- thc config # View configuration
307
- thc config --edit # Edit configuration
308
- ```
309
-
310
- Configuration is stored in `~/.config/thought-cabinet/config.json`.
311
-
312
- ## Hooks
313
-
314
- ### Custom Hooks
315
-
316
- Configure hooks in `.thought-cabinet/hooks.json` to run commands on events:
317
-
318
- ```json
319
- {
320
- "hooks": {
321
- "PostWorktreeAdd": [
322
- {
323
- "hooks": [{ "type": "command", "command": "npm install", "timeout": 300 }]
324
- }
325
- ]
326
- }
327
- }
328
- ```
329
-
330
- **Available events:**
331
-
332
- - `PreWorktreeAdd`, `PostWorktreeAdd` - Worktree creation
333
- - `PreWorktreeMerge`, `PostWorktreeMerge` - Worktree merge
334
- - `PostThoughtsInit`, `PostThoughtsDestroy`, `PostThoughtsSync` - Thoughts lifecycle
335
-
336
- ### Git Hooks
337
-
338
- Automatically installed git hooks:
339
-
340
- - **pre-commit**: Prevents accidental commits of `thoughts/` directory
341
- - **post-commit**: Auto-syncs thoughts after each commit
342
-
343
- ## Directory Structure
344
-
345
- ```
346
- your-project/
347
- └── thoughts/
348
- ├── yourusername/ → Personal notes for this project
349
- ├── shared/ → Team-shared notes
350
- │ ├── research/ → Codebase research documents
351
- │ └── plans/ → Implementation plans
352
- ├── global/ → Cross-project thoughts
353
- └── searchable/ → Hard links for grep/ripgrep
354
- ```
88
+ Research and plans are written to disk. The agent reads back only what it needs, freeing context for active work.
355
89
 
356
- ## Best Practices
90
+ ## CLI Overview
357
91
 
358
- **For AI-assisted development:**
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 |
359
99
 
360
- - Always run `/research_codebase` before planning complex features
361
- - Use `/create_plan` to make implementation explicit and verifiable
362
- - Implement in worktrees for maximum throughput
363
- - Run `/validate_plan` before merging to catch deviations
100
+ See [docs/CLI.md](docs/CLI.md) for the full command reference with all flags and options.
364
101
 
365
- **General tips:**
102
+ ## Advanced Topics
366
103
 
367
- - Run `thc sync` frequently to share knowledge
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
- - 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
377
- - the thoughts system is based on [humanlayer](https://github.com/humanlayer/humanlayer)
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)
package/dist/index.js CHANGED
@@ -2797,8 +2797,8 @@ async function agentInitCommand(options) {
2797
2797
  // src/commands/agent.ts
2798
2798
  function agentCommand(program) {
2799
2799
  const agent = program.command("agent").description("Manage coding agent configuration");
2800
- agent.command("init").description("Initialize coding agent configuration in current directory").option("--agent <agents...>", "Target agents (e.g., claude-code codebuddy cursor)").option("-g, --global", "Install to global scope").option("--mode <mode>", "Installation mode: symlink or copy (default: symlink)").option("--source <path>", "Source directory for assets").option("--force", "Force overwrite of existing installations").option("--all", "Install all assets without prompting").action(async (options) => {
2801
- const agentTypes = options.agent?.map((a) => {
2800
+ agent.command("init").description("Initialize coding agent configuration in current directory").option("--target <agents...>", "Target agents (e.g., claude-code codebuddy cursor)").option("-g, --global", "Install to global scope").option("--mode <mode>", "Installation mode: symlink or copy (default: symlink)").option("--source <path>", "Source directory for assets").option("--force", "Force overwrite of existing installations").option("--all", "Install all assets without prompting").action(async (options) => {
2801
+ const agentTypes = options.target?.map((a) => {
2802
2802
  if (!isValidAgentType(a)) {
2803
2803
  console.error(`Unknown agent: ${a}`);
2804
2804
  process.exit(1);
@@ -3562,11 +3562,11 @@ function hooksCommand(program) {
3562
3562
  function completionCommand(program) {
3563
3563
  const completion = program.command("completion").description("Manage shell completion for thoughtcabinet CLI");
3564
3564
  completion.command("install").description("Install shell completion scripts").action(async () => {
3565
- const { install } = await import("./installer-LJ3SJXPW.js");
3565
+ const { install } = await import("./installer-RE5BSCVX.js");
3566
3566
  await install();
3567
3567
  });
3568
3568
  completion.command("uninstall").description("Remove shell completion scripts").action(async () => {
3569
- const { uninstall } = await import("./installer-LJ3SJXPW.js");
3569
+ const { uninstall } = await import("./installer-RE5BSCVX.js");
3570
3570
  await uninstall();
3571
3571
  });
3572
3572
  }
@@ -3656,7 +3656,7 @@ var OPTIONS = {
3656
3656
  "worktree list": ["--all"],
3657
3657
  "worktree merge": ["--into", "--force", "--keep-session", "--keep-worktree", "--keep-branch"],
3658
3658
  "worktree remove": ["--force"],
3659
- "agent init": ["--force", "--all", "--agent", "--global", "--mode", "--source"]
3659
+ "agent init": ["--force", "--all", "--target", "--global", "--mode", "--source"]
3660
3660
  };
3661
3661
  var DYNAMIC_ARGS = {
3662
3662
  "profile show": getProfileNames,
@@ -3669,7 +3669,7 @@ var DYNAMIC_OPTIONS = {
3669
3669
  "--branch": getBranchNames,
3670
3670
  "--base": getBranchNames,
3671
3671
  "--into": getBranchNames,
3672
- "--agent": getAgentNames,
3672
+ "--target": getAgentNames,
3673
3673
  "--mode": () => ["symlink", "copy"]
3674
3674
  };
3675
3675
  async function handleCompletion() {