claude-compass 0.0.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.
@@ -0,0 +1,217 @@
1
+ claude-memory — Full Product Spec
2
+ What It Is
3
+ claude-memory is an npm package that extends Claude Code with automatic CLAUDE.md lifecycle management. It installs hooks and agents into Claude Code's existing infrastructure so that project context stays accurate over time — silently, without interrupting the developer's workflow.
4
+ It works exclusively with Claude Code. No separate runtime, no background processes, no cloud dependency.
5
+
6
+ How It Works — The Full Flow
7
+ Developer works in Claude Code
8
+
9
+ PostToolUse hook fires after significant file writes
10
+
11
+ Hook appends one-line note to .claude/pending-updates.md
12
+ (pure bash, zero LLM tokens)
13
+
14
+ Session ends
15
+
16
+ SessionEnd hook prints summary:
17
+ "✦ claude-memory: 3 changes logged"
18
+
19
+ Developer finishes their day or a feature
20
+
21
+ claude-md-updater agent runs (manually or on threshold)
22
+
23
+ Reads pending-updates.md + CLAUDE.md
24
+ Makes surgical updates to CLAUDE.md
25
+ Clears pending-updates.md
26
+ Prints: "CLAUDE.md updated — 2 conventions added, 1 gotcha recorded"
27
+
28
+ npm Package Structure
29
+ claude-memory/
30
+ ├── package.json
31
+ ├── bin/
32
+ │ └── claude-memory.js ← CLI entry point
33
+ ├── src/
34
+ │ ├── install.js ← installs hooks + agents into ~/.claude
35
+ │ ├── status.js ← reads and displays current state
36
+ │ ├── update.js ← manually triggers claude-md-updater
37
+ │ └── init.js ← creates CLAUDE.md + folder structure
38
+ ├── templates/
39
+ │ ├── hooks/
40
+ │ │ ├── post-tool-use.js ← the hook that logs changes
41
+ │ │ └── session-end.js ← the hook that prints summary
42
+ │ └── agents/
43
+ │ └── claude-md-updater.md ← the updater agent
44
+ └── README.md
45
+
46
+ Installation Experience
47
+ User runs:
48
+ bashnpm install -g claude-memory
49
+ claude-memory init
50
+ claude-memory init does the following in order:
51
+
52
+ Detects if the current directory is a git repo — if not, warns but continues
53
+ Checks if CLAUDE.md already exists — if yes, backs it up to CLAUDE.md.backup before touching anything
54
+ Creates .claude/context/ directory
55
+ Creates .claude/pending-updates.md with empty state
56
+ Installs hooks into ~/.claude/hooks/ (global) or .claude/hooks/ (project)
57
+ Installs claude-md-updater agent into .claude/agents/
58
+ If no CLAUDE.md exists, runs codebase-explorer agent to generate one
59
+ Prints:
60
+
61
+ ✦ claude-memory initialized
62
+
63
+ CLAUDE.md ✓ ready
64
+ pending-updates ✓ ready
65
+ hooks ✓ post-tool-use, session-end registered
66
+ agent ✓ claude-md-updater installed
67
+
68
+ Changes will be logged silently during sessions.
69
+ Run: claude-memory status to check anytime.
70
+
71
+ File Architecture
72
+ CLAUDE.md — stable core
73
+ Only contains things that rarely change:
74
+
75
+ Project purpose (1-2 sentences)
76
+ Tech stack
77
+ Key architectural decisions
78
+ Coding conventions
79
+ Folder structure overview
80
+ Critical gotchas
81
+ A ## Last Updated line at the bottom with date
82
+
83
+ .claude/pending-updates.md
84
+ Append-only log during sessions. Format:
85
+ [2026-04-03 14:23] FILE_WRITE: server/routes/auth.js — new OAuth route added
86
+ [2026-04-03 14:31] FILE_WRITE: server/db/migrations/004_add_sessions.sql — new sessions table
87
+ [2026-04-03 15:12] AGENT_NOTE: discovered that session tokens must be rotated on each request
88
+ Gets cleared after each successful CLAUDE.md update.
89
+ .claude/context/ — optional reference files
90
+ Only created if needed. Never auto-loaded — agents read them explicitly when relevant:
91
+ .claude/context/
92
+ ├── decisions.md ← architectural decisions and why
93
+ ├── known-issues.md ← current bugs and gotchas
94
+ └── recent-changes.md ← what changed in last 2 weeks
95
+
96
+ Hook Design
97
+ PostToolUse Hook — post-tool-use.js
98
+ Fires after every tool use in Claude Code.
99
+ Logic:
100
+
101
+ If tool is NOT a file write (Write, Edit, MultiEdit) → exit immediately, do nothing
102
+ If file written is in node_modules/, .git/, dist/, build/ → exit, do nothing
103
+ If file written is a lockfile (package-lock.json, yarn.lock) → exit, do nothing
104
+ Otherwise → append one line to .claude/pending-updates.md:
105
+
106
+ [timestamp] FILE_WRITE: path/to/file — {brief description from tool context}
107
+ This is pure JavaScript/bash. Zero LLM calls. Costs nothing.
108
+ SessionEnd Hook — session-end.js
109
+ Fires when Claude Code session ends.
110
+ Logic:
111
+
112
+ Read .claude/pending-updates.md
113
+ Count lines
114
+ If 0 lines → print nothing
115
+ If 1-2 lines → print nothing (too minor to surface)
116
+ If 3+ lines → print:
117
+
118
+ ✦ claude-memory: 4 changes logged — run claude-memory update to sync CLAUDE.md
119
+
120
+ If 10+ lines → print with urgency:
121
+
122
+ ✦ claude-memory: 12 changes logged — CLAUDE.md may be out of date
123
+ run: claude-memory update
124
+
125
+ The claude-md-updater Agent
126
+ This is the only part that uses LLM tokens.
127
+ Trigger: Either manually via claude-memory update CLI command, or when developer explicitly asks in Claude Code: "update CLAUDE.md" or "sync claude memory."
128
+ Agent description for Claude Code:
129
+ Use this agent when the user runs claude-memory update, asks to update
130
+ CLAUDE.md, asks to sync project context, or says "update claude memory".
131
+ Also triggers when pending-updates.md has 10 or more entries. Does NOT
132
+ trigger during normal coding work.
133
+ What the agent does:
134
+
135
+ Reads .claude/pending-updates.md in full
136
+ Reads current CLAUDE.md in full
137
+ For each entry in pending-updates, decides: does this represent a change significant enough to update CLAUDE.md? Criteria:
138
+
139
+ New file in a key directory (new route, new service, new migration) → yes
140
+ Change to existing file that's already documented → maybe, only if it changes the documented behavior
141
+ Lockfile, config tweak, minor edit → no
142
+
143
+
144
+ Makes only surgical edits to CLAUDE.md — adds lines, updates existing lines, never rewrites sections wholesale
145
+ Updates the ## Last Updated line
146
+ Clears .claude/pending-updates.md (writes empty file)
147
+ Prints a one-line summary:
148
+
149
+ ✦ CLAUDE.md updated — 2 entries added, 1 updated, 9 skipped
150
+ Token cost estimate: ~2,000-4,000 tokens per run. At typical API rates, less than $0.01 per update. Run it once a day — negligible.
151
+
152
+ CLI Commands
153
+ claude-memory init
154
+ First-time setup. Run once per project.
155
+
156
+ Creates folder structure
157
+ Installs hooks and agent
158
+ Generates CLAUDE.md if missing
159
+ Safe to re-run — won't overwrite existing CLAUDE.md without confirmation
160
+
161
+ claude-memory status
162
+ Shows current state. Safe to run anytime.
163
+ ✦ claude-memory status
164
+
165
+ Project: my-project
166
+ CLAUDE.md last updated 2 days ago (Apr 1)
167
+ Pending updates: 4 changes waiting
168
+ Last session: logged 2 changes (today 3:45pm)
169
+ Agent: claude-md-updater ✓ installed
170
+ Hooks: post-tool-use ✓ session-end ✓
171
+ claude-memory update
172
+ Manually triggers the claude-md-updater agent inside Claude Code.
173
+
174
+ Only works when run from inside a Claude Code session
175
+ If run outside Claude Code, prints:
176
+
177
+ ✦ claude-memory: open Claude Code and run this command from inside a session,
178
+ or type "update CLAUDE.md" in your Claude Code chat.
179
+ claude-memory reset
180
+ Clears pending-updates.md without updating CLAUDE.md.
181
+
182
+ Asks for confirmation first
183
+ Useful if pending changes are all irrelevant
184
+
185
+
186
+ package.json
187
+ json{
188
+ "name": "claude-memory",
189
+ "version": "0.1.0",
190
+ "description": "Automatic CLAUDE.md lifecycle management for Claude Code",
191
+ "bin": {
192
+ "claude-memory": "./bin/claude-memory.js"
193
+ },
194
+ "keywords": [
195
+ "claude",
196
+ "claude-code",
197
+ "anthropic",
198
+ "ai",
199
+ "developer-tools"
200
+ ],
201
+ "engines": {
202
+ "node": ">=18.0.0"
203
+ }
204
+ }
205
+
206
+ What To Build First — Prioritized Order
207
+ Tell Claude Code to build in this order so you have something working at each step:
208
+
209
+ npm package skeleton — package.json, bin/claude-memory.js, basic CLI routing
210
+ claude-memory init — folder creation, file scaffolding, confirmation output
211
+ claude-memory status — reads state and displays it
212
+ PostToolUse hook — the change logger
213
+ SessionEnd hook — the session summary
214
+ claude-md-updater agent — the CLAUDE.md syncer
215
+ claude-memory update — triggers the agent
216
+ claude-memory reset — clears pending updates
217
+ Polish — error handling, edge cases, first-run experience
package/package.json ADDED
@@ -0,0 +1 @@
1
+ {"name":"claude-compass","version":"0.0.1"}