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,62 @@
1
+ ---
2
+ name: commit-history
3
+ description: List recent git commits linked to agent sessions, optionally filtered by branch or repo. Use when the user asks "show agent commits", "what has the agent shipped", "list linked commits", or wants commits with their session context.
4
+ argument-hint: "[branch=... repo=... limit=...]"
5
+ user-invocable: true
6
+ ---
7
+
8
+ The user wants a list of agent-linked commits. Filter args: $ARGUMENTS
9
+
10
+ ## Quick start
11
+
12
+ ```json
13
+ memory_commits { "branch": "main", "limit": 20 }
14
+ ```
15
+
16
+ Expected output:
17
+
18
+ ```text
19
+ 9a1b2c3 main 2026-06-07 "rotate refresh tokens" · session 7f3a9c2 (14 obs)
20
+ b21d004 main 2026-06-05 "rate limiter audit" · session b21d004 (9 obs)
21
+ ```
22
+
23
+ ## Why
24
+
25
+ Render only the commits the tool returned, newest first. An empty result means
26
+ the filter matched nothing, not that work is missing.
27
+
28
+ ## Workflow
29
+
30
+ 1. Parse `$ARGUMENTS` for `branch=<name>`, `repo=<url-or-fragment>`,
31
+ `limit=<n>`. A bare numeric token is the limit. Defaults: no branch, no repo,
32
+ limit 100, max 500.
33
+ 2. Call `memory_commits` with the parsed filters.
34
+ 3. Render reverse-chronologically: short sha, branch, authored timestamp, first
35
+ line of the message, linked session id(s) (first 8) with observation counts,
36
+ and file count when `files` is present.
37
+ 4. Empty result: tell the user the filter matched nothing and suggest dropping
38
+ the branch or repo filter.
39
+
40
+ ## Anti-patterns
41
+
42
+ WRONG (REST fallback): concatenate `?branch=` + raw branch name, so a name with
43
+ `?`, `&`, or `#` corrupts the query string.
44
+
45
+ RIGHT: URL-encode every value with `URLSearchParams`/`encodeURIComponent` before
46
+ appending to `GET /agentmemory/commits`.
47
+
48
+ ## Checklist
49
+
50
+ - Filters parsed; bare number treated as limit; limit capped at 500.
51
+ - Output is reverse-chronological.
52
+ - Session ids and observation counts come straight from the response.
53
+ - REST fallback URL-encodes branch, repo, and limit.
54
+
55
+ ## See also
56
+
57
+ - `commit-context`: drill into one commit's session.
58
+ - `recall`: search the observations behind a linked session.
59
+
60
+ ## Troubleshooting
61
+
62
+ See ../_shared/TROUBLESHOOTING.md if `memory_commits` is not available.
@@ -0,0 +1,75 @@
1
+ # forget worked examples
2
+
3
+ ## 1. Delete a leaked secret
4
+
5
+ User: "Forget that note where I pasted the API key."
6
+
7
+ Search:
8
+
9
+ ```json
10
+ memory_smart_search { "query": "api key", "limit": 20 }
11
+ ```
12
+
13
+ Response:
14
+
15
+ ```json
16
+ {
17
+ "results": [
18
+ { "id": "abc12345", "sessionId": "7f3a9c21", "title": "Pasted staging API key",
19
+ "narrative": "STAGING_KEY=sk-live-..." }
20
+ ]
21
+ }
22
+ ```
23
+
24
+ Present and gate:
25
+
26
+ > Found 1 match:
27
+ > - `abc12345` (session `7f3a9c2`) "Pasted staging API key"
28
+ >
29
+ > Delete this memory? (yes/no)
30
+
31
+ After the user says yes:
32
+
33
+ ```json
34
+ memory_governance_delete { "memoryIds": ["abc12345"], "reason": "user privacy request" }
35
+ ```
36
+
37
+ Response:
38
+
39
+ ```json
40
+ { "deleted": 1 }
41
+ ```
42
+
43
+ Present:
44
+
45
+ > Deleted 1 memory (`abc12345`).
46
+
47
+ ## 2. Drop a whole session's observations
48
+
49
+ User: "Delete everything from the throwaway spike session."
50
+
51
+ Search, identify the session, then collect every memory id in it:
52
+
53
+ ```json
54
+ memory_smart_search { "query": "spike prototype throwaway", "limit": 20 }
55
+ ```
56
+
57
+ Response has 4 results all with `sessionId: c98f1100`. Show all four, get a yes,
58
+ then pass every id:
59
+
60
+ ```json
61
+ memory_governance_delete {
62
+ "memoryIds": ["m1", "m2", "m3", "m4"],
63
+ "reason": "drop throwaway spike session"
64
+ }
65
+ ```
66
+
67
+ Never send `{ "sessionId": "c98f1100" }`; the MCP deletes by memory id only.
68
+
69
+ ## 3. User declines
70
+
71
+ User: "Actually, on second thought, keep them."
72
+
73
+ Do not call delete. Confirm:
74
+
75
+ > Understood, nothing deleted. The 4 memories from session `c98f110` are intact.
@@ -0,0 +1,66 @@
1
+ ---
2
+ name: forget
3
+ description: Delete specific observations from agentmemory after showing them and getting explicit confirmation. Use when the user says "forget this", "delete memory", "remove that note", or wants to scrub specific data for privacy.
4
+ argument-hint: "[what to forget - session ID, file path, or search term]"
5
+ user-invocable: true
6
+ ---
7
+
8
+ The user wants to remove data from agentmemory: $ARGUMENTS
9
+
10
+ ## Quick start
11
+
12
+ ```json
13
+ memory_smart_search { "query": "old api key in config", "limit": 20 }
14
+ ```
15
+
16
+ Show the matches, get a yes, then:
17
+
18
+ ```json
19
+ memory_governance_delete { "memoryIds": ["abc12345", "def67890"], "reason": "user privacy request" }
20
+ ```
21
+
22
+ Expected output:
23
+
24
+ ```text
25
+ Found 2 matching memories. Confirmed. Deleted 2 memories.
26
+ ```
27
+
28
+ ## Why
29
+
30
+ This is destructive and irreversible. Show exactly what will be deleted and get
31
+ an explicit yes before calling delete. Delete by memory ID, never a bare session.
32
+
33
+ ## Workflow
34
+
35
+ 1. Search with `memory_smart_search`, the user's text as `query`, `limit: 20`.
36
+ 2. Show what matched: session ids, memory ids, titles. Ask for explicit
37
+ confirmation. Do not proceed on silence or a vague "sure, whatever".
38
+ 3. On confirmation, call `memory_governance_delete` with `memoryIds` (array or
39
+ comma-separated string) and optional `reason` (default `plugin skill request`).
40
+ 4. To drop a whole session, collect every memory id in that session from the
41
+ search results and pass them all. The MCP does not accept a bare `sessionId`.
42
+ 5. Report the deletion count back.
43
+
44
+ ## Anti-patterns
45
+
46
+ WRONG: search returns matches, you immediately call `memory_governance_delete`
47
+ without showing them or waiting for a yes.
48
+
49
+ RIGHT: list the matches, ask "Delete these 2? (yes/no)", and only delete after
50
+ an explicit yes.
51
+
52
+ ## Checklist
53
+
54
+ - Matches were shown to the user before any delete.
55
+ - An explicit yes was received, not assumed.
56
+ - `memoryIds` holds real ids from the search, never a bare `sessionId`.
57
+ - Final message states the actual count deleted.
58
+
59
+ ## See also
60
+
61
+ - `remember`: the write side; forget is its undo.
62
+ - `recall`: find the exact memory id before deleting.
63
+
64
+ ## Troubleshooting
65
+
66
+ See ../_shared/TROUBLESHOOTING.md if `memory_smart_search` or `memory_governance_delete` is not available.
@@ -0,0 +1,56 @@
1
+ # handoff worked examples
2
+
3
+ ## 1. Resume with an open question
4
+
5
+ User: "Where were we?"
6
+
7
+ Project cwd: `/Users/dev/app`. Invocation:
8
+
9
+ ```json
10
+ memory_sessions { "limit": 20 }
11
+ ```
12
+
13
+ Response:
14
+
15
+ ```json
16
+ {
17
+ "sessions": [
18
+ { "id": "7f3a9c21", "cwd": "/Users/dev/app", "title": "Auth refresh rework",
19
+ "status": "completed", "startedAt": "2026-06-07T09:00:00Z",
20
+ "summary": "Reworked refresh rotation. Open: should logout revoke all device tokens?",
21
+ "concepts": ["jwt-refresh-rotation", "logout"] }
22
+ ]
23
+ }
24
+ ```
25
+
26
+ Pull supporting context:
27
+
28
+ ```json
29
+ memory_recall { "query": "jwt-refresh-rotation logout", "limit": 10 }
30
+ ```
31
+
32
+ Present:
33
+
34
+ > Resuming `7f3a9c2` "Auth refresh rework".
35
+ > **Open question:** should logout revoke all device tokens or just the current one?
36
+ > Touched `auth/refresh.ts`, `auth/logout.ts`. Refresh rotation is done.
37
+ > **Next step:** decide the revoke scope, then finish `auth/logout.ts`.
38
+
39
+ ## 2. Sibling-repo guard
40
+
41
+ Project cwd: `/Users/dev/repo-a`. Sessions include one with `cwd:
42
+ /Users/dev/repo-a-staging`.
43
+
44
+ A raw prefix would match `repo-a-staging`. The boundary check rejects it because
45
+ `/Users/dev/repo-a-staging` does not equal `/Users/dev/repo-a` and does not start
46
+ with `/Users/dev/repo-a/`. Pick the real `repo-a` session instead, or fall back
47
+ to the most recent session overall if none matches.
48
+
49
+ ## 3. Empty session
50
+
51
+ User: "Resume."
52
+
53
+ If the matched session has zero observations:
54
+
55
+ > The most recent session `c98f110` for this project has no recorded
56
+ > observations. Nothing to hand off. Want to start fresh from the current state?
@@ -0,0 +1,68 @@
1
+ ---
2
+ name: handoff
3
+ description: Resume the most recent agent session for the current working directory, leading with any unanswered question. Use when the user says "where were we", "resume", "handoff", "pick up where I left off", or starts a session with no fresh context.
4
+ argument-hint: "[optional cwd override]"
5
+ user-invocable: true
6
+ ---
7
+
8
+ The user wants to resume work. Optional cwd override: $ARGUMENTS
9
+
10
+ ## Quick start
11
+
12
+ ```json
13
+ memory_sessions { "limit": 20 }
14
+ ```
15
+
16
+ Pick the most recent session whose `cwd` matches this project, then:
17
+ `memory_recall { "query": "<session top concepts>", "limit": 10 }`.
18
+
19
+ Expected output:
20
+
21
+ ```text
22
+ Resuming 7f3a9c2 "Auth refresh rework".
23
+ Open question: should logout revoke all device tokens or just the current one?
24
+ Next step: decide revoke scope, then update auth/logout.ts.
25
+ ```
26
+
27
+ ## Why
28
+
29
+ Match the session by directory boundary, not raw prefix, so a sibling repo never
30
+ gets mistaken for this one. Never invent observations for an empty session.
31
+
32
+ ## Workflow
33
+
34
+ 1. Resolve the project path: if `$ARGUMENTS` is given, normalize it to absolute
35
+ (`path.resolve(process.cwd(), $ARGUMENTS)`); else use the cwd.
36
+ 2. Call `memory_sessions`. Pick the most recent session whose normalized `cwd`
37
+ matches by directory boundary: equality, OR `cwd.startsWith(projectPath + sep)`,
38
+ OR `projectPath.startsWith(cwd + sep)`. Prefer `completed` over `abandoned`.
39
+ No match: fall back to the single most recent session overall.
40
+ 3. If the session ended on an unanswered user-facing question, surface it FIRST.
41
+ Look in `summary` or recent `conversation` observations whose `narrative`
42
+ ends in `?`.
43
+ 4. Summarize: title/summary, key files, key decisions or errors, using
44
+ `memory_recall` on the top concepts, limit 10.
45
+ 5. End with one concrete "next step?" pointer.
46
+
47
+ ## Anti-patterns
48
+
49
+ WRONG: `session.cwd.startsWith(projectPath)` matches `/repo-a-staging` when the
50
+ project is `/repo-a`, resuming the wrong repo's session.
51
+
52
+ RIGHT: `session.cwd === projectPath || session.cwd.startsWith(projectPath + sep)`,
53
+ a directory-boundary check that cannot cross sibling repos.
54
+
55
+ ## Checklist
56
+
57
+ - cwd override resolved to an absolute, normalized path.
58
+ - Match used a directory-boundary check, not a raw prefix.
59
+ - Unanswered question (if any) leads the response.
60
+ - Empty session is reported plainly, with an offer to start fresh.
61
+
62
+ ## See also
63
+
64
+ - `recap`, `session-history`, `recall`: same session data, broader views.
65
+
66
+ ## Troubleshooting
67
+
68
+ See ../_shared/TROUBLESHOOTING.md if `memory_sessions` or `memory_recall` is not available.
@@ -0,0 +1,74 @@
1
+ # recall worked examples
2
+
3
+ ## 1. Hit on a past decision
4
+
5
+ User: "Did we ever decide how to cache sessions?"
6
+
7
+ Invocation:
8
+
9
+ ```json
10
+ memory_smart_search { "query": "session caching decision", "limit": 10 }
11
+ ```
12
+
13
+ Response:
14
+
15
+ ```json
16
+ {
17
+ "results": [
18
+ { "sessionId": "7f3a9c21", "type": "decision", "title": "Drop Redis for iii state store",
19
+ "narrative": "We decided to drop Redis and use the iii-engine state store for session caching.",
20
+ "importance": 8 }
21
+ ]
22
+ }
23
+ ```
24
+
25
+ Present:
26
+
27
+ > Yes. In session `7f3a9c21` you decided to drop Redis and use the iii-engine
28
+ > state store for session caching (importance 8).
29
+
30
+ ## 2. Multiple results across sessions
31
+
32
+ User: "Recall anything about the rate limiter."
33
+
34
+ Invocation:
35
+
36
+ ```json
37
+ memory_smart_search { "query": "rate limiter", "limit": 10 }
38
+ ```
39
+
40
+ Response:
41
+
42
+ ```json
43
+ {
44
+ "results": [
45
+ { "sessionId": "b21d004e", "type": "code", "title": "limit.ts counts per-IP",
46
+ "narrative": "Rate limiter counts per-IP, not per-user.", "importance": 6 },
47
+ { "sessionId": "c98f1100", "type": "conversation", "title": "Discussed sliding window",
48
+ "narrative": "Considered a sliding-window limiter, deferred.", "importance": 4 }
49
+ ]
50
+ }
51
+ ```
52
+
53
+ Present them grouped by session, leading with the per-IP code note.
54
+
55
+ ## 3. No results
56
+
57
+ User: "Recall the GraphQL schema migration."
58
+
59
+ Invocation:
60
+
61
+ ```json
62
+ memory_smart_search { "query": "graphql schema migration", "limit": 10 }
63
+ ```
64
+
65
+ Response:
66
+
67
+ ```json
68
+ { "results": [] }
69
+ ```
70
+
71
+ Present:
72
+
73
+ > No memories matched that. Try `schema change`, `graphql`, or `migration` as
74
+ > narrower terms, or `recap this week` to scan recent sessions.
@@ -0,0 +1,60 @@
1
+ ---
2
+ name: recall
3
+ description: Search agentmemory for past observations, sessions, and learnings about a topic using hybrid BM25 plus vector plus graph search. Use when the user says "recall", "what did we do about", "did we ever", "have we seen", or needs context from past sessions.
4
+ argument-hint: "[search query]"
5
+ user-invocable: true
6
+ ---
7
+
8
+ The user wants to recall past context about: $ARGUMENTS
9
+
10
+ ## Quick start
11
+
12
+ ```json
13
+ memory_smart_search { "query": "jwt refresh token rotation", "limit": 10 }
14
+ ```
15
+
16
+ Expected output:
17
+
18
+ ```text
19
+ 2 results across 2 sessions.
20
+ [importance 8] decision · "Rotate refresh tokens on every use" (session 7f3a9c21)
21
+ [importance 5] code · "limit.ts counts per-IP" (session b21d004e)
22
+ ```
23
+
24
+ ## Why
25
+
26
+ Only surface what the tool returned. Never fabricate an observation, a session
27
+ id, or an importance score. If nothing comes back, say so.
28
+
29
+ ## Workflow
30
+
31
+ 1. Call `memory_smart_search` with the user's text as `query` and `limit: 10`.
32
+ Pass `project` when the user scopes to a specific repo.
33
+ 2. Group results by session.
34
+ 3. For each observation show its type, title, and narrative.
35
+ 4. Lead with the high-signal observations (importance >= 7).
36
+ 5. If zero results, suggest 2-3 alternative search terms and stop. Do not guess.
37
+
38
+ ## Anti-patterns
39
+
40
+ WRONG: results are empty, so you write "We probably discussed token expiry last
41
+ week" from assumption.
42
+
43
+ RIGHT: "No memories matched that query. Try `refresh token`, `session expiry`,
44
+ or `auth rotation`."
45
+
46
+ ## Checklist
47
+
48
+ - Every observation shown came from the tool response.
49
+ - Results grouped by session, high-importance first.
50
+ - Empty results trigger alternative-term suggestions, not invention.
51
+ - No session id or score was paraphrased or rounded.
52
+
53
+ ## See also
54
+
55
+ - `remember`: the write side; recall retrieves what it stores.
56
+ - `recap`, `handoff`, `session-history`: session-scoped views of the same data.
57
+
58
+ ## Troubleshooting
59
+
60
+ See ../_shared/TROUBLESHOOTING.md if `memory_smart_search` is not available.
@@ -0,0 +1,60 @@
1
+ # recap worked examples
2
+
3
+ ## 1. This week
4
+
5
+ User: "Recap this week."
6
+
7
+ Window: last 7 days. Invocation:
8
+
9
+ ```json
10
+ memory_sessions { "limit": 30 }
11
+ ```
12
+
13
+ Response (after filtering to cwd and the 7-day window):
14
+
15
+ ```json
16
+ {
17
+ "sessions": [
18
+ { "id": "7f3a9c21", "cwd": "/Users/dev/app", "title": "Auth refresh rework",
19
+ "startedAt": "2026-06-07T09:00:00Z", "observationCount": 14, "status": "completed",
20
+ "concepts": ["jwt-refresh-rotation", "auth-flow"] },
21
+ { "id": "b21d004e", "cwd": "/Users/dev/app", "title": "Rate limiter audit",
22
+ "startedAt": "2026-06-05T14:00:00Z", "observationCount": 9, "status": "completed",
23
+ "concepts": ["rate-limiter", "per-ip-bug"] }
24
+ ]
25
+ }
26
+ ```
27
+
28
+ Per session, pull highlights:
29
+
30
+ ```json
31
+ memory_recall { "query": "jwt-refresh-rotation auth-flow", "limit": 3 }
32
+ ```
33
+
34
+ Present:
35
+
36
+ > **2026-06-07**
37
+ > - `7f3a9c2` Auth refresh rework, 14 obs, completed
38
+ > - [8] Rotate refresh tokens on every use
39
+ >
40
+ > **2026-06-05**
41
+ > - `b21d004e` Rate limiter audit, 9 obs, completed
42
+ > - [7] limit.ts counts per-IP, not per-user
43
+ >
44
+ > 2 sessions across 2 days, 23 observations.
45
+
46
+ ## 2. Bare number
47
+
48
+ User: "recap 3"
49
+
50
+ Treat as `last 3`. Call `memory_sessions { "limit": 3 }`, group by date, same format.
51
+
52
+ ## 3. Empty window
53
+
54
+ User: "Recap today."
55
+
56
+ If `memory_sessions` returns no session whose `startedAt` is today and whose
57
+ `cwd` matches:
58
+
59
+ > No sessions today for this project. The most recent was yesterday, `7f3a9c2`
60
+ > Auth refresh rework. Want a recap of that instead?
@@ -0,0 +1,63 @@
1
+ ---
2
+ name: recap
3
+ description: Summarize the last N agent sessions for the current project, grouped by date, with highlight observations per session. Use when the user asks "recap", "what have we been doing", "today", "this week", or wants a rollup of recent work.
4
+ argument-hint: "[last N | today | this week]"
5
+ user-invocable: true
6
+ ---
7
+
8
+ The user wants a recap. Time window args: $ARGUMENTS
9
+
10
+ ## Quick start
11
+
12
+ ```json
13
+ memory_sessions { "limit": 30 }
14
+ ```
15
+
16
+ Then per surviving session: `memory_recall { "query": "<top concepts>", "limit": 3 }`.
17
+
18
+ Expected output:
19
+
20
+ ```text
21
+ 2026-06-07
22
+ 7f3a9c2 · "Auth refresh rework" · 14 obs · completed
23
+ - [8] Rotate refresh tokens on every use
24
+ 3 sessions across 2 days, 41 observations.
25
+ ```
26
+
27
+ ## Why
28
+
29
+ Only summarize sessions and observations the tools returned. An empty window is
30
+ a real answer, not a prompt to invent activity.
31
+
32
+ ## Workflow
33
+
34
+ 1. Parse `$ARGUMENTS`: `today` = current local date; `this week` = last 7 days;
35
+ `last <n>` or bare numeric = most recent N; empty = `last 10`.
36
+ 2. Call `memory_sessions`, filter to the current project (match `cwd` against the
37
+ working directory), apply the window, sort by `startedAt` descending.
38
+ 3. Group survivors by local calendar date (YYYY-MM-DD).
39
+ 4. Per session list id (first 8), title or first prompt, observation count,
40
+ status. Indent 2-3 highlights (importance >= 7) from `memory_recall`.
41
+ 5. End with "N sessions across M days, K observations."
42
+
43
+ ## Anti-patterns
44
+
45
+ WRONG: window is empty, so you summarize "a productive week of auth work" from
46
+ memory of the conversation.
47
+
48
+ RIGHT: "No sessions in the last 7 days for this project."
49
+
50
+ ## Checklist
51
+
52
+ - Window parsed correctly from the argument.
53
+ - Sessions filtered to the current project's cwd.
54
+ - Highlights come from `memory_recall`, not paraphrase.
55
+ - Totals line reflects the actual counts shown.
56
+
57
+ ## See also
58
+
59
+ - `handoff`, `session-history`, `recall`: same session data, different lens.
60
+
61
+ ## Troubleshooting
62
+
63
+ See ../_shared/TROUBLESHOOTING.md if `memory_sessions` or `memory_recall` is not available.
@@ -0,0 +1,67 @@
1
+ # remember worked examples
2
+
3
+ ## 1. Saving a decision
4
+
5
+ User: "Remember that we decided to drop Redis and use the iii-engine state store for session caching."
6
+
7
+ Invocation:
8
+
9
+ ```json
10
+ memory_save {
11
+ "content": "We decided to drop Redis and use the iii-engine state store for session caching to remove a moving part.",
12
+ "concepts": "session-caching, iii-state-store, dropped-redis",
13
+ "files": ""
14
+ }
15
+ ```
16
+
17
+ Response:
18
+
19
+ ```json
20
+ { "id": "7f3a9c21", "concepts": ["session-caching", "iii-state-store", "dropped-redis"], "saved": true }
21
+ ```
22
+
23
+ Present:
24
+
25
+ > Saved. Tagged it `session-caching`, `iii-state-store`, `dropped-redis`, so a
26
+ > later recall on caching or Redis will surface this decision.
27
+
28
+ ## 2. Saving a code-specific gotcha
29
+
30
+ User: "Save this: the rate limiter in middleware/limit.ts counts per-IP, not per-user, so logged-in users on shared IPs collide."
31
+
32
+ Invocation:
33
+
34
+ ```json
35
+ memory_save {
36
+ "content": "The rate limiter in middleware/limit.ts counts per-IP, not per-user, so logged-in users on shared IPs collide.",
37
+ "concepts": "rate-limiter, per-ip-bug, shared-ip-collision",
38
+ "files": "src/middleware/limit.ts"
39
+ }
40
+ ```
41
+
42
+ Response:
43
+
44
+ ```json
45
+ { "id": "b21d004e", "concepts": ["rate-limiter", "per-ip-bug", "shared-ip-collision"], "saved": true }
46
+ ```
47
+
48
+ Present:
49
+
50
+ > Saved memory `b21d004e` referencing `src/middleware/limit.ts`. Concepts:
51
+ > `rate-limiter`, `per-ip-bug`, `shared-ip-collision`.
52
+
53
+ ## 3. Vague request, no files
54
+
55
+ User: "Remember this for later."
56
+
57
+ Ask once for the substance, then save:
58
+
59
+ ```json
60
+ memory_save {
61
+ "content": "Staging deploys must run the migration job before the app rollout, never after.",
62
+ "concepts": "staging-deploy, migration-ordering, rollout-sequence",
63
+ "files": ""
64
+ }
65
+ ```
66
+
67
+ Present the confirmation with the concepts echoed back.