stenotype 0.1.0 → 0.2.0

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/README.md CHANGED
@@ -1,217 +1,43 @@
1
- # Stenotype — Memory Plugin for OpenClaw
1
+ # Stenotype
2
2
 
3
- ![version](https://img.shields.io/badge/version-0.4.0-blue)
4
- ![tests](https://img.shields.io/badge/tests-88%20passing-brightgreen)
5
- ![license](https://img.shields.io/badge/license-MIT-lightgrey)
6
-
7
- Automatic memory capture and recall. LLM-powered extraction with hybrid vector+keyword search.
8
-
9
- ## Quick links
10
-
11
- - [Changelog](./CHANGELOG.md)
12
- - [Architecture](./docs/architecture.md)
13
- - [Config reference](./docs/config-reference.md)
14
- - [FAQ](./docs/faq.md)
15
- - [Benchmarking](./docs/benchmarking.md)
16
- - [Release checklist](./docs/release-checklist.md)
17
-
18
- ## Architecture
19
-
20
- Three stages:
21
-
22
- 1. **Recall** (`before_agent_start`) — embed user message, query SQLite with hybrid scoring (vector similarity + FTS5 keywords + temperature-weighted recency + importance + usage frequency), inject relevant memories via `prependContext`
23
- 2. **Log** (`agent_end` + session watcher) — append raw conversation to NDJSON files + SQLite. Session watcher scans `~/.openclaw/agents/*/sessions` for cross-agent coverage.
24
- 3. **Extract** (background service, every 15min) — LLM extracts structured memories (category, content, subject, confidence, tags) from unprocessed logs. Deduplicates and supersedes contradicted memories.
3
+ Automatic memory capture and recall for AI agent workflows.
25
4
 
26
5
  ## Install
27
6
 
28
- `openclaw stenotype setup` now includes:
29
- - explicit extraction + embedding provider selection
30
- - optional provider connectivity checks
31
- - optional safe `MEMORY.md` import on next start
32
- - daily summary cron scheduling (keep/enable/disable, once-daily)
33
-
34
- It also patches existing **Daily Summary** crons to use Stenotype NDJSON logs (`~/.stenotype/logs/YYYY-MM-DD.ndjson`) as the source of truth instead of `ai-memory/session-logs`.
35
-
36
7
  ```bash
37
- # In OpenClaw config, add to plugins.load.paths:
38
- # "plugins": { "load": { "paths": ["/path/to/stenotype"] } }
39
-
40
- # Or symlink into extensions:
41
- ln -s /path/to/stenotype ~/.openclaw/extensions/stenotype
42
-
43
- # Set the memory slot:
44
- # "plugins": { "slots": { "memory": "stenotype" } }
8
+ npm install -g stenotype
9
+ stenotype setup
45
10
  ```
46
11
 
47
12
  ## Configuration
48
13
 
49
- ```json5
50
- {
51
- plugins: {
52
- slots: { memory: "stenotype" },
53
- entries: {
54
- stenotype: {
55
- enabled: true,
56
- config: {
57
- embeddingApiKey: "${OPENAI_API_KEY}",
58
- extractionApiKey: "${OPENAI_API_KEY}",
59
- extractionModel: "gpt-4o-mini",
60
- agentId: "main", // defaults to OPENCLAW_AGENT_ID or "main"
61
- recallScope: "agent", // "agent" (isolated) or "global"
62
- autoRecall: true,
63
- autoCapture: true,
64
- fileSync: true
65
- }
66
- }
67
- }
68
- }
69
- }
70
- ```
71
-
72
- ## CLI
73
-
74
- ```bash
75
- openclaw stenotype status # Health check
76
- openclaw stenotype stats # Detailed statistics
77
- openclaw stenotype search "query" # Search memories
78
- openclaw stenotype sync # Force MEMORY.md sync
79
- openclaw stenotype setup # Interactive setup wizard
80
- openclaw stenotype setup --headless --summary-schedule enable --summary-time 02:15
81
- openclaw stenotype temps # Update temperature tiers
82
- openclaw stenotype baseline # 7-day telemetry/token baseline
83
- openclaw stenotype baseline --out ./artifacts/baseline # writes JSON+MD report
84
-
85
- # local model management
86
- openclaw stenotype model status
87
- openclaw stenotype model download
88
- ```
89
-
90
- Benchmark harness (issue #14 support):
91
-
92
- ```bash
93
- cp bench/benchmark-dataset.template.json bench/benchmark-dataset.json
94
- node scripts/benchmark-local-vs-cloud.mjs --dataset ./bench/benchmark-dataset.json --local-model ~/.cache/stenotype/models/qwen2.5-3b-instruct-q4_k_m.gguf
95
- ```
96
-
97
- ## Memory reliability features (v0.4 workstream)
98
-
99
- - **Deterministic preflight gate** (`preflightMode: "warn" | "strict"`): checks pinned directives + open commitments before recall injection.
100
- - **Pinned durable memory tier**: use `memory_pin` tool to mark must-load context.
101
- - **Commitment ledger**: use `commitment_add` tool (plus auto-capture from assistant "I will…" statements).
102
- - **Two-stage recall packing**: deterministic (pinned/commitments) first, semantic/FTS second, then dedupe + char-budget packing.
103
- - **Token-aware routing**: `~/.stenotype/job-policy.json` controls max input chars/token caps for extraction/summary/recall jobs.
104
- - **Visible token thresholds + alerts**: warn-level telemetry (`kind: "alert"`) and hard-limit throttling (`kind: "throttle"`) are emitted when budgets are crossed.
105
- - **Baseline telemetry**: NDJSON events under `~/.stenotype/telemetry/` power before/after token and recall comparisons.
106
-
107
- ## Token routing policy (`~/.stenotype/job-policy.json`)
14
+ Add to your agent config:
108
15
 
109
16
  ```json
110
17
  {
111
- "extraction": { "model": "low-cost", "maxInputChars": 15000, "warnTokens": 50000, "hardMaxTokens": 120000 },
112
- "summary": { "model": "low-cost", "maxInputChars": 10000, "warnTokens": 25000, "hardMaxTokens": 70000 },
113
- "recall": { "model": "balanced", "maxInputChars": 6000, "warnTokens": 8000, "hardMaxTokens": 16000 }
18
+ "memory": {
19
+ "provider": "stenotype",
20
+ "agentId": "main",
21
+ "embeddingApiKey": "sk-...",
22
+ "extractionApiKey": "sk-...",
23
+ "extractionModel": "gpt-4o-mini"
24
+ }
114
25
  }
115
26
  ```
116
27
 
117
- - `warnTokens`: emits `alert` telemetry and warning logs (job continues).
118
- - `hardMaxTokens`: emits `throttle` telemetry and enforces a hard stop/fallback for that job.
119
-
120
- ## Agent isolation
121
-
122
- - Memories/logs are tagged with `agent_id` (default `main`).
123
- - Recall defaults to agent-local scope (`recallScope: "agent"`) and can be widened with `"global"`.
124
- - Existing databases are auto-migrated with backfill to `agent_id = "main"` to preserve single-agent behavior.
125
-
126
- ## Storage
127
-
128
- - **Database:** `~/.stenotype/memories.db` (SQLite + FTS5)
129
- - **Logs:** `~/.stenotype/logs/YYYY-MM-DD.ndjson`
130
- - **Embeddings:** Stored as binary blobs, cosine similarity computed in-process
131
- - **Temperature tiers:** Hot (<3d or accessed <7d), Warm (<14d or accessed <30d), Cold (everything else)
132
-
133
- ## Dashboard (built-in + local)
134
-
135
- Stenotype currently ships two dashboard surfaces:
136
-
137
- 1. **Built-in dashboard command** (`openclaw stenotype dashboard`) from `src/dashboard/server.ts`
138
- 2. **Docker-first local dashboard MVP** in `dashboard-local/`
139
-
140
- ### Built-in dashboard (issue #2 scope for current ship)
141
-
142
- Run:
143
-
144
- ```bash
145
- openclaw stenotype dashboard --port 4789
146
- # open http://localhost:4789
147
- ```
148
-
149
- Current capabilities:
150
- - Memory browser with search
151
- - Filter by category, temperature, and date range
152
- - Stats overview (total/active memories, temperature distribution, DB size, today's extraction count)
153
- - Extraction queue status + health signal (healthy/degraded/stalled)
154
- - Memory actions: edit + delete
155
- - Temperature distribution visualization + category bars
156
-
157
- Known limitations (intentionally out of current ship scope):
158
- - No pagination/virtualized table for very large memory sets
159
- - No dedicated extraction-job drilldown (worker runs, retries, error traces)
160
- - No multi-day trend charting/delta analytics yet
161
-
162
- ### Local dashboard MVP (Docker-first)
163
-
164
- A standalone local dashboard is included at `dashboard-local/`.
165
-
166
- ### What it shows
167
-
168
- - Summary cards (total/active memories, last 24h count, log events shown)
169
- - Recent memory events from NDJSON logs (`~/.stenotype/logs/*.ndjson`)
170
- - Memories list from SQLite (`~/.stenotype/memories.db`)
171
- - Search + category filtering
172
-
173
- ### Quick start (Docker Compose)
174
-
175
- ```bash
176
- cd /path/to/stenotype
177
-
178
- docker compose -f docker-compose.dashboard.yml up --build
179
- # open http://localhost:4789
180
- ```
181
-
182
- Optional custom data path:
183
-
184
- ```bash
185
- STENOTYPE_DATA_PATH=/absolute/path/to/.stenotype \
186
- docker compose -f docker-compose.dashboard.yml up --build
187
- ```
188
-
189
- ### Local run (no Docker)
28
+ ## CLI
190
29
 
191
30
  ```bash
192
- cd /path/to/stenotype
193
- node dashboard-local/server.mjs
194
- # open http://localhost:4789
31
+ stenotype setup # Interactive setup
32
+ stenotype status # Health check
33
+ stenotype stats # Memory statistics
34
+ stenotype search "query" # Search memories
35
+ stenotype sync # Sync memory file
36
+ stenotype temps # Update memory tiers
37
+ stenotype baseline # Usage baseline report
38
+ stenotype dashboard # Launch local dashboard
195
39
  ```
196
40
 
197
- ### Data behavior / fallback
198
-
199
- - If `memories.db` exists, dashboard reads memory summary + memory list from SQLite.
200
- - If logs exist, dashboard reads recent event feed from NDJSON logs.
201
- - If neither exists, dashboard serves mock fallback data with an explicit note in UI.
202
-
203
- ## Recall harness CI gate
204
-
205
- - Workflow: `.github/workflows/recall-harness-gate.yml`
206
- - Gate test file: `tests/recall-harness.test.ts`
207
- - Threshold behavior: build fails when deterministic recall assertions or context-budget assertions fail.
208
-
209
- ### TODO (post-MVP)
210
-
211
- - Add pagination + virtualized event rendering for very large logs.
212
- - Add memory management actions (edit/delete) in standalone dashboard.
213
- - Add richer analytics (trend chart by day/week, category deltas).
214
-
215
- ## Memory Categories
41
+ ## License
216
42
 
217
- decision, task, person, project, preference, fact, emotion, instruction, other
43
+ MIT
Binary file
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "stenotype",
3
- "version": "0.1.0",
4
- "description": "Automatic memory capture and recall for AI agent systems",
3
+ "version": "0.2.0",
4
+ "description": "Automatic memory capture and recall for AI agent workflows",
5
5
  "type": "module",
6
- "main": "dist/index.js",
6
+ "main": "dist/index.cjs",
7
7
  "bin": {
8
8
  "stenotype": "dist/index.cjs"
9
9
  },
@@ -11,51 +11,26 @@
11
11
  "dist/index.cjs",
12
12
  "dist/stenotype.jsc"
13
13
  ],
14
- "engines": {
15
- "node": ">=20.0.0"
16
- },
17
14
  "scripts": {
18
15
  "build": "tsc",
19
16
  "build:protected": "node scripts/build-protected.mjs",
20
- "start": "node dist/index.js",
21
- "status": "node dist/index.js status",
22
- "recall": "node dist/index.js recall",
23
- "test": "vitest run",
24
- "test:watch": "vitest",
25
- "test:recall-harness": "vitest run tests/recall-harness.test.ts --reporter=verbose",
26
- "typecheck": "tsc --noEmit",
27
- "baseline:report": "node scripts/generate-baseline-report.mjs main ./artifacts/baseline",
28
- "bench:local-vs-cloud": "node scripts/benchmark-local-vs-cloud.mjs --dataset ./bench/benchmark-dataset.json"
29
- },
30
- "openclaw": {
31
- "extensions": [
32
- "./index.ts"
33
- ]
17
+ "dev": "tsx src/index.ts",
18
+ "prepublishOnly": "node scripts/preflight-publish.mjs"
34
19
  },
35
20
  "dependencies": {
36
- "@modelcontextprotocol/sdk": "^1.29.0",
37
- "@types/express": "^5.0.6",
38
- "@types/pg": "^8.18.0",
39
- "better-sqlite3": "^11.9.1",
40
- "express": "^5.2.1",
41
- "jose": "^6.2.3",
42
- "keytar": "^7.9.0",
43
- "node-llama-cpp": "^3.17.1",
44
- "openai": "^4.80.0",
45
- "pg": "^8.20.0",
46
- "pgvector": "^0.2.1",
47
- "prompts": "^2.4.2"
21
+ "@anthropic-ai/sdk": "^0.90.0",
22
+ "bytenode": "^1.5.7",
23
+ "openai": "^4.78.1",
24
+ "sqlite-vec": "^0.1.7",
25
+ "sqlite-vec-linux-x64": "^0.1.7"
48
26
  },
49
27
  "devDependencies": {
50
- "@sinclair/typebox": "^0.34.0",
51
- "@types/better-sqlite3": "^7.6.13",
52
- "@types/keytar": "^4.4.0",
53
- "@types/prompts": "^2.4.9",
54
- "@types/supertest": "^7.2.0",
55
- "bytenode": "^1.5.7",
56
- "esbuild": "^0.28.0",
57
- "supertest": "^7.2.2",
58
- "typescript": "^5.9.3",
59
- "vitest": "^4.0.18"
28
+ "@types/node": "^22.0.0",
29
+ "esbuild": "^0.24.0",
30
+ "tsx": "^4.19.0",
31
+ "typescript": "^5.7.0"
32
+ },
33
+ "engines": {
34
+ "node": ">=20.0.0"
60
35
  }
61
- }
36
+ }
package/LICENSE DELETED
@@ -1,21 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) 2026 Stenotype contributors
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
package/dist/index.js DELETED
@@ -1,10 +0,0 @@
1
- #!/usr/bin/env node
2
- /**
3
- * Stenotype standalone entrypoint (post-OpenClaw port).
4
- *
5
- * The original OpenClaw plugin registration lives in index.openclaw.ts.archive
6
- * for reference. That file depended on `openclaw/plugin-sdk` and assumed an
7
- * in-process runtime. Ductor runs Stenotype out-of-process as a CLI, so this
8
- * file simply delegates to the subcommand dispatcher in src/cli.ts.
9
- */
10
- import "./src/cli.js";