omni-memory-agent 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 (35) hide show
  1. omni_memory_agent-0.1.0/LICENSE +21 -0
  2. omni_memory_agent-0.1.0/MANIFEST.in +3 -0
  3. omni_memory_agent-0.1.0/PKG-INFO +104 -0
  4. omni_memory_agent-0.1.0/PLAN.md +290 -0
  5. omni_memory_agent-0.1.0/README.md +85 -0
  6. omni_memory_agent-0.1.0/omni_memory/__init__.py +6 -0
  7. omni_memory_agent-0.1.0/omni_memory/__main__.py +6 -0
  8. omni_memory_agent-0.1.0/omni_memory/artifacts.py +57 -0
  9. omni_memory_agent-0.1.0/omni_memory/branch.py +46 -0
  10. omni_memory_agent-0.1.0/omni_memory/cleanup.py +80 -0
  11. omni_memory_agent-0.1.0/omni_memory/cli.py +341 -0
  12. omni_memory_agent-0.1.0/omni_memory/context.py +70 -0
  13. omni_memory_agent-0.1.0/omni_memory/digest.py +62 -0
  14. omni_memory_agent-0.1.0/omni_memory/gitmeta.py +137 -0
  15. omni_memory_agent-0.1.0/omni_memory/graph/__init__.py +4 -0
  16. omni_memory_agent-0.1.0/omni_memory/graphbuild.py +37 -0
  17. omni_memory_agent-0.1.0/omni_memory/inject.py +50 -0
  18. omni_memory_agent-0.1.0/omni_memory/install.py +88 -0
  19. omni_memory_agent-0.1.0/omni_memory/llm.py +132 -0
  20. omni_memory_agent-0.1.0/omni_memory/rank.py +130 -0
  21. omni_memory_agent-0.1.0/omni_memory/serve.py +90 -0
  22. omni_memory_agent-0.1.0/omni_memory/session_memory.py +141 -0
  23. omni_memory_agent-0.1.0/omni_memory/skills/omni-memory/SKILL.md +60 -0
  24. omni_memory_agent-0.1.0/omni_memory/staleness.py +69 -0
  25. omni_memory_agent-0.1.0/omni_memory/static/index.html +224 -0
  26. omni_memory_agent-0.1.0/omni_memory/store.py +244 -0
  27. omni_memory_agent-0.1.0/omni_memory_agent.egg-info/PKG-INFO +104 -0
  28. omni_memory_agent-0.1.0/omni_memory_agent.egg-info/SOURCES.txt +33 -0
  29. omni_memory_agent-0.1.0/omni_memory_agent.egg-info/dependency_links.txt +1 -0
  30. omni_memory_agent-0.1.0/omni_memory_agent.egg-info/entry_points.txt +2 -0
  31. omni_memory_agent-0.1.0/omni_memory_agent.egg-info/requires.txt +10 -0
  32. omni_memory_agent-0.1.0/omni_memory_agent.egg-info/top_level.txt +1 -0
  33. omni_memory_agent-0.1.0/pyproject.toml +28 -0
  34. omni_memory_agent-0.1.0/setup.cfg +4 -0
  35. omni_memory_agent-0.1.0/setup.py +5 -0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Abhinav Singh
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,3 @@
1
+ include LICENSE README.md PLAN.md
2
+ recursive-include omni_memory/static *.html
3
+ recursive-include omni_memory/skills *
@@ -0,0 +1,104 @@
1
+ Metadata-Version: 2.4
2
+ Name: omni-memory-agent
3
+ Version: 0.1.0
4
+ Summary: Persistent, branch-aware, git-anchored memory & context layer for coding agents.
5
+ Author: Abhinav Singh
6
+ License: MIT
7
+ Keywords: ai,memory,coding-agent,knowledge-graph,claude-code,mcp
8
+ Requires-Python: >=3.9
9
+ Description-Content-Type: text/markdown
10
+ License-File: LICENSE
11
+ Provides-Extra: graph
12
+ Requires-Dist: networkx>=3.0; extra == "graph"
13
+ Provides-Extra: serve
14
+ Requires-Dist: fastapi>=0.110; extra == "serve"
15
+ Requires-Dist: uvicorn>=0.29; extra == "serve"
16
+ Provides-Extra: dev
17
+ Requires-Dist: pytest>=7.0; extra == "dev"
18
+ Dynamic: license-file
19
+
20
+ # ◇ OmniMemory
21
+
22
+ **The memory & context layer for coding agents** — persistent, branch-aware,
23
+ git-anchored, fully local. Your AI stops forgetting between chats and stops
24
+ hallucinating architecture it never verified.
25
+
26
+ > Plugs into **Claude Code** and **Antigravity** (more IDEs coming). Toggle with
27
+ > `/omni-memory`. Browse everything in a minimalist local dashboard.
28
+
29
+ ## Install
30
+
31
+ **Option A — Claude Code plugin (no pip needed).** The zero-dependency engine
32
+ rides along inside the plugin, so this is all it takes:
33
+
34
+ ```
35
+ /plugin marketplace add SinghAbhinav04/Omni-Memory
36
+ /plugin install omni-memory@singhabhinav
37
+ ```
38
+
39
+ That wires the skill + the capture/inject hooks automatically. Just work — memory
40
+ injects on every prompt and updates itself when a session ends.
41
+
42
+ **Option B — pip (gives you the `omni-memory` CLI everywhere).**
43
+
44
+ ```bash
45
+ pip install omni-memory-agent # or, from a clone: python -m pip install -e .
46
+ omni-memory install # wire it into Claude Code (the CLI is `omni-memory`)
47
+ omni-memory build # one-time: seed memory from the repo (optional)
48
+ omni-memory status
49
+ ```
50
+
51
+ The core is **zero-dependency** (Python stdlib + SQLite) and runs with **no API
52
+ key**. Set `GEMINI_API_KEY` (or Anthropic/OpenAI) only if you want the AI-written
53
+ build pass and artifacts.
54
+
55
+ ## What it does
56
+ - **Remembers** decisions, facts, request/data flows, gotchas — automatically at
57
+ the end of each session, and on demand.
58
+ - **Branch-aware** — memory is scoped to your git branch; tracks branch creator,
59
+ timeline, and merge status. Merged branches roll into the base.
60
+ - **Enforced** — injects a *VERIFIED PROJECT MEMORY* block into prompts and makes
61
+ the agent cite what it used, or admit "not in memory" instead of inventing.
62
+ - **Relevant** — an IDF-tiered ranker surfaces the few memories that actually
63
+ match your prompt + the files in play, instead of dumping everything.
64
+ - **Self-checking** — `omni-memory check` re-anchors memories against git and
65
+ flags any whose files changed since they were written as ⚠ stale.
66
+ - **Clean** — an extraction-noise filter keeps aspirational prose and doc
67
+ boilerplate out of the store.
68
+ - **Graph + dashboard** — `omni-memory ui` opens a local UI: browsable memory
69
+ docs, the knowledge graph, and the repo/branch graph.
70
+
71
+ ## Commands
72
+ ```
73
+ omni-memory status | on | off | branch-aware
74
+ omni-memory build # one-time: AI-written facts from the repo + docs
75
+ omni-memory ui # local dashboard (graph + memory docs + repo graph)
76
+ omni-memory map # (re)build the knowledge graph
77
+ omni-memory check # re-anchor vs git; flag stale memories
78
+ omni-memory recall <q> # query memory instead of grepping
79
+ omni-memory branches # git topology + per-branch memory
80
+ omni-memory remember "…" [--kind decision|fact|flow|gotcha|todo|…]
81
+ omni-memory forget <id>
82
+ omni-memory digest # (re)write the MEMORY.md knowledge base
83
+ omni-memory artifact [apimap|linkup|all] # AI-written cross-reference docs
84
+ omni-memory key <gemini|anthropic|openai> # store a model key securely (chmod 600)
85
+ omni-memory install [--platform claude-code|antigravity]
86
+ ```
87
+
88
+ ## How it works
89
+ ```
90
+ CAPTURE (session + git) → STORE (SQLite, branch-tagged) → RANK + INJECT + ENFORCE
91
+ → CHECK (staleness vs git) → VISUALIZE (dashboard)
92
+ ```
93
+ Capture fires from deterministic harness events (`UserPromptSubmit` → inject,
94
+ `SessionEnd` → capture) — never left to the agent's goodwill. Local-first, no
95
+ cloud, no paid data. See [`PLAN.md`](PLAN.md) for the full architecture and roadmap.
96
+
97
+ ## Status
98
+ Core is in: store · git provenance · branch-aware scoping · capture/inject/enforce
99
+ · IDF relevance ranker · staleness anchoring · noise filter · `map` · dashboard
100
+ (knowledge graph + repo/branch graph). Roadmap: Antigravity via MCP, tree-sitter
101
+ AST code graph, runtime request-flow capture. See `PLAN.md`.
102
+
103
+ ## License
104
+ MIT © 2026 Abhinav Singh
@@ -0,0 +1,290 @@
1
+ # OmniMemory — the memory & context layer for coding agents
2
+
3
+ > **One line:** the memory layer that actually remembers your *architecture* —
4
+ > branch-aware, flow-aware, git-anchored, fully local, across every chat and IDE.
5
+
6
+ Your AI coding agent forgets everything between chats, re-greps the same files,
7
+ and hallucinates architecture it never verified. OmniMemory is a persistent,
8
+ self-updating, graph-backed memory that plugs into Claude Code and Antigravity
9
+ (more IDEs later), keeps learning as you work, and **forces the agent to use
10
+ verified project memory instead of guessing** — with a minimalist local
11
+ dashboard to browse it all.
12
+
13
+ ---
14
+
15
+ ## 0. Positioning & why it wins
16
+
17
+ Most memory tools do *one* of these well; OmniMemory owns the intersection —
18
+ and adds the pieces none of them cover:
19
+
20
+ | Capability | OmniMemory |
21
+ |---|---|
22
+ | Local code knowledge graph (AST) | ✅ |
23
+ | Evolving conversational memory | ✅ (local, zero-cloud) |
24
+ | Contradiction handling + forgetting | ✅ |
25
+ | Multi-IDE skill install + MCP | ✅ |
26
+ | **Branch-aware memory + git provenance** | ✅ ⭐ |
27
+ | **Staleness anchoring (memory re-verified against code changes)** | ✅ ⭐ |
28
+ | **Runtime request-flow capture (real params/returns)** | ✅ ⭐ |
29
+ | **Enforced usage (anti-hallucination)** | ✅ ⭐ |
30
+ | **Local dashboard (graph + readable memory docs + repo graph)** | ✅ ⭐ |
31
+ | Fully local / free | ✅ |
32
+
33
+ The ⭐ rows + the local dashboard are the reason-to-exist and the star magnet.
34
+ Viral demo: *"switch to my feature branch → it already knows what changed there,
35
+ who started it, and whether it merged."*
36
+
37
+ ---
38
+
39
+ ## 1. Module map
40
+
41
+ **Core (built, zero-dep):**
42
+ - `store.py` — SQLite store + schema, contradiction/supersede, staleness columns
43
+ - `session_memory.py` — SessionEnd capture (transcript+diff → memories)
44
+ - `cleanup.py` — extraction-noise filter (anchored facts in, doc prose out)
45
+ - `rank.py` — IDF-tiered relevance ranker for retrieval
46
+ - `staleness.py` — flag memories whose files changed since they were written
47
+ - `inject.py` — prompt injection + enforcement (cite [id]s or "not in memory")
48
+ - `branch.py` / `gitmeta.py` — branch-aware scoping + git provenance
49
+ - `graphbuild.py` — knowledge graph from memory + git topology
50
+ - `digest.py` / `artifacts.py` — MEMORY.md + AI-written api-map / linkup
51
+ - `llm.py` / `context.py` — optional model layer (key-optional) + repo snapshot
52
+ - `serve.py` + `static/` — local dashboard (graph · memory docs · repo graph)
53
+ - `install.py` — multi-IDE hook/skill wiring
54
+
55
+ **Planned:** `runtime.py` (runtime flow capture), a tree-sitter AST code graph
56
+ under `graph/`, and an MCP server face for non–Claude Code agents.
57
+
58
+ ---
59
+
60
+ ## 2. Commands (`/omni-memory …`) — modular, user-friendly
61
+
62
+ Everything is a toggle/subcommand; nothing is forced on.
63
+
64
+ ```
65
+ /omni-memory status + turn the layer on/off for this project
66
+ /omni-memory on | off enable/disable memory injection
67
+ /omni-memory branch-aware toggle branch-scoped memory (on by default)
68
+ /omni-memory map (re)build the code/knowledge graph
69
+ /omni-memory ui launch the local dashboard (browser)
70
+ /omni-memory graph open the interactive graph view
71
+ /omni-memory recall <q> query memory instead of grepping
72
+ /omni-memory why <x> trace/explain a connection between two things
73
+ /omni-memory branches show the repo git-graph + per-branch memory
74
+ /omni-memory flows show request/call-flow diagrams
75
+ /omni-memory forget <id> drop / archive a stale memory
76
+ /omni-memory status what's remembered, current branch, store size
77
+ /omni-memory install wire into Claude Code + Antigravity
78
+ ```
79
+
80
+ ---
81
+
82
+ ## 3. Architecture — 5 layers (additions only, nothing rebuilt)
83
+
84
+ ```
85
+ CAPTURE ──► STORE ──► SERVE ──► INJECT+ENFORCE ──► VISUALIZE
86
+ (static + (SQLite + (MCP for (prompt hook + (local dashboard:
87
+ chat + graph, agent, citation rules) graph · docs ·
88
+ runtime + branch- HTTP for repo-graph ·
89
+ git) tagged) the UI) flows · timeline)
90
+ ```
91
+
92
+ 1. **Capture**
93
+ - *Static:* AST code graph + DB schema introspection + deps + OpenAPI/endpoints
94
+ - *Conversational:* SessionEnd hook → extract decisions / facts / gotchas / flows
95
+ from the transcript + diff (uses the agent's own model)
96
+ - *Runtime (later):* ingest logs / test runs / optional instrumentation → actual
97
+ params, return shapes, success vs failure paths
98
+ - *Git:* `gitmeta.py` → branch creator, timeline, base, merge commit/date, status
99
+ 2. **Store** — local `.omni-memory/` (SQLite + graph JSON). Every memory tagged
100
+ `branch`, `kind`, `files[]`, `symbols[]`, `status`, `confidence`, `source`,
101
+ linked to commit range. Contradiction-check + supersede + forget.
102
+ 3. **Serve** — `serve.py` runs **MCP** (for the agent) **+ FastAPI** (for the UI)
103
+ over the same store. `/omni-memory install` writes the per-platform config.
104
+ 4. **Inject + Enforce** — a prompt hook retrieves the relevant memories (current
105
+ branch ∪ base + files in context + query) and graph subgraph, injects a
106
+ **"VERIFIED PROJECT MEMORY"** block with rules: *use it, cite the memory IDs
107
+ you relied on, and if it's not in memory say so — don't invent.* Agent reports
108
+ used IDs → logged (proves it's using memory; powers the demo + trust).
109
+ 5. **Visualize** — minimalist monochrome dashboard (see §6).
110
+
111
+ ---
112
+
113
+ ## 4. Data model (SQLite, local)
114
+
115
+ ```
116
+ memory(id, branch, kind[decision|fact|flow|gotcha|todo|api|db|endpoint],
117
+ text, files[], symbols[], commit_range, created, updated,
118
+ status[active|merged|abandoned|superseded], confidence, source,
119
+ supersedes_id)
120
+
121
+ branches(name, creator, created_at, base_branch, ahead, behind,
122
+ status[active|merged|abandoned], merged_at, merge_commit, into_branch)
123
+
124
+ commits(sha, branch, author, date, message, files[])
125
+
126
+ flows(id, name, entry, steps_json[success/failure with params+returns], branch)
127
+
128
+ graph_nodes / graph_edges (branch-tagged; AST code graph)
129
+ memory_commit_link(memory_id, sha)
130
+ ```
131
+
132
+ ---
133
+
134
+ ## 5. Core loop (v1 = continuous memory + enforcement + branch-aware)
135
+
136
+ 1. **Capture** — SessionEnd hook → structured memories tagged with current git
137
+ branch + touched files; contradiction-check, supersede stale.
138
+ 2. **Inject** — prompt hook → relevant memories + subgraph → "VERIFIED PROJECT
139
+ MEMORY" block with enforcement instructions.
140
+ 3. **Branch-aware** — memories filter by branch; git hooks flip `status` on
141
+ branch-switch / merge (merged rolls into base; abandoned is archived).
142
+ `/omni-memory branch-aware` toggles branch-scoping vs global.
143
+ 4. **Enforce** — agent cites used memory IDs; `querylog` records usage.
144
+
145
+ ---
146
+
147
+ ## 6. Frontend — minimalist local dashboard (monochrome, offline)
148
+
149
+ Launched by `/omni-memory ui` → FastAPI serves a **bundled** Vite+React SPA on
150
+ localhost (works offline; ships pre-built in the wheel).
151
+
152
+ **Views:**
153
+ - **Graph** — interactive connected-knowledge graph (d3 force-directed)
154
+ - **Memory** — every stored memory as browsable, searchable "docs"; filter by
155
+ branch / kind / file; click to read full entry + linked files/symbols/commits
156
+ - **Repo Graph** — the git DAG (`@gitgraph/js` or d3): `main` trunk + feature
157
+ branches, merge points + dates + **branch creator**; click a commit/branch →
158
+ the memories attached to it (git history *is* the memory index)
159
+ - **Flows** — request/call-flow diagrams (Mermaid + runtime later)
160
+ - **Timeline** — memory growing over time ("it's alive")
161
+
162
+ **API:** `/api/memories` (list/search/filter) · `/api/memory/:id` · `/api/graph`
163
+ · `/api/branches` · `/api/commits` · `/api/flows`. MCP = agent face, HTTP = UI face.
164
+
165
+ ---
166
+
167
+ ## 7. IDE integration (scope: Claude Code + Antigravity)
168
+
169
+ - **Claude Code:** a `/omni-memory` skill + hooks in settings.json
170
+ (SessionEnd → capture; UserPromptSubmit/PreToolUse → inject+enforce) + MCP
171
+ server for recall tools.
172
+ - **Antigravity:** via the MCP server (same `serve.py`) + its rules/memories
173
+ mechanism.
174
+ - `/omni-memory install` writes both via per-platform config writers.
175
+ - Extensible to Codex / OpenCode / Gemini CLI / VS Code via the same MCP + skill
176
+ pattern.
177
+
178
+ ---
179
+
180
+ ## 7a. Knowledge-base format — the north star (modeled on real usage)
181
+
182
+ OmniMemory's job is to **auto-generate and maintain** the kind of AI knowledge
183
+ base a senior dev builds by hand. Reference: `Documents/work/docs` (a real
184
+ multi-repo BFHL platform kb). We mirror its proven shape:
185
+
186
+ - **Indexed with a reading order** — `MEMORY.md` opens with architecture →
187
+ concepts → flows → events → api-map → db → components, then running notes.
188
+ - **Kinds mapped to that taxonomy:** `decision · concept · flow · event (kafka
189
+ contract) · endpoint (controller→service→repo+params) · db · component ·
190
+ gotcha/known-issue · assumption (verify) · todo · fact`.
191
+ - **Confidence markers** — `EXTRACTED / INFERRED / ASSUMPTION` on every fact.
192
+ - **Two killer auto-generated artifacts (P1/P2, from the AST graph + runtime):**
193
+ - **api-map** — every endpoint → controller → service → repo/downstream with
194
+ DTOs/params/headers (replaces hand-written `api-map.md`).
195
+ - **linkup** — the master cross-reference: Mermaid repo-dependency graph,
196
+ controller→service→repo maps, Kafka producer/consumer contracts, shared
197
+ DBs/code (replaces hand-written `linkup.md`).
198
+ - **Multi-repo aware** — one memory/graph spanning sibling repos, because real
199
+ systems are many repos.
200
+ - **Mermaid** for dependency/flow diagrams in the dashboard + digest.
201
+
202
+ ## 7b. Autonomy & persistence — why this beats other memory tools
203
+
204
+ The failure of every memory tool is that **updating** the memory is left to the
205
+ agent's goodwill — and agents forget. OmniMemory's rule: **never rely on the
206
+ agent to remember to update.** Capture fires from deterministic *harness events*,
207
+ and retrieval is always-on.
208
+
209
+ **Claude Code (hooks = harness-run, not agent-run):**
210
+ - `UserPromptSubmit` → `omni-memory inject` (always injects verified memory).
211
+ - `SessionEnd` / `Stop` → `omni-memory capture` (extracts from transcript+diff
212
+ via a small model, deterministically — no agent decision needed).
213
+ - `PostToolUse(Edit|Write)` → mark graph stale / incremental re-map.
214
+ - The skill + `MEMORY.md` digest are always available for @-reference.
215
+
216
+ **Antigravity (artifacts = always-in-context knowledge):**
217
+ - Write the `MEMORY.md` digest as a persistent **artifact** so it's always
218
+ loaded into context (no re-fetch).
219
+ - Register OmniMemory as an **MCP server** for deep recall + capture tools.
220
+ - Capture on task-complete events where available; else a cadence + the
221
+ staleness nudge below.
222
+
223
+ **Staleness watchdog (the "keep reminding to update" fix):** the store tracks
224
+ `last_capture` + commits since. If stale, the injected block **prepends a
225
+ directive** ("⚠ memory N commits stale — capturing now") and the hook runs
226
+ capture. Automation is the fix; the nudge is only the fallback. Result: the
227
+ knowledge base updates itself as you work, across branches, without you or the
228
+ agent having to remember.
229
+
230
+ ## 8. Repo structure
231
+
232
+ ```
233
+ omni-memory/
234
+ omni_memory/
235
+ cli.py # /omni-memory dispatch
236
+ store.py # SQLite store + schema
237
+ branch.py # branch-aware memory logic
238
+ gitmeta.py # git provenance (creator, timeline, merges)
239
+ session_memory.py # SessionEnd capture (transcript+diff → memories)
240
+ inject.py # prompt injection + enforcement
241
+ runtime.py # runtime flow capture (P2)
242
+ serve.py # MCP + FastAPI
243
+ api.py # HTTP endpoints for the UI
244
+ install.py # multi-IDE wiring
245
+ graph/ # AST code graph (extract/build/cluster/export/callflow)
246
+ static/ # bundled dashboard (single-file HTML)
247
+ web/ # optional richer dashboard build
248
+ skills/omni-memory/ # the skill package (SKILL.md + refs)
249
+ LICENSE(MIT) README.md PLAN.md pyproject.toml
250
+ ```
251
+
252
+ ---
253
+
254
+ ## 9. Phases
255
+
256
+ - **P0 — core** — store + branch model + git metadata + Claude Code capture /
257
+ inject / enforce hooks + `/omni-memory map`. Demoable: persistent,
258
+ branch-aware, enforced memory in Claude Code.
259
+ - **P0.5 — minimal dashboard** — FastAPI + Graph & Memory-docs views (the demo UI).
260
+ - **P1 — branch-aware, full** — git provenance + **Repo Graph** view + Antigravity (MCP).
261
+ - **P2 — runtime flow capture** — endpoint→DB→Kafka→params/returns, success vs failure.
262
+ - **P3 — polish** — contradiction/forgetting tuning, Timeline/Flows views, more
263
+ IDEs, perf, tests. **Launch:** Show HN / Trendshift, demo GIF.
264
+
265
+ ---
266
+
267
+ ## 10. Enhancements / roadmap (post-v1)
268
+
269
+ - **Contradiction & decay tuning** — confidence scoring, auto-expire stale memory.
270
+ - **Team mode** — optional shared memory (git-synced `.omni-memory/` or a light server).
271
+ - **PR/issue ingestion** — pull decisions from PR descriptions & review threads.
272
+ - **"Why did we…" answers** — trace a decision to its commit + chat origin.
273
+ - **Onboarding mode** — new dev asks the repo questions, gets guided tours.
274
+ - **Language coverage** — extend the tree-sitter AST extractors.
275
+ - **Runtime adapters** — OpenTelemetry / log-format plugins for flow capture.
276
+ - **Secrets safety** — redact params/returns; never store credentials.
277
+ - **Export** — GraphML / Obsidian vault of the whole memory.
278
+ - **Eval** — benchmark recall/enforcement (LongMemEval/LoCoMo style) for credibility.
279
+
280
+ ---
281
+
282
+ ## 11. Principles
283
+
284
+ - **Local-first, free.** No mandatory cloud, no paid data. Your code never leaves.
285
+ - **Deterministic where possible.** Code graph via AST (no LLM); LLM only for the
286
+ semantic/conversational layer.
287
+ - **Never guess.** Enforcement makes the agent cite memory or admit it doesn't know.
288
+ - **Minimalist.** Clean monochrome UI, modular toggles, one-command install.
289
+ - **Zero-dependency core.** The whole memory engine runs on the Python stdlib;
290
+ extras (graph analysis, richer serving) are strictly optional.
@@ -0,0 +1,85 @@
1
+ # ◇ OmniMemory
2
+
3
+ **The memory & context layer for coding agents** — persistent, branch-aware,
4
+ git-anchored, fully local. Your AI stops forgetting between chats and stops
5
+ hallucinating architecture it never verified.
6
+
7
+ > Plugs into **Claude Code** and **Antigravity** (more IDEs coming). Toggle with
8
+ > `/omni-memory`. Browse everything in a minimalist local dashboard.
9
+
10
+ ## Install
11
+
12
+ **Option A — Claude Code plugin (no pip needed).** The zero-dependency engine
13
+ rides along inside the plugin, so this is all it takes:
14
+
15
+ ```
16
+ /plugin marketplace add SinghAbhinav04/Omni-Memory
17
+ /plugin install omni-memory@singhabhinav
18
+ ```
19
+
20
+ That wires the skill + the capture/inject hooks automatically. Just work — memory
21
+ injects on every prompt and updates itself when a session ends.
22
+
23
+ **Option B — pip (gives you the `omni-memory` CLI everywhere).**
24
+
25
+ ```bash
26
+ pip install omni-memory-agent # or, from a clone: python -m pip install -e .
27
+ omni-memory install # wire it into Claude Code (the CLI is `omni-memory`)
28
+ omni-memory build # one-time: seed memory from the repo (optional)
29
+ omni-memory status
30
+ ```
31
+
32
+ The core is **zero-dependency** (Python stdlib + SQLite) and runs with **no API
33
+ key**. Set `GEMINI_API_KEY` (or Anthropic/OpenAI) only if you want the AI-written
34
+ build pass and artifacts.
35
+
36
+ ## What it does
37
+ - **Remembers** decisions, facts, request/data flows, gotchas — automatically at
38
+ the end of each session, and on demand.
39
+ - **Branch-aware** — memory is scoped to your git branch; tracks branch creator,
40
+ timeline, and merge status. Merged branches roll into the base.
41
+ - **Enforced** — injects a *VERIFIED PROJECT MEMORY* block into prompts and makes
42
+ the agent cite what it used, or admit "not in memory" instead of inventing.
43
+ - **Relevant** — an IDF-tiered ranker surfaces the few memories that actually
44
+ match your prompt + the files in play, instead of dumping everything.
45
+ - **Self-checking** — `omni-memory check` re-anchors memories against git and
46
+ flags any whose files changed since they were written as ⚠ stale.
47
+ - **Clean** — an extraction-noise filter keeps aspirational prose and doc
48
+ boilerplate out of the store.
49
+ - **Graph + dashboard** — `omni-memory ui` opens a local UI: browsable memory
50
+ docs, the knowledge graph, and the repo/branch graph.
51
+
52
+ ## Commands
53
+ ```
54
+ omni-memory status | on | off | branch-aware
55
+ omni-memory build # one-time: AI-written facts from the repo + docs
56
+ omni-memory ui # local dashboard (graph + memory docs + repo graph)
57
+ omni-memory map # (re)build the knowledge graph
58
+ omni-memory check # re-anchor vs git; flag stale memories
59
+ omni-memory recall <q> # query memory instead of grepping
60
+ omni-memory branches # git topology + per-branch memory
61
+ omni-memory remember "…" [--kind decision|fact|flow|gotcha|todo|…]
62
+ omni-memory forget <id>
63
+ omni-memory digest # (re)write the MEMORY.md knowledge base
64
+ omni-memory artifact [apimap|linkup|all] # AI-written cross-reference docs
65
+ omni-memory key <gemini|anthropic|openai> # store a model key securely (chmod 600)
66
+ omni-memory install [--platform claude-code|antigravity]
67
+ ```
68
+
69
+ ## How it works
70
+ ```
71
+ CAPTURE (session + git) → STORE (SQLite, branch-tagged) → RANK + INJECT + ENFORCE
72
+ → CHECK (staleness vs git) → VISUALIZE (dashboard)
73
+ ```
74
+ Capture fires from deterministic harness events (`UserPromptSubmit` → inject,
75
+ `SessionEnd` → capture) — never left to the agent's goodwill. Local-first, no
76
+ cloud, no paid data. See [`PLAN.md`](PLAN.md) for the full architecture and roadmap.
77
+
78
+ ## Status
79
+ Core is in: store · git provenance · branch-aware scoping · capture/inject/enforce
80
+ · IDF relevance ranker · staleness anchoring · noise filter · `map` · dashboard
81
+ (knowledge graph + repo/branch graph). Roadmap: Antigravity via MCP, tree-sitter
82
+ AST code graph, runtime request-flow capture. See `PLAN.md`.
83
+
84
+ ## License
85
+ MIT © 2026 Abhinav Singh
@@ -0,0 +1,6 @@
1
+ """OmniMemory — the memory & context layer for coding agents.
2
+
3
+ Local-first, branch-aware, git-anchored, enforced.
4
+ """
5
+
6
+ __version__ = "0.1.0"
@@ -0,0 +1,6 @@
1
+ import sys
2
+
3
+ from .cli import main
4
+
5
+ if __name__ == "__main__":
6
+ sys.exit(main())
@@ -0,0 +1,57 @@
1
+ """AI-written doc artifacts — api-map.md and linkup.md.
2
+
3
+ Modeled on the hand-written work/docs kb: an endpoint→service→repo API map and a
4
+ master cross-reference (Mermaid dependency graph + controller/service/repo maps +
5
+ Kafka contracts + shared DBs/code). These regenerate from the live codebase so
6
+ they never drift.
7
+ """
8
+ from __future__ import annotations
9
+
10
+ from pathlib import Path
11
+
12
+ from . import context, llm
13
+ from .store import Store
14
+
15
+ APIMAP_PROMPT = """\
16
+ You are OmniMemory generating `api-map.md` for this repository. Output ONLY
17
+ GitHub-flavored Markdown (no preamble). Structure:
18
+ - A short header: base path / auth headers if evident.
19
+ - One section per controller/route group, each with a table:
20
+ | Method | Path | Request (DTO/params) | Flow: Controller -> Service -> Repository/downstream |
21
+ Be specific: real controller/service/repo class names, real paths, real DTOs,
22
+ real downstreams (DB, Kafka topic, external API). Note Kafka publishes as
23
+ `-> Kafka <topic>`. If a detail is inferred, append `(inferred)`. Base it strictly
24
+ on the code below — do not invent endpoints.
25
+ """
26
+
27
+ LINKUP_PROMPT = """\
28
+ You are OmniMemory generating `linkup.md`, the master cross-reference. Output ONLY
29
+ Markdown. Include, in order:
30
+ 1. `## Dependency graph` — a Mermaid ```mermaid graph LR``` of repos/services/DBs/
31
+ queues and how they call each other (REST, Kafka topics, shared DB).
32
+ 2. `## Controller -> Service -> Repository` — a table of the main call chains.
33
+ 3. `## Event contracts` — Kafka topics with producer(s) and consumer(s).
34
+ 4. `## Shared data & code` — shared DBs/collections and shared utility classes.
35
+ Use real names from the code below. Mark inferred items `(inferred)`. No preamble.
36
+ """
37
+
38
+
39
+ def _generate(root: Path, prompt: str) -> str:
40
+ ctx = context.gather(root)
41
+ return llm.complete(prompt, ctx).strip()
42
+
43
+
44
+ def generate_apimap(store: Store, root: Path) -> Path:
45
+ out = store.dir / "api-map.md"
46
+ out.write_text(_generate(root, APIMAP_PROMPT) + "\n")
47
+ return out
48
+
49
+
50
+ def generate_linkup(store: Store, root: Path) -> Path:
51
+ out = store.dir / "linkup.md"
52
+ out.write_text(_generate(root, LINKUP_PROMPT) + "\n")
53
+ return out
54
+
55
+
56
+ def generate_all(store: Store, root: Path) -> list[Path]:
57
+ return [generate_apimap(store, root), generate_linkup(store, root)]
@@ -0,0 +1,46 @@
1
+ """Branch-aware memory: sync git topology into the store, resolve scope."""
2
+ from __future__ import annotations
3
+
4
+ from pathlib import Path
5
+ from typing import Optional
6
+
7
+ from . import gitmeta
8
+ from .store import Store
9
+
10
+
11
+ def sync_git(store: Store, root: Path) -> dict:
12
+ """Pull the current git topology into the store. Returns the snapshot."""
13
+ snap = gitmeta.snapshot(root)
14
+ for b in snap["branches"]:
15
+ store.upsert_branch(**b)
16
+ for c in snap["commits"]:
17
+ store.upsert_commit(c["sha"], c["branch"], c["author"], c["date"],
18
+ c["message"], c["files"])
19
+ store.set_meta("default_branch", snap["default"])
20
+ from . import staleness
21
+ staleness.recompute(store, root)
22
+ return snap
23
+
24
+
25
+ def scope(store: Store, root: Path) -> tuple[str, Optional[str]]:
26
+ """(current_branch, base_branch|None) honoring the branch-aware toggle.
27
+
28
+ branch-aware ON → memory for current branch + its base.
29
+ branch-aware OFF → all branches (base returned as None, current as '*').
30
+ """
31
+ if not store.get_meta("branch_aware", True):
32
+ return "*", None
33
+ cur = gitmeta.current_branch(root)
34
+ base = store.get_meta("default_branch") or gitmeta.default_branch(root)
35
+ return cur, (base if base != cur else None)
36
+
37
+
38
+ def on_branch_change(store: Store, root: Path) -> None:
39
+ """Re-sync topology; flip merged branches' memories to 'merged' status."""
40
+ snap = sync_git(store, root)
41
+ for b in snap["branches"]:
42
+ if b["status"] == "merged":
43
+ store.db.execute(
44
+ "UPDATE memory SET status='merged' "
45
+ "WHERE branch=? AND status='active'", (b["name"],))
46
+ store.db.commit()