thought-cabinet 0.0.4 → 0.1.1
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/.thought-cabinet/hooks.example.json +34 -0
- package/LICENSE +188 -2
- package/README.md +306 -74
- package/dist/index.js +1296 -609
- package/dist/index.js.map +1 -1
- package/package.json +3 -2
- package/src/agent-assets/commands/code-simplifier.md +52 -0
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
{
|
|
2
|
+
"hooks": {
|
|
3
|
+
"PostWorktreeAdd": [
|
|
4
|
+
{
|
|
5
|
+
"hooks": [
|
|
6
|
+
{
|
|
7
|
+
"type": "command",
|
|
8
|
+
"command": "echo 'Worktree @ $THC_WORKTREE_PATH successfully added'"
|
|
9
|
+
}
|
|
10
|
+
]
|
|
11
|
+
}
|
|
12
|
+
],
|
|
13
|
+
"PostWorktreeMerge": [
|
|
14
|
+
{
|
|
15
|
+
"hooks": [
|
|
16
|
+
{
|
|
17
|
+
"type": "command",
|
|
18
|
+
"command": "echo 'Worktree merged successfully'"
|
|
19
|
+
}
|
|
20
|
+
]
|
|
21
|
+
}
|
|
22
|
+
],
|
|
23
|
+
"PostThoughtsSync": [
|
|
24
|
+
{
|
|
25
|
+
"hooks": [
|
|
26
|
+
{
|
|
27
|
+
"type": "command",
|
|
28
|
+
"command": "echo 'Thoughts synced at $(date)' >> .thought-cabinet/sync.log"
|
|
29
|
+
}
|
|
30
|
+
]
|
|
31
|
+
}
|
|
32
|
+
]
|
|
33
|
+
}
|
|
34
|
+
}
|
package/LICENSE
CHANGED
|
@@ -1,6 +1,192 @@
|
|
|
1
|
-
Apache
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
2
4
|
|
|
3
|
-
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
|
4
190
|
|
|
5
191
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
192
|
you may not use this file except in compliance with the License.
|
package/README.md
CHANGED
|
@@ -1,18 +1,56 @@
|
|
|
1
1
|
# Thought Cabinet
|
|
2
2
|
|
|
3
|
-
A CLI tool
|
|
3
|
+
A CLI tool that integrates AI coding agents into structured development workflows through filesystem-based memory and context management.
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## Why Thought Cabinet?
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
AI coding agents like Claude Code are powerful but face key challenges:
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
- **Context limits**: Large codebases exceed model context windows
|
|
10
|
+
- **No persistent memory**: Agents forget learnings between sessions
|
|
11
|
+
- **Unstructured work**: Complex tasks benefit from planning before implementation
|
|
12
|
+
- **Isolation**: AI-generated knowledge isn't easily shared with teams
|
|
10
13
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
- **
|
|
14
|
-
- **
|
|
15
|
-
- **
|
|
14
|
+
Thought Cabinet solves these by providing:
|
|
15
|
+
|
|
16
|
+
- **Context offloading**: Research and plans are saved to disk, freeing model context
|
|
17
|
+
- **Filesystem memory**: Version-controlled thoughts persist across sessions
|
|
18
|
+
- **Structured workflows**: Slash commands guide agents through research → plan → implement → validate
|
|
19
|
+
- **Team sharing**: Thoughts sync via git, enabling knowledge sharing
|
|
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
|
|
46
|
+
|
|
47
|
+
### Worktree Isolation
|
|
48
|
+
|
|
49
|
+
Each feature gets its own git worktree with a dedicated tmux session, enabling:
|
|
50
|
+
|
|
51
|
+
- Parallel development on multiple features
|
|
52
|
+
- Clean separation between research (main branch) and implementation (worktree)
|
|
53
|
+
- Easy cleanup and merge when done
|
|
16
54
|
|
|
17
55
|
## Installation
|
|
18
56
|
|
|
@@ -20,126 +58,320 @@ Thought Cabinet provides a systematic way to organize and version-control your d
|
|
|
20
58
|
npm install -g thought-cabinet
|
|
21
59
|
```
|
|
22
60
|
|
|
23
|
-
##
|
|
61
|
+
## Claude Code Integration
|
|
24
62
|
|
|
25
|
-
|
|
63
|
+
Thought Cabinet provides slash commands, agents, and skills that integrate with Claude Code. Install them via `thc agent init`.
|
|
64
|
+
|
|
65
|
+
### Installing Agent Configuration
|
|
26
66
|
|
|
27
67
|
```bash
|
|
28
68
|
cd your-project
|
|
29
|
-
|
|
69
|
+
thc agent init
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
This interactively installs to `.claude/`:
|
|
73
|
+
- **Commands** - Slash commands for workflow phases (`/research_codebase`, `/create_plan`, etc.)
|
|
74
|
+
- **Agents** - Specialized sub-agents for code analysis and research
|
|
75
|
+
- **Skills** - Extended capabilities like document generation
|
|
76
|
+
- **Settings** - Project permissions and configuration
|
|
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)
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
### Slash Commands
|
|
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 |
|
|
96
|
+
|
|
97
|
+
### Context Offloading
|
|
98
|
+
|
|
99
|
+
AI agents have limited context windows. Thought Cabinet offloads context to the filesystem:
|
|
100
|
+
|
|
101
|
+
```
|
|
102
|
+
┌─────────────────┐ ┌─────────────────────────────┐
|
|
103
|
+
│ Model Context │ │ filesystem (thoughts/) │
|
|
104
|
+
├─────────────────┤ ├─────────────────────────────┤
|
|
105
|
+
│ Current task │ ←── │ research/auth-system.md │
|
|
106
|
+
│ Active code │ │ plans/add-oauth.md │
|
|
107
|
+
│ Recent changes │ │ previous session learnings │
|
|
108
|
+
└─────────────────┘ └─────────────────────────────┘
|
|
30
109
|
```
|
|
31
110
|
|
|
32
|
-
|
|
111
|
+
- `/research_codebase` writes comprehensive analysis to disk, then only the relevant sections are read when needed
|
|
112
|
+
- `/create_plan` produces detailed plans that persist across sessions
|
|
113
|
+
- The AI can reference previous research without re-exploring the entire codebase
|
|
33
114
|
|
|
34
|
-
|
|
35
|
-
2. Create directory structure for this project
|
|
36
|
-
3. Install git hooks for protection and auto-sync
|
|
37
|
-
4. Create symlinks in `thoughts/` directory
|
|
115
|
+
### Filesystem-Based Memory
|
|
38
116
|
|
|
39
|
-
|
|
117
|
+
Unlike conversation history that disappears, thoughts persist:
|
|
40
118
|
|
|
41
119
|
```bash
|
|
42
|
-
|
|
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
|
|
43
128
|
```
|
|
44
129
|
|
|
45
|
-
|
|
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)
|
|
46
140
|
|
|
47
141
|
```bash
|
|
48
|
-
|
|
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
|
|
49
156
|
```
|
|
50
157
|
|
|
51
|
-
|
|
158
|
+
### Phase 2: Create Worktree
|
|
52
159
|
|
|
53
|
-
|
|
160
|
+
```bash
|
|
161
|
+
# Create isolated worktree with tmux session
|
|
162
|
+
thc worktree add add-oauth
|
|
54
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
|
|
55
168
|
```
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
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
|
|
64
183
|
```
|
|
65
184
|
|
|
66
|
-
|
|
185
|
+
**Parallel work**: While implementation runs, you can continue other work in the main branch. Multiple worktrees can run simultaneously.
|
|
67
186
|
|
|
68
|
-
###
|
|
187
|
+
### Phase 4: Merge & Cleanup
|
|
69
188
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
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
|
+
```
|
|
75
199
|
|
|
76
|
-
###
|
|
200
|
+
### Workflow Diagram
|
|
77
201
|
|
|
78
|
-
|
|
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
|
+
```
|
|
79
225
|
|
|
80
|
-
|
|
81
|
-
- `thoughtcabinet profile list` - List all profiles
|
|
82
|
-
- `thoughtcabinet profile show <name>` - Show profile details
|
|
83
|
-
- `thoughtcabinet profile delete <name>` - Delete a profile
|
|
226
|
+
## Quick Start
|
|
84
227
|
|
|
85
|
-
|
|
228
|
+
### Initialize Thoughts
|
|
86
229
|
|
|
87
230
|
```bash
|
|
88
|
-
|
|
231
|
+
cd your-project
|
|
232
|
+
thc init
|
|
89
233
|
```
|
|
90
234
|
|
|
91
|
-
|
|
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
|
|
92
240
|
|
|
93
|
-
|
|
241
|
+
### Basic Usage
|
|
94
242
|
|
|
95
|
-
|
|
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
|
|
96
255
|
|
|
97
256
|
```bash
|
|
98
|
-
|
|
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
|
|
99
265
|
```
|
|
100
266
|
|
|
101
|
-
|
|
267
|
+
## CLI Commands
|
|
268
|
+
|
|
269
|
+
### Agent Configuration
|
|
102
270
|
|
|
103
271
|
```bash
|
|
104
|
-
|
|
272
|
+
thc agent init # Install Claude Code slash commands, agents, and skills
|
|
273
|
+
thc agent init --all # Install all without prompting
|
|
274
|
+
thc agent init --force # Overwrite existing configuration
|
|
105
275
|
```
|
|
106
276
|
|
|
107
|
-
|
|
277
|
+
### Thoughts Management
|
|
108
278
|
|
|
109
|
-
|
|
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
|
+
```
|
|
110
286
|
|
|
111
|
-
|
|
112
|
-
2. **post-commit**: Auto-syncs thoughts after each code commit
|
|
287
|
+
### Worktree Management
|
|
113
288
|
|
|
114
|
-
|
|
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
|
+
```
|
|
115
294
|
|
|
116
|
-
|
|
295
|
+
### Profiles
|
|
296
|
+
|
|
297
|
+
Use different thoughts repositories for different contexts (work, personal):
|
|
117
298
|
|
|
118
299
|
```bash
|
|
119
|
-
|
|
120
|
-
|
|
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
|
|
121
303
|
```
|
|
122
304
|
|
|
123
|
-
|
|
305
|
+
### Configuration
|
|
124
306
|
|
|
125
|
-
|
|
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
|
|
126
315
|
|
|
127
|
-
|
|
128
|
-
2. Use `shared/` for team documentation that should be version-controlled
|
|
129
|
-
3. Use `global/yourusername/` for cross-repository personal notes
|
|
130
|
-
4. Use `global/shared/` for cross-repository team documentation
|
|
131
|
-
5. Run `thoughtcabinet sync` before sharing important updates
|
|
132
|
-
6. Never commit the `thoughts/` directory to your code repository
|
|
316
|
+
### Custom Hooks
|
|
133
317
|
|
|
134
|
-
|
|
318
|
+
Configure hooks in `.thought-cabinet/hooks.json` to run commands on events:
|
|
135
319
|
|
|
136
|
-
|
|
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
|
|
137
340
|
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
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
|
+
```
|
|
357
|
+
|
|
358
|
+
## Best Practices
|
|
359
|
+
|
|
360
|
+
**For AI-assisted development:**
|
|
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
|
|
365
|
+
|
|
366
|
+
**General tips:**
|
|
367
|
+
- Run `thc sync` frequently to share knowledge
|
|
368
|
+
- Use `thc prune` to clean up stale mappings
|
|
142
369
|
|
|
143
370
|
## License
|
|
144
371
|
|
|
145
372
|
Apache-2.0
|
|
373
|
+
|
|
374
|
+
## Credits
|
|
375
|
+
|
|
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)
|