@agenr/openclaw-plugin 0.14.1 → 1.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,320 +1,12 @@
1
- ```text
2
- █████╗ ██████╗ ███████╗███╗ ██╗██████╗
3
- ██╔══██╗██╔════╝ ██╔════╝████╗ ██║██╔══██╗
4
- ███████║██║ ███╗█████╗ ██╔██╗ ██║██████╔╝
5
- ██╔══██║██║ ██║██╔══╝ ██║╚██╗██║██╔══██╗
6
- ██║ ██║╚██████╔╝███████╗██║ ╚████║██║ ██║
7
- ╚═╝ ╚═╝ ╚═════╝ ╚══════╝╚═╝ ╚═══╝╚═╝ ╚═╝
8
- AGENt memoRy
9
- ```
10
-
11
- # AGENR
12
-
13
- **AY-JEN-ER** - Human memory for AI agents.
14
-
15
- This README is the overview and quick start. Canonical mechanism docs live in [docs/ARCHITECTURE.md](./docs/ARCHITECTURE.md) and [docs/OPENCLAW.md](./docs/OPENCLAW.md).
16
-
17
- AGENR is a local, structured, universal, living memory layer for AI agents. It tackles session amnesia, multi-surface fragmentation, and vendor lock-in together so you get one person, many agents, one brain.
18
-
19
- It extracts structured knowledge from conversation transcripts - facts, decisions, preferences, todos, relationships, events, lessons - and stores them in a local database with semantic search. Entries strengthen when reinforced, decay when stale, and resolve contradictions. Your memory stays on your machine.
20
-
21
- More: [Vision](./docs/vision.md) | [Roadmap](./docs/roadmap.md) | [Architecture](./docs/ARCHITECTURE.md) | [OpenClaw guide](./docs/OPENCLAW.md)
22
-
23
- ## Quick Start
24
-
25
- ```bash
26
- pnpm install -g agenr
27
- agenr init
28
- ```
29
-
30
- That's it. The interactive wizard handles everything: auth setup, platform detection, plugin installation, session ingestion, and watcher configuration. Run `agenr init` again anytime to reconfigure.
31
-
32
- ## What It Does
33
-
34
- - **Extract** - An LLM reads your transcripts and pulls out structured entries. Smart filtering removes noise (tool calls, file contents, boilerplate - about 80% of a typical session) before the LLM sees it. Hedged or unverified agent claims are capped at importance 5 with an `unverified` tag.
35
- - **Store** - Entries get embedded and compared against existing knowledge. Near-duplicates reinforce existing entries. New information gets inserted. Online dedup catches copies in real-time.
36
- - **Recall** - Semantic search plus memory-aware ranking. Entries you recall often score higher. Stale entries decay. Contradicted entries get penalized.
37
- - **Surgeon** - Corpus health maintenance: deterministic cleanup, quality evolution, and LLM-assisted retirement, dedup, and contradiction resolution.
38
-
39
- ```text
40
- Transcript -> Filter -> Extract -> Store -> Recall
41
- 80% LLM dedup semantic
42
- noise typed + embed + memory-
43
- removed entries + dedup aware
44
- ```
45
-
46
- ## What You Need
47
-
48
- An **OpenAI API key** for embeddings (`text-embedding-3-small`). Embeddings cost fractions of a penny per operation - a full ingestion of 100+ session transcripts runs about $0.10 total.
49
-
50
- For the LLM extraction step, AGENR supports:
51
- - **OpenAI API key** (recommended) - `gpt-5.4-mini` is the default baseline and recommended balance of quality and cost; `gpt-5.4` is the higher-quality option and the default surgeon model; `gpt-4.1-mini` remains available as a lower-cost fallback
52
- - **OpenAI Pro subscription** - no API key needed
53
- - **Anthropic Claude subscription** - no API key needed
54
-
55
- The `agenr init` wizard walks you through all of this.
56
-
57
- ```bash
58
- export OPENAI_API_KEY=sk-... # for embeddings + extraction
59
- ```
60
-
61
- ## Platform Setup
62
-
63
- ### OpenClaw (recommended)
64
-
65
- `agenr init` auto-detects OpenClaw, installs the native plugin, and restarts the gateway. The plugin handles everything automatically: session-start context injection (recent turns, core recall, browse recall, and a memory index), mid-session signals when important entries arrive, cross-session handoff summaries, and native `agenr_recall`, `agenr_store`, `agenr_extract`, `agenr_retire`, `agenr_update`, and session-project tools.
66
-
67
- No AGENTS.md edits needed. No MCP config needed. The bundled SKILL.md loads automatically and instructs the agent when to call `agenr_store` proactively.
68
-
69
- **Manual alternative:**
70
-
71
- ```bash
72
- openclaw plugins install agenr
73
- ```
74
-
75
- > **Security notice:** The OpenClaw plugin runs recall, store, extract, retire, update, and trace flows through shared in-process agenr services. It does not shell out to the agenr CLI, read your OpenClaw credentials, or send data anywhere except your configured model and embedding providers. The plugin source is open and auditable.
76
-
77
- Optional config in `openclaw.json`:
78
-
79
- ```json
80
- {
81
- "plugins": {
82
- "entries": {
83
- "agenr": {
84
- "config": {
85
- "budget": 2000,
86
- "signalMinImportance": 8,
87
- "signalCooldownMs": 30000,
88
- "signalMaxPerSession": 10
89
- }
90
- }
91
- }
92
- }
93
- }
94
- ```
95
-
96
- Signal config controls how often mid-session notifications fire. See [docs/OPENCLAW.md](./docs/OPENCLAW.md) for all available options.
97
-
98
- ### Claude Code
99
-
100
- ```bash
101
- agenr init --platform claude-code
102
- ```
103
-
104
- Adds the `agenr_recall` instruction block to `~/.claude/CLAUDE.md` and wires `.mcp.json`.
105
-
106
- ### Codex
107
-
108
- ```bash
109
- agenr init --platform codex
110
- ```
111
-
112
- Adds the `agenr_recall` instruction block to `~/.codex/AGENTS.md` and wires `~/.codex/config.toml`.
113
-
114
- ### Cursor
115
-
116
- ```bash
117
- agenr init --platform cursor
118
- ```
119
-
120
- Adds instructions to `.cursor/rules/agenr.mdc` and wires `.cursor/mcp.json`.
121
-
122
- ### Windsurf
123
-
124
- ```bash
125
- agenr init --platform windsurf
126
- ```
127
-
128
- Adds instructions to `~/.codeium/windsurf/memories/global_rules.md` and wires `.mcp.json`.
129
-
130
- ### Generic / Any MCP Tool
131
-
132
- ```bash
133
- agenr init # auto-detects platform, falls back to generic AGENTS.md
134
- ```
135
-
136
- Or start `agenr mcp` as a stdio MCP server and configure it in your tool's MCP settings manually. Your agent gets `agenr_recall`, `agenr_store`, `agenr_extract`, `agenr_retire`, and `agenr_update` as tools.
137
-
138
- ## How Memory Works
139
-
140
- ### Extraction & Storage
141
-
142
- AGENR reads your session transcripts, filters out noise, and extracts structured knowledge entries. Each entry has a type, subject, content, importance, and expiry. Near-duplicates are caught automatically - if you discussed the same decision in three sessions, you get one entry with higher confirmations, not three copies.
143
-
144
- ```bash
145
- agenr ingest ~/.openclaw/agents/main/sessions/ --glob '**/*.jsonl'
1
+ # @agenr/openclaw-plugin
146
2
 
147
- [1/108] session-abc123.jsonl (1.2MB) - 12 extracted, 10 stored, 1 skipped (duplicate), 1 reinforced
148
- [2/108] session-def456.jsonl (800KB) - 8 extracted, 7 stored, 0 skipped, 1 reinforced
149
- ...
150
- ```
3
+ Plugin-only npm package for the agenr OpenClaw memory integration.
151
4
 
152
- ### Recall (semantic + memory-aware)
5
+ Install it with:
153
6
 
154
7
  ```bash
155
- agenr recall "package manager"
8
+ openclaw plugins install @agenr/openclaw-plugin
9
+ openclaw gateway restart
156
10
  ```
157
11
 
158
- ```text
159
- 1 results (46ms)
160
- 1. [decision] project tooling: We switched this project to pnpm.
161
- importance=7 | today | recalled 3 times
162
- tags: tooling, package-manager
163
- ```
164
-
165
- Recall supports date range queries (`--since 14d --until 7d`), temporal browse mode (`--browse --since 1d`), and around-date targeting (`--around 2026-02-15 --around-radius 14`) to rank entries primarily by distance from a specific date with importance used as a secondary tiebreaker.
166
-
167
- ### Cross-session Handoff
168
-
169
- When you start a new OpenClaw session, agenr injects a startup context assembled from four pieces:
170
-
171
- 1. **Recent turns** - the last few user/assistant turns from the previous session file for immediate continuity
172
- 2. **Core recall** - universal core memory plus project-tagged core memory for configured `coreProjects`
173
- 3. **Browse recall** - recent high-value memory, scoped by explicit session project when one exists, otherwise limited to universal / NULL-project entries
174
- 4. **Memory index** - a compact breadcrumb list of available projects and memory buckets
175
-
176
- The plugin formats those pieces into startup markdown, applies selector and budget limits, and records only the entries that were actually rendered so startup and mid-session recall can dedupe cleanly.
177
-
178
- When a session ends, the plugin writes a handoff using a fallback-first strategy: it stores a lightweight fallback entry immediately, then attempts an LLM-upgraded handoff summary. If the LLM upgrade succeeds, the fallback is retired. On the next session start, surfaced handoff entries are consumed and retired after use.
179
-
180
- See [docs/OPENCLAW.md](./docs/OPENCLAW.md) for the current startup flow and [docs/OPENCLAW_HANDOFFS.md](./docs/OPENCLAW_HANDOFFS.md) for the detailed handoff lifecycle.
181
-
182
- ### Corpus Health
183
-
184
- The surgeon is the single corpus-health entry point. It runs deterministic pre-steps first, then performs the selected semantic pass. A bare run defaults to a full `auto` sweep:
185
-
186
- ```bash
187
- agenr surgeon run --apply
188
- ```
189
-
190
- ## Advanced
191
-
192
- ### Multi-instance & DB Isolation
193
-
194
- When running multiple OpenClaw instances (or mixing OpenClaw and Codex), each instance gets registered in a global projects map at `~/.agenr/config.json`. By default, all instances share `~/.agenr/knowledge.db` with data separated by project tags.
195
-
196
- For non-default OpenClaw paths, the init wizard offers isolated databases:
197
-
198
- ```text
199
- ~/.agenr/knowledge.db # shared (default)
200
- ~/my-openclaw/agenr-data/knowledge.db # isolated
201
- ```
202
-
203
- The wizard writes the isolated DB path directly to the OpenClaw plugin config so no manual editing is needed.
204
-
205
- ### Manual Ingest
206
-
207
- ```bash
208
- agenr ingest <paths...> --bulk --workers 10 --whole-file
209
- ```
210
-
211
- The init wizard offers cost estimation before ingestion using model pricing, showing estimated token counts and costs for recent (last 7 days) vs full history ingestion.
212
-
213
- ### Live Watching & Watcher
214
-
215
- The watcher tails your session files, extracts new knowledge every few minutes, and stores it. If you ingested history first, watch resumes right where ingest left off.
216
-
217
- ```bash
218
- # Watch your sessions directory
219
- agenr watch --platform openclaw
220
-
221
- # Install as a background daemon (macOS launchd, 120s interval)
222
- agenr watcher install
223
- agenr watcher status
224
- agenr watcher logs
225
- ```
226
-
227
- ### Benchmarking
228
-
229
- Evaluate extraction quality against scored rubrics:
230
-
231
- ```bash
232
- agenr benchmark
233
- ```
234
-
235
- Runs extraction against benchmark session fixtures, scores results against rubric JSON, and reports per-session plus overall metrics (recall, partial recall, precision proxy, composite score, pass rate). Supports multi-run aggregation with mean/min/stdev reporting.
236
-
237
- ### MCP Integration (manual)
238
-
239
- If you prefer manual MCP setup over `agenr init`, start the stdio server:
240
-
241
- ```bash
242
- agenr mcp
243
- ```
244
-
245
- This exposes five MCP tools: `agenr_recall`, `agenr_store`, `agenr_extract`, `agenr_retire`, and `agenr_update`. Use `agenr_store` for precise structured writes. Watcher ingestion and platform integrations still remain useful for transcript-scale capture.
246
-
247
- ## Commands
248
-
249
- | Command | What it does |
250
- | --- | --- |
251
- | `agenr init` | Interactive setup wizard: auth, platform detection, plugin install, ingestion, watcher. Replaces the old `setup` flow. Use `--platform` to skip auto-detection. |
252
- | `agenr setup` | Configure LLM provider, auth, and model defaults (also available inside `init`) |
253
- | `agenr config` | Show and update agenr configuration |
254
- | `agenr auth` | Authentication status and diagnostics |
255
- | `agenr ingest <paths...>` | Bulk-ingest files and directories |
256
- | `agenr extract <files...>` | Extract knowledge entries from text files |
257
- | `agenr store [files...]` | Store entries with semantic dedup |
258
- | `agenr recall [query]` | Semantic + memory-aware recall. Use `--since`/`--until` for date ranges, `--around` for target-date ranking, `--browse` for temporal mode. |
259
- | `agenr retire [subject]` | Retire a stale entry (hidden, not deleted). Match by subject or `--id`. |
260
- | `agenr update --id <id> [--importance <n>] [--expiry <level>]` | Update mutable entry metadata in place. Supports importance and expiry; pass at least one. |
261
- | `agenr watch [file]` | Live-watch files/directories, auto-extract knowledge |
262
- | `agenr watcher install` | Install background watch daemon (macOS launchd) |
263
- | `agenr watcher status` | Show daemon status (running/stopped, pid, watched file, recent logs) |
264
- | `agenr watcher logs` | Stream or show recent daemon logs |
265
- | `agenr surgeon run` | Run corpus-health maintenance: cleanup, quality evolution, and retirement/dedup/contradictions |
266
- | `agenr benchmark` | Run extraction against benchmark fixtures and score results |
267
- | `agenr context` | Generate context file for AI tool integration |
268
- | `agenr health` | Show database health and cleanup status |
269
- | `agenr mcp` | Start MCP server (stdio) |
270
- | `agenr todo <subcommand>` | Manage todos in the knowledge base |
271
- | `agenr db <cmd>` | Database management (stats, version, export, reset, path, check, vector-check, rebuild-index) |
272
-
273
- Full reference: [docs/CLI.md](./docs/CLI.md) | [docs/CONFIGURATION.md](./docs/CONFIGURATION.md)
274
-
275
- ## Architecture
276
-
277
- - **Runtime:** Node.js 20+, TypeScript, ESM
278
- - **Storage:** libsql/SQLite - default at `~/.agenr/knowledge.db`, optionally isolated per instance
279
- - **Embeddings:** OpenAI `text-embedding-3-small`, 1024 dimensions
280
- - **Recall scoring:** Vector similarity x recency x memory strength (max(importance, recall strength)), with contradiction penalties
281
- - **Global config:** `~/.agenr/config.json` - stores auth, model, and a projects map keyed by directory path with platform, project slug, and optional isolated DB path per instance
282
-
283
- Deep dive: [docs/ARCHITECTURE.md](./docs/ARCHITECTURE.md)
284
-
285
- ## Status
286
-
287
- The core pipeline is stable and tested. We use it daily managing thousands of knowledge entries across OpenClaw sessions.
288
-
289
- **Shipped:** extraction, storage, recall (semantic + browse), MCP integration, online dedup, surgeon corpus health passes, smart filtering, live watching, daemon mode, cross-session handoff (LLM-summarized), three-phase context injection, interactive init wizard, cost estimation, DB isolation, benchmarking.
290
-
291
- **Next:** GUI Management Console (browse, search, and curate your knowledge database visually), Cursor live signals, Claude Code UserPromptSubmit adapter, transitive project dependencies.
292
-
293
- ## Philosophy
294
-
295
- The big labs are building bigger brains. agenr is building better continuity.
296
-
297
- The product bet is that memory should be local, structured, universal, and living: local because it is yours, structured because "what did we decide?" needs a real answer, universal because it should work across surfaces, and living because stale or contradicted memory must be maintained rather than merely accumulated.
298
-
299
- For the product thesis, see [docs/vision.md](./docs/vision.md).
300
-
301
- ## Troubleshooting
302
-
303
- | Problem | Fix |
304
- |---|---|
305
- | `agenr init` wizard fails to detect platform | Pass `--platform openclaw` (or `codex`, `claude-code`, etc.) explicitly |
306
- | Plugin install fails during wizard | Run `openclaw plugins install agenr` manually, then `openclaw gateway restart` |
307
- | Embeddings fail | Set `OPENAI_API_KEY` env var or `agenr config set-key openai <key>` |
308
- | Database locked | Wait for the active write-heavy command to finish (`agenr ingest --bulk`, `agenr surgeon run --apply`, etc.) and retry |
309
- | Recall returns nothing after force-kill | `agenr db vector-check --rebuild` (vector shadow-table drift) |
310
- | Extraction fails mid-file | Retry - dedup skips already-stored entries |
311
- | Stale handoff entries persist | Run `agenr recall --browse --since 1d` to check, then `agenr retire --id <id>` |
312
- | Gateway doesn't pick up plugin | Run `openclaw gateway restart` after plugin install |
313
-
314
- ## License
315
-
316
- AGPL-3.0 - [LICENSE](./LICENSE)
317
-
318
- ## Contributing
319
-
320
- See [CONTRIBUTING.md](./CONTRIBUTING.md)
12
+ The OpenClaw plugin id remains `agenr`, so existing plugin config keys and memory-slot settings stay the same.