neuro-cortex-memory 2.0.0__tar.gz

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 (377) hide show
  1. neuro_cortex_memory-2.0.0/.claude-plugin/marketplace.json +28 -0
  2. neuro_cortex_memory-2.0.0/.claude-plugin/plugin.json +67 -0
  3. neuro_cortex_memory-2.0.0/.github/workflows/ci.yml +116 -0
  4. neuro_cortex_memory-2.0.0/.github/workflows/release.yml +106 -0
  5. neuro_cortex_memory-2.0.0/.gitignore +16 -0
  6. neuro_cortex_memory-2.0.0/.mcp.json +9 -0
  7. neuro_cortex_memory-2.0.0/CLAUDE.md +306 -0
  8. neuro_cortex_memory-2.0.0/PKG-INFO +821 -0
  9. neuro_cortex_memory-2.0.0/README.md +797 -0
  10. neuro_cortex_memory-2.0.0/_pipeline/run_test.py +30 -0
  11. neuro_cortex_memory-2.0.0/benchmarks/beam/data.py +122 -0
  12. neuro_cortex_memory-2.0.0/benchmarks/beam/run_benchmark.py +326 -0
  13. neuro_cortex_memory-2.0.0/benchmarks/episodic/run_benchmark.py +338 -0
  14. neuro_cortex_memory-2.0.0/benchmarks/evermembench/run_benchmark.py +313 -0
  15. neuro_cortex_memory-2.0.0/benchmarks/lib/__init__.py +35 -0
  16. neuro_cortex_memory-2.0.0/benchmarks/lib/fusion.py +53 -0
  17. neuro_cortex_memory-2.0.0/benchmarks/lib/reporting.py +74 -0
  18. neuro_cortex_memory-2.0.0/benchmarks/lib/retriever.py +276 -0
  19. neuro_cortex_memory-2.0.0/benchmarks/lib/scoring.py +101 -0
  20. neuro_cortex_memory-2.0.0/benchmarks/lib/temporal.py +103 -0
  21. neuro_cortex_memory-2.0.0/benchmarks/locomo/.gitignore +1 -0
  22. neuro_cortex_memory-2.0.0/benchmarks/locomo/data.py +63 -0
  23. neuro_cortex_memory-2.0.0/benchmarks/locomo/retriever.py +226 -0
  24. neuro_cortex_memory-2.0.0/benchmarks/locomo/run_benchmark.py +165 -0
  25. neuro_cortex_memory-2.0.0/benchmarks/longmemeval/retrieval_config.json +428 -0
  26. neuro_cortex_memory-2.0.0/benchmarks/longmemeval/retrieval_config.yaml +381 -0
  27. neuro_cortex_memory-2.0.0/benchmarks/longmemeval/run_benchmark.py +945 -0
  28. neuro_cortex_memory-2.0.0/benchmarks/memoryagentbench/run_benchmark.py +235 -0
  29. neuro_cortex_memory-2.0.0/benchmarks/quick_test.sh +27 -0
  30. neuro_cortex_memory-2.0.0/commands/methodology.md +13 -0
  31. neuro_cortex_memory-2.0.0/docs/adr/001-zero-dependencies.md +19 -0
  32. neuro_cortex_memory-2.0.0/docs/adr/002-clean-architecture-layers.md +26 -0
  33. neuro_cortex_memory-2.0.0/docs/adr/003-felder-silverman-model.md +24 -0
  34. neuro_cortex_memory-2.0.0/docs/adr/004-jaccard-over-cosine-similarity.md +19 -0
  35. neuro_cortex_memory-2.0.0/docs/adr/005-agglomerative-over-kmeans-clustering.md +19 -0
  36. neuro_cortex_memory-2.0.0/docs/adr/006-ema-for-incremental-updates.md +25 -0
  37. neuro_cortex_memory-2.0.0/docs/adr/007-head-tail-jsonl-reading.md +19 -0
  38. neuro_cortex_memory-2.0.0/docs/adr/008-handler-as-composition-root.md +25 -0
  39. neuro_cortex_memory-2.0.0/docs/adr/009-node-test-over-jest.md +19 -0
  40. neuro_cortex_memory-2.0.0/docs/adr/010-sparse-dictionary-learning.md +18 -0
  41. neuro_cortex_memory-2.0.0/docs/adr/011-persona-vector-design.md +28 -0
  42. neuro_cortex_memory-2.0.0/docs/adr/012-python-migration.md +71 -0
  43. neuro_cortex_memory-2.0.0/docs/adr/013-zikkaron-thermodynamic-memory.md +89 -0
  44. neuro_cortex_memory-2.0.0/docs/api-reference.md +611 -0
  45. neuro_cortex_memory-2.0.0/docs/architecture.md +306 -0
  46. neuro_cortex_memory-2.0.0/docs/data-flow.md +250 -0
  47. neuro_cortex_memory-2.0.0/docs/neural-graph.png +0 -0
  48. neuro_cortex_memory-2.0.0/docs/testing-guide.md +292 -0
  49. neuro_cortex_memory-2.0.0/mcp_server/__init__.py +1 -0
  50. neuro_cortex_memory-2.0.0/mcp_server/__main__.py +737 -0
  51. neuro_cortex_memory-2.0.0/mcp_server/core/__init__.py +1 -0
  52. neuro_cortex_memory-2.0.0/mcp_server/core/ablation.py +307 -0
  53. neuro_cortex_memory-2.0.0/mcp_server/core/attribution_tracer.py +233 -0
  54. neuro_cortex_memory-2.0.0/mcp_server/core/behavioral_crosscoder.py +101 -0
  55. neuro_cortex_memory-2.0.0/mcp_server/core/blindspot_detector.py +257 -0
  56. neuro_cortex_memory-2.0.0/mcp_server/core/bridge_finder.py +191 -0
  57. neuro_cortex_memory-2.0.0/mcp_server/core/cascade.py +340 -0
  58. neuro_cortex_memory-2.0.0/mcp_server/core/causal_graph.py +287 -0
  59. neuro_cortex_memory-2.0.0/mcp_server/core/cognitive_map.py +287 -0
  60. neuro_cortex_memory-2.0.0/mcp_server/core/compression.py +211 -0
  61. neuro_cortex_memory-2.0.0/mcp_server/core/consolidation_engine.py +218 -0
  62. neuro_cortex_memory-2.0.0/mcp_server/core/context_generator.py +106 -0
  63. neuro_cortex_memory-2.0.0/mcp_server/core/coupled_neuromodulation.py +426 -0
  64. neuro_cortex_memory-2.0.0/mcp_server/core/curation.py +222 -0
  65. neuro_cortex_memory-2.0.0/mcp_server/core/decay_cycle.py +120 -0
  66. neuro_cortex_memory-2.0.0/mcp_server/core/dendritic_clusters.py +391 -0
  67. neuro_cortex_memory-2.0.0/mcp_server/core/domain_detector.py +162 -0
  68. neuro_cortex_memory-2.0.0/mcp_server/core/dual_store_cls.py +291 -0
  69. neuro_cortex_memory-2.0.0/mcp_server/core/emergence_tracker.py +305 -0
  70. neuro_cortex_memory-2.0.0/mcp_server/core/emotional_tagging.py +195 -0
  71. neuro_cortex_memory-2.0.0/mcp_server/core/engram.py +131 -0
  72. neuro_cortex_memory-2.0.0/mcp_server/core/enrichment.py +262 -0
  73. neuro_cortex_memory-2.0.0/mcp_server/core/fractal.py +368 -0
  74. neuro_cortex_memory-2.0.0/mcp_server/core/graph_builder.py +174 -0
  75. neuro_cortex_memory-2.0.0/mcp_server/core/hdc_encoder.py +210 -0
  76. neuro_cortex_memory-2.0.0/mcp_server/core/hierarchical_predictive_coding.py +815 -0
  77. neuro_cortex_memory-2.0.0/mcp_server/core/homeostatic_plasticity.py +343 -0
  78. neuro_cortex_memory-2.0.0/mcp_server/core/hopfield.py +219 -0
  79. neuro_cortex_memory-2.0.0/mcp_server/core/interference.py +429 -0
  80. neuro_cortex_memory-2.0.0/mcp_server/core/knowledge_graph.py +213 -0
  81. neuro_cortex_memory-2.0.0/mcp_server/core/memory_rules.py +248 -0
  82. neuro_cortex_memory-2.0.0/mcp_server/core/metacognition.py +432 -0
  83. neuro_cortex_memory-2.0.0/mcp_server/core/microglial_pruning.py +181 -0
  84. neuro_cortex_memory-2.0.0/mcp_server/core/narrative.py +235 -0
  85. neuro_cortex_memory-2.0.0/mcp_server/core/oscillatory_clock.py +547 -0
  86. neuro_cortex_memory-2.0.0/mcp_server/core/pattern_extractor.py +332 -0
  87. neuro_cortex_memory-2.0.0/mcp_server/core/pattern_separation.py +364 -0
  88. neuro_cortex_memory-2.0.0/mcp_server/core/persona_vector.py +173 -0
  89. neuro_cortex_memory-2.0.0/mcp_server/core/profile_builder.py +320 -0
  90. neuro_cortex_memory-2.0.0/mcp_server/core/prospective.py +114 -0
  91. neuro_cortex_memory-2.0.0/mcp_server/core/query_router.py +272 -0
  92. neuro_cortex_memory-2.0.0/mcp_server/core/reconsolidation.py +164 -0
  93. neuro_cortex_memory-2.0.0/mcp_server/core/replay.py +675 -0
  94. neuro_cortex_memory-2.0.0/mcp_server/core/schema_engine.py +585 -0
  95. neuro_cortex_memory-2.0.0/mcp_server/core/sensory_buffer.py +245 -0
  96. neuro_cortex_memory-2.0.0/mcp_server/core/session_critique.py +291 -0
  97. neuro_cortex_memory-2.0.0/mcp_server/core/session_extractor.py +237 -0
  98. neuro_cortex_memory-2.0.0/mcp_server/core/sleep_compute.py +249 -0
  99. neuro_cortex_memory-2.0.0/mcp_server/core/sparse_dictionary.py +380 -0
  100. neuro_cortex_memory-2.0.0/mcp_server/core/spreading_activation.py +212 -0
  101. neuro_cortex_memory-2.0.0/mcp_server/core/staleness.py +184 -0
  102. neuro_cortex_memory-2.0.0/mcp_server/core/style_classifier.py +289 -0
  103. neuro_cortex_memory-2.0.0/mcp_server/core/synaptic_plasticity.py +568 -0
  104. neuro_cortex_memory-2.0.0/mcp_server/core/synaptic_tagging.py +223 -0
  105. neuro_cortex_memory-2.0.0/mcp_server/core/thermodynamics.py +176 -0
  106. neuro_cortex_memory-2.0.0/mcp_server/core/tripartite_synapse.py +414 -0
  107. neuro_cortex_memory-2.0.0/mcp_server/core/two_stage_model.py +379 -0
  108. neuro_cortex_memory-2.0.0/mcp_server/core/unified_graph_builder.py +500 -0
  109. neuro_cortex_memory-2.0.0/mcp_server/errors/__init__.py +49 -0
  110. neuro_cortex_memory-2.0.0/mcp_server/handlers/__init__.py +0 -0
  111. neuro_cortex_memory-2.0.0/mcp_server/handlers/add_rule.py +125 -0
  112. neuro_cortex_memory-2.0.0/mcp_server/handlers/anchor.py +109 -0
  113. neuro_cortex_memory-2.0.0/mcp_server/handlers/assess_coverage.py +263 -0
  114. neuro_cortex_memory-2.0.0/mcp_server/handlers/backfill_memories.py +366 -0
  115. neuro_cortex_memory-2.0.0/mcp_server/handlers/checkpoint.py +164 -0
  116. neuro_cortex_memory-2.0.0/mcp_server/handlers/consolidate.py +847 -0
  117. neuro_cortex_memory-2.0.0/mcp_server/handlers/create_trigger.py +103 -0
  118. neuro_cortex_memory-2.0.0/mcp_server/handlers/detect_domain.py +28 -0
  119. neuro_cortex_memory-2.0.0/mcp_server/handlers/detect_gaps.py +219 -0
  120. neuro_cortex_memory-2.0.0/mcp_server/handlers/drill_down.py +130 -0
  121. neuro_cortex_memory-2.0.0/mcp_server/handlers/explore_features.py +176 -0
  122. neuro_cortex_memory-2.0.0/mcp_server/handlers/forget.py +90 -0
  123. neuro_cortex_memory-2.0.0/mcp_server/handlers/get_causal_chain.py +200 -0
  124. neuro_cortex_memory-2.0.0/mcp_server/handlers/get_methodology_graph.py +23 -0
  125. neuro_cortex_memory-2.0.0/mcp_server/handlers/get_project_story.py +234 -0
  126. neuro_cortex_memory-2.0.0/mcp_server/handlers/get_rules.py +89 -0
  127. neuro_cortex_memory-2.0.0/mcp_server/handlers/import_sessions.py +248 -0
  128. neuro_cortex_memory-2.0.0/mcp_server/handlers/list_domains.py +44 -0
  129. neuro_cortex_memory-2.0.0/mcp_server/handlers/memory_stats.py +60 -0
  130. neuro_cortex_memory-2.0.0/mcp_server/handlers/narrative.py +66 -0
  131. neuro_cortex_memory-2.0.0/mcp_server/handlers/navigate_memory.py +138 -0
  132. neuro_cortex_memory-2.0.0/mcp_server/handlers/open_memory_dashboard.py +45 -0
  133. neuro_cortex_memory-2.0.0/mcp_server/handlers/open_visualization.py +53 -0
  134. neuro_cortex_memory-2.0.0/mcp_server/handlers/query_methodology.py +218 -0
  135. neuro_cortex_memory-2.0.0/mcp_server/handlers/rate_memory.py +82 -0
  136. neuro_cortex_memory-2.0.0/mcp_server/handlers/rebuild_profiles.py +71 -0
  137. neuro_cortex_memory-2.0.0/mcp_server/handlers/recall.py +460 -0
  138. neuro_cortex_memory-2.0.0/mcp_server/handlers/recall_hierarchical.py +137 -0
  139. neuro_cortex_memory-2.0.0/mcp_server/handlers/record_session_end.py +218 -0
  140. neuro_cortex_memory-2.0.0/mcp_server/handlers/remember.py +560 -0
  141. neuro_cortex_memory-2.0.0/mcp_server/handlers/run_pipeline.py +851 -0
  142. neuro_cortex_memory-2.0.0/mcp_server/handlers/seed_project.py +382 -0
  143. neuro_cortex_memory-2.0.0/mcp_server/handlers/sync_instructions.py +194 -0
  144. neuro_cortex_memory-2.0.0/mcp_server/handlers/validate_memory.py +159 -0
  145. neuro_cortex_memory-2.0.0/mcp_server/hooks/__init__.py +0 -0
  146. neuro_cortex_memory-2.0.0/mcp_server/hooks/compaction_checkpoint.py +93 -0
  147. neuro_cortex_memory-2.0.0/mcp_server/hooks/post_tool_capture.py +217 -0
  148. neuro_cortex_memory-2.0.0/mcp_server/hooks/session_lifecycle.py +191 -0
  149. neuro_cortex_memory-2.0.0/mcp_server/hooks/session_start.py +247 -0
  150. neuro_cortex_memory-2.0.0/mcp_server/infrastructure/__init__.py +0 -0
  151. neuro_cortex_memory-2.0.0/mcp_server/infrastructure/brain_index_store.py +20 -0
  152. neuro_cortex_memory-2.0.0/mcp_server/infrastructure/config.py +16 -0
  153. neuro_cortex_memory-2.0.0/mcp_server/infrastructure/embedding_engine.py +164 -0
  154. neuro_cortex_memory-2.0.0/mcp_server/infrastructure/file_io.py +69 -0
  155. neuro_cortex_memory-2.0.0/mcp_server/infrastructure/mcp_client.py +271 -0
  156. neuro_cortex_memory-2.0.0/mcp_server/infrastructure/mcp_client_pool.py +93 -0
  157. neuro_cortex_memory-2.0.0/mcp_server/infrastructure/memory_config.py +116 -0
  158. neuro_cortex_memory-2.0.0/mcp_server/infrastructure/memory_store.py +1386 -0
  159. neuro_cortex_memory-2.0.0/mcp_server/infrastructure/profile_store.py +27 -0
  160. neuro_cortex_memory-2.0.0/mcp_server/infrastructure/scanner.py +269 -0
  161. neuro_cortex_memory-2.0.0/mcp_server/infrastructure/session_store.py +20 -0
  162. neuro_cortex_memory-2.0.0/mcp_server/server/__init__.py +0 -0
  163. neuro_cortex_memory-2.0.0/mcp_server/server/http_server.py +592 -0
  164. neuro_cortex_memory-2.0.0/mcp_server/shared/__init__.py +1 -0
  165. neuro_cortex_memory-2.0.0/mcp_server/shared/categorizer.py +94 -0
  166. neuro_cortex_memory-2.0.0/mcp_server/shared/hash.py +19 -0
  167. neuro_cortex_memory-2.0.0/mcp_server/shared/linear_algebra.py +98 -0
  168. neuro_cortex_memory-2.0.0/mcp_server/shared/memory_types.py +249 -0
  169. neuro_cortex_memory-2.0.0/mcp_server/shared/project_ids.py +44 -0
  170. neuro_cortex_memory-2.0.0/mcp_server/shared/similarity.py +18 -0
  171. neuro_cortex_memory-2.0.0/mcp_server/shared/sparse.py +75 -0
  172. neuro_cortex_memory-2.0.0/mcp_server/shared/text.py +55 -0
  173. neuro_cortex_memory-2.0.0/mcp_server/shared/types.py +363 -0
  174. neuro_cortex_memory-2.0.0/mcp_server/shared/yaml_parser.py +40 -0
  175. neuro_cortex_memory-2.0.0/mcp_server/validation/__init__.py +1 -0
  176. neuro_cortex_memory-2.0.0/mcp_server/validation/schemas.py +147 -0
  177. neuro_cortex_memory-2.0.0/package.json +19 -0
  178. neuro_cortex_memory-2.0.0/pyproject.toml +54 -0
  179. neuro_cortex_memory-2.0.0/scripts/launch-medical-graph.js +64 -0
  180. neuro_cortex_memory-2.0.0/scripts/medical-graph-builder.js +361 -0
  181. neuro_cortex_memory-2.0.0/scripts/payment-graph-builder.js +306 -0
  182. neuro_cortex_memory-2.0.0/scripts/run-tv-pipeline.js +57 -0
  183. neuro_cortex_memory-2.0.0/scripts/setup.sh +83 -0
  184. neuro_cortex_memory-2.0.0/skills/methodology-agent/SKILL.md +57 -0
  185. neuro_cortex_memory-2.0.0/tasks/3-tier-dispatch.md +62 -0
  186. neuro_cortex_memory-2.0.0/tasks/benchmark-improvement-plan.md +95 -0
  187. neuro_cortex_memory-2.0.0/tasks/benchmark-results.md +229 -0
  188. neuro_cortex_memory-2.0.0/tasks/lessons.md +17 -0
  189. neuro_cortex_memory-2.0.0/tasks/longmemeval-results.md +99 -0
  190. neuro_cortex_memory-2.0.0/tasks/neuro-evolution-plan.md +475 -0
  191. neuro_cortex_memory-2.0.0/tasks/refactoring-plan.md +53 -0
  192. neuro_cortex_memory-2.0.0/tasks/todo.md +186 -0
  193. neuro_cortex_memory-2.0.0/tests/core/attribution-tracer.test.js +176 -0
  194. neuro_cortex_memory-2.0.0/tests/core/behavioral-crosscoder.test.js +144 -0
  195. neuro_cortex_memory-2.0.0/tests/core/blindspot-detector.test.js +204 -0
  196. neuro_cortex_memory-2.0.0/tests/core/bridge-finder.test.js +248 -0
  197. neuro_cortex_memory-2.0.0/tests/core/context-generator.test.js +159 -0
  198. neuro_cortex_memory-2.0.0/tests/core/domain-detector.test.js +218 -0
  199. neuro_cortex_memory-2.0.0/tests/core/graph-builder.test.js +268 -0
  200. neuro_cortex_memory-2.0.0/tests/core/pattern-extractor.test.js +280 -0
  201. neuro_cortex_memory-2.0.0/tests/core/persona-vector.test.js +233 -0
  202. neuro_cortex_memory-2.0.0/tests/core/profile-builder.test.js +368 -0
  203. neuro_cortex_memory-2.0.0/tests/core/sparse-dictionary.test.js +235 -0
  204. neuro_cortex_memory-2.0.0/tests/core/style-classifier.test.js +205 -0
  205. neuro_cortex_memory-2.0.0/tests/errors/index.test.js +152 -0
  206. neuro_cortex_memory-2.0.0/tests/fixtures/brain-index.json +7 -0
  207. neuro_cortex_memory-2.0.0/tests/fixtures/conversations/sample.jsonl +5 -0
  208. neuro_cortex_memory-2.0.0/tests/fixtures/memories/sample.md +11 -0
  209. neuro_cortex_memory-2.0.0/tests/fixtures/profiles.json +45 -0
  210. neuro_cortex_memory-2.0.0/tests/handlers/detect-domain.test.js +25 -0
  211. neuro_cortex_memory-2.0.0/tests/handlers/explore-features.test.js +103 -0
  212. neuro_cortex_memory-2.0.0/tests/handlers/get-methodology-graph.test.js +26 -0
  213. neuro_cortex_memory-2.0.0/tests/handlers/list-domains.test.js +34 -0
  214. neuro_cortex_memory-2.0.0/tests/handlers/open-visualization.test.js +14 -0
  215. neuro_cortex_memory-2.0.0/tests/handlers/query-methodology.test.js +43 -0
  216. neuro_cortex_memory-2.0.0/tests/handlers/rebuild-profiles.test.js +31 -0
  217. neuro_cortex_memory-2.0.0/tests/handlers/record-session-end.test.js +41 -0
  218. neuro_cortex_memory-2.0.0/tests/infrastructure/file-io.test.js +140 -0
  219. neuro_cortex_memory-2.0.0/tests/infrastructure/mcp-client-pool.test.js +47 -0
  220. neuro_cortex_memory-2.0.0/tests/infrastructure/mcp-client.test.js +140 -0
  221. neuro_cortex_memory-2.0.0/tests/infrastructure/profile-store.test.js +34 -0
  222. neuro_cortex_memory-2.0.0/tests/infrastructure/scanner.test.js +110 -0
  223. neuro_cortex_memory-2.0.0/tests/infrastructure/session-store.test.js +25 -0
  224. neuro_cortex_memory-2.0.0/tests/integration/mcp-roundtrip.test.js +112 -0
  225. neuro_cortex_memory-2.0.0/tests/server/mcp-router.test.js +203 -0
  226. neuro_cortex_memory-2.0.0/tests/server/stdio.test.js +11 -0
  227. neuro_cortex_memory-2.0.0/tests/shared/categorizer.test.js +114 -0
  228. neuro_cortex_memory-2.0.0/tests/shared/hash.test.js +62 -0
  229. neuro_cortex_memory-2.0.0/tests/shared/linear-algebra.test.js +174 -0
  230. neuro_cortex_memory-2.0.0/tests/shared/project-ids.test.js +91 -0
  231. neuro_cortex_memory-2.0.0/tests/shared/similarity.test.js +64 -0
  232. neuro_cortex_memory-2.0.0/tests/shared/sparse.test.js +164 -0
  233. neuro_cortex_memory-2.0.0/tests/shared/text.test.js +136 -0
  234. neuro_cortex_memory-2.0.0/tests/shared/yaml.test.js +73 -0
  235. neuro_cortex_memory-2.0.0/tests/validation/schemas.test.js +132 -0
  236. neuro_cortex_memory-2.0.0/tests_py/__init__.py +0 -0
  237. neuro_cortex_memory-2.0.0/tests_py/benchmarks/__init__.py +0 -0
  238. neuro_cortex_memory-2.0.0/tests_py/benchmarks/benchmark_harness.py +1309 -0
  239. neuro_cortex_memory-2.0.0/tests_py/core/__init__.py +0 -0
  240. neuro_cortex_memory-2.0.0/tests_py/core/test_ablation.py +120 -0
  241. neuro_cortex_memory-2.0.0/tests_py/core/test_attribution_tracer.py +152 -0
  242. neuro_cortex_memory-2.0.0/tests_py/core/test_behavioral_crosscoder.py +123 -0
  243. neuro_cortex_memory-2.0.0/tests_py/core/test_blindspot_detector.py +144 -0
  244. neuro_cortex_memory-2.0.0/tests_py/core/test_bridge_finder.py +209 -0
  245. neuro_cortex_memory-2.0.0/tests_py/core/test_cascade.py +164 -0
  246. neuro_cortex_memory-2.0.0/tests_py/core/test_causal_graph.py +306 -0
  247. neuro_cortex_memory-2.0.0/tests_py/core/test_compression.py +137 -0
  248. neuro_cortex_memory-2.0.0/tests_py/core/test_consolidation_engine.py +168 -0
  249. neuro_cortex_memory-2.0.0/tests_py/core/test_context_generator.py +231 -0
  250. neuro_cortex_memory-2.0.0/tests_py/core/test_coupled_neuromodulation.py +147 -0
  251. neuro_cortex_memory-2.0.0/tests_py/core/test_curation.py +178 -0
  252. neuro_cortex_memory-2.0.0/tests_py/core/test_decay_cycle.py +98 -0
  253. neuro_cortex_memory-2.0.0/tests_py/core/test_dendritic_clusters.py +152 -0
  254. neuro_cortex_memory-2.0.0/tests_py/core/test_domain_detector.py +176 -0
  255. neuro_cortex_memory-2.0.0/tests_py/core/test_dual_store_cls.py +208 -0
  256. neuro_cortex_memory-2.0.0/tests_py/core/test_emergence_tracker.py +106 -0
  257. neuro_cortex_memory-2.0.0/tests_py/core/test_emotional_tagging.py +153 -0
  258. neuro_cortex_memory-2.0.0/tests_py/core/test_engram.py +134 -0
  259. neuro_cortex_memory-2.0.0/tests_py/core/test_fractal.py +226 -0
  260. neuro_cortex_memory-2.0.0/tests_py/core/test_graph_builder.py +200 -0
  261. neuro_cortex_memory-2.0.0/tests_py/core/test_hierarchical_predictive_coding.py +202 -0
  262. neuro_cortex_memory-2.0.0/tests_py/core/test_homeostatic_plasticity.py +130 -0
  263. neuro_cortex_memory-2.0.0/tests_py/core/test_hopfield.py +158 -0
  264. neuro_cortex_memory-2.0.0/tests_py/core/test_interference.py +159 -0
  265. neuro_cortex_memory-2.0.0/tests_py/core/test_knowledge_graph.py +121 -0
  266. neuro_cortex_memory-2.0.0/tests_py/core/test_memory_rules.py +196 -0
  267. neuro_cortex_memory-2.0.0/tests_py/core/test_metacognition.py +303 -0
  268. neuro_cortex_memory-2.0.0/tests_py/core/test_microglial_pruning.py +116 -0
  269. neuro_cortex_memory-2.0.0/tests_py/core/test_narrative.py +166 -0
  270. neuro_cortex_memory-2.0.0/tests_py/core/test_oscillatory_clock.py +222 -0
  271. neuro_cortex_memory-2.0.0/tests_py/core/test_pattern_extractor.py +245 -0
  272. neuro_cortex_memory-2.0.0/tests_py/core/test_pattern_separation.py +147 -0
  273. neuro_cortex_memory-2.0.0/tests_py/core/test_persona_vector.py +199 -0
  274. neuro_cortex_memory-2.0.0/tests_py/core/test_precision_weighted_errors.py +180 -0
  275. neuro_cortex_memory-2.0.0/tests_py/core/test_profile_builder.py +304 -0
  276. neuro_cortex_memory-2.0.0/tests_py/core/test_prospective.py +105 -0
  277. neuro_cortex_memory-2.0.0/tests_py/core/test_query_router.py +218 -0
  278. neuro_cortex_memory-2.0.0/tests_py/core/test_reconsolidation.py +151 -0
  279. neuro_cortex_memory-2.0.0/tests_py/core/test_replay.py +104 -0
  280. neuro_cortex_memory-2.0.0/tests_py/core/test_schema_engine.py +196 -0
  281. neuro_cortex_memory-2.0.0/tests_py/core/test_session_critique.py +233 -0
  282. neuro_cortex_memory-2.0.0/tests_py/core/test_session_extractor.py +273 -0
  283. neuro_cortex_memory-2.0.0/tests_py/core/test_sparse_dictionary.py +198 -0
  284. neuro_cortex_memory-2.0.0/tests_py/core/test_spreading_activation.py +195 -0
  285. neuro_cortex_memory-2.0.0/tests_py/core/test_stochastic_transmission.py +288 -0
  286. neuro_cortex_memory-2.0.0/tests_py/core/test_style_classifier.py +246 -0
  287. neuro_cortex_memory-2.0.0/tests_py/core/test_swr_replay.py +296 -0
  288. neuro_cortex_memory-2.0.0/tests_py/core/test_synaptic_plasticity.py +148 -0
  289. neuro_cortex_memory-2.0.0/tests_py/core/test_synaptic_tagging.py +201 -0
  290. neuro_cortex_memory-2.0.0/tests_py/core/test_thermodynamics.py +190 -0
  291. neuro_cortex_memory-2.0.0/tests_py/core/test_tripartite_synapse.py +170 -0
  292. neuro_cortex_memory-2.0.0/tests_py/core/test_two_stage_model.py +157 -0
  293. neuro_cortex_memory-2.0.0/tests_py/errors/__init__.py +0 -0
  294. neuro_cortex_memory-2.0.0/tests_py/errors/test_errors.py +87 -0
  295. neuro_cortex_memory-2.0.0/tests_py/handlers/__init__.py +0 -0
  296. neuro_cortex_memory-2.0.0/tests_py/handlers/test_checkpoint.py +133 -0
  297. neuro_cortex_memory-2.0.0/tests_py/handlers/test_consolidate.py +150 -0
  298. neuro_cortex_memory-2.0.0/tests_py/handlers/test_detect_domain.py +20 -0
  299. neuro_cortex_memory-2.0.0/tests_py/handlers/test_explore_features.py +262 -0
  300. neuro_cortex_memory-2.0.0/tests_py/handlers/test_get_methodology_graph.py +23 -0
  301. neuro_cortex_memory-2.0.0/tests_py/handlers/test_import_sessions.py +206 -0
  302. neuro_cortex_memory-2.0.0/tests_py/handlers/test_list_domains.py +28 -0
  303. neuro_cortex_memory-2.0.0/tests_py/handlers/test_memory_stats.py +76 -0
  304. neuro_cortex_memory-2.0.0/tests_py/handlers/test_open_visualization.py +76 -0
  305. neuro_cortex_memory-2.0.0/tests_py/handlers/test_query_methodology.py +43 -0
  306. neuro_cortex_memory-2.0.0/tests_py/handlers/test_rebuild_profiles.py +142 -0
  307. neuro_cortex_memory-2.0.0/tests_py/handlers/test_recall.py +136 -0
  308. neuro_cortex_memory-2.0.0/tests_py/handlers/test_recall_enhancements.py +117 -0
  309. neuro_cortex_memory-2.0.0/tests_py/handlers/test_record_session_end.py +183 -0
  310. neuro_cortex_memory-2.0.0/tests_py/handlers/test_registry.py +29 -0
  311. neuro_cortex_memory-2.0.0/tests_py/handlers/test_remember.py +131 -0
  312. neuro_cortex_memory-2.0.0/tests_py/handlers/test_run_pipeline.py +1380 -0
  313. neuro_cortex_memory-2.0.0/tests_py/hooks/__init__.py +0 -0
  314. neuro_cortex_memory-2.0.0/tests_py/hooks/test_session_lifecycle.py +188 -0
  315. neuro_cortex_memory-2.0.0/tests_py/infrastructure/__init__.py +0 -0
  316. neuro_cortex_memory-2.0.0/tests_py/infrastructure/test_brain_index_store.py +11 -0
  317. neuro_cortex_memory-2.0.0/tests_py/infrastructure/test_config.py +36 -0
  318. neuro_cortex_memory-2.0.0/tests_py/infrastructure/test_embedding_engine.py +106 -0
  319. neuro_cortex_memory-2.0.0/tests_py/infrastructure/test_file_io.py +78 -0
  320. neuro_cortex_memory-2.0.0/tests_py/infrastructure/test_mcp_client.py +1065 -0
  321. neuro_cortex_memory-2.0.0/tests_py/infrastructure/test_mcp_client_pool.py +183 -0
  322. neuro_cortex_memory-2.0.0/tests_py/infrastructure/test_memory_store.py +332 -0
  323. neuro_cortex_memory-2.0.0/tests_py/infrastructure/test_profile_store.py +32 -0
  324. neuro_cortex_memory-2.0.0/tests_py/infrastructure/test_scanner.py +73 -0
  325. neuro_cortex_memory-2.0.0/tests_py/infrastructure/test_session_store.py +20 -0
  326. neuro_cortex_memory-2.0.0/tests_py/integration/__init__.py +0 -0
  327. neuro_cortex_memory-2.0.0/tests_py/integration/test_memory_lifecycle.py +255 -0
  328. neuro_cortex_memory-2.0.0/tests_py/server/__init__.py +0 -0
  329. neuro_cortex_memory-2.0.0/tests_py/server/test_http_server.py +418 -0
  330. neuro_cortex_memory-2.0.0/tests_py/shared/__init__.py +0 -0
  331. neuro_cortex_memory-2.0.0/tests_py/shared/test_categorizer.py +141 -0
  332. neuro_cortex_memory-2.0.0/tests_py/shared/test_hash.py +46 -0
  333. neuro_cortex_memory-2.0.0/tests_py/shared/test_linear_algebra.py +142 -0
  334. neuro_cortex_memory-2.0.0/tests_py/shared/test_project_ids.py +61 -0
  335. neuro_cortex_memory-2.0.0/tests_py/shared/test_similarity.py +46 -0
  336. neuro_cortex_memory-2.0.0/tests_py/shared/test_sparse.py +128 -0
  337. neuro_cortex_memory-2.0.0/tests_py/shared/test_text.py +107 -0
  338. neuro_cortex_memory-2.0.0/tests_py/shared/test_types.py +185 -0
  339. neuro_cortex_memory-2.0.0/tests_py/shared/test_yaml_parser.py +58 -0
  340. neuro_cortex_memory-2.0.0/tests_py/test_main.py +83 -0
  341. neuro_cortex_memory-2.0.0/tests_py/validation/__init__.py +0 -0
  342. neuro_cortex_memory-2.0.0/tests_py/validation/test_schemas.py +80 -0
  343. neuro_cortex_memory-2.0.0/ui/dashboard/DESIGN.md +296 -0
  344. neuro_cortex_memory-2.0.0/ui/dashboard/js/analytics.js +195 -0
  345. neuro_cortex_memory-2.0.0/ui/dashboard/js/categories.js +89 -0
  346. neuro_cortex_memory-2.0.0/ui/dashboard/js/config.js +63 -0
  347. neuro_cortex_memory-2.0.0/ui/dashboard/js/controls.js +67 -0
  348. neuro_cortex_memory-2.0.0/ui/dashboard/js/edges.js +365 -0
  349. neuro_cortex_memory-2.0.0/ui/dashboard/js/effects.js +52 -0
  350. neuro_cortex_memory-2.0.0/ui/dashboard/js/graph.js +589 -0
  351. neuro_cortex_memory-2.0.0/ui/dashboard/js/interaction.js +207 -0
  352. neuro_cortex_memory-2.0.0/ui/dashboard/js/nodes.js +130 -0
  353. neuro_cortex_memory-2.0.0/ui/dashboard/js/polling.js +45 -0
  354. neuro_cortex_memory-2.0.0/ui/dashboard/js/scene.js +208 -0
  355. neuro_cortex_memory-2.0.0/ui/dashboard/js/state.js +34 -0
  356. neuro_cortex_memory-2.0.0/ui/dashboard/js/stats.js +31 -0
  357. neuro_cortex_memory-2.0.0/ui/dashboard/js/timeline.js +91 -0
  358. neuro_cortex_memory-2.0.0/ui/dashboard/theme.css +527 -0
  359. neuro_cortex_memory-2.0.0/ui/memory-dashboard.html +2060 -0
  360. neuro_cortex_memory-2.0.0/ui/methodology-viz.html +1031 -0
  361. neuro_cortex_memory-2.0.0/ui/payment-viz.html +759 -0
  362. neuro_cortex_memory-2.0.0/ui/unified/js/clusters.js +130 -0
  363. neuro_cortex_memory-2.0.0/ui/unified/js/config.js +72 -0
  364. neuro_cortex_memory-2.0.0/ui/unified/js/controls.js +135 -0
  365. neuro_cortex_memory-2.0.0/ui/unified/js/edges.js +349 -0
  366. neuro_cortex_memory-2.0.0/ui/unified/js/effects.js +43 -0
  367. neuro_cortex_memory-2.0.0/ui/unified/js/graph.js +374 -0
  368. neuro_cortex_memory-2.0.0/ui/unified/js/interaction.js +357 -0
  369. neuro_cortex_memory-2.0.0/ui/unified/js/layout.js +250 -0
  370. neuro_cortex_memory-2.0.0/ui/unified/js/monitor.js +300 -0
  371. neuro_cortex_memory-2.0.0/ui/unified/js/nodes.js +151 -0
  372. neuro_cortex_memory-2.0.0/ui/unified/js/polling.js +186 -0
  373. neuro_cortex_memory-2.0.0/ui/unified/js/scene.js +191 -0
  374. neuro_cortex_memory-2.0.0/ui/unified/js/state.js +40 -0
  375. neuro_cortex_memory-2.0.0/ui/unified/js/zoom.js +53 -0
  376. neuro_cortex_memory-2.0.0/ui/unified/theme.css +326 -0
  377. neuro_cortex_memory-2.0.0/ui/unified-viz.html +273 -0
@@ -0,0 +1,28 @@
1
+ {
2
+ "name": "jarvis-plugins",
3
+ "owner": {
4
+ "name": "Clement Deust",
5
+ "email": "admin@ai-architect.tools"
6
+ },
7
+ "metadata": {
8
+ "description": "Persistent memory and cognitive profiling plugins for Claude Code",
9
+ "version": "2.0.0"
10
+ },
11
+ "plugins": [
12
+ {
13
+ "name": "jarvis",
14
+ "source": "./",
15
+ "description": "Persistent memory and cognitive profiling for Claude Code — thermodynamic memory, intent-aware retrieval, causal graphs, and cognitive profiling that learns how you work",
16
+ "version": "2.0.0",
17
+ "author": {
18
+ "name": "Clement Deust",
19
+ "email": "admin@ai-architect.tools"
20
+ },
21
+ "homepage": "https://github.com/cdeust/jarvis",
22
+ "repository": "https://github.com/cdeust/jarvis",
23
+ "license": "MIT",
24
+ "keywords": ["memory", "cognitive-profiling", "mcp", "claude-code", "jarvis"],
25
+ "category": "productivity"
26
+ }
27
+ ]
28
+ }
@@ -0,0 +1,67 @@
1
+ {
2
+ "name": "jarvis",
3
+ "description": "Persistent memory and cognitive profiling for Claude Code — thermodynamic memory with heat/decay, intent-aware retrieval, biological plasticity, and cognitive profiling that learns how you work",
4
+ "version": "2.1.0",
5
+ "author": {
6
+ "name": "Clement Deust",
7
+ "email": "admin@ai-architect.tools"
8
+ },
9
+ "homepage": "https://github.com/cdeust/jarvis",
10
+ "repository": "https://github.com/cdeust/jarvis",
11
+ "license": "MIT",
12
+ "keywords": ["memory", "cognitive-profiling", "mcp", "claude-code", "neuroscience"],
13
+ "mcpServers": {
14
+ "jarvis": {
15
+ "command": "python3",
16
+ "args": ["-m", "mcp_server"],
17
+ "cwd": "${CLAUDE_PLUGIN_ROOT}"
18
+ }
19
+ },
20
+ "hooks": {
21
+ "SessionEnd": [
22
+ {
23
+ "hooks": [
24
+ {
25
+ "type": "command",
26
+ "command": "python3 -m mcp_server.hooks.session_lifecycle",
27
+ "cwd": "${CLAUDE_PLUGIN_ROOT}"
28
+ }
29
+ ]
30
+ }
31
+ ],
32
+ "SessionStart": [
33
+ {
34
+ "hooks": [
35
+ {
36
+ "type": "command",
37
+ "command": "python3 -m mcp_server.hooks.session_start",
38
+ "cwd": "${CLAUDE_PLUGIN_ROOT}"
39
+ }
40
+ ]
41
+ }
42
+ ],
43
+ "PostToolUse": [
44
+ {
45
+ "hooks": [
46
+ {
47
+ "type": "command",
48
+ "command": "python3 -m mcp_server.hooks.post_tool_capture",
49
+ "cwd": "${CLAUDE_PLUGIN_ROOT}"
50
+ }
51
+ ]
52
+ }
53
+ ],
54
+ "Notification": [
55
+ {
56
+ "matcher": "compaction",
57
+ "hooks": [
58
+ {
59
+ "type": "command",
60
+ "command": "python3 -m mcp_server.hooks.compaction_checkpoint",
61
+ "cwd": "${CLAUDE_PLUGIN_ROOT}"
62
+ }
63
+ ]
64
+ }
65
+ ]
66
+ }
67
+ }
@@ -0,0 +1,116 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ pull_request:
7
+ branches: [main]
8
+
9
+ concurrency:
10
+ group: ${{ github.workflow }}-${{ github.ref }}
11
+ cancel-in-progress: true
12
+
13
+ jobs:
14
+ test:
15
+ name: Test (Python ${{ matrix.python-version }})
16
+ runs-on: ubuntu-latest
17
+ strategy:
18
+ fail-fast: false
19
+ matrix:
20
+ python-version: ["3.10", "3.11", "3.12", "3.13"]
21
+
22
+ steps:
23
+ - uses: actions/checkout@v4
24
+
25
+ - name: Set up Python ${{ matrix.python-version }}
26
+ uses: actions/setup-python@v5
27
+ with:
28
+ python-version: ${{ matrix.python-version }}
29
+
30
+ - name: Cache pip
31
+ uses: actions/cache@v4
32
+ with:
33
+ path: ~/.cache/pip
34
+ key: ${{ runner.os }}-pip-${{ matrix.python-version }}-${{ hashFiles('pyproject.toml') }}
35
+ restore-keys: |
36
+ ${{ runner.os }}-pip-${{ matrix.python-version }}-
37
+
38
+ - name: Install dependencies
39
+ run: pip install -e ".[dev]"
40
+
41
+ - name: Run tests
42
+ run: pytest --tb=short -q
43
+
44
+ - name: Run tests with coverage
45
+ if: matrix.python-version == '3.12'
46
+ run: pytest --cov=mcp_server --cov-report=xml --cov-report=term-missing
47
+
48
+ - name: Upload coverage
49
+ if: matrix.python-version == '3.12'
50
+ uses: actions/upload-artifact@v4
51
+ with:
52
+ name: coverage-report
53
+ path: coverage.xml
54
+
55
+ lint:
56
+ name: Lint
57
+ runs-on: ubuntu-latest
58
+ steps:
59
+ - uses: actions/checkout@v4
60
+
61
+ - name: Set up Python
62
+ uses: actions/setup-python@v5
63
+ with:
64
+ python-version: "3.12"
65
+
66
+ - name: Install ruff
67
+ run: pip install ruff
68
+
69
+ - name: Check formatting
70
+ run: ruff format --check .
71
+
72
+ - name: Check linting
73
+ run: ruff check .
74
+
75
+ typecheck:
76
+ name: Type Check
77
+ runs-on: ubuntu-latest
78
+ steps:
79
+ - uses: actions/checkout@v4
80
+
81
+ - name: Set up Python
82
+ uses: actions/setup-python@v5
83
+ with:
84
+ python-version: "3.12"
85
+
86
+ - name: Install dependencies
87
+ run: |
88
+ pip install -e ".[dev]"
89
+ pip install pyright
90
+
91
+ - name: Run type checker
92
+ run: pyright mcp_server/
93
+ continue-on-error: true
94
+
95
+ build:
96
+ name: Build Package
97
+ runs-on: ubuntu-latest
98
+ steps:
99
+ - uses: actions/checkout@v4
100
+
101
+ - name: Set up Python
102
+ uses: actions/setup-python@v5
103
+ with:
104
+ python-version: "3.12"
105
+
106
+ - name: Install build tools
107
+ run: pip install build
108
+
109
+ - name: Build sdist and wheel
110
+ run: python -m build
111
+
112
+ - name: Upload build artifacts
113
+ uses: actions/upload-artifact@v4
114
+ with:
115
+ name: dist
116
+ path: dist/
@@ -0,0 +1,106 @@
1
+ name: Release
2
+
3
+ on:
4
+ push:
5
+ tags:
6
+ - "v*"
7
+
8
+ permissions:
9
+ contents: write
10
+ id-token: write
11
+
12
+ jobs:
13
+ test:
14
+ name: Test before release
15
+ runs-on: ubuntu-latest
16
+ steps:
17
+ - uses: actions/checkout@v4
18
+
19
+ - name: Set up Python
20
+ uses: actions/setup-python@v5
21
+ with:
22
+ python-version: "3.12"
23
+
24
+ - name: Install dependencies
25
+ run: pip install -e ".[dev]"
26
+
27
+ - name: Run tests
28
+ run: pytest --tb=short -q
29
+
30
+ build:
31
+ name: Build
32
+ needs: test
33
+ runs-on: ubuntu-latest
34
+ steps:
35
+ - uses: actions/checkout@v4
36
+
37
+ - name: Set up Python
38
+ uses: actions/setup-python@v5
39
+ with:
40
+ python-version: "3.12"
41
+
42
+ - name: Install build tools
43
+ run: pip install build
44
+
45
+ - name: Build sdist and wheel
46
+ run: python -m build
47
+
48
+ - name: Upload build artifacts
49
+ uses: actions/upload-artifact@v4
50
+ with:
51
+ name: dist
52
+ path: dist/
53
+
54
+ publish-pypi:
55
+ name: Publish to PyPI
56
+ needs: build
57
+ runs-on: ubuntu-latest
58
+ environment:
59
+ name: pypi
60
+ url: https://pypi.org/p/neuro-cortex-memory
61
+ steps:
62
+ - name: Download build artifacts
63
+ uses: actions/download-artifact@v4
64
+ with:
65
+ name: dist
66
+ path: dist/
67
+
68
+ - name: Publish to PyPI
69
+ uses: pypa/gh-action-pypi-publish@release/v1
70
+ with:
71
+ verbose: true
72
+
73
+ github-release:
74
+ name: GitHub Release
75
+ needs: build
76
+ runs-on: ubuntu-latest
77
+ steps:
78
+ - uses: actions/checkout@v4
79
+ with:
80
+ fetch-depth: 0
81
+
82
+ - name: Download build artifacts
83
+ uses: actions/download-artifact@v4
84
+ with:
85
+ name: dist
86
+ path: dist/
87
+
88
+ - name: Generate changelog
89
+ id: changelog
90
+ run: |
91
+ # Get previous tag
92
+ PREV_TAG=$(git tag --sort=-version:refname | head -2 | tail -1)
93
+ if [ -z "$PREV_TAG" ]; then
94
+ CHANGELOG=$(git log --pretty=format:"- %s" HEAD)
95
+ else
96
+ CHANGELOG=$(git log --pretty=format:"- %s" ${PREV_TAG}..HEAD)
97
+ fi
98
+ # Write to file to avoid escaping issues
99
+ echo "$CHANGELOG" > changelog.txt
100
+
101
+ - name: Create GitHub Release
102
+ uses: softprops/action-gh-release@v2
103
+ with:
104
+ body_path: changelog.txt
105
+ files: dist/*
106
+ generate_release_notes: true
@@ -0,0 +1,16 @@
1
+ __pycache__/
2
+ *.pyc
3
+ *.pyo
4
+ .coverage
5
+ htmlcov/
6
+ *.egg-info/
7
+ dist/
8
+ build/
9
+ .pytest_cache/
10
+ .python-version
11
+ .DS_Store
12
+ mcp-server_old/
13
+
14
+ # Large benchmark datasets (download instructions in README)
15
+ benchmarks/longmemeval/longmemeval_s.json
16
+ benchmarks/longmemeval/longmemeval_oracle.json
@@ -0,0 +1,9 @@
1
+ {
2
+ "mcpServers": {
3
+ "methodology-agent": {
4
+ "command": "python3",
5
+ "args": ["-m", "mcp_server"],
6
+ "cwd": "/Users/cdeust/Developments/jarvis"
7
+ }
8
+ }
9
+ }
@@ -0,0 +1,306 @@
1
+ # JARVIS — Methodology Agent
2
+
3
+ Persistent memory and cognitive profiling MCP server for Claude Code. Python 3.10+ with FastMCP, Pydantic, and numpy.
4
+
5
+ ## Problem Statement
6
+
7
+ Claude Code sessions generate rich behavioral data (tool usage, session duration, first messages, keyword patterns) but this data is lost between sessions. JARVIS mines this history to build a cognitive profile per domain and provides a thermodynamic memory system with heat/decay, predictive coding write gates, causal graphs, and intent-aware retrieval.
8
+
9
+ ## Code Quality Rules
10
+
11
+ - **300 lines max** per file — split into focused modules when exceeded
12
+ - **40 lines max** per method — extract helpers for readability
13
+ - **Clean Architecture** — inner layers never import outer layers
14
+ - **SOLID principles** — single responsibility, dependency inversion
15
+ - **Reverse dependency injection** — core defines interfaces, infrastructure implements
16
+ - **Factory injection** — handlers compose core + infrastructure via factories
17
+ - **No dead code** — remove unused functions, backward-compat shims, commented-out code
18
+ - **No unwired code** — if it's built, it must be called somewhere
19
+
20
+ See `tasks/refactoring-plan.md` for the file-by-file split plan (31 files over 300 lines).
21
+
22
+ ## Research Methodology
23
+
24
+ When implementing neuroscience-inspired mechanisms, always consult primary research papers before coding. Use [arxivisual](https://arxivisual.com) to explore and understand referenced papers visually — it provides detailed visual explanations of arxiv papers. Paper references are listed in `tasks/neuro-evolution-plan.md` and `docs/adr/`. The implementation should follow the computational model described in the paper, not just the metaphor. Every new mechanism must cite its source paper and match the paper's equations/algorithms as closely as practical for a memory system operating at hours/days timescale (vs milliseconds in biology).
25
+
26
+ ## Architecture
27
+
28
+ Clean Architecture with concentric layers. Inner layers never import outer layers.
29
+
30
+ ```
31
+ TRANSPORT → SERVER → HANDLERS → CORE ← SHARED
32
+
33
+ INFRASTRUCTURE → SHARED
34
+ ```
35
+
36
+ Handlers are the **composition roots**: they wire infrastructure (I/O) to core (logic) and are the only layer allowed to import both.
37
+
38
+ ### Dependency Rules
39
+
40
+ | Layer | May Import | Must NOT Import |
41
+ |---|---|---|
42
+ | **shared/** | Python stdlib only | core, infrastructure, handlers, server, transport |
43
+ | **core/** | shared/ only | infrastructure, handlers, server, transport, os/pathlib |
44
+ | **infrastructure/** | shared/, Python stdlib | core, handlers, server, transport |
45
+ | **validation/** | shared/, errors/ | core, infrastructure, handlers |
46
+ | **errors/** | nothing | everything |
47
+ | **handlers/** | core, infrastructure, shared, validation, errors | server, transport |
48
+ | **server/** | handlers, errors | core, infrastructure (except via handlers) |
49
+ | **transport/** | server | everything else |
50
+ | **hooks/** | infrastructure, core, shared | server, transport |
51
+
52
+ ### Module Inventory
53
+
54
+ **shared/** — Pure utility functions (10 modules)
55
+ - `text.py` — Keyword extraction with stopword filtering
56
+ - `categorizer.py` — 10-category work classification
57
+ - `similarity.py` — Jaccard similarity coefficient
58
+ - `hash.py` — DJB2 non-cryptographic hash
59
+ - `project_ids.py` — Path ↔ project ID ↔ label ↔ domain ID conversion
60
+ - `yaml_parser.py` — Lightweight YAML frontmatter parser
61
+ - `types.py` — Pydantic models (ProfilesV2, DomainProfile, CognitiveStyle, etc.)
62
+ - `linear_algebra.py` — Dense vector math via numpy (dot, norm, cosine, project, clamp)
63
+ - `sparse.py` — Sparse vector operations (dict-based, topK, conversions)
64
+ - `memory_types.py` — Runtime validation types for the memory subsystem
65
+
66
+ **core/** — Pure business logic, zero I/O (60 modules)
67
+
68
+ *Cognitive Profiling:*
69
+ - `domain_detector.py` — 3-signal weighted domain classification
70
+ - `context_generator.py` — Human-readable profile text generation
71
+ - `pattern_extractor.py` — Entry points, recurring patterns, tool preferences, session shape
72
+ - `style_classifier.py` — Felder-Silverman cognitive style classification + EMA update
73
+ - `bridge_finder.py` — Cross-domain connection detection (structural + analogical)
74
+ - `blindspot_detector.py` — Category, tool, and pattern gap analysis
75
+ - `profile_builder.py` — Profile orchestration (assembles all core modules)
76
+ - `graph_builder.py` — Graph node/edge construction for visualization
77
+
78
+ *Behavioral Interpretability:*
79
+ - `sparse_dictionary.py` — Behavioral feature dictionary learning (OMP sparse coding, K-SVD)
80
+ - `persona_vector.py` — 12D persona vector with drift detection and context steering
81
+ - `behavioral_crosscoder.py` — Cross-domain behavioral feature persistence detection
82
+ - `attribution_tracer.py` — Pipeline attribution graph via perturbation-based tracing
83
+
84
+ *Memory Thermodynamics:*
85
+ - `thermodynamics.py` — Heat, surprise, importance, valence, metamemory
86
+ - `hierarchical_predictive_coding.py` — 3-level Friston free energy gate (sensory/entity/schema) replacing flat 4-signal
87
+ - `coupled_neuromodulation.py` — DA/NE/ACh/5-HT coupled cascade with cross-channel effects (Doya 2002, Schultz 1997)
88
+ - `emotional_tagging.py` — Amygdala-inspired priority encoding with Yerkes-Dodson curve (Wang & Bhatt 2024)
89
+ - `synaptic_tagging.py` — Retroactive promotion of weak memories sharing entities (Frey & Morris 1997)
90
+ - `curation.py` — Active curation logic (merge, link, create decisions)
91
+ - `engram.py` — Memory trace structure (Josselyn & Tonegawa 2020)
92
+ - `decay_cycle.py` — Thermodynamic cooling with stage-dependent rates
93
+ - `tripartite_synapse.py` — Astrocyte calcium dynamics, D-serine LTP facilitation, metabolic gating (Perea 2009)
94
+ - `compression.py` — Full-text → gist → tag compression
95
+ - `staleness.py` — File-reference staleness scoring
96
+
97
+ *Oscillatory & Cascade:*
98
+ - `oscillatory_clock.py` — Theta/gamma/SWR phase gating (Hasselmo 2005, Buzsaki 2015)
99
+ - `cascade.py` — Consolidation stages: LABILE → EARLY_LTP → LATE_LTP → CONSOLIDATED (Kandel 2001)
100
+ - `pattern_separation.py` — DG orthogonalization + neurogenesis analog (Leutgeb 2007, Yassa & Stark 2011)
101
+ - `schema_engine.py` — Cortical knowledge structures with Piaget accommodation (Tse 2007, Gilboa & Marlatte 2017)
102
+ - `interference.py` — Proactive/retroactive interference detection + sleep orthogonalization
103
+ - `homeostatic_plasticity.py` — Synaptic scaling + BCM threshold (Turrigiano 2008, Abraham & Bear 1996)
104
+ - `dendritic_clusters.py` — Branch-specific nonlinear integration + priming (Kastellakis 2015)
105
+ - `two_stage_model.py` — Hippocampal-cortical transfer protocol (McClelland 1995)
106
+ - `emergence_tracker.py` — System-level metrics: forgetting curve, spacing effect, schema acceleration
107
+ - `ablation.py` — Lesion study framework for 20 ablatable mechanisms
108
+
109
+ *Consolidation:*
110
+ - `consolidation_engine.py` — Orchestrates decay, compression, CLS, causal discovery
111
+ - `dual_store_cls.py` — Episodic → semantic memory consolidation (CLS)
112
+ - `causal_graph.py` — PC Algorithm for causal discovery
113
+ - `reconsolidation.py` — Memory updating on access
114
+ - `replay.py` — Hippocampal replay for memory consolidation
115
+ - `sleep_compute.py` — Dream replay, cluster summarization, re-embedding, auto-narration
116
+ - `synaptic_plasticity.py` — LTP/LTD Hebbian learning + STDP causal direction + stochastic transmission + phase-gated plasticity (Hebb 1949, BCM 1982, Bi & Poo 1998, Markram 1998)
117
+ - `microglial_pruning.py` — Complement-dependent edge elimination + orphan archival (Wang et al. 2020)
118
+
119
+ *Retrieval & Navigation:*
120
+ - `query_router.py` — Intent classification (temporal/causal/semantic/entity) + 7-signal WRRF fusion
121
+ - `spreading_activation.py` — Collins & Loftus 1975 semantic priming over entity graph (WRRF signal #7)
122
+ - `hdc_encoder.py` — 1024D bipolar HDC (bind/bundle/permute/similarity)
123
+ - `cognitive_map.py` — Successor Representation co-access graph + 2D projection
124
+ - `hopfield.py` — Hopfield network for content-addressable recall
125
+ - `fractal.py` — Hierarchical clustering (L0/L1/L2 levels)
126
+ - `enrichment.py` — Doc2Query synthetic queries + concept synonym expansion
127
+ - `sensory_buffer.py` — Bounded pre-consolidation ring buffer
128
+ - `knowledge_graph.py` — Entity and relationship extraction
129
+ - `prospective.py` — Trigger-based proactive recall (keyword, time, file, domain)
130
+ - `memory_rules.py` — Neuro-symbolic rules system (soft/hard filtering)
131
+
132
+ *Analysis & Narrative:*
133
+ - `narrative.py` — Story generation from memories
134
+ - `metacognition.py` — Self-reflection on memory system performance
135
+ - `session_critique.py` — Post-session analysis and improvement suggestions
136
+ - `session_extractor.py` — Extracts memories from session transcripts
137
+
138
+ **infrastructure/** — All I/O (11 modules)
139
+ - `config.py` — Centralized path constants via pathlib
140
+ - `file_io.py` — Generic JSON/text read/write operations
141
+ - `profile_store.py` — profiles.json persistence
142
+ - `session_store.py` — session-log.json persistence
143
+ - `brain_index_store.py` — brain-index.json reader
144
+ - `scanner.py` — Discovers memories + conversations from ~/.claude/
145
+ - `mcp_client.py` — Async MCP client over stdio (JSON-RPC 2.0, version negotiation)
146
+ - `mcp_client_pool.py` — Singleton connection pool (lazy connect, reuse, idle timeout)
147
+ - `memory_store.py` — SQLite + FTS5 persistence layer
148
+ - `memory_config.py` — Runtime configuration (env vars with JARVIS_MEMORY_ prefix)
149
+ - `embedding_engine.py` — Vector embeddings (64-dim default, configurable)
150
+
151
+ **handlers/** — Composition roots (34 handlers, one per tool)
152
+
153
+ **validation/** — `schemas.py` — Per-tool argument validation
154
+
155
+ **errors/** — `__init__.py` — MethodologyError, ValidationError, StorageError, AnalysisError, McpConnectionError
156
+
157
+ **server/** — `mcp_router.py` (MCP JSON-RPC dispatch), `http_server.py` (visualization + dashboard server)
158
+
159
+ **transport/** — `stdio.py` — Async newline-delimited JSON-RPC 2.0 over stdin/stdout
160
+
161
+ **hooks/** — Session lifecycle automation
162
+ - `session_lifecycle.py` — SessionEnd hook for automatic profile updates
163
+ - `session_start.py` — SessionStart hook: injects anchored + hot memories + checkpoint state
164
+ - `post_tool_capture.py` — PostToolUse auto-capture hook
165
+ - `compaction_checkpoint.py` — Saves state before context compaction
166
+
167
+ ## MCP Tools
168
+
169
+ ### Tier 1 — Core Memory & Profiling (22 tools)
170
+
171
+ | Tool | Purpose | Target Latency |
172
+ |---|---|---|
173
+ | `query_methodology` | Returns cognitive profile + hot memories for current domain | <50ms |
174
+ | `detect_domain` | Lightweight domain classification | <20ms |
175
+ | `rebuild_profiles` | Full rescan of session data | <10s |
176
+ | `list_domains` | Overview of all domains | <10ms |
177
+ | `record_session_end` | Incremental profile update + session critique | <200ms |
178
+ | `get_methodology_graph` | Graph data for 3D visualization | <100ms |
179
+ | `open_visualization` | Launch 3D methodology map in browser | — |
180
+ | `explore_features` | Interpretability exploration (features, attribution, persona, crosscoder) | <100ms |
181
+ | `open_memory_dashboard` | Launch real-time memory dashboard in browser | — |
182
+ | `remember` | Store a memory through the 4-signal predictive coding gate | <100ms |
183
+ | `recall` | Retrieve memories via 6-signal WRRF fusion | <200ms |
184
+ | `consolidate` | Run maintenance: decay, compression, CLS, sleep compute | <5s |
185
+ | `checkpoint` | Save/restore working state for hippocampal replay | <100ms |
186
+ | `narrative` | Generate project narrative from stored memories | <500ms |
187
+ | `memory_stats` | Memory system diagnostics | <50ms |
188
+ | `import_sessions` | Import conversation history into memory store | varies |
189
+ | `forget` | Hard/soft delete with is_protected guard | <50ms |
190
+ | `validate_memory` | Validate memories against filesystem state | <500ms |
191
+ | `rate_memory` | Useful/not-useful feedback → metamemory confidence | <50ms |
192
+ | `seed_project` | 5-stage codebase bootstrap | varies |
193
+ | `anchor` | Mark memory as compaction-resistant (heat=1.0) | <50ms |
194
+ | `backfill_memories` | Auto-import prior Claude Code conversations | varies |
195
+
196
+ ### Tier 2 — Navigation & Exploration (5 tools)
197
+
198
+ | Tool | Purpose | Target Latency |
199
+ |---|---|---|
200
+ | `recall_hierarchical` | Fractal L0/L1/L2 weighted recall | <200ms |
201
+ | `drill_down` | Navigate into fractal cluster (L2 → L1 → memories) | <100ms |
202
+ | `navigate_memory` | Successor Representation co-access BFS traversal | <200ms |
203
+ | `get_causal_chain` | Trace entity relationships through knowledge graph | <200ms |
204
+ | `detect_gaps` | Identify isolated entities, sparse domains, temporal drift | <500ms |
205
+
206
+ ### Tier 3 — Automation & Intelligence (7 tools)
207
+
208
+ | Tool | Purpose | Target Latency |
209
+ |---|---|---|
210
+ | `sync_instructions` | Push top memory insights into CLAUDE.md | <500ms |
211
+ | `create_trigger` | Prospective memory triggers (keyword/time/file/domain) | <100ms |
212
+ | `add_rule` | Add neuro-symbolic hard/soft/tag rules | <100ms |
213
+ | `get_rules` | List active rules by scope/type | <50ms |
214
+ | `get_project_story` | Period-based autobiographical narrative | <500ms |
215
+ | `assess_coverage` | Knowledge coverage score (0-100) + recommendations | <500ms |
216
+ | `run_pipeline` | Drive ai-architect pipeline end-to-end (11 stages → PR) | varies |
217
+
218
+ ## Slash Commands
219
+
220
+ - `/methodology` — View cognitive methodology profile
221
+
222
+ ## Data Flow
223
+
224
+ ### Memory Write Path
225
+
226
+ 1. **Gate**: 4-signal novelty filter (embedding distance, entity overlap, temporal proximity, structural similarity)
227
+ 2. **Curate**: Active curation — merge with similar, link to related, or create new
228
+ 3. **Store**: SQLite + FTS5 with entity extraction → knowledge graph + engram competition
229
+
230
+ ### Memory Read Path
231
+
232
+ 1. **Route**: Intent classification (temporal/causal/semantic/entity)
233
+ 2. **Enrich**: Doc2Query expansion + concept synonyms
234
+ 3. **Fuse**: 6-signal WRRF (vector + FTS5 + heat + Hopfield + HDC + SR)
235
+ 4. **Filter**: Neuro-symbolic rules → ranked results
236
+
237
+ ### Cognitive Profile Pipeline
238
+
239
+ 1. **Scan**: Read ~/.claude/projects/ for JSONL conversations and memory .md files
240
+ 2. **Group**: Map projects to domains via project ID matching
241
+ 3. **Extract**: Per-domain pattern extraction (clustering, n-grams, tool stats, session shape)
242
+ 4. **Classify**: Felder-Silverman cognitive style from behavioral signals
243
+ 5. **Bridge**: Cross-domain connections from brain-index cross-refs and text analogies
244
+ 6. **Detect gaps**: Blind spots by comparing domain coverage against global averages
245
+ 7. **Learn features**: Sparse dictionary learning on 27D behavioral activation space
246
+ 8. **Encode**: Per-domain sparse feature activations + persona vectors
247
+ 9. **Crosscode**: Detect persistent behavioral features across domains
248
+ 10. **Store**: Persist as ~/.claude/methodology/profiles.json
249
+
250
+ ## Testing
251
+
252
+ ```bash
253
+ pytest # All tests (1837 passing)
254
+ pytest --cov=mcp_server --cov-report=term-missing # With coverage
255
+ pytest tests_py/core/ # Core layer only
256
+ pytest tests_py/shared/ # Shared layer only
257
+ pytest tests_py/handlers/ # Handler layer only
258
+ ```
259
+
260
+ **Coverage targets**: shared 95%+, core 90%+, infrastructure 85%+, handlers 85%+, validation/errors 95%+, server/transport 80%+, hooks 90%+.
261
+
262
+ ## Benchmarks
263
+
264
+ 6 benchmarks covering long-term memory from 2024-2026:
265
+
266
+ ```bash
267
+ # Tier 1 — Active (results tracked)
268
+ python3 benchmarks/longmemeval/run_benchmark.py --variant s # LongMemEval (ICLR 2025) — 500 Qs
269
+ python3 benchmarks/locomo/run_benchmark.py # LoCoMo (ACL 2024) — 1986 Qs
270
+ python3 benchmarks/beam/run_benchmark.py --split 100K # BEAM (ICLR 2026) — 200 Qs
271
+
272
+ # Tier 2 — Additional
273
+ python3 benchmarks/memoryagentbench/run_benchmark.py # MemoryAgentBench (ICLR 2026)
274
+ python3 benchmarks/evermembench/run_benchmark.py # EverMemBench (2026) — 2400 Qs
275
+ python3 benchmarks/episodic/run_benchmark.py --events 20 # Episodic Memories (ICLR 2025)
276
+ ```
277
+
278
+ **Current scores vs Zikkaron:**
279
+ | Benchmark | JARVIS | Zikkaron | Status |
280
+ |---|---|---|---|
281
+ | LongMemEval R@10 | **99.0%** | 96.7% | Ahead |
282
+ | LongMemEval MRR | 0.944 | 0.945 | Tied |
283
+ | LoCoMo MRR | 0.579 | 0.708 | Behind |
284
+ | BEAM Overall | 0.299 | 0.404 | Behind |
285
+
286
+ ## Key Design Decisions
287
+
288
+ See `docs/adr/` for Architecture Decision Records:
289
+ - ADR-001: Zero external dependencies (superseded by ADR-012)
290
+ - ADR-002: Clean architecture layers
291
+ - ADR-003: Felder-Silverman cognitive model
292
+ - ADR-004: Jaccard over cosine similarity
293
+ - ADR-005: Agglomerative over k-means clustering
294
+ - ADR-006: EMA for incremental updates
295
+ - ADR-007: Head/tail JSONL reading
296
+ - ADR-008: Handler as composition root
297
+ - ADR-009: node:test over Jest (superseded by ADR-012)
298
+ - ADR-010: Sparse dictionary learning for behavioral features
299
+ - ADR-011: 12D persona vector design
300
+ - ADR-012: Python migration from Node.js
301
+ - ADR-013: Zikkaron-inspired thermodynamic memory
302
+ - ADR-014: Biological mechanisms (spreading activation, synaptic tagging, neuromodulation, LTP/LTD, STDP, emotional tagging, microglial pruning)
303
+
304
+ ## Technology Stack
305
+
306
+ Python 3.10+ with three dependencies: `fastmcp>=2.0.0`, `pydantic>=2.0.0`, `numpy>=1.24.0`. Uses built-in `sqlite3` for persistence. Pre-computed profiles stored at `~/.claude/methodology/profiles.json`, memory database at `~/.claude/memory/jarvis.db`.