agenr 1.0.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.
Files changed (169) hide show
  1. package/CHANGELOG.md +49 -0
  2. package/README.md +15 -7
  3. package/dist/{chunk-A6CLW24R.js → chunk-YU3EWRVT.js} +585 -493
  4. package/dist/cli.js +5491 -1892
  5. package/dist/core/recall/index.d.ts +135 -4
  6. package/dist/core/recall/index.js +1 -2
  7. package/dist/internal-recall-eval-server.js +2 -3
  8. package/package.json +29 -22
  9. package/.prettierrc +0 -5
  10. package/.vscode/launch.json +0 -77
  11. package/.vscode/tasks.json +0 -12
  12. package/AGENTS.md +0 -269
  13. package/dist/adapters/openclaw/index.d.ts +0 -32
  14. package/dist/adapters/openclaw/index.js +0 -2310
  15. package/dist/adapters/openclaw/openclaw.plugin.json +0 -33
  16. package/dist/adapters/openclaw/package.json +0 -10
  17. package/dist/chunk-3CUEEUDS.js +0 -1035
  18. package/dist/chunk-ETQPUJGS.js +0 -0
  19. package/dist/ports--s4nSj4z.d.ts +0 -166
  20. package/docs/EVALS.md +0 -516
  21. package/docs/INGEST.md +0 -340
  22. package/docs/OPENCLAW-PLUGIN.md +0 -417
  23. package/docs/PLAN.md +0 -488
  24. package/docs/RECALL.md +0 -416
  25. package/docs/STORE.md +0 -246
  26. package/eslint.config.js +0 -172
  27. package/openclaw.plugin.json +0 -33
  28. package/scripts/check-sim.ts +0 -89
  29. package/scripts/copy-openclaw-plugin-artifacts.mjs +0 -16
  30. package/src/adapters/api/internal-recall-eval-server.ts +0 -204
  31. package/src/adapters/api/routes/internal-recall-eval.ts +0 -120
  32. package/src/adapters/api/validation/recall-eval-request.ts +0 -441
  33. package/src/adapters/db/client.ts +0 -206
  34. package/src/adapters/db/openclaw-plugin-queries.ts +0 -285
  35. package/src/adapters/db/queries.ts +0 -455
  36. package/src/adapters/db/recall-adapter.ts +0 -344
  37. package/src/adapters/db/row-mapping.ts +0 -216
  38. package/src/adapters/db/schema.ts +0 -399
  39. package/src/adapters/embeddings.ts +0 -286
  40. package/src/adapters/files/transcript-files.ts +0 -52
  41. package/src/adapters/llm.ts +0 -646
  42. package/src/adapters/openclaw/config.ts +0 -104
  43. package/src/adapters/openclaw/format/prompt-section.ts +0 -58
  44. package/src/adapters/openclaw/format/recall-format.ts +0 -86
  45. package/src/adapters/openclaw/hooks/before-prompt-build.ts +0 -338
  46. package/src/adapters/openclaw/hooks/before-reset.ts +0 -112
  47. package/src/adapters/openclaw/index.ts +0 -65
  48. package/src/adapters/openclaw/memory/flush-plan.ts +0 -21
  49. package/src/adapters/openclaw/memory/runtime.ts +0 -83
  50. package/src/adapters/openclaw/openclaw.plugin.json +0 -33
  51. package/src/adapters/openclaw/package.json +0 -10
  52. package/src/adapters/openclaw/runtime.ts +0 -182
  53. package/src/adapters/openclaw/session/predecessor.ts +0 -319
  54. package/src/adapters/openclaw/session/sessions-store-reader.ts +0 -136
  55. package/src/adapters/openclaw/session/state.ts +0 -157
  56. package/src/adapters/openclaw/session/summary-reader.ts +0 -112
  57. package/src/adapters/openclaw/session/summary.ts +0 -373
  58. package/src/adapters/openclaw/session/tui-lane.ts +0 -59
  59. package/src/adapters/openclaw/tools.ts +0 -944
  60. package/src/adapters/openclaw/transcript/jsonl.ts +0 -53
  61. package/src/adapters/openclaw/transcript/message-content.ts +0 -300
  62. package/src/adapters/openclaw/transcript/parser.ts +0 -406
  63. package/src/adapters/openclaw/transcript/timestamps.ts +0 -99
  64. package/src/adapters/openclaw/transcript/tool-summarization.ts +0 -347
  65. package/src/adapters/openclaw/types.ts +0 -248
  66. package/src/app/evals/recall/collect-diagnostics.ts +0 -292
  67. package/src/app/evals/recall/contracts.ts +0 -345
  68. package/src/app/evals/recall/index.ts +0 -21
  69. package/src/app/evals/recall/instrumented-recall-ports.ts +0 -115
  70. package/src/app/evals/recall/normalize-response.ts +0 -78
  71. package/src/app/evals/recall/provision-fixtures.ts +0 -268
  72. package/src/app/evals/recall/run-recall-eval-case.ts +0 -134
  73. package/src/app/evals/recall/sandbox.ts +0 -92
  74. package/src/app/ingestion/index.ts +0 -9
  75. package/src/app/ingestion/ports.ts +0 -81
  76. package/src/app/ingestion/service.ts +0 -313
  77. package/src/cli/commands/db.ts +0 -117
  78. package/src/cli/commands/ingest.ts +0 -652
  79. package/src/cli/commands/init/cost-estimator.ts +0 -91
  80. package/src/cli/commands/init/external-commands.ts +0 -241
  81. package/src/cli/commands/init/index.ts +0 -17
  82. package/src/cli/commands/init/openclaw-detect.ts +0 -58
  83. package/src/cli/commands/init/session-scanner.ts +0 -83
  84. package/src/cli/commands/init/wizard.ts +0 -498
  85. package/src/cli/commands/recall.ts +0 -249
  86. package/src/cli/commands/setup.ts +0 -1411
  87. package/src/cli/main.ts +0 -41
  88. package/src/cli/ui.ts +0 -180
  89. package/src/cli.ts +0 -6
  90. package/src/config.ts +0 -357
  91. package/src/core/ingestion/dedup.ts +0 -561
  92. package/src/core/ingestion/extract.ts +0 -329
  93. package/src/core/ingestion/index.ts +0 -15
  94. package/src/core/ingestion/parser.ts +0 -271
  95. package/src/core/ingestion/pipeline.ts +0 -390
  96. package/src/core/ingestion/prompts.ts +0 -436
  97. package/src/core/ports.ts +0 -108
  98. package/src/core/recall/index.ts +0 -6
  99. package/src/core/recall/lexical.ts +0 -247
  100. package/src/core/recall/scoring.ts +0 -177
  101. package/src/core/recall/search.ts +0 -463
  102. package/src/core/recall/temporal.ts +0 -111
  103. package/src/core/recall/trace.ts +0 -124
  104. package/src/core/recall/types.ts +0 -67
  105. package/src/core/store/embedding-text.ts +0 -11
  106. package/src/core/store/hashing.ts +0 -28
  107. package/src/core/store/index.ts +0 -3
  108. package/src/core/store/pipeline.ts +0 -324
  109. package/src/core/store/validation.ts +0 -153
  110. package/src/core/types.ts +0 -112
  111. package/src/internal-recall-eval-server.ts +0 -95
  112. package/src/logger.ts +0 -83
  113. package/src/ui.ts +0 -74
  114. package/src/version.ts +0 -24
  115. package/tests/adapters/api/internal-recall-eval-server.test.ts +0 -88
  116. package/tests/adapters/api/routes/internal-recall-eval.test.ts +0 -461
  117. package/tests/adapters/api/validation/recall-eval-request.test.ts +0 -285
  118. package/tests/adapters/db/client.test.ts +0 -286
  119. package/tests/adapters/db/schema.test.ts +0 -275
  120. package/tests/adapters/embeddings.test.ts +0 -193
  121. package/tests/adapters/files/transcript-files.test.ts +0 -107
  122. package/tests/adapters/llm.test.ts +0 -453
  123. package/tests/adapters/openclaw/before-prompt-build.test.ts +0 -1160
  124. package/tests/adapters/openclaw/before-reset.test.ts +0 -287
  125. package/tests/adapters/openclaw/config.test.ts +0 -60
  126. package/tests/adapters/openclaw/flush-plan.test.ts +0 -18
  127. package/tests/adapters/openclaw/package-metadata.test.ts +0 -37
  128. package/tests/adapters/openclaw/prompt-section.test.ts +0 -25
  129. package/tests/adapters/openclaw/runtime.test.ts +0 -247
  130. package/tests/adapters/openclaw/session/predecessor.test.ts +0 -393
  131. package/tests/adapters/openclaw/session/summary.test.ts +0 -256
  132. package/tests/adapters/openclaw/session/tui-lane.test.ts +0 -32
  133. package/tests/adapters/openclaw/session-state.test.ts +0 -44
  134. package/tests/adapters/openclaw/tools.test.ts +0 -476
  135. package/tests/adapters/openclaw/transcript/parser.test.ts +0 -501
  136. package/tests/app/evals/recall/instrumented-recall-ports.test.ts +0 -120
  137. package/tests/app/evals/recall/run-recall-eval-case.test.ts +0 -508
  138. package/tests/app/ingestion/service.test.ts +0 -251
  139. package/tests/cli/commands/db.test.ts +0 -34
  140. package/tests/cli/commands/ingest.test.ts +0 -142
  141. package/tests/cli/commands/init/cost-estimator.test.ts +0 -50
  142. package/tests/cli/commands/init/external-commands.test.ts +0 -86
  143. package/tests/cli/commands/init/index.test.ts +0 -20
  144. package/tests/cli/commands/init/openclaw-detect.test.ts +0 -35
  145. package/tests/cli/commands/init/session-scanner.test.ts +0 -58
  146. package/tests/cli/commands/init/wizard.test.ts +0 -247
  147. package/tests/cli/commands/recall.test.ts +0 -82
  148. package/tests/cli/commands/setup.test.ts +0 -347
  149. package/tests/cli/fake-prompts.ts +0 -150
  150. package/tests/config.test.ts +0 -77
  151. package/tests/core/ingestion/dedup.test.ts +0 -351
  152. package/tests/core/ingestion/extract.test.ts +0 -294
  153. package/tests/core/ingestion/parser.test.ts +0 -251
  154. package/tests/core/ingestion/pipeline.test.ts +0 -592
  155. package/tests/core/ingestion/prompts.test.ts +0 -100
  156. package/tests/core/recall/lexical.test.ts +0 -91
  157. package/tests/core/recall/scoring.test.ts +0 -155
  158. package/tests/core/recall/search.integration.test.ts +0 -753
  159. package/tests/core/recall/search.test.ts +0 -262
  160. package/tests/core/recall/temporal.test.ts +0 -71
  161. package/tests/core/store/hashing.test.ts +0 -28
  162. package/tests/core/store/pipeline.test.ts +0 -295
  163. package/tests/core/store/validation.test.ts +0 -154
  164. package/tests/logger.test.ts +0 -77
  165. package/tests/ui.test.ts +0 -30
  166. package/tests/version.test.ts +0 -14
  167. package/tsconfig.json +0 -21
  168. package/tsup.config.ts +0 -14
  169. package/dist/{chunk-TQV24PSV.js → chunk-FLRJOP3J.js} +91 -91
package/CHANGELOG.md CHANGED
@@ -1,5 +1,54 @@
1
1
  # Changelog
2
2
 
3
+ ## [1.2.0] - 2026-03-29
4
+
5
+ The surgeon retirement pass — an autonomous agent that evaluates and retires stale knowledge entries.
6
+
7
+ ### Added
8
+
9
+ - **Surgeon retirement pass.** A standalone agent loop powered by `@mariozechner/pi-agent-core` that evaluates knowledge entries and retires semantically stale ones. Runs as `agenr surgeon run` with full dry-run and apply modes, budget governance, and completion guards.
10
+ - **7 surgeon tools.** `get_health_stats`, `query_candidates`, `inspect_entry`, `simulate_recall`, `retire_entry`, `update_entry`, and `complete_pass` — each adapted from the v0 surgeon for v1's simpler schema.
11
+ - **Recall simulation without telemetry.** The `simulate_recall` tool wraps the v1 recall pipeline with a no-op telemetry adapter and optional target-entry exclusion, so the surgeon can test retrieval impact without polluting recall metrics.
12
+ - **Surgeon CLI commands.** `agenr surgeon run`, `agenr surgeon status`, `agenr surgeon history`, and `agenr surgeon actions <run-id>` for running, inspecting, and auditing surgeon passes.
13
+ - **Surgeon status shows evaluation coverage.** `agenr surgeon status` now displays recently evaluated vs new candidates, so you can see how much work remains before running.
14
+ - **Surgeon model configuration in setup.** `agenr setup` and `agenr init` now include surgeon model overrides in the advanced task-specific model configuration flow.
15
+ - **Budget and completion governance.** Cost-based budget tracking, context-limit detection, completion guards that reject premature pass completion, and continuation prompts that keep the surgeon working when budget remains.
16
+ - **Run and action persistence.** Surgeon runs and individual actions (retirements, skips, updates) are logged to the database for auditability and recently-evaluated filtering on future runs.
17
+ - **Database backup before apply.** Surgeon creates a timestamped backup of the knowledge database (including WAL/SHM sidecars) before executing mutations in apply mode.
18
+ - **Surgeon configuration.** New `surgeon` section in `config.json` supporting model override, cost caps, daily cost limits, context limits, custom instructions, and per-pass protection thresholds.
19
+
20
+ ### Changed
21
+
22
+ - **Schema version bumped to 2.** The `surgeon_runs` table is expanded with pass type, status, token/cost tracking, model, dry-run flag, and structured summary fields. A new `surgeon_run_actions` table logs individual surgeon actions with indexed `entry_id` for efficient recently-evaluated queries. Existing databases are migrated automatically via `ALTER TABLE ADD COLUMN`.
23
+ - **Protection threshold raised to importance ≥ 9.** Entries with importance 8 are now eligible for surgeon evaluation since many entries default to importance 8 during ingestion.
24
+ - **Setup prompt updated.** The advanced model override prompt now reads "Customize task-specific models?" to reflect the addition of surgeon alongside extraction and dedup overrides.
25
+
26
+ ### Fixed
27
+
28
+ - **Tightened npm publish surface.** Root package now uses a strict `"files"` allowlist so only intended artifacts are published.
29
+
30
+ ## [1.1.0] - 2026-03-28
31
+
32
+ This release splits the OpenClaw plugin into its own publishable npm package and tightens session-start handoff reliability.
33
+
34
+ ### Added
35
+
36
+ - **Standalone OpenClaw plugin package.** Publishes the OpenClaw integration separately as `@agenr/openclaw-plugin` while keeping the runtime plugin id as `agenr`.
37
+ - **Workspace-based build layout.** Adds `pnpm-workspace.yaml` and package-specific build wiring for the dedicated plugin package.
38
+ - **Plugin packaging coverage.** Expands tests to verify the standalone plugin package metadata, manifest/version alignment, and that the plugin entry graph stays free of CLI-only code.
39
+ - **Plugin-specific docs.** Adds package-level README content and OpenClaw docs covering the new install and local development paths.
40
+
41
+ ### Changed
42
+
43
+ - **CLI package is no longer the plugin package.** The root `agenr` package now builds the CLI plus the plugin package, but no longer exposes OpenClaw plugin metadata itself.
44
+ - **OpenClaw install instructions updated.** Installation now uses `openclaw plugins install @agenr/openclaw-plugin`, with migration guidance for existing users and unchanged plugin id/config keys.
45
+ - **Init flow updated for split packaging.** OpenClaw setup and installation flows now point at the standalone plugin package instead of the root package.
46
+
47
+ ### Fixed
48
+
49
+ - **Plugin manifests now carry release versions.** Both shared and published OpenClaw manifests include explicit version metadata.
50
+ - **Longer session-start summary timeout.** Increases the read-time predecessor summary generation timeout from 10 seconds to 20 seconds so session handoff injection is less likely to fail on slower LLM responses.
51
+
3
52
  ## [1.0.1] - 2026-03-28
4
53
 
5
54
  A focused patch release for OpenClaw plugin compatibility and installation reliability.
package/README.md CHANGED
@@ -18,7 +18,7 @@ agenr gives agents a persistent brain: a local SQLite database of durable knowle
18
18
 
19
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, todos, events, and relationships 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, and the CLI provides offline ingest and recall against that same database.
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 recall against that same database.
22
22
 
23
23
  ## Features
24
24
 
@@ -55,20 +55,23 @@ Run `agenr init` again any time you want to re-run onboarding, reinstall the plu
55
55
  If you already have agenr configured, or you want to install the plugin separately:
56
56
 
57
57
  ```bash
58
- openclaw plugins install agenr
58
+ openclaw plugins install @agenr/openclaw-plugin
59
59
  openclaw gateway restart
60
60
  ```
61
61
 
62
62
  `agenr init` normally does this for you, updates `openclaw.json`, and offers an initial ingest pass over existing sessions.
63
- The published npm package also ships the root `openclaw.extensions` and `openclaw.plugin.json` metadata that recent OpenClaw releases require for direct installs.
63
+ The OpenClaw plugin id remains `agenr`, so `plugins.entries.agenr`, `plugins.slots.memory`, and existing plugin config keys do not change.
64
+ After the plugin is installed, `openclaw plugins update agenr` continues to target that same plugin id.
64
65
  If `plugins.entries.agenr.config` is omitted, the plugin falls back to agenr's normal config resolution: `AGENR_CONFIG_PATH`, then `~/.agenr/config.json`, and the `dbPath` from that config or `~/.agenr/knowledge.db`.
65
66
 
66
- For local development or a custom build path, run `pnpm build` first and point OpenClaw at the built plugin directory:
67
+ If you want to pin an exact plugin release, install a versioned package spec such as `openclaw plugins install @agenr/openclaw-plugin@1.0.1`.
68
+
69
+ For local development or a custom build path, run `pnpm build` first and point OpenClaw at the plugin package root:
67
70
 
68
71
  ```json
69
72
  {
70
73
  "plugins": {
71
- "load": { "paths": ["/path/to/agenr/dist/adapters/openclaw"] },
74
+ "load": { "paths": ["/path/to/agenr/packages/openclaw-plugin"] },
72
75
  "allow": ["agenr"],
73
76
  "slots": { "memory": "agenr" },
74
77
  "entries": {
@@ -85,6 +88,11 @@ For local development or a custom build path, run `pnpm build` first and point O
85
88
 
86
89
  If `config.json` is not next to `dbPath`, add `"configPath": "/path/to/config.json"` inside `plugins.entries.agenr.config`.
87
90
 
91
+ Migration note:
92
+
93
+ - Existing users who originally installed the plugin from the `agenr` package should reinstall once with `openclaw plugins install @agenr/openclaw-plugin` so OpenClaw records the new npm package source.
94
+ - After that reinstall, `openclaw plugins update agenr` should continue to work because updates key off the plugin id `agenr`.
95
+
88
96
  ## Configuration
89
97
 
90
98
  `agenr init` and `agenr setup` handle configuration interactively. By default, agenr stores config at `~/.agenr/config.json` and the database at `~/.agenr/knowledge.db`.
@@ -175,10 +183,10 @@ pnpm check # format + lint + typecheck + test
175
183
  | Problem | What to check |
176
184
  | ----------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
177
185
  | `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. |
178
- | `openclaw plugins install agenr` fails | Make sure the `openclaw` CLI is installed and on `PATH`. For local development, run `pnpm build` and use `plugins.load.paths` instead. |
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. |
179
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. |
180
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. |
181
- | 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 `dist/adapters/openclaw` directory. |
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. |
182
190
 
183
191
  ## License
184
192