thoth-agents 0.1.13 → 0.1.16

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.
@@ -9,387 +9,199 @@ metadata:
9
9
  # thoth-mem Agents Skill
10
10
 
11
11
  Use this skill whenever memory work crosses the orchestrator/subagent boundary.
12
- Its job is to prevent silent ownership bugs such as prompt pollution,
13
- implicit `manual-save-{project}` sessions, or subagents writing session-level
14
- artifacts that belong to the orchestrator.
12
+ It prevents prompt pollution, implicit fallback sessions such as
13
+ `manual-save-{project}`, and session-level writes from the wrong agent.
15
14
 
16
15
  ## Shared References
17
16
 
18
- Read these first instead of re-inventing conventions:
17
+ Read these first:
19
18
 
20
19
  - [../_shared/persistence-contract.md](../_shared/persistence-contract.md)
21
20
  - [../_shared/thoth-mem-convention.md](../_shared/thoth-mem-convention.md)
22
21
 
23
- This skill ADDS the orchestrator/subagent split that those files imply. Do not
24
- duplicate their SDD persistence details unless needed to make a decision.
22
+ ## Active MCP Surface
25
23
 
26
- Adapter bindings may differ, but the same semantic ownership boundaries must
27
- hold.
24
+ Use thoth-mem through these MCP tools:
28
25
 
29
- ## Hard Ownership Split
30
-
31
- ### Root/main orchestrator identity
32
-
33
- The current root/main agent owns root/main orchestrator-owned tools and responsibilities
34
- for the session. In harnesses where the initial agent is not named
35
- `orchestrator`, all "orchestrator-only", "root-only", and
36
- "orchestrator-owned" rules still apply to that initial/root agent.
26
+ - `mem_recall` for fused retrieval and search
27
+ - `mem_save` for observations, prompts, session summaries, and passive learnings
28
+ - `mem_context` for recent session/project continuity
29
+ - `mem_get` for full memory content and optional timeline context
30
+ - `mem_project` for project summaries, graph facts, topics, and topic context
31
+ - `mem_session` for root-owned session lifecycle and checkpoints
37
32
 
38
- ### New Root Session Bootstrap
33
+ Admin/export/import/sync/migration/rebuild/index/trace operations are CLI/HTTP/dashboard operations, not MCP tools.
39
34
 
40
- At the start of every new root session, when thoth-mem tools are available, the
41
- root/main orchestrator MUST:
42
-
43
- 1. Load `thoth-mem-agents` and `requirements-interview`.
44
- 2. Call `mem_session_start` with the active project and session identity.
45
- 3. Save the real user prompt with `mem_save_prompt`.
46
-
47
- In prose: call `mem_session_start` before delegation, then save the real user prompt with `mem_save_prompt`.
35
+ ## Hard Ownership Split
48
36
 
49
- Only save real user prompts with `mem_save_prompt`. Never save generated
50
- subagent prompts, internal handoffs, tool scaffolding, summaries, or delegated
51
- task text as user intent.
37
+ ### Root/main orchestrator identity
52
38
 
53
- If thoth-mem tools or required project/session identity are unavailable, state
54
- that memory bootstrap could not run and continue without claiming memory was
55
- saved.
39
+ The initial/root agent in the harness is the orchestrator owner for this
40
+ session, even when the runtime does not label it `orchestrator`.
56
41
 
57
- ### Orchestrator-only tools
42
+ ### Root-only session and prompt ownership
58
43
 
59
- ONLY the root/main orchestrator owns these tools:
44
+ At new root session start, when tools and identity are available, the root:
60
45
 
61
- - `mem_session_start`
62
- - `mem_session_summary`
63
- - `mem_save_prompt`
46
+ 1. Loads `thoth-mem-agents` and `requirements-interview`.
47
+ 2. Calls `mem_session(action="start")` with root session identity.
48
+ 3. Saves real user intent with `mem_save(kind="prompt")`.
64
49
 
65
- Subagents MUST NOT call them.
50
+ Root owns these operations:
66
51
 
67
- If the active harness cannot hard-enforce this ownership split, treat it as
68
- instruction-level governance and disclose that limitation when reporting
69
- memory-governance status. Lack of hard enforcement is not permission for a
70
- subagent to create sessions, close sessions, or save prompts.
52
+ - `mem_session(action="start")`
53
+ - `mem_session(action="checkpoint")` when used for root progress checkpoints
54
+ - `mem_session(action="summary")`
55
+ - `mem_save(kind="prompt")`
56
+ - root-owned session summaries/checkpoints, including `mem_save(kind="session_summary")` when used as the summary carrier
71
57
 
72
- Why:
58
+ Subagents must never start/checkpoint/summarize sessions or save prompts.
73
59
 
74
- - `mem_session_start` defines the session boundary.
75
- - `mem_session_summary` closes or repairs that boundary.
76
- - `mem_save_prompt` is only valid for real user requests, and subagent prompts
77
- are orchestration artifacts, not user intent.
60
+ If tools or required identity are missing, report that bootstrap/compaction
61
+ could not be persisted and continue without claiming memory was saved.
78
62
 
79
- ## Root Memory Protocol
63
+ ## Root Recall and Save Protocol
80
64
 
81
- ### Durable Saves
65
+ ### Durable saves
82
66
 
83
- The root/main orchestrator should call `mem_save` after durable work or
84
- decisions, including:
67
+ Root should persist durable outcomes with `mem_save`:
85
68
 
86
- - architecture, design, or workflow decisions
87
- - accepted or rejected recommendations
88
- - bug fixes with root cause
89
- - non-obvious discoveries, gotchas, or edge cases
90
- - configuration changes or environment setup
91
- - reusable patterns or conventions
92
- - durable user preferences or constraints
69
+ - decisions and architecture constraints
70
+ - bug fixes and root cause
71
+ - non-obvious discoveries and patterns
72
+ - configuration changes
73
+ - durable preferences/constraints
93
74
 
94
- Use stable topic keys for evolving topics. If unsure, call
95
- `mem_suggest_topic_key` before saving. Keep the observation content structured:
75
+ Keep content structured:
96
76
 
97
77
  ```text
98
78
  What: concise description
99
79
  Why: reason or problem solved
100
80
  Where: files, paths, systems, or artifacts
101
- Learned: edge cases, caveats, or follow-up notes
81
+ Learned: caveats or edge cases
102
82
  ```
103
83
 
104
- Do not claim memory was saved unless the tool call succeeded.
105
-
106
- ### Recall
107
-
108
- Broad recovery at root session start or after compaction may use the root-owned
109
- recent-session overview tools when available. For precise retrieval, use
110
- Targeted 3-layer recall:
111
-
112
- 1. `mem_search` with compact results to scan IDs and titles.
113
- 2. `mem_timeline` around promising observation IDs.
114
- 3. `mem_get_observation` only for records needed in full.
115
-
116
- Use preview search only when compact results are insufficient to disambiguate.
117
-
118
- ### Session Close
84
+ ### Recall funnel (canonical)
119
85
 
120
- Before ending the root session, the root/main orchestrator MUST call
121
- `mem_session_summary` when the tool is available. Use a concise summary with:
86
+ 1. `mem_recall(mode="compact")`
87
+ 2. `mem_recall(mode="context")`
88
+ 3. `mem_get(id=...)`
122
89
 
123
- - Goal
124
- - Instructions
125
- - Discoveries
126
- - Accomplished
127
- - Next Steps
128
- - Relevant Files
90
+ Use `mem_get(id=..., include_timeline=true)` when chronology matters.
91
+ Use `mem_context(..., recall_query="...")` only as optional fused context, not
92
+ as a replacement for the recall funnel.
129
93
 
130
- If the summary cannot be saved, disclose that limitation rather than implying
131
- the next session will recover it from memory.
94
+ ### Project navigation
132
95
 
133
- ### After Compaction
96
+ Use `mem_project` for project-level navigation:
134
97
 
135
- After compaction, first preserve the compacted summary with
136
- `mem_session_summary`, then recover recent context and use Targeted 3-layer
137
- recall before continuing. Do not invent missing memory.
98
+ - `action="list"`
99
+ - `action="summary"`
100
+ - `action="graph"`
101
+ - `action="topics"`
102
+ - `action="topic"`
138
103
 
139
- ### Delegation Handoff as Compaction
104
+ ### Session close and compaction
140
105
 
141
- Before delegating after meaningful context changes, the root/main orchestrator
142
- should treat the handoff as a context-compaction boundary. When
143
- `mem_session_summary` and the parent `session_id`/project are available, the
144
- root MUST save or refresh the handoff body as root-owned session summary
145
- context before dispatch.
106
+ Before ending meaningful work, root records continuity with either:
146
107
 
147
- The initial subagent prompt carries task instructions plus recovery
148
- instructions, not the handoff body. Include the parent `session_id`, project,
149
- persistence mode, memory permissions, and bounded 3-layer recall instructions
150
- when memory recall or SDD persistence is delegated. Do not embed the handoff
151
- summary body, raw transcripts, secrets, unrelated context, file dumps, or
152
- generated subagent prompts in the prompt or structured attachments.
108
+ - `mem_session(action="summary")`, or
109
+ - root-owned `mem_save(kind="session_summary")`
153
110
 
154
- If root-owned compaction cannot be persisted because tooling or parent identity
155
- is unavailable, disclose that limitation and continue with explicit task
156
- instructions and local context. Do not ask a subagent to create a fallback
157
- session, call `mem_session_summary`, or save the generated dispatch prompt.
111
+ Before delegation after meaningful context changes, root may refresh a
112
+ checkpoint/summary context using root-owned session tools. Subagent prompts must
113
+ carry recovery instructions, never the raw handoff body.
158
114
 
159
- ### SDD Topic Keys
115
+ ## Project-Scoped Context Rules
160
116
 
161
- SDD artifacts saved to thoth-mem use deterministic topic keys:
162
-
163
- `sdd/{change}/{artifact}`
164
-
165
- Examples: `sdd/add-user-auth/spec`, `sdd/add-user-auth/design`,
166
- `sdd/add-user-auth/tasks`.
167
-
168
- Never reuse the `sdd/...` namespace for general durable observations.
169
-
170
- ## Project-Scoped Read Tools
171
-
172
- These tools are read/context only, not session-owned artifacts:
173
-
174
- - `mem_context`
175
- - `mem_project_summary`
176
- - `mem_project_graph`
177
- - `mem_topic_keys`
178
-
179
- Use them only when the dispatch includes parent `session_id` and `project`,
180
- and only for bounded project/topic context that helps before the usual
181
- 3-layer recall.
117
+ `mem_context` and `mem_project(...)` are bounded context reads, not ownership
118
+ transfers.
182
119
 
183
120
  Rules:
184
121
 
185
- - Treat them as safer alternatives to broad session context for project-scoped
186
- discovery.
187
- - Keep them bounded with project/topic filters and explicit limits.
188
- - Do not use them to create, close, or summarize sessions.
189
- - Do not use them to save prompts or durable observations.
122
+ - Use only with parent `session_id` and `project` when delegated.
123
+ - Keep calls bounded to the task scope.
124
+ - Do not use them to bypass the recall funnel.
125
+ - Do not use them to create session summaries or save prompts.
190
126
 
191
- ## Prompt Saving Rule
192
-
193
- - Never save a subagent prompt.
194
- - Never ask a subagent to save its prompt.
195
- - Treat the subagent prompt as generated execution scaffolding from the
196
- orchestrator.
197
-
198
- If a workflow says “save the prompt for future context,” that applies to the
199
- root user conversation only.
127
+ Operational note: semantic lanes can be pending/degraded; lexical/KG fallback is
128
+ valid and expected. Treat fallback metadata as state, not failure.
200
129
 
201
130
  ## Dispatch Contract
202
131
 
203
- When a subagent is allowed to touch thoth-mem, the orchestrator MUST pass:
132
+ When subagents may use thoth-mem, dispatch MUST include:
204
133
 
205
134
  - parent `session_id`
206
135
  - `project`
207
- - any thoth-mem limits or ownership constraints relevant to the task
208
- - handoff recovery instructions when the task depends on root-owned session
209
- summary context
210
-
211
- If a subagent does NOT receive both `session_id` and `project`, it MUST NOT call
212
- any thoth-mem tool.
136
+ - persistence mode
137
+ - memory permissions (read-only vs delegated write)
138
+ - bounded recall instructions
213
139
 
214
- Reason: thoth-mem can create implicit fallback sessions such as
215
- `manual-save-{project}`. That splits history away from the root workflow.
140
+ Without both `session_id` and `project`, subagents must not call thoth-mem.
216
141
 
217
142
  ## Capability Split by Agent Type
218
143
 
219
144
  ### Read-only subagents
220
145
 
221
- Semantic roles: explorer, librarian, oracle.
146
+ Roles: explorer, librarian, oracle.
222
147
 
223
- Allowed pattern only:
148
+ Allowed:
224
149
 
225
- 1. `mem_search`
226
- 2. `mem_timeline`
227
- 3. `mem_get_observation`
228
- 4. `mem_context` when parent-session context overview is needed
229
- 5. `mem_project_summary` when project overview is needed
230
- 6. `mem_project_graph` when relationship/lineage investigation is needed
231
- 7. `mem_topic_keys` when topic-key discovery or inspection is needed
150
+ - recall funnel: `mem_recall(mode="compact")` -> `mem_recall(mode="context")` -> `mem_get`
151
+ - optional bounded context: `mem_context`, `mem_project`
232
152
 
233
- Rules:
153
+ Not allowed:
234
154
 
235
- - Use the parent `session_id` and `project` from dispatch.
236
- - Use bounded 3-layer recall to recover the parent-session handoff summary
237
- before treating memory as source material.
238
- - Keep 3-layer recall canonical; use `mem_context`, `mem_project_summary`,
239
- `mem_project_graph`, and `mem_topic_keys` only as bounded supplements when
240
- dispatch explicitly allows project-scoped/context reads.
241
- - Report missing, stale, contradictory, or insufficient recalled context.
242
- - Do not call `mem_save`, `mem_update`, `mem_session_start`,
243
- `mem_session_summary`, or `mem_save_prompt`.
244
- - Do not treat `mem_search` output as the artifact body.
245
- - Keep project-scoped read tools bounded by project/topic filters and the task
246
- scope.
155
+ - `mem_save`
156
+ - any root session ownership action (`mem_session(...)`)
157
+ - `mem_save(kind="prompt")`
247
158
 
248
159
  ### Write-capable subagents
249
160
 
250
- Semantic roles: deep, quick, designer.
161
+ Roles: deep, quick, designer.
251
162
 
252
- Allowed thoth-mem behavior:
163
+ Allowed:
253
164
 
254
- - same 3-layer recall as read-only agents when reading
255
- - bounded context tools (`mem_context`, `mem_project_summary`,
256
- `mem_project_graph`, `mem_topic_keys`) when broader parent/project context is
257
- explicitly needed
258
- - `mem_save` for delegated durable observations that arise from their
259
- implementation work
165
+ - same recall funnel as read-only roles
166
+ - optional bounded context via `mem_context`/`mem_project`
167
+ - delegated durable saves via `mem_save(kind="observation")`
168
+ - deterministic SDD artifact saves only when explicitly delegated
260
169
 
261
170
  Rules:
262
171
 
263
- - Use the parent `session_id` and `project` from dispatch on every thoth-mem
264
- call.
265
- - Use bounded 3-layer recall to recover the parent-session handoff summary
266
- before treating memory as source material.
267
- - Keep 3-layer recall canonical; use `mem_context`, `mem_project_summary`,
268
- `mem_project_graph`, and `mem_topic_keys` only as bounded supplements when
269
- dispatch explicitly allows project-scoped/context reads.
270
- - Report missing, stale, contradictory, or insufficient recalled context.
271
- - Never create or close sessions.
272
- - Never save prompts.
273
- - You do not own durable memory of your own. Any `mem_save` is a delegated
274
- write under the orchestrator's session/project, not a subagent-owned
275
- session.
276
- - Save only durable information: decisions, bugfixes, patterns,
277
- configuration changes, discoveries, and explicitly assigned SDD artifacts.
278
- - For SDD apply work, save `apply-progress` or assigned deterministic SDD
279
- artifacts only when explicitly delegated and only under the parent
280
- session/project.
281
-
282
- ## Memory Types and Topic Keys
283
-
284
- Prefer stable, non-colliding topic keys.
285
-
286
- ### General durable observations
172
+ - every thoth-mem call uses parent `session_id` and `project`
173
+ - never start/checkpoint/summarize sessions
174
+ - never save prompts
175
+ - report missing/stale/contradictory/insufficient recall context
287
176
 
288
- Use keys outside the SDD namespace, for example:
177
+ ## Topic-Key Rules
289
178
 
290
- - `decision/thoth-mem/subagent-ownership`
291
- - `bugfix/thoth-mem/prompt-pollution`
292
- - `pattern/thoth-mem/parent-session-dispatch`
293
- - `config/thoth-mem/root-hook`
294
- - `discovery/thoth-mem/manual-save-fallback`
295
-
296
- ### SDD artifacts
297
-
298
- Use the shared deterministic format from the convention files:
179
+ General durable observations must stay outside `sdd/*`.
180
+ SDD artifacts use deterministic keys only:
299
181
 
300
182
  `sdd/{change}/{artifact}`
301
183
 
302
- Never reuse the `sdd/...` namespace for general notes. That causes artifact
303
- collisions and corrupts recovery assumptions.
304
-
305
- ## Orchestrator Checklist
306
-
307
- Before dispatching subagents in a thoth-mem workflow, verify all of this:
308
-
309
- - `mem_session_start` has already run for the root session before any later
310
- `mem_session_summary`.
311
- - The dispatch includes parent `session_id` and `project`.
312
- - The dispatch states whether the subagent may read memory only or may also
313
- `mem_save` delegated observations under the parent session/project, and
314
- whether project-scoped read tools (`mem_project_summary`, `mem_project_graph`,
315
- `mem_topic_keys`) are allowed.
316
- - If a root-owned handoff summary exists, the dispatch includes recovery
317
- instructions but not the summary body.
318
- - The dispatch does NOT ask the subagent to save prompts.
319
- - The dispatch does NOT ask the subagent to write session summaries.
320
- - If the work is SDD-related, the dispatch preserves the shared topic-key rules
321
- and avoids collisions with `sdd/{change}/{artifact}`.
322
- - The dispatch identifies the active binding surface when it matters for tool
323
- names or enforcement. Explicitly note when memory ownership and tool-boundary
324
- controls are instruction-level rather than runtime-enforced.
184
+ Examples: `sdd/add-user-auth/spec`, `sdd/add-user-auth/design`,
185
+ `sdd/add-user-auth/tasks`.
325
186
 
326
187
  ## Anti-Patterns
327
188
 
328
- Reject these patterns immediately:
329
-
330
- - Subagent calls `mem_save_prompt`.
331
- - Subagent calls `mem_session_start` or `mem_session_summary`.
332
- - Subagent uses thoth-mem without parent `session_id` and `project`.
333
- - Subagent uses `mem_context` as a replacement for the bounded 3-layer recall
334
- path.
335
- - Subagent uses project-scoped read tools without explicit permission in the
336
- dispatch.
337
- - Read-only subagent writes memory.
338
- - General observation saved under `sdd/...`.
339
- - Orchestrator asks a subagent to “remember this user request” by saving the
340
- generated dispatch prompt.
341
- - A harness-specific tool alias is treated as permission to bypass the
342
- orchestrator/subagent ownership split.
343
-
344
- ## Dispatch Examples
345
-
346
- ### Correct
347
-
348
- ```text
349
- Load skill thoth-mem-agents and follow it.
350
- Parent session_id: ses_root_123
351
- Project: thoth-agents
352
- Memory limits: read-only recall only; do not write memory.
353
- Task: inspect prior thoth-mem ownership decisions for the hook redesign.
354
- ```
355
-
356
- ```text
357
- Load skill thoth-mem-agents and follow it.
358
- Parent session_id: ses_root_123
359
- Project: thoth-agents
360
- Memory limits: you may mem_save durable implementation observations, but never
361
- save prompts or call session tools.
362
- Task: implement the prompt ownership fix and persist any durable bugfix notes.
363
- ```
189
+ Reject immediately:
364
190
 
365
- ### Incorrect
366
-
367
- ```text
368
- Check memory and save your prompt for traceability.
369
- ```
370
-
371
- Why wrong: no parent `session_id`/`project`, and it asks the subagent to save a
372
- generated prompt.
373
-
374
- ```text
375
- Use mem_session_summary when done so we keep the session updated.
376
- ```
377
-
378
- Why wrong: session summaries are orchestrator-owned.
191
+ - asking a subagent to save a generated dispatch prompt
192
+ - subagent use of root session operations (`mem_session(...)`)
193
+ - subagent save of `kind="prompt"`
194
+ - inventing thoth-mem tools outside the six-tool MCP surface
195
+ - treating `mem_context` as a substitute for recall funnel
196
+ - saving general notes under `sdd/*`
379
197
 
380
198
  ## Response Standard
381
199
 
382
- When you apply this skill, be explicit about:
383
-
384
- - which agent owns the memory operation
385
- - which thoth-mem tools are allowed for this task
386
- - whether parent `session_id` and `project` were provided
387
- - whether project-scoped read tools are allowed and which ones
388
- - whether a proposed topic key is safe or collides with `sdd/...`
389
- - which binding surface is active when the distinction affects tool names,
390
- role invocation, or enforcement
391
- - whether any governance rule is instruction-level because the harness cannot
392
- hard-enforce the boundary
200
+ When applying this skill, state clearly:
393
201
 
394
- If any of those are missing, stop using thoth-mem and continue only with local
395
- context unless the orchestrator provides the missing ownership data.
202
+ - memory owner for each operation (root vs subagent)
203
+ - allowed tools for the task
204
+ - whether parent `session_id` and `project` are present
205
+ - whether context reads are bounded and explicitly allowed
206
+ - whether topic keys collide with `sdd/*`
207
+ - whether any rule is instruction-level due to runtime enforcement limits