agenr 1.2.0 → 1.4.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/CHANGELOG.md +54 -0
- package/README.md +50 -23
- package/dist/{chunk-YU3EWRVT.js → chunk-DSP74MEN.js} +755 -28
- package/dist/cli.js +1945 -385
- package/dist/core/recall/index.d.ts +3 -1
- package/dist/core/recall/index.js +1 -1
- package/dist/internal-recall-eval-server.js +2 -2
- package/package.json +20 -20
- package/dist/{chunk-FLRJOP3J.js → chunk-EUPZHNOY.js} +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,59 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [1.4.0] - 2026-03-30
|
|
4
|
+
|
|
5
|
+
Configurable summary models, surgeon personal knowledge protection, and documentation overhaul.
|
|
6
|
+
|
|
7
|
+
### Added
|
|
8
|
+
|
|
9
|
+
- **Configurable continuity and episode summary models.** New `continuityModel` and `episodeModel` fields in the OpenClaw plugin config (`plugins.entries.agenr.config`) allow overriding the model used for continuity and episode summary generation independently. Falls back to the agent's primary model when unset. Use a fast model like `openai/gpt-5.4-mini` for these structured extraction tasks instead of burning Opus tokens.
|
|
10
|
+
- **Personal knowledge protection in surgeon.** The surgeon retirement pass now has explicit guidance that personal facts (family, pets, hardware, contacts, identity, physical environment) are durable by nature. Only retires personal entries when contradicted or clearly duplicated — not for low recall or moderate importance.
|
|
11
|
+
- **Corpus age awareness in surgeon.** The `_meta` table now tracks `last_bulk_ingest_at`, surfaced via `get_health_stats`. The surgeon heavily discounts `recall_count = 0` when the corpus was rebuilt within 30 days, preventing mass retirements of freshly ingested entries.
|
|
12
|
+
- **New documentation: `docs/EPISODES.md`.** Comprehensive episodic memory docs covering lifecycle, CLI usage, recall modes, temporal window parser, search modes, embeddings, session discovery, and architecture.
|
|
13
|
+
- **New documentation: `docs/SURGEON.md`.** Comprehensive surgeon docs covering tools, CLI commands, dry-run vs apply, budget governance, configuration, protection thresholds, and audit history.
|
|
14
|
+
|
|
15
|
+
### Changed
|
|
16
|
+
|
|
17
|
+
- **Continuity summary timeout increased.** Inner timeout bumped from 15s to 30s, read-time wrapper from 20s to 35s. Prevents timeout failures when using slower models for continuity summaries.
|
|
18
|
+
- **Updated `docs/RECALL.md`.** Added unified recall mode routing (`auto`/`entries`/`episodes`), auto-routing rules, temporal window parser reference, and episode search pipeline documentation.
|
|
19
|
+
- **Updated `docs/INGEST.md`.** Added episode ingest section with full flag documentation, behavior differences from entry ingest, session discovery, surface reconstruction, and practical examples.
|
|
20
|
+
- **Updated `README.md`.** Added episodic memory and surgeon to features list, CLI commands table, and new "How Episodes Work" and "How the Surgeon Works" sections with doc links.
|
|
21
|
+
|
|
22
|
+
## [1.3.0] - 2026-03-30
|
|
23
|
+
|
|
24
|
+
Episodic memory — session-level temporal recall for the brain.
|
|
25
|
+
|
|
26
|
+
### Added
|
|
27
|
+
|
|
28
|
+
- **Episodic memory system (Phases 0–6).** A new `episodes` table stores narrative summaries of what happened during each session, queryable by time range and semantic similarity. Gives the brain temporal awareness — "what happened yesterday", "what were we working on last week", "sessions about schema changes" all work.
|
|
29
|
+
- **Episode ingest CLI.** `agenr ingest episodes <path>` scans OpenClaw session transcripts (including rotated `.reset.*` and `.deleted.*` files), generates episodic summaries, and writes episodes to the database. Supports `--recent`, `--regenerate`, `--dry-run`, `--concurrency`, `--embed-only`, and `--no-embed` flags.
|
|
30
|
+
- **Session discovery via `sessions.json`.** Uses OpenClaw's session registry for authoritative metadata (surface, agentId, chatType) on active sessions. Falls back to transcript-based surface reconstruction for rotated files.
|
|
31
|
+
- **Surface reconstruction from transcripts.** Detects session surface (webchat, telegram, signal, tui, subagent, heartbeat, cron) from Sender metadata blocks, Conversation info blocks, inbound_meta, and content heuristics. Integrated into the transcript parser to avoid double file reads.
|
|
32
|
+
- **Agent ID derivation from directory path.** Falls back to parsing the OpenClaw directory structure (`agents/{agentId}/sessions/`) when registry metadata is unavailable.
|
|
33
|
+
- **Unified recall with mode routing.** `agenr_recall` gains a `mode` parameter (`auto`, `entries`, `episodes`). Auto-routing uses three-band rules: temporal narrative → episodes, factual → entries, mixed → both. Results returned in separate sections with routing metadata.
|
|
34
|
+
- **Calendar-aware temporal window parser.** Parses "today", "yesterday", "this/last week", "this/last month", "N days/weeks/months ago", "in March", "March 15th", "last Friday", and ISO dates into precise calendar intervals for episode search.
|
|
35
|
+
- **Episode recall pipeline.** Pure temporal search via interval overlap scoring. No embedding dependency for basic temporal queries.
|
|
36
|
+
- **Hybrid semantic episode search (Phase 6).** Episode embeddings stored at write time, vector index (`idx_episodes_embedding`) for cosine similarity search. Three modes: pure temporal, pure semantic, and hybrid (hard temporal filter + semantic rerank).
|
|
37
|
+
- **Episode embedding backfill.** `agenr ingest episodes --embed-only` backfills embeddings for episodes missing them — no LLM calls, just embedding API.
|
|
38
|
+
- **Episode model configuration.** New `episodeModel` config field in `agenr setup` / `agenr init` for episode summary generation model override, following the existing extraction/dedup/surgeon pattern.
|
|
39
|
+
- **Episode writing at session start.** Predecessor episodes generated via `before_prompt_build` hook, best-effort with timeout. Backfill CLI is the canonical repair path.
|
|
40
|
+
- **Parallel preflight parsing.** Episode ingest Stage 1 parses transcript files concurrently to handle large session directories (600+ files) without hanging.
|
|
41
|
+
|
|
42
|
+
### Changed
|
|
43
|
+
|
|
44
|
+
- **Continuity domain extraction.** Session handoff logic reorganized under `src/adapters/openclaw/session/continuity/` as a proper subdomain with clean public API. Continuity summaries (for session handoff) are now explicitly separate from episodic summaries (for temporal recall).
|
|
45
|
+
- **Renamed session summaries to continuity summaries.** Clarifies the distinction between handoff artifacts and episodic memory artifacts throughout the codebase.
|
|
46
|
+
- **Removed `before_reset` hook.** Does not fire for OpenClaw plugins — all episode and continuity logic uses `before_prompt_build` only.
|
|
47
|
+
- **Semantic memory cleanup (Ref #7).** Removed `reflection` entry type, migrated `todo` to `tasks` table, renamed `event` to `milestone`, broadened type descriptions.
|
|
48
|
+
- **Transcript file discovery.** Fixed regex to match rotated files with ISO timestamp dots (`.628Z`). Discovery now finds all 600+ files instead of only active `.jsonl` files.
|
|
49
|
+
|
|
50
|
+
### Fixed
|
|
51
|
+
|
|
52
|
+
- **Episode vector search ambiguous column.** Prefixed select columns with table alias in `episodeVectorSearch()` to resolve `id` ambiguity with `vector_top_k` join.
|
|
53
|
+
- **Temporal parser ordinal dates.** "March 15th", "January 1st", "February 2nd" now parse correctly.
|
|
54
|
+
- **Subagent/cron surface classification.** Session registry detects `:subagent:` and `:cron:` in session keys for correct surface tagging.
|
|
55
|
+
- **Internal session skipping.** Agenr prompt pipeline sessions are filtered from episode generation.
|
|
56
|
+
|
|
3
57
|
## [1.2.0] - 2026-03-29
|
|
4
58
|
|
|
5
59
|
The surgeon retirement pass — an autonomous agent that evaluates and retires stale knowledge entries.
|
package/README.md
CHANGED
|
@@ -14,18 +14,20 @@ Local-first, durable memory infrastructure for AI agents.
|
|
|
14
14
|
|
|
15
15
|
## What is agenr?
|
|
16
16
|
|
|
17
|
-
agenr gives agents a persistent brain: a local SQLite database of durable knowledge that survives across sessions, tools, and agent restarts. Instead of relying on fragile prompt state or file-based scratch memory, agents can ingest transcripts, extract decisions and lessons, store them as typed entries, and recall them later with semantic search and memory-aware ranking.
|
|
17
|
+
agenr gives agents a persistent brain: a local SQLite database of durable knowledge that survives across sessions, tools, and agent restarts. Instead of relying on fragile prompt state or file-based scratch memory, agents can ingest transcripts, extract decisions and lessons, store them as typed entries, generate episodic summaries of what happened, and recall them later with semantic search and memory-aware ranking.
|
|
18
18
|
|
|
19
|
-
It exists because most agent runtimes forget everything important between sessions. Even when a tool has a built-in memory feature, it is often lossy, file-based, or tightly coupled to one surface. agenr keeps memory structured and queryable: facts, decisions, preferences, lessons,
|
|
19
|
+
It exists because most agent runtimes forget everything important between sessions. Even when a tool has a built-in memory feature, it is often lossy, file-based, or tightly coupled to one surface. agenr keeps memory structured and queryable: facts, decisions, preferences, lessons, tasks, milestones, relationships, and session-level episodes live in one local store instead of getting flattened into prompt text.
|
|
20
20
|
|
|
21
|
-
What makes agenr different is the combination of local-first storage, semantic embeddings, hybrid recall, and adapter-friendly architecture. The core is hexagonal, so multiple agent systems can share the same brain over time. Today the production adapter is the OpenClaw memory plugin, published separately as `@agenr/openclaw-plugin`, and the CLI provides offline ingest and
|
|
21
|
+
What makes agenr different is the combination of local-first storage, semantic embeddings, hybrid recall, episodic temporal memory, and adapter-friendly architecture. The core is hexagonal, so multiple agent systems can share the same brain over time. Today the production adapter is the OpenClaw memory plugin, published separately as `@agenr/openclaw-plugin`, and the CLI provides offline ingest, recall, and maintenance against that same database.
|
|
22
22
|
|
|
23
23
|
## Features
|
|
24
24
|
|
|
25
|
-
- Hybrid recall: vector similarity, lexical FTS, temporal awareness, recency decay, and importance weighting.
|
|
25
|
+
- Hybrid recall for durable knowledge: vector similarity, lexical FTS, temporal awareness, recency decay, and importance weighting.
|
|
26
|
+
- Episodic memory: session-level summaries with temporal filtering and optional semantic episode search for questions like "what happened yesterday?"
|
|
26
27
|
- LLM-powered knowledge extraction from conversation transcripts.
|
|
27
28
|
- Semantic deduplication using exact hashes, normalized hashes, embeddings, and within-run clustering.
|
|
28
|
-
- Session continuity with predecessor resolution, recent transcript tails, and LLM-generated
|
|
29
|
+
- Session continuity with predecessor resolution, recent transcript tails, and LLM-generated continuity summaries.
|
|
30
|
+
- Surgeon retirement pass for corpus maintenance: inspect stale candidates, simulate recall impact, and retire semantically obsolete knowledge with audit history.
|
|
29
31
|
- Agent tools for `store`, `recall`, `retire`, `update`, and `trace` through the OpenClaw plugin.
|
|
30
32
|
- Native OpenClaw memory plugin that replaces OpenClaw's built-in memory slot.
|
|
31
33
|
- Local-first storage with SQLite/libSQL. Memory stays on your machine; only model and embedding calls leave it.
|
|
@@ -46,7 +48,7 @@ It walks through:
|
|
|
46
48
|
- model selection filtered by the auth method you chose
|
|
47
49
|
- OpenAI embedding key setup
|
|
48
50
|
- OpenClaw detection and optional plugin installation
|
|
49
|
-
- session scanning and optional bulk ingestion of existing transcripts
|
|
51
|
+
- session scanning and optional bulk ingestion of existing transcripts into durable entries and episodic summaries
|
|
50
52
|
|
|
51
53
|
Run `agenr init` again any time you want to re-run onboarding, reinstall the plugin, or ingest another batch of existing sessions.
|
|
52
54
|
|
|
@@ -109,10 +111,10 @@ Key config fields:
|
|
|
109
111
|
|
|
110
112
|
| Field | What it does |
|
|
111
113
|
| -------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
112
|
-
| `auth` | Authentication method: `openai-api-key`, `openai-subscription`, `anthropic-api-key`, `anthropic-oauth`, or `anthropic-token`.
|
|
114
|
+
| `auth` | Authentication method: `openai-api-key`, `openai-subscription`, `anthropic-api-key`, `anthropic-oauth`, or `anthropic-token`. |
|
|
113
115
|
| `provider` / `model` | Default LLM provider and model used for extraction tasks unless overridden. |
|
|
114
116
|
| `credentials` | Stored manual credentials. Today that can include `openaiApiKey`, `anthropicApiKey`, and `anthropicOauthToken`. The config file is written with locked-down permissions (`0600`). |
|
|
115
|
-
| `credentials.openaiApiKey` | OpenAI key used for embeddings, and also for extraction when `auth` is `openai-api-key`. Older configs may still rely on legacy `embeddingApiKey` or `apiKey` fallback fields.
|
|
117
|
+
| `credentials.openaiApiKey` | OpenAI key used for embeddings, and also for extraction when `auth` is `openai-api-key`. Older configs may still rely on legacy `embeddingApiKey` or `apiKey` fallback fields. |
|
|
116
118
|
| `embeddingModel` | Embedding model. Defaults to `text-embedding-3-small`. |
|
|
117
119
|
| `extractionModel` / `dedupModel` | Optional per-pipeline overrides so extraction and dedup can use different provider/model pairs. |
|
|
118
120
|
| `extractionContext` | Optional user context injected into extraction prompts to help the model decide what is worth remembering. |
|
|
@@ -128,15 +130,21 @@ Important: when agenr is running as an OpenClaw plugin, session summaries use Op
|
|
|
128
130
|
|
|
129
131
|
## CLI Commands
|
|
130
132
|
|
|
131
|
-
The
|
|
132
|
-
|
|
133
|
-
| Command
|
|
134
|
-
|
|
|
135
|
-
| `agenr init`
|
|
136
|
-
| `agenr setup`
|
|
137
|
-
| `agenr recall <query>`
|
|
138
|
-
| `agenr ingest <path>`
|
|
139
|
-
| `agenr
|
|
133
|
+
The CLI surface is still intentionally compact, but it now covers setup, recall, ingest, and corpus maintenance.
|
|
134
|
+
|
|
135
|
+
| Command | What it does |
|
|
136
|
+
| ------------------------------ | ------------------------------------------------------------------------------------------------------------------------ |
|
|
137
|
+
| `agenr init` | Interactive first-run wizard: auth, model selection, OpenClaw detection, plugin install, and optional initial ingestion. |
|
|
138
|
+
| `agenr setup` | Configure auth, model defaults, embeddings, and the agenr database path. |
|
|
139
|
+
| `agenr recall <query>` | Run the hybrid recall pipeline with optional temporal and type/tag filters. |
|
|
140
|
+
| `agenr ingest <path>` | Default durable-entry ingest shorthand. Equivalent to `agenr ingest entries <path>`. |
|
|
141
|
+
| `agenr ingest entries <path>` | Bulk-ingest one file or directory of OpenClaw transcript files into durable knowledge entries. |
|
|
142
|
+
| `agenr ingest episodes <path>` | Backfill episodic summaries from OpenClaw session transcripts, including rotated `.reset.*` and `.deleted.*` files. |
|
|
143
|
+
| `agenr surgeon run` | Execute the surgeon retirement pass. Dry-run by default; add `--apply` to mutate the corpus. |
|
|
144
|
+
| `agenr surgeon status` | Show corpus health plus the latest surgeon run summary. |
|
|
145
|
+
| `agenr surgeon history` | Show recent surgeon runs. |
|
|
146
|
+
| `agenr surgeon actions <run>` | Show the audit trail for one surgeon run. |
|
|
147
|
+
| `agenr db reset` | Delete and recreate the knowledge database. |
|
|
140
148
|
|
|
141
149
|
The OpenClaw plugin also gives the agent five tools directly inside the runtime: `agenr_store`, `agenr_recall`, `agenr_retire`, `agenr_update`, and `agenr_trace`.
|
|
142
150
|
|
|
@@ -146,9 +154,15 @@ Examples:
|
|
|
146
154
|
# Recall knowledge
|
|
147
155
|
agenr recall "what decisions did we make about the API?"
|
|
148
156
|
|
|
149
|
-
# Ingest transcripts
|
|
157
|
+
# Ingest transcripts into durable entries
|
|
150
158
|
agenr ingest ~/.openclaw/agents/main/sessions/
|
|
151
159
|
|
|
160
|
+
# Backfill episodic summaries
|
|
161
|
+
agenr ingest episodes ~/.openclaw/agents/main/sessions/ --recent 30d
|
|
162
|
+
|
|
163
|
+
# Run the surgeon retirement pass (dry-run by default)
|
|
164
|
+
agenr surgeon run --budget 2.00
|
|
165
|
+
|
|
152
166
|
# Reset the database
|
|
153
167
|
agenr db reset
|
|
154
168
|
```
|
|
@@ -167,7 +181,20 @@ Recall is a hybrid pipeline. Agenr embeds the query, retrieves candidates throug
|
|
|
167
181
|
|
|
168
182
|
## How Ingestion Works
|
|
169
183
|
|
|
170
|
-
|
|
184
|
+
Agenr has two ingest pipelines over the same transcript corpus:
|
|
185
|
+
|
|
186
|
+
- `agenr ingest entries <path>` extracts durable typed knowledge such as facts, decisions, preferences, lessons, milestones, and relationships.
|
|
187
|
+
- `agenr ingest episodes <path>` generates one narrative summary per session so the brain can answer temporal questions like "what happened last week?"
|
|
188
|
+
|
|
189
|
+
Both paths parse OpenClaw transcripts first, but they optimize for different outputs: entry ingest distills durable knowledge and runs semantic dedup across the whole ingest batch, while episode ingest does a session-by-session preflight pass, uses `sessions.json` metadata when available, reconstructs missing surface metadata for rotated files, and writes episodic summaries. Details: [docs/INGEST.md](./docs/INGEST.md) and [docs/STORE.md](./docs/STORE.md).
|
|
190
|
+
|
|
191
|
+
## How Episodes Work
|
|
192
|
+
|
|
193
|
+
Episodes are session-level memory artifacts stored separately from durable entries. They preserve temporal narrative: what happened in a session, when it happened, which agent/session it belonged to, and optionally an embedding for semantic episode search. Recall can route narrative or time-bounded questions toward episodes automatically, or combine episode and entry results in mixed mode. For implementation details and the episode recall model, see [docs/EPISODES.md](./docs/EPISODES.md).
|
|
194
|
+
|
|
195
|
+
## How the Surgeon Works
|
|
196
|
+
|
|
197
|
+
The surgeon is a maintenance pass for the durable-memory corpus. It evaluates retirement candidates, inspects related context, can simulate recall impact before mutation, and records runs plus per-action audit history in the database. `agenr surgeon run` is safe by default because it starts in dry-run mode; `--apply` is the explicit mutation switch. For runtime details, governance, and audit behavior, see [docs/SURGEON.md](./docs/SURGEON.md).
|
|
171
198
|
|
|
172
199
|
## Development
|
|
173
200
|
|
|
@@ -183,10 +210,10 @@ pnpm check # format + lint + typecheck + test
|
|
|
183
210
|
| Problem | What to check |
|
|
184
211
|
| ----------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
185
212
|
| `agenr init` cannot complete setup | Re-run `agenr setup` and verify the selected auth method is actually available. Subscription flows depend on the relevant external login being present, and non-OpenAI extraction setups still need a separate OpenAI embedding key. |
|
|
186
|
-
| `openclaw plugins install @agenr/openclaw-plugin` fails | Make sure the `openclaw` CLI is installed and on `PATH`. For local development, run `pnpm build` and use `plugins.load.paths` instead.
|
|
187
|
-
| `agenr recall` or `agenr_recall` fails with embedding/auth errors | Embeddings always use OpenAI. Confirm `credentials.openaiApiKey` is configured, or re-run `agenr setup` to set the embedding key explicitly.
|
|
188
|
-
| SQLite says the database is locked | Avoid running multiple writers against the same DB at once. Stop overlapping ingest/reset runs, restart the OpenClaw gateway if needed, then retry.
|
|
189
|
-
| OpenClaw does not pick up the plugin | Restart the gateway, confirm `plugins.slots.memory` is `agenr`, confirm `plugins.allow` contains `agenr`, and for dev installs confirm `plugins.load.paths` points at the built `packages/openclaw-plugin` directory.
|
|
213
|
+
| `openclaw plugins install @agenr/openclaw-plugin` fails | Make sure the `openclaw` CLI is installed and on `PATH`. For local development, run `pnpm build` and use `plugins.load.paths` instead. |
|
|
214
|
+
| `agenr recall` or `agenr_recall` fails with embedding/auth errors | Embeddings always use OpenAI. Confirm `credentials.openaiApiKey` is configured, or re-run `agenr setup` to set the embedding key explicitly. |
|
|
215
|
+
| SQLite says the database is locked | Avoid running multiple writers against the same DB at once. Stop overlapping ingest/reset runs, restart the OpenClaw gateway if needed, then retry. |
|
|
216
|
+
| OpenClaw does not pick up the plugin | Restart the gateway, confirm `plugins.slots.memory` is `agenr`, confirm `plugins.allow` contains `agenr`, and for dev installs confirm `plugins.load.paths` points at the built `packages/openclaw-plugin` directory. |
|
|
190
217
|
|
|
191
218
|
## License
|
|
192
219
|
|