agent-memory-labs 0.1.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 (118) hide show
  1. agent_memory_labs-0.1.0/.gitignore +46 -0
  2. agent_memory_labs-0.1.0/LICENSE +21 -0
  3. agent_memory_labs-0.1.0/PKG-INFO +604 -0
  4. agent_memory_labs-0.1.0/README.md +565 -0
  5. agent_memory_labs-0.1.0/pyproject.toml +166 -0
  6. agent_memory_labs-0.1.0/src/agentic_memory/__init__.py +13 -0
  7. agent_memory_labs-0.1.0/src/agentic_memory/__main__.py +20 -0
  8. agent_memory_labs-0.1.0/src/agentic_memory/chat/__init__.py +10 -0
  9. agent_memory_labs-0.1.0/src/agentic_memory/chat/pipeline.py +355 -0
  10. agent_memory_labs-0.1.0/src/agentic_memory/cli.py +3506 -0
  11. agent_memory_labs-0.1.0/src/agentic_memory/config.py +479 -0
  12. agent_memory_labs-0.1.0/src/agentic_memory/core/__init__.py +27 -0
  13. agent_memory_labs-0.1.0/src/agentic_memory/core/base.py +60 -0
  14. agent_memory_labs-0.1.0/src/agentic_memory/core/claim_extraction.py +158 -0
  15. agent_memory_labs-0.1.0/src/agentic_memory/core/config_validator.py +95 -0
  16. agent_memory_labs-0.1.0/src/agentic_memory/core/connection.py +234 -0
  17. agent_memory_labs-0.1.0/src/agentic_memory/core/embedding.py +384 -0
  18. agent_memory_labs-0.1.0/src/agentic_memory/core/entity_extraction.py +165 -0
  19. agent_memory_labs-0.1.0/src/agentic_memory/core/extraction_llm.py +111 -0
  20. agent_memory_labs-0.1.0/src/agentic_memory/core/graph_writer.py +660 -0
  21. agent_memory_labs-0.1.0/src/agentic_memory/core/registry.py +18 -0
  22. agent_memory_labs-0.1.0/src/agentic_memory/core/request_context.py +22 -0
  23. agent_memory_labs-0.1.0/src/agentic_memory/core/retry.py +56 -0
  24. agent_memory_labs-0.1.0/src/agentic_memory/core/runtime_embedding.py +249 -0
  25. agent_memory_labs-0.1.0/src/agentic_memory/core/scheduler.py +543 -0
  26. agent_memory_labs-0.1.0/src/agentic_memory/docker/docker-compose.yml +48 -0
  27. agent_memory_labs-0.1.0/src/agentic_memory/eval/__init__.py +17 -0
  28. agent_memory_labs-0.1.0/src/agentic_memory/eval/retrieval_eval.py +1132 -0
  29. agent_memory_labs-0.1.0/src/agentic_memory/ingestion/__init__.py +22 -0
  30. agent_memory_labs-0.1.0/src/agentic_memory/ingestion/git_graph.py +488 -0
  31. agent_memory_labs-0.1.0/src/agentic_memory/ingestion/graph.py +3784 -0
  32. agent_memory_labs-0.1.0/src/agentic_memory/ingestion/parser.py +737 -0
  33. agent_memory_labs-0.1.0/src/agentic_memory/ingestion/python_call_analyzer.py +896 -0
  34. agent_memory_labs-0.1.0/src/agentic_memory/ingestion/typescript_call_analyzer.py +583 -0
  35. agent_memory_labs-0.1.0/src/agentic_memory/ingestion/watcher.py +267 -0
  36. agent_memory_labs-0.1.0/src/agentic_memory/product/__init__.py +5 -0
  37. agent_memory_labs-0.1.0/src/agentic_memory/product/state.py +965 -0
  38. agent_memory_labs-0.1.0/src/agentic_memory/server/__init__.py +47 -0
  39. agent_memory_labs-0.1.0/src/agentic_memory/server/app.py +1791 -0
  40. agent_memory_labs-0.1.0/src/agentic_memory/server/code_search.py +645 -0
  41. agent_memory_labs-0.1.0/src/agentic_memory/server/public_mcp.py +241 -0
  42. agent_memory_labs-0.1.0/src/agentic_memory/server/reranking.py +433 -0
  43. agent_memory_labs-0.1.0/src/agentic_memory/server/research_search.py +349 -0
  44. agent_memory_labs-0.1.0/src/agentic_memory/server/result_types.py +87 -0
  45. agent_memory_labs-0.1.0/src/agentic_memory/server/tools.py +1516 -0
  46. agent_memory_labs-0.1.0/src/agentic_memory/server/unified_search.py +394 -0
  47. agent_memory_labs-0.1.0/src/agentic_memory/telemetry.py +443 -0
  48. agent_memory_labs-0.1.0/src/agentic_memory/temporal/__init__.py +15 -0
  49. agent_memory_labs-0.1.0/src/agentic_memory/temporal/bridge.py +306 -0
  50. agent_memory_labs-0.1.0/src/agentic_memory/temporal/seeds.py +94 -0
  51. agent_memory_labs-0.1.0/src/agentic_memory/trace/__init__.py +11 -0
  52. agent_memory_labs-0.1.0/src/agentic_memory/trace/service.py +389 -0
  53. agent_memory_labs-0.1.0/src/agentic_memory/web/__init__.py +27 -0
  54. agent_memory_labs-0.1.0/src/agentic_memory/web/chunker.py +161 -0
  55. agent_memory_labs-0.1.0/src/agentic_memory/web/crawler.py +47 -0
  56. agent_memory_labs-0.1.0/src/agentic_memory/web/pipeline.py +582 -0
  57. agent_memory_labs-0.1.0/src/am_server/__init__.py +23 -0
  58. agent_memory_labs-0.1.0/src/am_server/app.py +576 -0
  59. agent_memory_labs-0.1.0/src/am_server/auth.py +340 -0
  60. agent_memory_labs-0.1.0/src/am_server/data/selectors.json +38 -0
  61. agent_memory_labs-0.1.0/src/am_server/dependencies.py +119 -0
  62. agent_memory_labs-0.1.0/src/am_server/mcp_profiles.py +218 -0
  63. agent_memory_labs-0.1.0/src/am_server/metrics.py +534 -0
  64. agent_memory_labs-0.1.0/src/am_server/middleware.py +50 -0
  65. agent_memory_labs-0.1.0/src/am_server/models.py +472 -0
  66. agent_memory_labs-0.1.0/src/am_server/publication_config.py +50 -0
  67. agent_memory_labs-0.1.0/src/am_server/routes/__init__.py +33 -0
  68. agent_memory_labs-0.1.0/src/am_server/routes/conversation.py +105 -0
  69. agent_memory_labs-0.1.0/src/am_server/routes/dashboard.py +486 -0
  70. agent_memory_labs-0.1.0/src/am_server/routes/ext.py +52 -0
  71. agent_memory_labs-0.1.0/src/am_server/routes/health.py +435 -0
  72. agent_memory_labs-0.1.0/src/am_server/routes/openclaw.py +1169 -0
  73. agent_memory_labs-0.1.0/src/am_server/routes/product.py +159 -0
  74. agent_memory_labs-0.1.0/src/am_server/routes/publication.py +470 -0
  75. agent_memory_labs-0.1.0/src/am_server/routes/research.py +120 -0
  76. agent_memory_labs-0.1.0/src/am_server/routes/search.py +80 -0
  77. agent_memory_labs-0.1.0/src/am_server/server.py +36 -0
  78. agent_memory_labs-0.1.0/src/codememory/__init__.py +19 -0
  79. agent_memory_labs-0.1.0/src/codememory/__main__.py +21 -0
  80. agent_memory_labs-0.1.0/src/codememory/chat/__init__.py +12 -0
  81. agent_memory_labs-0.1.0/src/codememory/chat/pipeline.py +342 -0
  82. agent_memory_labs-0.1.0/src/codememory/cli.py +16 -0
  83. agent_memory_labs-0.1.0/src/codememory/config.py +468 -0
  84. agent_memory_labs-0.1.0/src/codememory/core/__init__.py +31 -0
  85. agent_memory_labs-0.1.0/src/codememory/core/base.py +58 -0
  86. agent_memory_labs-0.1.0/src/codememory/core/claim_extraction.py +158 -0
  87. agent_memory_labs-0.1.0/src/codememory/core/config_validator.py +96 -0
  88. agent_memory_labs-0.1.0/src/codememory/core/connection.py +148 -0
  89. agent_memory_labs-0.1.0/src/codememory/core/embedding.py +183 -0
  90. agent_memory_labs-0.1.0/src/codememory/core/entity_extraction.py +165 -0
  91. agent_memory_labs-0.1.0/src/codememory/core/extraction_llm.py +111 -0
  92. agent_memory_labs-0.1.0/src/codememory/core/graph_writer.py +664 -0
  93. agent_memory_labs-0.1.0/src/codememory/core/registry.py +19 -0
  94. agent_memory_labs-0.1.0/src/codememory/core/request_context.py +28 -0
  95. agent_memory_labs-0.1.0/src/codememory/core/retry.py +74 -0
  96. agent_memory_labs-0.1.0/src/codememory/core/runtime_embedding.py +212 -0
  97. agent_memory_labs-0.1.0/src/codememory/core/scheduler.py +543 -0
  98. agent_memory_labs-0.1.0/src/codememory/docker/docker-compose.yml +48 -0
  99. agent_memory_labs-0.1.0/src/codememory/ingestion/__init__.py +25 -0
  100. agent_memory_labs-0.1.0/src/codememory/ingestion/git_graph.py +592 -0
  101. agent_memory_labs-0.1.0/src/codememory/ingestion/graph.py +1368 -0
  102. agent_memory_labs-0.1.0/src/codememory/ingestion/parser.py +334 -0
  103. agent_memory_labs-0.1.0/src/codememory/ingestion/watcher.py +398 -0
  104. agent_memory_labs-0.1.0/src/codememory/product/__init__.py +13 -0
  105. agent_memory_labs-0.1.0/src/codememory/product/state.py +10 -0
  106. agent_memory_labs-0.1.0/src/codememory/server/__init__.py +21 -0
  107. agent_memory_labs-0.1.0/src/codememory/server/app.py +1379 -0
  108. agent_memory_labs-0.1.0/src/codememory/server/result_types.py +85 -0
  109. agent_memory_labs-0.1.0/src/codememory/server/tools.py +1098 -0
  110. agent_memory_labs-0.1.0/src/codememory/server/unified_search.py +402 -0
  111. agent_memory_labs-0.1.0/src/codememory/telemetry.py +427 -0
  112. agent_memory_labs-0.1.0/src/codememory/temporal/__init__.py +25 -0
  113. agent_memory_labs-0.1.0/src/codememory/temporal/bridge.py +330 -0
  114. agent_memory_labs-0.1.0/src/codememory/temporal/seeds.py +135 -0
  115. agent_memory_labs-0.1.0/src/codememory/web/__init__.py +35 -0
  116. agent_memory_labs-0.1.0/src/codememory/web/chunker.py +166 -0
  117. agent_memory_labs-0.1.0/src/codememory/web/crawler.py +48 -0
  118. agent_memory_labs-0.1.0/src/codememory/web/pipeline.py +595 -0
@@ -0,0 +1,46 @@
1
+ # Python
2
+ __pycache__/
3
+ *.pyc
4
+ *.pyo
5
+ .venv/
6
+ .venv-agentic-memory/
7
+ venv/
8
+ .pytest_cache/
9
+ pytest-cache-files-*/
10
+ .coverage
11
+ htmlcov/
12
+ *.egg-info/
13
+
14
+ # Node
15
+ node_modules/
16
+ dist/
17
+ build/
18
+ *.tsbuildinfo
19
+ .cache/
20
+
21
+ # SpacetimeDB generated bindings
22
+ packages/am-temporal-kg/generated-bindings/
23
+
24
+ # Environment
25
+ .env
26
+ .env.local
27
+ .env.*.local
28
+
29
+ # OS
30
+ .DS_Store
31
+ Thumbs.db
32
+
33
+ # Wrangler
34
+ .wrangler/
35
+
36
+ # Logs
37
+ *.log
38
+ npm-debug.log*
39
+
40
+ # Local agent/editor artifacts
41
+ .claude/worktrees/
42
+ ~/.config/cursor/
43
+ docs/notebooklm/
44
+ repomix-output.md
45
+ .mcp.json
46
+ .claude/
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Agentic Memory Contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,604 @@
1
+ Metadata-Version: 2.4
2
+ Name: agent-memory-labs
3
+ Version: 0.1.0
4
+ Summary: Agentic Memory: Structural Code Graph with Neo4j and MCP
5
+ License-File: LICENSE
6
+ Requires-Python: >=3.10
7
+ Requires-Dist: apscheduler<4.0,>=3.10.0
8
+ Requires-Dist: basedpyright>=1.39.0
9
+ Requires-Dist: crawl4ai>=0.8.0
10
+ Requires-Dist: fastapi>=0.115.0
11
+ Requires-Dist: google-genai>=1.0.0
12
+ Requires-Dist: groq>=0.10.0
13
+ Requires-Dist: httpx>=0.27.0
14
+ Requires-Dist: markdownify>=1.2.0
15
+ Requires-Dist: mcp
16
+ Requires-Dist: neo4j
17
+ Requires-Dist: openai
18
+ Requires-Dist: pydantic>=2.0.0
19
+ Requires-Dist: pymupdf4llm>=1.27.0
20
+ Requires-Dist: python-dotenv
21
+ Requires-Dist: sqlalchemy>=2.0.0
22
+ Requires-Dist: tree-sitter
23
+ Requires-Dist: tree-sitter-javascript
24
+ Requires-Dist: tree-sitter-python
25
+ Requires-Dist: uvicorn[standard]>=0.30.0
26
+ Requires-Dist: watchdog
27
+ Provides-Extra: dev
28
+ Requires-Dist: black>=23.0.0; extra == 'dev'
29
+ Requires-Dist: mypy>=1.0.0; extra == 'dev'
30
+ Requires-Dist: pre-commit>=3.0.0; extra == 'dev'
31
+ Requires-Dist: pytest-asyncio>=0.21.0; extra == 'dev'
32
+ Requires-Dist: pytest-cov>=4.0.0; extra == 'dev'
33
+ Requires-Dist: pytest-mock>=3.10.0; extra == 'dev'
34
+ Requires-Dist: pytest>=7.0.0; extra == 'dev'
35
+ Requires-Dist: responses>=0.23.0; extra == 'dev'
36
+ Requires-Dist: ruff>=0.1.0; extra == 'dev'
37
+ Requires-Dist: types-requests; extra == 'dev'
38
+ Description-Content-Type: text/markdown
39
+
40
+ # ๐Ÿง  Agentic Memory
41
+ https://github.com/jarmen423/agentic-memory
42
+
43
+ > **Multi-Domain Memory Layer for AI Agents**
44
+
45
+ Agentic Memory gives AI agents persistent, searchable memory across four domains: **code**, **git history**, **web research**, and **conversations** โ€” all stored in a unified Neo4j graph and exposed via MCP.
46
+
47
+ **Core Value Prop:** *"Don't let your agent work from a blank slate. Give it memory."*
48
+
49
+ ---
50
+
51
+ ## โœจ Features
52
+
53
+ | Feature | Description |
54
+ |---------|-------------|
55
+ | **๐Ÿ“Š Code Graph** | Structural understanding of files, entities, imports, and on-demand execution tracing โ€” not just text similarity |
56
+ | **๐Ÿ’ฌ Conversation Memory** | Stores and retrieves past agent/user exchanges by semantic similarity |
57
+ | **๐ŸŒ Research & Web Memory** | Ingests URLs, PDFs, and research reports as searchable findings |
58
+ | **๐Ÿงฌ Git Graph (Opt-in)** | Adds commit/author/file-version history in the same Neo4j DB |
59
+ | **๐Ÿ” Unified Search** | `search_all_memory` spans all domains in a single query |
60
+ | **โšก Real-time Sync** | File watcher automatically updates the code graph as you work |
61
+ | **๐Ÿค– MCP Protocol** | Drop-in integration with Claude, Cursor, Windsurf, and any MCP-compatible AI |
62
+ | **โฑ๏ธ Temporal GraphRAG** | Time-aware graph layer for deterministic retrieval at any point in time |
63
+
64
+ ---
65
+
66
+ ## ๐Ÿš€ Quick Start
67
+
68
+ ### 1. Install globally
69
+
70
+ ```bash
71
+ # Recommended: Use pipx for isolated global installation
72
+ pipx install agentic-memory
73
+
74
+ # Or with uv tooling
75
+ uv tool install agentic-memory
76
+ uvx agentic-memory --help
77
+
78
+ # Or use pip in a virtualenv
79
+ pip install agentic-memory
80
+ ```
81
+
82
+ ### 2. Initialize in any repository
83
+
84
+ ```bash
85
+ cd /path/to/your/repo
86
+ agentic-memory init
87
+ ```
88
+
89
+ The interactive wizard will guide you through:
90
+ - Neo4j setup (local Docker, Aura cloud, or custom)
91
+ - Code embedding provider selection
92
+ - Gemini API key by default for code semantic search
93
+ - File extensions to index
94
+
95
+ By default, `agentic-memory init` configures the `code` module to use
96
+ `gemini-embedding-2-preview` so code memory stays aligned with the rest of the
97
+ multimodal Agentic Memory system. If you want code memory completely separate,
98
+ you can switch the `code` module to another text embedding provider such as
99
+ OpenAI.
100
+
101
+ That's it! Your repository is now indexed and ready for AI agents.
102
+
103
+ ### Running Agentic Memory On This Repository
104
+
105
+ If you are working inside the `agentic-memory` repo itself, this checkout is
106
+ already initialized through:
107
+
108
+ - `D:\code\agentic-memory\.codememory\config.json`
109
+
110
+ So you normally do **not** need to run `agentic-memory init` again.
111
+
112
+ On this machine, the practical local flow is:
113
+
114
+ ```powershell
115
+ cd D:\code\agentic-memory
116
+ docker compose up -d neo4j
117
+ .\.venv-agentic-memory\Scripts\python.exe -m agentic_memory.cli status --json
118
+ .\.venv-agentic-memory\Scripts\python.exe -m agentic_memory.cli index --json
119
+ ```
120
+
121
+ Why the commands use `python -m agentic_memory.cli` instead of `agentic-memory`:
122
+
123
+ - the console script may not be on `PATH`
124
+ - the repo-local virtualenv path is explicit and avoids shell ambiguity
125
+
126
+ Current local config expectations for this repo:
127
+
128
+ - Neo4j: `bolt://localhost:7687`
129
+ - Neo4j user: `neo4j`
130
+ - Neo4j password: `password`
131
+ - code embedding provider: Gemini (`gemini-embedding-2-preview`)
132
+
133
+ If `status` fails before indexing starts, the most likely immediate cause is
134
+ that Neo4j is not running locally yet.
135
+
136
+ ---
137
+
138
+ ## ๐Ÿ“– Usage
139
+
140
+ ### Code memory
141
+
142
+ ```bash
143
+ # Setup/config for code memory in this repo
144
+ agentic-memory init
145
+
146
+ # Show repository status and statistics
147
+ agentic-memory status
148
+
149
+ # One-time structural code ingest (files, entities, imports)
150
+ agentic-memory index
151
+
152
+ # Continuous structural code ingest on file changes
153
+ agentic-memory watch
154
+
155
+ # Experimental old repo-wide CALLS build
156
+ agentic-memory build-calls
157
+
158
+ # JIT trace one function's likely execution neighborhood
159
+ agentic-memory trace-execution src/app.py:run_checkout --json
160
+
161
+ # Start MCP server for AI agents
162
+ agentic-memory serve
163
+
164
+ # Semantic search across code
165
+ agentic-memory search "where is the auth logic?"
166
+ ```
167
+
168
+ If the console script is not on `PATH`, use the module form instead:
169
+
170
+ ```powershell
171
+ .\.venv-agentic-memory\Scripts\python.exe -m agentic_memory.cli status --json
172
+ .\.venv-agentic-memory\Scripts\python.exe -m agentic_memory.cli index --json
173
+ ```
174
+
175
+ ### Code-memory behavior model
176
+
177
+ The default code pipeline now stops after structural graph construction:
178
+
179
+ - Pass 1: structure scan and changed-file detection
180
+ - Pass 2: entities, chunks, and embeddings
181
+ - Pass 3: import graph construction
182
+
183
+ What it does **not** do by default:
184
+
185
+ - repo-wide `CALLS` reconstruction
186
+
187
+ Behavioral tracing is now handled just in time with:
188
+
189
+ - CLI: `agentic-memory trace-execution ...`
190
+ - MCP: `trace_execution_path(...)`
191
+
192
+ The older repo-wide analyzer-backed `CALLS` flow is still available explicitly:
193
+
194
+ - CLI: `agentic-memory build-calls`
195
+
196
+ Detailed explanation:
197
+
198
+ - `docs/JIT_TRACING.md`
199
+ - `docs/PUBLIC_PLUGIN_SURFACES.md`
200
+
201
+ ### Public plugin surfaces
202
+
203
+ Agentic Memory now supports a hosted remote-MCP plugin architecture for public AI surfaces. The publication model is:
204
+
205
+ - OpenAI / ChatGPT: OpenAI app review and publish, backed by the hosted OpenAI MCP surface
206
+ - Codex: distribution derived from the approved OpenAI app; `.codex-plugin/plugin.json` is the local preflight package
207
+ - Claude: Anthropic directory submission backed by the hosted Claude MCP surface
208
+
209
+ Default hosted/public MCP mounts:
210
+
211
+ - `/mcp`
212
+ - `/mcp-openai`
213
+ - `/mcp-codex`
214
+ - `/mcp-claude`
215
+
216
+ Internal/self-hosted full MCP mount:
217
+
218
+ - `/mcp-full`
219
+
220
+ Canonical publication/legal URLs:
221
+
222
+ - `https://mcp.agentmemorylabs.com/publication/agentic-memory`
223
+ - `https://mcp.agentmemorylabs.com/publication/privacy`
224
+ - `https://mcp.agentmemorylabs.com/publication/terms`
225
+ - `https://mcp.agentmemorylabs.com/publication/support`
226
+ - `https://mcp.agentmemorylabs.com/publication/dpa`
227
+
228
+ Publication packets:
229
+
230
+ - `docs/publication/openai`
231
+ - `docs/publication/anthropic`
232
+ - `docs/publication/shared`
233
+
234
+ For the public surface contract and auth details, see [docs/PUBLIC_PLUGIN_SURFACES.md](docs/PUBLIC_PLUGIN_SURFACES.md).
235
+
236
+ ### Web & research memory
237
+
238
+ ```bash
239
+ # Setup/index repair for research memory
240
+ agentic-memory web-init
241
+
242
+ # Actual ad hoc research ingest from a URL or PDF
243
+ agentic-memory web-ingest https://example.com/paper.pdf
244
+
245
+ # Search research memory
246
+ agentic-memory web-search "transformer attention mechanisms"
247
+
248
+ # Create future ingest triggers
249
+ agentic-memory web-schedule --project my-project --query "LLM memory" --interval 24h
250
+
251
+ # Actual scheduled or ad hoc research ingest execution
252
+ agentic-memory web-run-research --project my-project
253
+ ```
254
+
255
+ ### Conversation memory
256
+
257
+ ```bash
258
+ # Setup/index repair for conversation memory
259
+ agentic-memory chat-init
260
+
261
+ # Actual conversation ingest
262
+ agentic-memory chat-ingest /path/to/conversation.json
263
+
264
+ # Search past conversations
265
+ agentic-memory chat-search "what did we decide about the auth flow?"
266
+ ```
267
+
268
+ ### Optional learned reranking
269
+
270
+ Agentic Memory can optionally apply a shared learned reranking layer across
271
+ code, research, and conversation search:
272
+
273
+ - first-stage retrieval still gathers candidates with the domain's normal
274
+ dense / lexical / temporal logic
275
+ - reranking only reorders the candidate pool that survived those filters
276
+ - if the hosted reranker is disabled or unavailable, the system falls back to
277
+ baseline ordering and records that fallback in retrieval provenance
278
+
279
+ The current hosted backend is Cohere Rerank v2. Configure it with:
280
+
281
+ ```bash
282
+ AM_RERANK_ENABLED=true
283
+ AM_RERANK_PROVIDER=cohere
284
+ AM_RERANK_MODEL=rerank-v4.0-fast
285
+ COHERE_API_KEY=...
286
+ ```
287
+
288
+ Optional per-domain candidate caps and timeout settings live in `.env.example`.
289
+
290
+ If you want a backup path for retryable provider failures, you can keep direct
291
+ Cohere as primary and configure OpenRouter as a narrow failover:
292
+
293
+ ```bash
294
+ AM_RERANK_FALLBACK_PROVIDER=openrouter
295
+ AM_RERANK_FALLBACK_MODEL=cohere/rerank-4-fast
296
+ OPENROUTER_API_KEY=...
297
+ ```
298
+
299
+ The fallback is only used for retryable provider-side failures such as
300
+ timeouts, HTTP `429`, and `5xx` responses.
301
+
302
+ ### Git graph (opt-in)
303
+
304
+ ```bash
305
+ agentic-memory git-init --repo /absolute/path/to/repo --mode local --full-history
306
+ agentic-memory git-sync --repo /absolute/path/to/repo --incremental
307
+ agentic-memory git-status --repo /absolute/path/to/repo --json
308
+ ```
309
+
310
+ Git graph command details and rollout notes: [docs/GIT_GRAPH.md](docs/GIT_GRAPH.md)
311
+
312
+ ---
313
+
314
+ ## ๐Ÿงพ Tool-Use Annotation (Research)
315
+
316
+ Agentic Memory supports SQLite telemetry for MCP tool calls plus manual post-response labeling as `prompted` or `unprompted`.
317
+
318
+ ```bash
319
+ agentic-memory --prompted "check our auth"
320
+ agentic-memory --unprompted "check our auth"
321
+ ```
322
+
323
+ Full workflow and options: [docs/TOOL_USE_ANNOTATION.md](docs/TOOL_USE_ANNOTATION.md)
324
+
325
+ ---
326
+
327
+ ## ๐Ÿ—๏ธ Architecture
328
+
329
+ ```
330
+ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
331
+ โ”‚ Code Repository โ”‚ โ”‚ Web / PDFs / โ”‚ โ”‚ Conversation โ”‚ โ”‚ Git Commits / โ”‚
332
+ โ”‚ (file watcher) โ”‚ โ”‚ Research Reportsโ”‚ โ”‚ Logs โ”‚ โ”‚ Blame / History โ”‚
333
+ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
334
+ โ”‚ โ”‚ โ”‚ โ”‚
335
+ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
336
+ โ”‚
337
+ Ingestion Pipelines
338
+ โ”‚
339
+ โ–ผ
340
+ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
341
+ โ”‚ Neo4j โ”‚
342
+ โ”‚ Memory Graphโ”‚
343
+ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
344
+ โ”‚
345
+ โ–ผ
346
+ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” MCP Protocol โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
347
+ โ”‚ AI Agent / โ”‚ <โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€> โ”‚ MCP Server โ”‚
348
+ โ”‚ Claude โ”‚ โ”‚ (Interface) โ”‚
349
+ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
350
+ ```
351
+
352
+ ### Components
353
+
354
+ | Component | Role | Description |
355
+ |-----------|------|-------------|
356
+ | **Code Watcher** (`watcher.py`) | The "Code Writer" | Watches filesystem changes, keeps the code graph in sync |
357
+ | **Graph Builder** (`graph.py`) | The "Code Mapper" | Parses code with Tree-sitter, builds Neo4j graph with embeddings |
358
+ | **Research Pipeline** (`web/pipeline.py`) | The "Research Writer" | Ingests URLs, PDFs, and findings into the memory graph |
359
+ | **Chat Pipeline** (`chat/pipeline.py`) | The "Conversation Writer" | Stores conversation turns with semantic embeddings |
360
+ | **MCP Server** (`server/app.py`) | The "Interface" | Exposes all memory domains to AI agents via MCP protocol |
361
+
362
+ ---
363
+
364
+ ## ๐Ÿ”Œ MCP Tools Available to AI Agents
365
+
366
+ ### Unified search
367
+
368
+ | Tool | Description |
369
+ |------|-------------|
370
+ | `search_all_memory(query)` | Search across all domains โ€” code, research, and conversations โ€” in one call |
371
+
372
+ ### Code domain
373
+
374
+ | Tool | Description |
375
+ |------|-------------|
376
+ | `search_codebase(query, limit=5)` | Semantic search over code |
377
+ | `get_file_dependencies(file_path)` | Returns imports and dependents for a file |
378
+ | `identify_impact(file_path, max_depth=3)` | Blast radius analysis for changes |
379
+ | `get_file_info(file_path)` | File structure overview (classes, functions) |
380
+ | `trace_execution_path(start_symbol, max_depth=2, force_refresh=false)` | On-demand behavioral tracing for one function root |
381
+
382
+ ### Conversation domain
383
+
384
+ | Tool | Description |
385
+ |------|-------------|
386
+ | `search_conversations(query, limit=5)` | Semantic search over past conversation turns |
387
+ | `get_conversation_context(session_id)` | Retrieve a full conversation context window |
388
+ | `add_message(role, content, session_id)` | Store a new message in conversation memory |
389
+
390
+ ### Research domain
391
+
392
+ | Tool | Description |
393
+ |------|-------------|
394
+ | `schedule_research(project_id, query, interval)` | Schedule recurring research sessions |
395
+ | `run_research_session(project_id)` | Run a research session immediately |
396
+ | `list_research_schedules(project_id)` | List active research schedules |
397
+
398
+ ### Git domain (opt-in)
399
+
400
+ | Tool | Description |
401
+ |------|-------------|
402
+ | `get_git_file_history(file_path, limit=20)` | File-level commit history and ownership signals |
403
+ | `get_commit_context(sha, include_diff_stats=true)` | Commit metadata and change statistics |
404
+ | `find_recent_risky_changes(path_or_symbol, window_days)` | Recent high-risk changes using hybrid signals |
405
+
406
+ > Note: Git-domain tools are part of the git graph rollout. If missing in your build, run `agentic-memory git-init` first.
407
+
408
+ ---
409
+
410
+ ## ๐Ÿ—‚๏ธ Memory Domains
411
+
412
+ | Domain | What Gets Stored | Graph Nodes |
413
+ |--------|-----------------|-------------|
414
+ | **Code** | Source files, functions, classes, imports | `File`, `Function`, `Class`, `Chunk` |
415
+ | **Conversations** | Agent/user message turns, session context | `ConversationTurn`, `Session` |
416
+ | **Research** | Web pages, PDFs, reports, findings, claims | `Report`, `Finding`, `Chunk`, `Source` |
417
+ | **Git** | Commits, authors, file versions, diffs | `Commit`, `Author`, `FileVersion` |
418
+
419
+ ---
420
+
421
+ ## โฑ๏ธ Experimental Temporal GraphRAG
422
+
423
+ Phase 8 adds a shadow-mode temporal maintenance layer alongside the existing Neo4j graph:
424
+
425
+ - `packages/am-temporal-kg/` โ€” SpacetimeDB TypeScript module for temporal edge ingest, scheduled maintenance, and deterministic temporal retrieval
426
+ - `packages/am-sync-neo4j/` โ€” subscription worker that mirrors curated temporal rows back into Neo4j
427
+
428
+ This layer is additive. Existing retrieval paths remain unchanged until the later retrieval cutover phase.
429
+
430
+ ---
431
+
432
+ ## ๐Ÿ–ฅ๏ธ Full-Stack Local Flow
433
+
434
+ A unified search surface spans code, research, and conversation memory:
435
+
436
+ - MCP: `search_all_memory(...)`
437
+ - REST: `GET /search/all`
438
+
439
+ A local product control plane handles install and dogfood loops:
440
+
441
+ - CLI: `agentic-memory product-status`, `agentic-memory product-repo-add`, `agentic-memory product-integration-set`, `agentic-memory product-component-set`, `agentic-memory product-event-record`
442
+ - REST: `GET /product/status`, `POST /product/repos`, `POST /product/integrations`, `POST /product/components/{component}`, `POST /product/events`, `POST /product/onboarding`
443
+ - Workflow: [docs/PRODUCT_DOGFOODING.md](docs/PRODUCT_DOGFOODING.md)
444
+
445
+ A lightweight local FastAPI app in `desktop_shell/` provides a browser-based control plane:
446
+
447
+ ```bash
448
+ python -m am_server.server
449
+ python -m desktop_shell --backend-url http://127.0.0.1:8765
450
+ ```
451
+
452
+ Reference docs:
453
+
454
+ - [docs/SETUP_FULL_STACK.md](docs/SETUP_FULL_STACK.md)
455
+ - [docs/MCP_TOOL_REFERENCE.md](docs/MCP_TOOL_REFERENCE.md)
456
+ - [docs/PROVIDER_CONFIGURATION.md](docs/PROVIDER_CONFIGURATION.md)
457
+ - [docs/research/RERANKERS_PRIMER.md](docs/research/RERANKERS_PRIMER.md)
458
+ - [docs/research/RERANKERS_CROSS_DOMAIN_USE_CASES.md](docs/research/RERANKERS_CROSS_DOMAIN_USE_CASES.md)
459
+ - [docs/research/RERANKING_DECISION_MEMO.md](docs/research/RERANKING_DECISION_MEMO.md)
460
+ - [docs/SPACETIMEDB_OPERATIONS.md](docs/SPACETIMEDB_OPERATIONS.md)
461
+ - [docs/PRODUCT_DOGFOODING.md](docs/PRODUCT_DOGFOODING.md)
462
+
463
+ ---
464
+
465
+ ## โœ… Integration Recommendation Policy
466
+
467
+ Current recommendation policy is explicit:
468
+
469
+ 1. **Recommended default:** `mcp_native` integration for production reliability.
470
+ 2. **Optional path:** `skill_adapter` workflow for shell/script-driven operators.
471
+ 3. **Promotion rule:** `skill_adapter` becomes first-class only after parity evidence
472
+ is captured versus `mcp_native` across success rate, latency, token cost, retries,
473
+ and operator steps.
474
+
475
+ Reference docs and evaluation artifacts:
476
+
477
+ - [docs/evaluation-decision.md](docs/evaluation-decision.md)
478
+ - [evaluation/README.md](evaluation/README.md)
479
+ - [evaluation/tasks/benchmark_tasks.json](evaluation/tasks/benchmark_tasks.json)
480
+ - [evaluation/schemas/benchmark_results.schema.json](evaluation/schemas/benchmark_results.schema.json)
481
+ - [evaluation/skills/skill-adapter-workflow.md](evaluation/skills/skill-adapter-workflow.md)
482
+
483
+ ---
484
+
485
+ ## ๐Ÿณ Docker Setup (Neo4j)
486
+
487
+ ```bash
488
+ # Start Neo4j
489
+ docker-compose up -d neo4j
490
+
491
+ # Neo4j will be available at:
492
+ # HTTP: http://localhost:7474
493
+ # Bolt: bolt://localhost:7687
494
+ # Username: neo4j
495
+ # Password: password (change this in production!)
496
+ ```
497
+
498
+ ### Neo4j Aura (Cloud)
499
+
500
+ Get a free instance at [neo4j.com/cloud/aura/](https://neo4j.com/cloud/aura/)
501
+
502
+ ---
503
+
504
+ ## ๐Ÿ“ Configuration
505
+
506
+ Per-repository configuration is stored in `.agentic-memory/config.json`:
507
+
508
+ ```json
509
+ {
510
+ "neo4j": {
511
+ "uri": "bolt://localhost:7687",
512
+ "user": "neo4j",
513
+ "password": "password"
514
+ },
515
+ "openai": {
516
+ "api_key": "sk-..."
517
+ },
518
+ "indexing": {
519
+ "ignore_dirs": ["node_modules", "__pycache__", ".git"],
520
+ "extensions": [".py", ".js", ".ts", ".tsx", ".jsx"]
521
+ }
522
+ }
523
+ ```
524
+
525
+ **Note:** `.agentic-memory/` is gitignored by default to prevent committing API keys.
526
+
527
+ ---
528
+
529
+ ## ๐Ÿ”Œ MCP Integration
530
+
531
+ ### Claude Desktop
532
+
533
+ ```json
534
+ {
535
+ "mcpServers": {
536
+ "agentic-memory": {
537
+ "command": "agentic-memory",
538
+ "args": ["serve", "--repo", "/absolute/path/to/your/project"]
539
+ }
540
+ }
541
+ }
542
+ ```
543
+
544
+ ### Cursor IDE
545
+
546
+ ```json
547
+ {
548
+ "mcpServers": {
549
+ "agentic-memory": {
550
+ "command": "agentic-memory",
551
+ "args": ["serve", "--repo", "/absolute/path/to/your/project", "--port", "8000"]
552
+ }
553
+ }
554
+ }
555
+ ```
556
+
557
+ ### Windsurf
558
+
559
+ Add to your MCP configuration file.
560
+
561
+ > Note: If your installed version does not support `--repo`, use your client's `cwd` setting or launch via a wrapper script: `cd /absolute/path/to/project && agentic-memory serve`.
562
+
563
+ ---
564
+
565
+ ## ๐Ÿ”ง Installation from Source
566
+
567
+ ```bash
568
+ git clone https://github.com/jarmen423/agentic-memory.git
569
+ cd agentic-memory
570
+ pip install -e .
571
+ agentic-memory init
572
+ ```
573
+
574
+ ---
575
+
576
+ ## ๐Ÿงช Development
577
+
578
+ ```bash
579
+ pip install -e .
580
+ mypy src/agentic_memory
581
+ pytest
582
+ ```
583
+
584
+ ---
585
+
586
+ ## ๐Ÿ“ License
587
+
588
+ MIT License - see LICENSE file for details.
589
+
590
+ ---
591
+
592
+ ## ๐Ÿค Contributing
593
+
594
+ Contributions welcome! Please see TODO.md for the roadmap.
595
+
596
+ ---
597
+
598
+ ## ๐Ÿ™ Acknowledgments
599
+
600
+ - **Neo4j** - Graph database with vector search
601
+ - **Tree-sitter** - Incremental parsing for code
602
+ - **Google Gemini** - Default embedding provider for multimodal memory alignment
603
+ - **MCP (Model Context Protocol)** - Standard interface for AI tools
604
+ - **SpacetimeDB** - Temporal graph layer