genesis-memory 0.6.1__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 (88) hide show
  1. genesis_memory-0.6.1/LICENSE +21 -0
  2. genesis_memory-0.6.1/PKG-INFO +259 -0
  3. genesis_memory-0.6.1/README.md +238 -0
  4. genesis_memory-0.6.1/genesis_memory/__init__.py +2 -0
  5. genesis_memory-0.6.1/genesis_memory/cli/__init__.py +1 -0
  6. genesis_memory-0.6.1/genesis_memory/cli/client_registry.py +742 -0
  7. genesis_memory-0.6.1/genesis_memory/cli/config_formats.py +199 -0
  8. genesis_memory-0.6.1/genesis_memory/cli/doctor.py +168 -0
  9. genesis_memory-0.6.1/genesis_memory/cli/export_config.py +169 -0
  10. genesis_memory-0.6.1/genesis_memory/cli/init_cmd.py +431 -0
  11. genesis_memory-0.6.1/genesis_memory/cli/jsonc_merger.py +97 -0
  12. genesis_memory-0.6.1/genesis_memory/cli/run.py +503 -0
  13. genesis_memory-0.6.1/genesis_memory/cli/templates/opencode_plugin.js +349 -0
  14. genesis_memory-0.6.1/genesis_memory/cli/update_checker.py +160 -0
  15. genesis_memory-0.6.1/genesis_memory/core/__init__.py +1 -0
  16. genesis_memory-0.6.1/genesis_memory/core/ast_edge_extractor.py +289 -0
  17. genesis_memory-0.6.1/genesis_memory/core/db.py +160 -0
  18. genesis_memory-0.6.1/genesis_memory/core/hebbian_engine.py +229 -0
  19. genesis_memory-0.6.1/genesis_memory/core/licensing.py +277 -0
  20. genesis_memory-0.6.1/genesis_memory/core/privacy_shield.py +243 -0
  21. genesis_memory-0.6.1/genesis_memory/core/skill_synthesizer.py +225 -0
  22. genesis_memory-0.6.1/genesis_memory/core/team_sync.py +411 -0
  23. genesis_memory-0.6.1/genesis_memory/core/verification_trap.py +285 -0
  24. genesis_memory-0.6.1/genesis_memory/daemon/__init__.py +1 -0
  25. genesis_memory-0.6.1/genesis_memory/daemon/server.py +1340 -0
  26. genesis_memory-0.6.1/genesis_memory/dashboard/__init__.py +1 -0
  27. genesis_memory-0.6.1/genesis_memory/dashboard/server.py +760 -0
  28. genesis_memory-0.6.1/genesis_memory/dashboard/static/index.html +755 -0
  29. genesis_memory-0.6.1/genesis_memory/data/llms.txt +59 -0
  30. genesis_memory-0.6.1/genesis_memory/data/openapi.json +1 -0
  31. genesis_memory-0.6.1/genesis_memory/eval/__init__.py +1 -0
  32. genesis_memory-0.6.1/genesis_memory/eval/step4_harness.py +972 -0
  33. genesis_memory-0.6.1/genesis_memory/hooks/__init__.py +1 -0
  34. genesis_memory-0.6.1/genesis_memory/hooks/subconscious_hook.py +763 -0
  35. genesis_memory-0.6.1/genesis_memory/proxy/__init__.py +1 -0
  36. genesis_memory-0.6.1/genesis_memory/proxy/anaphora_rewriter.py +155 -0
  37. genesis_memory-0.6.1/genesis_memory/proxy/content_compressor.py +292 -0
  38. genesis_memory-0.6.1/genesis_memory/proxy/dialogue_synthesizer.py +136 -0
  39. genesis_memory-0.6.1/genesis_memory/proxy/launcher.py +217 -0
  40. genesis_memory-0.6.1/genesis_memory/proxy/pricing_catalog.json +3066 -0
  41. genesis_memory-0.6.1/genesis_memory/proxy/pricing_engine.py +304 -0
  42. genesis_memory-0.6.1/genesis_memory/proxy/proxy_server.py +1598 -0
  43. genesis_memory-0.6.1/genesis_memory/proxy/pytest_spool.py +59 -0
  44. genesis_memory-0.6.1/genesis_memory/proxy/spool.py +459 -0
  45. genesis_memory-0.6.1/genesis_memory/proxy/structured_distiller.py +240 -0
  46. genesis_memory-0.6.1/genesis_memory/proxy/summary_parser.py +219 -0
  47. genesis_memory-0.6.1/genesis_memory/proxy/supervisor.py +261 -0
  48. genesis_memory-0.6.1/genesis_memory/proxy/tool_compactor.py +393 -0
  49. genesis_memory-0.6.1/genesis_memory/sleep/__init__.py +1 -0
  50. genesis_memory-0.6.1/genesis_memory/sleep/digest_generator.py +104 -0
  51. genesis_memory-0.6.1/genesis_memory/sleep/end_session.py +278 -0
  52. genesis_memory-0.6.1/genesis_memory/sleep/sleep_consolidation.py +123 -0
  53. genesis_memory-0.6.1/genesis_memory/sleep/sleep_daemon.py +285 -0
  54. genesis_memory-0.6.1/genesis_memory.egg-info/PKG-INFO +259 -0
  55. genesis_memory-0.6.1/genesis_memory.egg-info/SOURCES.txt +86 -0
  56. genesis_memory-0.6.1/genesis_memory.egg-info/dependency_links.txt +1 -0
  57. genesis_memory-0.6.1/genesis_memory.egg-info/entry_points.txt +6 -0
  58. genesis_memory-0.6.1/genesis_memory.egg-info/requires.txt +11 -0
  59. genesis_memory-0.6.1/genesis_memory.egg-info/top_level.txt +1 -0
  60. genesis_memory-0.6.1/pyproject.toml +51 -0
  61. genesis_memory-0.6.1/setup.cfg +4 -0
  62. genesis_memory-0.6.1/tests/test_challenge_rule.py +283 -0
  63. genesis_memory-0.6.1/tests/test_client_registry.py +199 -0
  64. genesis_memory-0.6.1/tests/test_commercial_integration.py +354 -0
  65. genesis_memory-0.6.1/tests/test_content_compressor.py +148 -0
  66. genesis_memory-0.6.1/tests/test_dashboard_server.py +217 -0
  67. genesis_memory-0.6.1/tests/test_db_hardening.py +226 -0
  68. genesis_memory-0.6.1/tests/test_dialogue_buffer.py +668 -0
  69. genesis_memory-0.6.1/tests/test_distiller_and_rewriter.py +355 -0
  70. genesis_memory-0.6.1/tests/test_genesis_daemon.py +462 -0
  71. genesis_memory-0.6.1/tests/test_genesis_proxy.py +1026 -0
  72. genesis_memory-0.6.1/tests/test_genesis_proxy_production.py +567 -0
  73. genesis_memory-0.6.1/tests/test_hebbian_and_skills.py +350 -0
  74. genesis_memory-0.6.1/tests/test_licensing.py +132 -0
  75. genesis_memory-0.6.1/tests/test_memory_chaos_suite.py +564 -0
  76. genesis_memory-0.6.1/tests/test_onboarding.py +187 -0
  77. genesis_memory-0.6.1/tests/test_pricing_engine.py +42 -0
  78. genesis_memory-0.6.1/tests/test_privacy_redaction.py +117 -0
  79. genesis_memory-0.6.1/tests/test_privacy_shield.py +164 -0
  80. genesis_memory-0.6.1/tests/test_proxy_anthropic_route.py +149 -0
  81. genesis_memory-0.6.1/tests/test_spool.py +404 -0
  82. genesis_memory-0.6.1/tests/test_step4_eval_harness.py +124 -0
  83. genesis_memory-0.6.1/tests/test_step4_oracle.py +194 -0
  84. genesis_memory-0.6.1/tests/test_team_sync.py +429 -0
  85. genesis_memory-0.6.1/tests/test_tool_compactor.py +460 -0
  86. genesis_memory-0.6.1/tests/test_universal_clients.py +297 -0
  87. genesis_memory-0.6.1/tests/test_update_checker.py +60 -0
  88. genesis_memory-0.6.1/tests/test_version.py +23 -0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 GENESIS Project
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,259 @@
1
+ Metadata-Version: 2.4
2
+ Name: genesis-memory
3
+ Version: 0.6.1
4
+ Summary: Universal Cognitive Memory OS, Zero-Trust Privacy Shield & Stateless Token-Diet Gateway for every AI coding agent
5
+ Author: GENESIS Team
6
+ License: MIT
7
+ Requires-Python: >=3.10
8
+ Description-Content-Type: text/markdown
9
+ License-File: LICENSE
10
+ Requires-Dist: fastapi>=0.100.0
11
+ Requires-Dist: uvicorn>=0.22.0
12
+ Requires-Dist: websockets>=11.0
13
+ Requires-Dist: pydantic>=2.0.0
14
+ Requires-Dist: requests>=2.28.0
15
+ Requires-Dist: aiohttp>=3.8.0
16
+ Provides-Extra: dev
17
+ Requires-Dist: pytest>=7.0.0; extra == "dev"
18
+ Requires-Dist: pytest-asyncio>=0.21.0; extra == "dev"
19
+ Requires-Dist: ruff>=0.1.0; extra == "dev"
20
+ Dynamic: license-file
21
+
22
+ <p align="center">
23
+ <img src="site/public/favicon.svg" width="84" alt="GENESIS Memory" />
24
+ </p>
25
+
26
+ <h1 align="center">GENESIS Memory</h1>
27
+
28
+ <p align="center">
29
+ <strong>The persistent brain &amp; token diet for <em>every</em> AI coding agent.</strong>
30
+ </p>
31
+
32
+ <p align="center">
33
+ <img src="https://img.shields.io/badge/tests-421%20passed-22C55E?style=flat-square&logo=pytest" alt="Tests" />
34
+ <img src="https://img.shields.io/badge/version-0.5.0-00F0FF?style=flat-square" alt="Version" />
35
+ <img src="https://img.shields.io/badge/clients-20%20auto--wired-8B5CF6?style=flat-square" alt="Clients" />
36
+ <img src="https://img.shields.io/badge/MCP%20tools-19%20%2B%20gateway-38BDF8?style=flat-square" alt="MCP Tools" />
37
+ <img src="https://img.shields.io/badge/python-3.10%2B-3776AB?style=flat-square&logo=python&logoColor=white" alt="Python" />
38
+ <img src="https://img.shields.io/badge/license-MIT-gray?style=flat-square" alt="License" />
39
+ </p>
40
+
41
+ <p align="center">
42
+ One local SQLite memory shared by <strong>Cursor</strong>, <strong>Claude Code</strong>, <strong>VS Code</strong>, <strong>Zed</strong>, <strong>Windsurf</strong>, <strong>JetBrains</strong>, <strong>Neovim</strong>, <strong>Emacs</strong>, <strong>OpenCode</strong>, <strong>Antigravity</strong>, every terminal agent and every SDK —<br/>
43
+ while collapsing 4,000-line tool outputs into 84-token pointers and scrubbing secrets before they ever touch disk.
44
+ </p>
45
+
46
+ ---
47
+
48
+ ## Why
49
+
50
+ Every AI coding agent has the **Goldfish Effect**: each session starts from nothing. Decisions, invariants, half-finished threads and hard-won debugging insight evaporate. You repeat yourself; the agent re-reads 80k tokens of test output; your bill grows.
51
+
52
+ GENESIS is a **local-first cognitive memory OS** that sits *between* your agents and their models:
53
+
54
+ | Primitive | What it does | Who uses it |
55
+ |---|---|---|
56
+ | **MCP** (stdio) | 19 cognitive tools — `remember`, `recall`, `reinforce`, `challenge_rule`, `attest_closure`, `genesis_log`, … — or a single `genesis` gateway tool that routes them all | Cursor, Claude Code/Desktop, VS Code, Zed, Windsurf, JetBrains, Neovim, Emacs, Codex, Gemini CLI, Amazon Q, Goose, Cline, Roo, Continue |
57
+ | **Hook** (pre-prompt) | Injects a ≤200-token *subconscious capsule*: active thread, last cross-client dialogue turn, matching skills, top engrams, one recall directive | Cursor 1.7 hooks, Claude Code `PrePrompt`, OpenCode plugin, Antigravity |
58
+ | **Proxy** (stateless gateway) | `OPENAI_BASE_URL` / `ANTHROPIC_BASE_URL` → `127.0.0.1:8000`. Structural tool-pair compaction, anaphora rewriting, memory capsule injection, byte-exact SSE relay, fail-open | Any SDK, LangChain, LlamaIndex, CrewAI, AutoGen, Aider, anything with a base URL |
59
+
60
+ Everything is stdlib-only Python, runs under 100 MB RSS, stores to one WAL-mode SQLite file, and never phones home.
61
+
62
+ ---
63
+
64
+ ## Quick start
65
+
66
+ ```bash
67
+ pip install genesis-memory # or: git clone … && pip install -e .
68
+
69
+ genesis setup --preview # read-only: what is installed, what would be wired
70
+ genesis setup --yes # wire every detected client (timestamped backups; --revert undoes)
71
+
72
+ genesis dashboard --open # Mission Control at http://127.0.0.1:8090
73
+ genesis run -- pytest tests/ # headless, spooled, exit-code preserving
74
+ genesis doctor # system diagnostics, client matrix & update check
75
+ genesis upgrade # 1-click self-upgrade to the latest release
76
+ ```
77
+
78
+ Anything not auto-detected:
79
+
80
+ ```bash
81
+ genesis clients # the universal matrix with detection status
82
+ genesis export-config --client zed --format native # exact snippet in the client's own dialect
83
+ genesis export-config --format toml # canonical mcpServers as TOML / yaml / json / env / lua / elisp
84
+ genesis export-config --all --out ./snippets # one file per client
85
+ ```
86
+
87
+ ---
88
+
89
+ ## Universal client support
90
+
91
+ `genesis setup` is a **data-driven registry** (`genesis_memory/cli/client_registry.py`): each client declares where its config lives, how to detect it, which primitives it supports and how to render the patch in its own dialect. JSON/JSONC files are deep-merged (your existing servers and comments survive); YAML/TOML/Lisp/dotenv files get an idempotent `>>> genesis-memory >>>` marker block that re-runs replace and `--revert` removes.
92
+
93
+ | Client | Config | Primitives | Format |
94
+ |---|---|---|---|
95
+ | Cursor | `~/.cursor/mcp.json` + `hooks.json` | MCP · Hook · Proxy | json |
96
+ | Claude Code | `~/.claude/settings.json` + `~/.claude.json` | Hook · MCP · Proxy | json |
97
+ | Claude Desktop | `…/Claude/claude_desktop_config.json` | MCP | json |
98
+ | OpenCode | `~/.config/opencode/opencode.jsonc` + `plugins/genesis-memory.js` | MCP · Proxy · Hook | jsonc |
99
+ | Antigravity IDE | `.agents/` (native) | MCP · Hook | native |
100
+ | Windsurf (Codeium) | `~/.codeium/windsurf/mcp_config.json` | MCP · Proxy | json |
101
+ | Zed | `~/.config/zed/settings.json` → `context_servers` | MCP · Proxy | jsonc |
102
+ | VS Code (Copilot agent mode) | `…/Code/User/mcp.json` → `servers` | MCP · Proxy | jsonc |
103
+ | Cline | `…/saoudrizwan.claude-dev/settings/cline_mcp_settings.json` | MCP · Proxy | json |
104
+ | Roo Code | `…/rooveterinaryinc.roo-cline/settings/mcp_settings.json` | MCP · Proxy | json |
105
+ | Continue.dev | `~/.continue/mcpServers/genesis-memory.yaml` | MCP · Proxy | yaml |
106
+ | JetBrains Junie / AI Assistant | `~/.junie/mcp/mcp.json` | MCP · Proxy | json |
107
+ | Neovim (mcphub · Avante · CodeCompanion · Copilot.lua) | `~/.config/mcphub/servers.json` (+ Lua via export) | MCP · Proxy | json / lua |
108
+ | Emacs (gptel · aidermacs · mcp.el) | `~/.emacs.d/genesis-memory.el` | MCP · Proxy | elisp |
109
+ | Aider | `~/.aider.conf.yml` | Proxy | yaml |
110
+ | OpenAI Codex CLI | `~/.codex/config.toml` | MCP · Proxy | toml |
111
+ | Gemini CLI | `~/.gemini/settings.json` | MCP | json |
112
+ | Amazon Q Developer CLI | `~/.aws/amazonq/mcp.json` | MCP | json |
113
+ | Goose (Block) | `~/.config/goose/config.yaml` | MCP · Proxy | yaml |
114
+ | Any SDK / framework (LangChain, LlamaIndex, CrewAI, AutoGen, OpenAI, Anthropic) | `~/.genesis/genesis.env` | Proxy | env |
115
+
116
+ ```python
117
+ # Zero code changes for any framework: point the base URL at the gateway.
118
+ from openai import OpenAI
119
+ client = OpenAI(base_url="http://127.0.0.1:8000/v1", api_key="not-needed")
120
+ ```
121
+
122
+ ---
123
+
124
+ ## Architecture
125
+
126
+ ```mermaid
127
+ flowchart LR
128
+ subgraph Clients["20 AI clients · any SDK"]
129
+ C1[Cursor] --- C2[Claude Code] --- C3[VS Code / Zed / JetBrains] --- C4[Neovim / Emacs] --- C5[LangChain · CrewAI · …]
130
+ end
131
+ Clients -- "stdio MCP (19 tools)" --> D[genesis-daemon<br/>&lt;100 MB RSS · stdlib only]
132
+ Clients -- "pre-prompt hook<br/>≤200-token capsule" --> H[subconscious_hook.py]
133
+ Clients -- "OPENAI_BASE_URL / ANTHROPIC_BASE_URL" --> P[genesis-proxy :8000<br/>/v1/chat/completions · /v1/messages]
134
+ D & H & P --> S[(memory.db<br/>SQLite WAL · busy 5000ms<br/>BEGIN IMMEDIATE + retry)]
135
+ R[genesis run<br/>headless spooler] -- "redacted bytes" --> SP[(~/.genesis/spool<br/>TTL 7d · LRU 500MB)]
136
+ S --> SL[sleep daemon<br/>Hebbian decay · skills · digest]
137
+ S & SP & P --> M[Mission Control :8090<br/>SSE telemetry · read-only]
138
+ PS[[Privacy Shield<br/>15 patterns + Shannon entropy]] -.guards.-> S & SP
139
+ ```
140
+
141
+ ### Repository layout
142
+
143
+ ```text
144
+ genesis_memory/
145
+ ├── core/
146
+ │ ├── db.py # WAL + busy_timeout + BEGIN IMMEDIATE + jittered retry (shared by every process)
147
+ │ ├── privacy_shield.py # structural patterns + Shannon-entropy detector; redact()/scan()/redact_bytes()
148
+ │ ├── hebbian_engine.py # stability τ, decay, reinforcement
149
+ │ ├── skill_synthesizer.py # recurring outcomes → procedural skills
150
+ │ ├── ast_edge_extractor.py # dependency closure for attest_closure
151
+ │ ├── licensing.py # offline HMAC-SHA256 tiers
152
+ │ └── team_sync.py # enterprise vector-clock sync
153
+ ├── daemon/server.py # stdio MCP daemon · versioned schema · lock-storm resilient dispatch
154
+ ├── hooks/subconscious_hook.py# ≤200-token capsule, ambient turn capture
155
+ ├── proxy/ # aiohttp gateway (OpenAI + Anthropic), compactor, distiller, pricing engine (+ bundled catalog)
156
+ ├── cli/
157
+ │ ├── run.py # genesis CLI · 60+ toolchain headless spooler
158
+ │ ├── client_registry.py # universal data-driven client matrix (20 specs, aliases, dialect renderers)
159
+ │ ├── config_formats.py # dependency-free JSON/YAML/TOML/env emitters + marker-block merger
160
+ │ ├── export_config.py # genesis export-config / genesis clients
161
+ │ ├── init_cmd.py # genesis setup · preview · backup · --revert
162
+ │ └── templates/opencode_plugin.js
163
+ ├── sleep/ # consolidation cycle, digest, ledger
164
+ └── dashboard/ # Mission Control (stdlib HTTP + SSE) and static/index.html cockpit
165
+ site/ # React 19 + Vite 7 landing page with live interactive demos
166
+ tests/ # 421 tests: chaos, concurrency, multi-process, privacy, clients, dashboard, proxy
167
+ ```
168
+
169
+ ---
170
+
171
+ ## Capabilities
172
+
173
+ ### Lossless headless spooling — `genesis run`
174
+ Wraps **60+ toolchains** (`pytest ruff mypy black tsc npm pnpm yarn bun deno cargo go dotnet gradle mvn make docker kubectl helm terraform pip uv poetry git gh …`) in a strict headless environment (`CI=1 TERM=dumb NO_COLOR=1 PAGER=cat GIT_TERMINAL_PROMPT=0 PIP_NO_INPUT=1 …`), refuses interactive shapes (`git rebase -i`, `docker run -it`, `--watch`), captures every byte to an atomic spool, prints a ≤10-line summary with a `ctx:log/<id>` pointer and preserves the exit code. Agents dereference with `genesis_log(id, grep=…)`.
175
+
176
+ ### Zero-trust privacy shield
177
+ Two independent detectors — 15 structural vendor patterns (OpenAI, Anthropic, Google, GitHub, AWS, Slack, Stripe, SendGrid, npm, Hugging Face, JWT, Bearer, PEM, basic-auth URLs, `KEY=value`) and a **Shannon-entropy gate at 4.0 bits/char** for credentials with no known prefix. Git SHAs, URLs, paths and identifiers pass untouched. Applied at `remember()` (reject), thread/dialogue fields (redact), and the **spool before the atomic write** (`GENESIS_SPOOL_RAW=1` opts out).
178
+
179
+ ### Bulletproof SQLite concurrency
180
+ Every connection goes through `core/db.py`: WAL journal, `busy_timeout=5000`, `synchronous=NORMAL`, `BEGIN IMMEDIATE` transaction scope, jittered exponential retry, and read-only URIs for dashboards/reports. The MCP dispatcher rolls back and retries a tool call that loses a write race. The suite runs 8 threads × 25 writes and 4 processes × 15 JSON-RPC calls against one file and asserts **zero `database is locked`**.
181
+
182
+ ### Stateless gateway — OpenAI *and* Anthropic
183
+ `POST /v1/chat/completions` and `POST /v1/messages` both get structural tool-pair compaction, memory capsule injection and streaming passthrough with TTFT preserved. Shadow mode measures without mutating. `GET /v1/telemetry`, `/v1/pricing`, `/v1/receipts/{id}`, `/v1/recovery/{id}`.
184
+
185
+ ### Biomimetic sleep consolidation
186
+ Engrams carry a stability τ; retention decays as e^(−age/τ). Reinforcement widens τ, contradiction narrows it, dormant engrams are tombstoned, recurring wins are distilled into skills, and a bounded Active Digest primes the next session.
187
+
188
+ ### Mission Control dashboard — `genesis dashboard`
189
+ Zero-dependency cockpit on `:8090`, streaming `/api/stream` SSE: token/dollar diet ticker, orbital **Memory Universe** (drag · zoom · inspect · reinforce), BM25 **Engram Explorer** with keyboard navigation, **Conflict Deck** (accept / keep / dismiss), **Skill Browser**, Hebbian **Sleep** curves, **Client Mesh** with live detection, **Privacy Shield sandbox**, spool & ledger, and a `⌘K` command palette. Read-only over WAL; every action is an explicit audited POST.
190
+
191
+ ---
192
+
193
+ ## MCP tools
194
+
195
+ | Tool | Purpose |
196
+ |---|---|
197
+ | `remember` / `recall` / `forget` / `invalidate` | Episodic store with FTS5 BM25 ranking, utility scoring, supersession |
198
+ | `reinforce` | Hebbian +1 / −1 from outcomes |
199
+ | `challenge_rule` / `resolve_conflict` | Propose a better rule; human veto queue |
200
+ | `thread_update` / `thread_get` | Unified cross-client active work thread |
201
+ | `dialogue_update` / `dialogue_get` / `cross_client_resolve` | Cross-client conversational continuity with provenance |
202
+ | `synthesize_skill` / `skill_recall` | Procedural memory |
203
+ | `get_dependencies` / `attest_closure` | AST dependency closure attestation |
204
+ | `genesis_log` | Dereference spooled output (grep / pagination / chunked) |
205
+ | `sleep_now` / `status` | Consolidation trigger; health & counters |
206
+ | `genesis` | One-tool gateway: `{op: "recall", query: …}` routes every op above |
207
+
208
+ Set `GENESIS_MCP_TOOL_MODE=gateway` to advertise only the gateway tool and shrink every-turn schema bytes.
209
+
210
+ ---
211
+
212
+ ## Benchmarks (reference machine, `tests/`)
213
+
214
+ | Scenario | Before | After | Δ |
215
+ |---|---|---|---|
216
+ | `pytest` run, 4,000 lines in agent context | ~79,200 tok | 84 tok | **−98.4 %** |
217
+ | Subconscious capsule vs. whole store | 21,480 tok | 176 tok | **−99.2 %** |
218
+ | 14-turn conversation + 2,200 tool lines via gateway | 60,800 tok | 3,030 tok | **−95.0 %** |
219
+ | Recall latency @ 10k engrams | — | < 50 ms | — |
220
+ | Daemon RSS steady state | — | ≈ 30 MB | budget 100 MB |
221
+ | 8 procs × concurrent writes to one DB | — | 0 lock errors | — |
222
+
223
+ ---
224
+
225
+ ## Testing
226
+
227
+ ```bash
228
+ python -m pytest tests/ # 421 passed, 1 skipped
229
+ python -m pytest tests/test_db_hardening.py # multi-thread + multi-process lock storm
230
+ python -m pytest tests/test_privacy_shield.py tests/test_universal_clients.py tests/test_dashboard_server.py
231
+ ```
232
+
233
+ ---
234
+
235
+ ## Licensing
236
+
237
+ Offline-first HMAC-SHA256 — works air-gapped.
238
+
239
+ | | Community | Developer Pro | Enterprise Gateway |
240
+ |---|---|---|---|
241
+ | Price | Free / MIT | $14 mo · $12 annual | $39 seat/mo · $32 annual |
242
+ | Local SQLite memory · hook · spooler · 20-client setup · privacy shield | ✅ | ✅ | ✅ |
243
+ | High-ratio compactor · Hebbian sleep · dashboard · live pricing · Anthropic route | — | ✅ | ✅ |
244
+ | Team shared memory sync · on-prem Docker gateway · audit logs · SLA | — | — | ✅ |
245
+
246
+ ```bash
247
+ genesis auth --key GEN-PRO-<key>
248
+ genesis license
249
+ ```
250
+
251
+ ---
252
+
253
+ ## Links
254
+
255
+ - [RELEASE_CHANGELOG.md](RELEASE_CHANGELOG.md) — every change in v0.5.0, with rationale and impact
256
+ - [docs/ARCHITECTURE.md](docs/ARCHITECTURE.md) · [docs/MCP_SPEC.md](docs/MCP_SPEC.md) · [llms.txt](llms.txt) · [openapi.json](openapi.json)
257
+ - Landing page: `cd site && npm install && npm run build && npm run preview` → http://localhost:4173
258
+
259
+ <p align="center"><sub>GENESIS Memory — because your AI agent deserves a brain that doesn't reset every session.</sub></p>
@@ -0,0 +1,238 @@
1
+ <p align="center">
2
+ <img src="site/public/favicon.svg" width="84" alt="GENESIS Memory" />
3
+ </p>
4
+
5
+ <h1 align="center">GENESIS Memory</h1>
6
+
7
+ <p align="center">
8
+ <strong>The persistent brain &amp; token diet for <em>every</em> AI coding agent.</strong>
9
+ </p>
10
+
11
+ <p align="center">
12
+ <img src="https://img.shields.io/badge/tests-421%20passed-22C55E?style=flat-square&logo=pytest" alt="Tests" />
13
+ <img src="https://img.shields.io/badge/version-0.5.0-00F0FF?style=flat-square" alt="Version" />
14
+ <img src="https://img.shields.io/badge/clients-20%20auto--wired-8B5CF6?style=flat-square" alt="Clients" />
15
+ <img src="https://img.shields.io/badge/MCP%20tools-19%20%2B%20gateway-38BDF8?style=flat-square" alt="MCP Tools" />
16
+ <img src="https://img.shields.io/badge/python-3.10%2B-3776AB?style=flat-square&logo=python&logoColor=white" alt="Python" />
17
+ <img src="https://img.shields.io/badge/license-MIT-gray?style=flat-square" alt="License" />
18
+ </p>
19
+
20
+ <p align="center">
21
+ One local SQLite memory shared by <strong>Cursor</strong>, <strong>Claude Code</strong>, <strong>VS Code</strong>, <strong>Zed</strong>, <strong>Windsurf</strong>, <strong>JetBrains</strong>, <strong>Neovim</strong>, <strong>Emacs</strong>, <strong>OpenCode</strong>, <strong>Antigravity</strong>, every terminal agent and every SDK —<br/>
22
+ while collapsing 4,000-line tool outputs into 84-token pointers and scrubbing secrets before they ever touch disk.
23
+ </p>
24
+
25
+ ---
26
+
27
+ ## Why
28
+
29
+ Every AI coding agent has the **Goldfish Effect**: each session starts from nothing. Decisions, invariants, half-finished threads and hard-won debugging insight evaporate. You repeat yourself; the agent re-reads 80k tokens of test output; your bill grows.
30
+
31
+ GENESIS is a **local-first cognitive memory OS** that sits *between* your agents and their models:
32
+
33
+ | Primitive | What it does | Who uses it |
34
+ |---|---|---|
35
+ | **MCP** (stdio) | 19 cognitive tools — `remember`, `recall`, `reinforce`, `challenge_rule`, `attest_closure`, `genesis_log`, … — or a single `genesis` gateway tool that routes them all | Cursor, Claude Code/Desktop, VS Code, Zed, Windsurf, JetBrains, Neovim, Emacs, Codex, Gemini CLI, Amazon Q, Goose, Cline, Roo, Continue |
36
+ | **Hook** (pre-prompt) | Injects a ≤200-token *subconscious capsule*: active thread, last cross-client dialogue turn, matching skills, top engrams, one recall directive | Cursor 1.7 hooks, Claude Code `PrePrompt`, OpenCode plugin, Antigravity |
37
+ | **Proxy** (stateless gateway) | `OPENAI_BASE_URL` / `ANTHROPIC_BASE_URL` → `127.0.0.1:8000`. Structural tool-pair compaction, anaphora rewriting, memory capsule injection, byte-exact SSE relay, fail-open | Any SDK, LangChain, LlamaIndex, CrewAI, AutoGen, Aider, anything with a base URL |
38
+
39
+ Everything is stdlib-only Python, runs under 100 MB RSS, stores to one WAL-mode SQLite file, and never phones home.
40
+
41
+ ---
42
+
43
+ ## Quick start
44
+
45
+ ```bash
46
+ pip install genesis-memory # or: git clone … && pip install -e .
47
+
48
+ genesis setup --preview # read-only: what is installed, what would be wired
49
+ genesis setup --yes # wire every detected client (timestamped backups; --revert undoes)
50
+
51
+ genesis dashboard --open # Mission Control at http://127.0.0.1:8090
52
+ genesis run -- pytest tests/ # headless, spooled, exit-code preserving
53
+ genesis doctor # system diagnostics, client matrix & update check
54
+ genesis upgrade # 1-click self-upgrade to the latest release
55
+ ```
56
+
57
+ Anything not auto-detected:
58
+
59
+ ```bash
60
+ genesis clients # the universal matrix with detection status
61
+ genesis export-config --client zed --format native # exact snippet in the client's own dialect
62
+ genesis export-config --format toml # canonical mcpServers as TOML / yaml / json / env / lua / elisp
63
+ genesis export-config --all --out ./snippets # one file per client
64
+ ```
65
+
66
+ ---
67
+
68
+ ## Universal client support
69
+
70
+ `genesis setup` is a **data-driven registry** (`genesis_memory/cli/client_registry.py`): each client declares where its config lives, how to detect it, which primitives it supports and how to render the patch in its own dialect. JSON/JSONC files are deep-merged (your existing servers and comments survive); YAML/TOML/Lisp/dotenv files get an idempotent `>>> genesis-memory >>>` marker block that re-runs replace and `--revert` removes.
71
+
72
+ | Client | Config | Primitives | Format |
73
+ |---|---|---|---|
74
+ | Cursor | `~/.cursor/mcp.json` + `hooks.json` | MCP · Hook · Proxy | json |
75
+ | Claude Code | `~/.claude/settings.json` + `~/.claude.json` | Hook · MCP · Proxy | json |
76
+ | Claude Desktop | `…/Claude/claude_desktop_config.json` | MCP | json |
77
+ | OpenCode | `~/.config/opencode/opencode.jsonc` + `plugins/genesis-memory.js` | MCP · Proxy · Hook | jsonc |
78
+ | Antigravity IDE | `.agents/` (native) | MCP · Hook | native |
79
+ | Windsurf (Codeium) | `~/.codeium/windsurf/mcp_config.json` | MCP · Proxy | json |
80
+ | Zed | `~/.config/zed/settings.json` → `context_servers` | MCP · Proxy | jsonc |
81
+ | VS Code (Copilot agent mode) | `…/Code/User/mcp.json` → `servers` | MCP · Proxy | jsonc |
82
+ | Cline | `…/saoudrizwan.claude-dev/settings/cline_mcp_settings.json` | MCP · Proxy | json |
83
+ | Roo Code | `…/rooveterinaryinc.roo-cline/settings/mcp_settings.json` | MCP · Proxy | json |
84
+ | Continue.dev | `~/.continue/mcpServers/genesis-memory.yaml` | MCP · Proxy | yaml |
85
+ | JetBrains Junie / AI Assistant | `~/.junie/mcp/mcp.json` | MCP · Proxy | json |
86
+ | Neovim (mcphub · Avante · CodeCompanion · Copilot.lua) | `~/.config/mcphub/servers.json` (+ Lua via export) | MCP · Proxy | json / lua |
87
+ | Emacs (gptel · aidermacs · mcp.el) | `~/.emacs.d/genesis-memory.el` | MCP · Proxy | elisp |
88
+ | Aider | `~/.aider.conf.yml` | Proxy | yaml |
89
+ | OpenAI Codex CLI | `~/.codex/config.toml` | MCP · Proxy | toml |
90
+ | Gemini CLI | `~/.gemini/settings.json` | MCP | json |
91
+ | Amazon Q Developer CLI | `~/.aws/amazonq/mcp.json` | MCP | json |
92
+ | Goose (Block) | `~/.config/goose/config.yaml` | MCP · Proxy | yaml |
93
+ | Any SDK / framework (LangChain, LlamaIndex, CrewAI, AutoGen, OpenAI, Anthropic) | `~/.genesis/genesis.env` | Proxy | env |
94
+
95
+ ```python
96
+ # Zero code changes for any framework: point the base URL at the gateway.
97
+ from openai import OpenAI
98
+ client = OpenAI(base_url="http://127.0.0.1:8000/v1", api_key="not-needed")
99
+ ```
100
+
101
+ ---
102
+
103
+ ## Architecture
104
+
105
+ ```mermaid
106
+ flowchart LR
107
+ subgraph Clients["20 AI clients · any SDK"]
108
+ C1[Cursor] --- C2[Claude Code] --- C3[VS Code / Zed / JetBrains] --- C4[Neovim / Emacs] --- C5[LangChain · CrewAI · …]
109
+ end
110
+ Clients -- "stdio MCP (19 tools)" --> D[genesis-daemon<br/>&lt;100 MB RSS · stdlib only]
111
+ Clients -- "pre-prompt hook<br/>≤200-token capsule" --> H[subconscious_hook.py]
112
+ Clients -- "OPENAI_BASE_URL / ANTHROPIC_BASE_URL" --> P[genesis-proxy :8000<br/>/v1/chat/completions · /v1/messages]
113
+ D & H & P --> S[(memory.db<br/>SQLite WAL · busy 5000ms<br/>BEGIN IMMEDIATE + retry)]
114
+ R[genesis run<br/>headless spooler] -- "redacted bytes" --> SP[(~/.genesis/spool<br/>TTL 7d · LRU 500MB)]
115
+ S --> SL[sleep daemon<br/>Hebbian decay · skills · digest]
116
+ S & SP & P --> M[Mission Control :8090<br/>SSE telemetry · read-only]
117
+ PS[[Privacy Shield<br/>15 patterns + Shannon entropy]] -.guards.-> S & SP
118
+ ```
119
+
120
+ ### Repository layout
121
+
122
+ ```text
123
+ genesis_memory/
124
+ ├── core/
125
+ │ ├── db.py # WAL + busy_timeout + BEGIN IMMEDIATE + jittered retry (shared by every process)
126
+ │ ├── privacy_shield.py # structural patterns + Shannon-entropy detector; redact()/scan()/redact_bytes()
127
+ │ ├── hebbian_engine.py # stability τ, decay, reinforcement
128
+ │ ├── skill_synthesizer.py # recurring outcomes → procedural skills
129
+ │ ├── ast_edge_extractor.py # dependency closure for attest_closure
130
+ │ ├── licensing.py # offline HMAC-SHA256 tiers
131
+ │ └── team_sync.py # enterprise vector-clock sync
132
+ ├── daemon/server.py # stdio MCP daemon · versioned schema · lock-storm resilient dispatch
133
+ ├── hooks/subconscious_hook.py# ≤200-token capsule, ambient turn capture
134
+ ├── proxy/ # aiohttp gateway (OpenAI + Anthropic), compactor, distiller, pricing engine (+ bundled catalog)
135
+ ├── cli/
136
+ │ ├── run.py # genesis CLI · 60+ toolchain headless spooler
137
+ │ ├── client_registry.py # universal data-driven client matrix (20 specs, aliases, dialect renderers)
138
+ │ ├── config_formats.py # dependency-free JSON/YAML/TOML/env emitters + marker-block merger
139
+ │ ├── export_config.py # genesis export-config / genesis clients
140
+ │ ├── init_cmd.py # genesis setup · preview · backup · --revert
141
+ │ └── templates/opencode_plugin.js
142
+ ├── sleep/ # consolidation cycle, digest, ledger
143
+ └── dashboard/ # Mission Control (stdlib HTTP + SSE) and static/index.html cockpit
144
+ site/ # React 19 + Vite 7 landing page with live interactive demos
145
+ tests/ # 421 tests: chaos, concurrency, multi-process, privacy, clients, dashboard, proxy
146
+ ```
147
+
148
+ ---
149
+
150
+ ## Capabilities
151
+
152
+ ### Lossless headless spooling — `genesis run`
153
+ Wraps **60+ toolchains** (`pytest ruff mypy black tsc npm pnpm yarn bun deno cargo go dotnet gradle mvn make docker kubectl helm terraform pip uv poetry git gh …`) in a strict headless environment (`CI=1 TERM=dumb NO_COLOR=1 PAGER=cat GIT_TERMINAL_PROMPT=0 PIP_NO_INPUT=1 …`), refuses interactive shapes (`git rebase -i`, `docker run -it`, `--watch`), captures every byte to an atomic spool, prints a ≤10-line summary with a `ctx:log/<id>` pointer and preserves the exit code. Agents dereference with `genesis_log(id, grep=…)`.
154
+
155
+ ### Zero-trust privacy shield
156
+ Two independent detectors — 15 structural vendor patterns (OpenAI, Anthropic, Google, GitHub, AWS, Slack, Stripe, SendGrid, npm, Hugging Face, JWT, Bearer, PEM, basic-auth URLs, `KEY=value`) and a **Shannon-entropy gate at 4.0 bits/char** for credentials with no known prefix. Git SHAs, URLs, paths and identifiers pass untouched. Applied at `remember()` (reject), thread/dialogue fields (redact), and the **spool before the atomic write** (`GENESIS_SPOOL_RAW=1` opts out).
157
+
158
+ ### Bulletproof SQLite concurrency
159
+ Every connection goes through `core/db.py`: WAL journal, `busy_timeout=5000`, `synchronous=NORMAL`, `BEGIN IMMEDIATE` transaction scope, jittered exponential retry, and read-only URIs for dashboards/reports. The MCP dispatcher rolls back and retries a tool call that loses a write race. The suite runs 8 threads × 25 writes and 4 processes × 15 JSON-RPC calls against one file and asserts **zero `database is locked`**.
160
+
161
+ ### Stateless gateway — OpenAI *and* Anthropic
162
+ `POST /v1/chat/completions` and `POST /v1/messages` both get structural tool-pair compaction, memory capsule injection and streaming passthrough with TTFT preserved. Shadow mode measures without mutating. `GET /v1/telemetry`, `/v1/pricing`, `/v1/receipts/{id}`, `/v1/recovery/{id}`.
163
+
164
+ ### Biomimetic sleep consolidation
165
+ Engrams carry a stability τ; retention decays as e^(−age/τ). Reinforcement widens τ, contradiction narrows it, dormant engrams are tombstoned, recurring wins are distilled into skills, and a bounded Active Digest primes the next session.
166
+
167
+ ### Mission Control dashboard — `genesis dashboard`
168
+ Zero-dependency cockpit on `:8090`, streaming `/api/stream` SSE: token/dollar diet ticker, orbital **Memory Universe** (drag · zoom · inspect · reinforce), BM25 **Engram Explorer** with keyboard navigation, **Conflict Deck** (accept / keep / dismiss), **Skill Browser**, Hebbian **Sleep** curves, **Client Mesh** with live detection, **Privacy Shield sandbox**, spool & ledger, and a `⌘K` command palette. Read-only over WAL; every action is an explicit audited POST.
169
+
170
+ ---
171
+
172
+ ## MCP tools
173
+
174
+ | Tool | Purpose |
175
+ |---|---|
176
+ | `remember` / `recall` / `forget` / `invalidate` | Episodic store with FTS5 BM25 ranking, utility scoring, supersession |
177
+ | `reinforce` | Hebbian +1 / −1 from outcomes |
178
+ | `challenge_rule` / `resolve_conflict` | Propose a better rule; human veto queue |
179
+ | `thread_update` / `thread_get` | Unified cross-client active work thread |
180
+ | `dialogue_update` / `dialogue_get` / `cross_client_resolve` | Cross-client conversational continuity with provenance |
181
+ | `synthesize_skill` / `skill_recall` | Procedural memory |
182
+ | `get_dependencies` / `attest_closure` | AST dependency closure attestation |
183
+ | `genesis_log` | Dereference spooled output (grep / pagination / chunked) |
184
+ | `sleep_now` / `status` | Consolidation trigger; health & counters |
185
+ | `genesis` | One-tool gateway: `{op: "recall", query: …}` routes every op above |
186
+
187
+ Set `GENESIS_MCP_TOOL_MODE=gateway` to advertise only the gateway tool and shrink every-turn schema bytes.
188
+
189
+ ---
190
+
191
+ ## Benchmarks (reference machine, `tests/`)
192
+
193
+ | Scenario | Before | After | Δ |
194
+ |---|---|---|---|
195
+ | `pytest` run, 4,000 lines in agent context | ~79,200 tok | 84 tok | **−98.4 %** |
196
+ | Subconscious capsule vs. whole store | 21,480 tok | 176 tok | **−99.2 %** |
197
+ | 14-turn conversation + 2,200 tool lines via gateway | 60,800 tok | 3,030 tok | **−95.0 %** |
198
+ | Recall latency @ 10k engrams | — | < 50 ms | — |
199
+ | Daemon RSS steady state | — | ≈ 30 MB | budget 100 MB |
200
+ | 8 procs × concurrent writes to one DB | — | 0 lock errors | — |
201
+
202
+ ---
203
+
204
+ ## Testing
205
+
206
+ ```bash
207
+ python -m pytest tests/ # 421 passed, 1 skipped
208
+ python -m pytest tests/test_db_hardening.py # multi-thread + multi-process lock storm
209
+ python -m pytest tests/test_privacy_shield.py tests/test_universal_clients.py tests/test_dashboard_server.py
210
+ ```
211
+
212
+ ---
213
+
214
+ ## Licensing
215
+
216
+ Offline-first HMAC-SHA256 — works air-gapped.
217
+
218
+ | | Community | Developer Pro | Enterprise Gateway |
219
+ |---|---|---|---|
220
+ | Price | Free / MIT | $14 mo · $12 annual | $39 seat/mo · $32 annual |
221
+ | Local SQLite memory · hook · spooler · 20-client setup · privacy shield | ✅ | ✅ | ✅ |
222
+ | High-ratio compactor · Hebbian sleep · dashboard · live pricing · Anthropic route | — | ✅ | ✅ |
223
+ | Team shared memory sync · on-prem Docker gateway · audit logs · SLA | — | — | ✅ |
224
+
225
+ ```bash
226
+ genesis auth --key GEN-PRO-<key>
227
+ genesis license
228
+ ```
229
+
230
+ ---
231
+
232
+ ## Links
233
+
234
+ - [RELEASE_CHANGELOG.md](RELEASE_CHANGELOG.md) — every change in v0.5.0, with rationale and impact
235
+ - [docs/ARCHITECTURE.md](docs/ARCHITECTURE.md) · [docs/MCP_SPEC.md](docs/MCP_SPEC.md) · [llms.txt](llms.txt) · [openapi.json](openapi.json)
236
+ - Landing page: `cd site && npm install && npm run build && npm run preview` → http://localhost:4173
237
+
238
+ <p align="center"><sub>GENESIS Memory — because your AI agent deserves a brain that doesn't reset every session.</sub></p>
@@ -0,0 +1,2 @@
1
+ """GENESIS Memory Package - Autonomous Cognitive Memory OS."""
2
+ __version__ = "0.6.1"
@@ -0,0 +1 @@
1
+ """genesis_memory.cli module."""