memcore-omnix 2.2.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.
- memcore_omnix-2.2.0/LICENSE +21 -0
- memcore_omnix-2.2.0/PKG-INFO +386 -0
- memcore_omnix-2.2.0/README.md +360 -0
- memcore_omnix-2.2.0/memcore/__main__.py +2029 -0
- memcore_omnix-2.2.0/memcore/ablation.py +121 -0
- memcore_omnix-2.2.0/memcore/client.py +325 -0
- memcore_omnix-2.2.0/memcore/contradiction.py +336 -0
- memcore_omnix-2.2.0/memcore/core.py +42 -0
- memcore_omnix-2.2.0/memcore/doctor.py +386 -0
- memcore_omnix-2.2.0/memcore/embedding.py +322 -0
- memcore_omnix-2.2.0/memcore/export.py +324 -0
- memcore_omnix-2.2.0/memcore/imports.py +281 -0
- memcore_omnix-2.2.0/memcore/ingest.py +1371 -0
- memcore_omnix-2.2.0/memcore/mcp_install.py +414 -0
- memcore_omnix-2.2.0/memcore/mcp_server.py +661 -0
- memcore_omnix-2.2.0/memcore/recall.py +1507 -0
- memcore_omnix-2.2.0/memcore/schema/schema.sql +131 -0
- memcore_omnix-2.2.0/memcore/semantic.py +245 -0
- memcore_omnix-2.2.0/memcore/store.py +1552 -0
- memcore_omnix-2.2.0/memcore/write.py +1890 -0
- memcore_omnix-2.2.0/memcore_omnix.egg-info/PKG-INFO +386 -0
- memcore_omnix-2.2.0/memcore_omnix.egg-info/SOURCES.txt +26 -0
- memcore_omnix-2.2.0/memcore_omnix.egg-info/dependency_links.txt +1 -0
- memcore_omnix-2.2.0/memcore_omnix.egg-info/entry_points.txt +3 -0
- memcore_omnix-2.2.0/memcore_omnix.egg-info/requires.txt +7 -0
- memcore_omnix-2.2.0/memcore_omnix.egg-info/top_level.txt +1 -0
- memcore_omnix-2.2.0/pyproject.toml +47 -0
- memcore_omnix-2.2.0/setup.cfg +4 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 P Choke & SORA
|
|
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,386 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: memcore-omnix
|
|
3
|
+
Version: 2.2.0
|
|
4
|
+
Summary: Governed, bitemporal, local-first memory engine for autonomous AI agent fleets
|
|
5
|
+
Author: P Choke & MIKA
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Keywords: memory,ai-agents,autonomous-agents,sqlite,hybrid-search,bitemporal
|
|
8
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
9
|
+
Classifier: Intended Audience :: Developers
|
|
10
|
+
Classifier: Programming Language :: Python :: 3
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
16
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
17
|
+
Requires-Python: >=3.10
|
|
18
|
+
Description-Content-Type: text/markdown
|
|
19
|
+
License-File: LICENSE
|
|
20
|
+
Provides-Extra: sqlite-vec
|
|
21
|
+
Requires-Dist: sqlite-vec>=0.1.0; extra == "sqlite-vec"
|
|
22
|
+
Provides-Extra: local-embed
|
|
23
|
+
Requires-Dist: fastembed>=0.4.0; extra == "local-embed"
|
|
24
|
+
Requires-Dist: model2vec>=0.10.0; extra == "local-embed"
|
|
25
|
+
Dynamic: license-file
|
|
26
|
+
|
|
27
|
+
<div align="center">
|
|
28
|
+
|
|
29
|
+
# MemCore
|
|
30
|
+
|
|
31
|
+
**Governed, Bitemporal, Local-First Memory Engine for Autonomous AI Agent Fleets**
|
|
32
|
+
|
|
33
|
+
<p><em>Capture broadly. Recall narrowly. Never trust raw conversational history.</em></p>
|
|
34
|
+
|
|
35
|
+
<p>
|
|
36
|
+
<img src="https://img.shields.io/badge/python-3.10+-3776AB?style=flat-square" alt="Python 3.10+" />
|
|
37
|
+
<img src="https://img.shields.io/badge/storage-SQLite_WAL_+_FTS5_+_sqlite--vec-07405E?style=flat-square" alt="SQLite WAL FTS5 sqlite-vec" />
|
|
38
|
+
<img src="https://img.shields.io/badge/embeddings-model2vec_/_FastEmbed-10b981?style=flat-square" alt="Local Embeddings" />
|
|
39
|
+
<img src="https://img.shields.io/badge/ecosystem-Universal_MCP_&_CLI-8b5cf6?style=flat-square" alt="Universal MCP & CLI" />
|
|
40
|
+
<a href="LICENSE"><img src="https://img.shields.io/badge/license-MIT-slate?style=flat-square" alt="MIT License" /></a>
|
|
41
|
+
</p>
|
|
42
|
+
|
|
43
|
+
<p>
|
|
44
|
+
<a href="#why-memcore">Why MemCore</a> ·
|
|
45
|
+
<a href="#visual-before--after-ungoverned-rag-vs-memcore">Before / After</a> ·
|
|
46
|
+
<a href="#quick-start">Quick Start</a> ·
|
|
47
|
+
<a href="#how-governed-memory-works">Trust & Lifecycle</a> ·
|
|
48
|
+
<a href="#hybrid-rrf-recall--vector-providers">Hybrid Recall</a> ·
|
|
49
|
+
<a href="#architecture--modules">Architecture</a> ·
|
|
50
|
+
<a href="#measured-performance--footprint">Performance</a> ·
|
|
51
|
+
<a href="#python-sdk--operational-cli">SDK & CLI</a> ·
|
|
52
|
+
<a href="#recommended-ecosystem-combo">Trinity Combo</a>
|
|
53
|
+
</p>
|
|
54
|
+
|
|
55
|
+
</div>
|
|
56
|
+
|
|
57
|
+
---
|
|
58
|
+
|
|
59
|
+
## Why MemCore?
|
|
60
|
+
|
|
61
|
+
Most AI agent memory frameworks dump raw conversational logs directly into prompts or unverified vector stores. Over time, this creates three fatal failure modes:
|
|
62
|
+
1. **State Poisoning:** When an agent guesses wrong once, that wrong assumption is embedded and re-injected as "truth" in future sessions.
|
|
63
|
+
2. **Stale Code Drift:** Facts about a codebase stay frozen in vector memory long after the underlying source file has been refactored.
|
|
64
|
+
3. **Cross-Agent Isolation Leaks:** Private agent scratchpads bleed into shared project context without access-control boundaries.
|
|
65
|
+
|
|
66
|
+
**MemCore solves this by introducing governed, bitemporal memory with hard SQL-enforced trust boundaries (`~/.memcore`):**
|
|
67
|
+
|
|
68
|
+
- **Two-Zone Isolation:** Separates the **Raw Ingest Journal (`Untrusted`)** — an append-only ledger of turns and tool calls that is *never* recalled into prompts — from **Governed Canonical Memory (`Authoritative`)**.
|
|
69
|
+
- **Bitemporal Versioning & Tombstone Refusal Guards:** Corrections (`supersede`) create immutable version chains tracking both valid-world time and transaction time. Rejected claims leave a cryptographic **Tombstone** that blocks identical bad claims from ever being re-admitted.
|
|
70
|
+
- **Source-File SHA-256 Staleness Detection:** Memories bound to a `source_file` automatically flip their `freshness` label to `stale` the instant that file's SHA-256 changes on disk — while unrelated Git commits leave it untouched.
|
|
71
|
+
- **Sub-Millisecond Hybrid RRF Recall:** Fuses SQLite **FTS5 BM25** lexical search with in-process **`sqlite-vec` SIMD** vector distance and **`model2vec`** static embeddings (`minishlab/potion-base-8M`) via Reciprocal Rank Fusion (RRF, $k=60$) — requiring **zero background daemons**, zero Docker containers, and zero open network ports.
|
|
72
|
+
|
|
73
|
+
> [!IMPORTANT]
|
|
74
|
+
> **Hard SQL Scope Guarantee:** Project-wide (`project`) vs. agent-private (`private`) visibility rules are enforced directly inside SQL `WHERE` clauses (`recall.py`) — never in Python post-filtering. Agent A can never read Agent B's private notes, even under broad semantic vector search.
|
|
75
|
+
|
|
76
|
+
<div align="center">
|
|
77
|
+
<img src="docs/architecture.svg" alt="MemCore Governed Trust and Hybrid Architecture" width="100%" />
|
|
78
|
+
</div>
|
|
79
|
+
|
|
80
|
+
---
|
|
81
|
+
|
|
82
|
+
## Visual Before & After: Ungoverned RAG vs. MemCore
|
|
83
|
+
|
|
84
|
+
<table>
|
|
85
|
+
<tr>
|
|
86
|
+
<th width="50%">Ungoverned Vector RAG Memory</th>
|
|
87
|
+
<th width="50%">MemCore Governed Bitemporal Memory</th>
|
|
88
|
+
</tr>
|
|
89
|
+
<tr>
|
|
90
|
+
<td>
|
|
91
|
+
|
|
92
|
+
```text
|
|
93
|
+
Query: "What port does ClickHouse use?"
|
|
94
|
+
|
|
95
|
+
Recalled Chunks (Unfiltered Cosine Similarity):
|
|
96
|
+
1. [0.89] "Let's try connecting to ClickHouse on 8123..."
|
|
97
|
+
2. [0.87] "ClickHouse runs on port 9000 in settings.py"
|
|
98
|
+
3. [0.85] "We migrated ClickHouse to port 9440 with TLS"
|
|
99
|
+
|
|
100
|
+
Result:
|
|
101
|
+
❌ Contradictory history dumped into prompt
|
|
102
|
+
❌ Old port 9000 and failed guess 8123 pollute context
|
|
103
|
+
❌ No way to know if settings.py changed since last week
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
</td>
|
|
107
|
+
<td>
|
|
108
|
+
|
|
109
|
+
```text
|
|
110
|
+
Query: "What port does ClickHouse use?"
|
|
111
|
+
|
|
112
|
+
Recalled Canonical Memory (Hybrid FTS5 + Vector RRF):
|
|
113
|
+
1. [scope=project | lifecycle=accepted
|
|
114
|
+
| verification=source_backed | freshness=current]
|
|
115
|
+
"ClickHouse telemetry analytics migrated to port 9440
|
|
116
|
+
with mTLS (settings.py)"
|
|
117
|
+
└─ supersedes: v1 ("port 9000", valid_until: 2026-10-18)
|
|
118
|
+
└─ tombstone: "port 8123" blocked (rejected)
|
|
119
|
+
|
|
120
|
+
Result:
|
|
121
|
+
✅ Only active canonical truth is returned
|
|
122
|
+
✅ Prior version preserved in immutable audit history
|
|
123
|
+
✅ SHA-256 of settings.py verified current at read time
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
</td>
|
|
127
|
+
</tr>
|
|
128
|
+
</table>
|
|
129
|
+
|
|
130
|
+
---
|
|
131
|
+
|
|
132
|
+
## Quick Start
|
|
133
|
+
|
|
134
|
+
### 1. Universal One-Command Auto-Install (Recommended)
|
|
135
|
+
|
|
136
|
+
Install `memcore`, initialize the governed store, and automatically register its stdio MCP server across every supported AI agent CLI and IDE on your machine:
|
|
137
|
+
|
|
138
|
+
```bash
|
|
139
|
+
pip install memcore-omnix
|
|
140
|
+
memcore init
|
|
141
|
+
memcore install
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
`memcore install` detects and atomically updates:
|
|
145
|
+
- **Claude Code** (`~/.claude.json` via official `claude mcp add-json`) & **Claude Desktop** (`claude_desktop_config.json`)
|
|
146
|
+
- **Google Antigravity & Antigravity IDE** (`~/.gemini/config/mcp_config.json`, `~/.gemini/antigravity/mcp_config.json`)
|
|
147
|
+
- **Gemini CLI** (`~/.gemini/settings.json`) & **Codex CLI** (`~/.codex/config.toml` with atomic TOML validation)
|
|
148
|
+
- **Cursor** (`~/.cursor/mcp.json`), **Windsurf**, **VS Code (Copilot)**, **OpenCode**, and **Cline**
|
|
149
|
+
|
|
150
|
+
Inspect detected clients or run a full governance & schema diagnostic:
|
|
151
|
+
|
|
152
|
+
```bash
|
|
153
|
+
memcore clients
|
|
154
|
+
memcore doctor
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
---
|
|
158
|
+
|
|
159
|
+
## How Governed Memory Works
|
|
160
|
+
|
|
161
|
+
```mermaid
|
|
162
|
+
flowchart LR
|
|
163
|
+
subgraph Zone1 ["Zone 1: Untrusted Capture"]
|
|
164
|
+
Turns["Raw Agent Turns & Tool Calls"] --> Journal[("ingest_event<br/>Append-Only Journal")]
|
|
165
|
+
end
|
|
166
|
+
|
|
167
|
+
subgraph Gate ["Governance & Admission Gate"]
|
|
168
|
+
Journal -->|"Curate / Triage"| Check{"Tombstone &<br/>Fingerprint Check"}
|
|
169
|
+
Direct["Direct memory_remember"] --> Check
|
|
170
|
+
end
|
|
171
|
+
|
|
172
|
+
subgraph Zone2 ["Zone 2: Authoritative Canonical Store (~/.memcore)"]
|
|
173
|
+
Check -- "Blocked by Tombstone" --> Reject["Refused (No State Pollution)"]
|
|
174
|
+
Check -- "Admitted" --> Canon[("memory + memory_version<br/>Bitemporal SQLite WAL")]
|
|
175
|
+
Canon --> FTS["FTS5 BM25 Index"]
|
|
176
|
+
Canon --> Vec["sqlite-vec SIMD +<br/>model2vec / FastEmbed"]
|
|
177
|
+
end
|
|
178
|
+
|
|
179
|
+
FTS & Vec -->|"Reciprocal Rank Fusion (k=60)<br/>+ SHA-256 Staleness Check"| Recall(["Salience L1 / Full Recall"])
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
### Four-Dimensional Trust Labels
|
|
183
|
+
|
|
184
|
+
Every recalled memory carries four explicit labels so the consuming agent knows exactly how much authority it holds:
|
|
185
|
+
|
|
186
|
+
| Dimension | Allowed Values | Engineering Meaning |
|
|
187
|
+
| :--- | :--- | :--- |
|
|
188
|
+
| **`scope`** | `project` · `private` | `project` is shared across all agents in the workspace; `private` is strictly isolated to `owner_agent_id` in SQL. |
|
|
189
|
+
| **`lifecycle`** | `accepted` · `candidate` · `conflict` · `superseded` · `rejected` · `disabled` | Only live memories (`accepted` / `candidate` / `conflict`) appear in standard recall; `superseded` and `rejected` stay in audit history. |
|
|
190
|
+
| **`verification`** | `user_authoritative` · `runtime_verified` · `source_backed` · `unverified` | Ranks explicit user rules and runtime-proven facts above unverified observations. |
|
|
191
|
+
| **`freshness`** | `current` · `aging` · `stale` | Automatically transitions `source_backed` claims to `stale` when the tracked `source_file` SHA-256 changes on disk. |
|
|
192
|
+
|
|
193
|
+
### Salience L1 Progressive Recall
|
|
194
|
+
|
|
195
|
+
When an agent searches memory with `include_content=False` (or during compact context injection), MemCore generates a **180-character Salience L1 Preview** (`recall.py`) that prioritizes:
|
|
196
|
+
1. Hard negations and prohibitions (`never`, `must not`, `ห้าม`)
|
|
197
|
+
2. Numerical bounds, ports, timeouts, and version constraints
|
|
198
|
+
3. File paths and module identifiers
|
|
199
|
+
|
|
200
|
+
This cuts memory injection token overhead by **up to 80%** while keeping critical constraints visible, letting the agent fetch full bodies only for the exact IDs it needs.
|
|
201
|
+
|
|
202
|
+
---
|
|
203
|
+
|
|
204
|
+
## Hybrid RRF Recall & Vector Providers
|
|
205
|
+
|
|
206
|
+
MemCore fuses lexical exactness (SQLite FTS5 BM25 + Unicode substring matching for technical identifiers and spaceless scripts) with dense vector semantics using Reciprocal Rank Fusion ($k=60$).
|
|
207
|
+
|
|
208
|
+
Configure your embedding provider via `--provider` or `MEMCORE_EMBEDDING_PROVIDER`:
|
|
209
|
+
|
|
210
|
+
| Provider | Default Model | Execution Mode | Highlights |
|
|
211
|
+
| :--- | :--- | :--- | :--- |
|
|
212
|
+
| **`local` / `model2vec`** | `minishlab/potion-base-8M` | **In-Process Static Vectors** | Ultra-lightweight sub-millisecond static embeddings in pure CPU RAM; zero daemon. |
|
|
213
|
+
| **`local` / `fastembed`** | `BAAI/bge-small-en-v1.5` | **In-Process ONNX (CPU)** | High-precision 384-dim ONNX embeddings running directly in-process (~30 MB). |
|
|
214
|
+
| **`ollama`** | `nomic-embed-text` | **Local Daemon** | Connects to a local Ollama instance (`localhost:11434`). |
|
|
215
|
+
| **`openrouter`** | `text-embedding-3-small` | **Remote Gateway** | Uses OpenRouter API (`OPENROUTER_API_KEY`). |
|
|
216
|
+
| **`openai`** | `text-embedding-3-small` | **Cloud API** | Uses OpenAI API (`OPENAI_API_KEY`). |
|
|
217
|
+
| **`none`** | *(Disabled)* | **Pure Lexical Offline** | Zero-dependency SQLite FTS5 BM25 + Unicode substring matching. |
|
|
218
|
+
|
|
219
|
+
---
|
|
220
|
+
|
|
221
|
+
## Architecture & Modules
|
|
222
|
+
|
|
223
|
+
| Module | Role | Key Responsibilities |
|
|
224
|
+
| :--- | :--- | :--- |
|
|
225
|
+
| `memcore/store.py` | **SQLite WAL + `sqlite-vec` Storage** | Schema initialization, atomic migrations under lock, FTS5 sync triggers, custom SQL math functions, and locked-down `sqlite-vec` SIMD extension loading. |
|
|
226
|
+
| `memcore/write.py` | **Governed Write & Lifecycle Engine** | Claim normalization & SHA-256 fingerprinting, idempotency keys, bitemporal `supersede`, `promote`, `reject`, tombstone refusal guards, and corroboration funnel. |
|
|
227
|
+
| `memcore/recall.py` | **Hybrid RRF Search & Salience L1** | SQL-enforced scope filtering, FTS5 BM25 + dense vector RRF ($k=60$), freshness/decay scoring, point-in-time `version_at` queries, and Salience L1 previews. |
|
|
228
|
+
| `memcore/doctor.py` | **Governance Audit & Retention GC** | Fingerprint integrity checks, tombstone scope validation, reversible candidate retention cleanup (`gc_scan` / `gc_apply`), and operational stats. |
|
|
229
|
+
| `memcore/imports.py` | **Ingest & Cross-Format Import** | JSONL and Markdown memory import with automatic secret redaction, deduplication, and provenance binding. |
|
|
230
|
+
| `memcore/embedding.py` | **Multi-Tier Embedding Engine** | Unified provider adapter supporting `model2vec` (`StaticModel`), `fastembed`, `ollama`, `openrouter`, and `openai` with automatic batching and fallback. |
|
|
231
|
+
| `memcore/ingest.py` | **Journal & Semantic Triage** | Append-only `ingest_event` capture, derivation tracking (`ingest_derivation`), and governed review queue (`memory_review_queue` / `memory_review_decide`). |
|
|
232
|
+
| `memcore/core.py` | **Unified Engine Facade** | Attribute-synchronizing module proxy re-exporting `write`, `recall`, `doctor`, and `imports`. |
|
|
233
|
+
| `memcore/mcp_server.py` | **Stdio MCP Server** | Exposes 9 governed memory tools over newline-delimited JSON-RPC 2.0. |
|
|
234
|
+
| `memcore/mcp_install.py` | **Universal Client Installer** | Atomically registers/unregisters `memcore` across 11 AI agent CLIs and IDEs. |
|
|
235
|
+
|
|
236
|
+
---
|
|
237
|
+
|
|
238
|
+
## Measured Performance & Footprint
|
|
239
|
+
|
|
240
|
+
Measured on local disk with SQLite WAL, FTS5 BM25, and hybrid RRF retrieval (`docs/BENCHMARKS.md`):
|
|
241
|
+
|
|
242
|
+
| Metric | MemCore (In-Process SQLite WAL) | External Daemon / Remote Vector DB |
|
|
243
|
+
| :--- | :--- | :--- |
|
|
244
|
+
| **Background Daemon RAM** | **0 MB** (100% in-process) | 300 MB – 1 GB+ (Docker / server process) |
|
|
245
|
+
| **Store Initialization** | **< 1.0 ms** (`0.9 ms` p50) | 2,000 – 5,000 ms (service boot / handshake) |
|
|
246
|
+
| **Indexed Claim Lookup** | **0.017 ms** (`17 µs` p50) | 15 – 35 ms (network round-trip) |
|
|
247
|
+
| **Hybrid Recall Latency (`p50`)** | **2.24 ms** (1,000 iterations) | 25 – 60 ms (HTTP/gRPC + remote vector query) |
|
|
248
|
+
| **Tail Recall Latency (`p95`)** | **4.80 ms** | 75 – 150 ms |
|
|
249
|
+
| **Hybrid Recall Precision (`p@3`)** | **1.00** (exact, negation, paraphrase) | Varies |
|
|
250
|
+
| **Batch Ingestion Rate** | **1,650 writes/sec** | 50 – 150 writes/sec |
|
|
251
|
+
| **Network Attack Surface** | **Zero open ports** (offline-first) | Exposed HTTP/gRPC ports |
|
|
252
|
+
|
|
253
|
+
---
|
|
254
|
+
|
|
255
|
+
## Python SDK & Operational CLI
|
|
256
|
+
|
|
257
|
+
### Python SDK
|
|
258
|
+
|
|
259
|
+
```python
|
|
260
|
+
from memcore.client import MemCore
|
|
261
|
+
|
|
262
|
+
with MemCore(project="platform", agent="sora") as mc:
|
|
263
|
+
# 1. Store a governed fact bound to a source file for automatic SHA-256 staleness tracking
|
|
264
|
+
mem_id = mc.remember(
|
|
265
|
+
"ClickHouse telemetry analytics runs on port 9000",
|
|
266
|
+
memory_type="fact",
|
|
267
|
+
source_file="src/settings.py",
|
|
268
|
+
)
|
|
269
|
+
|
|
270
|
+
# 2. Hybrid recall (FTS5 BM25 + Dense Vector RRF Fusion)
|
|
271
|
+
hits = mc.search("telemetry database port")
|
|
272
|
+
for hit in hits:
|
|
273
|
+
print(f"[{hit['scope']} | {hit['verification']} | {hit['freshness']}] {hit['content']}")
|
|
274
|
+
|
|
275
|
+
# 3. Bitemporal update (preserves immutable prior version history)
|
|
276
|
+
mc.supersede(
|
|
277
|
+
mem_id,
|
|
278
|
+
"ClickHouse telemetry analytics migrated to port 9440 with mTLS",
|
|
279
|
+
reason="security hardening",
|
|
280
|
+
)
|
|
281
|
+
```
|
|
282
|
+
|
|
283
|
+
### MCP Tools Exposed (`memcore.mcp_server`)
|
|
284
|
+
|
|
285
|
+
| MCP Tool | Purpose |
|
|
286
|
+
| :--- | :--- |
|
|
287
|
+
| **`memory_remember`** | Store a governed fact, decision, preference, or note (with optional `source_file` and `source_commit` provenance). |
|
|
288
|
+
| **`memory_search`** | Hybrid FTS5 BM25 + dense vector RRF recall with Salience L1 preview or full content. |
|
|
289
|
+
| **`memory_supersede`** | Bitemporally update an existing memory while keeping immutable version history. |
|
|
290
|
+
| **`memory_promote`** | Promote a private agent memory to shared project scope. |
|
|
291
|
+
| **`memory_reject`** | Reject a memory claim and install a cryptographic tombstone refusal guard. |
|
|
292
|
+
| **`memory_feedback`** | Mark a recalled memory `accepted`, `rejected`, or `stale` after task execution. |
|
|
293
|
+
| **`memory_review_queue`** | List pending raw journal events awaiting governed curation. |
|
|
294
|
+
| **`memory_review_decide`** | Apply a governed verdict (`remember`, `ignore`, `defer`) to a pending journal event. |
|
|
295
|
+
| **`memory_status`** | Inspect database health, WAL mode, governance invariants, and memory counts. |
|
|
296
|
+
|
|
297
|
+
<details>
|
|
298
|
+
<summary><strong>🛠️ Click to expand: Full Operational CLI & Multi-Agent Export Commands</strong></summary>
|
|
299
|
+
|
|
300
|
+
<br/>
|
|
301
|
+
|
|
302
|
+
```bash
|
|
303
|
+
# Database health, WAL integrity, governance invariants, and backup readiness
|
|
304
|
+
memcore doctor
|
|
305
|
+
|
|
306
|
+
# Store and search memories directly from the terminal
|
|
307
|
+
memcore remember "Python 3.10+ required for core services" --project platform --agent sora
|
|
308
|
+
memcore search "python version" --project platform --agent sora
|
|
309
|
+
|
|
310
|
+
# Backfill or refresh local embeddings
|
|
311
|
+
memcore embed --provider local --all
|
|
312
|
+
|
|
313
|
+
# Create, verify, and restore atomic database snapshots
|
|
314
|
+
memcore backup
|
|
315
|
+
memcore backup-status
|
|
316
|
+
memcore restore-from-snapshot --snapshot <snapshot-name> --confirm
|
|
317
|
+
|
|
318
|
+
# Review raw journal events and apply governed triage decisions
|
|
319
|
+
memcore journal-stats
|
|
320
|
+
memcore journal-review-list --project platform --agent sora
|
|
321
|
+
memcore journal-review-decide <event-id> --verdict remember --content "Verified fact" --agent sora
|
|
322
|
+
|
|
323
|
+
# Export governed project memory into deterministic, SHA-256-signed workspace instruction files
|
|
324
|
+
memcore export # Writes workspace AGENTS.md
|
|
325
|
+
memcore export --host claude-code # Writes CLAUDE.md
|
|
326
|
+
memcore export --host gemini-cli # Writes GEMINI.md
|
|
327
|
+
memcore export --host copilot # Writes .github/copilot-instructions.md
|
|
328
|
+
```
|
|
329
|
+
|
|
330
|
+
</details>
|
|
331
|
+
|
|
332
|
+
### Multi-Agent Ecosystem Support
|
|
333
|
+
|
|
334
|
+
<table width="100%">
|
|
335
|
+
<tr>
|
|
336
|
+
<td align="center" width="25%"><img src="assets/agents/antigravity.svg" width="44" height="44" alt="Antigravity" /><br /><sub>Antigravity</sub></td>
|
|
337
|
+
<td align="center" width="25%"><img src="assets/agents/codex.svg" width="44" height="44" alt="Codex" /><br /><sub>Codex</sub></td>
|
|
338
|
+
<td align="center" width="25%"><img src="assets/agents/claude-code.svg" width="44" height="44" alt="Claude Code" /><br /><sub>Claude Code</sub></td>
|
|
339
|
+
<td align="center" width="25%"><img src="assets/agents/cursor.svg" width="44" height="44" alt="Cursor" /><br /><sub>Cursor</sub></td>
|
|
340
|
+
</tr>
|
|
341
|
+
<tr>
|
|
342
|
+
<td align="center" width="25%"><img src="assets/agents/deepseek-harness.svg" width="44" height="44" alt="DeepSeek" /><br /><sub>DeepSeek Harness</sub></td>
|
|
343
|
+
<td align="center" width="25%"><img src="assets/agents/hermes.svg" width="44" height="44" alt="Hermes" /><br /><sub>Hermes</sub></td>
|
|
344
|
+
<td align="center" width="25%"><img src="assets/agents/opencode.svg" width="44" height="44" alt="OpenCode" /><br /><sub>OpenCode</sub></td>
|
|
345
|
+
<td align="center" width="25%"><img src="assets/agents/gemini.svg" width="44" height="44" alt="Gemini" /><br /><sub>Gemini CLI</sub></td>
|
|
346
|
+
</tr>
|
|
347
|
+
</table>
|
|
348
|
+
|
|
349
|
+
---
|
|
350
|
+
|
|
351
|
+
## Recommended Ecosystem Combo
|
|
352
|
+
|
|
353
|
+
While **MemCore** operates standalone as your governed memory engine, pairing it with [**trimtok**](https://github.com/Stxyu-p/trimtok) and [**Skill Proof**](https://github.com/Stxyu-p/skill-proof) completes the **Global Agent Trinity** — uniting every AI coding client on your machine around three shared local hubs:
|
|
354
|
+
|
|
355
|
+
```mermaid
|
|
356
|
+
flowchart LR
|
|
357
|
+
Task(["Developer Request"]) --> SP["Skill Proof<br/>~/.skill-proof/skills<br/>(Deterministic Skill Router)"]
|
|
358
|
+
SP --> MC["MemCore<br/>~/.memcore<br/>(Governed Bitemporal Memory)"]
|
|
359
|
+
MC --> Agent["Any AI Coding Agent"]
|
|
360
|
+
Agent --> TT["trimtok<br/>~/.trimtok<br/>(88.3% Context Compression + CCR #c1)"]
|
|
361
|
+
TT --> Agent
|
|
362
|
+
```
|
|
363
|
+
|
|
364
|
+
| Pillar | Repository | Global Hub | What Installing All 3 Gives You |
|
|
365
|
+
| :--- | :--- | :--- | :--- |
|
|
366
|
+
| **Governed Memory** | **[MemCore](https://github.com/Stxyu-p/memcore)** | `~/.memcore` | Gives every IDE and CLI **one shared bitemporal brain** (`FTS5` + `sqlite-vec` SIMD + `model2vec`) with hard trust boundaries and source-file staleness tracking. |
|
|
367
|
+
| **Context Shield** | **[trimtok](https://github.com/Stxyu-p/trimtok)** | `~/.trimtok` | Cuts terminal, traceback, diff, AST code, and JSON token bloat by **88.3%** with instant `#c1` lossless recovery. |
|
|
368
|
+
| **Skill Vault & Router** | **[Skill Proof](https://github.com/Stxyu-p/skill-proof)** | `~/.skill-proof/skills` | Consolidates all dispersed `SKILL.md` playbooks into **one deduplicated global vault** and routes tasks in `< 1 ms` with zero routing LLM calls. |
|
|
369
|
+
|
|
370
|
+
```bash
|
|
371
|
+
# Install & link the complete Global Agent Trinity across all your IDEs and CLIs
|
|
372
|
+
pip install memcore-omnix trimtok skill-proof
|
|
373
|
+
memcore init && memcore install && trimtok install && skill-proof install
|
|
374
|
+
skill-proof vault migrate
|
|
375
|
+
```
|
|
376
|
+
|
|
377
|
+
---
|
|
378
|
+
|
|
379
|
+
## Verification & License
|
|
380
|
+
|
|
381
|
+
```bash
|
|
382
|
+
# Run the complete 605-test governance, bitemporal, concurrency, and hybrid recall harness
|
|
383
|
+
python -m unittest discover -s harness -p "test_*.py"
|
|
384
|
+
```
|
|
385
|
+
|
|
386
|
+
Distributed under the [MIT License](LICENSE). Designed and maintained by **P Choke & SORA**.
|