thought-cabinet 0.1.13 → 0.2.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/README.md +38 -15
- package/dist/index.js +933 -485
- package/dist/index.js.map +1 -1
- package/docs/CLI.md +24 -13
- package/package.json +1 -1
- package/src/agent-assets/skills/creating-plan/SKILL.md +6 -0
- package/src/agent-assets/skills/creating-plan/plan-template.md +37 -12
- package/src/agent-assets/skills/implementing-plan/SKILL.md +43 -7
- package/src/agent-assets/skills/init-agent-memory/SKILL.md +161 -0
- package/src/agent-assets/skills/init-agent-memory/architectural-patterns-template.md +36 -0
- package/src/agent-assets/skills/init-agent-memory/claude-memory-template.md +40 -0
- package/src/agent-assets/skills/navigate-thoughts/SKILL.md +45 -0
- package/src/agent-assets/skills/onboard/SKILL.md +74 -0
- package/src/agent-assets/skills/onboard/onboard.sh +118 -0
- package/src/agent-assets/skills/test-driven-development/SKILL.md +6 -1
- package/src/agent-assets/skills/test-skill-e2e/SKILL.md +205 -0
- package/src/agent-assets/skills/writing-skill/SKILL.md +207 -0
- package/src/agent-assets/skills/writing-skill/best-practices.md +1211 -0
- package/src/agent-assets/skills/writing-skill/skill-template.md +63 -0
package/docs/CLI.md
CHANGED
|
@@ -75,22 +75,35 @@ thc prune --apply # Actually remove stale mappings
|
|
|
75
75
|
| `--apply` | Apply changes (default is dry-run) |
|
|
76
76
|
| `--config-file <path>` | Path to config file |
|
|
77
77
|
|
|
78
|
+
### `thc migrate`
|
|
79
|
+
|
|
80
|
+
Migrate configuration from `~/.config/thought-cabinet/` to `~/.thought-cabinet/`. Moves config file, agent assets, and thoughts repos, then updates all paths in the config.
|
|
81
|
+
|
|
82
|
+
```bash
|
|
83
|
+
thc migrate # Interactive migration with confirmation
|
|
84
|
+
thc migrate --dry-run # Show what would be migrated without changes
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
| Flag | Description |
|
|
88
|
+
| ---------------------- | ------------------------------------------ |
|
|
89
|
+
| `--dry-run` | Show migration plan without making changes |
|
|
90
|
+
| `--config-file <path>` | Path to legacy config file |
|
|
91
|
+
|
|
78
92
|
## Agent Configuration
|
|
79
93
|
|
|
80
|
-
### `thc
|
|
94
|
+
### `thc skill install`
|
|
81
95
|
|
|
82
|
-
|
|
96
|
+
Install all bundled skills and agents to your AI coding agent's config directory.
|
|
83
97
|
|
|
84
|
-
Assets are installed via **symlink** by default: a canonical copy is stored in `.thought-cabinet/` (project) or `~/.
|
|
98
|
+
Assets are installed via **symlink** by default: a canonical copy is stored in `.thought-cabinet/` (project) or `~/.thought-cabinet/` (global), and symlinks are created in the agent's config directory. This means updating the canonical copy updates all agents at once.
|
|
85
99
|
|
|
86
100
|
```bash
|
|
87
|
-
thc
|
|
88
|
-
thc
|
|
89
|
-
thc
|
|
90
|
-
thc
|
|
91
|
-
thc
|
|
92
|
-
thc
|
|
93
|
-
thc agent init --force # Overwrite existing installations
|
|
101
|
+
thc skill install # Install all assets
|
|
102
|
+
thc skill install --target claude-code # Install for a specific agent
|
|
103
|
+
thc skill install --target cursor codex # Install for multiple agents
|
|
104
|
+
thc skill install --global # Install to global scope
|
|
105
|
+
thc skill install --mode copy # Copy files instead of symlinking
|
|
106
|
+
thc skill install --force # Overwrite existing installations
|
|
94
107
|
```
|
|
95
108
|
|
|
96
109
|
| Flag | Description |
|
|
@@ -98,9 +111,7 @@ thc agent init --force # Overwrite existing installations
|
|
|
98
111
|
| `--target <agents...>` | Target agents (e.g., `claude-code`, `codebuddy`, `cursor`, `codex`, `gemini-cli`, `cline`) |
|
|
99
112
|
| `-g, --global` | Install to global scope |
|
|
100
113
|
| `--mode <mode>` | Installation mode: `symlink` (default) or `copy` |
|
|
101
|
-
| `--source <path>` | Source directory for assets |
|
|
102
114
|
| `--force` | Force overwrite of existing installations |
|
|
103
|
-
| `--all` | Install all assets without prompting |
|
|
104
115
|
|
|
105
116
|
#### Installed Skills
|
|
106
117
|
|
|
@@ -239,7 +250,7 @@ thc config --json # Output as JSON
|
|
|
239
250
|
| `--json` | Output configuration as JSON |
|
|
240
251
|
| `--config-file <path>` | Path to config file |
|
|
241
252
|
|
|
242
|
-
Configuration is stored at `~/.config/thought-cabinet/config.json
|
|
253
|
+
Configuration is stored at `~/.thought-cabinet/config.json` (falls back to `~/.config/thought-cabinet/config.json`; respects `XDG_CONFIG_HOME`).
|
|
243
254
|
|
|
244
255
|
## Hooks
|
|
245
256
|
|
package/package.json
CHANGED
|
@@ -144,6 +144,12 @@ After structure approval:
|
|
|
144
144
|
|
|
145
145
|
2. **Write plan** using [plan-template.md](plan-template.md)
|
|
146
146
|
- **MUST** Read the template and follow the structure exactly.
|
|
147
|
+
- **TDD compatibility check**: For every change block, verify:
|
|
148
|
+
- `Testable Behaviors` appears **before** `Reference Implementation`
|
|
149
|
+
- Each testable behavior bullet is specific enough to write a failing test from (includes input, condition, and expected output/behavior)
|
|
150
|
+
- Each bullet maps to exactly one test — split compound behaviors
|
|
151
|
+
- The code block is labeled "Reference Implementation", not "Code to write"
|
|
152
|
+
- If a change block has no conditional logic, no data transformation, and is a pure pass-through, it may omit testable behaviors — document why.
|
|
147
153
|
|
|
148
154
|
3. **Sync thoughts directory**:
|
|
149
155
|
```bash
|
|
@@ -50,12 +50,24 @@
|
|
|
50
50
|
|
|
51
51
|
**File**: `path/to/file.ext`
|
|
52
52
|
**Changes**: [Summary of changes]
|
|
53
|
-
|
|
53
|
+
|
|
54
|
+
##### Testable Behaviors (RED tests)
|
|
55
|
+
|
|
56
|
+
> Each bullet is one TDD RED test. `implementing-plan` writes each test first, watches it fail, then writes the minimal code to pass it.
|
|
57
|
+
|
|
58
|
+
- [Input/condition] → [expected output/behavior]
|
|
59
|
+
- [Edge case] → [expected behavior]
|
|
60
|
+
- [Error case] → [expected fallback]
|
|
61
|
+
|
|
62
|
+
##### Reference Implementation
|
|
54
63
|
|
|
55
64
|
```[language]
|
|
56
|
-
//
|
|
65
|
+
// Suggested implementation — written AFTER the RED tests pass.
|
|
66
|
+
// implementing-plan must not read this before writing the failing tests.
|
|
57
67
|
```
|
|
58
68
|
|
|
69
|
+
---
|
|
70
|
+
|
|
59
71
|
### Success Criteria:
|
|
60
72
|
|
|
61
73
|
#### Automated Verification:
|
|
@@ -81,18 +93,11 @@
|
|
|
81
93
|
|
|
82
94
|
---
|
|
83
95
|
|
|
84
|
-
## Testing
|
|
85
|
-
|
|
86
|
-
### Unit Tests:
|
|
87
|
-
|
|
88
|
-
- [What to test]
|
|
89
|
-
- [Key edge cases]
|
|
96
|
+
## Integration Testing
|
|
90
97
|
|
|
91
|
-
|
|
98
|
+
[End-to-end scenarios that require multiple components working together — not covered by unit tests above]
|
|
92
99
|
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
### Manual Testing Steps:
|
|
100
|
+
## Manual Testing Steps
|
|
96
101
|
|
|
97
102
|
1. [Specific verification step]
|
|
98
103
|
2. [Edge case to test manually]
|
|
@@ -126,6 +131,26 @@ Always separate into two categories:
|
|
|
126
131
|
- Performance under real conditions
|
|
127
132
|
- User acceptance criteria
|
|
128
133
|
|
|
134
|
+
## TDD Compatibility Requirements
|
|
135
|
+
|
|
136
|
+
When writing each change block, ask:
|
|
137
|
+
|
|
138
|
+
1. **Are the testable behaviors specific enough to write a failing test from?**
|
|
139
|
+
- Bad: "handles null input"
|
|
140
|
+
- Good: "`envCreateTime=null` with cutoff set → returns `false` (safe fallback)"
|
|
141
|
+
|
|
142
|
+
2. **Is the behavior written before the code block?**
|
|
143
|
+
- The testable behaviors section must appear before the reference implementation.
|
|
144
|
+
- The implementer reads behaviors first and writes the RED test before reading the code.
|
|
145
|
+
|
|
146
|
+
3. **Does each bullet map to exactly one test?**
|
|
147
|
+
- Compound behaviors (A and B) → split into two bullets.
|
|
148
|
+
- Each bullet = one `def "..."()` / `it(...)` / `test(...)`.
|
|
149
|
+
|
|
150
|
+
4. **Is the code block labeled "Reference Implementation"?**
|
|
151
|
+
- Never label it "Code to write" or "Implementation".
|
|
152
|
+
- The label signals it is consulted only after RED → GREEN, not before.
|
|
153
|
+
|
|
129
154
|
## Common Patterns
|
|
130
155
|
|
|
131
156
|
### Database Changes:
|
|
@@ -30,7 +30,14 @@ The procedure for each unit of work:
|
|
|
30
30
|
|
|
31
31
|
After all TDD cycles in the phase are complete, run the phase's automated verification commands as the final gate.
|
|
32
32
|
|
|
33
|
-
**Resolving conflicts with the plan**: If the plan says "no tests needed", evaluate independently
|
|
33
|
+
**Resolving conflicts with the plan**: If the plan says "no tests needed", evaluate independently. The plan may be wrong — verify by reading existing test files. Apply TDD unless the code meets ALL of these criteria:
|
|
34
|
+
1. Zero conditional logic (no if/else, no switches, no ternaries, no loops with conditions)
|
|
35
|
+
2. Zero data transformation (no mapping, filtering, formatting, restructuring)
|
|
36
|
+
3. The function is a pure pass-through that only calls other already-tested functions with static arguments
|
|
37
|
+
|
|
38
|
+
"Wiring", "integration-level", "mostly delegation", and "would require too many mocks" are NOT valid reasons to skip TDD. If mocking is hard, that's a design signal — simplify the interface or extract testable units.
|
|
39
|
+
|
|
40
|
+
**When skipping TDD**: Document the skip in the phase completion message with the specific criteria met (1-3 above). If you cannot clearly articulate which criterion applies, you must write tests.
|
|
34
41
|
|
|
35
42
|
## Getting Started
|
|
36
43
|
|
|
@@ -38,9 +45,10 @@ When given a plan path:
|
|
|
38
45
|
|
|
39
46
|
1. Read the plan completely - check for existing checkmarks (- [x])
|
|
40
47
|
2. Read ALL files mentioned in the plan without limit/offset
|
|
41
|
-
3.
|
|
42
|
-
4.
|
|
43
|
-
5.
|
|
48
|
+
3. **Read existing test files** for every module the plan modifies (use glob: `**/__tests__/*`, `**/*.test.*`, `**/*.spec.*` near changed files). This is mandatory — never assume "no tests exist" without checking.
|
|
49
|
+
4. Understand how the pieces fit together
|
|
50
|
+
5. Create a todo list to track progress
|
|
51
|
+
6. Begin implementation of the **first uncompleted phase only**
|
|
44
52
|
|
|
45
53
|
If no plan path provided, ask for one:
|
|
46
54
|
|
|
@@ -81,9 +89,37 @@ How should I proceed?
|
|
|
81
89
|
|
|
82
90
|
Before writing any production code for a phase:
|
|
83
91
|
|
|
84
|
-
1.
|
|
85
|
-
2.
|
|
86
|
-
3.
|
|
92
|
+
1. Read existing test files for the modules being changed (if not already read in Getting Started)
|
|
93
|
+
2. For each change block in the phase, read only the **Testable Behaviors** section — do NOT read the Reference Implementation yet
|
|
94
|
+
3. For each testable behavior bullet, execute one RED-GREEN-REFACTOR cycle:
|
|
95
|
+
- **RED**: Write one failing test for that behavior. Run it. Confirm it fails for the right reason.
|
|
96
|
+
- **GREEN**: Write the minimal production code to pass it. Run it. Confirm it passes.
|
|
97
|
+
- **REFACTOR**: Clean up. Run tests. Stay green.
|
|
98
|
+
4. Only after all behavior bullets have passing tests, read the Reference Implementation and reconcile — adjust your implementation if it diverges from the plan's intent, but do not delete passing tests.
|
|
99
|
+
5. Proceed to the phase completion checklist.
|
|
100
|
+
|
|
101
|
+
### How to Extract Work Items from a Plan Change Block
|
|
102
|
+
|
|
103
|
+
A change block looks like:
|
|
104
|
+
|
|
105
|
+
```
|
|
106
|
+
##### Testable Behaviors (RED tests)
|
|
107
|
+
- `cutoff empty` → `isEnvCreatedAfterCutoff` returns `true`
|
|
108
|
+
- `createTime after cutoff` → returns `true`
|
|
109
|
+
- `createTime before cutoff` → returns `false`
|
|
110
|
+
- `createTime null + cutoff set` → returns `false` (safe fallback)
|
|
111
|
+
|
|
112
|
+
##### Reference Implementation
|
|
113
|
+
[code]
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
Map this to a work queue:
|
|
117
|
+
1. `def "isEnvCreatedAfterCutoff: cutoff empty returns true"()` → RED → GREEN
|
|
118
|
+
2. `def "isEnvCreatedAfterCutoff: createTime after cutoff returns true"()` → RED → GREEN
|
|
119
|
+
3. `def "isEnvCreatedAfterCutoff: createTime before cutoff returns false"()` → RED → GREEN
|
|
120
|
+
4. `def "isEnvCreatedAfterCutoff: null createTime with cutoff set returns false"()` → RED → GREEN
|
|
121
|
+
|
|
122
|
+
Each bullet is one test. Complete all cycles for this change block before moving to the next.
|
|
87
123
|
|
|
88
124
|
## Phase Completion Checklist
|
|
89
125
|
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: init-agent-memory
|
|
3
|
+
description: Initializes agent memory for a new project by creating a concise AGENTS.md and supporting docs with progressive disclosure. Use when onboarding an agent to a repository, bootstrapping first-run project context, or replacing an overly long memory file with a scoped index to docs references.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Initializing Agent Memory
|
|
7
|
+
|
|
8
|
+
Create high-signal project memory for new repositories by generating `AGENTS.md` plus focused supporting docs under `docs/`, then creating `CLAUDE.md` as a compatibility symlink.
|
|
9
|
+
|
|
10
|
+
## Workflow Overview
|
|
11
|
+
|
|
12
|
+
1. **Gather context** - Read user instructions and repository facts; ask only unresolved questions
|
|
13
|
+
2. **Research evidence** - Identify tech stack, project layout, commands, and repeated architectural patterns with file:line references
|
|
14
|
+
3. **Propose structure** - Share planned AGENTS.md sections and supporting docs before writing
|
|
15
|
+
4. **Write docs** - Generate `AGENTS.md`, supporting docs, and the `CLAUDE.md` symlink
|
|
16
|
+
5. **Quality review** - Validate constraints from the request and improve clarity
|
|
17
|
+
|
|
18
|
+
## Step 1: Gather Context
|
|
19
|
+
|
|
20
|
+
### Read Inputs First
|
|
21
|
+
|
|
22
|
+
If present, read these in order:
|
|
23
|
+
1. User-provided memory instructions (for example `init_agent_memory.md`)
|
|
24
|
+
2. Existing `AGENTS.md` and `CLAUDE.md`
|
|
25
|
+
3. `README.md` and package/build metadata
|
|
26
|
+
|
|
27
|
+
Read full files before drafting. Do not assume conventions.
|
|
28
|
+
|
|
29
|
+
### Ask Only Missing Questions
|
|
30
|
+
|
|
31
|
+
Only ask if required information cannot be inferred from repository files. Keep questions minimal and concrete.
|
|
32
|
+
|
|
33
|
+
Example:
|
|
34
|
+
|
|
35
|
+
```text
|
|
36
|
+
I can generate the initial memory docs. One point is still unclear: should AGENTS.md include only project-level workflows, or also team-specific process notes?
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## Step 2: Research Evidence
|
|
40
|
+
|
|
41
|
+
Collect concrete references for each required section.
|
|
42
|
+
|
|
43
|
+
### Required Evidence Buckets
|
|
44
|
+
|
|
45
|
+
- **Project overview (WHY):** repository purpose and problem domain
|
|
46
|
+
- **Tech stack (WHAT):** languages, frameworks, runtime, major tooling
|
|
47
|
+
- **Key directories (WHAT):** top-level modules and responsibilities
|
|
48
|
+
- **Essential commands (HOW):** build, test, lint, run workflows used daily
|
|
49
|
+
- **Architectural patterns:** conventions/design decisions that appear in multiple files
|
|
50
|
+
|
|
51
|
+
### Evidence Rules
|
|
52
|
+
|
|
53
|
+
- Use file:line references instead of code snippets
|
|
54
|
+
- Prefer primary sources (`src/`, command definitions, config files)
|
|
55
|
+
- For architectural patterns, include only patterns supported by at least two code references
|
|
56
|
+
- If evidence conflicts across docs and code, prefer the code and mention mismatch briefly
|
|
57
|
+
|
|
58
|
+
## Step 3: Propose Structure
|
|
59
|
+
|
|
60
|
+
Before writing files, share a concise structure proposal and get confirmation.
|
|
61
|
+
|
|
62
|
+
Use this format:
|
|
63
|
+
|
|
64
|
+
```text
|
|
65
|
+
Here is the proposed memory layout.
|
|
66
|
+
|
|
67
|
+
AGENTS.md (under 150 lines):
|
|
68
|
+
1. Project Overview
|
|
69
|
+
2. Tech Stack
|
|
70
|
+
3. Key Directories
|
|
71
|
+
4. Essential Build/Test Commands
|
|
72
|
+
5. Additional Documentation
|
|
73
|
+
|
|
74
|
+
Supporting docs:
|
|
75
|
+
- docs/architectural-patterns.md
|
|
76
|
+
|
|
77
|
+
I will keep AGENTS.md as an index and push detail into supporting docs (progressive disclosure).
|
|
78
|
+
I will then create CLAUDE.md as a symlink to AGENTS.md for backward compatibility.
|
|
79
|
+
Should I proceed with this structure?
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
If the user already requested this exact structure explicitly, treat that as approval and proceed.
|
|
83
|
+
|
|
84
|
+
## Step 4: Write Docs
|
|
85
|
+
|
|
86
|
+
### 4a. Create `AGENTS.md`
|
|
87
|
+
|
|
88
|
+
Use [claude-memory-template.md](claude-memory-template.md).
|
|
89
|
+
|
|
90
|
+
Required constraints:
|
|
91
|
+
- Keep total length under 150 lines
|
|
92
|
+
- Include WHAT, WHY, HOW coverage
|
|
93
|
+
- Use file:line references instead of code snippets
|
|
94
|
+
- Do not include formatting/style rules that linters already enforce
|
|
95
|
+
- Add an "Additional Documentation" section that points to `docs/*`
|
|
96
|
+
|
|
97
|
+
### 4b. Create `docs/architectural-patterns.md`
|
|
98
|
+
|
|
99
|
+
Use [architectural-patterns-template.md](architectural-patterns-template.md).
|
|
100
|
+
|
|
101
|
+
Required constraints:
|
|
102
|
+
- Document only recurring patterns and conventions
|
|
103
|
+
- Every pattern needs concrete evidence with file:line references
|
|
104
|
+
- Focus on decisions that influence future implementation work
|
|
105
|
+
|
|
106
|
+
### 4c. Create `CLAUDE.md` Symlink
|
|
107
|
+
|
|
108
|
+
After writing `AGENTS.md`, create `CLAUDE.md` as a symlink to `AGENTS.md` in the same directory.
|
|
109
|
+
|
|
110
|
+
If `CLAUDE.md` already exists as a regular file (not a symlink):
|
|
111
|
+
1. Read the existing `CLAUDE.md` content
|
|
112
|
+
2. Identify any useful, non-redundant content not already covered by the new `AGENTS.md`
|
|
113
|
+
3. Incorporate that content into `AGENTS.md` (respecting the 150-line limit) or into a supporting doc under `docs/`
|
|
114
|
+
4. Remove the old `CLAUDE.md` file and replace it with the symlink
|
|
115
|
+
|
|
116
|
+
Create the symlink with:
|
|
117
|
+
```bash
|
|
118
|
+
ln -sf AGENTS.md CLAUDE.md
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
Required constraints:
|
|
122
|
+
- `AGENTS.md` is the canonical file
|
|
123
|
+
- `CLAUDE.md` is a symlink (not a duplicate copy)
|
|
124
|
+
- The symlink target resolves to `AGENTS.md` from the repository root
|
|
125
|
+
- Pre-existing `CLAUDE.md` content must be preserved (merged into `AGENTS.md` or `docs/`) before replacement
|
|
126
|
+
|
|
127
|
+
### 4d. Progressive Disclosure Rules
|
|
128
|
+
|
|
129
|
+
- Keep `AGENTS.md` concise and universally applicable
|
|
130
|
+
- Put specialized details in `docs/*.md`
|
|
131
|
+
- References from `AGENTS.md` should be direct and descriptive
|
|
132
|
+
- Avoid deep reference chains
|
|
133
|
+
|
|
134
|
+
## Step 5: Quality Review
|
|
135
|
+
|
|
136
|
+
Run this checklist before presenting output:
|
|
137
|
+
|
|
138
|
+
- [ ] `AGENTS.md` is under 150 lines
|
|
139
|
+
- [ ] `CLAUDE.md` is a symlink to `AGENTS.md`
|
|
140
|
+
- [ ] Sections cover project overview, tech stack, key directories, essential commands, additional docs
|
|
141
|
+
- [ ] File:line references are present and accurate
|
|
142
|
+
- [ ] No code snippets in `AGENTS.md`
|
|
143
|
+
- [ ] No generic formatting/style guidance duplicated from linters
|
|
144
|
+
- [ ] `docs/architectural-patterns.md` includes only repeated patterns with evidence
|
|
145
|
+
- [ ] Terminology is consistent (`AGENTS.md`, `CLAUDE.md` symlink, "Additional Documentation", `docs/`)
|
|
146
|
+
|
|
147
|
+
Present result with file paths and invite targeted revision requests.
|
|
148
|
+
|
|
149
|
+
## Guidelines
|
|
150
|
+
|
|
151
|
+
**Scope discipline:**
|
|
152
|
+
- Optimize for first-session usefulness, not exhaustive documentation
|
|
153
|
+
- Prefer omission over speculative or weakly supported claims
|
|
154
|
+
|
|
155
|
+
**Progressive disclosure:**
|
|
156
|
+
- `AGENTS.md` is an entrypoint index
|
|
157
|
+
- Keep advanced details in dedicated `docs/` files
|
|
158
|
+
|
|
159
|
+
**Reliability:**
|
|
160
|
+
- Cite source lines for every non-trivial claim
|
|
161
|
+
- Re-check references after edits
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# Architectural Patterns
|
|
2
|
+
|
|
3
|
+
Document recurring patterns observed across the codebase. Include only patterns backed by multiple examples.
|
|
4
|
+
|
|
5
|
+
## Pattern: [Name]
|
|
6
|
+
|
|
7
|
+
- Intent: [Why this pattern exists]
|
|
8
|
+
- How it appears:
|
|
9
|
+
- [Description of implementation shape]
|
|
10
|
+
- Evidence:
|
|
11
|
+
- `path/to/file:line`
|
|
12
|
+
- `path/to/another-file:line`
|
|
13
|
+
- Implication for new changes:
|
|
14
|
+
- [How contributors/agents should align with this pattern]
|
|
15
|
+
|
|
16
|
+
## Pattern: [Name]
|
|
17
|
+
|
|
18
|
+
- Intent: [Why this pattern exists]
|
|
19
|
+
- How it appears:
|
|
20
|
+
- [Description of implementation shape]
|
|
21
|
+
- Evidence:
|
|
22
|
+
- `path/to/file:line`
|
|
23
|
+
- `path/to/another-file:line`
|
|
24
|
+
- Implication for new changes:
|
|
25
|
+
- [How contributors/agents should align with this pattern]
|
|
26
|
+
|
|
27
|
+
## Placement
|
|
28
|
+
|
|
29
|
+
Store this file at `docs/architectural-patterns.md` (same level as `AGENTS.md`).
|
|
30
|
+
|
|
31
|
+
## Exclusions
|
|
32
|
+
|
|
33
|
+
Do not include:
|
|
34
|
+
- One-off implementation details found in only one file
|
|
35
|
+
- Preference statements without evidence
|
|
36
|
+
- Forward-looking proposals not present in current code
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# AGENTS.md Template
|
|
2
|
+
|
|
3
|
+
Use this template to create the concise canonical memory document.
|
|
4
|
+
|
|
5
|
+
## Project Overview
|
|
6
|
+
|
|
7
|
+
- Purpose: [What the project does and why it exists]
|
|
8
|
+
- Scope: [Core responsibilities and boundaries]
|
|
9
|
+
- Evidence: `path/to/file:line`
|
|
10
|
+
|
|
11
|
+
## Tech Stack
|
|
12
|
+
|
|
13
|
+
- Languages/runtime: [TypeScript, Node.js, etc.]
|
|
14
|
+
- Frameworks/libraries: [Commander.js, Vitest, etc.]
|
|
15
|
+
- Tooling: [build/lint/test tools]
|
|
16
|
+
- Evidence: `path/to/file:line`
|
|
17
|
+
|
|
18
|
+
## Key Directories
|
|
19
|
+
|
|
20
|
+
- `src/...`: [responsibility]
|
|
21
|
+
- `...`: [responsibility]
|
|
22
|
+
- Evidence per directory: `path/to/file:line`
|
|
23
|
+
|
|
24
|
+
## Essential Build/Test Commands
|
|
25
|
+
|
|
26
|
+
- `...`: [what it does and when to use it]
|
|
27
|
+
- `...`: [what it does and when to use it]
|
|
28
|
+
- Evidence: `path/to/file:line`
|
|
29
|
+
|
|
30
|
+
## Additional Documentation
|
|
31
|
+
|
|
32
|
+
- `docs/architectural-patterns.md`: Recurring design patterns and conventions
|
|
33
|
+
- Add only docs that provide specialized detail not suitable for AGENTS.md
|
|
34
|
+
|
|
35
|
+
## Constraints
|
|
36
|
+
|
|
37
|
+
- Keep full document under 150 lines
|
|
38
|
+
- Use file:line references instead of code snippets
|
|
39
|
+
- Keep guidance universally applicable for contributors and agents
|
|
40
|
+
- Treat `AGENTS.md` as canonical, then create `CLAUDE.md` as a symlink to `AGENTS.md`
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: navigate-thoughts
|
|
3
|
+
description: Resolves thoughts/ paths and navigates thought documents. Use when user references a thoughts/ path, asks to find/read/list thoughts documents, or encounters symlinks in the thoughts directory.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Navigating Thoughts
|
|
7
|
+
|
|
8
|
+
Resolve thoughts paths to canonical form and locate documents in the local thoughts directory.
|
|
9
|
+
|
|
10
|
+
## Background
|
|
11
|
+
|
|
12
|
+
`thoughts/` is a symlink-based directory managed by ThoughtCabinet. It points into a central thoughts git repo but is accessed locally via relative paths from the project root.
|
|
13
|
+
|
|
14
|
+
**Directory structure:**
|
|
15
|
+
- `thoughts/{user}/` — Personal repo-specific notes
|
|
16
|
+
- `thoughts/shared/` — Team-shared repo-specific notes (plans, research, PRs)
|
|
17
|
+
- `thoughts/global/` — Cross-repository notes
|
|
18
|
+
- `thoughts/searchable/` — Hard links for search tools (NOT canonical, never reference)
|
|
19
|
+
|
|
20
|
+
**Common subdirectories under `shared/`:**
|
|
21
|
+
- `shared/plans/` — Implementation plans (`YYYY-MM-DD-description.md`)
|
|
22
|
+
- `shared/research/` — Research documents (`YYYY-MM-DD-description.md`)
|
|
23
|
+
|
|
24
|
+
## Workflow
|
|
25
|
+
|
|
26
|
+
1. **Normalize path**
|
|
27
|
+
- Strip `searchable/` segment: `thoughts/searchable/shared/plans/foo.md` → `thoughts/shared/plans/foo.md`
|
|
28
|
+
- Ensure `thoughts/` prefix (add if user gives bare path like `shared/plans/foo.md`)
|
|
29
|
+
- If user gives a description instead of a path, proceed to search
|
|
30
|
+
|
|
31
|
+
2. **Locate document**
|
|
32
|
+
- Exact path given: read it directly
|
|
33
|
+
- Partial/fuzzy: `ls` the likely directory, then match by name or grep for content
|
|
34
|
+
- No path given: `ls -lt thoughts/shared/ thoughts/{user}/ | head -20` to show recent documents
|
|
35
|
+
|
|
36
|
+
3. **Present**
|
|
37
|
+
- Read and present the document content
|
|
38
|
+
- If the path was non-canonical (e.g. contained `searchable/`), note the canonical path
|
|
39
|
+
|
|
40
|
+
## Rules
|
|
41
|
+
|
|
42
|
+
- **NEVER reference `thoughts/searchable/` paths** in output — always use canonical paths
|
|
43
|
+
- **All paths are relative** to the project root (e.g. `thoughts/shared/plans/...`, never absolute)
|
|
44
|
+
- If `thoughts/` doesn't exist, tell the user to run `thc thoughts init`
|
|
45
|
+
- When listing, prefer `ls -lt` (recent first) for discoverability
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: onboard
|
|
3
|
+
description: Onboard an AI agent to a new project by initializing ThoughtCabinet thoughts repo and bootstrapping agent memory. Use when starting work on a new repository, setting up a fresh project for AI-assisted development, or when the user asks to onboard, bootstrap, or initialize a project.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Onboarding a New Project
|
|
7
|
+
|
|
8
|
+
Set up a new project for AI-assisted development: initialize the thoughts repo and bootstrap agent memory in one workflow.
|
|
9
|
+
|
|
10
|
+
## Workflow Context
|
|
11
|
+
|
|
12
|
+
This skill orchestrates two capabilities that are normally run separately:
|
|
13
|
+
- `thc init` — connects the project to a thoughts repo
|
|
14
|
+
- `init-agent-memory` skill — creates AGENTS.md and supporting docs
|
|
15
|
+
|
|
16
|
+
After onboarding, the project is ready for skills like `creating-plan`, `research-codebase`, and `implementing-plan`.
|
|
17
|
+
|
|
18
|
+
## Workflow Overview
|
|
19
|
+
|
|
20
|
+
1. **Pre-flight + Initialize thoughts** - Run `onboard.sh`: check environment, run `thc init`
|
|
21
|
+
2. **Bootstrap agent memory** - Invoke `init-agent-memory` skill (if needed)
|
|
22
|
+
3. **Verify** - Run `onboard.sh --verify-only`: confirm everything is wired up
|
|
23
|
+
|
|
24
|
+
## Step 1: Pre-flight and Initialize Thoughts
|
|
25
|
+
|
|
26
|
+
Run: `bash onboard.sh`
|
|
27
|
+
|
|
28
|
+
**Exit codes determine next action**:
|
|
29
|
+
- **1** — Fatal error (not a git repo, thc missing, init failed). Stop and report.
|
|
30
|
+
- **2** — Thoughts ready, AGENTS.md not found. Proceed to Step 2.
|
|
31
|
+
- **3** — Thoughts + AGENTS.md both exist. Ask user if they want to regenerate memory or skip to Step 3.
|
|
32
|
+
|
|
33
|
+
If thoughts was already initialized and user wants to re-initialize:
|
|
34
|
+
```bash
|
|
35
|
+
bash onboard.sh --force
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Step 2: Bootstrap Agent Memory
|
|
39
|
+
|
|
40
|
+
**If AGENTS.md already exists**: Ask the user whether to regenerate or skip.
|
|
41
|
+
|
|
42
|
+
**If AGENTS.md does not exist**: Invoke the `init-agent-memory` skill.
|
|
43
|
+
|
|
44
|
+
**Note**: `thoughts/CLAUDE.md` (from Step 1) and root `CLAUDE.md` (from this step) serve different purposes:
|
|
45
|
+
- `thoughts/CLAUDE.md` — thoughts directory usage rules
|
|
46
|
+
- `./CLAUDE.md` — project memory for the AI agent (symlink to AGENTS.md)
|
|
47
|
+
|
|
48
|
+
## Step 3: Verify and Present
|
|
49
|
+
|
|
50
|
+
Run: `bash onboard.sh --verify-only`
|
|
51
|
+
|
|
52
|
+
Present results to user:
|
|
53
|
+
|
|
54
|
+
```
|
|
55
|
+
Project onboarding complete!
|
|
56
|
+
|
|
57
|
+
- thoughts/ connected to [thoughts repo path]
|
|
58
|
+
- AGENTS.md created with project context
|
|
59
|
+
- Git hooks installed (auto-sync on commit)
|
|
60
|
+
|
|
61
|
+
You're ready to use skills like /creating-plan, /research-codebase, and /implementing-plan.
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
If any step was skipped or failed, note it clearly with suggested remediation.
|
|
65
|
+
|
|
66
|
+
## Guidelines
|
|
67
|
+
|
|
68
|
+
**Be incremental**: Re-running the skill should be safe — each step skips if already done.
|
|
69
|
+
|
|
70
|
+
**Fail fast**: If a critical step fails, stop and report rather than continuing with a broken setup.
|
|
71
|
+
|
|
72
|
+
**Minimal prompting**: Only ask questions when the answer cannot be inferred from the environment.
|
|
73
|
+
|
|
74
|
+
**Respect existing work**: Never overwrite AGENTS.md, CLAUDE.md, or thoughts/ without explicit user confirmation.
|