cc-brain 0.1.4 → 0.1.6

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
@@ -45,19 +45,27 @@ npm install -g cc-brain
45
45
  cc-brain install
46
46
  ```
47
47
 
48
- ### npx (no install)
48
+ ### npx (one-liner)
49
49
  ```bash
50
50
  npx cc-brain install
51
51
  ```
52
52
 
53
- ### bunx
53
+ ### bun
54
54
  ```bash
55
- bunx cc-brain install
55
+ bun install -g cc-brain
56
+ cc-brain install
57
+ ```
58
+
59
+ ### GitHub Packages
60
+ ```bash
61
+ npm install -g @tripzcodes/cc-brain --registry=https://npm.pkg.github.com
62
+ cc-brain install
56
63
  ```
57
64
 
58
- ### Claude Plugin
65
+ ### Upgrade
59
66
  ```bash
60
- claude plugins add cc-brain
67
+ npm install -g cc-brain@latest
68
+ cc-brain install
61
69
  ```
62
70
 
63
71
  ---
@@ -145,25 +153,27 @@ claude plugins add cc-brain
145
153
 
146
154
  ---
147
155
 
148
- ## Commands
156
+ ## Skills
149
157
 
150
- Use these skills in Claude Code:
158
+ Skills are installed to `~/.claude/skills/` and available in Claude Code:
151
159
 
152
- | Command | Description |
153
- |---------|-------------|
160
+ | Skill | Description |
161
+ |-------|-------------|
154
162
  | `/save` | Save session context to brain |
155
163
  | `/recall <query>` | Search archive for past context |
156
164
  | `/brain` | View current brain state |
157
165
 
166
+ Skills are automatically discovered by Claude Code after installation.
167
+
158
168
  ---
159
169
 
160
170
  ## CLI
161
171
 
162
172
  ```bash
163
173
  # Setup
164
- cc-brain install # Install hooks (merges with existing)
165
- cc-brain uninstall # Remove hooks (preserves user hooks)
166
- cc-brain uninstall --purge # Remove everything
174
+ cc-brain install # Install hooks + skills
175
+ cc-brain uninstall # Remove hooks + skills (preserves brain data)
176
+ cc-brain uninstall --purge # Remove everything including brain data
167
177
 
168
178
  # Search & Archive
169
179
  cc-brain recall "query" # Search archive (scored results)
@@ -201,8 +211,8 @@ skills/
201
211
  recall.md /recall skill
202
212
  brain.md /brain skill
203
213
  scripts/
204
- install.js Install hooks (merges, preserves existing)
205
- uninstall.js Remove hooks (filters cc-brain only)
214
+ install.js Install hooks + skills to ~/.claude/
215
+ uninstall.js Remove hooks + skills (--purge for full removal)
206
216
  ```
207
217
 
208
218
  ---
package/hooks/hooks.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "hooks": [
6
6
  {
7
7
  "type": "command",
8
- "command": "bun \"$CLAUDE_PROJECT_DIR/src/loader.js\"",
8
+ "command": "npx cc-brain load",
9
9
  "timeout": 5,
10
10
  "statusMessage": "Loading brain..."
11
11
  }
@@ -17,7 +17,7 @@
17
17
  "hooks": [
18
18
  {
19
19
  "type": "agent",
20
- "prompt": "Context is being compacted. Save important information using the structured saver.\n\nANALYZE this session for:\n- New user insights (T1 - rare)\n- New preferences (T1 - rare)\n- Project decisions + rationale (T2)\n- Current focus/state (T2)\n- Session summary (T3 - if significant)\n\nBUILD JSON payload:\n```json\n{\n \"t2\": {\n \"what\": \"Project description\",\n \"focus\": [\"current tasks\"],\n \"decisions\": {\"decision\": \"rationale\"}\n },\n \"t3\": \"Session summary if significant work done.\"\n}\n```\n\nSAVE using:\n```bash\nbun src/saver.js --json '<payload>'\n```\n\nRules:\n- Only include tiers with new info\n- T2 updates are common, T1 updates are rare\n- Decisions need rationale\n- Keep it concise",
20
+ "prompt": "Context is being compacted. Save important information using the structured saver.\n\nANALYZE this session for:\n- New user insights (T1 - rare)\n- New preferences (T1 - rare)\n- Project decisions + rationale (T2)\n- Current focus/state (T2)\n- Session summary (T3 - if significant)\n\nBUILD JSON payload:\n```json\n{\n \"t2\": {\n \"what\": \"Project description\",\n \"focus\": [\"current tasks\"],\n \"decisions\": {\"decision\": \"rationale\"}\n },\n \"t3\": \"Session summary if significant work done.\"\n}\n```\n\nSAVE using:\n```bash\nnpx cc-brain save --json '<payload>'\n```\n\nRules:\n- Only include tiers with new info\n- T2 updates are common, T1 updates are rare\n- Decisions need rationale\n- Keep it concise",
21
21
  "timeout": 120,
22
22
  "statusMessage": "Saving to brain..."
23
23
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cc-brain",
3
- "version": "0.1.4",
3
+ "version": "0.1.6",
4
4
  "description": "Persistent memory system for Claude Code - remembers context across sessions",
5
5
  "type": "module",
6
6
  "bin": {
@@ -18,7 +18,7 @@
18
18
  "scripts": {
19
19
  "postinstall": "node scripts/install.js",
20
20
  "preuninstall": "node scripts/uninstall.js",
21
- "test": "node src/loader.js"
21
+ "test": "bun test"
22
22
  },
23
23
  "keywords": [
24
24
  "claude",
@@ -66,9 +66,8 @@ if (existsSync(settingsPath)) {
66
66
  // Read our hooks config
67
67
  const hooks = JSON.parse(readFileSync(join(PROJECT_ROOT, 'hooks', 'hooks.json'), 'utf-8'));
68
68
 
69
- // Update loader path to absolute (forward slashes for cross-platform)
70
- const loaderPath = join(PROJECT_ROOT, 'src', 'loader.js').replace(/\\/g, '/');
71
- hooks.SessionStart[0].hooks[0].command = `bun "${loaderPath}"`;
69
+ // Use npx to resolve package at runtime (works regardless of install location)
70
+ hooks.SessionStart[0].hooks[0].command = 'npx cc-brain load';
72
71
 
73
72
  // Merge hooks — preserve user's other hooks, replace/append ours
74
73
  function isCcBrainHook(entry) {
package/src/loader.js CHANGED
@@ -96,12 +96,14 @@ function loadBrain() {
96
96
  const pruned = autoPruneArchive();
97
97
 
98
98
  const parts = [];
99
+ let hasContent = false;
99
100
 
100
101
  parts.push('<brain>');
101
102
 
102
103
  // Show pruned files warning
103
104
  if (pruned.length > 0) {
104
105
  parts.push(`[Auto-pruned ${pruned.length} archive entries older than ${AUTO_PRUNE_DAYS} days: ${pruned.join(', ')}]\n`);
106
+ hasContent = true;
105
107
  }
106
108
 
107
109
  // ═══════════════════════════════════════════
@@ -113,6 +115,7 @@ function loadBrain() {
113
115
  parts.push('<user-profile>');
114
116
  parts.push(user);
115
117
  parts.push('</user-profile>');
118
+ hasContent = true;
116
119
  }
117
120
 
118
121
  const prefs = readIfExists(join(BRAIN_DIR, 'preferences.md'), LIMITS.preferences);
@@ -120,6 +123,7 @@ function loadBrain() {
120
123
  parts.push('<preferences>');
121
124
  parts.push(prefs);
122
125
  parts.push('</preferences>');
126
+ hasContent = true;
123
127
  }
124
128
 
125
129
  // ═══════════════════════════════════════════
@@ -135,6 +139,7 @@ function loadBrain() {
135
139
  parts.push(`<project id="${PROJECT_ID}">`);
136
140
  parts.push(context);
137
141
  parts.push('</project>');
142
+ hasContent = true;
138
143
  }
139
144
  }
140
145
 
@@ -154,14 +159,14 @@ function loadBrain() {
154
159
 
155
160
  parts.push('</brain>');
156
161
 
157
- return parts.join('\n');
162
+ return { output: parts.join('\n'), hasContent };
158
163
  }
159
164
 
160
- const brain = loadBrain();
165
+ const { output, hasContent } = loadBrain();
161
166
 
162
167
  // Only output if there's actual content
163
- if (brain.replace(/<\/?brain>/g, '').replace(/<[^>]+\/>/g, '').replace(/<[^>]+>[^<]*<\/[^>]+>/g, '').replace(/\[.*?\]/g, '').replace(/<!--.*?-->/g, '').trim()) {
164
- console.log(brain);
168
+ if (hasContent) {
169
+ console.log(output);
165
170
  console.log('\n---');
166
171
  console.log('Above is your persistent memory. Use /save to update, /recall to search archive.');
167
172
  }