claude-cortex 1.0.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 (102) hide show
  1. package/README.md +291 -0
  2. package/dist/api/events.d.ts +134 -0
  3. package/dist/api/events.d.ts.map +1 -0
  4. package/dist/api/events.js +73 -0
  5. package/dist/api/events.js.map +1 -0
  6. package/dist/api/visualization-server.d.ts +11 -0
  7. package/dist/api/visualization-server.d.ts.map +1 -0
  8. package/dist/api/visualization-server.js +653 -0
  9. package/dist/api/visualization-server.js.map +1 -0
  10. package/dist/context/project-context.d.ts +57 -0
  11. package/dist/context/project-context.d.ts.map +1 -0
  12. package/dist/context/project-context.js +135 -0
  13. package/dist/context/project-context.js.map +1 -0
  14. package/dist/database/init.d.ts +49 -0
  15. package/dist/database/init.d.ts.map +1 -0
  16. package/dist/database/init.js +336 -0
  17. package/dist/database/init.js.map +1 -0
  18. package/dist/embeddings/generator.d.ts +20 -0
  19. package/dist/embeddings/generator.d.ts.map +1 -0
  20. package/dist/embeddings/generator.js +77 -0
  21. package/dist/embeddings/generator.js.map +1 -0
  22. package/dist/embeddings/index.d.ts +2 -0
  23. package/dist/embeddings/index.d.ts.map +1 -0
  24. package/dist/embeddings/index.js +2 -0
  25. package/dist/embeddings/index.js.map +1 -0
  26. package/dist/errors.d.ts +74 -0
  27. package/dist/errors.d.ts.map +1 -0
  28. package/dist/errors.js +131 -0
  29. package/dist/errors.js.map +1 -0
  30. package/dist/index.d.ts +16 -0
  31. package/dist/index.d.ts.map +1 -0
  32. package/dist/index.js +83 -0
  33. package/dist/index.js.map +1 -0
  34. package/dist/memory/activation.d.ts +69 -0
  35. package/dist/memory/activation.d.ts.map +1 -0
  36. package/dist/memory/activation.js +168 -0
  37. package/dist/memory/activation.js.map +1 -0
  38. package/dist/memory/consolidate.d.ts +96 -0
  39. package/dist/memory/consolidate.d.ts.map +1 -0
  40. package/dist/memory/consolidate.js +400 -0
  41. package/dist/memory/consolidate.js.map +1 -0
  42. package/dist/memory/contradiction.d.ts +69 -0
  43. package/dist/memory/contradiction.d.ts.map +1 -0
  44. package/dist/memory/contradiction.js +286 -0
  45. package/dist/memory/contradiction.js.map +1 -0
  46. package/dist/memory/decay.d.ts +62 -0
  47. package/dist/memory/decay.d.ts.map +1 -0
  48. package/dist/memory/decay.js +184 -0
  49. package/dist/memory/decay.js.map +1 -0
  50. package/dist/memory/salience.d.ts +36 -0
  51. package/dist/memory/salience.d.ts.map +1 -0
  52. package/dist/memory/salience.js +200 -0
  53. package/dist/memory/salience.js.map +1 -0
  54. package/dist/memory/similarity.d.ts +57 -0
  55. package/dist/memory/similarity.d.ts.map +1 -0
  56. package/dist/memory/similarity.js +114 -0
  57. package/dist/memory/similarity.js.map +1 -0
  58. package/dist/memory/store.d.ts +170 -0
  59. package/dist/memory/store.d.ts.map +1 -0
  60. package/dist/memory/store.js +973 -0
  61. package/dist/memory/store.js.map +1 -0
  62. package/dist/memory/types.d.ts +91 -0
  63. package/dist/memory/types.d.ts.map +1 -0
  64. package/dist/memory/types.js +30 -0
  65. package/dist/memory/types.js.map +1 -0
  66. package/dist/server.d.ts +12 -0
  67. package/dist/server.d.ts.map +1 -0
  68. package/dist/server.js +466 -0
  69. package/dist/server.js.map +1 -0
  70. package/dist/tools/context.d.ts +135 -0
  71. package/dist/tools/context.d.ts.map +1 -0
  72. package/dist/tools/context.js +273 -0
  73. package/dist/tools/context.js.map +1 -0
  74. package/dist/tools/forget.d.ts +53 -0
  75. package/dist/tools/forget.d.ts.map +1 -0
  76. package/dist/tools/forget.js +179 -0
  77. package/dist/tools/forget.js.map +1 -0
  78. package/dist/tools/recall.d.ts +74 -0
  79. package/dist/tools/recall.d.ts.map +1 -0
  80. package/dist/tools/recall.js +140 -0
  81. package/dist/tools/recall.js.map +1 -0
  82. package/dist/tools/remember.d.ts +65 -0
  83. package/dist/tools/remember.d.ts.map +1 -0
  84. package/dist/tools/remember.js +147 -0
  85. package/dist/tools/remember.js.map +1 -0
  86. package/dist/worker/brain-worker.d.ts +100 -0
  87. package/dist/worker/brain-worker.d.ts.map +1 -0
  88. package/dist/worker/brain-worker.js +261 -0
  89. package/dist/worker/brain-worker.js.map +1 -0
  90. package/dist/worker/link-discovery.d.ts +47 -0
  91. package/dist/worker/link-discovery.d.ts.map +1 -0
  92. package/dist/worker/link-discovery.js +103 -0
  93. package/dist/worker/link-discovery.js.map +1 -0
  94. package/dist/worker/predictive-consolidation.d.ts +46 -0
  95. package/dist/worker/predictive-consolidation.d.ts.map +1 -0
  96. package/dist/worker/predictive-consolidation.js +110 -0
  97. package/dist/worker/predictive-consolidation.js.map +1 -0
  98. package/dist/worker/types.d.ts +91 -0
  99. package/dist/worker/types.d.ts.map +1 -0
  100. package/dist/worker/types.js +22 -0
  101. package/dist/worker/types.js.map +1 -0
  102. package/package.json +59 -0
@@ -0,0 +1,91 @@
1
+ /**
2
+ * Brain Worker Types and Configuration
3
+ *
4
+ * Phase 4 Organic Brain Feature
5
+ *
6
+ * Defines configuration, result types, and status interfaces
7
+ * for the background brain worker.
8
+ */
9
+ import { ConsolidationResult } from '../memory/types.js';
10
+ /**
11
+ * Configuration for the brain worker
12
+ */
13
+ export interface WorkerConfig {
14
+ /** Light tick interval - activation pruning, predictive check (default: 5 min) */
15
+ lightTickIntervalMs: number;
16
+ /** Medium tick interval - link discovery, contradiction scan (default: 30 min) */
17
+ mediumTickIntervalMs: number;
18
+ /** STM warning threshold - consider consolidation when exceeded (default: 0.7 = 70%) */
19
+ stmWarningThreshold: number;
20
+ /** STM critical threshold - immediate consolidation (default: 0.85 = 85%) */
21
+ stmCriticalThreshold: number;
22
+ /** Total memory warning threshold (default: 0.8 = 80% of 1100 total) */
23
+ totalMemoryWarningThreshold: number;
24
+ /** Max memories to process for link discovery per cycle (default: 10) */
25
+ maxLinksPerCycle: number;
26
+ /** Max contradiction pairs to check per scan (default: 50) */
27
+ contradictionScanLimit: number;
28
+ /** High activity threshold - memories created in 30 min (default: 5) */
29
+ highActivityThreshold: number;
30
+ }
31
+ /**
32
+ * Default worker configuration
33
+ */
34
+ export declare const DEFAULT_WORKER_CONFIG: WorkerConfig;
35
+ /**
36
+ * Result of a light tick operation
37
+ */
38
+ export interface LightTickResult {
39
+ /** Number of stale activation entries pruned */
40
+ activationsPruned: number;
41
+ /** Consolidation result if predictive consolidation ran, null otherwise */
42
+ predictiveConsolidation: ConsolidationResult | null;
43
+ /** When this tick completed */
44
+ timestamp: Date;
45
+ }
46
+ /**
47
+ * Result of a medium tick operation
48
+ */
49
+ export interface MediumTickResult {
50
+ /** Number of new links discovered and created */
51
+ linksDiscovered: number;
52
+ /** Number of contradictions detected */
53
+ contradictionsFound: number;
54
+ /** Number of contradiction links created */
55
+ contradictionsLinked: number;
56
+ /** Number of memories scanned for links */
57
+ memoriesScanned: number;
58
+ /** When this tick completed */
59
+ timestamp: Date;
60
+ }
61
+ /**
62
+ * Current status of the brain worker
63
+ */
64
+ export interface WorkerStatus {
65
+ /** Whether the worker is currently running */
66
+ isRunning: boolean;
67
+ /** When the last light tick completed */
68
+ lastLightTick: Date | null;
69
+ /** When the last medium tick completed */
70
+ lastMediumTick: Date | null;
71
+ /** When the last predictive consolidation ran */
72
+ lastConsolidation: Date | null;
73
+ /** Cumulative statistics */
74
+ stats: {
75
+ lightTicks: number;
76
+ mediumTicks: number;
77
+ consolidations: number;
78
+ };
79
+ }
80
+ /**
81
+ * Decision from predictive consolidation check
82
+ */
83
+ export interface PredictiveDecision {
84
+ /** Whether consolidation should run */
85
+ shouldRun: boolean;
86
+ /** Human-readable reason for the decision */
87
+ reason: string;
88
+ /** Urgency level of the consolidation need */
89
+ urgency: 'low' | 'medium' | 'high' | 'critical';
90
+ }
91
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/worker/types.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB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IAE/B,4BAA4B;IAC5B,KAAK,EAAE;QACL,UAAU,EAAE,MAAM,CAAC;QACnB,WAAW,EAAE,MAAM,CAAC;QACpB,cAAc,EAAE,MAAM,CAAC;KACxB,CAAC;CACH;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,uCAAuC;IACvC,SAAS,EAAE,OAAO,CAAC;IAEnB,6CAA6C;IAC7C,MAAM,EAAE,MAAM,CAAC;IAEf,8CAA8C;IAC9C,OAAO,EAAE,KAAK,GAAG,QAAQ,GAAG,MAAM,GAAG,UAAU,CAAC;CACjD"}
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Brain Worker Types and Configuration
3
+ *
4
+ * Phase 4 Organic Brain Feature
5
+ *
6
+ * Defines configuration, result types, and status interfaces
7
+ * for the background brain worker.
8
+ */
9
+ /**
10
+ * Default worker configuration
11
+ */
12
+ export const DEFAULT_WORKER_CONFIG = {
13
+ lightTickIntervalMs: 5 * 60 * 1000, // 5 minutes
14
+ mediumTickIntervalMs: 30 * 60 * 1000, // 30 minutes
15
+ stmWarningThreshold: 0.7, // 70 of 100 STM
16
+ stmCriticalThreshold: 0.85, // 85 of 100 STM
17
+ totalMemoryWarningThreshold: 0.8, // 880 of 1100 total
18
+ maxLinksPerCycle: 10,
19
+ contradictionScanLimit: 50,
20
+ highActivityThreshold: 5,
21
+ };
22
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/worker/types.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAiCH;;GAEG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAiB;IACjD,mBAAmB,EAAE,CAAC,GAAG,EAAE,GAAG,IAAI,EAAQ,YAAY;IACtD,oBAAoB,EAAE,EAAE,GAAG,EAAE,GAAG,IAAI,EAAM,aAAa;IACvD,mBAAmB,EAAE,GAAG,EAAmB,gBAAgB;IAC3D,oBAAoB,EAAE,IAAI,EAAiB,gBAAgB;IAC3D,2BAA2B,EAAE,GAAG,EAAW,oBAAoB;IAC/D,gBAAgB,EAAE,EAAE;IACpB,sBAAsB,EAAE,EAAE;IAC1B,qBAAqB,EAAE,CAAC;CACzB,CAAC"}
package/package.json ADDED
@@ -0,0 +1,59 @@
1
+ {
2
+ "name": "claude-cortex",
3
+ "version": "1.0.0",
4
+ "description": "Brain-like memory system for Claude Code - solves context compaction and memory persistence",
5
+ "main": "dist/index.js",
6
+ "type": "module",
7
+ "scripts": {
8
+ "build": "tsc",
9
+ "start": "node dist/index.js",
10
+ "start:api": "node dist/index.js --mode api",
11
+ "dev": "tsx src/index.ts",
12
+ "dev:api": "tsx src/index.ts --mode api",
13
+ "watch": "tsc --watch"
14
+ },
15
+ "keywords": [
16
+ "claude",
17
+ "mcp",
18
+ "memory",
19
+ "ai",
20
+ "context"
21
+ ],
22
+ "author": "Michael Kyriacou",
23
+ "license": "MIT",
24
+ "repository": {
25
+ "type": "git",
26
+ "url": "git+https://github.com/mkdelta221/claude-cortex.git"
27
+ },
28
+ "homepage": "https://github.com/mkdelta221/claude-cortex#readme",
29
+ "bugs": {
30
+ "url": "https://github.com/mkdelta221/claude-cortex/issues"
31
+ },
32
+ "engines": {
33
+ "node": ">=18.0.0"
34
+ },
35
+ "dependencies": {
36
+ "@modelcontextprotocol/sdk": "^1.0.0",
37
+ "@xenova/transformers": "^2.17.2",
38
+ "better-sqlite3": "^11.0.0",
39
+ "cors": "^2.8.5",
40
+ "express": "^4.21.0",
41
+ "ws": "^8.18.0",
42
+ "zod": "^3.23.0"
43
+ },
44
+ "devDependencies": {
45
+ "@types/better-sqlite3": "^7.6.11",
46
+ "@types/cors": "^2.8.17",
47
+ "@types/express": "^5.0.0",
48
+ "@types/node": "^22.0.0",
49
+ "@types/ws": "^8.5.13",
50
+ "tsx": "^4.19.0",
51
+ "typescript": "^5.6.0"
52
+ },
53
+ "bin": {
54
+ "claude-cortex": "./dist/index.js"
55
+ },
56
+ "files": [
57
+ "dist"
58
+ ]
59
+ }