@claudetools/tools 0.8.2 → 0.8.4

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 (74) hide show
  1. package/dist/cli.js +41 -0
  2. package/dist/context/deduplication.d.ts +72 -0
  3. package/dist/context/deduplication.js +77 -0
  4. package/dist/context/deduplication.test.d.ts +6 -0
  5. package/dist/context/deduplication.test.js +84 -0
  6. package/dist/context/emergency-eviction.d.ts +73 -0
  7. package/dist/context/emergency-eviction.example.d.ts +13 -0
  8. package/dist/context/emergency-eviction.example.js +94 -0
  9. package/dist/context/emergency-eviction.js +226 -0
  10. package/dist/context/eviction-engine.d.ts +76 -0
  11. package/dist/context/eviction-engine.example.d.ts +7 -0
  12. package/dist/context/eviction-engine.example.js +144 -0
  13. package/dist/context/eviction-engine.js +176 -0
  14. package/dist/context/example-usage.d.ts +1 -0
  15. package/dist/context/example-usage.js +128 -0
  16. package/dist/context/exchange-summariser.d.ts +80 -0
  17. package/dist/context/exchange-summariser.js +261 -0
  18. package/dist/context/health-monitor.d.ts +97 -0
  19. package/dist/context/health-monitor.example.d.ts +1 -0
  20. package/dist/context/health-monitor.example.js +164 -0
  21. package/dist/context/health-monitor.js +210 -0
  22. package/dist/context/importance-scorer.d.ts +94 -0
  23. package/dist/context/importance-scorer.example.d.ts +1 -0
  24. package/dist/context/importance-scorer.example.js +140 -0
  25. package/dist/context/importance-scorer.js +187 -0
  26. package/dist/context/index.d.ts +9 -0
  27. package/dist/context/index.js +16 -0
  28. package/dist/context/session-helper.d.ts +10 -0
  29. package/dist/context/session-helper.js +51 -0
  30. package/dist/context/session-store.d.ts +94 -0
  31. package/dist/context/session-store.js +286 -0
  32. package/dist/context/usage-estimator.d.ts +131 -0
  33. package/dist/context/usage-estimator.js +260 -0
  34. package/dist/context/usage-estimator.test.d.ts +1 -0
  35. package/dist/context/usage-estimator.test.js +208 -0
  36. package/dist/context-cli.d.ts +16 -0
  37. package/dist/context-cli.js +309 -0
  38. package/dist/evaluation/build-dataset.d.ts +1 -0
  39. package/dist/evaluation/build-dataset.js +135 -0
  40. package/dist/evaluation/threshold-eval.d.ts +63 -0
  41. package/dist/evaluation/threshold-eval.js +250 -0
  42. package/dist/handlers/codedna-handlers.d.ts +2 -2
  43. package/dist/handlers/tool-handlers.js +126 -165
  44. package/dist/helpers/api-client.d.ts +5 -1
  45. package/dist/helpers/api-client.js +3 -1
  46. package/dist/helpers/compact-formatter.d.ts +51 -0
  47. package/dist/helpers/compact-formatter.js +130 -0
  48. package/dist/helpers/engagement-tracker.d.ts +10 -0
  49. package/dist/helpers/engagement-tracker.js +61 -0
  50. package/dist/helpers/error-tracking.js +1 -1
  51. package/dist/helpers/session-validation.d.ts +76 -0
  52. package/dist/helpers/session-validation.js +221 -0
  53. package/dist/helpers/usage-analytics.js +1 -1
  54. package/dist/hooks/index.d.ts +4 -0
  55. package/dist/hooks/index.js +6 -0
  56. package/dist/hooks/post-tool-use-hook-cli.d.ts +2 -0
  57. package/dist/hooks/post-tool-use-hook-cli.js +34 -0
  58. package/dist/hooks/post-tool-use.d.ts +67 -0
  59. package/dist/hooks/post-tool-use.js +234 -0
  60. package/dist/hooks/stop-hook-cli.d.ts +2 -0
  61. package/dist/hooks/stop-hook-cli.js +34 -0
  62. package/dist/hooks/stop.d.ts +64 -0
  63. package/dist/hooks/stop.js +192 -0
  64. package/dist/index.d.ts +3 -0
  65. package/dist/index.js +2 -0
  66. package/dist/logger.d.ts +1 -1
  67. package/dist/logger.js +4 -0
  68. package/dist/resources.js +3 -0
  69. package/dist/setup.js +206 -2
  70. package/dist/templates/claude-md.d.ts +1 -1
  71. package/dist/templates/claude-md.js +23 -35
  72. package/dist/templates/worker-prompt.js +35 -202
  73. package/dist/tools.js +26 -20
  74. package/package.json +6 -2
package/dist/tools.js CHANGED
@@ -7,7 +7,14 @@ export function registerToolDefinitions(server) {
7
7
  tools: [
8
8
  {
9
9
  name: 'memory_search',
10
- description: 'Search the memory system for relevant facts and entities based on a query. Use this to recall past conversations, facts, and relationships. NOTE: Context is now automatically injected - use this only for explicit searches.',
10
+ description: `⚠️ RARELY NEEDED - Context is AUTO-INJECTED via hooks on every message.
11
+
12
+ Only use this tool when:
13
+ - You need to search with DIFFERENT parameters than the user's query
14
+ - You're debugging what's in memory
15
+ - The user explicitly asks to search memory
16
+
17
+ DO NOT use this tool to "recall context" - that happens automatically.`,
11
18
  inputSchema: {
12
19
  type: 'object',
13
20
  properties: {
@@ -29,7 +36,7 @@ export function registerToolDefinitions(server) {
29
36
  },
30
37
  {
31
38
  name: 'memory_explain',
32
- description: 'Explain what memory context was automatically injected in the last response. Use this when you want to understand what memories are being used.',
39
+ description: 'Debug tool: Show what memory context was auto-injected. Only use if debugging memory injection.',
33
40
  inputSchema: {
34
41
  type: 'object',
35
42
  properties: {},
@@ -37,7 +44,13 @@ export function registerToolDefinitions(server) {
37
44
  },
38
45
  {
39
46
  name: 'memory_inject',
40
- description: 'Manually trigger context injection for a specific query. Normally context is injected automatically, but use this for explicit control.',
47
+ description: `⚠️ RARELY NEEDED - Context is AUTO-INJECTED via user-prompt-submit hook.
48
+
49
+ Only use this tool when:
50
+ - You need to inject context for a DIFFERENT query than the user's message
51
+ - The user explicitly asks to refresh context
52
+
53
+ DO NOT call this routinely - it wastes context tokens.`,
41
54
  inputSchema: {
42
55
  type: 'object',
43
56
  properties: {
@@ -133,13 +146,19 @@ EXAMPLES:
133
146
  type: 'string',
134
147
  description: 'Project ID (optional, uses default if not provided)',
135
148
  },
149
+ is_critical: {
150
+ type: 'boolean',
151
+ description: 'Mark as critical fact - always injected regardless of query relevance. Use sparingly for truly essential facts.',
152
+ },
136
153
  },
137
154
  required: ['entity1', 'relationship', 'entity2', 'context'],
138
155
  },
139
156
  },
140
157
  {
141
158
  name: 'memory_get_context',
142
- description: 'Get the current memory context, optionally filtered by a query. Returns recent facts and entities.',
159
+ description: `⚠️ RARELY NEEDED - Context is AUTO-INJECTED via hooks.
160
+
161
+ Only use for debugging or when user explicitly asks "what context do you have?"`,
143
162
  inputSchema: {
144
163
  type: 'object',
145
164
  properties: {
@@ -185,23 +204,10 @@ EXAMPLES:
185
204
  // =========================================================================
186
205
  {
187
206
  name: 'memory_index',
188
- description: `Get a lightweight index of available memories WITHOUT fetching full content. Use this FIRST to scan what context is available before deciding what to retrieve.
189
-
190
- Returns for each memory:
191
- - id: Unique identifier for fetching details
192
- - topic: Short topic/subject description
193
- - relevance: Score (0-1) indicating how relevant to query
194
- - token_cost: Estimated tokens if fetched
195
- - importance: "critical" | "high" | "normal" - Critical facts are auto-injected
196
- - category: "architecture" | "pattern" | "decision" | "preference" | "fact"
197
- - last_accessed: When this memory was last used
198
-
199
- WORKFLOW:
200
- 1. Call memory_index with your query to see what's available
201
- 2. Review the index - critical items are auto-injected
202
- 3. Call memory_detail for specific IDs you want full content for
207
+ description: `⚠️ RARELY NEEDED - Critical facts are AUTO-INJECTED via hooks.
203
208
 
204
- This saves tokens by letting you selectively fetch only relevant memories.`,
209
+ Only use when you need to browse ALL available memories or debug what's stored.
210
+ For normal work, context is injected automatically - don't call this.`,
205
211
  inputSchema: {
206
212
  type: 'object',
207
213
  properties: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@claudetools/tools",
3
- "version": "0.8.2",
3
+ "version": "0.8.4",
4
4
  "description": "Persistent AI memory, task management, and codebase intelligence for Claude Code",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -26,7 +26,9 @@
26
26
  "codedna:analytics": "tsx -e \"import { weeklyAnalyticsSummary } from './src/helpers/usage-analytics.js'; weeklyAnalyticsSummary()\"",
27
27
  "codedna:analytics:24h": "tsx -e \"import { getLast24HoursAnalytics, printAnalytics } from './src/helpers/usage-analytics.js'; const r = await getLast24HoursAnalytics(); printAnalytics(r, 'Last 24 Hours')\"",
28
28
  "codedna:analytics:30d": "tsx -e \"import { getLast30DaysAnalytics, printAnalytics } from './src/helpers/usage-analytics.js'; const r = await getLast30DaysAnalytics(); printAnalytics(r, 'Last 30 Days')\"",
29
- "prompt:verify": "scripts/verify-prompt-compliance.sh"
29
+ "prompt:verify": "scripts/verify-prompt-compliance.sh",
30
+ "eval:build-dataset": "tsx src/evaluation/build-dataset.ts",
31
+ "eval:threshold": "tsx src/evaluation/threshold-eval.ts"
30
32
  },
31
33
  "repository": {
32
34
  "type": "git",
@@ -63,10 +65,12 @@
63
65
  "typescript": "^5.3.0"
64
66
  },
65
67
  "devDependencies": {
68
+ "@types/better-sqlite3": "^7.6.13",
66
69
  "@types/node": "^20.10.0",
67
70
  "@types/nunjucks": "^3.2.6",
68
71
  "@types/prompts": "^2.4.9",
69
72
  "@vitest/ui": "^4.0.15",
73
+ "better-sqlite3": "^12.5.0",
70
74
  "tsx": "^4.7.0",
71
75
  "typescript": "^5.3.0",
72
76
  "vitest": "^4.0.15"