@simbimbo/memory-ocmemog 0.1.11 → 0.1.13
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.
- package/CHANGELOG.md +30 -0
- package/README.md +83 -18
- package/brain/runtime/__init__.py +2 -12
- package/brain/runtime/config.py +1 -24
- package/brain/runtime/inference.py +1 -151
- package/brain/runtime/instrumentation.py +1 -15
- package/brain/runtime/memory/__init__.py +3 -13
- package/brain/runtime/memory/api.py +1 -1219
- package/brain/runtime/memory/candidate.py +1 -185
- package/brain/runtime/memory/conversation_state.py +1 -1823
- package/brain/runtime/memory/distill.py +1 -344
- package/brain/runtime/memory/embedding_engine.py +1 -92
- package/brain/runtime/memory/freshness.py +1 -112
- package/brain/runtime/memory/health.py +1 -40
- package/brain/runtime/memory/integrity.py +1 -186
- package/brain/runtime/memory/memory_consolidation.py +1 -58
- package/brain/runtime/memory/memory_links.py +1 -107
- package/brain/runtime/memory/memory_salience.py +1 -233
- package/brain/runtime/memory/memory_synthesis.py +1 -31
- package/brain/runtime/memory/memory_taxonomy.py +1 -33
- package/brain/runtime/memory/pondering_engine.py +1 -654
- package/brain/runtime/memory/promote.py +1 -277
- package/brain/runtime/memory/provenance.py +1 -406
- package/brain/runtime/memory/reinforcement.py +1 -71
- package/brain/runtime/memory/retrieval.py +1 -210
- package/brain/runtime/memory/semantic_search.py +1 -64
- package/brain/runtime/memory/store.py +1 -429
- package/brain/runtime/memory/unresolved_state.py +1 -91
- package/brain/runtime/memory/vector_index.py +1 -323
- package/brain/runtime/model_roles.py +1 -9
- package/brain/runtime/model_router.py +1 -22
- package/brain/runtime/providers.py +1 -66
- package/brain/runtime/security/redaction.py +1 -12
- package/brain/runtime/state_store.py +1 -23
- package/brain/runtime/storage_paths.py +1 -39
- package/docs/architecture/memory.md +20 -24
- package/docs/release-checklist.md +19 -6
- package/docs/usage.md +33 -17
- package/index.ts +8 -1
- package/ocmemog/__init__.py +11 -0
- package/ocmemog/doctor.py +1255 -0
- package/ocmemog/runtime/__init__.py +18 -0
- package/ocmemog/runtime/_compat_bridge.py +28 -0
- package/ocmemog/runtime/config.py +34 -0
- package/ocmemog/runtime/identity.py +115 -0
- package/ocmemog/runtime/inference.py +163 -0
- package/ocmemog/runtime/instrumentation.py +20 -0
- package/ocmemog/runtime/memory/__init__.py +91 -0
- package/ocmemog/runtime/memory/api.py +1594 -0
- package/ocmemog/runtime/memory/candidate.py +192 -0
- package/ocmemog/runtime/memory/conversation_state.py +1831 -0
- package/ocmemog/runtime/memory/distill.py +282 -0
- package/ocmemog/runtime/memory/embedding_engine.py +151 -0
- package/ocmemog/runtime/memory/freshness.py +114 -0
- package/ocmemog/runtime/memory/health.py +93 -0
- package/ocmemog/runtime/memory/integrity.py +208 -0
- package/ocmemog/runtime/memory/memory_consolidation.py +60 -0
- package/ocmemog/runtime/memory/memory_links.py +109 -0
- package/ocmemog/runtime/memory/memory_salience.py +235 -0
- package/ocmemog/runtime/memory/memory_synthesis.py +33 -0
- package/ocmemog/runtime/memory/memory_taxonomy.py +35 -0
- package/ocmemog/runtime/memory/pondering_engine.py +681 -0
- package/ocmemog/runtime/memory/promote.py +279 -0
- package/ocmemog/runtime/memory/provenance.py +408 -0
- package/ocmemog/runtime/memory/reinforcement.py +73 -0
- package/ocmemog/runtime/memory/retrieval.py +224 -0
- package/ocmemog/runtime/memory/semantic_search.py +66 -0
- package/ocmemog/runtime/memory/store.py +433 -0
- package/ocmemog/runtime/memory/unresolved_state.py +93 -0
- package/ocmemog/runtime/memory/vector_index.py +411 -0
- package/ocmemog/runtime/model_roles.py +15 -0
- package/ocmemog/runtime/model_router.py +28 -0
- package/ocmemog/runtime/providers.py +78 -0
- package/ocmemog/runtime/roles.py +92 -0
- package/ocmemog/runtime/security/__init__.py +8 -0
- package/ocmemog/runtime/security/redaction.py +17 -0
- package/ocmemog/runtime/state_store.py +32 -0
- package/ocmemog/runtime/storage_paths.py +70 -0
- package/ocmemog/sidecar/app.py +421 -60
- package/ocmemog/sidecar/compat.py +50 -13
- package/ocmemog/sidecar/transcript_watcher.py +327 -242
- package/openclaw.plugin.json +4 -0
- package/package.json +1 -1
- package/scripts/ocmemog-backfill-vectors.py +5 -3
- package/scripts/ocmemog-continuity-benchmark.py +1 -1
- package/scripts/ocmemog-demo.py +1 -1
- package/scripts/ocmemog-doctor.py +15 -0
- package/scripts/ocmemog-install.sh +29 -7
- package/scripts/ocmemog-integrated-proof.py +374 -0
- package/scripts/ocmemog-reindex-vectors.py +5 -3
- package/scripts/ocmemog-release-check.sh +330 -0
- package/scripts/ocmemog-sidecar.sh +4 -2
- package/scripts/ocmemog-test-rig.py +5 -3
- package/brain/runtime/memory/artifacts.py +0 -33
- package/brain/runtime/memory/context_builder.py +0 -112
- package/brain/runtime/memory/interaction_memory.py +0 -57
- package/brain/runtime/memory/memory_gate.py +0 -38
- package/brain/runtime/memory/memory_graph.py +0 -54
- package/brain/runtime/memory/person_identity.py +0 -83
- package/brain/runtime/memory/person_memory.py +0 -138
- package/brain/runtime/memory/sentiment_memory.py +0 -67
- package/brain/runtime/memory/tool_catalog.py +0 -68
package/docs/usage.md
CHANGED
|
@@ -6,7 +6,7 @@ ocmemog is a repo-local OpenClaw memory sidecar backed by SQLite with llama.cpp-
|
|
|
6
6
|
|
|
7
7
|
- search/get over local memory are supported
|
|
8
8
|
- provider-backed local embeddings are the primary path
|
|
9
|
-
-
|
|
9
|
+
- some advanced memory flows still depend on compatibility-shimmed runtime surfaces and may run in degraded mode depending on the configured provider/runtime
|
|
10
10
|
|
|
11
11
|
## Running the sidecar
|
|
12
12
|
|
|
@@ -21,9 +21,15 @@ scripts/ocmemog-sidecar.sh
|
|
|
21
21
|
Manual watcher:
|
|
22
22
|
|
|
23
23
|
```bash
|
|
24
|
-
#
|
|
24
|
+
# if you set OCMEMOG_TRANSCRIPT_DIR, that path is watched; otherwise defaults to
|
|
25
|
+
# ~/.openclaw/workspace/memory/transcripts (or ~/.openclaw/agents/main/sessions when
|
|
26
|
+
# OCMEMOG_SESSION_DIR is set and no transcript path is given)
|
|
25
27
|
export OCMEMOG_TRANSCRIPT_DIR="$HOME/.openclaw/workspace/memory/transcripts"
|
|
26
|
-
export
|
|
28
|
+
export OCMEMOG_SESSION_DIR="$HOME/.openclaw/agents/main/sessions"
|
|
29
|
+
export OCMEMOG_INGEST_ENDPOINT="http://127.0.0.1:17891/memory/ingest_async"
|
|
30
|
+
export OCMEMOG_TRANSCRIPT_POLL_SECONDS=30
|
|
31
|
+
export OCMEMOG_INGEST_BATCH_SECONDS=30
|
|
32
|
+
export OCMEMOG_INGEST_BATCH_MAX=25
|
|
27
33
|
./scripts/ocmemog-transcript-watcher.sh
|
|
28
34
|
```
|
|
29
35
|
|
|
@@ -42,7 +48,7 @@ Useful environment variables:
|
|
|
42
48
|
export OCMEMOG_HOST=127.0.0.1
|
|
43
49
|
export OCMEMOG_PORT=17891
|
|
44
50
|
export OCMEMOG_STATE_DIR=/path/to/state
|
|
45
|
-
export OCMEMOG_DB_PATH=/path/to/
|
|
51
|
+
export OCMEMOG_DB_PATH=/path/to/ocmemog_memory.sqlite3
|
|
46
52
|
export OCMEMOG_MEMORY_MODEL=gpt-4o-mini
|
|
47
53
|
export OCMEMOG_OPENAI_API_KEY=sk-...
|
|
48
54
|
export OCMEMOG_OPENAI_API_BASE=https://api.openai.com/v1
|
|
@@ -51,18 +57,30 @@ export OCMEMOG_LOCAL_LLM_BASE_URL=http://127.0.0.1:18080/v1
|
|
|
51
57
|
export OCMEMOG_LOCAL_LLM_MODEL=qwen2.5-7b-instruct
|
|
52
58
|
export OCMEMOG_LOCAL_EMBED_BASE_URL=http://127.0.0.1:18081/v1
|
|
53
59
|
export OCMEMOG_LOCAL_EMBED_MODEL=nomic-embed-text-v1.5
|
|
54
|
-
export
|
|
55
|
-
export
|
|
60
|
+
export OCMEMOG_EMBED_MODEL_LOCAL=simple
|
|
61
|
+
export OCMEMOG_EMBED_MODEL_PROVIDER=local-openai
|
|
62
|
+
export OCMEMOG_SESSION_DIR=$HOME/.openclaw/agents/main/sessions
|
|
56
63
|
export OCMEMOG_TRANSCRIPT_DIR=$HOME/.openclaw/workspace/memory/transcripts
|
|
57
64
|
export OCMEMOG_TRANSCRIPT_GLOB=*.log
|
|
58
|
-
export
|
|
65
|
+
export OCMEMOG_TRANSCRIPT_WATCHER=true
|
|
66
|
+
export OCMEMOG_TRANSCRIPT_POLL_SECONDS=30
|
|
59
67
|
export OCMEMOG_INGEST_KIND=memory
|
|
60
68
|
export OCMEMOG_INGEST_SOURCE=transcript
|
|
61
|
-
export
|
|
69
|
+
export OCMEMOG_INGEST_ASYNC_WORKER=true
|
|
70
|
+
export OCMEMOG_INGEST_ASYNC_POLL_SECONDS=5
|
|
71
|
+
export OCMEMOG_INGEST_ASYNC_BATCH_MAX=25
|
|
72
|
+
export OCMEMOG_INGEST_BATCH_SECONDS=30
|
|
73
|
+
export OCMEMOG_INGEST_BATCH_MAX=25
|
|
74
|
+
export OCMEMOG_SHUTDOWN_DRAIN_QUEUE=false
|
|
75
|
+
export OCMEMOG_WORKER_SHUTDOWN_TIMEOUT_SECONDS=0.35
|
|
76
|
+
export OCMEMOG_SHUTDOWN_TIMING=true
|
|
77
|
+
export OCMEMOG_SHUTDOWN_DUMP_THREADS=false
|
|
62
78
|
```
|
|
63
79
|
|
|
64
80
|
Default state location in this repo is `.ocmemog-state/`.
|
|
65
81
|
|
|
82
|
+
On shutdown, set `OCMEMOG_SHUTDOWN_DRAIN_QUEUE=true` to synchronously flush queued ingest entries before exit. This is useful for short-running deployments and tests that expect strong delivery guarantees.
|
|
83
|
+
|
|
66
84
|
## Plugin API
|
|
67
85
|
|
|
68
86
|
Health:
|
|
@@ -183,15 +201,13 @@ Notes:
|
|
|
183
201
|
|
|
184
202
|
## What is not safe to rely on yet
|
|
185
203
|
|
|
186
|
-
- `brain/runtime/memory/api.py`
|
|
187
|
-
- It targets missing/legacy tables and columns.
|
|
188
204
|
- Provider-backed embeddings
|
|
189
|
-
- Available when `
|
|
190
|
-
- Legacy OpenAI-hosted embeddings remain available when `
|
|
205
|
+
- Available when `OCMEMOG_EMBED_MODEL_PROVIDER=local-openai` and the local embedding endpoint is reachable.
|
|
206
|
+
- Legacy OpenAI-hosted embeddings remain available when `OCMEMOG_EMBED_MODEL_PROVIDER=openai` and `OCMEMOG_OPENAI_API_KEY` is set.
|
|
191
207
|
- Model-backed distillation
|
|
192
208
|
- Available when `OCMEMOG_OPENAI_API_KEY` is set; otherwise falls back to heuristic distill.
|
|
193
209
|
- Role-prioritized context building
|
|
194
|
-
- `brain.runtime.roles.role_registry` is
|
|
210
|
+
- `brain.runtime.roles.role_registry` is now provided by `ocmemog.runtime.roles` and mirrored in compatibility probes.
|
|
195
211
|
- Full brAIn memory parity
|
|
196
212
|
- The repo ships only a subset of the original runtime architecture.
|
|
197
213
|
|
|
@@ -201,7 +217,7 @@ To inspect memory state quickly:
|
|
|
201
217
|
|
|
202
218
|
```bash
|
|
203
219
|
python3 - <<'PY'
|
|
204
|
-
from
|
|
220
|
+
from ocmemog.runtime.memory import store
|
|
205
221
|
store.init_db()
|
|
206
222
|
conn = store.connect()
|
|
207
223
|
for table in ("knowledge", "reflections", "directives", "tasks", "candidates", "promotions"):
|
|
@@ -215,7 +231,7 @@ To rebuild embeddings for recent knowledge rows:
|
|
|
215
231
|
|
|
216
232
|
```bash
|
|
217
233
|
python3 - <<'PY'
|
|
218
|
-
from
|
|
234
|
+
from ocmemog.runtime.memory import vector_index
|
|
219
235
|
print(vector_index.index_memory())
|
|
220
236
|
PY
|
|
221
237
|
```
|
|
@@ -223,7 +239,7 @@ PY
|
|
|
223
239
|
## TODO: Missing runtime dependencies
|
|
224
240
|
|
|
225
241
|
- TODO: wire a real inference backend before enabling distill/promote as an operator-facing workflow
|
|
226
|
-
-
|
|
227
|
-
-
|
|
242
|
+
- Provider execution is now native-first through `OCMEMOG_EMBED_MODEL_PROVIDER`; `BRAIN_EMBED_MODEL_PROVIDER` remains as a compatibility alias.
|
|
243
|
+
- Role-based context selection now has native ownership coverage via `ocmemog.runtime.roles` with shim-aware capability reporting.
|
|
228
244
|
- TODO: harden `/memory/get` with a table allow-list before exposing the sidecar outside trusted local use
|
|
229
245
|
- TODO: decide whether to expose `runbooks` and `lessons` in the plugin API
|
package/index.ts
CHANGED
|
@@ -6,6 +6,7 @@ const DEFAULT_TIMEOUT_MS = 30_000;
|
|
|
6
6
|
type PluginConfig = {
|
|
7
7
|
endpoint: string;
|
|
8
8
|
timeoutMs: number;
|
|
9
|
+
token?: string;
|
|
9
10
|
};
|
|
10
11
|
|
|
11
12
|
const AUTO_HYDRATION_ENABLED = ["1", "true", "yes"].includes(
|
|
@@ -80,6 +81,7 @@ function readConfig(raw: unknown): PluginConfig {
|
|
|
80
81
|
typeof cfg.timeoutMs === "number" && Number.isFinite(cfg.timeoutMs) && cfg.timeoutMs > 0
|
|
81
82
|
? cfg.timeoutMs
|
|
82
83
|
: DEFAULT_TIMEOUT_MS,
|
|
84
|
+
token: typeof cfg.token === "string" && cfg.token.trim() ? cfg.token.trim() : undefined,
|
|
83
85
|
};
|
|
84
86
|
}
|
|
85
87
|
|
|
@@ -88,9 +90,14 @@ async function postJson<T>(config: PluginConfig, path: string, body: Record<stri
|
|
|
88
90
|
const timeout = setTimeout(() => controller.abort(), config.timeoutMs);
|
|
89
91
|
|
|
90
92
|
try {
|
|
93
|
+
const headers: Record<string, string> = { "content-type": "application/json" };
|
|
94
|
+
if (config.token) {
|
|
95
|
+
headers["x-ocmemog-token"] = config.token;
|
|
96
|
+
}
|
|
97
|
+
|
|
91
98
|
const response = await fetch(new URL(path, config.endpoint).toString(), {
|
|
92
99
|
method: "POST",
|
|
93
|
-
headers
|
|
100
|
+
headers,
|
|
94
101
|
body: JSON.stringify(body),
|
|
95
102
|
signal: controller.signal,
|
|
96
103
|
});
|
package/ocmemog/__init__.py
CHANGED
|
@@ -1 +1,12 @@
|
|
|
1
1
|
"""ocmemog sidecar package."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from importlib.metadata import PackageNotFoundError, version as _package_version
|
|
6
|
+
|
|
7
|
+
try:
|
|
8
|
+
__version__ = _package_version("ocmemog-sidecar")
|
|
9
|
+
except PackageNotFoundError: # pragma: no cover - package metadata may be unavailable in source layouts.
|
|
10
|
+
__version__ = "0.1.12"
|
|
11
|
+
|
|
12
|
+
__all__ = ["__version__"]
|