@misterhuydo/cairn-mcp 1.2.7 → 1.2.8

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,309 +1,101 @@
1
- # Cairn MCP
2
-
3
- > Persistent polyglot knowledge graph for Claude Code. Index once, query forever.
4
-
5
- Claude is stateless — every session starts at zero. On a multi-repo codebase with Java backends, TypeScript frontends, and Vue components, that means 50% of every session is archaeology: finding where things live before any real work can begin.
6
-
7
- **Cairn fixes this.** It indexes your project into a local SQLite knowledge graph (stored in `.cairn/`) and exposes 8 MCP tools that give Claude instant, persistent memory across sessions.
8
-
9
- ---
10
-
11
- # Setup
12
- - See how-to-use.md
13
-
14
- ```bash
15
- npm install -g @misterhuydo/cairn-mcp
16
- ```
17
-
18
- **Requirements:** Node.js >= 22.15.0
19
-
20
- ---
21
-
22
- ## Setup
23
-
24
- Add to `~/.claude.json`:
25
-
26
- ```json
27
- {
28
- "mcpServers": {
29
- "cairn": {
30
- "command": "cairn-mcp"
31
- }
32
- }
33
- }
34
- ```
35
-
36
- Restart Claude Code. Done.
37
-
38
- ---
39
-
40
- ## Passive hooks (recommended)
41
-
42
- Install once and Cairn works automatically — no need to call `cairn_bundle` or `cairn_checkpoint` manually.
43
-
44
- **Global (all projects):**
45
-
46
- ```bash
47
- cairn install-hooks --global
48
- ```
49
-
50
- **Project-only:**
51
-
52
- ```bash
53
- cairn install-hooks
54
- ```
55
-
56
- | Hook | Trigger | Effect |
57
- |---|---|---|
58
- | `PreToolUse[Read]` | Every file read | Source files compressed ~68% before Claude sees them |
59
- | `Stop` | Every response | Session auto-saved to `.cairn/session.json` |
60
- | `UserPromptSubmit` | First message of session | Claude reminded of prior session, prompted to call `cairn_resume` |
61
-
62
- ## How it works
63
-
64
- Cairn works like git it looks for `.cairn/` in your current working directory. Run Claude Code from your project root and Cairn automatically stores the index at `.cairn/index.db` and bundles at `.cairn/bundles/`.
65
-
66
- No root paths needed. No global config. Just `cd` to your project and go.
67
-
68
- ---
69
-
70
- ## Tools
71
-
72
- ### `cairn_maintain` Index your project
73
- Run once at the start of each session. The index persists in `.cairn/index.db`.
74
-
75
- ```
76
- cairn_maintain()
77
- cairn_maintain({ languages: ["typescript", "vue"] }) // limit to specific languages
78
- ```
79
-
80
- ```json
81
- {
82
- "repos_indexed": 1,
83
- "files_by_language": { "java": 412, "typescript": 287, "vue": 94 },
84
- "symbols_total": 6841,
85
- "security_findings": 47,
86
- "duration_ms": 4200
87
- }
88
- ```
89
-
90
- ---
91
-
92
- ### `cairn_search` Find anything across all languages
93
- ```
94
- cairn_search({ query: "user authentication", language: "typescript" })
95
- ```
96
-
97
- ```json
98
- [
99
- { "lang": "typescript", "kind": "function", "fqn": "src/composables/useAuth.ts::useAuth" },
100
- { "lang": "vue", "kind": "component", "fqn": "src/components/LoginForm.vue::LoginForm" },
101
- { "lang": "java", "kind": "class", "fqn": "com.example.auth.UserAuthenticator" }
102
- ]
103
- ```
104
-
105
- ---
106
-
107
- ### `cairn_bundle` — Minified source snapshot for Claude to read
108
- Strips comments and empty lines, writes a compressed `### File:` bundle. Use after `cairn_search` to give Claude readable source without blowing the context window.
109
-
110
- ```
111
- cairn_bundle({ filter_paths: ["src/components/checkout"], bundle_name: "checkout" })
112
- ```
113
-
114
- ```json
115
- {
116
- "bundle_path": "/your/project/.cairn/bundles/checkout.txt",
117
- "original_kb": 284,
118
- "compressed_kb": 91,
119
- "reduction_pct": 68
120
- }
121
- ```
122
-
123
- ---
124
-
125
- ### `cairn_describe` — Summarize a module
126
- ```
127
- cairn_describe({ path: "src/components/checkout" })
128
- ```
129
-
130
- ```json
131
- {
132
- "languages": ["vue", "typescript"],
133
- "symbols": {
134
- "component": ["CheckoutForm", "OrderSummary", "PaymentStep"],
135
- "function": ["useCheckout", "usePayment"]
136
- },
137
- "imports_from": ["src/store/cart.ts", "src/api/orders.ts"],
138
- "imported_by": ["src/views/CartView.vue"],
139
- "external_deps": ["stripe", "@stripe/stripe-js"]
140
- }
141
- ```
142
-
143
- ---
144
-
145
- ### `cairn_code_graph` — Dependency health
146
- ```
147
- cairn_code_graph({ mode: "instability" })
148
- ```
149
-
150
- ```json
151
- {
152
- "modules": [
153
- { "name": "src/views", "instability": 1.0, "status": "safe_to_refactor" },
154
- { "name": "src/composables", "instability": 0.4, "status": "review_before_change" },
155
- { "name": "src/utils", "instability": 0.1, "status": "load_bearing" }
156
- ]
157
- }
158
- ```
159
-
160
- Modes: `instability` · `health` · `cycles`
161
-
162
- ---
163
-
164
- ### `cairn_security` — Vulnerability scan
165
- ```
166
- cairn_security({ severity: "HIGH" })
167
- ```
168
-
169
- ```json
170
- {
171
- "total_findings": 12,
172
- "by_language": { "typescript": 7, "java": 5 },
173
- "findings": [
174
- { "severity": "HIGH", "cwe": "CWE-79", "file": "src/components/UserProfile.vue", "line": 84, "rule": "XSS via innerHTML" },
175
- { "severity": "HIGH", "cwe": "CWE-611", "file": "backend/src/.../XmlParser.java", "line": 47, "rule": "XXE" }
176
- ]
177
- }
178
- ```
179
-
180
- Covers: XSS · XXE · SQL injection · command injection · weak crypto · hardcoded secrets · open redirect · unsafe deserialization
181
-
182
- ---
183
-
184
- ### `cairn_minify` — Minify a single file
185
- Minify one source file on demand. Returns compressed content with a `[cairn: N → M lines]` header. Useful when passive hooks are not installed.
186
-
187
- ```
188
- cairn_minify({ file_path: "/abs/path/to/Service.java" })
189
- ```
190
-
191
- ---
192
-
193
- ### `cairn_checkpoint` — Save session state
194
- Tell Cairn what you were working on so the next session can pick up where you left off.
195
-
196
- ```
197
- cairn_checkpoint({
198
- message: "Added multi-currency to CheckoutForm, still need PaymentStep",
199
- active_files: ["src/components/checkout/CheckoutForm.vue"],
200
- notes: ["CurrencyService expects ISO 4217 codes, not symbols"]
201
- })
202
- ```
203
-
204
- ```json
205
- {
206
- "saved": true,
207
- "checkpoint_at": "2026-02-25T14:30:00Z",
208
- "active_files_tracked": 1,
209
- "notes_saved": 1
210
- }
211
- ```
212
-
213
- ---
214
-
215
- ### `cairn_resume` — Restore session + smart re-index
216
- Call instead of `cairn_maintain` when resuming work. Detects which files changed and only re-indexes those.
217
-
218
- ```
219
- cairn_resume()
220
- ```
221
-
222
- ```json
223
- {
224
- "last_checkpoint": "2026-02-25T14:30:00Z",
225
- "message": "Added multi-currency to CheckoutForm, still need PaymentStep",
226
- "index_status": "incremental",
227
- "files_reindexed": 2,
228
- "files_unchanged": 845,
229
- "changed_since_checkpoint": [
230
- { "file": "src/components/checkout/PaymentStep.vue", "change": "modified" }
231
- ],
232
- "active_files": ["src/components/checkout/CheckoutForm.vue"],
233
- "notes": ["CurrencyService expects ISO 4217 codes, not symbols"],
234
- "resume_summary": "Last session you were adding multi-currency support..."
235
- }
236
- ```
237
-
238
- ---
239
-
240
- ## Supported Languages
241
-
242
- | Language | What Cairn extracts |
243
- |---|---|
244
- | Java | packages, classes, interfaces, enums, records, methods |
245
- | TypeScript / JavaScript | classes, interfaces, functions, types, enums |
246
- | Vue | components, composables, script block symbols |
247
- | Python | classes, functions, decorators |
248
- | SQL | tables, views, stored procedures |
249
- | XML / HTML | bean ids, component names |
250
- | Config (YAML, properties, .env) | top-level keys |
251
- | Markdown | headings |
252
- | Build files (pom.xml, package.json, build.gradle) | dependencies |
253
-
254
- ---
255
-
256
- ## Typical session
257
-
258
- **With passive hooks (recommended):**
259
- ```
260
- 1. cairn_maintain → index project
261
- 2. cairn_search → find the symbols you need
262
- 3. cairn_describe → understand a module before modifying it
263
- 4. cairn_security → check for issues before a PR
264
- (reads auto-compressed, session auto-saved — nothing else needed)
265
- ```
266
-
267
- **Without hooks:**
268
- ```
269
- 1. cairn_maintain → index project (persists between sessions)
270
- 2. cairn_search → find the symbols you need
271
- 3. cairn_bundle → get a readable snapshot of relevant files
272
- 4. cairn_describe → understand a module before modifying it
273
- 5. cairn_security → check for issues before a PR
274
- 6. cairn_checkpoint → save what you were working on
275
- ```
276
-
277
- **Resuming work:**
278
- ```
279
- 1. cairn_resume → restore session + incremental re-index
280
- 2. cairn_search → continue where you left off
281
- ```
282
-
283
- ## Complete session lifecycle
284
-
285
- ```
286
- ─── START OF SESSION ──────────────────────────────────────────
287
- You: "Hey Claude, please resume and continue"
288
- Claude: cairn_resume
289
- → "Last session: adding multi-currency to checkout.
290
- PaymentStep.vue was modified since checkpoint (2 files changed, re-indexed).
291
- Notes: CurrencyService expects ISO 4217 codes. PaymentStep EUR bug not fixed yet.
292
- Ready to continue."
293
-
294
- ─── DURING SESSION ────────────────────────────────────────────
295
- Claude uses: cairn_search, cairn_code_graph, cairn_security
296
- as needed — all reading from .cairn/index.db in cwd
297
- (file reads auto-compressed by PreToolUse hook)
298
-
299
- ─── END OF SESSION ────────────────────────────────────────────
300
- You: "Ok let's stop here for today"
301
- (Stop hook fires → .cairn/session.json auto-saved)
302
- → Next session: cairn_resume picks up automatically
303
- ```
304
-
305
- ---
306
-
307
- ## License
308
-
309
- MIT
1
+ # Cairn MCP
2
+
3
+ Persistent polyglot knowledge graph for Claude Code. Index once, query forever.
4
+
5
+ Claude is stateless — every session starts cold. Cairn fixes this by indexing your project into a local SQLite knowledge graph and wiring into Claude Code via hooks, so file compression, checkpointing, and session restore all happen automatically in the background.
6
+
7
+ ---
8
+
9
+ ## Install
10
+
11
+ ```bash
12
+ npm install -g @misterhuydo/cairn-mcp
13
+ ```
14
+
15
+ **Requirements:** Node.js >= 22.15.0
16
+
17
+ ---
18
+
19
+ ## Setup
20
+
21
+ **1. Register the MCP server** — add to `~/.claude.json` and restart Claude Code:
22
+
23
+ ```json
24
+ {
25
+ "mcpServers": {
26
+ "cairn": {
27
+ "command": "cairn-mcp"
28
+ }
29
+ }
30
+ }
31
+ ```
32
+
33
+ > Already have other MCP servers? Just add `"cairn": { "command": "cairn-mcp" }` inside your existing `"mcpServers"` block.
34
+
35
+ **2. Install passive hooks:**
36
+
37
+ ```bash
38
+ cairn install-hooks --global # recommended — applies to all projects
39
+ # or
40
+ cairn install-hooks # this project only (.claude/settings.json)
41
+ ```
42
+
43
+ That's it. Cairn now runs silently in the background — no manual tool calls needed.
44
+
45
+ ---
46
+
47
+ ## What the hooks do
48
+
49
+ | Hook | Trigger | Effect |
50
+ |---|---|---|
51
+ | `PreToolUse[Read]` | Every file read | Source files compressed ~68% before Claude sees them |
52
+ | `Stop` | End of every response | Session auto-saved to `.cairn/session.json` |
53
+ | `UserPromptSubmit` | First message of a new session | Fresh project: Claude prompted to run `cairn_maintain`. Returning session: Claude prompted to run `cairn_resume` |
54
+
55
+ ---
56
+
57
+ ## First use
58
+
59
+ Just open Claude Code from your project root and start working. The `UserPromptSubmit` hook handles everything:
60
+
61
+ - **Fresh project** — hook tells Claude to run `cairn_maintain`, index is built automatically
62
+ - **Returning session** — hook tells Claude to run `cairn_resume`, prior context is restored
63
+
64
+ No manual steps. The index lives in `.cairn/index.db` inside your project like a `.git` folder, just `cd` to the root and everything works.
65
+
66
+ ---
67
+
68
+ ## Tools
69
+
70
+ | Tool | What it does |
71
+ |---|---|
72
+ | `cairn_maintain` | Full index of the current project |
73
+ | `cairn_resume` | Restore last session + re-index only changed files |
74
+ | `cairn_search` | Find classes, functions, components by name or concept |
75
+ | `cairn_describe` | Summarize what a folder or module does |
76
+ | `cairn_code_graph` | Dependency health — instability, cycles, load-bearing modules |
77
+ | `cairn_security` | Scan for XSS, SQLi, hardcoded secrets, weak crypto, and more |
78
+ | `cairn_bundle` | Minified source snapshot (auto-handled by hooks) |
79
+ | `cairn_checkpoint` | Save session state (auto-handled by hooks) |
80
+
81
+ ---
82
+
83
+ ## Supported languages
84
+
85
+ | Language | What Cairn extracts |
86
+ |---|---|
87
+ | Java | packages, classes, interfaces, enums, records, methods |
88
+ | TypeScript / JavaScript | classes, interfaces, functions, types, enums |
89
+ | Vue | components, composables, script block symbols |
90
+ | Python | classes, functions, decorators |
91
+ | SQL | tables, views, stored procedures |
92
+ | XML / HTML | bean ids, component names |
93
+ | Config (YAML, properties, .env) | top-level keys |
94
+ | Markdown | headings |
95
+ | Build files (pom.xml, package.json, build.gradle) | dependencies |
96
+
97
+ ---
98
+
99
+ ## License
100
+
101
+ MIT
package/bin/cairn-cli.js CHANGED
@@ -147,9 +147,22 @@ if (subcommand === 'minify') {
147
147
  } else if (subcommand === 'resume-hint') {
148
148
  const cairnDir = path.join(process.cwd(), '.cairn');
149
149
  const sessionPath = path.join(cairnDir, 'session.json');
150
- if (!fs.existsSync(sessionPath)) process.exit(0);
150
+ const dbPath = path.join(cairnDir, 'index.db');
151
151
  const lockPath = path.join(cairnDir, '.hint-lock');
152
152
  const LOCK_TTL_MS = 30 * 60 * 1000;
153
+ if (!fs.existsSync(sessionPath)) {
154
+ // No session yet — prompt to index if DB is also missing (fresh project)
155
+ if (!fs.existsSync(dbPath)) {
156
+ if (fs.existsSync(lockPath)) {
157
+ const age = Date.now() - fs.statSync(lockPath).mtimeMs;
158
+ if (age < LOCK_TTL_MS) process.exit(0);
159
+ }
160
+ fs.mkdirSync(cairnDir, { recursive: true });
161
+ fs.writeFileSync(lockPath, new Date().toISOString(), 'utf8');
162
+ process.stdout.write('[cairn] No index found. Run cairn_maintain to index this project.\n');
163
+ }
164
+ process.exit(0);
165
+ }
153
166
  if (fs.existsSync(lockPath)) {
154
167
  const age = Date.now() - fs.statSync(lockPath).mtimeMs;
155
168
  if (age < LOCK_TTL_MS) process.exit(0);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@misterhuydo/cairn-mcp",
3
- "version": "1.2.7",
3
+ "version": "1.2.8",
4
4
  "description": "MCP server that gives Claude Code persistent memory across sessions. Index your codebase once, search symbols, bundle source, scan for vulnerabilities, and checkpoint/resume work — across Java, TypeScript, Vue, Python, SQL and more.",
5
5
  "type": "module",
6
6
  "main": "index.js",
package/how-to-use.md DELETED
@@ -1,226 +0,0 @@
1
- # Claude Global Instructions
2
-
3
- ## MCP Tools — Cairn Session Lifecycle
4
-
5
- Always use cairn MCP tools to manage project context across sessions.
6
-
7
- ### Start of Session
8
- When starting work on a project, always run:
9
- 1. `cairn_resume` — restores last session context and incrementally re-indexes changed files
10
-
11
- If it's a **fresh project** with no prior session:
12
- 1. `cairn_maintain` — index the project (persists between sessions)
13
-
14
- ### During Session
15
- Use these tools as needed throughout the session:
16
- - `cairn_search` — find symbols, functions, or files before reading or modifying code
17
- - `cairn_bundle` — get a readable snapshot of relevant files before making changes
18
- - `cairn_describe` — understand a module before modifying it
19
- - `cairn_security` — check for security issues (always run before a PR)
20
-
21
- **Prefer cairn tools over manual file browsing or grep when available.**
22
-
23
- ### End of Session
24
- When the user signals they are done (e.g. "let's stop", "that's enough for today", "wrap up"), always run:
25
- - `cairn_checkpoint` — save session state with:
26
- - `message`: summary of what was accomplished
27
- - `active_files`: files that were modified or are in progress
28
- - `notes`: important context, known bugs, or next steps
29
-
30
- ---
31
-
32
- ## Example Session
33
-
34
- **Resuming:**
35
- > User: "Hey Claude, please resume and continue"
36
- > Claude runs `cairn_resume` → reads context → continues work
37
-
38
- **Ending:**
39
- > User: "Ok let's stop here for today"
40
- > Claude runs `cairn_checkpoint` with a meaningful summary and notes → confirms session saved
41
-
42
- ---
43
-
44
- # Cairn — Quick Start
45
-
46
- > **Requirements:** Node.js >= 22.15.0
47
-
48
- ## 1. Install globally
49
-
50
- ```bash
51
- npm install -g @misterhuydo/cairn-mcp
52
- ```
53
-
54
- Two commands are now available: `cairn-mcp` (MCP server) and `cairn` (CLI for hooks).
55
-
56
- ## 2. Install passive hooks (recommended)
57
-
58
- Cairn hooks into Claude Code so that compression and checkpointing happen automatically — no need to call `cairn_bundle` or `cairn_checkpoint` manually.
59
-
60
- **Global — applies to every project on this machine:**
61
-
62
- ```bash
63
- cairn install-hooks --global
64
- ```
65
-
66
- **Project-level — applies to this project only:**
67
-
68
- ```bash
69
- cairn install-hooks
70
- ```
71
-
72
- Both write to `~/.claude/settings.json` (global) or `.claude/settings.json` (project). Safe to run multiple times — existing settings are preserved.
73
-
74
- What this sets up:
75
-
76
- | Hook | Effect |
77
- |---|---|
78
- | `PreToolUse[Read]` | Every source file read is silently compressed before Claude sees it (~68% fewer tokens for `.java/.ts/.js/.vue/.py/.sql`) |
79
- | `Stop` | Session auto-saved to `.cairn/session.json` every time Claude finishes responding |
80
- | `UserPromptSubmit` | On the first message of a new session, Claude is reminded of the prior session and prompted to call `cairn_resume` |
81
-
82
- After this you never need to call `cairn_bundle` or `cairn_checkpoint` — Claude reads files normally and compression + checkpointing happen transparently in the background.
83
-
84
- ## 3. Register the MCP server with Claude Code
85
-
86
- Add to your `~/.claude.json` and restart Claude Code. You should see 8 cairn tools available.
87
-
88
- **File location by platform:**
89
-
90
- | Platform | Path |
91
- |---|---|
92
- | Windows | `C:\\Users\\<you>\\.claude.json` |
93
- | macOS | `~/.claude.json` |
94
- | Linux | `~/.claude.json` |
95
-
96
- ```json
97
- {
98
- "mcpServers": {
99
- "cairn": {
100
- "command": "cairn-mcp"
101
- }
102
- }
103
- }
104
- ```
105
-
106
- > If you already have other MCP servers, just add `"cairn": { ... }` inside the existing `"mcpServers"` block.
107
-
108
- ## 4. (Optional) Configure Claude via CLAUDE.md
109
-
110
- If you prefer Claude to manage session lifecycle explicitly rather than via hooks, create a global `CLAUDE.md` file. This is an alternative to passive hooks — you don't need both.
111
-
112
- **File location by platform:**
113
-
114
- | Platform | Path |
115
- |---|---|
116
- | Windows | `C:\\Users\\<you>\\CLAUDE.md` |
117
- | macOS | `~/CLAUDE.md` |
118
- | Linux | `~/CLAUDE.md` |
119
-
120
- Copy and save the following content into that file:
121
-
122
- ````markdown
123
- ## MCP Tools — Cairn Session Lifecycle
124
-
125
- Always use cairn MCP tools to manage project context across sessions.
126
-
127
- ### Start of Session
128
- When starting work on a project, always run:
129
- 1. `cairn_resume` — restores last session context and incrementally re-indexes changed files
130
-
131
- If it's a fresh project with no prior session:
132
- 1. `cairn_maintain` — index the project (persists between sessions)
133
-
134
- ### During Session
135
- Use these tools as needed throughout the session:
136
- - `cairn_search` — find symbols, functions, or files before reading or modifying code
137
- - `cairn_bundle` — get a readable snapshot of relevant files before making changes
138
- - `cairn_describe` — understand a module before modifying it
139
- - `cairn_security` — check for security issues (always run before a PR)
140
-
141
- Prefer cairn tools over manual file browsing or grep when available.
142
-
143
- ### End of Session
144
- When the user signals they are done (e.g. "let's stop", "that's enough for today", "wrap up"), always run:
145
- - `cairn_checkpoint` — save session state with:
146
- - `message`: summary of what was accomplished
147
- - `active_files`: files that were modified or are in progress
148
- - `notes`: important context, known bugs, or next steps
149
- ````
150
-
151
- ## 5. Index your project
152
-
153
- Run Claude Code from your project root, then:
154
-
155
-
156
- ```
157
- cairn_maintain
158
- ```
159
-
160
- No paths needed — Cairn works like git and finds your project from the current directory. The index is stored in `.cairn/index.db` inside your project.
161
-
162
- Run this once at the start of each session (or use `cairn_resume` to pick up where you left off).
163
-
164
- ## 6. Tools at a glance
165
-
166
- | Tool | What to use it for |
167
- |---|---|
168
- | `cairn_maintain` | Index the current project (run at session start) |
169
- | `cairn_search` | Find classes, functions, components by name or concept |
170
- | `cairn_describe` | Summarize what a folder/module does |
171
- | `cairn_code_graph` | Check instability, health, or cycles before refactoring |
172
- | `cairn_security` | Scan for vulnerabilities (XSS, SQLi, hardcoded secrets, etc.) |
173
- | `cairn_bundle` | Package source files into a minified snapshot for Claude to read |
174
- | `cairn_checkpoint` | Save what you're working on so the next session can resume |
175
- | `cairn_resume` | Restore the last checkpoint + incremental re-index of changed files |
176
-
177
- > `cairn_bundle` and `cairn_checkpoint` are called automatically when passive hooks are installed. They remain available for explicit use when needed.
178
-
179
- ## 7. Typical session
180
-
181
- **With passive hooks (recommended):**
182
- ```
183
- 1. cairn_maintain → index the project
184
- 2. cairn_search → find what you need
185
- 3. cairn_describe → understand a module before modifying it
186
- 4. cairn_security → check for issues before a PR
187
- (file reads auto-compressed, session auto-saved — nothing else needed)
188
- ```
189
-
190
- **Without hooks:**
191
- ```
192
- 1. cairn_maintain → index the project
193
- 2. cairn_search → find what you need
194
- 3. cairn_bundle → get a readable snapshot of relevant files
195
- 4. cairn_describe → understand a module before modifying it
196
- 5. cairn_security → check for issues before a PR
197
- 6. cairn_checkpoint → save your progress before ending the session
198
- ```
199
-
200
- **Resuming work:**
201
- ```
202
- 1. cairn_resume → restore last checkpoint + re-index only changed files
203
- 2. cairn_search → continue where you left off
204
- ```
205
-
206
- ## 8. Complete session lifecycle
207
-
208
- ```
209
- ─── START OF SESSION ──────────────────────────────────────────
210
- You: "Hey Claude, please resume and continue"
211
- Claude: cairn_resume
212
- → "Last session: adding multi-currency to checkout.
213
- PaymentStep.vue was modified since checkpoint (2 files changed, re-indexed).
214
- Notes: CurrencyService expects ISO 4217 codes. PaymentStep EUR bug not fixed yet.
215
- Ready to continue."
216
-
217
- ─── DURING SESSION ────────────────────────────────────────────
218
- Claude uses: cairn_search, cairn_code_graph, cairn_security
219
- as needed — all reading from .cairn/index.db in cwd
220
- (file reads auto-compressed by PreToolUse hook)
221
-
222
- ─── END OF SESSION ────────────────────────────────────────────
223
- You: "Ok let's stop here for today"
224
- (Stop hook fires → .cairn/session.json auto-saved)
225
- → Next session: cairn_resume picks up automatically
226
- ```