@agentmemory/agentmemory 0.9.30 → 0.9.32
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/.env.example +57 -48
- package/AGENTS.md +8 -8
- package/README.md +256 -819
- package/dist/.env.example +57 -48
- package/dist/cli.d.mts.map +1 -1
- package/dist/cli.mjs +2257 -1027
- package/dist/cli.mjs.map +1 -1
- package/dist/compression-recovery-CZh63Jmz.mjs +5997 -0
- package/dist/compression-recovery-CZh63Jmz.mjs.map +1 -0
- package/dist/{connect-B4_ca6BD.mjs → connect-BX3njQ3Y.mjs} +897 -276
- package/dist/connect-BX3njQ3Y.mjs.map +1 -0
- package/dist/hooks/_capture.d.mts +5 -1
- package/dist/hooks/_capture.d.mts.map +1 -1
- package/dist/hooks/_capture.mjs +141 -26
- package/dist/hooks/_capture.mjs.map +1 -1
- package/dist/hooks/notification.mjs +20 -6
- package/dist/hooks/notification.mjs.map +1 -1
- package/dist/hooks/post-commit.mjs +83 -10
- package/dist/hooks/post-commit.mjs.map +1 -1
- package/dist/hooks/post-tool-failure.mjs +19 -6
- package/dist/hooks/post-tool-failure.mjs.map +1 -1
- package/dist/hooks/post-tool-use.mjs +19 -6
- package/dist/hooks/post-tool-use.mjs.map +1 -1
- package/dist/hooks/pre-compact.mjs +104 -22
- package/dist/hooks/pre-compact.mjs.map +1 -1
- package/dist/hooks/pre-tool-use.mjs +83 -10
- package/dist/hooks/pre-tool-use.mjs.map +1 -1
- package/dist/hooks/prompt-submit.mjs +12 -4
- package/dist/hooks/prompt-submit.mjs.map +1 -1
- package/dist/hooks/session-end.mjs +59 -17
- package/dist/hooks/session-end.mjs.map +1 -1
- package/dist/hooks/session-start.mjs +95 -15
- package/dist/hooks/session-start.mjs.map +1 -1
- package/dist/hooks/stop.mjs +75 -72
- package/dist/hooks/stop.mjs.map +1 -1
- package/dist/hooks/subagent-start.mjs +13 -5
- package/dist/hooks/subagent-start.mjs.map +1 -1
- package/dist/hooks/subagent-stop.mjs +32 -10
- package/dist/hooks/subagent-stop.mjs.map +1 -1
- package/dist/hooks/task-completed.mjs +21 -6
- package/dist/hooks/task-completed.mjs.map +1 -1
- package/dist/{image-refs-T_urbwHM.mjs → image-refs-Cyta4Lf9.mjs} +2 -2
- package/dist/{image-refs-T_urbwHM.mjs.map → image-refs-Cyta4Lf9.mjs.map} +1 -1
- package/dist/index.mjs +16390 -11530
- package/dist/index.mjs.map +1 -1
- package/dist/integrations/dsh.d.mts +55 -0
- package/dist/integrations/dsh.d.mts.map +1 -0
- package/dist/integrations/dsh.mjs +1172 -0
- package/dist/integrations/dsh.mjs.map +1 -0
- package/dist/{keyed-mutex-DchXsyfP.mjs → keyed-mutex-DCUh7PG-.mjs} +58 -9
- package/dist/keyed-mutex-DCUh7PG-.mjs.map +1 -0
- package/dist/{secret-store-BnY3A50C.mjs → secret-store-iYXRcrO8.mjs} +717 -474
- package/dist/secret-store-iYXRcrO8.mjs.map +1 -0
- package/dist/session-arguments-zxsbbd8y.mjs +113 -0
- package/dist/session-arguments-zxsbbd8y.mjs.map +1 -0
- package/dist/{src-Jsq9LCeH.mjs → src-C23nMpda.mjs} +5263 -4667
- package/dist/src-C23nMpda.mjs.map +1 -0
- package/dist/{standalone-DKCdrf1d.mjs → standalone-BYo5USDb.mjs} +379 -63
- package/dist/standalone-BYo5USDb.mjs.map +1 -0
- package/dist/standalone.d.mts +1 -1
- package/dist/standalone.d.mts.map +1 -1
- package/dist/standalone.mjs +864 -81
- package/dist/standalone.mjs.map +1 -1
- package/dist/viewer/index.html +337 -168
- package/integrations/hermes/README.md +94 -0
- package/integrations/hermes/__init__.py +670 -0
- package/integrations/hermes/plugin.yaml +27 -0
- package/integrations/omp/LICENSE +190 -0
- package/integrations/omp/README.md +76 -0
- package/integrations/omp/capture.ts +1 -0
- package/integrations/omp/dist/index.mjs +1477 -0
- package/integrations/omp/index.ts +488 -0
- package/integrations/omp/package.json +13 -0
- package/integrations/omp/security.ts +67 -0
- package/integrations/omp/skills/agentmemory-agents/REFERENCE.md +32 -0
- package/integrations/omp/skills/agentmemory-agents/SKILL.md +48 -0
- package/integrations/omp/skills/agentmemory-agents/TROUBLESHOOTING.md +70 -0
- package/integrations/omp/skills/agentmemory-architecture/SKILL.md +37 -0
- package/integrations/omp/skills/agentmemory-architecture/TROUBLESHOOTING.md +70 -0
- package/integrations/omp/skills/agentmemory-config/REFERENCE.md +91 -0
- package/integrations/omp/skills/agentmemory-config/SKILL.md +98 -0
- package/integrations/omp/skills/agentmemory-config/TROUBLESHOOTING.md +70 -0
- package/integrations/omp/skills/agentmemory-hooks/REFERENCE.md +20 -0
- package/integrations/omp/skills/agentmemory-hooks/SKILL.md +60 -0
- package/integrations/omp/skills/agentmemory-hooks/TROUBLESHOOTING.md +70 -0
- package/integrations/omp/skills/agentmemory-mcp-tools/REFERENCE.md +66 -0
- package/integrations/omp/skills/agentmemory-mcp-tools/SKILL.md +52 -0
- package/integrations/omp/skills/agentmemory-mcp-tools/TROUBLESHOOTING.md +70 -0
- package/integrations/omp/skills/agentmemory-rest-api/REFERENCE.md +159 -0
- package/integrations/omp/skills/agentmemory-rest-api/SKILL.md +49 -0
- package/integrations/omp/skills/agentmemory-rest-api/TROUBLESHOOTING.md +70 -0
- package/integrations/omp/skills/commit-context/EXAMPLES.md +71 -0
- package/integrations/omp/skills/commit-context/SKILL.md +64 -0
- package/integrations/omp/skills/commit-context/TROUBLESHOOTING.md +70 -0
- package/integrations/omp/skills/commit-history/EXAMPLES.md +71 -0
- package/integrations/omp/skills/commit-history/SKILL.md +62 -0
- package/integrations/omp/skills/commit-history/TROUBLESHOOTING.md +70 -0
- package/integrations/omp/skills/forget/EXAMPLES.md +40 -0
- package/integrations/omp/skills/forget/SKILL.md +73 -0
- package/integrations/omp/skills/forget/TROUBLESHOOTING.md +70 -0
- package/integrations/omp/skills/handoff/EXAMPLES.md +57 -0
- package/integrations/omp/skills/handoff/SKILL.md +75 -0
- package/integrations/omp/skills/handoff/TROUBLESHOOTING.md +70 -0
- package/integrations/omp/skills/lesson/SKILL.md +64 -0
- package/integrations/omp/skills/lesson/TROUBLESHOOTING.md +70 -0
- package/integrations/omp/skills/memory-discipline/SKILL.md +65 -0
- package/integrations/omp/skills/memory-discipline/TROUBLESHOOTING.md +70 -0
- package/integrations/omp/skills/recall/EXAMPLES.md +74 -0
- package/integrations/omp/skills/recall/SKILL.md +74 -0
- package/integrations/omp/skills/recall/TROUBLESHOOTING.md +70 -0
- package/integrations/omp/skills/recap/EXAMPLES.md +62 -0
- package/integrations/omp/skills/recap/SKILL.md +68 -0
- package/integrations/omp/skills/recap/TROUBLESHOOTING.md +70 -0
- package/integrations/omp/skills/remember/EXAMPLES.md +67 -0
- package/integrations/omp/skills/remember/SKILL.md +66 -0
- package/integrations/omp/skills/remember/TROUBLESHOOTING.md +70 -0
- package/integrations/omp/skills/session-history/EXAMPLES.md +59 -0
- package/integrations/omp/skills/session-history/SKILL.md +67 -0
- package/integrations/omp/skills/session-history/TROUBLESHOOTING.md +70 -0
- package/integrations/omp/skills/write-agentmemory-skill/SKILL.md +41 -0
- package/integrations/omp/skills/write-agentmemory-skill/TROUBLESHOOTING.md +70 -0
- package/integrations/openclaw/LICENSE +190 -0
- package/integrations/openclaw/README.md +98 -0
- package/integrations/openclaw/openclaw.plugin.json +71 -0
- package/integrations/openclaw/package.json +38 -0
- package/integrations/openclaw/plugin.mjs +425 -0
- package/integrations/openclaw/plugin.yaml +26 -0
- package/integrations/openclaw/skills/agentmemory-agents/REFERENCE.md +32 -0
- package/integrations/openclaw/skills/agentmemory-agents/SKILL.md +48 -0
- package/integrations/openclaw/skills/agentmemory-agents/TROUBLESHOOTING.md +70 -0
- package/integrations/openclaw/skills/agentmemory-architecture/SKILL.md +37 -0
- package/integrations/openclaw/skills/agentmemory-architecture/TROUBLESHOOTING.md +70 -0
- package/integrations/openclaw/skills/agentmemory-config/REFERENCE.md +91 -0
- package/integrations/openclaw/skills/agentmemory-config/SKILL.md +98 -0
- package/integrations/openclaw/skills/agentmemory-config/TROUBLESHOOTING.md +70 -0
- package/integrations/openclaw/skills/agentmemory-hooks/REFERENCE.md +20 -0
- package/integrations/openclaw/skills/agentmemory-hooks/SKILL.md +60 -0
- package/integrations/openclaw/skills/agentmemory-hooks/TROUBLESHOOTING.md +70 -0
- package/integrations/openclaw/skills/agentmemory-mcp-tools/REFERENCE.md +66 -0
- package/integrations/openclaw/skills/agentmemory-mcp-tools/SKILL.md +52 -0
- package/integrations/openclaw/skills/agentmemory-mcp-tools/TROUBLESHOOTING.md +70 -0
- package/integrations/openclaw/skills/agentmemory-rest-api/REFERENCE.md +159 -0
- package/integrations/openclaw/skills/agentmemory-rest-api/SKILL.md +49 -0
- package/integrations/openclaw/skills/agentmemory-rest-api/TROUBLESHOOTING.md +70 -0
- package/integrations/openclaw/skills/commit-context/EXAMPLES.md +71 -0
- package/integrations/openclaw/skills/commit-context/SKILL.md +64 -0
- package/integrations/openclaw/skills/commit-context/TROUBLESHOOTING.md +70 -0
- package/integrations/openclaw/skills/commit-history/EXAMPLES.md +71 -0
- package/integrations/openclaw/skills/commit-history/SKILL.md +62 -0
- package/integrations/openclaw/skills/commit-history/TROUBLESHOOTING.md +70 -0
- package/integrations/openclaw/skills/forget/EXAMPLES.md +40 -0
- package/integrations/openclaw/skills/forget/SKILL.md +73 -0
- package/integrations/openclaw/skills/forget/TROUBLESHOOTING.md +70 -0
- package/integrations/openclaw/skills/handoff/EXAMPLES.md +57 -0
- package/integrations/openclaw/skills/handoff/SKILL.md +75 -0
- package/integrations/openclaw/skills/handoff/TROUBLESHOOTING.md +70 -0
- package/integrations/openclaw/skills/lesson/SKILL.md +64 -0
- package/integrations/openclaw/skills/lesson/TROUBLESHOOTING.md +70 -0
- package/integrations/openclaw/skills/memory-discipline/SKILL.md +65 -0
- package/integrations/openclaw/skills/memory-discipline/TROUBLESHOOTING.md +70 -0
- package/integrations/openclaw/skills/recall/EXAMPLES.md +74 -0
- package/integrations/openclaw/skills/recall/SKILL.md +74 -0
- package/integrations/openclaw/skills/recall/TROUBLESHOOTING.md +70 -0
- package/integrations/openclaw/skills/recap/EXAMPLES.md +62 -0
- package/integrations/openclaw/skills/recap/SKILL.md +68 -0
- package/integrations/openclaw/skills/recap/TROUBLESHOOTING.md +70 -0
- package/integrations/openclaw/skills/remember/EXAMPLES.md +67 -0
- package/integrations/openclaw/skills/remember/SKILL.md +66 -0
- package/integrations/openclaw/skills/remember/TROUBLESHOOTING.md +70 -0
- package/integrations/openclaw/skills/session-history/EXAMPLES.md +59 -0
- package/integrations/openclaw/skills/session-history/SKILL.md +67 -0
- package/integrations/openclaw/skills/session-history/TROUBLESHOOTING.md +70 -0
- package/integrations/openclaw/skills/write-agentmemory-skill/SKILL.md +41 -0
- package/integrations/openclaw/skills/write-agentmemory-skill/TROUBLESHOOTING.md +70 -0
- package/integrations/pi/LICENSE +190 -0
- package/integrations/pi/README.md +46 -51
- package/integrations/pi/dist/index.mjs +1460 -0
- package/integrations/pi/index.ts +192 -175
- package/integrations/pi/package.json +17 -7
- package/integrations/pi/security.ts +6 -26
- package/integrations/pi/skills/agentmemory-agents/REFERENCE.md +32 -0
- package/integrations/pi/skills/agentmemory-agents/SKILL.md +48 -0
- package/integrations/pi/skills/agentmemory-agents/TROUBLESHOOTING.md +70 -0
- package/integrations/pi/skills/agentmemory-architecture/SKILL.md +37 -0
- package/integrations/pi/skills/agentmemory-architecture/TROUBLESHOOTING.md +70 -0
- package/integrations/pi/skills/agentmemory-config/REFERENCE.md +91 -0
- package/integrations/pi/skills/agentmemory-config/SKILL.md +98 -0
- package/integrations/pi/skills/agentmemory-config/TROUBLESHOOTING.md +70 -0
- package/integrations/pi/skills/agentmemory-hooks/REFERENCE.md +20 -0
- package/integrations/pi/skills/agentmemory-hooks/SKILL.md +60 -0
- package/integrations/pi/skills/agentmemory-hooks/TROUBLESHOOTING.md +70 -0
- package/integrations/pi/skills/agentmemory-mcp-tools/REFERENCE.md +66 -0
- package/integrations/pi/skills/agentmemory-mcp-tools/SKILL.md +52 -0
- package/integrations/pi/skills/agentmemory-mcp-tools/TROUBLESHOOTING.md +70 -0
- package/integrations/pi/skills/agentmemory-rest-api/REFERENCE.md +159 -0
- package/integrations/pi/skills/agentmemory-rest-api/SKILL.md +49 -0
- package/integrations/pi/skills/agentmemory-rest-api/TROUBLESHOOTING.md +70 -0
- package/integrations/pi/skills/commit-context/EXAMPLES.md +71 -0
- package/integrations/pi/skills/commit-context/SKILL.md +64 -0
- package/integrations/pi/skills/commit-context/TROUBLESHOOTING.md +70 -0
- package/integrations/pi/skills/commit-history/EXAMPLES.md +71 -0
- package/integrations/pi/skills/commit-history/SKILL.md +62 -0
- package/integrations/pi/skills/commit-history/TROUBLESHOOTING.md +70 -0
- package/integrations/pi/skills/forget/EXAMPLES.md +40 -0
- package/integrations/pi/skills/forget/SKILL.md +73 -0
- package/integrations/pi/skills/forget/TROUBLESHOOTING.md +70 -0
- package/integrations/pi/skills/handoff/EXAMPLES.md +57 -0
- package/integrations/pi/skills/handoff/SKILL.md +75 -0
- package/integrations/pi/skills/handoff/TROUBLESHOOTING.md +70 -0
- package/integrations/pi/skills/lesson/SKILL.md +64 -0
- package/integrations/pi/skills/lesson/TROUBLESHOOTING.md +70 -0
- package/integrations/pi/skills/memory-discipline/SKILL.md +65 -0
- package/integrations/pi/skills/memory-discipline/TROUBLESHOOTING.md +70 -0
- package/integrations/pi/skills/recall/EXAMPLES.md +74 -0
- package/integrations/pi/skills/recall/SKILL.md +74 -0
- package/integrations/pi/skills/recall/TROUBLESHOOTING.md +70 -0
- package/integrations/pi/skills/recap/EXAMPLES.md +62 -0
- package/integrations/pi/skills/recap/SKILL.md +68 -0
- package/integrations/pi/skills/recap/TROUBLESHOOTING.md +70 -0
- package/integrations/pi/skills/remember/EXAMPLES.md +67 -0
- package/integrations/pi/skills/remember/SKILL.md +66 -0
- package/integrations/pi/skills/remember/TROUBLESHOOTING.md +70 -0
- package/integrations/pi/skills/session-history/EXAMPLES.md +59 -0
- package/integrations/pi/skills/session-history/SKILL.md +67 -0
- package/integrations/pi/skills/session-history/TROUBLESHOOTING.md +70 -0
- package/integrations/pi/skills/write-agentmemory-skill/SKILL.md +41 -0
- package/integrations/pi/skills/write-agentmemory-skill/TROUBLESHOOTING.md +70 -0
- package/package.json +33 -11
- package/plugin/.claude-plugin/plugin.json +16 -3
- package/plugin/.codex-plugin/plugin.json +4 -3
- package/plugin/.devin-plugin/plugin.json +6 -5
- package/plugin/.mcp.json +5 -1
- package/plugin/README.md +71 -0
- package/plugin/cursor/hooks.json +23 -8
- package/plugin/hooks/hooks.json +24 -12
- package/plugin/hooks.json +67 -0
- package/plugin/opencode/README.md +1 -1
- package/plugin/opencode/agentmemory-capture.ts +25 -11
- package/plugin/opencode/plugin.json +1 -1
- package/plugin/plugin.json +1 -1
- package/plugin/scripts/_capture.d.mts +5 -1
- package/plugin/scripts/_capture.d.mts.map +1 -1
- package/plugin/scripts/_capture.mjs +141 -26
- package/plugin/scripts/_capture.mjs.map +1 -1
- package/plugin/scripts/cursor/run-detached.mjs +786 -0
- package/plugin/scripts/cursor/run-detached.mjs.map +1 -0
- package/plugin/scripts/cursor/run-hook.d.mts +1 -0
- package/plugin/scripts/cursor/run-hook.mjs +704 -0
- package/plugin/scripts/cursor/run-hook.mjs.map +1 -0
- package/plugin/scripts/notification.mjs +20 -6
- package/plugin/scripts/notification.mjs.map +1 -1
- package/plugin/scripts/plugin-bridge.mjs +61 -11
- package/plugin/scripts/post-tool-failure.mjs +19 -6
- package/plugin/scripts/post-tool-failure.mjs.map +1 -1
- package/plugin/scripts/post-tool-use.mjs +19 -6
- package/plugin/scripts/post-tool-use.mjs.map +1 -1
- package/plugin/scripts/pre-compact.mjs +104 -22
- package/plugin/scripts/pre-compact.mjs.map +1 -1
- package/plugin/scripts/pre-tool-use.mjs +83 -10
- package/plugin/scripts/pre-tool-use.mjs.map +1 -1
- package/plugin/scripts/prompt-submit.mjs +12 -4
- package/plugin/scripts/prompt-submit.mjs.map +1 -1
- package/plugin/scripts/session-end.mjs +59 -17
- package/plugin/scripts/session-end.mjs.map +1 -1
- package/plugin/scripts/session-start.mjs +95 -15
- package/plugin/scripts/session-start.mjs.map +1 -1
- package/plugin/scripts/stop.mjs +75 -72
- package/plugin/scripts/stop.mjs.map +1 -1
- package/plugin/scripts/subagent-start.mjs +13 -5
- package/plugin/scripts/subagent-start.mjs.map +1 -1
- package/plugin/scripts/subagent-stop.mjs +32 -10
- package/plugin/scripts/subagent-stop.mjs.map +1 -1
- package/plugin/scripts/task-completed.mjs +21 -6
- package/plugin/scripts/task-completed.mjs.map +1 -1
- package/plugin/skills/_shared/TROUBLESHOOTING.md +21 -7
- package/plugin/skills/agentmemory-agents/REFERENCE.md +8 -7
- package/plugin/skills/agentmemory-agents/SKILL.md +19 -5
- package/plugin/skills/agentmemory-agents/TROUBLESHOOTING.md +70 -0
- package/plugin/skills/agentmemory-architecture/SKILL.md +8 -4
- package/plugin/skills/agentmemory-architecture/TROUBLESHOOTING.md +70 -0
- package/plugin/skills/agentmemory-config/REFERENCE.md +13 -15
- package/plugin/skills/agentmemory-config/SKILL.md +34 -10
- package/plugin/skills/agentmemory-config/TROUBLESHOOTING.md +70 -0
- package/plugin/skills/agentmemory-hooks/SKILL.md +31 -10
- package/plugin/skills/agentmemory-hooks/TROUBLESHOOTING.md +70 -0
- package/plugin/skills/agentmemory-mcp-tools/REFERENCE.md +5 -5
- package/plugin/skills/agentmemory-mcp-tools/SKILL.md +16 -3
- package/plugin/skills/agentmemory-mcp-tools/TROUBLESHOOTING.md +70 -0
- package/plugin/skills/agentmemory-rest-api/REFERENCE.md +10 -1
- package/plugin/skills/agentmemory-rest-api/SKILL.md +12 -6
- package/plugin/skills/agentmemory-rest-api/TROUBLESHOOTING.md +70 -0
- package/plugin/skills/commit-context/SKILL.md +1 -1
- package/plugin/skills/commit-context/TROUBLESHOOTING.md +70 -0
- package/plugin/skills/commit-history/SKILL.md +1 -1
- package/plugin/skills/commit-history/TROUBLESHOOTING.md +70 -0
- package/plugin/skills/forget/EXAMPLES.md +19 -54
- package/plugin/skills/forget/SKILL.md +16 -12
- package/plugin/skills/forget/TROUBLESHOOTING.md +70 -0
- package/plugin/skills/handoff/EXAMPLES.md +5 -4
- package/plugin/skills/handoff/SKILL.md +10 -5
- package/plugin/skills/handoff/TROUBLESHOOTING.md +70 -0
- package/plugin/skills/lesson/SKILL.md +1 -1
- package/plugin/skills/lesson/TROUBLESHOOTING.md +70 -0
- package/plugin/skills/memory-discipline/SKILL.md +1 -1
- package/plugin/skills/memory-discipline/TROUBLESHOOTING.md +70 -0
- package/plugin/skills/recall/SKILL.md +18 -7
- package/plugin/skills/recall/TROUBLESHOOTING.md +70 -0
- package/plugin/skills/recap/EXAMPLES.md +5 -3
- package/plugin/skills/recap/SKILL.md +11 -6
- package/plugin/skills/recap/TROUBLESHOOTING.md +70 -0
- package/plugin/skills/remember/EXAMPLES.md +3 -3
- package/plugin/skills/remember/SKILL.md +1 -1
- package/plugin/skills/remember/TROUBLESHOOTING.md +70 -0
- package/plugin/skills/session-history/EXAMPLES.md +2 -2
- package/plugin/skills/session-history/SKILL.md +10 -4
- package/plugin/skills/session-history/TROUBLESHOOTING.md +70 -0
- package/plugin/skills/write-agentmemory-skill/SKILL.md +2 -1
- package/plugin/skills/write-agentmemory-skill/TROUBLESHOOTING.md +70 -0
- package/dist/connect-B4_ca6BD.mjs.map +0 -1
- package/dist/docker-compose.yml +0 -73
- package/dist/iii-config.docker.yaml +0 -53
- package/dist/iii-config.yaml +0 -63
- package/dist/keyed-mutex-DchXsyfP.mjs.map +0 -1
- package/dist/secret-store-BnY3A50C.mjs.map +0 -1
- package/dist/src-Jsq9LCeH.mjs.map +0 -1
- package/dist/standalone-DKCdrf1d.mjs.map +0 -1
- package/dist/status-IRz7ta8-.mjs +0 -2344
- package/dist/status-IRz7ta8-.mjs.map +0 -1
- package/docker-compose.yml +0 -73
- package/iii-config.docker.yaml +0 -53
- package/iii-config.yaml +0 -63
- package/plugin/scripts/post-commit.mjs +0 -184
- package/plugin/scripts/post-commit.mjs.map +0 -1
- /package/plugin/scripts/{post-commit.d.mts → cursor/run-detached.d.mts} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stop.mjs","names":[],"sources":["../../src/
|
|
1
|
+
{"version":3,"file":"stop.mjs","names":[],"sources":["../../src/hooks/_project.ts","../../src/hooks/stop.ts"],"sourcesContent":["import { execSync } from \"node:child_process\";\nimport { realpathSync } from \"node:fs\";\nimport { basename, dirname, resolve } from \"node:path\";\n\n// Resolution order: AGENTMEMORY_PROJECT_NAME env → git repository basename → cwd basename.\nexport function resolveProject(cwd?: string): string {\n const explicit = process.env[\"AGENTMEMORY_PROJECT_NAME\"];\n if (explicit && explicit.trim()) return explicit.trim();\n const dir = cwd && cwd.trim() ? cwd : process.cwd();\n try {\n const [top, gitDir, commonDir] = execSync(\n \"git rev-parse --show-toplevel --git-dir --git-common-dir\",\n {\n cwd: dir,\n stdio: [\"ignore\", \"pipe\", \"ignore\"],\n timeout: 500,\n },\n )\n .toString()\n .trim()\n .split(/\\r?\\n/);\n if (top) return basename(repositoryRoot(dir, top, gitDir, commonDir));\n } catch {}\n return basename(dir);\n}\n\nfunction repositoryRoot(dir: string, top: string, gitDir?: string, commonDir?: string): string {\n if (!gitDir || !commonDir) return top;\n const physical = realpathSync(dir);\n const common = resolve(physical, commonDir);\n if (resolve(physical, gitDir) === common || basename(common) !== \".git\") return top;\n return dirname(common);\n}\n\nexport function hookCwd(data: Record<string, unknown> | null | undefined): string | undefined {\n if (!data || typeof data !== \"object\") return undefined;\n if (typeof data.cwd === \"string\" && data.cwd.trim()) return data.cwd;\n const roots = data.workspace_roots;\n if (Array.isArray(roots)) {\n for (const root of roots) {\n if (typeof root === \"string\" && root.trim()) return root;\n }\n }\n const projectDir =\n process.env[\"DEVIN_PROJECT_DIR\"] || process.env[\"CLAUDE_PROJECT_DIR\"];\n if (projectDir && projectDir.trim()) return projectDir;\n return undefined;\n}\n","#!/usr/bin/env node\nimport { resolveProject, hookCwd } from \"./_project.js\";\nimport { REST_URL, authHeaders, captureObservation, isDrainChild, runDrainChild, stripPrivateData, transportBlocked, withEventId } from \"./_capture.js\";\n\n// Inlined — see src/hooks/sdk-guard.ts for canonical version. Kept local\n// per-hook so tsdown does not emit a shared hashed chunk that would churn\n// the diff on every rebuild.\nfunction isSdkChildContext(payload: unknown): boolean {\n if (process.env[\"AGENTMEMORY_SDK_CHILD\"] === \"1\") return true;\n if (!payload || typeof payload !== \"object\") return false;\n return (payload as { entrypoint?: unknown }).entrypoint === \"sdk-ts\";\n}\n\nconst OBSERVE_TIMEOUT_MS = 2000;\nconst EXIT_CAP_MS = 3500;\nconst END_CAP_MS = 1500;\nconst REPLY_MAX_CHARS = 4000;\n\nfunction boundReply(reply: string): { text: string; bytes?: number } {\n const safe = stripPrivateData(reply);\n if (safe.length <= REPLY_MAX_CHARS) return { text: safe };\n let head = Math.ceil((REPLY_MAX_CHARS - 1) / 2);\n let tail = safe.length - (REPLY_MAX_CHARS - 1 - head);\n if (/[\\uD800-\\uDBFF]/.test(safe[head - 1]!)) head--;\n if (/[\\uDC00-\\uDFFF]/.test(safe[tail]!)) tail++;\n return { text: `${safe.slice(0, head)}\\u2026${safe.slice(tail)}`, bytes: Buffer.byteLength(safe, \"utf8\") };\n}\n\nasync function main() {\n if (isDrainChild()) return runDrainChild();\n let input = \"\";\n for await (const chunk of process.stdin) {\n input += chunk;\n }\n\n let data: Record<string, unknown>;\n try {\n data = JSON.parse(input);\n } catch {\n return;\n }\n\n if (!data || typeof data !== \"object\") return;\n if (isSdkChildContext(data)) {\n // Do not summarize from inside a Claude Agent SDK child session;\n // would re-enter agent-sdk provider and loop (see sdk-guard.ts).\n return;\n }\n\n const sessionId = ((data.session_id || data.sessionId || data.conversation_id) as string) || \"unknown\";\n const reply = data.last_assistant_message;\n if (typeof reply === \"string\" && reply.trim()) {\n const capture = setTimeout(() => process.exit(0), EXIT_CAP_MS).unref();\n const cwd = hookCwd(data) || process.cwd();\n const bounded = boundReply(reply);\n const body = {\n hookType: \"stop\",\n sessionId,\n project: resolveProject(cwd),\n cwd,\n timestamp: new Date().toISOString(),\n data: {\n last_assistant_message: bounded.text,\n ...(bounded.bytes === undefined ? {} : { last_assistant_message_bytes: bounded.bytes }),\n },\n };\n await captureObservation(withEventId(body, {}), OBSERVE_TIMEOUT_MS).catch(() => {});\n clearTimeout(capture);\n }\n\n setTimeout(() => process.exit(0), END_CAP_MS).unref();\n if (transportBlocked()) return;\n fetch(`${REST_URL}/agentmemory/session/end`, {\n method: \"POST\",\n headers: authHeaders(),\n body: JSON.stringify({ sessionId, final: false }),\n signal: AbortSignal.timeout(5000),\n }).catch(() => {});\n}\n\nmain().catch(() => process.exit(0));\n"],"mappings":";;;;;;AAKA,SAAgB,eAAe,KAAsB;CACnD,MAAM,WAAW,QAAQ,IAAI;AAC7B,KAAI,YAAY,SAAS,MAAM,CAAE,QAAO,SAAS,MAAM;CACvD,MAAM,MAAM,OAAO,IAAI,MAAM,GAAG,MAAM,QAAQ,KAAK;AACnD,KAAI;EACF,MAAM,CAAC,KAAK,QAAQ,aAAa,SAC/B,4DACA;GACE,KAAK;GACL,OAAO;IAAC;IAAU;IAAQ;IAAS;GACnC,SAAS;GACV,CACF,CACE,UAAU,CACV,MAAM,CACN,MAAM,QAAQ;AACjB,MAAI,IAAK,QAAO,SAAS,eAAe,KAAK,KAAK,QAAQ,UAAU,CAAC;SAC/D;AACR,QAAO,SAAS,IAAI;;AAGtB,SAAS,eAAe,KAAa,KAAa,QAAiB,WAA4B;AAC7F,KAAI,CAAC,UAAU,CAAC,UAAW,QAAO;CAClC,MAAM,WAAW,aAAa,IAAI;CAClC,MAAM,SAAS,QAAQ,UAAU,UAAU;AAC3C,KAAI,QAAQ,UAAU,OAAO,KAAK,UAAU,SAAS,OAAO,KAAK,OAAQ,QAAO;AAChF,QAAO,QAAQ,OAAO;;AAGxB,SAAgB,QAAQ,MAAsE;AAC5F,KAA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,SAAS,SAAU;AACvC,KAAI,kBAAkB,KAAK,CAGzB;CAGF,MAAM,YAAc,KAAK,cAAc,KAAK,aAAa,KAAK,mBAA+B;CAC7F,MAAM,QAAQ,KAAK;AACnB,KAAI,OAAO,UAAU,YAAY,MAAM,MAAM,EAAE;EAC7C,MAAM,UAAU,iBAAiB,QAAQ,KAAK,EAAE,EAAE,YAAY,CAAC,OAAO;EACtE,MAAM,MAAM,QAAQ,KAAK,IAAI,QAAQ,KAAK;EAC1C,MAAM,UAAU,WAAW,MAAM;AAYjC,QAAM,mBAAmB,YAAY;GAVnC,UAAU;GACV;GACA,SAAS,eAAe,IAAI;GAC5B;GACA,4BAAW,IAAI,MAAM,EAAC,aAAa;GACnC,MAAM;IACJ,wBAAwB,QAAQ;IAChC,GAAI,QAAQ,UAAU,KAAA,IAAY,EAAE,GAAG,EAAE,8BAA8B,QAAQ,OAAO;IACvF;GAEsC,EAAE,EAAE,CAAC,EAAE,mBAAmB,CAAC,YAAY,GAAG;AACnF,eAAa,QAAQ;;AAGvB,kBAAiB,QAAQ,KAAK,EAAE,EAAE,WAAW,CAAC,OAAO;AACrD,KAAI,kBAAkB,CAAE;AACxB,OAAM,GAAG,SAAS,2BAA2B;EAC3C,QAAQ;EACR,SAAS,aAAa;EACtB,MAAM,KAAK,UAAU;GAAE;GAAW,OAAO;GAAO,CAAC;EACjD,QAAQ,YAAY,QAAQ,IAAK;EAClC,CAAC,CAAC,YAAY,GAAG;;AAGpB,MAAM,CAAC,YAAY,QAAQ,KAAK,EAAE,CAAC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { execSync } from "node:child_process";
|
|
3
|
-
import {
|
|
3
|
+
import { realpathSync } from "node:fs";
|
|
4
|
+
import { basename, dirname, resolve } from "node:path";
|
|
4
5
|
import { captureObservation, isDrainChild, runDrainChild, withEventId } from "./_capture.mjs";
|
|
5
6
|
//#region src/hooks/_project.ts
|
|
6
7
|
function resolveProject(cwd) {
|
|
@@ -8,7 +9,7 @@ function resolveProject(cwd) {
|
|
|
8
9
|
if (explicit && explicit.trim()) return explicit.trim();
|
|
9
10
|
const dir = cwd && cwd.trim() ? cwd : process.cwd();
|
|
10
11
|
try {
|
|
11
|
-
const top = execSync("git rev-parse --show-toplevel", {
|
|
12
|
+
const [top, gitDir, commonDir] = execSync("git rev-parse --show-toplevel --git-dir --git-common-dir", {
|
|
12
13
|
cwd: dir,
|
|
13
14
|
stdio: [
|
|
14
15
|
"ignore",
|
|
@@ -16,11 +17,18 @@ function resolveProject(cwd) {
|
|
|
16
17
|
"ignore"
|
|
17
18
|
],
|
|
18
19
|
timeout: 500
|
|
19
|
-
}).toString().trim();
|
|
20
|
-
if (top) return basename(top);
|
|
20
|
+
}).toString().trim().split(/\r?\n/);
|
|
21
|
+
if (top) return basename(repositoryRoot(dir, top, gitDir, commonDir));
|
|
21
22
|
} catch {}
|
|
22
23
|
return basename(dir);
|
|
23
24
|
}
|
|
25
|
+
function repositoryRoot(dir, top, gitDir, commonDir) {
|
|
26
|
+
if (!gitDir || !commonDir) return top;
|
|
27
|
+
const physical = realpathSync(dir);
|
|
28
|
+
const common = resolve(physical, commonDir);
|
|
29
|
+
if (resolve(physical, gitDir) === common || basename(common) !== ".git") return top;
|
|
30
|
+
return dirname(common);
|
|
31
|
+
}
|
|
24
32
|
function hookCwd(data) {
|
|
25
33
|
if (!data || typeof data !== "object") return void 0;
|
|
26
34
|
if (typeof data.cwd === "string" && data.cwd.trim()) return data.cwd;
|
|
@@ -66,7 +74,7 @@ async function main() {
|
|
|
66
74
|
agent_id: agentId,
|
|
67
75
|
agent_type: agentType
|
|
68
76
|
}
|
|
69
|
-
}, data), OBSERVE_TIMEOUT_MS);
|
|
77
|
+
}, {}, void 0, { stable: Boolean(data.agent_id) }), OBSERVE_TIMEOUT_MS);
|
|
70
78
|
setTimeout(() => process.exit(0), EXIT_CAP_MS).unref();
|
|
71
79
|
}
|
|
72
80
|
main().catch(() => process.exit(0));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"subagent-start.mjs","names":[],"sources":["../../src/hooks/_project.ts","../../src/hooks/subagent-start.ts"],"sourcesContent":["import { execSync } from \"node:child_process\";\nimport { basename } from \"node:path\";\n\n// Resolution order: AGENTMEMORY_PROJECT_NAME env → git
|
|
1
|
+
{"version":3,"file":"subagent-start.mjs","names":[],"sources":["../../src/hooks/_project.ts","../../src/hooks/subagent-start.ts"],"sourcesContent":["import { execSync } from \"node:child_process\";\nimport { realpathSync } from \"node:fs\";\nimport { basename, dirname, resolve } from \"node:path\";\n\n// Resolution order: AGENTMEMORY_PROJECT_NAME env → git repository basename → cwd basename.\nexport function resolveProject(cwd?: string): string {\n const explicit = process.env[\"AGENTMEMORY_PROJECT_NAME\"];\n if (explicit && explicit.trim()) return explicit.trim();\n const dir = cwd && cwd.trim() ? cwd : process.cwd();\n try {\n const [top, gitDir, commonDir] = execSync(\n \"git rev-parse --show-toplevel --git-dir --git-common-dir\",\n {\n cwd: dir,\n stdio: [\"ignore\", \"pipe\", \"ignore\"],\n timeout: 500,\n },\n )\n .toString()\n .trim()\n .split(/\\r?\\n/);\n if (top) return basename(repositoryRoot(dir, top, gitDir, commonDir));\n } catch {}\n return basename(dir);\n}\n\nfunction repositoryRoot(dir: string, top: string, gitDir?: string, commonDir?: string): string {\n if (!gitDir || !commonDir) return top;\n const physical = realpathSync(dir);\n const common = resolve(physical, commonDir);\n if (resolve(physical, gitDir) === common || basename(common) !== \".git\") return top;\n return dirname(common);\n}\n\nexport function hookCwd(data: Record<string, unknown> | null | undefined): string | undefined {\n if (!data || typeof data !== \"object\") return undefined;\n if (typeof data.cwd === \"string\" && data.cwd.trim()) return data.cwd;\n const roots = data.workspace_roots;\n if (Array.isArray(roots)) {\n for (const root of roots) {\n if (typeof root === \"string\" && root.trim()) return root;\n }\n }\n const projectDir =\n process.env[\"DEVIN_PROJECT_DIR\"] || process.env[\"CLAUDE_PROJECT_DIR\"];\n if (projectDir && projectDir.trim()) return projectDir;\n return undefined;\n}\n","#!/usr/bin/env node\nimport { resolveProject, hookCwd } from \"./_project.js\";\nimport { captureObservation, isDrainChild, runDrainChild, withEventId } from \"./_capture.js\";\n\n// Inlined from ./sdk-guard so each hook bundles to a single self-contained\n// .mjs (matches the pattern used by every other hook entry in tsdown.config).\nfunction isSdkChildContext(payload: unknown): boolean {\n if (process.env[\"AGENTMEMORY_SDK_CHILD\"] === \"1\") return true;\n if (!payload || typeof payload !== \"object\") return false;\n return (payload as { entrypoint?: unknown }).entrypoint === \"sdk-ts\";\n}\n\nconst OBSERVE_TIMEOUT_MS = 800;\nconst EXIT_CAP_MS = 1300;\n\nasync function main() {\n if (isDrainChild()) return runDrainChild();\n let input = \"\";\n for await (const chunk of process.stdin) {\n input += chunk;\n }\n\n let data: Record<string, unknown>;\n try {\n data = JSON.parse(input);\n } catch {\n return;\n }\n\n if (!data || typeof data !== \"object\") return;\n if (isSdkChildContext(data)) return;\n\n const sessionId = ((data.session_id || data.sessionId || data.conversation_id) as string) || \"unknown\";\n const agentId = data.agent_id || data.agentName;\n const agentType = data.agent_type || data.agentDisplayName || data.agentName;\n\n const cwd = hookCwd(data) || process.cwd();\n\n void captureObservation(\n withEventId(\n {\n hookType: \"subagent_start\",\n sessionId,\n project: resolveProject(cwd),\n cwd,\n timestamp: new Date().toISOString(),\n data: {\n agent_id: agentId,\n agent_type: agentType,\n },\n },\n {},\n undefined,\n { stable: Boolean(data.agent_id) },\n ),\n OBSERVE_TIMEOUT_MS,\n );\n setTimeout(() => process.exit(0), EXIT_CAP_MS).unref();\n}\n\nmain().catch(() => process.exit(0));\n"],"mappings":";;;;;;AAKA,SAAgB,eAAe,KAAsB;CACnD,MAAM,WAAW,QAAQ,IAAI;AAC7B,KAAI,YAAY,SAAS,MAAM,CAAE,QAAO,SAAS,MAAM;CACvD,MAAM,MAAM,OAAO,IAAI,MAAM,GAAG,MAAM,QAAQ,KAAK;AACnD,KAAI;EACF,MAAM,CAA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SAAO,KAAK,MAAM,MAAM;SAClB;AACN;;AAGF,KAAI,CAAC,QAAQ,OAAO,SAAS,SAAU;AACvC,KAAI,kBAAkB,KAAK,CAAE;CAE7B,MAAM,YAAc,KAAK,cAAc,KAAK,aAAa,KAAK,mBAA+B;CAC7F,MAAM,UAAU,KAAK,YAAY,KAAK;CACtC,MAAM,YAAY,KAAK,cAAc,KAAK,oBAAoB,KAAK;CAEnE,MAAM,MAAM,QAAQ,KAAK,IAAI,QAAQ,KAAK;AAErC,oBACH,YACE;EACE,UAAU;EACV;EACA,SAAS,eAAe,IAAI;EAC5B;EACA,4BAAW,IAAI,MAAM,EAAC,aAAa;EACnC,MAAM;GACJ,UAAU;GACV,YAAY;GACb;EACF,EACD,EAAE,EACF,KAAA,GACA,EAAE,QAAQ,QAAQ,KAAK,SAAS,EAAE,CACnC,EACD,mBACD;AACD,kBAAiB,QAAQ,KAAK,EAAE,EAAE,YAAY,CAAC,OAAO;;AAGxD,MAAM,CAAC,YAAY,QAAQ,KAAK,EAAE,CAAC"}
|
|
@@ -1,14 +1,22 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { execSync } from "node:child_process";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { realpathSync } from "node:fs";
|
|
4
|
+
import { basename, dirname, resolve } from "node:path";
|
|
5
|
+
import { captureObservation, isDrainChild, runDrainChild, stripPrivateData, withEventId } from "./_capture.mjs";
|
|
6
|
+
//#region src/hooks/_capture-filter.ts
|
|
7
|
+
function truncateText(value, max) {
|
|
8
|
+
if (value.length <= max) return value;
|
|
9
|
+
const end = /[\uD800-\uDBFF]/.test(value[max - 1] ?? "") ? max - 1 : max;
|
|
10
|
+
return value.slice(0, end);
|
|
11
|
+
}
|
|
12
|
+
//#endregion
|
|
5
13
|
//#region src/hooks/_project.ts
|
|
6
14
|
function resolveProject(cwd) {
|
|
7
15
|
const explicit = process.env["AGENTMEMORY_PROJECT_NAME"];
|
|
8
16
|
if (explicit && explicit.trim()) return explicit.trim();
|
|
9
17
|
const dir = cwd && cwd.trim() ? cwd : process.cwd();
|
|
10
18
|
try {
|
|
11
|
-
const top = execSync("git rev-parse --show-toplevel", {
|
|
19
|
+
const [top, gitDir, commonDir] = execSync("git rev-parse --show-toplevel --git-dir --git-common-dir", {
|
|
12
20
|
cwd: dir,
|
|
13
21
|
stdio: [
|
|
14
22
|
"ignore",
|
|
@@ -16,11 +24,18 @@ function resolveProject(cwd) {
|
|
|
16
24
|
"ignore"
|
|
17
25
|
],
|
|
18
26
|
timeout: 500
|
|
19
|
-
}).toString().trim();
|
|
20
|
-
if (top) return basename(top);
|
|
27
|
+
}).toString().trim().split(/\r?\n/);
|
|
28
|
+
if (top) return basename(repositoryRoot(dir, top, gitDir, commonDir));
|
|
21
29
|
} catch {}
|
|
22
30
|
return basename(dir);
|
|
23
31
|
}
|
|
32
|
+
function repositoryRoot(dir, top, gitDir, commonDir) {
|
|
33
|
+
if (!gitDir || !commonDir) return top;
|
|
34
|
+
const physical = realpathSync(dir);
|
|
35
|
+
const common = resolve(physical, commonDir);
|
|
36
|
+
if (resolve(physical, gitDir) === common || basename(common) !== ".git") return top;
|
|
37
|
+
return dirname(common);
|
|
38
|
+
}
|
|
24
39
|
function hookCwd(data) {
|
|
25
40
|
if (!data || typeof data !== "object") return void 0;
|
|
26
41
|
if (typeof data.cwd === "string" && data.cwd.trim()) return data.cwd;
|
|
@@ -53,11 +68,13 @@ async function main() {
|
|
|
53
68
|
if (!data || typeof data !== "object") return;
|
|
54
69
|
if (isSdkChildContext(data)) return;
|
|
55
70
|
const sessionId = data.session_id || data.sessionId || data.conversation_id || "unknown";
|
|
56
|
-
const agentId = data.agent_id || data.agentName;
|
|
57
|
-
const agentType = data.agent_type || data.agentDisplayName || data.agentName;
|
|
58
|
-
const
|
|
71
|
+
const agentId = data.agent_id || data.agentId || data.agentName;
|
|
72
|
+
const agentType = data.agent_type || data.agentType || data.agentDisplayName || data.agentName;
|
|
73
|
+
const reply = data.last_assistant_message ?? data.response;
|
|
74
|
+
const redactedReply = typeof reply === "string" ? stripPrivateData(reply) : "";
|
|
75
|
+
const lastMsg = truncateText(redactedReply, 4e3);
|
|
59
76
|
const cwd = hookCwd(data) || process.cwd();
|
|
60
|
-
|
|
77
|
+
const body = {
|
|
61
78
|
hookType: "subagent_stop",
|
|
62
79
|
sessionId,
|
|
63
80
|
project: resolveProject(cwd),
|
|
@@ -68,7 +85,12 @@ async function main() {
|
|
|
68
85
|
agent_type: agentType,
|
|
69
86
|
last_message: lastMsg
|
|
70
87
|
}
|
|
71
|
-
}
|
|
88
|
+
};
|
|
89
|
+
captureObservation(withEventId(body, {}, {
|
|
90
|
+
...body.data,
|
|
91
|
+
last_message: redactedReply,
|
|
92
|
+
stop_hook_active: data.stop_hook_active === true
|
|
93
|
+
}, { stable: Boolean(data.agent_id || data.agentId) }), OBSERVE_TIMEOUT_MS);
|
|
72
94
|
setTimeout(() => process.exit(0), EXIT_CAP_MS).unref();
|
|
73
95
|
}
|
|
74
96
|
main().catch(() => process.exit(0));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"subagent-stop.mjs","names":[],"sources":["../../src/hooks/_project.ts","../../src/hooks/subagent-stop.ts"],"sourcesContent":["import { execSync } from \"node:child_process\";\nimport { basename } from \"node:path\";\n\n// Resolution order: AGENTMEMORY_PROJECT_NAME env → git
|
|
1
|
+
{"version":3,"file":"subagent-stop.mjs","names":[],"sources":["../../src/hooks/_capture-filter.ts","../../src/hooks/_project.ts","../../src/hooks/subagent-stop.ts"],"sourcesContent":["const DEFAULT_DENY_PATTERNS = [\n \"memory_*\",\n \"toolsearch\",\n \"listmcpresources\",\n \"fetchmcpresource\",\n];\n\nfunction parseEnvList(raw: string | undefined): string[] | undefined {\n if (!raw?.trim()) return undefined;\n return raw\n .split(/[,\\s]+/)\n .map((part) => part.trim())\n .filter(Boolean);\n}\n\nexport function bareToolName(toolName: string): string {\n const trimmed = toolName.trim();\n if (/^mcp__/i.test(trimmed)) {\n const parts = trimmed.split(\"__\");\n if (parts.length >= 3) return parts[parts.length - 1]!;\n }\n return trimmed;\n}\n\nfunction normalizePattern(pattern: string): string {\n return pattern.trim().toLowerCase();\n}\n\nfunction matchesPattern(toolName: string, pattern: string): boolean {\n const bare = bareToolName(toolName).toLowerCase();\n const full = toolName.trim().toLowerCase();\n const pat = normalizePattern(pattern);\n if (!pat.includes(\"*\")) return bare === pat || full === pat;\n const escaped = pat.replace(/[.+?^${}()|[\\]\\\\]/g, \"\\\\$&\");\n const re = new RegExp(`^${escaped.replace(/\\*/g, \".*\")}$`);\n return re.test(bare) || re.test(full);\n}\n\nfunction matchesAny(toolName: string, patterns: string[]): boolean {\n return patterns.some((pattern) => matchesPattern(toolName, pattern));\n}\n\nexport function shouldCaptureTool(toolName: unknown): boolean {\n if (typeof toolName !== \"string\" || !toolName.trim()) return true;\n\n const allow = parseEnvList(process.env[\"AGENTMEMORY_CAPTURE_ALLOW\"]);\n if (allow) return matchesAny(toolName, allow);\n\n const deny = [\n ...DEFAULT_DENY_PATTERNS,\n ...(parseEnvList(process.env[\"AGENTMEMORY_CAPTURE_DENY\"]) ?? []),\n ];\n return !matchesAny(toolName, deny);\n}\n\nexport function captureOutputMax(): number {\n const raw = process.env[\"AGENTMEMORY_CAPTURE_OUTPUT_MAX\"];\n if (!raw?.trim()) return 8000;\n const parsed = Number.parseInt(raw, 10);\n return Number.isFinite(parsed) && parsed > 0 ? parsed : 8000;\n}\n\nexport function truncateText(value: string, max: number): string {\n if (value.length <= max) return value;\n const end = /[\\uD800-\\uDBFF]/.test(value[max - 1] ?? \"\") ? max - 1 : max;\n return value.slice(0, end);\n}\n\nexport function truncateCaptureOutput(value: unknown, max: number): unknown {\n if (typeof value === \"string\" && value.length > max) {\n const suffix = \"\\n[...truncated]\";\n return max <= suffix.length\n ? suffix.slice(0, max)\n : truncateText(value, max - suffix.length) + suffix;\n }\n if (typeof value === \"object\" && value !== null) {\n const str = JSON.stringify(value);\n if (str.length > max) {\n const suffix = \"...[truncated]\";\n return max <= suffix.length\n ? suffix.slice(0, max)\n : truncateText(str, max - suffix.length) + suffix;\n }\n return value;\n }\n return value;\n}\n\nexport function preCompactBudget(): number {\n const raw = process.env[\"AGENTMEMORY_PRE_COMPACT_BUDGET\"];\n if (raw?.trim() === \"0\") return 0;\n if (!raw?.trim()) return 1500;\n const parsed = Number.parseInt(raw, 10);\n return Number.isFinite(parsed) && parsed >= 0 ? parsed : 1500;\n}\n","import { execSync } from \"node:child_process\";\nimport { realpathSync } from \"node:fs\";\nimport { basename, dirname, resolve } from \"node:path\";\n\n// Resolution order: AGENTMEMORY_PROJECT_NAME env → git repository basename → cwd basename.\nexport function resolveProject(cwd?: string): string {\n const explicit = process.env[\"AGENTMEMORY_PROJECT_NAME\"];\n if (explicit && explicit.trim()) return explicit.trim();\n const dir = cwd && cwd.trim() ? cwd : process.cwd();\n try {\n const [top, gitDir, commonDir] = execSync(\n \"git rev-parse --show-toplevel --git-dir --git-common-dir\",\n {\n cwd: dir,\n stdio: [\"ignore\", \"pipe\", \"ignore\"],\n timeout: 500,\n },\n )\n .toString()\n .trim()\n .split(/\\r?\\n/);\n if (top) return basename(repositoryRoot(dir, top, gitDir, commonDir));\n } catch {}\n return basename(dir);\n}\n\nfunction repositoryRoot(dir: string, top: string, gitDir?: string, commonDir?: string): string {\n if (!gitDir || !commonDir) return top;\n const physical = realpathSync(dir);\n const common = resolve(physical, commonDir);\n if (resolve(physical, gitDir) === common || basename(common) !== \".git\") return top;\n return dirname(common);\n}\n\nexport function hookCwd(data: Record<string, unknown> | null | undefined): string | undefined {\n if (!data || typeof data !== \"object\") return undefined;\n if (typeof data.cwd === \"string\" && data.cwd.trim()) return data.cwd;\n const roots = data.workspace_roots;\n if (Array.isArray(roots)) {\n for (const root of roots) {\n if (typeof root === \"string\" && root.trim()) return root;\n }\n }\n const projectDir =\n process.env[\"DEVIN_PROJECT_DIR\"] || process.env[\"CLAUDE_PROJECT_DIR\"];\n if (projectDir && projectDir.trim()) return projectDir;\n return undefined;\n}\n","#!/usr/bin/env node\nimport { truncateText } from \"./_capture-filter.js\";\nimport { resolveProject, hookCwd } from \"./_project.js\";\nimport { captureObservation, isDrainChild, runDrainChild, stripPrivateData, withEventId } from \"./_capture.js\";\n\nfunction isSdkChildContext(payload: unknown): boolean {\n if (process.env[\"AGENTMEMORY_SDK_CHILD\"] === \"1\") return true;\n if (!payload || typeof payload !== \"object\") return false;\n return (payload as { entrypoint?: unknown }).entrypoint === \"sdk-ts\";\n}\n\nconst OBSERVE_TIMEOUT_MS = 2000;\nconst EXIT_CAP_MS = 2500;\n\nasync function main() {\n if (isDrainChild()) return runDrainChild();\n let input = \"\";\n for await (const chunk of process.stdin) {\n input += chunk;\n }\n\n let data: Record<string, unknown>;\n try {\n data = JSON.parse(input);\n } catch {\n return;\n }\n\n if (!data || typeof data !== \"object\") return;\n if (isSdkChildContext(data)) return;\n\n const sessionId = ((data.session_id || data.sessionId || data.conversation_id) as string) || \"unknown\";\n const agentId = data.agent_id || data.agentId || data.agentName;\n const agentType = data.agent_type || data.agentType || data.agentDisplayName || data.agentName;\n const reply = data.last_assistant_message ?? data.response;\n const redactedReply = typeof reply === \"string\" ? stripPrivateData(reply) : \"\";\n const lastMsg = truncateText(redactedReply, 4000);\n\n const cwd = hookCwd(data) || process.cwd();\n\n const body = {\n hookType: \"subagent_stop\",\n sessionId,\n project: resolveProject(cwd),\n cwd,\n timestamp: new Date().toISOString(),\n data: {\n agent_id: agentId,\n agent_type: agentType,\n last_message: lastMsg,\n },\n };\n void captureObservation(\n withEventId(\n body,\n {},\n { ...body.data, last_message: redactedReply, stop_hook_active: data.stop_hook_active === true },\n { stable: Boolean(data.agent_id || data.agentId) },\n ),\n OBSERVE_TIMEOUT_MS,\n );\n setTimeout(() => process.exit(0), EXIT_CAP_MS).unref();\n}\n\nmain().catch(() => process.exit(0));\n"],"mappings":";;;;;;AA8DA,SAAgB,aAAa,OAAe,KAAqB;AAC/D,KA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,KAAK,EAAE,CAAC"}
|
|
@@ -1,14 +1,22 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { execSync } from "node:child_process";
|
|
3
|
-
import {
|
|
3
|
+
import { realpathSync } from "node:fs";
|
|
4
|
+
import { basename, dirname, resolve } from "node:path";
|
|
4
5
|
import { captureObservation, isDrainChild, runDrainChild, withEventId } from "./_capture.mjs";
|
|
6
|
+
//#region src/hooks/_capture-filter.ts
|
|
7
|
+
function truncateText(value, max) {
|
|
8
|
+
if (value.length <= max) return value;
|
|
9
|
+
const end = /[\uD800-\uDBFF]/.test(value[max - 1] ?? "") ? max - 1 : max;
|
|
10
|
+
return value.slice(0, end);
|
|
11
|
+
}
|
|
12
|
+
//#endregion
|
|
5
13
|
//#region src/hooks/_project.ts
|
|
6
14
|
function resolveProject(cwd) {
|
|
7
15
|
const explicit = process.env["AGENTMEMORY_PROJECT_NAME"];
|
|
8
16
|
if (explicit && explicit.trim()) return explicit.trim();
|
|
9
17
|
const dir = cwd && cwd.trim() ? cwd : process.cwd();
|
|
10
18
|
try {
|
|
11
|
-
const top = execSync("git rev-parse --show-toplevel", {
|
|
19
|
+
const [top, gitDir, commonDir] = execSync("git rev-parse --show-toplevel --git-dir --git-common-dir", {
|
|
12
20
|
cwd: dir,
|
|
13
21
|
stdio: [
|
|
14
22
|
"ignore",
|
|
@@ -16,11 +24,18 @@ function resolveProject(cwd) {
|
|
|
16
24
|
"ignore"
|
|
17
25
|
],
|
|
18
26
|
timeout: 500
|
|
19
|
-
}).toString().trim();
|
|
20
|
-
if (top) return basename(top);
|
|
27
|
+
}).toString().trim().split(/\r?\n/);
|
|
28
|
+
if (top) return basename(repositoryRoot(dir, top, gitDir, commonDir));
|
|
21
29
|
} catch {}
|
|
22
30
|
return basename(dir);
|
|
23
31
|
}
|
|
32
|
+
function repositoryRoot(dir, top, gitDir, commonDir) {
|
|
33
|
+
if (!gitDir || !commonDir) return top;
|
|
34
|
+
const physical = realpathSync(dir);
|
|
35
|
+
const common = resolve(physical, commonDir);
|
|
36
|
+
if (resolve(physical, gitDir) === common || basename(common) !== ".git") return top;
|
|
37
|
+
return dirname(common);
|
|
38
|
+
}
|
|
24
39
|
function hookCwd(data) {
|
|
25
40
|
if (!data || typeof data !== "object") return void 0;
|
|
26
41
|
if (typeof data.cwd === "string" && data.cwd.trim()) return data.cwd;
|
|
@@ -63,11 +78,11 @@ async function main() {
|
|
|
63
78
|
data: {
|
|
64
79
|
task_id: data.task_id,
|
|
65
80
|
task_subject: data.task_subject,
|
|
66
|
-
task_description: typeof data.task_description === "string" ? data.task_description
|
|
81
|
+
task_description: typeof data.task_description === "string" ? truncateText(data.task_description, 2e3) : "",
|
|
67
82
|
teammate_name: data.teammate_name,
|
|
68
83
|
team_name: data.team_name
|
|
69
84
|
}
|
|
70
|
-
}, data), OBSERVE_TIMEOUT_MS);
|
|
85
|
+
}, {}, void 0, { stable: Boolean(data.task_id) }), OBSERVE_TIMEOUT_MS);
|
|
71
86
|
setTimeout(() => process.exit(0), EXIT_CAP_MS).unref();
|
|
72
87
|
}
|
|
73
88
|
main().catch(() => process.exit(0));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"task-completed.mjs","names":[],"sources":["../../src/hooks/_project.ts","../../src/hooks/task-completed.ts"],"sourcesContent":["import { execSync } from \"node:child_process\";\nimport { basename } from \"node:path\";\n\n// Resolution order: AGENTMEMORY_PROJECT_NAME env → git
|
|
1
|
+
{"version":3,"file":"task-completed.mjs","names":[],"sources":["../../src/hooks/_capture-filter.ts","../../src/hooks/_project.ts","../../src/hooks/task-completed.ts"],"sourcesContent":["const DEFAULT_DENY_PATTERNS = [\n \"memory_*\",\n \"toolsearch\",\n \"listmcpresources\",\n \"fetchmcpresource\",\n];\n\nfunction parseEnvList(raw: string | undefined): string[] | undefined {\n if (!raw?.trim()) return undefined;\n return raw\n .split(/[,\\s]+/)\n .map((part) => part.trim())\n .filter(Boolean);\n}\n\nexport function bareToolName(toolName: string): string {\n const trimmed = toolName.trim();\n if (/^mcp__/i.test(trimmed)) {\n const parts = trimmed.split(\"__\");\n if (parts.length >= 3) return parts[parts.length - 1]!;\n }\n return trimmed;\n}\n\nfunction normalizePattern(pattern: string): string {\n return pattern.trim().toLowerCase();\n}\n\nfunction matchesPattern(toolName: string, pattern: string): boolean {\n const bare = bareToolName(toolName).toLowerCase();\n const full = toolName.trim().toLowerCase();\n const pat = normalizePattern(pattern);\n if (!pat.includes(\"*\")) return bare === pat || full === pat;\n const escaped = pat.replace(/[.+?^${}()|[\\]\\\\]/g, \"\\\\$&\");\n const re = new RegExp(`^${escaped.replace(/\\*/g, \".*\")}$`);\n return re.test(bare) || re.test(full);\n}\n\nfunction matchesAny(toolName: string, patterns: string[]): boolean {\n return patterns.some((pattern) => matchesPattern(toolName, pattern));\n}\n\nexport function shouldCaptureTool(toolName: unknown): boolean {\n if (typeof toolName !== \"string\" || !toolName.trim()) return true;\n\n const allow = parseEnvList(process.env[\"AGENTMEMORY_CAPTURE_ALLOW\"]);\n if (allow) return matchesAny(toolName, allow);\n\n const deny = [\n ...DEFAULT_DENY_PATTERNS,\n ...(parseEnvList(process.env[\"AGENTMEMORY_CAPTURE_DENY\"]) ?? []),\n ];\n return !matchesAny(toolName, deny);\n}\n\nexport function captureOutputMax(): number {\n const raw = process.env[\"AGENTMEMORY_CAPTURE_OUTPUT_MAX\"];\n if (!raw?.trim()) return 8000;\n const parsed = Number.parseInt(raw, 10);\n return Number.isFinite(parsed) && parsed > 0 ? parsed : 8000;\n}\n\nexport function truncateText(value: string, max: number): string {\n if (value.length <= max) return value;\n const end = /[\\uD800-\\uDBFF]/.test(value[max - 1] ?? \"\") ? max - 1 : max;\n return value.slice(0, end);\n}\n\nexport function truncateCaptureOutput(value: unknown, max: number): unknown {\n if (typeof value === \"string\" && value.length > max) {\n const suffix = \"\\n[...truncated]\";\n return max <= suffix.length\n ? suffix.slice(0, max)\n : truncateText(value, max - suffix.length) + suffix;\n }\n if (typeof value === \"object\" && value !== null) {\n const str = JSON.stringify(value);\n if (str.length > max) {\n const suffix = \"...[truncated]\";\n return max <= suffix.length\n ? suffix.slice(0, max)\n : truncateText(str, max - suffix.length) + suffix;\n }\n return value;\n }\n return value;\n}\n\nexport function preCompactBudget(): number {\n const raw = process.env[\"AGENTMEMORY_PRE_COMPACT_BUDGET\"];\n if (raw?.trim() === \"0\") return 0;\n if (!raw?.trim()) return 1500;\n const parsed = Number.parseInt(raw, 10);\n return Number.isFinite(parsed) && parsed >= 0 ? parsed : 1500;\n}\n","import { execSync } from \"node:child_process\";\nimport { realpathSync } from \"node:fs\";\nimport { basename, dirname, resolve } from \"node:path\";\n\n// Resolution order: AGENTMEMORY_PROJECT_NAME env → git repository basename → cwd basename.\nexport function resolveProject(cwd?: string): string {\n const explicit = process.env[\"AGENTMEMORY_PROJECT_NAME\"];\n if (explicit && explicit.trim()) return explicit.trim();\n const dir = cwd && cwd.trim() ? cwd : process.cwd();\n try {\n const [top, gitDir, commonDir] = execSync(\n \"git rev-parse --show-toplevel --git-dir --git-common-dir\",\n {\n cwd: dir,\n stdio: [\"ignore\", \"pipe\", \"ignore\"],\n timeout: 500,\n },\n )\n .toString()\n .trim()\n .split(/\\r?\\n/);\n if (top) return basename(repositoryRoot(dir, top, gitDir, commonDir));\n } catch {}\n return basename(dir);\n}\n\nfunction repositoryRoot(dir: string, top: string, gitDir?: string, commonDir?: string): string {\n if (!gitDir || !commonDir) return top;\n const physical = realpathSync(dir);\n const common = resolve(physical, commonDir);\n if (resolve(physical, gitDir) === common || basename(common) !== \".git\") return top;\n return dirname(common);\n}\n\nexport function hookCwd(data: Record<string, unknown> | null | undefined): string | undefined {\n if (!data || typeof data !== \"object\") return undefined;\n if (typeof data.cwd === \"string\" && data.cwd.trim()) return data.cwd;\n const roots = data.workspace_roots;\n if (Array.isArray(roots)) {\n for (const root of roots) {\n if (typeof root === \"string\" && root.trim()) return root;\n }\n }\n const projectDir =\n process.env[\"DEVIN_PROJECT_DIR\"] || process.env[\"CLAUDE_PROJECT_DIR\"];\n if (projectDir && projectDir.trim()) return projectDir;\n return undefined;\n}\n","#!/usr/bin/env node\nimport { truncateText } from \"./_capture-filter.js\";\nimport { resolveProject, hookCwd } from \"./_project.js\";\nimport { captureObservation, isDrainChild, runDrainChild, withEventId } from \"./_capture.js\";\n\nfunction isSdkChildContext(payload: unknown): boolean {\n if (process.env[\"AGENTMEMORY_SDK_CHILD\"] === \"1\") return true;\n if (!payload || typeof payload !== \"object\") return false;\n return (payload as { entrypoint?: unknown }).entrypoint === \"sdk-ts\";\n}\n\nconst OBSERVE_TIMEOUT_MS = 2000;\nconst EXIT_CAP_MS = 2500;\n\nasync function main() {\n if (isDrainChild()) return runDrainChild();\n let input = \"\";\n for await (const chunk of process.stdin) {\n input += chunk;\n }\n\n let data: Record<string, unknown>;\n try {\n data = JSON.parse(input);\n } catch {\n return;\n }\n\n if (!data || typeof data !== \"object\") return;\n if (isSdkChildContext(data)) return;\n\n const sessionId = ((data.session_id || data.sessionId || data.conversation_id) as string) || \"unknown\";\n\n const cwd = hookCwd(data) || process.cwd();\n\n void captureObservation(\n withEventId(\n {\n hookType: \"task_completed\",\n sessionId,\n project: resolveProject(cwd),\n cwd,\n timestamp: new Date().toISOString(),\n data: {\n task_id: data.task_id,\n task_subject: data.task_subject,\n task_description: typeof data.task_description === \"string\"\n ? truncateText(data.task_description, 2000)\n : \"\",\n teammate_name: data.teammate_name,\n team_name: data.team_name,\n },\n },\n {},\n undefined,\n { stable: Boolean(data.task_id) },\n ),\n OBSERVE_TIMEOUT_MS,\n );\n setTimeout(() => process.exit(0), EXIT_CAP_MS).unref();\n}\n\nmain().catch(() => process.exit(0));\n"],"mappings":";;;;;;AA8DA,SAAgB,aAAa,OAAe,KAAqB;AAC/D,KAAI,MAAM,UAAU,IAAK,QAAO;CAChC,MAAM,MAAM,kBAAkB,KAAK,MAAM,MAAM,MAAM,GAAG,GAAG,MAAM,IAAI;AACrE,QAAO,MAAM,MAAM,GAAG,I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,QAAQ,QAAqC,eAAe;;AAG9D,MAAM,qBAAqB;AAC3B,MAAM,cAAc;AAEpB,eAAe,OAAO;AACpB,KAAI,cAAc,CAAE,QAAO,eAAe;CAC1C,IAAI,QAAQ;AACZ,YAAW,MAAM,SAAS,QAAQ,MAChC,UAAS;CAGX,IAAI;AACJ,KAAI;AACF,SAAO,KAAK,MAAM,MAAM;SAClB;AACN;;AAGF,KAAI,CAAC,QAAQ,OAAO,SAAS,SAAU;AACvC,KAAI,kBAAkB,KAAK,CAAE;CAE7B,MAAM,YAAc,KAAK,cAAc,KAAK,aAAa,KAAK,mBAA+B;CAE7F,MAAM,MAAM,QAAQ,KAAK,IAAI,QAAQ,KAAK;AAErC,oBACH,YACE;EACE,UAAU;EACV;EACA,SAAS,eAAe,IAAI;EAC5B;EACA,4BAAW,IAAI,MAAM,EAAC,aAAa;EACnC,MAAM;GACJ,SAAS,KAAK;GACd,cAAc,KAAK;GACnB,kBAAkB,OAAO,KAAK,qBAAqB,WAC/C,aAAa,KAAK,kBAAkB,IAAK,GACzC;GACJ,eAAe,KAAK;GACpB,WAAW,KAAK;GACjB;EACF,EACD,EAAE,EACF,KAAA,GACA,EAAE,QAAQ,QAAQ,KAAK,QAAQ,EAAE,CAClC,EACD,mBACD;AACD,kBAAiB,QAAQ,KAAK,EAAE,EAAE,YAAY,CAAC,OAAO;;AAGxD,MAAM,CAAC,YAAY,QAAQ,KAAK,EAAE,CAAC"}
|
|
@@ -1,17 +1,23 @@
|
|
|
1
1
|
# Troubleshooting agentmemory skills
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
Recovery steps for separately installed skills. This document is generated into
|
|
4
|
+
each skill directory so native skill readers can open it without parent traversal.
|
|
5
5
|
|
|
6
6
|
## "MCP tool not available"
|
|
7
7
|
|
|
8
8
|
Missing tools can mean a stopped MCP process, a disconnected daemon, or an
|
|
9
9
|
explicitly reduced tool surface. Walk these in order:
|
|
10
10
|
|
|
11
|
-
1.
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
11
|
+
1. Identify the host. In Claude Code, inspect `/plugin list` and `/mcp`.
|
|
12
|
+
In Hermes, inspect the configured memory provider and `mcp_servers` separately.
|
|
13
|
+
In OpenClaw, validate the host configuration and inspect its MCP servers and
|
|
14
|
+
native plugins separately. In Pi or OMP, inspect `/agentmemory-status` and the
|
|
15
|
+
MCP inventory separately; native save/search does not prove the broader tools
|
|
16
|
+
are connected. Do not run another host's setup commands.
|
|
17
|
+
2. Restart or reload the affected host connection after configuration changes.
|
|
18
|
+
3. Inspect the connected tool inventory. Hermes may namespace MCP tools; invoke
|
|
19
|
+
the actual advertised names and schemas. A native memory provider is not
|
|
20
|
+
proof that every MCP tool or shared skill is available.
|
|
15
21
|
4. Check `agentmemory status` and the daemon's `AGENTMEMORY_TOOLS` setting.
|
|
16
22
|
Codex's bundled bridge lists the daemon's enabled tools. The standalone shim
|
|
17
23
|
used by other hosts can fall back to seven basic tools with a separate store.
|
|
@@ -19,6 +25,12 @@ explicitly reduced tool surface. Walk these in order:
|
|
|
19
25
|
5. If `agentmemory connect codex` and the Codex plugin are both enabled, choose
|
|
20
26
|
one MCP connection. Check `/hooks` before adding global hook fallbacks.
|
|
21
27
|
|
|
28
|
+
Hermes, OpenClaw, Pi and OMP connector installations bundle skills; other hosts
|
|
29
|
+
may install them separately. Check the host's skill inventory and open this file
|
|
30
|
+
from the installed skill directory. Test automatic capture with a real turn and
|
|
31
|
+
a recorded observation; tool connectivity alone does not establish lifecycle
|
|
32
|
+
capture.
|
|
33
|
+
|
|
22
34
|
An outage or timeout is not an empty search result. Report the failure. A write
|
|
23
35
|
may have committed before the response was lost; inspect state before retrying.
|
|
24
36
|
|
|
@@ -32,9 +44,11 @@ API directly:
|
|
|
32
44
|
`AGENTMEMORY_SECRET`; for loopback URLs only, fall back to the secret in
|
|
33
45
|
`~/.agentmemory/.env` and then `~/.agentmemory/secret`. Load the value locally
|
|
34
46
|
without displaying it. Never send a local-file secret to a remote URL.
|
|
47
|
+
If `AGENTMEMORY_CREDENTIAL_MODE=explicit`, require the explicit host credential
|
|
48
|
+
and do not read local credential files.
|
|
35
49
|
Authenticated REST fallback requests require HTTPS for non-loopback
|
|
36
50
|
URLs; HTTP is allowed for loopback URLs (`localhost`, `127.0.0.0/8`, or `[::1]`).
|
|
37
|
-
Do not print or save the secret.
|
|
51
|
+
Reject redirects on authenticated requests. Do not print or save the secret.
|
|
38
52
|
|
|
39
53
|
Endpoint map by skill:
|
|
40
54
|
|
|
@@ -3,28 +3,29 @@
|
|
|
3
3
|
Generated from `src/cli/connect/index.ts`. Do not edit the block below by hand; run `npm run skills:gen` after adding or removing an adapter.
|
|
4
4
|
|
|
5
5
|
<!-- AUTOGEN:agents START - generated by scripts/skills/generate.ts, do not edit by hand -->
|
|
6
|
-
`agentmemory connect <agent>` wires the memory server into a host agent.
|
|
6
|
+
`agentmemory connect <agent>` wires the memory server into a host agent. 22 adapters:
|
|
7
7
|
|
|
8
8
|
| Agent | Name | Protocol |
|
|
9
9
|
| --- | --- | --- |
|
|
10
10
|
| Antigravity | `antigravity` | Using MCP via ~/.gemini/config/mcp_config.json, shared by current Antigravity surfaces. Pass --with-hooks for capture through ~/.gemini/config/hooks.json. |
|
|
11
11
|
| Antigravity CLI (agy) | `antigravity-cli` | Using MCP via ~/.gemini/config/mcp_config.json, shared with current Antigravity IDE versions. The `/mcp` slash command inside agy lists configured servers. Pass --with-hooks to also install the native ~/.gemini/config/hooks.json auto-capture hooks. |
|
|
12
12
|
| Claude Code | `claude-code` | Using MCP. Hooks are also available, see https://github.com/rohitg00/agentmemory#claude-code-one-block-paste-it. |
|
|
13
|
-
| Cline | `cline` | Using MCP via ~/.cline/
|
|
13
|
+
| Cline | `cline` | Using MCP via ~/.cline/data/settings/cline_mcp_settings.json (CLI), or CLINE_MCP_SETTINGS_PATH when set. VS Code users: add the same block via Cline Settings → MCP Servers → Edit JSON. |
|
|
14
14
|
| Codex CLI | `codex` | Using MCP. Hooks ship via the Codex plugin; on Codex Desktop, also pass --with-hooks to install the global hooks.json workaround. |
|
|
15
15
|
| Continue | `continue` | Using MCP via ~/.continue/config.yaml (preferred) or config.json (legacy, only when no yaml). |
|
|
16
16
|
| GitHub Copilot CLI | `copilot-cli` | Using MCP. Install the plugin too for full hooks/skills coverage. |
|
|
17
|
-
| Cursor | `cursor` | Using MCP
|
|
17
|
+
| Cursor | `cursor` | Using MCP. Lifecycle hooks ship in the Cursor plugin: Settings → Plugins → Add marketplace → this repo, then enable agentmemory. |
|
|
18
18
|
| Devin CLI | `devin` | Using MCP via the user config. Devin CLI migrates mcpServers into mcp_config.json on newer builds. Pass --with-hooks for native auto-capture. |
|
|
19
19
|
| Droid (Factory.ai) | `droid` | Using MCP via ~/.factory/mcp.json. The `/mcp` slash command inside droid lists configured servers. Pass --with-hooks to also install the native ~/.factory/hooks.json auto-capture hooks. |
|
|
20
|
-
| DeepSeek Harness | `dsh` | Using MCP via $DSH_HOME/cordis.patch.yml (the home-level patch layer every profile loads). Tools appear as mcp__agentmemory__*. Pass --with-hooks to also wire auto-capture
|
|
20
|
+
| DeepSeek Harness | `dsh` | Using MCP via $DSH_HOME/cordis.patch.yml (the home-level patch layer every profile loads). Tools appear as mcp__agentmemory__*. Pass --with-hooks to also wire auto-capture with the bundled native DSH plugin. |
|
|
21
21
|
| Gemini CLI | `gemini-cli` | Using MCP (the only protocol Gemini CLI speaks). Memory bridge runs at :3111 underneath. |
|
|
22
|
-
| Hermes Agent | `hermes` |
|
|
22
|
+
| Hermes Agent | `hermes` | Installs the native memory provider and bundled skills into the active Hermes profile. Credentials stay managed by Hermes. |
|
|
23
23
|
| Kiro | `kiro` | Using MCP via ~/.kiro/settings/mcp.json (user-level). Workspace overrides live in .kiro/settings/mcp.json. |
|
|
24
|
-
|
|
|
24
|
+
| Oh My Pi | `omp` | Installs native recall, capture and skills. Add --with-mcp for the full memory toolset. |
|
|
25
|
+
| OpenClaw | `openclaw` | Installs native recall/capture and bundled skills into the active OpenClaw state directory. MCP tools are opt-in with --with-mcp. |
|
|
25
26
|
| OpenCode | `opencode` | Using MCP via ~/.config/opencode/opencode.json (top-level `mcp` key). For full auto-capture, also install the bundled plugin in plugin/opencode/. |
|
|
26
27
|
| OpenHuman | `openhuman` | Using native hooks (REST API at :3111). MCP not required. |
|
|
27
|
-
|
|
|
28
|
+
| Pi | `pi` | Installs native recall, capture and skills. Add --with-mcp for the full memory toolset. |
|
|
28
29
|
| Qwen Code | `qwen` | Using MCP via ~/.qwen/settings.json. Qwen Code's hook system can also be wired separately, see docs. |
|
|
29
30
|
| Warp | `warp` | Using MCP via ~/.warp/.mcp.json. Skills auto-discover from .claude/skills/ if the Claude Code plugin is also installed. |
|
|
30
31
|
| Zed | `zed` | Using MCP via ~/.config/zed/settings.json (key: context_servers). |
|
|
@@ -12,18 +12,32 @@ user-invocable: false
|
|
|
12
12
|
agentmemory connect claude-code # or cursor, codex, gemini-cli, ...
|
|
13
13
|
```
|
|
14
14
|
|
|
15
|
-
After wiring, restart the host or run its MCP reload (for example `/mcp` in Claude Code) so it picks up the server. Then confirm the agent lists agentmemory's tools.
|
|
15
|
+
After wiring, restart the host or run its MCP reload (for example `/mcp` in Claude Code, or a new session after `devin mcp list` in Devin CLI) so it picks up the server. Then confirm the agent lists agentmemory's tools.
|
|
16
|
+
|
|
17
|
+
Devin CLI and Devin Desktop can also install the whole plugin with `devin plugins install rohitg00/agentmemory#plugin`, which adds the skills, the MCP server, and the capture hooks in one step. Cloud Devin sessions cannot reach a local agentmemory server, so the plugin is for local sessions only.
|
|
18
|
+
|
|
19
|
+
For Pi, Oh My Pi, or DeepSeek Harness, start the daemon and choose the matching command:
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
agentmemory connect pi --with-mcp
|
|
23
|
+
agentmemory connect omp --with-mcp
|
|
24
|
+
agentmemory connect dsh --with-hooks
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
Pi and OMP install native recall, capture and bundled skills; `--with-mcp` adds the tools needed by the broader workflows. Reload Pi with `/reload`, or restart OMP, then run `/agentmemory-status`. Restart DSH after enabling its bundled capture plugin. Re-run the matching connector after upgrading or moving AgentMemory so installed runtime paths stay current.
|
|
28
|
+
|
|
29
|
+
Cursor's connector configures MCP. Install and enable the Cursor plugin through Settings → Plugins → Add marketplace → this repository for lifecycle capture; do not add a second global hook copy.
|
|
16
30
|
|
|
17
31
|
## Workflow
|
|
18
32
|
|
|
19
|
-
1. Detect the calling agent. If unknown,
|
|
33
|
+
1. Detect the calling agent. If unknown, ask which host to configure before changing files.
|
|
20
34
|
2. Run `agentmemory connect <name>` using a name from the table in REFERENCE.md.
|
|
21
|
-
3.
|
|
35
|
+
3. Read the command result: an adapter that prints manual setup instructions has not completed installation. Restart the configured host, inspect its actual tool inventory, and perform an authorized save/recall check. A native memory provider and an MCP connection are separate surfaces (see [TROUBLESHOOTING.md](TROUBLESHOOTING.md)).
|
|
22
36
|
|
|
23
37
|
## Notes
|
|
24
38
|
|
|
25
|
-
-
|
|
26
|
-
- Windows
|
|
39
|
+
- Hermes, OpenClaw, Pi and OMP connectors bundle skills. For a separate skills installation, use `npx skills@1.7.1 add rohitg00/agentmemory --agent hermes-agent --skill '*'` or `--agent openclaw`. Choose the intended host; add `--global` only for a user-wide installation. Avoid duplicate skill installations when a native package already bundles them. Verify skill discovery and read a skill's local support file in that host.
|
|
40
|
+
- Native Windows supports `agentmemory connect copilot-cli`. Other automated connectors require macOS, Linux or a host running in the same WSL2 environment; use the host's manual setup instructions otherwise.
|
|
27
41
|
|
|
28
42
|
## See also
|
|
29
43
|
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
<!-- AUTOGEN:troubleshooting START - generated by scripts/skills/generate.ts, do not edit by hand -->
|
|
2
|
+
# Troubleshooting agentmemory skills
|
|
3
|
+
|
|
4
|
+
Recovery steps for separately installed skills. This document is generated into
|
|
5
|
+
each skill directory so native skill readers can open it without parent traversal.
|
|
6
|
+
|
|
7
|
+
## "MCP tool not available"
|
|
8
|
+
|
|
9
|
+
Missing tools can mean a stopped MCP process, a disconnected daemon, or an
|
|
10
|
+
explicitly reduced tool surface. Walk these in order:
|
|
11
|
+
|
|
12
|
+
1. Identify the host. In Claude Code, inspect `/plugin list` and `/mcp`.
|
|
13
|
+
In Hermes, inspect the configured memory provider and `mcp_servers` separately.
|
|
14
|
+
In OpenClaw, validate the host configuration and inspect its MCP servers and
|
|
15
|
+
native plugins separately. In Pi or OMP, inspect `/agentmemory-status` and the
|
|
16
|
+
MCP inventory separately; native save/search does not prove the broader tools
|
|
17
|
+
are connected. Do not run another host's setup commands.
|
|
18
|
+
2. Restart or reload the affected host connection after configuration changes.
|
|
19
|
+
3. Inspect the connected tool inventory. Hermes may namespace MCP tools; invoke
|
|
20
|
+
the actual advertised names and schemas. A native memory provider is not
|
|
21
|
+
proof that every MCP tool or shared skill is available.
|
|
22
|
+
4. Check `agentmemory status` and the daemon's `AGENTMEMORY_TOOLS` setting.
|
|
23
|
+
Codex's bundled bridge lists the daemon's enabled tools. The standalone shim
|
|
24
|
+
used by other hosts can fall back to seven basic tools with a separate store.
|
|
25
|
+
Do not claim full daemon functionality based on those seven tools.
|
|
26
|
+
5. If `agentmemory connect codex` and the Codex plugin are both enabled, choose
|
|
27
|
+
one MCP connection. Check `/hooks` before adding global hook fallbacks.
|
|
28
|
+
|
|
29
|
+
Hermes, OpenClaw, Pi and OMP connector installations bundle skills; other hosts
|
|
30
|
+
may install them separately. Check the host's skill inventory and open this file
|
|
31
|
+
from the installed skill directory. Test automatic capture with a real turn and
|
|
32
|
+
a recorded observation; tool connectivity alone does not establish lifecycle
|
|
33
|
+
capture.
|
|
34
|
+
|
|
35
|
+
An outage or timeout is not an empty search result. Report the failure. A write
|
|
36
|
+
may have committed before the response was lost; inspect state before retrying.
|
|
37
|
+
|
|
38
|
+
## REST fallback
|
|
39
|
+
|
|
40
|
+
When the MCP tools stay unavailable but the daemon is running, call the REST
|
|
41
|
+
API directly:
|
|
42
|
+
|
|
43
|
+
1. Set `AGENTMEMORY_URL` to the daemon base URL (default `http://localhost:3111`).
|
|
44
|
+
2. The REST API requires a bearer credential by default. Use the host's explicit
|
|
45
|
+
`AGENTMEMORY_SECRET`; for loopback URLs only, fall back to the secret in
|
|
46
|
+
`~/.agentmemory/.env` and then `~/.agentmemory/secret`. Load the value locally
|
|
47
|
+
without displaying it. Never send a local-file secret to a remote URL.
|
|
48
|
+
If `AGENTMEMORY_CREDENTIAL_MODE=explicit`, require the explicit host credential
|
|
49
|
+
and do not read local credential files.
|
|
50
|
+
Authenticated REST fallback requests require HTTPS for non-loopback
|
|
51
|
+
URLs; HTTP is allowed for loopback URLs (`localhost`, `127.0.0.0/8`, or `[::1]`).
|
|
52
|
+
Reject redirects on authenticated requests. Do not print or save the secret.
|
|
53
|
+
|
|
54
|
+
Endpoint map by skill:
|
|
55
|
+
|
|
56
|
+
| Skill | REST call |
|
|
57
|
+
| --------------- | --------------------------------------------------------------- |
|
|
58
|
+
| remember | `POST /agentmemory/remember` |
|
|
59
|
+
| recall | `POST /agentmemory/smart-search` |
|
|
60
|
+
| recap | `GET /agentmemory/sessions` + `POST /agentmemory/smart-search` |
|
|
61
|
+
| handoff | `GET /agentmemory/sessions` + `POST /agentmemory/smart-search` |
|
|
62
|
+
| session-history | `GET /agentmemory/sessions` |
|
|
63
|
+
| commit-context | `GET /agentmemory/session/by-commit?sha=<sha>` |
|
|
64
|
+
| commit-history | `GET /agentmemory/commits` (URL-encode every query param) |
|
|
65
|
+
|
|
66
|
+
The MCP host reads the plugin MCP configuration. Restart the daemon after
|
|
67
|
+
changing its configuration, then restart or reconnect the host MCP process after
|
|
68
|
+
changing its URL or explicit secret. The local bridge reads the credential files
|
|
69
|
+
for each request; it does not inherit other daemon `.env` settings.
|
|
70
|
+
<!-- AUTOGEN:troubleshooting END -->
|
|
@@ -4,7 +4,7 @@ description: How agentmemory is built, the iii engine primitives it runs on, its
|
|
|
4
4
|
user-invocable: false
|
|
5
5
|
---
|
|
6
6
|
|
|
7
|
-
agentmemory is a memory server for coding agents. It runs locally, captures observations, indexes them for hybrid retrieval, and serves them back over REST and MCP.
|
|
7
|
+
agentmemory is a memory server for coding agents. It runs locally, captures observations, indexes them for hybrid retrieval, and serves them back over REST and MCP. Worker Compose runs the pinned iii engine with AgentMemory and the registry `state` and `http` workers. The state worker uses a file-backed KV store by default, with Redis available by configuration; it is not SQLite.
|
|
8
8
|
|
|
9
9
|
## iii primitives
|
|
10
10
|
|
|
@@ -12,7 +12,11 @@ Everything is a function, a trigger, or worker state on the iii engine. There is
|
|
|
12
12
|
|
|
13
13
|
## Retrieval model
|
|
14
14
|
|
|
15
|
-
Recall
|
|
15
|
+
Recall combines BM25 keyword search with configured vector similarity and graph expansion. A clean installation has no embedding provider and uses BM25 without an API key. Set `EMBEDDING_PROVIDER=local` to enable on-device embeddings, which download a model once. A remote embedding provider runs only when `EMBEDDING_PROVIDER` names it. LLM summaries, consolidation and reflection run only when `AGENTMEMORY_LLM_PROVIDER` selects a provider or `AGENTMEMORY_ALLOW_AGENT_SDK=true` turns on the Claude Agent SDK fallback; a key in the environment alone does not turn them on. Per-observation LLM compression also needs `AGENTMEMORY_AUTO_COMPRESS=true`.
|
|
16
|
+
|
|
17
|
+
## Data boundary
|
|
18
|
+
|
|
19
|
+
Captured prompts, tool inputs and outputs, and memories stay in the local store. They leave the machine only through options the user turns on: a selected LLM provider, the Agent SDK fallback (`AGENTMEMORY_ALLOW_AGENT_SDK=true`), a remote embedding provider, a Redis state backend, or mesh sync to peer servers the user registers.
|
|
16
20
|
|
|
17
21
|
## Storage and lifecycle
|
|
18
22
|
|
|
@@ -20,11 +24,11 @@ Memories carry content, concepts, files, importance, and timestamps, grouped int
|
|
|
20
24
|
|
|
21
25
|
## Ports
|
|
22
26
|
|
|
23
|
-
REST
|
|
27
|
+
REST defaults to port `3111`, the viewer to `3113`, and the internal engine WebSocket to `49134`. Use `--port <N>` or `--instance <N>` to select another local runtime.
|
|
24
28
|
|
|
25
29
|
## Viewer
|
|
26
30
|
|
|
27
|
-
A real-time web viewer at `http://localhost:3113` shows memory building as sessions run. Useful for demos and for confirming capture is working.
|
|
31
|
+
A real-time web viewer at `http://localhost:3113` shows memory building as sessions run, with authenticated SSE updates over the REST port. Useful for demos and for confirming capture is working.
|
|
28
32
|
|
|
29
33
|
## See also
|
|
30
34
|
|