ziiagentmemory 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (160) hide show
  1. package/.env.example +175 -0
  2. package/AGENTS.md +124 -0
  3. package/LICENSE +190 -0
  4. package/README.md +1546 -0
  5. package/dist/cli.d.mts +5 -0
  6. package/dist/cli.d.mts.map +1 -0
  7. package/dist/cli.mjs +2859 -0
  8. package/dist/cli.mjs.map +1 -0
  9. package/dist/config-ChC9EtgV.mjs +259 -0
  10. package/dist/config-ChC9EtgV.mjs.map +1 -0
  11. package/dist/connect-JnsJXc68.mjs +1075 -0
  12. package/dist/connect-JnsJXc68.mjs.map +1 -0
  13. package/dist/hooks/notification.d.mts +1 -0
  14. package/dist/hooks/notification.mjs +74 -0
  15. package/dist/hooks/notification.mjs.map +1 -0
  16. package/dist/hooks/post-commit.d.mts +1 -0
  17. package/dist/hooks/post-commit.mjs +101 -0
  18. package/dist/hooks/post-commit.mjs.map +1 -0
  19. package/dist/hooks/post-tool-failure.d.mts +1 -0
  20. package/dist/hooks/post-tool-failure.mjs +75 -0
  21. package/dist/hooks/post-tool-failure.mjs.map +1 -0
  22. package/dist/hooks/post-tool-use.d.mts +1 -0
  23. package/dist/hooks/post-tool-use.mjs +120 -0
  24. package/dist/hooks/post-tool-use.mjs.map +1 -0
  25. package/dist/hooks/pre-compact.d.mts +1 -0
  26. package/dist/hooks/pre-compact.mjs +78 -0
  27. package/dist/hooks/pre-compact.mjs.map +1 -0
  28. package/dist/hooks/pre-tool-use.d.mts +1 -0
  29. package/dist/hooks/pre-tool-use.mjs +84 -0
  30. package/dist/hooks/pre-tool-use.mjs.map +1 -0
  31. package/dist/hooks/prompt-submit.d.mts +1 -0
  32. package/dist/hooks/prompt-submit.mjs +67 -0
  33. package/dist/hooks/prompt-submit.mjs.map +1 -0
  34. package/dist/hooks/session-end.d.mts +1 -0
  35. package/dist/hooks/session-end.mjs +60 -0
  36. package/dist/hooks/session-end.mjs.map +1 -0
  37. package/dist/hooks/session-start.d.mts +1 -0
  38. package/dist/hooks/session-start.mjs +85 -0
  39. package/dist/hooks/session-start.mjs.map +1 -0
  40. package/dist/hooks/stop.d.mts +1 -0
  41. package/dist/hooks/stop.mjs +44 -0
  42. package/dist/hooks/stop.mjs.map +1 -0
  43. package/dist/hooks/subagent-start.d.mts +1 -0
  44. package/dist/hooks/subagent-start.mjs +73 -0
  45. package/dist/hooks/subagent-start.mjs.map +1 -0
  46. package/dist/hooks/subagent-stop.d.mts +1 -0
  47. package/dist/hooks/subagent-stop.mjs +74 -0
  48. package/dist/hooks/subagent-stop.mjs.map +1 -0
  49. package/dist/hooks/task-completed.d.mts +1 -0
  50. package/dist/hooks/task-completed.mjs +73 -0
  51. package/dist/hooks/task-completed.mjs.map +1 -0
  52. package/dist/image-refs-BKLmp_sD.mjs +34 -0
  53. package/dist/image-refs-BKLmp_sD.mjs.map +1 -0
  54. package/dist/image-refs-C2YU7BIm.mjs +34 -0
  55. package/dist/image-refs-C2YU7BIm.mjs.map +1 -0
  56. package/dist/index.d.mts +2 -0
  57. package/dist/index.mjs +22324 -0
  58. package/dist/index.mjs.map +1 -0
  59. package/dist/keyed-mutex-DTHtcZrt.mjs +88 -0
  60. package/dist/keyed-mutex-DTHtcZrt.mjs.map +1 -0
  61. package/dist/logger-BEB7pCI9.mjs +43 -0
  62. package/dist/logger-BEB7pCI9.mjs.map +1 -0
  63. package/dist/schema-CNiCWzV9.mjs +78 -0
  64. package/dist/schema-CNiCWzV9.mjs.map +1 -0
  65. package/dist/src-Cr3pH_uH.mjs +20745 -0
  66. package/dist/src-Cr3pH_uH.mjs.map +1 -0
  67. package/dist/standalone-C6KzNkt5.mjs +700 -0
  68. package/dist/standalone-C6KzNkt5.mjs.map +1 -0
  69. package/dist/standalone.d.mts +25 -0
  70. package/dist/standalone.d.mts.map +1 -0
  71. package/dist/standalone.mjs +1867 -0
  72. package/dist/standalone.mjs.map +1 -0
  73. package/dist/tools-registry-DCt2KAWA.mjs +1145 -0
  74. package/dist/tools-registry-DCt2KAWA.mjs.map +1 -0
  75. package/docker-compose.yml +47 -0
  76. package/iii-config.docker.yaml +53 -0
  77. package/iii-config.yaml +61 -0
  78. package/package.json +99 -0
  79. package/plugin/.claude-plugin/plugin.json +13 -0
  80. package/plugin/.codex-plugin/plugin.json +15 -0
  81. package/plugin/.mcp.copilot.json +15 -0
  82. package/plugin/.mcp.json +13 -0
  83. package/plugin/hooks/hooks.codex.json +67 -0
  84. package/plugin/hooks/hooks.copilot.json +72 -0
  85. package/plugin/hooks/hooks.json +125 -0
  86. package/plugin/opencode/README.md +229 -0
  87. package/plugin/opencode/agentmemory-capture.ts +687 -0
  88. package/plugin/opencode/commands/recall.md +19 -0
  89. package/plugin/opencode/commands/remember.md +19 -0
  90. package/plugin/opencode/plugin.json +12 -0
  91. package/plugin/plugin.json +15 -0
  92. package/plugin/scripts/diagnostics.mjs +551 -0
  93. package/plugin/scripts/notification.d.mts +1 -0
  94. package/plugin/scripts/notification.mjs +74 -0
  95. package/plugin/scripts/notification.mjs.map +1 -0
  96. package/plugin/scripts/post-commit.d.mts +1 -0
  97. package/plugin/scripts/post-commit.mjs +101 -0
  98. package/plugin/scripts/post-commit.mjs.map +1 -0
  99. package/plugin/scripts/post-tool-failure.d.mts +1 -0
  100. package/plugin/scripts/post-tool-failure.mjs +75 -0
  101. package/plugin/scripts/post-tool-failure.mjs.map +1 -0
  102. package/plugin/scripts/post-tool-use.d.mts +1 -0
  103. package/plugin/scripts/post-tool-use.mjs +120 -0
  104. package/plugin/scripts/post-tool-use.mjs.map +1 -0
  105. package/plugin/scripts/pre-compact.d.mts +1 -0
  106. package/plugin/scripts/pre-compact.mjs +78 -0
  107. package/plugin/scripts/pre-compact.mjs.map +1 -0
  108. package/plugin/scripts/pre-tool-use.d.mts +1 -0
  109. package/plugin/scripts/pre-tool-use.mjs +84 -0
  110. package/plugin/scripts/pre-tool-use.mjs.map +1 -0
  111. package/plugin/scripts/prompt-submit.d.mts +1 -0
  112. package/plugin/scripts/prompt-submit.mjs +67 -0
  113. package/plugin/scripts/prompt-submit.mjs.map +1 -0
  114. package/plugin/scripts/session-end.d.mts +1 -0
  115. package/plugin/scripts/session-end.mjs +60 -0
  116. package/plugin/scripts/session-end.mjs.map +1 -0
  117. package/plugin/scripts/session-start.d.mts +1 -0
  118. package/plugin/scripts/session-start.mjs +85 -0
  119. package/plugin/scripts/session-start.mjs.map +1 -0
  120. package/plugin/scripts/stop.d.mts +1 -0
  121. package/plugin/scripts/stop.mjs +44 -0
  122. package/plugin/scripts/stop.mjs.map +1 -0
  123. package/plugin/scripts/subagent-start.d.mts +1 -0
  124. package/plugin/scripts/subagent-start.mjs +73 -0
  125. package/plugin/scripts/subagent-start.mjs.map +1 -0
  126. package/plugin/scripts/subagent-stop.d.mts +1 -0
  127. package/plugin/scripts/subagent-stop.mjs +74 -0
  128. package/plugin/scripts/subagent-stop.mjs.map +1 -0
  129. package/plugin/scripts/task-completed.d.mts +1 -0
  130. package/plugin/scripts/task-completed.mjs +73 -0
  131. package/plugin/scripts/task-completed.mjs.map +1 -0
  132. package/plugin/skills/_shared/TROUBLESHOOTING.md +38 -0
  133. package/plugin/skills/agentmemory-agents/REFERENCE.md +28 -0
  134. package/plugin/skills/agentmemory-agents/SKILL.md +34 -0
  135. package/plugin/skills/agentmemory-architecture/SKILL.md +33 -0
  136. package/plugin/skills/agentmemory-config/REFERENCE.md +42 -0
  137. package/plugin/skills/agentmemory-config/SKILL.md +37 -0
  138. package/plugin/skills/agentmemory-hooks/REFERENCE.md +20 -0
  139. package/plugin/skills/agentmemory-hooks/SKILL.md +39 -0
  140. package/plugin/skills/agentmemory-mcp-tools/REFERENCE.md +65 -0
  141. package/plugin/skills/agentmemory-mcp-tools/SKILL.md +39 -0
  142. package/plugin/skills/agentmemory-rest-api/REFERENCE.md +129 -0
  143. package/plugin/skills/agentmemory-rest-api/SKILL.md +43 -0
  144. package/plugin/skills/commit-context/EXAMPLES.md +71 -0
  145. package/plugin/skills/commit-context/SKILL.md +64 -0
  146. package/plugin/skills/commit-history/EXAMPLES.md +71 -0
  147. package/plugin/skills/commit-history/SKILL.md +62 -0
  148. package/plugin/skills/forget/EXAMPLES.md +75 -0
  149. package/plugin/skills/forget/SKILL.md +66 -0
  150. package/plugin/skills/handoff/EXAMPLES.md +56 -0
  151. package/plugin/skills/handoff/SKILL.md +68 -0
  152. package/plugin/skills/recall/EXAMPLES.md +74 -0
  153. package/plugin/skills/recall/SKILL.md +60 -0
  154. package/plugin/skills/recap/EXAMPLES.md +60 -0
  155. package/plugin/skills/recap/SKILL.md +63 -0
  156. package/plugin/skills/remember/EXAMPLES.md +67 -0
  157. package/plugin/skills/remember/SKILL.md +61 -0
  158. package/plugin/skills/session-history/EXAMPLES.md +59 -0
  159. package/plugin/skills/session-history/SKILL.md +61 -0
  160. package/plugin/skills/write-agentmemory-skill/SKILL.md +40 -0
@@ -0,0 +1,42 @@
1
+ # agentmemory configuration reference
2
+
3
+ Generated by scanning `src/` for `AGENTMEMORY_*` usage. Do not edit the block below by hand; run `npm run skills:gen` after adding or removing a variable. Internal markers ending in two underscores are excluded.
4
+
5
+ <!-- AUTOGEN:env START - generated by scripts/skills/generate.ts, do not edit by hand -->
6
+ Configuration is read from the environment and from `~/.agentmemory/.env` (no `export` prefix). 34 recognized variables:
7
+
8
+ - `AGENTMEMORY_AGENT_SCOPE`
9
+ - `AGENTMEMORY_ALLOW_AGENT_SDK`
10
+ - `AGENTMEMORY_AUTO_COMPRESS`
11
+ - `AGENTMEMORY_COMMIT_SHA`
12
+ - `AGENTMEMORY_COPILOT_MCP_BLOCK`
13
+ - `AGENTMEMORY_CWD`
14
+ - `AGENTMEMORY_DEBUG`
15
+ - `AGENTMEMORY_DROP_STALE_INDEX`
16
+ - `AGENTMEMORY_EXPORT_ROOT`
17
+ - `AGENTMEMORY_FOLLOWUP_WINDOW_SECONDS`
18
+ - `AGENTMEMORY_FORCE_PROXY`
19
+ - `AGENTMEMORY_GRAPH_WEIGHT`
20
+ - `AGENTMEMORY_III_CONFIG`
21
+ - `AGENTMEMORY_III_VERSION`
22
+ - `AGENTMEMORY_IMAGE_EMBEDDINGS`
23
+ - `AGENTMEMORY_IMAGE_STORE_MAX_BYTES`
24
+ - `AGENTMEMORY_INJECT_CONTEXT`
25
+ - `AGENTMEMORY_LLM_TIMEOUT_MS`
26
+ - `AGENTMEMORY_MCP_BLOCK`
27
+ - `AGENTMEMORY_PROBE_TIMEOUT_MS`
28
+ - `AGENTMEMORY_PROJECT_NAME`
29
+ - `AGENTMEMORY_PROVIDER`
30
+ - `AGENTMEMORY_REFLECT`
31
+ - `AGENTMEMORY_SDK_CHILD`
32
+ - `AGENTMEMORY_SECRET`
33
+ - `AGENTMEMORY_SESSION_ID`
34
+ - `AGENTMEMORY_SLOTS`
35
+ - `AGENTMEMORY_SUPPRESS_COST_WARNING`
36
+ - `AGENTMEMORY_TOOLS`
37
+ - `AGENTMEMORY_URL`
38
+ - `AGENTMEMORY_USE_DOCKER`
39
+ - `AGENTMEMORY_VERBOSE`
40
+ - `AGENTMEMORY_VIEWER_HOST`
41
+ - `AGENTMEMORY_VIEWER_URL`
42
+ <!-- AUTOGEN:env END -->
@@ -0,0 +1,37 @@
1
+ ---
2
+ name: agentmemory-config
3
+ description: agentmemory configuration, environment variables, ports, and feature flags. Use when enabling a feature, changing ports, setting an API key, configuring auth, or explaining why a feature is off by default.
4
+ user-invocable: false
5
+ ---
6
+
7
+ agentmemory reads configuration from the environment and from `~/.agentmemory/.env` (one `KEY=value` per line, no `export` prefix). Restart the server after changing it.
8
+
9
+ ## Quick start
10
+
11
+ Enable richer memory and set a provider key in `~/.agentmemory/.env`:
12
+
13
+ ```env
14
+ ANTHROPIC_API_KEY=sk-ant-...
15
+ AGENTMEMORY_AUTO_COMPRESS=true
16
+ AGENTMEMORY_INJECT_CONTEXT=true
17
+ ```
18
+
19
+ ## Defaults worth knowing
20
+
21
+ - No API key is required. Without one, agentmemory runs zero-LLM with BM25 plus local embeddings.
22
+ - Token-spending features ship OFF on purpose: `AGENTMEMORY_AUTO_COMPRESS` (LLM summaries) and `AGENTMEMORY_INJECT_CONTEXT` (auto context injection) both cost tokens proportional to tool-use frequency.
23
+ - Tool visibility: `AGENTMEMORY_TOOLS=all` (default) or `core` for the lean set.
24
+ - Auth: set `AGENTMEMORY_SECRET` to require `Authorization: Bearer` on the REST API.
25
+
26
+ ## Ports
27
+
28
+ REST is the anchor at 3111. Streams = N+1 (3112), viewer = N+2 (3113), engine = N+46023 (49134). Relocate the whole block with `--port <N>` or `--instance <N>`.
29
+
30
+ ## See also
31
+
32
+ - agentmemory-rest-api for how the secret is used.
33
+ - agentmemory-architecture for the port quartet rationale.
34
+
35
+ ## Reference
36
+
37
+ The full recognized-variable list lives in REFERENCE.md, generated by scanning `src/`.
@@ -0,0 +1,20 @@
1
+ # agentmemory hooks reference
2
+
3
+ Generated from `plugin/hooks/hooks.json`. Do not edit the block below by hand; run `npm run skills:gen` after changing the hook registration.
4
+
5
+ <!-- AUTOGEN:hooks START - generated by scripts/skills/generate.ts, do not edit by hand -->
6
+ The Claude Code plugin registers hooks on 12 lifecycle events to capture observations automatically:
7
+
8
+ - `Notification`
9
+ - `PostToolUse`
10
+ - `PostToolUseFailure`
11
+ - `PreCompact`
12
+ - `PreToolUse`
13
+ - `SessionEnd`
14
+ - `SessionStart`
15
+ - `Stop`
16
+ - `SubagentStart`
17
+ - `SubagentStop`
18
+ - `TaskCompleted`
19
+ - `UserPromptSubmit`
20
+ <!-- AUTOGEN:hooks END -->
@@ -0,0 +1,39 @@
1
+ ---
2
+ name: agentmemory-hooks
3
+ description: The agentmemory plugin hooks that capture observations automatically across the agent session lifecycle. Use when explaining how memory gets captured without manual saves, when debugging missing observations, or when tuning what gets recorded.
4
+ user-invocable: false
5
+ ---
6
+
7
+ The Claude Code plugin registers lifecycle hooks so memory is captured automatically. You do not have to call `memory_save` for routine work; the hooks observe tool use, prompts, and session boundaries and write observations for you.
8
+
9
+ ## Quick start
10
+
11
+ Install the plugin and the hooks register themselves:
12
+
13
+ ```bash
14
+ /plugin marketplace add rohitg00/agentmemory
15
+ /plugin install agentmemory
16
+ ```
17
+
18
+ Watch observations land live at `http://localhost:3113`.
19
+
20
+ ## What the hooks do
21
+
22
+ - Session start and end frame each unit of work and let `handoff` resume it.
23
+ - Tool-use hooks capture what changed and why, the raw material for `recall` and `recap`.
24
+ - Prompt-submit captures intent. Pre-compact preserves context before the host trims it.
25
+ - A post-commit hook links commits to sessions, which powers `commit-context` and `commit-history`.
26
+
27
+ ## Important
28
+
29
+ - Capture is on by default and is zero-LLM. Turning observations into LLM summaries (`AGENTMEMORY_AUTO_COMPRESS`) and injecting them back into context (`AGENTMEMORY_INJECT_CONTEXT`) are separate opt-ins because they spend tokens.
30
+ - If observations are missing, confirm the plugin is enabled and the server is running. See ../_shared/TROUBLESHOOTING.md.
31
+
32
+ ## See also
33
+
34
+ - agentmemory-config for the capture and injection flags.
35
+ - The handoff, recap, and session-history skills consume what these hooks record.
36
+
37
+ ## Reference
38
+
39
+ The exact registered hook events live in REFERENCE.md, generated from `plugin/hooks/hooks.json`.
@@ -0,0 +1,65 @@
1
+ # agentmemory MCP tools reference
2
+
3
+ Generated from `src/mcp/tools-registry.ts`. Do not edit the block below by hand; run `npm run skills:gen` after changing the registry.
4
+
5
+ <!-- AUTOGEN:tools START - generated by scripts/skills/generate.ts, do not edit by hand -->
6
+ agentmemory exposes 53 MCP tools. 8 are in the lean core set (`--tools core` or `AGENTMEMORY_TOOLS=core`); the rest load with `--tools all` (default).
7
+
8
+ | Tool | Core | Parameters | Purpose |
9
+ | --- | --- | --- | --- |
10
+ | `memory_action_create` | | `title`*: string, `description`: string, `priority`: number, `project`: string, `tags`: string, `parentId`: string, `requires`: string | Create an actionable work item with typed dependencies. Actions track what agents need to do and how work items relate to each other. |
11
+ | `memory_action_update` | | `actionId`*: string, `status`: string, `result`: string, `priority`: number | Update an action's status, priority, or details. Set status to 'done' to complete it and unblock dependent actions. |
12
+ | `memory_audit` | | `operation`: string, `limit`: number | View the audit trail of memory operations. |
13
+ | `memory_checkpoint` | | `operation`*: string, `name`: string, `checkpointId`: string, `status`: string, `type`: string, `linkedActionIds`: string | Create or resolve an external checkpoint (CI result, approval, deploy status) that gates action progress. |
14
+ | `memory_claude_bridge_sync` | | `direction`*: string | Sync memory state to/from Claude Code's native MEMORY.md file. |
15
+ | `memory_commit_lookup` | | `sha`*: string | Look up the agent session(s) that produced a specific git commit, given its SHA. Returns the commit metadata and linked sessions. |
16
+ | `memory_commits` | | `branch`: string, `repo`: string, `limit`: number | List recent commits linked to agent sessions, optionally filtered by branch or repo. |
17
+ | `memory_compress_file` | | `filePath`*: string | Compress a markdown file to reduce token usage while preserving headings, URLs, and code blocks. Creates a .original.md backup before writing. |
18
+ | `memory_consolidate` | yes | `tier`: string | Run the 4-tier memory consolidation pipeline (working -> episodic -> semantic -> procedural). |
19
+ | `memory_crystallize` | | `actionIds`*: string, `project`: string, `sessionId`: string | Compress completed action chains into compact crystal digests using LLM summarization. Extracts narrative, key outcomes, files affected, and lessons. |
20
+ | `memory_diagnose` | yes | `categories`: string | Run health checks across all subsystems (actions, leases, sentinels, sketches, signals, sessions, memories, mesh). Identifies stuck, orphaned, and inconsistent state. |
21
+ | `memory_export` | | none | Export all memory data as JSON. |
22
+ | `memory_facet_query` | | `matchAll`: string, `matchAny`: string, `targetType`: string | Query targets by facet tags with AND/OR logic. Find all actions tagged priority:urgent AND team:backend. |
23
+ | `memory_facet_tag` | | `targetId`*: string, `targetType`*: string, `dimension`*: string, `value`*: string | Attach a structured tag (dimension:value) to an action, memory, or observation for multi-dimensional categorization. |
24
+ | `memory_file_history` | | `files`*: string, `sessionId`: string | Get past observations about specific files. |
25
+ | `memory_frontier` | | `project`: string, `agentId`: string, `limit`: number | Get all unblocked actions ranked by priority and urgency. Returns the frontier of actionable work with no unsatisfied dependencies. |
26
+ | `memory_governance_delete` | | `memoryIds`*: string, `reason`: string | Delete specific memories with audit trail. |
27
+ | `memory_graph_query` | | `startNodeId`: string, `nodeType`: string, `maxDepth`: number, `query`: string | Query the knowledge graph for entities and relationships. |
28
+ | `memory_heal` | | `categories`: string, `dryRun`: string | Auto-fix all fixable issues found by diagnostics. Unblocks stuck actions, expires stale leases, cleans up orphaned data. |
29
+ | `memory_insight_list` | | `project`: string, `minConfidence`: number, `limit`: number | List synthesized insights, higher-order observations derived from patterns across memories, lessons, and crystals. |
30
+ | `memory_lease` | | `actionId`*: string, `agentId`*: string, `operation`*: string, `result`: string, `ttlMs`: number | Acquire, release, or renew an exclusive lease on an action. Prevents multiple agents from working on the same thing. |
31
+ | `memory_lesson_recall` | | `query`*: string, `project`: string, `minConfidence`: number, `limit`: number | Search lessons by query. Returns lessons sorted by confidence and recency. Use to check what the agent has learned before making decisions. |
32
+ | `memory_lesson_save` | yes | `content`*: string, `context`: string, `confidence`: number, `project`: string, `tags`: string | Save a lesson learned from this session. Lessons have confidence scores that strengthen when reinforced and decay when not used. Duplicate content auto-strengthens the existing lesson. |
33
+ | `memory_mesh_sync` | | `peerId`: string, `direction`: string | Sync memories and actions with peer agentmemory instances for multi-agent collaboration. |
34
+ | `memory_next` | | `project`: string, `agentId`: string | Get the single most important next action to work on. Combines dependency resolution, priority, and recency into a score. |
35
+ | `memory_obsidian_export` | | `vaultDir`: string, `types`: string | Export memories, lessons, and crystals as Obsidian-compatible Markdown files with YAML frontmatter and wikilinks for graph view. |
36
+ | `memory_patterns` | | `project`: string | Detect recurring patterns across sessions. |
37
+ | `memory_profile` | | `project`*: string, `refresh`: string | User/project profile with top concepts and file patterns. |
38
+ | `memory_recall` | yes | `query`*: string, `limit`: number, `format`: string, `token_budget`: number | Search past session observations for relevant context. Use when you need to recall what happened in previous sessions, find past decisions, or look up how a file was modified before. |
39
+ | `memory_reflect` | yes | `project`: string, `maxClusters`: number | Traverse the knowledge graph, group related memories by concept clusters, and synthesize higher-order insights via LLM. Returns new and reinforced insights. |
40
+ | `memory_relations` | | `memoryId`*: string, `maxHops`: number, `minConfidence`: number | Query the memory relationship graph. |
41
+ | `memory_routine_run` | | `routineId`*: string, `project`: string, `initiatedBy`: string | Instantiate a frozen workflow routine, creating actions for each step with proper dependencies. |
42
+ | `memory_save` | yes | `content`*: string, `type`: string, `concepts`: string, `files`: string, `project`: string | Explicitly save an important insight, decision, or pattern to long-term memory. |
43
+ | `memory_sentinel_create` | | `name`*: string, `type`*: string, `config`: string, `linkedActionIds`: string, `expiresInMs`: number | Create an event-driven sentinel that watches for conditions (webhook, timer, threshold, pattern, approval) and auto-unblocks gated actions when triggered. |
44
+ | `memory_sentinel_trigger` | | `sentinelId`*: string, `result`: string | Externally fire a sentinel, providing an optional result payload. Unblocks any gated actions. |
45
+ | `memory_sessions` | yes | none | List recent sessions with their status and observation counts. |
46
+ | `memory_signal_read` | | `agentId`*: string, `unreadOnly`: string, `threadId`: string, `limit`: number | Read messages for an agent. Marks delivered messages as read. |
47
+ | `memory_signal_send` | | `from`*: string, `to`: string, `content`*: string, `type`: string, `replyTo`: string | Send a message to another agent or broadcast. Supports threading, typed messages, and TTL expiration. |
48
+ | `memory_sketch_create` | | `title`*: string, `description`: string, `expiresInMs`: number, `project`: string | Create an ephemeral action graph for exploratory work. Auto-expires after TTL. Can be promoted to permanent actions or discarded. |
49
+ | `memory_sketch_promote` | | `sketchId`*: string, `project`: string | Promote a sketch's ephemeral actions to permanent actions. Makes the exploratory work official. |
50
+ | `memory_slot_append` | | `label`*: string, `text`*: string | Append text to an existing slot. Fails with 413 if the append would exceed the slot's sizeLimit, agent must compact via memory_slot_replace first. |
51
+ | `memory_slot_create` | | `label`*: string, `content`: string, `sizeLimit`: number, `description`: string, `pinned`: string, `scope`: string | Create a new slot. Reject if a slot with the same label already exists. |
52
+ | `memory_slot_delete` | | `label`*: string | Delete a slot. Seeded default slots can be deleted unless marked readOnly. |
53
+ | `memory_slot_get` | | `label`*: string | Read a single slot by label. |
54
+ | `memory_slot_list` | | none | List all memory slots (pinned + project + global). Slots are editable, size-limited memory units the agent can read and modify across sessions. |
55
+ | `memory_slot_replace` | | `label`*: string, `content`*: string | Replace slot content in place. Fails if content exceeds sizeLimit. |
56
+ | `memory_smart_search` | yes | `query`*: string, `expandIds`: string, `limit`: number | Hybrid semantic+keyword search with progressive disclosure. |
57
+ | `memory_snapshot_create` | | `message`: string | Create a git-versioned snapshot of current memory state. |
58
+ | `memory_team_feed` | | `limit`: number | Get recent shared items from all team members. |
59
+ | `memory_team_share` | | `itemId`*: string, `itemType`*: string | Share a memory or observation with team members. |
60
+ | `memory_timeline` | | `anchor`*: string, `project`: string, `before`: number, `after`: number | Chronological observations around an anchor point. |
61
+ | `memory_verify` | | `id`*: string | Verify a memory or observation by tracing its citation chain back to source observations and session context. Returns provenance information including confidence scores. |
62
+ | `memory_vision_search` | | `queryText`: string, `queryImageRef`: string, `queryImageBase64`: string, `topK`: number, `sessionId`: string | Cross-modal image search via CLIP embeddings. Pass queryText to find screenshots matching a description, or queryImageBase64/queryImageRef to find similar images. Requires AGENTMEMORY_IMAGE_EMBEDDINGS=true. |
63
+
64
+ `*` marks required parameters.
65
+ <!-- AUTOGEN:tools END -->
@@ -0,0 +1,39 @@
1
+ ---
2
+ name: agentmemory-mcp-tools
3
+ description: Map of every agentmemory MCP tool, what each does, and its parameters. Use when choosing which memory tool to call, when a tool name or argument is unclear, or when answering what agentmemory can do via MCP.
4
+ user-invocable: false
5
+ ---
6
+
7
+ agentmemory exposes its full capability set as MCP tools. This skill is the index: it tells you which tool to reach for and where to find exact parameters.
8
+
9
+ ## Quick start
10
+
11
+ Save then recall:
12
+
13
+ 1. `memory_save` with `content` (the insight), `concepts` (comma-separated keywords), `files` (comma-separated paths).
14
+ 2. `memory_smart_search` with `query` and `limit` to retrieve it later. This runs hybrid BM25 plus vector plus graph-expanded search.
15
+
16
+ ## Tool families
17
+
18
+ - Capture: `memory_save`, `memory_observe` flows, `memory_compress_file`.
19
+ - Retrieve: `memory_smart_search`, `memory_recall`, `memory_file_history`, `memory_timeline`, `memory_vision_search`.
20
+ - Sessions and commits: `memory_sessions`, `memory_commits`, `memory_commit_lookup`.
21
+ - Knowledge and graph: `memory_lesson_save`, `memory_lesson_recall`, `memory_graph_query`, `memory_relations`, `memory_patterns`, `memory_crystallize`.
22
+ - Structured slots: `memory_slot_create`, `memory_slot_append`, `memory_slot_get`, `memory_slot_list`, `memory_slot_replace`, `memory_slot_delete`.
23
+ - Governance and health: `memory_governance_delete`, `memory_audit`, `memory_verify`, `memory_heal`, `memory_diagnose`.
24
+
25
+ ## Workflow
26
+
27
+ 1. Pick the narrowest tool for the task. Prefer `memory_smart_search` for open recall, `memory_recall` when you already have a focused query, `memory_sessions` for session listings.
28
+ 2. Look up exact parameter names and which are required in REFERENCE.md before calling.
29
+ 3. Pass only documented fields. REST handlers whitelist fields and drop unknown ones.
30
+
31
+ ## See also
32
+
33
+ - agentmemory-rest-api for the HTTP equivalents.
34
+ - agentmemory-config for tool-visibility and feature flags.
35
+ - The user-invocable action skills (remember, recall, recap, handoff, forget) wrap the most common tools.
36
+
37
+ ## Reference
38
+
39
+ Full tool table with parameters and the core-set marking lives in REFERENCE.md, generated from source so it never drifts.
@@ -0,0 +1,129 @@
1
+ # agentmemory REST API reference
2
+
3
+ Generated from `src/triggers/api.ts`. Do not edit the block below by hand; run `npm run skills:gen` after changing the registered endpoints.
4
+
5
+ <!-- AUTOGEN:rest START - generated by scripts/skills/generate.ts, do not edit by hand -->
6
+ The REST API is the primary surface. All paths are under `http://localhost:3111` (override with `--port`). When `AGENTMEMORY_SECRET` is set, send `Authorization: Bearer $AGENTMEMORY_SECRET`; localhost is otherwise open.
7
+
8
+ 117 registered endpoints:
9
+
10
+ | Method | Path |
11
+ | --- | --- |
12
+ | POST | `/agentmemory/actions` |
13
+ | POST | `/agentmemory/actions/edges` |
14
+ | GET | `/agentmemory/actions/get` |
15
+ | POST | `/agentmemory/actions/update` |
16
+ | GET | `/agentmemory/audit` |
17
+ | POST | `/agentmemory/auto-forget` |
18
+ | GET | `/agentmemory/branch/detect` |
19
+ | GET | `/agentmemory/branch/sessions` |
20
+ | GET | `/agentmemory/branch/worktrees` |
21
+ | POST | `/agentmemory/cascade-update` |
22
+ | POST | `/agentmemory/checkpoints` |
23
+ | POST | `/agentmemory/checkpoints/resolve` |
24
+ | GET | `/agentmemory/claude-bridge/read` |
25
+ | POST | `/agentmemory/claude-bridge/sync` |
26
+ | GET | `/agentmemory/commits` |
27
+ | POST | `/agentmemory/compress-file` |
28
+ | GET | `/agentmemory/config/flags` |
29
+ | POST | `/agentmemory/consolidate` |
30
+ | POST | `/agentmemory/consolidate-pipeline` |
31
+ | POST | `/agentmemory/context` |
32
+ | GET | `/agentmemory/crystals` |
33
+ | POST | `/agentmemory/crystals/auto` |
34
+ | POST | `/agentmemory/crystals/create` |
35
+ | POST | `/agentmemory/diagnostics` |
36
+ | GET | `/agentmemory/diagnostics/followup` |
37
+ | POST | `/agentmemory/diagnostics/heal` |
38
+ | POST | `/agentmemory/enrich` |
39
+ | POST | `/agentmemory/evict` |
40
+ | POST | `/agentmemory/evolve` |
41
+ | GET | `/agentmemory/export` |
42
+ | POST | `/agentmemory/facets` |
43
+ | POST | `/agentmemory/facets/query` |
44
+ | POST | `/agentmemory/facets/remove` |
45
+ | GET | `/agentmemory/facets/stats` |
46
+ | POST | `/agentmemory/file-context` |
47
+ | POST | `/agentmemory/flow/compress` |
48
+ | POST | `/agentmemory/forget` |
49
+ | GET | `/agentmemory/frontier` |
50
+ | POST | `/agentmemory/generate-rules` |
51
+ | POST | `/agentmemory/governance/bulk-delete` |
52
+ | DELETE | `/agentmemory/governance/memories` |
53
+ | POST | `/agentmemory/graph/build` |
54
+ | POST | `/agentmemory/graph/extract` |
55
+ | POST | `/agentmemory/graph/query` |
56
+ | POST | `/agentmemory/graph/reset` |
57
+ | POST | `/agentmemory/graph/snapshot-rebuild` |
58
+ | GET | `/agentmemory/graph/stats` |
59
+ | GET | `/agentmemory/health` |
60
+ | POST | `/agentmemory/import` |
61
+ | GET | `/agentmemory/insights` |
62
+ | POST | `/agentmemory/insights/search` |
63
+ | POST | `/agentmemory/leases/acquire` |
64
+ | POST | `/agentmemory/leases/release` |
65
+ | POST | `/agentmemory/leases/renew` |
66
+ | POST | `/agentmemory/lessons` |
67
+ | POST | `/agentmemory/lessons/search` |
68
+ | POST | `/agentmemory/lessons/strengthen` |
69
+ | GET | `/agentmemory/livez` |
70
+ | GET | `/agentmemory/memories` |
71
+ | GET | `/agentmemory/memories/:id` |
72
+ | GET | `/agentmemory/mesh/export` |
73
+ | POST | `/agentmemory/mesh/peers` |
74
+ | POST | `/agentmemory/mesh/receive` |
75
+ | POST | `/agentmemory/mesh/sync` |
76
+ | POST | `/agentmemory/migrate` |
77
+ | GET | `/agentmemory/next` |
78
+ | GET | `/agentmemory/observations` |
79
+ | POST | `/agentmemory/observe` |
80
+ | POST | `/agentmemory/obsidian/export` |
81
+ | POST | `/agentmemory/patterns` |
82
+ | GET | `/agentmemory/procedural` |
83
+ | GET | `/agentmemory/profile` |
84
+ | POST | `/agentmemory/reflect` |
85
+ | POST | `/agentmemory/relations` |
86
+ | POST | `/agentmemory/remember` |
87
+ | POST | `/agentmemory/replay/import-jsonl` |
88
+ | GET | `/agentmemory/replay/load` |
89
+ | GET | `/agentmemory/replay/sessions` |
90
+ | POST | `/agentmemory/routines` |
91
+ | POST | `/agentmemory/routines/run` |
92
+ | GET | `/agentmemory/routines/status` |
93
+ | POST | `/agentmemory/search` |
94
+ | GET | `/agentmemory/semantic` |
95
+ | POST | `/agentmemory/sentinels` |
96
+ | POST | `/agentmemory/sentinels/cancel` |
97
+ | POST | `/agentmemory/sentinels/check` |
98
+ | POST | `/agentmemory/sentinels/trigger` |
99
+ | GET | `/agentmemory/session/by-commit` |
100
+ | POST | `/agentmemory/session/commit` |
101
+ | POST | `/agentmemory/session/end` |
102
+ | POST | `/agentmemory/session/start` |
103
+ | GET | `/agentmemory/sessions` |
104
+ | GET | `/agentmemory/signals` |
105
+ | POST | `/agentmemory/signals/send` |
106
+ | POST | `/agentmemory/sketches` |
107
+ | POST | `/agentmemory/sketches/add` |
108
+ | POST | `/agentmemory/sketches/discard` |
109
+ | POST | `/agentmemory/sketches/gc` |
110
+ | POST | `/agentmemory/sketches/promote` |
111
+ | GET | `/agentmemory/slot` |
112
+ | POST | `/agentmemory/slot/append` |
113
+ | POST | `/agentmemory/slot/reflect` |
114
+ | POST | `/agentmemory/slot/replace` |
115
+ | GET | `/agentmemory/slots` |
116
+ | POST | `/agentmemory/smart-search` |
117
+ | POST | `/agentmemory/snapshot/create` |
118
+ | POST | `/agentmemory/snapshot/restore` |
119
+ | GET | `/agentmemory/snapshots` |
120
+ | POST | `/agentmemory/summarize` |
121
+ | GET | `/agentmemory/team/feed` |
122
+ | GET | `/agentmemory/team/profile` |
123
+ | POST | `/agentmemory/team/share` |
124
+ | POST | `/agentmemory/timeline` |
125
+ | POST | `/agentmemory/verify` |
126
+ | GET | `/agentmemory/viewer` |
127
+ | POST | `/agentmemory/vision-embed` |
128
+ | POST | `/agentmemory/vision-search` |
129
+ <!-- AUTOGEN:rest END -->
@@ -0,0 +1,43 @@
1
+ ---
2
+ name: agentmemory-rest-api
3
+ description: The agentmemory HTTP REST API surface, the primary protocol for talking to the memory server. Use when calling agentmemory over HTTP, when MCP is unavailable and you need a fallback, or when integrating a host that does not speak MCP.
4
+ user-invocable: false
5
+ ---
6
+
7
+ REST is agentmemory's primary surface. MCP is a bridge on top of it. Every memory operation has an HTTP endpoint under `http://localhost:3111/agentmemory/*`.
8
+
9
+ ## Quick start
10
+
11
+ ```bash
12
+ # liveness
13
+ curl -fsS http://localhost:3111/agentmemory/livez
14
+
15
+ # save
16
+ curl -X POST http://localhost:3111/agentmemory/remember \
17
+ -H "Content-Type: application/json" \
18
+ -d '{"content":"chose JWT refresh rotation","concepts":["jwt-refresh-rotation"]}'
19
+
20
+ # recall
21
+ curl -X POST http://localhost:3111/agentmemory/smart-search \
22
+ -H "Content-Type: application/json" \
23
+ -d '{"query":"auth token strategy","limit":5}'
24
+ ```
25
+
26
+ ## Auth
27
+
28
+ By default localhost is open and no auth is needed. When `AGENTMEMORY_SECRET` is set, every request needs `Authorization: Bearer $AGENTMEMORY_SECRET`. See agentmemory-config.
29
+
30
+ ## Conventions
31
+
32
+ - Save returns `201`, reads return `200`, validation errors return `400`.
33
+ - Handlers whitelist body fields and drop unknown ones, so passing extra keys is safe but ignored.
34
+ - The port is configurable with `--port` or `--instance`; streams, viewer, and engine derive from it.
35
+
36
+ ## See also
37
+
38
+ - agentmemory-mcp-tools for the MCP equivalents.
39
+ - agentmemory-config for the port quartet and the secret.
40
+
41
+ ## Reference
42
+
43
+ The full endpoint list with methods lives in REFERENCE.md, generated from `src/triggers/api.ts`.
@@ -0,0 +1,71 @@
1
+ # commit-context worked examples
2
+
3
+ ## 1. Line range with a linked session
4
+
5
+ User: "Why is this retry loop here?" (pointing at lines 40-52 of refresh.ts)
6
+
7
+ Find the SHA:
8
+
9
+ ```bash
10
+ git blame -L 40,52 src/auth/refresh.ts
11
+ # 9a1b2c3d (dev 2026-06-07) ... retry on revoked token
12
+ ```
13
+
14
+ Look it up:
15
+
16
+ ```json
17
+ memory_commit_lookup { "sha": "9a1b2c3d4e5f60718293a4b5c6d7e8f901234567" }
18
+ ```
19
+
20
+ Response:
21
+
22
+ ```json
23
+ {
24
+ "commit": { "sha": "9a1b2c3d...", "short": "9a1b2c3", "branch": "main",
25
+ "author": "dev", "message": "rotate refresh tokens" },
26
+ "sessions": [ { "id": "7f3a9c21", "project": "app", "observationCount": 14,
27
+ "summary": "Reworked refresh rotation" } ]
28
+ }
29
+ ```
30
+
31
+ Present:
32
+
33
+ > `9a1b2c3` on `main` by dev: "rotate refresh tokens". Linked to session
34
+ > `7f3a9c2` "Auth refresh rework" (14 obs). The retry loop handles a token
35
+ > revoked mid-flight, per the session's high-importance observations.
36
+
37
+ ## 2. Function lookup, commit predates linking
38
+
39
+ User: "What was the agent doing when it wrote validateScope?"
40
+
41
+ ```bash
42
+ git log -L :validateScope:src/auth/scope.ts -n 1
43
+ # 1122aabb ...
44
+ ```
45
+
46
+ ```json
47
+ memory_commit_lookup { "sha": "1122aabbccddeeff00112233445566778899aabb" }
48
+ ```
49
+
50
+ Response:
51
+
52
+ ```json
53
+ { "commit": null }
54
+ ```
55
+
56
+ Present:
57
+
58
+ > `1122aab` predates agent session linking, so there is no recorded session.
59
+ > From `git show`: it added `validateScope` to enforce per-token scopes. I can
60
+ > show the full diff if useful.
61
+
62
+ ## 3. Bare path
63
+
64
+ User: "Give me context on src/middleware/limit.ts."
65
+
66
+ ```bash
67
+ git log -n 1 -- src/middleware/limit.ts
68
+ ```
69
+
70
+ Take the SHA, run `memory_commit_lookup`, present commit plus linked session in
71
+ the same shape as example 1.
@@ -0,0 +1,64 @@
1
+ ---
2
+ name: commit-context
3
+ description: Trace a file, function, or line back to the agent session that produced its current commit. Use when the user asks "why is this code here", "what was the agent doing when this changed", "who wrote this", or wants context on a specific location in the codebase.
4
+ argument-hint: "[file, function, or line]"
5
+ user-invocable: true
6
+ ---
7
+
8
+ The user wants commit context for: $ARGUMENTS
9
+
10
+ ## Quick start
11
+
12
+ ```bash
13
+ git blame -L 40,52 src/auth/refresh.ts # -> SHA 9a1b2c3d
14
+ ```
15
+
16
+ ```json
17
+ memory_commit_lookup { "sha": "9a1b2c3d4e5f60718293a4b5c6d7e8f901234567" }
18
+ ```
19
+
20
+ Expected output:
21
+
22
+ ```text
23
+ 9a1b2c3 on main by dev: "rotate refresh tokens"
24
+ Linked session 7f3a9c2 "Auth refresh rework", 14 obs.
25
+ ```
26
+
27
+ ## Why
28
+
29
+ Report only what git and the lookup return. When the lookup gives `commit: null`,
30
+ the commit predates session linking; do not invent intent.
31
+
32
+ ## Workflow
33
+
34
+ 1. Find the SHA: `git blame -L <start>,<end> <file>` for a line range;
35
+ `git log -L :<function>:<file>` for a function; `git log -n 1 -- <file>` for a
36
+ bare path.
37
+ 2. Look it up: `memory_commit_lookup { "sha": "<full-sha>" }`.
38
+ 3. Present the commit (sha, short sha, branch, author, message), the linked
39
+ session(s) (id, project, started/ended, observation count, summary), and the
40
+ importance >= 7 observations via `memory_recall` when available.
41
+
42
+ ## Anti-patterns
43
+
44
+ WRONG: lookup returns `{ "commit": null }`, you narrate "the agent was
45
+ refactoring auth" from the diff alone.
46
+
47
+ RIGHT: "This commit predates session linking, so there is no recorded agent
48
+ session. From `git show`: it changed token rotation in refresh.ts."
49
+
50
+ ## Checklist
51
+
52
+ - SHA came from git blame/log, not a guess.
53
+ - `commit: null` reported as "predates linking", no fabricated session.
54
+ - Session details quote the lookup response verbatim.
55
+ - No intent claimed beyond what observations state.
56
+
57
+ ## See also
58
+
59
+ - `commit-history`: list many agent-linked commits at once.
60
+ - `recall`: dig deeper into the linked session's observations.
61
+
62
+ ## Troubleshooting
63
+
64
+ See ../_shared/TROUBLESHOOTING.md if `memory_commit_lookup` is not available.
@@ -0,0 +1,71 @@
1
+ # commit-history worked examples
2
+
3
+ ## 1. Branch filter
4
+
5
+ User: "Show agent commits on main."
6
+
7
+ Invocation:
8
+
9
+ ```json
10
+ memory_commits { "branch": "main", "limit": 100 }
11
+ ```
12
+
13
+ Response:
14
+
15
+ ```json
16
+ {
17
+ "commits": [
18
+ { "short": "9a1b2c3", "branch": "main", "authoredAt": "2026-06-07T09:12:00Z",
19
+ "message": "rotate refresh tokens", "sessionIds": ["7f3a9c21"],
20
+ "observationCount": 14, "files": 3 },
21
+ { "short": "b21d004", "branch": "main", "authoredAt": "2026-06-05T14:40:00Z",
22
+ "message": "rate limiter audit", "sessionIds": ["b21d004e"],
23
+ "observationCount": 9, "files": 1 }
24
+ ]
25
+ }
26
+ ```
27
+
28
+ Present:
29
+
30
+ > - `9a1b2c3` main 2026-06-07 "rotate refresh tokens", session `7f3a9c2` (14 obs, 3 files)
31
+ > - `b21d004` main 2026-06-05 "rate limiter audit", session `b21d004` (9 obs, 1 file)
32
+
33
+ ## 2. Bare number as limit
34
+
35
+ User: "commit-history 5"
36
+
37
+ Treat `5` as the limit:
38
+
39
+ ```json
40
+ memory_commits { "limit": 5 }
41
+ ```
42
+
43
+ Render the five newest linked commits in the same format.
44
+
45
+ ## 3. Empty result
46
+
47
+ User: "Show agent commits on release-2.0."
48
+
49
+ ```json
50
+ memory_commits { "branch": "release-2.0", "limit": 100 }
51
+ ```
52
+
53
+ Response:
54
+
55
+ ```json
56
+ { "commits": [] }
57
+ ```
58
+
59
+ Present:
60
+
61
+ > No agent-linked commits on `release-2.0`. Drop the branch filter to see all
62
+ > linked commits, or try a different branch.
63
+
64
+ REST fallback for this same call, with encoding:
65
+
66
+ ```http
67
+ GET /agentmemory/commits?branch=release-2.0&limit=100
68
+ ```
69
+
70
+ Build it with `URLSearchParams` so a branch like `feat/a&b` becomes
71
+ `feat%2Fa%26b` rather than breaking the query.