@agentmemory/agentmemory 0.9.29 → 0.9.30

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 (140) hide show
  1. package/.env.example +83 -22
  2. package/AGENTS.md +17 -24
  3. package/README.md +447 -170
  4. package/dist/.env.example +83 -22
  5. package/dist/cli.d.mts.map +1 -1
  6. package/dist/cli.mjs +1221 -335
  7. package/dist/cli.mjs.map +1 -1
  8. package/dist/{connect-Qaeq15TQ.mjs → connect-B4_ca6BD.mjs} +30 -39
  9. package/dist/connect-B4_ca6BD.mjs.map +1 -0
  10. package/dist/docker-compose.yml +40 -14
  11. package/dist/hooks/_capture.d.mts +22 -0
  12. package/dist/hooks/_capture.d.mts.map +1 -0
  13. package/dist/hooks/_capture.mjs +908 -0
  14. package/dist/hooks/_capture.mjs.map +1 -0
  15. package/dist/hooks/antigravity-bridge.d.mts +1 -1
  16. package/dist/hooks/antigravity-bridge.d.mts.map +1 -1
  17. package/dist/hooks/antigravity-bridge.mjs +24 -15
  18. package/dist/hooks/antigravity-bridge.mjs.map +1 -1
  19. package/dist/hooks/notification.mjs +17 -25
  20. package/dist/hooks/notification.mjs.map +1 -1
  21. package/dist/hooks/post-commit.mjs +71 -1
  22. package/dist/hooks/post-commit.mjs.map +1 -1
  23. package/dist/hooks/post-tool-failure.mjs +59 -25
  24. package/dist/hooks/post-tool-failure.mjs.map +1 -1
  25. package/dist/hooks/post-tool-use.mjs +87 -35
  26. package/dist/hooks/post-tool-use.mjs.map +1 -1
  27. package/dist/hooks/pre-compact.mjs +83 -3
  28. package/dist/hooks/pre-compact.mjs.map +1 -1
  29. package/dist/hooks/pre-tool-use.mjs +71 -1
  30. package/dist/hooks/pre-tool-use.mjs.map +1 -1
  31. package/dist/hooks/prompt-submit.mjs +13 -21
  32. package/dist/hooks/prompt-submit.mjs.map +1 -1
  33. package/dist/hooks/session-end.mjs +25 -20
  34. package/dist/hooks/session-end.mjs.map +1 -1
  35. package/dist/hooks/session-start.mjs +80 -3
  36. package/dist/hooks/session-start.mjs.map +1 -1
  37. package/dist/hooks/stop.mjs +71 -1
  38. package/dist/hooks/stop.mjs.map +1 -1
  39. package/dist/hooks/subagent-start.mjs +16 -25
  40. package/dist/hooks/subagent-start.mjs.map +1 -1
  41. package/dist/hooks/subagent-stop.mjs +17 -25
  42. package/dist/hooks/subagent-stop.mjs.map +1 -1
  43. package/dist/hooks/task-completed.mjs +19 -27
  44. package/dist/hooks/task-completed.mjs.map +1 -1
  45. package/dist/iii-config.docker.yaml +10 -10
  46. package/dist/iii-config.yaml +3 -1
  47. package/dist/{image-refs-BKLmp_sD.mjs → image-refs-BaT-9oMU.mjs} +2 -2
  48. package/dist/image-refs-BaT-9oMU.mjs.map +1 -0
  49. package/dist/{image-refs-CJgZmb9X.mjs → image-refs-T_urbwHM.mjs} +3 -3
  50. package/dist/image-refs-T_urbwHM.mjs.map +1 -0
  51. package/dist/{keyed-mutex-DTHtcZrt.mjs → image-store-BsN4vyjr.mjs} +2 -14
  52. package/dist/image-store-BsN4vyjr.mjs.map +1 -0
  53. package/dist/index.mjs +12943 -6218
  54. package/dist/index.mjs.map +1 -1
  55. package/dist/{schema-BFZhNTF7.mjs → keyed-mutex-DchXsyfP.mjs} +28 -4
  56. package/dist/keyed-mutex-DchXsyfP.mjs.map +1 -0
  57. package/dist/secret-store-BnY3A50C.mjs +2348 -0
  58. package/dist/secret-store-BnY3A50C.mjs.map +1 -0
  59. package/dist/{src-G7yt8gGm.mjs → src-Jsq9LCeH.mjs} +5941 -2180
  60. package/dist/src-Jsq9LCeH.mjs.map +1 -0
  61. package/dist/{standalone-BqNJDJ04.mjs → standalone-DKCdrf1d.mjs} +39 -12
  62. package/dist/standalone-DKCdrf1d.mjs.map +1 -0
  63. package/dist/standalone.d.mts.map +1 -1
  64. package/dist/standalone.mjs +249 -14
  65. package/dist/standalone.mjs.map +1 -1
  66. package/dist/status-IRz7ta8-.mjs +2344 -0
  67. package/dist/status-IRz7ta8-.mjs.map +1 -0
  68. package/dist/viewer/index.html +7224 -2794
  69. package/docker-compose.yml +40 -14
  70. package/iii-config.docker.yaml +10 -10
  71. package/iii-config.yaml +3 -1
  72. package/integrations/pi/index.ts +2 -3
  73. package/integrations/pi/security.ts +52 -0
  74. package/package.json +13 -4
  75. package/plugin/.claude-plugin/plugin.json +2 -2
  76. package/plugin/.codex-plugin/plugin.json +26 -4
  77. package/plugin/.devin-plugin/plugin.json +1 -1
  78. package/plugin/.mcp.codex.json +12 -0
  79. package/plugin/.mcp.copilot.json +2 -7
  80. package/plugin/.mcp.json +2 -7
  81. package/plugin/assets/icon.svg +35 -0
  82. package/plugin/hooks/hooks.copilot.json +11 -11
  83. package/plugin/opencode/README.md +266 -30
  84. package/plugin/opencode/agentmemory-capture.ts +572 -3
  85. package/plugin/opencode/plugin.json +1 -1
  86. package/plugin/plugin.json +1 -1
  87. package/plugin/scripts/_capture.d.mts +22 -0
  88. package/plugin/scripts/_capture.d.mts.map +1 -0
  89. package/plugin/scripts/_capture.mjs +908 -0
  90. package/plugin/scripts/_capture.mjs.map +1 -0
  91. package/plugin/scripts/antigravity-bridge.d.mts +1 -1
  92. package/plugin/scripts/antigravity-bridge.d.mts.map +1 -1
  93. package/plugin/scripts/antigravity-bridge.mjs +24 -15
  94. package/plugin/scripts/antigravity-bridge.mjs.map +1 -1
  95. package/plugin/scripts/notification.mjs +17 -25
  96. package/plugin/scripts/notification.mjs.map +1 -1
  97. package/plugin/scripts/plugin-bridge.mjs +378 -0
  98. package/plugin/scripts/post-commit.mjs +71 -1
  99. package/plugin/scripts/post-commit.mjs.map +1 -1
  100. package/plugin/scripts/post-tool-failure.mjs +59 -25
  101. package/plugin/scripts/post-tool-failure.mjs.map +1 -1
  102. package/plugin/scripts/post-tool-use.mjs +87 -35
  103. package/plugin/scripts/post-tool-use.mjs.map +1 -1
  104. package/plugin/scripts/pre-compact.mjs +83 -3
  105. package/plugin/scripts/pre-compact.mjs.map +1 -1
  106. package/plugin/scripts/pre-tool-use.mjs +71 -1
  107. package/plugin/scripts/pre-tool-use.mjs.map +1 -1
  108. package/plugin/scripts/prompt-submit.mjs +13 -21
  109. package/plugin/scripts/prompt-submit.mjs.map +1 -1
  110. package/plugin/scripts/session-end.mjs +25 -20
  111. package/plugin/scripts/session-end.mjs.map +1 -1
  112. package/plugin/scripts/session-start.mjs +80 -3
  113. package/plugin/scripts/session-start.mjs.map +1 -1
  114. package/plugin/scripts/stop.mjs +71 -1
  115. package/plugin/scripts/stop.mjs.map +1 -1
  116. package/plugin/scripts/subagent-start.mjs +16 -25
  117. package/plugin/scripts/subagent-start.mjs.map +1 -1
  118. package/plugin/scripts/subagent-stop.mjs +17 -25
  119. package/plugin/scripts/subagent-stop.mjs.map +1 -1
  120. package/plugin/scripts/task-completed.mjs +19 -27
  121. package/plugin/scripts/task-completed.mjs.map +1 -1
  122. package/plugin/skills/_shared/TROUBLESHOOTING.md +22 -6
  123. package/plugin/skills/agentmemory-agents/REFERENCE.md +3 -3
  124. package/plugin/skills/agentmemory-config/REFERENCE.md +49 -1
  125. package/plugin/skills/agentmemory-config/SKILL.md +44 -7
  126. package/plugin/skills/agentmemory-mcp-tools/REFERENCE.md +1 -1
  127. package/plugin/skills/agentmemory-rest-api/REFERENCE.md +10 -2
  128. package/plugin/skills/handoff/SKILL.md +4 -2
  129. package/plugin/skills/memory-discipline/SKILL.md +13 -5
  130. package/dist/connect-Qaeq15TQ.mjs.map +0 -1
  131. package/dist/image-refs-BKLmp_sD.mjs.map +0 -1
  132. package/dist/image-refs-CJgZmb9X.mjs.map +0 -1
  133. package/dist/keyed-mutex-DTHtcZrt.mjs.map +0 -1
  134. package/dist/logger-BEB7pCI9.mjs +0 -43
  135. package/dist/logger-BEB7pCI9.mjs.map +0 -1
  136. package/dist/schema-BFZhNTF7.mjs.map +0 -1
  137. package/dist/src-G7yt8gGm.mjs.map +0 -1
  138. package/dist/standalone-BqNJDJ04.mjs.map +0 -1
  139. package/dist/tools-registry-BV_2bu7z.mjs +0 -1405
  140. package/dist/tools-registry-BV_2bu7z.mjs.map +0 -1
package/.env.example CHANGED
@@ -9,9 +9,9 @@
9
9
  # LLM key, no embedding key, and no API auth. Set keys here only when you
10
10
  # want to enable the corresponding feature.
11
11
  #
12
- # Run `npx @agentmemory/agentmemory init` to copy this file into place
13
- # automatically. Run `npx @agentmemory/agentmemory doctor` to verify that
14
- # the daemon reads the env you expect.
12
+ # Run `npx -y @agentmemory/agentmemory@latest init` to copy this file into
13
+ # place automatically. Run `npx -y @agentmemory/agentmemory@latest doctor`
14
+ # to verify that the daemon reads the env you expect.
15
15
  #
16
16
  # Defaults shown in comments. Listed in priority order — the first key
17
17
  # present wins on the LLM detection path (see src/config.ts::detectProvider).
@@ -21,8 +21,24 @@
21
21
  # -----------------------------------------------------------------------------
22
22
  #
23
23
  # Without a provider key, agentmemory runs in noop mode: observations are
24
- # indexed via zero-LLM synthetic compression, hybrid search still works,
24
+ # indexed via zero-LLM synthetic compression and BM25 recall still works,
25
25
  # but LLM-backed summarisation / reflection / consolidation are disabled.
26
+ # A provider key alone does not enable LLM-written observation compression;
27
+ # that path also requires AGENTMEMORY_AUTO_COMPRESS=true.
28
+ # AGENTMEMORY_CAPTURE_ALLOW= # Comma/space list of tool names or globs to capture; when set, only these are captured
29
+ # AGENTMEMORY_CAPTURE_DENY= # Extra tool names or globs to skip, added to the defaults (memory_*, toolsearch, listmcpresources, fetchmcpresource)
30
+ # AGENTMEMORY_CAPTURE_OUTPUT_MAX=8000 # Max characters of tool output stored per captured observation
31
+ # AGENTMEMORY_PRE_COMPACT_BUDGET=1500 # Token budget for context injected by the PreCompact hook; 0 disables it
32
+ # AGENTMEMORY_CAPTURE_MAX_ATTEMPTS=5 # Attempts before a capture becomes a dead letter
33
+ # AGENTMEMORY_CAPTURE_RETRY_INTERVAL_MS=10000 # Retry sweep interval and backoff base
34
+ # AGENTMEMORY_CAPTURE_DEDUP_HOURS=168 # How long stored event ids block replays
35
+ # AGENTMEMORY_CAPTURE_EVENTS_MAX=100000 # Max stored event ids
36
+ # AGENTMEMORY_CAPTURE_INBOX_MAX=10000 # Max unprocessed events before 503
37
+ # AGENTMEMORY_CAPTURE_DEAD_MAX=1000 # Max dead letters kept
38
+ # AGENTMEMORY_CAPTURE_SPOOL=false # Turn off the hook offline spool
39
+ # AGENTMEMORY_CAPTURE_SPOOL_DIR= # Spool folder (default <data dir>/capture-spool)
40
+ # AGENTMEMORY_CAPTURE_SPOOL_MAX_BYTES=5242880 # Spool size limit
41
+ # AGENTMEMORY_CAPTURE_SPOOL_MAX_AGE_HOURS=168 # Spooled records older than this are dropped
26
42
  # The detection order is OPENAI_API_KEY → MINIMAX_API_KEY → ANTHROPIC_API_KEY
27
43
  # → GEMINI_API_KEY → OPENROUTER_API_KEY → noop.
28
44
 
@@ -55,7 +71,7 @@
55
71
 
56
72
  # Opt-in Claude-subscription fallback (spawns @anthropic-ai/claude-agent-sdk
57
73
  # child sessions). Off by default — the agent-sdk fallback can trigger
58
- # Stop-hook recursion (#149 follow-up) when invoked from inside Claude Code.
74
+ # Stop-hook recursion when invoked from inside Claude Code.
59
75
  # AGENTMEMORY_ALLOW_AGENT_SDK=true
60
76
 
61
77
  # FALLBACK_PROVIDERS=anthropic,gemini # Comma-separated chain tried after the primary provider returns an error (e.g. rate limit)
@@ -64,10 +80,14 @@
64
80
  # 2. Embedding provider — auto-detected, override via EMBEDDING_PROVIDER
65
81
  # -----------------------------------------------------------------------------
66
82
  #
67
- # Without an embedding key, agentmemory runs in BM25-only mode for hybrid
68
- # search. Detection order: EMBEDDING_PROVIDER override → GEMINI_API_KEY →
83
+ # Without an embedding provider, vector embeddings are disabled. `mem::search`
84
+ # uses BM25; `mem::smart-search` can also fuse structural graph matches when
85
+ # graph data exists. Remote
86
+ # provider detection order: EMBEDDING_PROVIDER override → GEMINI_API_KEY →
69
87
  # OPENAI_API_KEY → VOYAGE_API_KEY → COHERE_API_KEY → OPENROUTER_API_KEY →
70
- # local (Xenova/all-MiniLM-L6-v2, 384-dim).
88
+ # BM25-only. Local embeddings are an explicit opt-in, not the keyless default.
89
+ # `EMBEDDING_PROVIDER=local` uses Xenova/all-MiniLM-L6-v2 (384-dim) on-device;
90
+ # the first embedding request downloads the model and needs network access.
71
91
 
72
92
  # EMBEDDING_PROVIDER=local # local | openai | voyage | cohere | gemini | openrouter
73
93
 
@@ -76,6 +96,8 @@
76
96
  # COHERE_API_KEY=... # General-purpose embeddings
77
97
 
78
98
  # Reuses OPENAI_API_KEY / OPENAI_BASE_URL above when EMBEDDING_PROVIDER=openai.
99
+ # OPENAI_EMBEDDING_BASE_URL=https://... # Embeddings only; falls back to OPENAI_BASE_URL
100
+ # OPENAI_EMBEDDING_API_KEY=sk-... # Embeddings only; wins over OPENAI_API_KEY when set
79
101
  # OPENAI_EMBEDDING_MODEL=text-embedding-3-small # Embedding model when EMBEDDING_PROVIDER=openai
80
102
  # OPENAI_EMBEDDING_DIMENSIONS=1536 # Required when the model is not in the known-models table
81
103
 
@@ -89,7 +111,9 @@
89
111
  # Without a secret, REST endpoints are open on loopback. Set this when
90
112
  # you expose the daemon beyond loopback or run behind a reverse proxy.
91
113
 
92
- # AGENTMEMORY_SECRET=your-secret-here
114
+ # AGENTMEMORY_SECRET=your-secret # generated into ~/.agentmemory/secret on first start when unset
115
+ # VIEWER_ALLOWED_ORIGINS=https://memory.example.com
116
+ # AGENTMEMORY_IMPORT_ROOT=~/projects
93
117
 
94
118
  # -----------------------------------------------------------------------------
95
119
  # 4. Search tuning
@@ -98,6 +122,7 @@
98
122
  # BM25_WEIGHT=0.4 # Hybrid search weight for BM25 leg
99
123
  # VECTOR_WEIGHT=0.6 # Hybrid search weight for vector leg
100
124
  # AGENTMEMORY_GRAPH_WEIGHT=0.2 # Graph traversal bonus on smart-search ranking
125
+ # AGENTMEMORY_GRAPH_COMPACT_ON_BOOT=false # Skip the one-time background trim of oversized graph provenance at startup
101
126
  # TOKEN_BUDGET=2000 # Max tokens injected via mem::context per session
102
127
  # MAX_OBS_PER_SESSION=500 # Per-session observation cap before consolidation kicks in
103
128
  # SUMMARIZE_CHUNK_SIZE=400 # When mem::summarize sees a session larger than this, it chunks observations and map-reduces (chunk-summarize → reduce-merge) to stay within the LLM's context window. Default 400 ≈ 50k tokens per chunk at ~110 tok/obs. Native sessions are capped by MAX_OBS_PER_SESSION; chunking primarily matters for bulk-imported jsonl sessions, which bypass that cap.
@@ -107,8 +132,8 @@
107
132
  # 5. Behaviour flags
108
133
  # -----------------------------------------------------------------------------
109
134
 
110
- # AGENTMEMORY_AUTO_COMPRESS=true # Run LLM compression on every observation batch (requires a provider key). Default off — synthetic compression handles most cases.
111
- # AGENTMEMORY_INJECT_CONTEXT=true # Inject recalled memories back into agent prompts (#143). Default off — hooks capture observations but do not modify conversation.
135
+ # AGENTMEMORY_AUTO_COMPRESS=true # Run LLM-written compression on every observation batch. Requires BOTH this flag and a configured provider; a provider alone leaves synthetic compression active.
136
+ # AGENTMEMORY_INJECT_CONTEXT=true # Inject recalled memories back into agent prompts. Default off — hooks capture observations but do not modify conversation.
112
137
  # CONSOLIDATION_ENABLED=true # Run the 4-tier consolidation pipeline (memories → semantic → procedural). Default off — opt in once you've measured the LLM cost.
113
138
  # CONSOLIDATION_DECAY_DAYS=30 # Age (days) after which non-reinforced memories decay during consolidation
114
139
  # GRAPH_EXTRACTION_ENABLED=true # Extract concept-graph edges on remember; powers the graph-traversal recall path
@@ -121,8 +146,16 @@
121
146
  # AGENTMEMORY_LLM_NOTHINK=1
122
147
 
123
148
  # AGENTMEMORY_REFLECT=true # Periodically auto-synthesize lessons from memories
124
- # AGENTMEMORY_DROP_STALE_INDEX=true # Drop on-disk BM25 / vector index on startup if dim guard fires (#248). Recovery toggle for stuck-state debugging.
149
+ # AGENTMEMORY_DROP_STALE_INDEX=true # Drop on-disk BM25 / vector index on startup if dim guard fires. Recovery toggle for stuck-state debugging.
125
150
  # AGENTMEMORY_IMAGE_EMBEDDINGS=true # Enable image embeddings when an image provider is present (experimental).
151
+ # AGENTMEMORY_AUDIT_RETENTION_MONTHS=6 # Drop whole audit-log month scopes older than N months on a daily sweep. Default 0 = keep audit history forever.
152
+ # AGENTMEMORY_AUDIT_MIGRATE_MAX_BYTES=33554432 # Largest legacy mem:audit scope file the one-time migration will read locally. Default 32 MiB; bigger or unreadable stores are left frozen.
153
+ # AGENTMEMORY_AUDIT_INDEX_PERSIST=false # Set to 1 or true to audit index migration and cleanup writes (debugging only)
154
+ # AGENTMEMORY_INDEX_SAVE_INTERVAL_MS=600000 # Minimum time between search index saves; shutdown and deletes still save immediately.
155
+ # AGENTMEMORY_VECTOR_BUCKET_SIZE=500 # Vectors held per storage bucket before a new bucket opens; a save only rewrites buckets it changed.
156
+ # AGENTMEMORY_VECTOR_BACKFILL_MAX=500 # Batch size for re-embedding vectors missing since the last save (continues across restarts); also caps the whole-store opt-in per boot.
157
+ # AGENTMEMORY_VECTOR_BACKFILL=all # Required to backfill an entire store's vectors at once (no prior vector save, or a stale legacy manifest); unset means that case waits for an explicit opt-in.
158
+ # AGENTMEMORY_VIEWER_STREAM_MAX=500 # Max items kept in the persisted "viewer" live-stream group; older entries are pruned in batches. Floored at 200 (the viewer's reload window); negative values fall back to the default
126
159
 
127
160
  # -----------------------------------------------------------------------------
128
161
  # 6. CLI / runtime knobs
@@ -135,8 +168,20 @@
135
168
  # AGENTMEMORY_PROBE_TIMEOUT_MS=2000 # MCP shim livez probe timeout
136
169
  # AGENTMEMORY_URL=http://localhost:3111 # REST base URL — honored by status, doctor, MCP shim
137
170
  # AGENTMEMORY_VIEWER_URL=http://localhost:3113 # Override the viewer URL printed by `agentmemory status`
171
+ # Persistent iii state; same override as `--data-dir`, used by native and
172
+ # Docker starts. Explicit flag/env wins. Otherwise instance 0 reuses an
173
+ # existing ./data/state_store.db or ./data/iii-config.yaml before defaults: macOS
174
+ # ~/Library/Application Support/agentmemory; Linux $XDG_DATA_HOME/agentmemory
175
+ # or ~/.local/share/agentmemory; Windows %APPDATA%\agentmemory.
176
+ # AGENTMEMORY_DATA_DIR=/absolute/path
177
+ # AGENTMEMORY_III_CONFIG=/path/to/iii-config.yaml # Engine config the CLI starts from; the bundled default binds 127.0.0.1
178
+ # AGENTMEMORY_STATE_SAVE_INTERVAL_MS=2000 # How often the engine writes state to disk; a crash loses at most this much
179
+ # AGENTMEMORY_USE_DOCKER=1 # Prefer bundled Docker even when a compatible native iii binary exists
138
180
  # AGENTMEMORY_EXPORT_ROOT=~/agentmemory-backup # Default destination for `agentmemory export`
139
181
 
182
+ # AGENTMEMORY_STATE_BACKEND=redis # file (default) | redis — storage adapter for iii-state and iii-stream, see README "Storage backend"
183
+ # AGENTMEMORY_REDIS_URL=redis://localhost:6379 # Required when AGENTMEMORY_STATE_BACKEND=redis
184
+
140
185
  # STANDALONE_MCP=1 # MCP shim only — bypass the worker and run @agentmemory/mcp in-process
141
186
  # STANDALONE_PERSIST_PATH=~/.agentmemory/local.db # Path used by the standalone MCP shim's local fallback store
142
187
 
@@ -154,23 +199,39 @@
154
199
  # 7. Ports
155
200
  # -----------------------------------------------------------------------------
156
201
 
157
- # III_REST_PORT=3111 # REST API port (also affects viewer at +2)
158
- # III_STREAMS_PORT=3112 # Streams API port
159
- # III_ENGINE_URL=ws://localhost:49134 # iii-engine WebSocket URL (used by the worker)
202
+ # III_REST_PORT=3111 # REST API + MCP HTTP anchor
203
+ # III_STREAM_PORT=3112 # Preferred streams override; defaults to REST + 1
204
+ # III_STREAMS_PORT=3112 # Legacy alias for III_STREAM_PORT
205
+ # III_VIEWER_PORT=3113 # Viewer bind port; defaults to REST + 2
206
+ # III_ENGINE_PORT=49134 # Engine bind port; defaults to REST + 46023
207
+ # III_ENGINE_URL=ws://localhost:49134 # Explicit/remote worker WebSocket URL; takes precedence over derived engine port
208
+ # Derivation applies only while the corresponding explicit port/URL is unset.
209
+ # `--instance 1` selects 3211/3212/3213/49234 and an instance-1 data subdir.
160
210
 
161
211
  # -----------------------------------------------------------------------------
162
212
  # 8. iii engine pin
163
213
  # -----------------------------------------------------------------------------
164
214
  #
165
- # agentmemory currently pins iii-engine to v0.11.2 — v0.11.6 introduces a
166
- # new sandbox-everything-via-`iii worker add` model that agentmemory
167
- # hasn't been refactored for yet. Override with AGENTMEMORY_III_VERSION
168
- # only after migrating to the sandbox model manually.
215
+ # agentmemory pins iii-engine to the same release as its iii-sdk dependency
216
+ # (v0.22.1). The worker speaks the wire protocol of that engine, so the two move
217
+ # together in agentmemory releases. Override with AGENTMEMORY_III_VERSION only
218
+ # if you run your own engine and know it matches.
219
+
220
+ # AGENTMEMORY_III_VERSION=0.22.1
221
+
222
+ # Engine usage telemetry (iii). Off unless you set it; true opts in.
223
+ # III_TELEMETRY_ENABLED=false
224
+
225
+ # -----------------------------------------------------------------------------
226
+ # 9. Session sweep
227
+ # -----------------------------------------------------------------------------
169
228
 
170
- # AGENTMEMORY_III_VERSION=0.11.2
229
+ # Hourly backstop that marks stale active sessions as abandoned.
230
+ # AGENTMEMORY_SESSION_SWEEP_ENABLED=false # Disable the hourly sweep
231
+ # AGENTMEMORY_SESSION_SWEEP_STALE_HOURS=24 # Inactivity hours before a session is abandoned
171
232
 
172
233
  # -----------------------------------------------------------------------------
173
- # 9. Claude Code bridge (opt-in)
234
+ # 10. Claude Code bridge (opt-in)
174
235
  # -----------------------------------------------------------------------------
175
236
 
176
237
  # CLAUDE_MEMORY_BRIDGE=true # Mirror compressed memories into Claude Code's CLAUDE.md
@@ -178,7 +239,7 @@
178
239
  # CLAUDE_MEMORY_LINE_BUDGET=200 # Lines of memory CLAUDE.md should hold
179
240
 
180
241
  # -----------------------------------------------------------------------------
181
- # 10. Obsidian export (opt-in)
242
+ # 11. Obsidian export (opt-in)
182
243
  # -----------------------------------------------------------------------------
183
244
 
184
245
  # OBSIDIAN_AUTO_EXPORT=true # Auto-export memories to an Obsidian vault on every consolidation
package/AGENTS.md CHANGED
@@ -4,36 +4,26 @@
4
4
 
5
5
  agentmemory is a persistent memory system for AI coding agents, built on iii-engine's three primitives (Worker/Function/Trigger). Everything goes through `registerFunction`/`registerTrigger`/`sdk.trigger()` — never bypass iii-engine with standalone SQLite or in-process alternatives.
6
6
 
7
- - **Engine**: iii-sdk (WebSocket to iii-engine on port 49134)
7
+ - **Engine**: iii-sdk 0.22.1 with @iii-dev/helpers 0.22.1 (WebSocket to iii-engine 0.22.1 on port 49134; the client type is `IIIClient`, HTTP requests are `HttpRequest` from `@iii-dev/helpers/http`)
8
8
  - **State**: File-based SQLite via iii-engine's StateModule (`./data/state_store.db`)
9
9
  - **Build**: TypeScript → ESM via tsdown, output to `dist/`
10
10
  - **Test**: vitest (`npm test` excludes integration tests)
11
11
 
12
12
  ## Consistency Rules
13
13
 
14
- **When adding or removing MCP tools, you MUST update ALL of the following:**
14
+ **Before every commit, run `npm run docs:sync` and commit what it changes.** It computes MCP tool counts (all, core, local fallback), REST endpoints, skills, hooks, tests, iii functions, source files, lines of code and KV scopes from the source, and rewrites them in README.md, the translated READMEs, AGENTS.md, INSTALL_FOR_AGENTS.md, plugin manifests, integration READMEs, the stat badges and the `src/index.ts` banner. The last synced values live in `scripts/docs-sync.state.json`; commit that file with the rest. `npm run docs:check` exits non-zero when anything is out of date. When the sync prints `check <fact> <old> left in <file>`, open that line: either fix it by hand or add its noun to the fact in `scripts/docs-sync.ts` so the next sync catches it. Never hand-edit these numbers or versions in the docs; change the source and sync.
15
+
16
+ **When adding or removing MCP tools, update:**
15
17
  1. `src/mcp/tools-registry.ts` — tool definition + `getAllTools()` array
16
18
  2. `src/mcp/server.ts` — handler case in the `mcp::tools::call` switch
17
19
  3. `src/triggers/api.ts` — REST endpoint registration
18
- 4. `src/index.ts` — function registration + endpoint count in the log line
20
+ 4. `src/index.ts` — function registration
19
21
  5. `test/mcp-standalone.test.ts` — tool count assertion
20
- 6. `README.md` — tool counts (search for "MCP tools")
21
- 7. `plugin/.claude-plugin/plugin.json` — tool count in description
22
- 8. `plugin/plugin.json` and `plugin/.mcp.copilot.json` (when present) — tool count or MCP exposure
23
22
 
24
- **When adding REST endpoints, you MUST update:**
23
+ **When adding REST endpoints, update:**
25
24
  1. `src/triggers/api.ts` — endpoint registration
26
- 2. `src/index.ts` — endpoint count in the log line
27
- 3. `README.md` — endpoint count (search for "REST endpoints" and "endpoints on port")
28
-
29
- **When bumping version, you MUST update ALL of the following:**
30
- 1. `package.json` — version field
31
- 2. `src/version.ts` — VERSION constant and type union
32
- 3. `src/types.ts` — ExportData version union
33
- 4. `src/functions/export-import.ts` — supportedVersions set
34
- 5. `test/export-import.test.ts` — version assertion
35
- 6. `plugin/.claude-plugin/plugin.json` — version field
36
- 7. `plugin/plugin.json` (when present) — version field
25
+
26
+ **When bumping version, change only `package.json`.** `npm run docs:sync` carries the new version into `src/version.ts`, the `src/types.ts` ExportData union, the `supportedVersions` set in `src/functions/export-import.ts`, every plugin and package manifest that shared the old version, the deploy templates, the AGENTS.md stats heading, and CHANGELOG.md (the Unreleased section becomes the new version with today's date, plus its compare link).
37
27
 
38
28
  **When adding new KV scopes:**
39
29
  1. `src/state/schema.ts` — add to the KV object
@@ -59,7 +49,9 @@ sdk.registerFunction(
59
49
 
60
50
  ### REST Endpoint Registration
61
51
  ```typescript
62
- sdk.registerFunction("api::your-endpoint", async (req: ApiRequest) => {
52
+ import type { HttpRequest } from "@iii-dev/helpers/http";
53
+
54
+ sdk.registerFunction("api::your-endpoint", async (req: HttpRequest) => {
63
55
  const denied = checkAuth(req, secret);
64
56
  if (denied) return denied;
65
57
  const body = req.body as Record<string, unknown>;
@@ -109,16 +101,17 @@ Hook scripts in `src/hooks/` are standalone Node.js scripts (no iii-sdk import).
109
101
 
110
102
  ## Testing
111
103
 
112
- - All tests must pass before PR: `npm test` (1,596+ tests)
104
+ - Before every commit run, in order: `npm run build`, `npm run skills:gen`, `npm run docs:sync`, `npm run skills:check`, `npm test` (2,500+ tests). Commit anything the generators changed. CI runs the same build, skills check and tests.
105
+ - Before any npm publish: `npm run release:gate` must pass. It installs the packed tarballs into a clean home and runs capture, recovery, restart, export/import, MCP and status checks against the installed CLI (see CONTRIBUTING.md, Release process)
113
106
  - Mock pattern: `vi.mock("iii-sdk")` with mock `sdk.trigger`, `kv.get/set/list`
114
107
  - Test files go in `test/` with `.test.ts` extension
115
108
  - Follow existing patterns in `test/crystallize.test.ts` for function tests
116
109
 
117
- ## Current Stats (v0.9.29)
110
+ ## Current Stats (v0.9.30)
118
111
 
119
112
  - 54 MCP tools (8 visible by default, `AGENTMEMORY_TOOLS=all` for all)
120
- - 130 REST endpoints
113
+ - 138 REST endpoints
121
114
  - 6 MCP resources, 3 MCP prompts
122
115
  - 12 hooks, 17 skills
123
- - 260+ iii functions
124
- - 1,596+ tests
116
+ - 311+ iii functions
117
+ - 2,500+ tests