purecontext-mcp 1.5.2 → 1.11.0

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.
Files changed (196) hide show
  1. package/AGENT_INSTRUCTIONS.md +18 -10
  2. package/AGENT_REFERENCE.md +684 -561
  3. package/CHANGELOG.md +567 -445
  4. package/CODE-HISTORY.md +29 -1
  5. package/FRAMEWORK-ADAPTERS.md +368 -351
  6. package/FULL-INSTALLATION-GUIDE.md +351 -341
  7. package/README.md +411 -339
  8. package/REFACTORING-SAFELY.md +338 -279
  9. package/SAFE-CHANGES.md +208 -156
  10. package/USER-GUIDE.md +3 -1
  11. package/WHY-PURECONTEXT.md +103 -73
  12. package/WORKFLOW-PR-REVIEW.md +245 -199
  13. package/dist/adapters/astro-preprocessor.d.ts +25 -0
  14. package/dist/adapters/astro-preprocessor.d.ts.map +1 -0
  15. package/dist/adapters/astro-preprocessor.js +50 -0
  16. package/dist/adapters/astro-preprocessor.js.map +1 -0
  17. package/dist/adapters/astro.d.ts +13 -0
  18. package/dist/adapters/astro.d.ts.map +1 -0
  19. package/dist/adapters/astro.js +83 -0
  20. package/dist/adapters/astro.js.map +1 -0
  21. package/dist/adapters/detect-utils.d.ts +38 -0
  22. package/dist/adapters/detect-utils.d.ts.map +1 -0
  23. package/dist/adapters/detect-utils.js +95 -0
  24. package/dist/adapters/detect-utils.js.map +1 -0
  25. package/dist/adapters/nuxt.d.ts +20 -0
  26. package/dist/adapters/nuxt.d.ts.map +1 -1
  27. package/dist/adapters/nuxt.js +128 -13
  28. package/dist/adapters/nuxt.js.map +1 -1
  29. package/dist/adapters/svelte-preprocessor.d.ts +29 -0
  30. package/dist/adapters/svelte-preprocessor.d.ts.map +1 -0
  31. package/dist/adapters/svelte-preprocessor.js +83 -0
  32. package/dist/adapters/svelte-preprocessor.js.map +1 -0
  33. package/dist/adapters/svelte.d.ts +13 -0
  34. package/dist/adapters/svelte.d.ts.map +1 -0
  35. package/dist/adapters/svelte.js +96 -0
  36. package/dist/adapters/svelte.js.map +1 -0
  37. package/dist/adapters/vue.d.ts.map +1 -1
  38. package/dist/adapters/vue.js +87 -20
  39. package/dist/adapters/vue.js.map +1 -1
  40. package/dist/bin.d.ts +16 -0
  41. package/dist/bin.d.ts.map +1 -0
  42. package/dist/bin.js +21 -0
  43. package/dist/bin.js.map +1 -0
  44. package/dist/cli/hooks.d.ts +2 -2
  45. package/dist/cli/hooks.d.ts.map +1 -1
  46. package/dist/cli/hooks.js +123 -135
  47. package/dist/cli/hooks.js.map +1 -1
  48. package/dist/cli/install-writers.d.ts.map +1 -1
  49. package/dist/cli/install-writers.js +281 -36
  50. package/dist/cli/install-writers.js.map +1 -1
  51. package/dist/cli/resolve-node.d.ts +53 -0
  52. package/dist/cli/resolve-node.d.ts.map +1 -0
  53. package/dist/cli/resolve-node.js +84 -0
  54. package/dist/cli/resolve-node.js.map +1 -0
  55. package/dist/config/config-loader.js +24 -0
  56. package/dist/config/config-loader.js.map +1 -1
  57. package/dist/config/config-schema.d.ts +71 -0
  58. package/dist/config/config-schema.d.ts.map +1 -1
  59. package/dist/config/config-schema.js +102 -0
  60. package/dist/config/config-schema.js.map +1 -1
  61. package/dist/core/db/api-keys.d.ts +1 -1
  62. package/dist/core/db/api-keys.d.ts.map +1 -1
  63. package/dist/core/db/api-keys.js +39 -39
  64. package/dist/core/db/api-keys.js.map +1 -1
  65. package/dist/core/db/co-change-store.d.ts +34 -0
  66. package/dist/core/db/co-change-store.d.ts.map +1 -0
  67. package/dist/core/db/co-change-store.js +78 -0
  68. package/dist/core/db/co-change-store.js.map +1 -0
  69. package/dist/core/db/schema.d.ts +3 -3
  70. package/dist/core/db/schema.d.ts.map +1 -1
  71. package/dist/core/db/schema.js +12 -30
  72. package/dist/core/db/schema.js.map +1 -1
  73. package/dist/core/db/sqlite-loader.d.ts +51 -0
  74. package/dist/core/db/sqlite-loader.d.ts.map +1 -0
  75. package/dist/core/db/sqlite-loader.js +94 -0
  76. package/dist/core/db/sqlite-loader.js.map +1 -0
  77. package/dist/core/db/wasm-sqlite.d.ts +4 -0
  78. package/dist/core/db/wasm-sqlite.d.ts.map +1 -0
  79. package/dist/core/db/wasm-sqlite.js +270 -0
  80. package/dist/core/db/wasm-sqlite.js.map +1 -0
  81. package/dist/core/diff-parser.d.ts.map +1 -1
  82. package/dist/core/diff-parser.js +6 -1
  83. package/dist/core/diff-parser.js.map +1 -1
  84. package/dist/core/git-log-reader.d.ts +28 -0
  85. package/dist/core/git-log-reader.d.ts.map +1 -1
  86. package/dist/core/git-log-reader.js +74 -3
  87. package/dist/core/git-log-reader.js.map +1 -1
  88. package/dist/core/index-manager.d.ts.map +1 -1
  89. package/dist/core/index-manager.js +29 -3
  90. package/dist/core/index-manager.js.map +1 -1
  91. package/dist/core/indexing-worker.d.ts +2 -0
  92. package/dist/core/indexing-worker.d.ts.map +1 -1
  93. package/dist/core/indexing-worker.js +2 -0
  94. package/dist/core/indexing-worker.js.map +1 -1
  95. package/dist/core/watcher/file-watcher.d.ts +6 -0
  96. package/dist/core/watcher/file-watcher.d.ts.map +1 -1
  97. package/dist/core/watcher/file-watcher.js +11 -1
  98. package/dist/core/watcher/file-watcher.js.map +1 -1
  99. package/dist/graph/path-resolver.js +86 -17
  100. package/dist/graph/path-resolver.js.map +1 -1
  101. package/dist/index.d.ts +3 -0
  102. package/dist/index.d.ts.map +1 -1
  103. package/dist/index.js +11 -1
  104. package/dist/index.js.map +1 -1
  105. package/dist/node-guard.d.ts +15 -0
  106. package/dist/node-guard.d.ts.map +1 -0
  107. package/dist/node-guard.js +33 -0
  108. package/dist/node-guard.js.map +1 -0
  109. package/dist/server/admin-api.d.ts +1 -1
  110. package/dist/server/admin-api.d.ts.map +1 -1
  111. package/dist/server/admin-api.js +2 -2
  112. package/dist/server/admin-api.js.map +1 -1
  113. package/dist/server/auth/api-key.d.ts +1 -1
  114. package/dist/server/auth/api-key.d.ts.map +1 -1
  115. package/dist/server/mcp-server.d.ts.map +1 -1
  116. package/dist/server/mcp-server.js +25 -0
  117. package/dist/server/mcp-server.js.map +1 -1
  118. package/dist/server/tools/analyze-diff.d.ts +8 -0
  119. package/dist/server/tools/analyze-diff.d.ts.map +1 -1
  120. package/dist/server/tools/analyze-diff.js +80 -16
  121. package/dist/server/tools/analyze-diff.js.map +1 -1
  122. package/dist/server/tools/change-synthesis.d.ts +90 -0
  123. package/dist/server/tools/change-synthesis.d.ts.map +1 -0
  124. package/dist/server/tools/change-synthesis.js +236 -0
  125. package/dist/server/tools/change-synthesis.js.map +1 -0
  126. package/dist/server/tools/co-change.d.ts +65 -0
  127. package/dist/server/tools/co-change.d.ts.map +1 -0
  128. package/dist/server/tools/co-change.js +146 -0
  129. package/dist/server/tools/co-change.js.map +1 -0
  130. package/dist/server/tools/compare-change-impact.d.ts +58 -0
  131. package/dist/server/tools/compare-change-impact.d.ts.map +1 -0
  132. package/dist/server/tools/compare-change-impact.js +0 -0
  133. package/dist/server/tools/compare-change-impact.js.map +1 -0
  134. package/dist/server/tools/find-refactoring-opportunities.d.ts +1 -1
  135. package/dist/server/tools/get-architecture-snapshot.d.ts.map +1 -1
  136. package/dist/server/tools/get-architecture-snapshot.js +28 -14
  137. package/dist/server/tools/get-architecture-snapshot.js.map +1 -1
  138. package/dist/server/tools/get-churn-metrics.d.ts.map +1 -1
  139. package/dist/server/tools/get-churn-metrics.js +1 -12
  140. package/dist/server/tools/get-churn-metrics.js.map +1 -1
  141. package/dist/server/tools/get-co-change.d.ts +37 -0
  142. package/dist/server/tools/get-co-change.d.ts.map +1 -0
  143. package/dist/server/tools/get-co-change.js +120 -0
  144. package/dist/server/tools/get-co-change.js.map +1 -0
  145. package/dist/server/tools/get-context-bundle.d.ts.map +1 -1
  146. package/dist/server/tools/get-context-bundle.js +56 -3
  147. package/dist/server/tools/get-context-bundle.js.map +1 -1
  148. package/dist/server/tools/get-entry-points.d.ts +1 -1
  149. package/dist/server/tools/get-symbol-risk.d.ts +25 -0
  150. package/dist/server/tools/get-symbol-risk.d.ts.map +1 -0
  151. package/dist/server/tools/get-symbol-risk.js +60 -0
  152. package/dist/server/tools/get-symbol-risk.js.map +1 -0
  153. package/dist/server/tools/get-symbol-source.d.ts +2 -0
  154. package/dist/server/tools/get-symbol-source.d.ts.map +1 -1
  155. package/dist/server/tools/get-symbol-source.js +18 -1
  156. package/dist/server/tools/get-symbol-source.js.map +1 -1
  157. package/dist/server/tools/index-repo.d.ts.map +1 -1
  158. package/dist/server/tools/index-repo.js +8 -2
  159. package/dist/server/tools/index-repo.js.map +1 -1
  160. package/dist/server/tools/prepare-change.d.ts +61 -0
  161. package/dist/server/tools/prepare-change.d.ts.map +1 -0
  162. package/dist/server/tools/prepare-change.js +262 -0
  163. package/dist/server/tools/prepare-change.js.map +1 -0
  164. package/dist/server/tools/search-symbols.d.ts +2 -0
  165. package/dist/server/tools/search-symbols.d.ts.map +1 -1
  166. package/dist/server/tools/search-symbols.js +33 -0
  167. package/dist/server/tools/search-symbols.js.map +1 -1
  168. package/dist/server/tools/symbol-lines.d.ts +25 -0
  169. package/dist/server/tools/symbol-lines.d.ts.map +1 -0
  170. package/dist/server/tools/symbol-lines.js +40 -0
  171. package/dist/server/tools/symbol-lines.js.map +1 -0
  172. package/dist/server/tools/symbol-risk.d.ts +109 -0
  173. package/dist/server/tools/symbol-risk.d.ts.map +1 -0
  174. package/dist/server/tools/symbol-risk.js +251 -0
  175. package/dist/server/tools/symbol-risk.js.map +1 -0
  176. package/dist/server/tools/verify-change.d.ts +40 -0
  177. package/dist/server/tools/verify-change.d.ts.map +1 -0
  178. package/dist/server/tools/verify-change.js +149 -0
  179. package/dist/server/tools/verify-change.js.map +1 -0
  180. package/dist/version.d.ts +1 -1
  181. package/dist/version.d.ts.map +1 -1
  182. package/dist/version.js +1 -1
  183. package/dist/version.js.map +1 -1
  184. package/docs/01-introduction.md +2 -2
  185. package/docs/02-installation.md +97 -89
  186. package/docs/03-quick-start.md +138 -135
  187. package/docs/04-configuration.md +247 -214
  188. package/docs/05-cli-reference.md +236 -219
  189. package/docs/06-tools-reference.md +902 -499
  190. package/docs/14-transport-modes.md +170 -167
  191. package/docs/18-git-history.md +43 -0
  192. package/docs/23-performance.md +123 -121
  193. package/docs/26-troubleshooting.md +249 -234
  194. package/grammars/README.md +88 -0
  195. package/package.json +7 -25
  196. package/AGENT_INSTRUCTIONS_SHORT.md +0 -150
package/SAFE-CHANGES.md CHANGED
@@ -1,156 +1,208 @@
1
- # Making Changes Safely
2
-
3
- The hardest part of changing code in a large codebase is not writing the new code — it's understanding what the old code touches. Every change that breaks something unexpected does so because the developer didn't know about a dependency they couldn't see.
4
-
5
- PureContext gives you two tools that together form a complete pre-change analysis workflow: **blast radius** (what does this touch?) and **context bundle** (what does this need?).
6
-
7
- ---
8
-
9
- ## The blast radius: knowing your impact before you start
10
-
11
- Before you change anything, find out what depends on it.
12
-
13
- **Scenario:** You're refactoring a utility function `formatCurrency` that's been in the codebase for three years. It's used everywhere, but you don't know exactly where.
14
-
15
- > "Before I refactor formatCurrency, show me everything that uses it."
16
-
17
- Claude calls `get_blast_radius` and returns:
18
-
19
- ```
20
- formatCurrency() is imported by 23 files:
21
- Direct importers (depth 1):
22
- src/billing/invoice.ts
23
- src/reporting/pdf-generator.ts
24
- src/api/responses/pricing.ts
25
- src/ui/components/PriceDisplay.tsx
26
- ... (8 more)
27
-
28
- Transitive importers (depth 2–3):
29
- src/api/routes/orders.ts (via billing/invoice.ts)
30
- src/workers/monthly-report.ts (via reporting/pdf-generator.ts)
31
- ... (9 more)
32
-
33
- Total files affected: 23
34
- ```
35
-
36
- You now know the scope before you've written a line. If the blast radius is 23 files, you know this change needs careful testing. If it's 2, you can move quickly.
37
-
38
- **What the blast radius tells you:**
39
- - Files you need to update if the function's signature changes
40
- - Test files that will break if behavior changes
41
- - Services that will fail if the function is removed
42
- - The difference between "safe to refactor locally" and "needs a deprecation cycle"
43
-
44
- **Using blast radius for deletion decisions:**
45
-
46
- > "I think this helper is unused — can you confirm?"
47
-
48
- ```
49
- get_blast_radius(symbolId: "legacyFormatDate-id") →
50
- importers: []
51
- count: 0
52
- ```
53
-
54
- Zero importers. Safe to delete. `find_dead_code` will surface all such symbols at once across the whole codebase.
55
-
56
- ---
57
-
58
- ## The context bundle: understanding what you're changing
59
-
60
- Once you know the impact scope, understand the code itself before you touch it.
61
-
62
- **Scenario:** You need to modify the `processOrder` function but you've never worked in this part of the codebase. You need to understand what it calls, what data it expects, and what it produces.
63
-
64
- > "Give me everything I need to understand processOrder before I change it."
65
-
66
- Claude calls `get_context_bundle` starting from `processOrder` with a depth of 2:
67
-
68
- ```
69
- Context bundle for processOrder():
70
-
71
- processOrder() src/orders/processor.ts (the function itself, 67 lines)
72
- validateCart() src/cart/validator.ts (called by processOrder, 34 lines)
73
- calculateTax() src/billing/tax.ts (called by processOrder, 28 lines)
74
- formatPrice() src/utils/format.ts (called by validateCart, 12 lines)
75
- OrderRecord src/db/models/order.ts (the data shape, 22 lines)
76
-
77
- Token estimate: 1,240 tokens
78
- Files covered: 5
79
- ```
80
-
81
- 1,240 tokens for a complete picture of the order processing flow. Reading those 5 files directly would be ~8,000 tokens and would include unrelated functions, imports, and comments.
82
-
83
- **Setting depth:** `maxDepth: 1` gives you just the direct dependencies. `maxDepth: 3` follows the dependency chain further but returns more. Start at 2 and go deeper only if you need it.
84
-
85
- **Setting a token budget:** If you're working within a context window budget, set `maxTokens` and the bundle will stop collecting symbols once the estimate exceeds it — always returning the most directly connected ones first.
86
-
87
- ---
88
-
89
- ## The complete pre-change workflow
90
-
91
- This is the pattern to use before any significant change:
92
-
93
- ```
94
- 1. Identify the symbol you're changing
95
- search_symbols(query: "processOrder") → find the right one
96
-
97
- 2. Check the blast radius
98
- get_blast_radius(symbolId) → how many files are affected?
99
-
100
- 3. Understand the symbol in context
101
- get_context_bundle(symbolId, maxDepth: 2) what does it depend on?
102
-
103
- 4. Make the change
104
-
105
- 5. Verify nothing became orphaned
106
- find_dead_code(repoId) → any exports that are now unused?
107
-
108
- 6. Re-index (if you changed signatures)
109
- index_folder → incremental, fast, picks up your changes
110
- ```
111
-
112
- ---
113
-
114
- ## Detecting architectural violations before they ship
115
-
116
- PureContext can also check whether your change violates the project's intended layer structure. If your codebase has defined architectural layers — for example, "core services must not import from API controllers" — the `get_layer_violations` tool checks for violations across the whole codebase.
117
-
118
- > "Check if my changes introduced any architectural boundary violations."
119
-
120
- ```
121
- get_layer_violations(repoId) →
122
-
123
- VIOLATION: src/core/billing.ts imports from src/api/middleware/auth.ts
124
- Layer: core api (not allowed per layer rules)
125
- Import: AuthMiddleware
126
- ```
127
-
128
- Catch these before code review, not during.
129
-
130
- ---
131
-
132
- ## For teams: sharing impact analysis
133
-
134
- In a team environment, blast radius analysis is especially valuable during planning. Before a developer starts on a change, ask PureContext to assess the scope:
135
-
136
- > "We're planning to move the authentication service from JWT to session-based auth. What's the blast radius of changing the validateToken function?"
137
-
138
- The answer tells the team how many files need to be updated, which services are affected, and whether this is a one-person job or a coordinated migration. That's a planning conversation that used to require a senior engineer's memory of the codebase.
139
-
140
- ---
141
-
142
- ## For legacy codebases
143
-
144
- Legacy codebases are where blast radius analysis pays off most. Nobody knows all the call sites for a function that's been there for five years. PureContext does.
145
-
146
- Before refactoring anything in a legacy system:
147
-
148
- 1. Run `find_dead_code` first it often reveals that 20% of what you thought you needed to understand is actually unused
149
- 2. Use blast radius on the symbols you do need to change — the dependency graph doesn't lie
150
- 3. Use context bundle to understand the chain before proposing a change to your team
151
-
152
- This transforms "I think this change is safe but I'm not sure" into "I know exactly which 7 files this change affects and here they are."
153
-
154
- ---
155
-
156
- → Reference: [MCP Tools Reference](../docs/06-tools-reference.md) — `get_blast_radius`, `get_context_bundle`, `find_importers`, `find_dead_code`, `get_layer_violations`
1
+ # Making Changes Safely
2
+
3
+ The hardest part of changing code in a large codebase is not writing the new code — it's understanding what the old code touches. Every change that breaks something unexpected does so because the developer didn't know about a dependency they couldn't see.
4
+
5
+ PureContext gives you two tools that together form a complete pre-change analysis workflow: **blast radius** (what does this touch?) and **context bundle** (what does this need?).
6
+
7
+ ---
8
+
9
+ ## The blast radius: knowing your impact before you start
10
+
11
+ Before you change anything, find out what depends on it.
12
+
13
+ **Scenario:** You're refactoring a utility function `formatCurrency` that's been in the codebase for three years. It's used everywhere, but you don't know exactly where.
14
+
15
+ > "Before I refactor formatCurrency, show me everything that uses it."
16
+
17
+ Claude calls `get_blast_radius` and returns:
18
+
19
+ ```
20
+ formatCurrency() is imported by 23 files:
21
+ Direct importers (depth 1):
22
+ src/billing/invoice.ts
23
+ src/reporting/pdf-generator.ts
24
+ src/api/responses/pricing.ts
25
+ src/ui/components/PriceDisplay.tsx
26
+ ... (8 more)
27
+
28
+ Transitive importers (depth 2–3):
29
+ src/api/routes/orders.ts (via billing/invoice.ts)
30
+ src/workers/monthly-report.ts (via reporting/pdf-generator.ts)
31
+ ... (9 more)
32
+
33
+ Total files affected: 23
34
+ ```
35
+
36
+ You now know the scope before you've written a line. If the blast radius is 23 files, you know this change needs careful testing. If it's 2, you can move quickly.
37
+
38
+ **What the blast radius tells you:**
39
+ - Files you need to update if the function's signature changes
40
+ - Test files that will break if behavior changes
41
+ - Services that will fail if the function is removed
42
+ - The difference between "safe to refactor locally" and "needs a deprecation cycle"
43
+
44
+ **Using blast radius for deletion decisions:**
45
+
46
+ > "I think this helper is unused — can you confirm?"
47
+
48
+ ```
49
+ get_blast_radius(symbolId: "legacyFormatDate-id") →
50
+ importers: []
51
+ count: 0
52
+ ```
53
+
54
+ Zero importers. Safe to delete. `find_dead_code` will surface all such symbols at once across the whole codebase.
55
+
56
+ ---
57
+
58
+ ## The context bundle: understanding what you're changing
59
+
60
+ Once you know the impact scope, understand the code itself before you touch it.
61
+
62
+ **Scenario:** You need to modify the `processOrder` function but you've never worked in this part of the codebase. You need to understand what it calls, what data it expects, and what it produces.
63
+
64
+ > "Give me everything I need to understand processOrder before I change it."
65
+
66
+ Claude calls `get_context_bundle` starting from `processOrder` with a depth of 2:
67
+
68
+ ```
69
+ Context bundle for processOrder():
70
+
71
+ processOrder() src/orders/processor.ts (the function itself, 67 lines)
72
+ validateCart() src/cart/validator.ts (called by processOrder, 34 lines)
73
+ calculateTax() src/billing/tax.ts (called by processOrder, 28 lines)
74
+ formatPrice() src/utils/format.ts (called by validateCart, 12 lines)
75
+ OrderRecord src/db/models/order.ts (the data shape, 22 lines)
76
+
77
+ Token estimate: 1,240 tokens
78
+ Files covered: 5
79
+ ```
80
+
81
+ 1,240 tokens for a complete picture of the order processing flow. Reading those 5 files directly would be ~8,000 tokens and would include unrelated functions, imports, and comments.
82
+
83
+ **Setting depth:** `maxDepth: 1` gives you just the direct dependencies. `maxDepth: 3` follows the dependency chain further but returns more. Start at 2 and go deeper only if you need it.
84
+
85
+ **Setting a token budget:** If you're working within a context window budget, set `maxTokens` and the bundle will stop collecting symbols once the estimate exceeds it — always returning the most directly connected ones first.
86
+
87
+ ---
88
+
89
+ ## The one-call pre-flight: `prepare_change`
90
+
91
+ The workflow below is the explicit, step-by-step version. When you just want the verdict, `prepare_change` runs the whole pre-flight in a single call — it resolves the target, predicts the files you'll touch, and returns the risk, the co-change partners you're about to forget, the tests, and any architectural flags, each with a plain-English reason.
92
+
93
+ > "I want to rename validateToken. What's the impact?"
94
+
95
+ ```
96
+ prepare_change(repoId, intent: "rename", targetSymbolId: "validateToken-id") →
97
+
98
+ verdict: "ready"
99
+ predictedChange: { changedFilePaths: [ ...12 files... ] }
100
+ risk: { band: "review" }
101
+ missingCoChange: [ "src/api/session-store.ts" ] moves with this historically, NOT in your plan
102
+ reasons: [
103
+ "Aggregate change risk: review.",
104
+ "1 file historically co-changes with the target but is NOT in the predicted change: src/api/session-store.ts."
105
+ ]
106
+ ```
107
+
108
+ It is **judgment, not actuation** — it never edits. If the target is ambiguous it returns `verdict: "ambiguous_target"` with candidates and asks you to pick, rather than guessing. Keep `predictedChange.changedFilePaths` and `missingCoChange[].filePath` — `verify_change` uses them afterward.
109
+
110
+ ---
111
+
112
+ ## The complete pre-change workflow
113
+
114
+ This is the pattern to use before any significant change:
115
+
116
+ ```
117
+ 1. Identify the symbol you're changing
118
+ search_symbols(query: "processOrder") find the right one
119
+
120
+ 2. Get a composite risk read
121
+ get_symbol_risk(symbolId) → band (low/review/high) + reasons
122
+
123
+ 3. Check the blast radius
124
+ get_blast_radius(symbolId)how many files are affected?
125
+
126
+ 4. Find what moves with it that the import graph can't show
127
+ get_co_change(symbolId) → files that historically change together
128
+ (e.g. the test or config that must move too)
129
+
130
+ 5. Understand the symbol in context
131
+ get_context_bundle(symbolId, maxDepth: 2) → dependencies + historicalNeighbors
132
+
133
+ 6. Make the change (and its co-changers, if they need to move together)
134
+
135
+ 7. Verify nothing became orphaned
136
+ find_dead_code(repoId) any exports that are now unused?
137
+
138
+ 8. Re-index (if you changed signatures)
139
+ index_folder → incremental, fast, picks up your changes
140
+ ```
141
+
142
+ > For a `high`-risk symbol, treat steps 3–4 as mandatory: the co-changers are the second-order edits most likely to break. For a quick inline signal, pass `includeRisk: true` to `search_symbols` to see each candidate's `{ band, riskScore }` before you pick one.
143
+
144
+ ---
145
+
146
+ ## Closing the loop: confirming the change was complete
147
+
148
+ The steps above are the *before*. After you've made the change, `verify_change` reconciles what you actually did against the prediction it's how you catch the co-change partner you meant to touch but didn't.
149
+
150
+ > "Here's my diff. Did I cover everything?"
151
+
152
+ ```
153
+ verify_change(repoId, diff: "<git diff>",
154
+ predictedFilePaths: [ ...from prepare_change... ],
155
+ predictedCoChange: [ "src/api/session-store.ts" ]) →
156
+
157
+ verdict: "incomplete"
158
+ unaddressedCoChange: [ "src/api/session-store.ts" ] ← you planned around it; still untouched
159
+ unplannedChanges: [ ]
160
+ ```
161
+
162
+ `complete` = every planned file touched, no co-change or coverage gaps; `incomplete` = a planned partner or untested symbol remains; `scope_expanded` = you touched files that weren't predicted. And `compare_change_impact` (against a `get_architecture_snapshot` baseline) tells you whether the change introduced a *new* import cycle or layer violation — never blaming it for pre-existing ones.
163
+
164
+ ---
165
+
166
+ ## Detecting architectural violations before they ship
167
+
168
+ PureContext can also check whether your change violates the project's intended layer structure. If your codebase has defined architectural layers — for example, "core services must not import from API controllers" — the `get_layer_violations` tool checks for violations across the whole codebase.
169
+
170
+ > "Check if my changes introduced any architectural boundary violations."
171
+
172
+ ```
173
+ get_layer_violations(repoId) →
174
+
175
+ VIOLATION: src/core/billing.ts imports from src/api/middleware/auth.ts
176
+ Layer: core → api (not allowed per layer rules)
177
+ Import: AuthMiddleware
178
+ ```
179
+
180
+ Catch these before code review, not during.
181
+
182
+ ---
183
+
184
+ ## For teams: sharing impact analysis
185
+
186
+ In a team environment, blast radius analysis is especially valuable during planning. Before a developer starts on a change, ask PureContext to assess the scope:
187
+
188
+ > "We're planning to move the authentication service from JWT to session-based auth. What's the blast radius of changing the validateToken function?"
189
+
190
+ The answer tells the team how many files need to be updated, which services are affected, and whether this is a one-person job or a coordinated migration. That's a planning conversation that used to require a senior engineer's memory of the codebase.
191
+
192
+ ---
193
+
194
+ ## For legacy codebases
195
+
196
+ Legacy codebases are where blast radius analysis pays off most. Nobody knows all the call sites for a function that's been there for five years. PureContext does.
197
+
198
+ Before refactoring anything in a legacy system:
199
+
200
+ 1. Run `find_dead_code` first — it often reveals that 20% of what you thought you needed to understand is actually unused
201
+ 2. Use blast radius on the symbols you do need to change — the dependency graph doesn't lie
202
+ 3. Use context bundle to understand the chain before proposing a change to your team
203
+
204
+ This transforms "I think this change is safe but I'm not sure" into "I know exactly which 7 files this change affects and here they are."
205
+
206
+ ---
207
+
208
+ → Reference: [MCP Tools Reference](docs/06-tools-reference.md) — `prepare_change`, `verify_change`, `compare_change_impact`, `get_symbol_risk`, `get_co_change`, `get_blast_radius`, `get_context_bundle`, `find_importers`, `find_dead_code`, `get_layer_violations`
package/USER-GUIDE.md CHANGED
@@ -2,13 +2,15 @@
2
2
 
3
3
  This guide explains what PureContext does, why it changes the way you work with code, and how to use its features effectively. Each section focuses on a capability area with real examples and concrete workflows.
4
4
 
5
+ PureContext gives an AI agent two things: **precise retrieval** (pull the exact symbol you need instead of reading whole files — the token-efficient foundation) and **change intelligence** (know what a change affects, what moves with it, and how risky it is — *before* the edit). The first makes every interaction cheap; the second is what lets an agent change unfamiliar code safely.
6
+
5
7
  For parameter-level documentation — every tool input, output, and flag — see the [Reference Manual](docs/README.md).
6
8
 
7
9
  ---
8
10
 
9
11
  ## Start here
10
12
 
11
- - [Why PureContext](WHY-PURECONTEXT.md) — The full case: what actually improves when AI has precise context instead of bulk context, who benefits, and what PureContext does not do
13
+ - [Why PureContext](WHY-PURECONTEXT.md) — The full case: why precise context beats bulk context, why *safe change* (not just retrieval) is the differentiator, who benefits, and what PureContext does not do
12
14
 
13
15
  ---
14
16
 
@@ -1,73 +1,103 @@
1
- # Why PureContext
2
-
3
- ## The problem is not tokens. It's accuracy.
4
-
5
- When an AI agent works with your code, the quality of its answers depends entirely on what you put in front of it. Give it an entire 800-line file to find one function and two things happen: you burn thousands of tokens getting there, and the AI spends most of that context on code that has nothing to do with your question.
6
-
7
- Token savings are the measurable side effect of a more fundamental improvement: **AI gets better answers from precise context than from bulk context.**
8
-
9
- A 45-line function retrieved by name gives Claude exactly what it needs. An 800-line file gives Claude the function plus seven unrelated utilities, three deprecated helpers, a wall of imports, and a pile of comments about things that were fixed in 2019. All of that crowds out the signal.
10
-
11
- PureContext fixes this by giving AI agents a way to navigate code the way experienced engineers do — by name, by meaning, by dependency — rather than by reading everything and hoping.
12
-
13
- ---
14
-
15
- ## What changes in practice
16
-
17
- ### Your AI assistant gets fewer hallucinations
18
-
19
- Hallucinations in coding tasks most often happen when the AI is working from incomplete or outdated context. If Claude has to read a file from two weeks ago that you haven't reindexed, or guess at function signatures from imports rather than seeing the actual definition, it will make things up convincingly.
20
-
21
- PureContext indexes your codebase on demand and re-indexes incrementally as you work. When Claude asks for `validatePaymentMethod`, it gets the current definition not a guess, not a stale version, the actual code as it exists right now.
22
-
23
- ### You stop copy-pasting code into the chat
24
-
25
- Without PureContext, a typical conversation goes:
26
-
27
- > "I need help understanding how the order processing pipeline works."
28
- > *[You open five files, copy the relevant parts, paste them into the chat]*
29
- > "Here's the OrderProcessor class, here's the CartValidator, here's..."
30
-
31
- With PureContext, Claude navigates the codebase itself. You describe what you want to understand and Claude fetches the relevant symbols, follows the dependency chain, and builds its own picture. You stay in the conversation; you're not the file fetcher.
32
-
33
- ### Large codebases become navigable
34
-
35
- A solo developer working on a 500-file TypeScript monorepo, and an enterprise team working on a 40,000-file Java platform, face the same structural problem: the codebase is too large to hold in any context window. PureContext makes both tractable by turning "read these files" into "retrieve these symbols."
36
-
37
- The difference matters most in enterprise environments where no single person knows the whole codebase, onboarding takes months, and getting AI to help requires giving it enough context to be useful without hitting token limits.
38
-
39
- ### AI agents can plan changes safely
40
-
41
- Before PureContext, asking an AI to help you change a core function was risky. The AI didn't know what depended on it. It couldn't see what would break.
42
-
43
- With the dependency graph tools, Claude can check the blast radius of any change before touching it — see what imports the function, follow the transitive dependency chain, and tell you "this change will affect 14 files across 3 services." That's the difference between AI assistance and AI guesswork.
44
-
45
- ---
46
-
47
- ## Who this is for
48
-
49
- **Solo developers** get a faster inner loop. Index your project once, then navigate it with natural language instead of file browsing. The AI remembers the structure so you don't have to keep re-explaining it in every conversation.
50
-
51
- **Teams** get a shared understanding of the codebase. When one developer indexes the repository on a shared server, everyone on the team can search it. New developers get a pre-built picture of the codebase on day one. Senior engineers don't spend their week explaining architecture.
52
-
53
- **Enterprise environments** get the audit trails, access controls, rate limiting, and Docker-based deployment that make AI-assisted development compatible with security requirements. PureContext doesn't read your code and send it to a third party — it indexes locally and serves over your own network.
54
-
55
- ---
56
-
57
- ## What PureContext is not
58
-
59
- It is not a replacement for reading code. There will always be times when you need to read a file carefully, understand edge cases, or review logic line by line. PureContext makes those moments targeted — you know which file, which function, which 45 lines matter — instead of exploratory.
60
-
61
- It is not a code editor or language server. It does not type-check, lint, or autocomplete. Those tools solve different problems.
62
-
63
- It is not magic. The quality of its output depends on the quality of your codebase structure, documentation, and naming. Well-named functions with docstrings are searchable from the first index. Undocumented spaghetti becomes searchable with AI summarization enabled — but meaningful naming still wins.
64
-
65
- ---
66
-
67
- ## The compounding effect
68
-
69
- The value of PureContext grows with use. The index improves as your codebase improves. The dependency graph becomes more useful as you add more framework adapters. Git history integration becomes richer as the project ages. AI summaries mean that even undocumented code becomes discoverable.
70
-
71
- On a fresh solo project: **useful from day one** for navigation and symbol retrieval.
72
-
73
- On a two-year-old enterprise codebase: **transformative**because that's where the navigation problem is most acute and where accurate AI assistance has the most value.
1
+ # Why PureContext
2
+
3
+ ## The problem is not tokens. It's accuracy.
4
+
5
+ When an AI agent works with your code, the quality of its answers depends entirely on what you put in front of it. Give it an entire 800-line file to find one function and two things happen: you burn thousands of tokens getting there, and the AI spends most of that context on code that has nothing to do with your question.
6
+
7
+ Token savings are the measurable side effect of a more fundamental improvement: **AI gets better answers from precise context than from bulk context.**
8
+
9
+ A 45-line function retrieved by name gives Claude exactly what it needs. An 800-line file gives Claude the function plus seven unrelated utilities, three deprecated helpers, a wall of imports, and a pile of comments about things that were fixed in 2019. All of that crowds out the signal.
10
+
11
+ PureContext fixes this by giving AI agents a way to navigate code the way experienced engineers do — by name, by meaning, by dependency — rather than by reading everything and hoping.
12
+
13
+ That precise retrieval is the **foundation**. It's also where the bigger shift begins.
14
+
15
+ ---
16
+
17
+ ## The bigger problem: agents can read code, but not change it safely
18
+
19
+ Finding code is the easy half and increasingly, every agent harness can do it. The hard half is *changing* code you didn't write: knowing what depends on a function, what quietly moves alongside it, and whether it's safe to touch at all.
20
+
21
+ That's the context a careful senior engineer carries in their head and a fresh agent simply doesn't have. PureContext gives the agent that context as tools it can call **before** it edits:
22
+
23
+ - **Blast radius** (`get_blast_radius`) every file that transitively depends on a symbol, so a change is never blind.
24
+ - **Temporal co-change** (`get_co_change`) — the files that historically move *together* in commits but don't import each other: the test, the migration, the feature flag. The coupling the dependency graph can't see.
25
+ - **Composite change risk** (`get_symbol_risk`) — one banded `low` / `review` / `high` verdict fusing churn, centrality, complexity, test gaps, and co-change, with plain-English reasons. Deliberately code-centered: no author or productivity metrics.
26
+ - **Refactor-safety checks** (`check_rename_safe` / `check_delete_safe` / `check_move_safe`, `plan_refactoring`) — a pre-flight verdict before a rename, delete, move, or multi-step refactor.
27
+
28
+ This is what sets PureContext apart from a fast symbol index: it doesn't just help an agent *find* code, it helps it *change* code without breaking what it can't see. The token-efficient retrieval underneath is what makes every one of those checks cheap enough to run on every edit.
29
+
30
+ ---
31
+
32
+ ## A closed loop, not just a warning
33
+
34
+ The checks above are the *before*. PureContext closes the loop around the whole edit:
35
+
36
+ 1. **`prepare_change`** — before editing, state your intent (rename, delete, modify, extract) and a target. PureContext resolves the exact change set and returns one pre-flight verdict: the files you'll touch, the composite risk, the historically co-changing files you're *about to forget*, the tests to run, and any architectural flags — in plain English, with reasons, not a bare confidence number. If the target is ambiguous it tells you and asks; it never guesses.
37
+ 2. **You make the edit.** PureContext does not. Your agent already has a file-write tool; PureContext's job is judgment, not a second pair of hands.
38
+ 3. **`verify_change`** — after editing, hand back the real diff. PureContext reconciles what you *did* against what it *predicted*: which co-change partners you addressed, which you still haven't, what you changed that wasn't planned, and whether any changed code is still untested. "Complete," "incomplete," or "scope expanded" — with the reasons.
39
+ 4. **`compare_change_impact`** snapshot the architecture before, and afterwards PureContext reports only what your change *introduced*: a new import cycle, a new layer violation. It never blames you for problems that were already there.
40
+
41
+ That before edit verify compare loop is the difference between a tool that *flags* risk and one that confirms the change was actually safe and complete.
42
+
43
+ ---
44
+
45
+ ## What changes in practice
46
+
47
+ ### Your AI assistant gets fewer hallucinations
48
+
49
+ Hallucinations in coding tasks most often happen when the AI is working from incomplete or outdated context. If Claude has to read a file from two weeks ago that you haven't reindexed, or guess at function signatures from imports rather than seeing the actual definition, it will make things up convincingly.
50
+
51
+ PureContext indexes your codebase on demand and re-indexes incrementally as you work. When Claude asks for `validatePaymentMethod`, it gets the current definition not a guess, not a stale version, the actual code as it exists right now.
52
+
53
+ ### You stop copy-pasting code into the chat
54
+
55
+ Without PureContext, a typical conversation goes:
56
+
57
+ > "I need help understanding how the order processing pipeline works."
58
+ > *[You open five files, copy the relevant parts, paste them into the chat]*
59
+ > "Here's the OrderProcessor class, here's the CartValidator, here's..."
60
+
61
+ With PureContext, Claude navigates the codebase itself. You describe what you want to understand and Claude fetches the relevant symbols, follows the dependency chain, and builds its own picture. You stay in the conversation; you're not the file fetcher.
62
+
63
+ ### Large codebases become navigable
64
+
65
+ A solo developer working on a 500-file TypeScript monorepo, and an enterprise team working on a 40,000-file Java platform, face the same structural problem: the codebase is too large to hold in any context window. PureContext makes both tractable by turning "read these files" into "retrieve these symbols."
66
+
67
+ The difference matters most in enterprise environments where no single person knows the whole codebase, onboarding takes months, and getting AI to help requires giving it enough context to be useful without hitting token limits.
68
+
69
+ ### AI agents can change code safely, not just read it
70
+
71
+ Before PureContext, asking an AI to change a core function was a gamble it didn't know what depended on the code, what moved with it, or whether it was risky to touch.
72
+
73
+ Now Claude checks the blast radius, the historical co-changers, and a composite risk score *before* editing, and can tell you: *"this is high-risk and untested it affects 14 files across 3 services and usually moves with `ledger.ts` and `refund.test.ts`, so I'll update those in the same change."* That's the difference between AI assistance and AI guesswork.
74
+
75
+ ---
76
+
77
+ ## Who this is for
78
+
79
+ **Solo developers** get a faster inner loop. Index your project once, then navigate it with natural language instead of file browsing. The AI remembers the structure so you don't have to keep re-explaining it in every conversation.
80
+
81
+ **Teams** get a shared understanding of the codebase. When one developer indexes the repository on a shared server, everyone on the team can search it. New developers get a pre-built picture of the codebase on day one. Senior engineers don't spend their week explaining architecture.
82
+
83
+ **Enterprise environments** get the audit trails, access controls, rate limiting, and Docker-based deployment that make AI-assisted development compatible with security requirements. PureContext doesn't read your code and send it to a third party — it indexes locally and serves over your own network.
84
+
85
+ ---
86
+
87
+ ## What PureContext is not
88
+
89
+ It is not a replacement for reading code. There will always be times when you need to read a file carefully, understand edge cases, or review logic line by line. PureContext makes those moments targeted — you know which file, which function, which 45 lines matter — instead of exploratory.
90
+
91
+ It is not a code editor or language server. It does not type-check, lint, or autocomplete. Those tools solve different problems. **It is not a second editor — it never applies your changes for you.** It tells the agent what's safe and what's still missing; the agent does the writing. Judgment, not actuation.
92
+
93
+ It is not magic. The quality of its output depends on the quality of your codebase structure, documentation, and naming. Well-named functions with docstrings are searchable from the first index. Undocumented spaghetti becomes searchable with AI summarization enabled — but meaningful naming still wins.
94
+
95
+ ---
96
+
97
+ ## The compounding effect
98
+
99
+ The value of PureContext grows with use. The index improves as your codebase improves. The dependency graph becomes more useful as you add more framework adapters. Git history integration becomes richer as the project ages. AI summaries mean that even undocumented code becomes discoverable.
100
+
101
+ On a fresh solo project: **useful from day one** for navigation and symbol retrieval.
102
+
103
+ On a two-year-old enterprise codebase: **transformative** — because that's where the navigation problem is most acute and where accurate AI assistance has the most value.