@yugabytedb/meko-mcp 2.1.0 → 2.3.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.
- package/README.md +233 -40
- package/assets/hooks-handlers/codex-session-end.sh +4 -69
- package/assets/hooks-handlers/cursor-session-start.sh +19 -1
- package/assets/hooks-handlers/lib/capture-cleanup-cli.js +1473 -0
- package/assets/hooks-handlers/lib/capture-notices.js +438 -0
- package/assets/hooks-handlers/lib/capture-state.js +2173 -0
- package/assets/hooks-handlers/lib/capture-status-cli.js +86 -0
- package/assets/hooks-handlers/lib/capture.js +2782 -403
- package/assets/hooks-handlers/lib/checkpoint-timer.js +485 -81
- package/assets/hooks-handlers/lib/journal-bridge.js +218 -0
- package/assets/hooks-handlers/lib/kiro-handler.js +760 -0
- package/assets/hooks-handlers/lib/opencode-handler.js +620 -0
- package/assets/hooks-handlers/lib/opencode-normalizer.js +145 -0
- package/assets/hooks-handlers/lib/terminal-handoff.js +427 -0
- package/assets/hooks-handlers/session-end.sh +3 -34
- package/assets/opencode-plugin/meko.js +213 -0
- package/assets/scripts/meko-statusline.sh +123 -16
- package/assets/skills/meko-mcp-tools/SKILL.md +116 -126
- package/assets/skills/meko-mcp-tools/references/_sections.md +3 -3
- package/assets/skills/meko-mcp-tools/references/tools-agent-id-conventions.md +25 -18
- package/assets/skills/meko-mcp-tools/references/tools-cookbook.md +99 -24
- package/assets/skills/meko-mcp-tools/references/tools-datapack-workflow.md +1 -1
- package/assets/skills/meko-mcp-tools/references/tools-known-limitations.md +53 -6
- package/assets/skills/meko-mcp-tools/references/tools-memory-vs-conversation.md +25 -79
- package/assets/skills/meko-mcp-tools/references/tools-overview.md +37 -26
- package/assets/skills/meko-mcp-tools/references/tools-rag-workflow.md +14 -8
- package/assets/skills/meko-mcp-tools/references/tools-troubleshooting.md +66 -1
- package/assets/skills/meko-mcp-tools/references/tools-user-id-conventions.md +7 -40
- package/assets/skills/meko-mcp-tools-desktop/SKILL.md +56 -20
- package/assets/skills/meko-mcp-tools-desktop/desktop/README.md +1 -1
- package/assets/skills/meko-mcp-tools-desktop/references/_sections.md +1 -1
- package/assets/skills/meko-mcp-tools-desktop/references/tools-agent-id-conventions.md +15 -8
- package/assets/skills/meko-mcp-tools-desktop/references/tools-cookbook.md +99 -36
- package/assets/skills/meko-mcp-tools-desktop/references/tools-known-limitations.md +22 -5
- package/assets/skills/meko-mcp-tools-desktop/references/tools-memory-vs-conversation.md +18 -14
- package/assets/skills/meko-mcp-tools-desktop/references/tools-overview.md +39 -28
- package/assets/skills/meko-mcp-tools-desktop/references/tools-rag-workflow.md +14 -8
- package/assets/skills/meko-mcp-tools-desktop/references/tools-troubleshooting.md +67 -1
- package/assets/skills/meko-select-datapack-desktop/SKILL.md +4 -4
- package/assets/skills/meko-select-datapack-desktop/references/cookbook.md +8 -8
- package/assets/skills/meko-select-datapack-desktop/references/role-display-future.md +7 -5
- package/assets/skills/meko-select-datapack-desktop/references/troubleshooting.md +4 -4
- package/bin/create-meko-setup.mjs +113 -12
- package/lib/capture-cleanup.mjs +63 -0
- package/lib/capture-status.mjs +67 -0
- package/lib/clients/aliases.mjs +5 -0
- package/lib/clients/claude-code.mjs +1 -0
- package/lib/clients/claude-desktop.mjs +120 -5
- package/lib/clients/codex.mjs +85 -37
- package/lib/clients/common.mjs +7 -0
- package/lib/clients/index.mjs +4 -0
- package/lib/clients/kiro.mjs +705 -0
- package/lib/clients/opencode.mjs +532 -0
- package/lib/config.mjs +158 -1
- package/lib/installer.mjs +18 -1
- package/lib/migrate/adapters/claude-code.mjs +11 -2
- package/lib/migrate/adapters/codex.mjs +497 -0
- package/lib/migrate/adapters/memory-md.mjs +27 -8
- package/lib/migrate/adapters/opencode.mjs +148 -0
- package/lib/migrate/claude-parser.mjs +153 -9
- package/lib/migrate/id.mjs +217 -10
- package/lib/migrate/mcp-client.mjs +25 -1
- package/lib/migrate/opencode-normalizer.mjs +132 -0
- package/lib/migrate/orchestrator.mjs +299 -56
- package/lib/migrate/progress.mjs +239 -5
- package/lib/migrate/registry.mjs +72 -0
- package/lib/migrate.mjs +100 -10
- package/lib/prompt.mjs +16 -1
- package/package.json +4 -4
- package/scripts/bundle-assets.mjs +4 -0
|
@@ -4,184 +4,130 @@ description: Behavioral guide for AI agents using Meko MCP tools. Triggers when
|
|
|
4
4
|
license: MIT
|
|
5
5
|
metadata:
|
|
6
6
|
author: Meko
|
|
7
|
-
version: "3.0
|
|
7
|
+
version: "3.2.0"
|
|
8
8
|
tags: mcp, tools, datapack, memory, conversation, rag, meko
|
|
9
9
|
---
|
|
10
10
|
|
|
11
11
|
# Meko MCP Tools — Agent Behavioral Guide
|
|
12
12
|
|
|
13
|
-
Meko is agent-native data infrastructure that enables continuous learning from context windows through collective memory and shared knowledge. This skill teaches you how to use Meko's
|
|
13
|
+
Meko is agent-native data infrastructure that enables continuous learning from context windows through collective memory and shared knowledge. This skill teaches you how to use Meko's 25 MCP tools available in production.
|
|
14
14
|
|
|
15
|
+
**Read this first.** On Claude Code, conversation capture is automatic (SessionStart / PreCompact / SessionEnd hooks) and the Meko server extracts durable memories from the captured turns on its own. Facts the user states in conversation are saved for you — you do **not** proactively call `memory_add` for them. Your active jobs are: **recall** what's already known (`context_search` first, then `memory_search` or `knowledgebase_search` for a single source), and the **few** save cases automatic extraction cannot reach. Details below.
|
|
15
16
|
|
|
16
|
-
|
|
17
|
+
## Non-negotiable operating contracts
|
|
17
18
|
|
|
18
|
-
|
|
19
|
+
Apply these rules before the longer guidance below. They are service-contract safeguards, not suggestions.
|
|
19
20
|
|
|
20
|
-
|
|
21
|
+
### 1. Distinguish failure from an empty search
|
|
21
22
|
|
|
22
|
-
|
|
23
|
-
- **Team-shared knowledge** — Important memories can be promoted with `memory_promote` (after explicit confirmation) or from the Cloud UI's Learnings tab. Uploaded documents arrive through **Add Knowledge**. The resulting content is visible to every datapack member and queryable via `knowledgebase_search`.
|
|
24
|
-
- **Conversation history** — Preserve full dialog exchanges with reasoning traces for audit, replay, and learning transfer.
|
|
25
|
-
- **Decision traces** — Capture how and why decisions were made, enabling debugging and continuous improvement.
|
|
23
|
+
Inspect the response envelope before its contents:
|
|
26
24
|
|
|
27
|
-
|
|
25
|
+
1. If `error` or an error-shaped `detail` is present, or the whole response is an error string (for example `Error searching memories: ...` or `[Errno 111] Connection refused`), the search **failed** and its findings are **unknown**. Say exactly that. Never say "nothing was found," "no results," or "the store is empty."
|
|
26
|
+
2. Do not retry quota (`free_tier_limit_reached`), permission (403), or validation errors. Report the error and stop. The one exception is `datapack_access_denied`: retry it once, because the server's access check also fails closed on a transient database error. Retry only documented transient failures (see `tools-troubleshooting.md`), with a bounded backoff. For `PAT_RATE_LIMITED`, wait out the retry-after (about 60s) before retrying.
|
|
27
|
+
3. Only a successful response with an explicit empty `results` array proves a legitimate empty search.
|
|
28
28
|
|
|
29
|
-
|
|
30
|
-
- You need to decide what to store, where, and how (personal memory vs. team-shared knowledge)
|
|
31
|
-
- You want to search the team's shared knowledge base (`knowledgebase_search`)
|
|
32
|
-
- You are managing datapacks
|
|
33
|
-
- You want to understand `agent_id` conventions, or `datapack_id` routing
|
|
29
|
+
### 2. Treat `memory_get_all` as a recent window, never an export
|
|
34
30
|
|
|
35
|
-
|
|
31
|
+
`memory_get_all` returns roughly 20 recent rows plus a `total`; it is not a listing tool. Inspect the row count against `total`, and never state or imply you have listed everything — the only trustworthy count is `total`. Calling it more than once does not add up to a complete export: a second call with `promoted=true` (or any other variant) is just another recent window, not the remaining rows, so two calls are still not a full listing. Do not invent `limit`, `offset`, `page`, or `page_size` arguments—the tool rejects pagination. Use targeted `memory_search` or `memory_get_by_id` for older or exact content. If the user needs a complete export, report that MCP currently has no complete enumeration path.
|
|
36
32
|
|
|
37
|
-
|
|
33
|
+
### 3. Separate retrieval breadth from reader context
|
|
38
34
|
|
|
39
|
-
|
|
35
|
+
Retrieve up to about 25 candidates for recall, preserve relevance order, and pass at most the top 10 useful evidence items to final reasoning. Never paste all 25–30 results into the reader by default. Raise the reader window only after measuring misses outside the top 10. When dated claims conflict, resolve recency only among claims about the same entity and field; do not sort the whole result set by date.
|
|
40
36
|
|
|
41
|
-
|
|
42
|
-
- **Common bucket** — `meko_agent`. The cross-project bucket for facts any agent should see regardless of project (user identity, global preferences). Empty / missing `agent_id` lands here automatically; you can also pass it explicitly.
|
|
43
|
-
- **Loose name** — non-coding clients (Claude Desktop, generic MCP) use a stable client name like `claude_desktop`. Not relevant in this skill (Claude Code is a coding agent).
|
|
37
|
+
If no candidate supports an answer, abstain: say the retrieved evidence does not cover it. Never fill the slot with a guess, and when the task offers fixed options, choose the one that *means* "not enough information" rather than defaulting to any particular option.
|
|
44
38
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
39
|
+
### 4. Verify writes and enforce real isolation
|
|
40
|
+
|
|
41
|
+
- A success-shaped write response is not proof. Read back memories and conversations. For artifacts, compute SHA-256 locally, require the matching `content_hash`, then read back important bytes. A missing hash means the upload is unconfirmed.
|
|
42
|
+
- A read-back must use the same `datapack_id` as the write. Checking the default datapack after writing to a pinned one proves nothing.
|
|
43
|
+
- `agent_id` attributes writes; it is not an access boundary. Put projects, tenants, or security domains that must not co-discover content in separate datapacks.
|
|
44
|
+
|
|
45
|
+
## `agent_id` — multi-agent identity
|
|
49
46
|
|
|
50
|
-
|
|
47
|
+
Use the SessionStart-injected `agent_id` verbatim. It normally has shape `<client>:<repo-basename>`. Use `meko_agent` only for deliberately cross-project writes; empty write IDs also route there.
|
|
51
48
|
|
|
52
49
|
**Read scoping varies by tool:**
|
|
53
|
-
- `memory_search` / `memory_get_all` — scoped to `(datapack_id, user_id)
|
|
54
|
-
- `conversation_get`
|
|
55
|
-
- `
|
|
56
|
-
- `
|
|
50
|
+
- `memory_search` / `memory_get_all` — scoped to `(datapack_id, user_id)`; `agent_id` does not filter results. Do not fan out reads by agent.
|
|
51
|
+
- `conversation_get`, `conversation_add_message`, `conversation_update`, `conversation_delete`: agent-owned. Pass the exact `agent_id` that created the conversation; any other value returns `agent_id_mismatch`.
|
|
52
|
+
- `memory_delete_all`: deletes only the passed `agent_id`'s bucket, even though memory reads span every agent. A `memory_search` preview can show rows this call won't delete.
|
|
53
|
+
- `conversation_list` — user/datapack scoped; `agent_id` is trace attribution only.
|
|
54
|
+
- `knowledgebase_search` — datapack scoped; `agent_id` is ignored.
|
|
55
|
+
- `context_search`: the memory and KB buckets follow the rules above. The conversation bucket is broader than both: it spans every user and agent on the datapack, and `agent_id` doesn't filter it.
|
|
57
56
|
|
|
58
|
-
See `tools-agent-id-conventions.md` for the full model, including how promotion works and how to phrase broad-query responses to the user.
|
|
57
|
+
See `tools-agent-id-conventions.md` for the full model, including how promotion works and how to phrase broad-query responses to the user. Legacy IDs remain readable through the same personal-memory read.
|
|
59
58
|
|
|
60
|
-
|
|
59
|
+
## Use Meko for durable memory, not as a replacement for project files
|
|
61
60
|
|
|
62
|
-
|
|
61
|
+
Use Meko for durable facts that must survive sessions, be found by meaning, or be shared across agents. Keep source code, exact artifacts, canonical specifications, and whole documents in their normal file or artifact stores; use exact lookup when identity is known. Do not create an ad-hoc local "agent memory" file as a substitute for Meko.
|
|
63
62
|
|
|
64
|
-
|
|
63
|
+
On Claude Code, memory reaches Meko two ways:
|
|
65
64
|
|
|
66
65
|
- **Automatic capture + extraction** (the dominant path) — the hooks capture this session's turns and the server extracts memories from them. Facts the user states are stored without any tool call from you.
|
|
67
66
|
- **Explicit `memory_add`** (the narrow path) — only for the cases extraction can't reach (see "When to call memory_add" below).
|
|
68
67
|
|
|
69
|
-
|
|
68
|
+
For meaning-based recall, call `memory_search`. For an exact known filename, key, hash, or complete document, use the corresponding direct file or artifact lookup. If a Meko call fails, report the failure; do not silently replace durable shared memory with a private local note.
|
|
70
69
|
|
|
71
70
|
## When spawning subagents
|
|
72
71
|
|
|
73
|
-
Subagents
|
|
74
|
-
|
|
75
|
-
### Rule (parent's responsibility)
|
|
76
|
-
|
|
77
|
-
**Every spawn prompt MUST prepend an inherited-context block** with the parent's actual `agent_id` and `conversation_id`:
|
|
72
|
+
Subagents do not receive SessionStart context. Every spawn prompt must include:
|
|
78
73
|
|
|
79
74
|
```
|
|
80
75
|
Meko context (inherited from parent session):
|
|
81
76
|
- agent_id: "<parent's agent_id, verbatim>"
|
|
82
77
|
- conversation_id: "<parent's conversation_id>"
|
|
83
|
-
- Use these for all Meko MCP calls.
|
|
78
|
+
- Use these verbatim for all Meko MCP calls.
|
|
84
79
|
```
|
|
85
80
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
**Default: inject unconditionally.** The skill-listing heuristic (subagent seeing `meko-agent-skills:meko-mcp-tools` in its available skills) is unreliable, and injecting a 4-line block costs nothing. Don't try to predict whether the subagent will touch Meko — inject always.
|
|
89
|
-
|
|
90
|
-
### What the subagent does with it
|
|
91
|
-
|
|
92
|
-
The subagent treats the block as authoritative. Apply this hierarchy in order:
|
|
93
|
-
|
|
94
|
-
1. **Default: reuse the inherited `conversation_id`.** The parent decides scope. Do NOT re-derive these values. Do NOT create a fresh conversation on a "feels separate" judgment — a separate-feeling task is not an explicit signal.
|
|
95
|
-
2. **Exception: create a new conversation only when the spawn prompt (or user) explicitly says so.** An explicit signal means the parent's prompt says something like "use a fresh conversation" or "start your own conversation scope," or the user directly asks for one. Absent that signal, reuse.
|
|
81
|
+
Reuse the inherited conversation unless the parent or user explicitly requests a fresh scope. Always reuse the inherited agent ID.
|
|
96
82
|
|
|
97
|
-
|
|
83
|
+
Parallel subagents writing to one conversation have hit intermittent `not_found` or `agent_id_mismatch` ("conversation belongs to agent 'None'") on `conversation_add_message` right after `conversation_create`, while other subagents succeeded with identical arguments. Retry that call once with the same `seed` after a few seconds. If it still fails, don't create a replacement conversation: save the durable findings with `memory_add` and tell the parent the transcript for that subagent is incomplete.
|
|
98
84
|
|
|
99
|
-
If the
|
|
100
|
-
|
|
101
|
-
### You may be a subagent — self-diagnosis
|
|
102
|
-
|
|
103
|
-
**Tell-tale signs:**
|
|
104
|
-
- You did NOT receive a SessionStart `additionalContext` block naming a Meko `conversation_id`.
|
|
105
|
-
- You see `meko-agent-skills:meko-mcp-tools` in your available skills but no watermark / inherited-context reference in your initial prompt.
|
|
106
|
-
- Your spawn prompt mentions you were "spawned" / "dispatched" / "launched" by a parent, or mentions a `Task` / `Agent` tool.
|
|
107
|
-
|
|
108
|
-
**What to do:**
|
|
109
|
-
- Look for a `Meko context (inherited from parent session):` block in the spawn prompt. If present, use those values verbatim for every Meko MCP call.
|
|
110
|
-
- If absent, **refuse to invoke Meko write tools** and respond to the parent with a clarification request: ask for the parent's `agent_id` and `conversation_id`. The parent can re-dispatch with the block prepended.
|
|
111
|
-
|
|
112
|
-
**What NOT to do:**
|
|
113
|
-
- Do NOT fall back to the nil UUID (`"00000000-0000-0000-0000-000000000000"`) for `conversation_id` — that's an orphan-write pattern.
|
|
114
|
-
- Do NOT invent an `agent_id`. The right value is whatever the parent is using (typically `claude_code:<repo-basename>`); don't assume `"agent"`, `"claude-code"`, `"meko_agent"`, or a different basename. Ask.
|
|
115
|
-
- Do NOT silently create your own conversation to "just get moving" — ask the parent.
|
|
116
|
-
|
|
117
|
-
Subagents cannot auto-discover the parent's watermark today: Claude Code does not expose a `CLAUDE_PARENT_SESSION_ID` env var or any equivalent marker file to subagent processes (see the spike note in `skills/hooks-handlers/lib/capture.js`). Prompt injection is the only enforcement mechanism.
|
|
85
|
+
**You may be the subagent.** If no SessionStart context named a `conversation_id`, assume you are one and look for the block above in your prompt. If it is absent, do not guess, invent IDs, use the nil UUID, or write — ask the parent for both values.
|
|
118
86
|
|
|
119
87
|
## Core principle: capture is automatic — recall, don't re-store
|
|
120
88
|
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
So your Meko reflexes are:
|
|
89
|
+
On Claude Code, hooks capture user turns and the server extracts durable memories. Do not duplicate facts the user states with `memory_add`.
|
|
124
90
|
|
|
125
|
-
|
|
126
|
-
2. **Save only what capture can't reach** (the three narrow cases below).
|
|
127
|
-
3. **Never** re-store a fact the user just said. **Never** write memories to local files.
|
|
91
|
+
Recall first; save only what capture cannot reach; never re-store a just-stated fact.
|
|
128
92
|
|
|
129
93
|
### When the user shares information
|
|
130
94
|
|
|
131
95
|
| Signal in conversation | What to do |
|
|
132
96
|
|---|---|
|
|
133
97
|
| User states a fact about themselves, their team, tools, or preferences | **Nothing — automatic capture + extraction stores it.** Just answer. |
|
|
134
|
-
| User corrects
|
|
98
|
+
| User corrects a prior fact | Capture adds the correction but may retain the old fact; find and update/delete the stale memory when it must not survive. |
|
|
135
99
|
| User explicitly says "remember this" / "save this to memory" | `memory_add` (verbatim). This is the clearest explicit-save case. |
|
|
136
|
-
| A durable fact appears only in
|
|
137
|
-
| User asks "what do you know about X?" |
|
|
100
|
+
| A durable fact appears only in assistant output or a tool result | `memory_add`; automatic extraction reads the user turn. |
|
|
101
|
+
| User asks "what do you know about X?" | `context_search`. One call returns separate memory, knowledge-base, and past-conversation buckets; report each. Confirm an empty memory or KB bucket with `memory_search` or `knowledgebase_search` before saying nothing is stored. |
|
|
138
102
|
| User asks "what do we (as a team) know about X?" or about uploaded documents | `knowledgebase_search` (returns uploaded docs + promoted memories). |
|
|
139
|
-
| User asks to share
|
|
103
|
+
| User asks to share private memories | Follow the exact-ID `memory_promote` confirmation workflow below. |
|
|
140
104
|
| User provides structured/tabular data (CSV, data dictionary) | Not natively supported via MCP. Point the user at the UI's Add Knowledge upload; do not `memory_add` row-by-row. |
|
|
141
105
|
| User wants to add documents to the team's knowledge base | Point them at the Cloud UI flow — Datapack → Actions → **Add Knowledge** (PDF/TXT/MD/JSON/MP4, 5MB each, 10/batch). MCP ingestion tools are not available on Cloud. |
|
|
142
106
|
|
|
143
|
-
### When to call memory_add
|
|
107
|
+
### When to call memory_add
|
|
144
108
|
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
1. **Explicit request** — the user says "remember this" / "save this."
|
|
148
|
-
2. **Output-only / tool-derived fact** — a durable fact that lives only in the assistant's output or a tool result, never in a user turn (extraction only sees the user turn).
|
|
149
|
-
3. **Overwriting correction** — a prior fact was negated and the stale memory must not survive (extraction is additive; pair `memory_add`/`memory_update` with a `memory_delete_by_id` of the old one).
|
|
150
|
-
|
|
151
|
-
When you do call it, store the fact verbatim in the user's own words; do not summarize.
|
|
109
|
+
Use it only for an explicit save request, an output/tool-derived durable fact, or a correction whose stale predecessor must be replaced. Store one focused fact verbatim; for corrections, update/delete the stale record.
|
|
152
110
|
|
|
153
111
|
## Automatic conversation capture
|
|
154
112
|
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
1. **Background checkpoint timer** — runs every 10 minutes, captures new exchanges without interrupting the agent
|
|
158
|
-
2. **PreCompact hook** — fires before context compaction, captures everything before compaction discards context
|
|
159
|
-
3. **SessionEnd hook** — fires at session end, captures remaining exchanges
|
|
160
|
-
|
|
161
|
-
All three are handled automatically. **Do NOT set up CronCreate for conversation capture** — it interrupts running tool calls and causes disruptive retry cycles.
|
|
113
|
+
Background, PreCompact, and SessionEnd hooks capture the conversation automatically. Do not create a separate capture cron.
|
|
162
114
|
|
|
163
115
|
### What to do at session start
|
|
164
116
|
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
1. **Created a Meko conversation** — `conversation_id` is injected into `additionalContext` on the first turn. Use that value for all subsequent MCP tool calls that accept `conversation_id`.
|
|
168
|
-
2. **Echoed the session's `agent_id`** — also injected into `additionalContext`. Use the injected value verbatim for project-scoped Meko tool calls. It's a per-session value derived from the cwd (shape: `claude_code:<repo-basename>`), not a constant. For genuinely cross-project facts, write with `agent_id="meko_agent"` (the common bucket) instead.
|
|
169
|
-
3. **Preloaded recent memories** — `additionalContext` may include a `### Memories from prior sessions` block. Inspect it before acting so you don't re-ask questions the user has already answered.
|
|
170
|
-
|
|
171
|
-
If `additionalContext` is absent or empty (hook failed, MCP unavailable), ask the user for their `agent_id` — do not invent one. See `tools-agent-id-conventions.md`.
|
|
117
|
+
Use the injected `conversation_id` and `agent_id` verbatim and inspect any preloaded memories. If injection is absent, do not invent values; ask for the missing identity or create a conversation only when the applicable workflow permits it.
|
|
172
118
|
|
|
173
119
|
### Before potentially destructive actions
|
|
174
120
|
|
|
175
|
-
|
|
121
|
+
When Meko is available and the user may have stored relevant preferences, search for them before deleting, overwriting, or restructuring user content:
|
|
176
122
|
|
|
177
123
|
```
|
|
178
124
|
memory_search(query="destructive <action type> preferences feedback",
|
|
179
125
|
agent_id=<your agent_id>, conversation_id=<session_conversation_id>)
|
|
180
126
|
```
|
|
181
127
|
|
|
182
|
-
A single
|
|
128
|
+
A single search covers all of this user's agents. Memory is supplemental evidence, not authorization: a relevant preference can require more caution, but an empty search never authorizes destruction. Follow host approval rules and prefer previews.
|
|
183
129
|
|
|
184
|
-
If
|
|
130
|
+
If your host's policy doesn't let you run a Meko delete tool even when the user asks, say so plainly and hand the user what they need to do it themselves: the exact memory or conversation IDs, a one-line summary of each, and the tool call to run from a client that allows deletes. Don't report the data as deleted.
|
|
185
131
|
|
|
186
132
|
### Capture rules
|
|
187
133
|
|
|
@@ -190,6 +136,21 @@ If a relevant feedback memory exists (e.g., "always ask before deleting content"
|
|
|
190
136
|
- **Always use a seed** — enables dedup across the three capture mechanisms.
|
|
191
137
|
- **Graceful failure** — if `conversation_add_message` fails, log the error and continue. Do not retry more than once.
|
|
192
138
|
|
|
139
|
+
### Long-running conversations
|
|
140
|
+
|
|
141
|
+
Meko stores a conversation as one Langfuse trace, and Langfuse refuses to load a trace larger than its size limit. After a long session crosses that limit, reads of the session's own conversation fail even though the conversation exists:
|
|
142
|
+
|
|
143
|
+
- `conversation_get` and `conversation_update` return `{"error": "not_found", "detail": "Conversation <id> not found"}`, or the call times out.
|
|
144
|
+
- On servers without the MEKO-714 fix, `conversation_add_message` returns the same `not_found`.
|
|
145
|
+
|
|
146
|
+
When this happens on the conversation you've been using all session, accept the error and keep working:
|
|
147
|
+
|
|
148
|
+
- Don't retry the call, create a replacement conversation, or replay earlier messages. Each replay makes the trace larger, and recreating the conversation has caused capture loops.
|
|
149
|
+
- Skip the read-back for that conversation. Tell the user once that Meko can't load this conversation because it's too large, and don't report it as data loss.
|
|
150
|
+
- Keep using `context_search`, the `memory_*` tools, and `knowledgebase_search`. They don't load the conversation trace.
|
|
151
|
+
|
|
152
|
+
A `not_found` for a conversation you just created, or one this session never wrote to, has other causes; see `tools-troubleshooting.md`.
|
|
153
|
+
|
|
193
154
|
## Calling tools correctly on the first attempt
|
|
194
155
|
|
|
195
156
|
**Use only the required parameters. Do not guess optional parameters.**
|
|
@@ -199,26 +160,60 @@ In the examples below, `<your-agent-id>` means the value the SessionStart hook i
|
|
|
199
160
|
### memory_add — correct call pattern
|
|
200
161
|
|
|
201
162
|
Only for the three narrow cases in "When to call memory_add" above — not for facts the user stated in conversation (those are captured automatically). The example below is an explicit "remember this" save:
|
|
163
|
+
|
|
202
164
|
```
|
|
203
165
|
memory_add(
|
|
204
166
|
text="Remember: deploy scripts must be run from the repo root, never a subdir",
|
|
205
167
|
agent_id="<your-agent-id>",
|
|
206
168
|
conversation_id="<session_conversation_id>")
|
|
207
169
|
```
|
|
170
|
+
|
|
208
171
|
Required parameters: `text`, `conversation_id`. On **writes**, `conversation_id` must be a real UUID (from `conversation_create` or the SessionStart hook) — writes attached to a nil/empty conversation are orphaned in Langfuse traces. NEVER pass `"current"` or other non-UUID values. `agent_id` is technically optional — empty/missing routes the write into the `meko_agent` common bucket — but for project-scoped facts pass the SessionStart-injected value verbatim.
|
|
209
172
|
|
|
173
|
+
**Write one coherent fact per memory**, with the identifiers a later search will use — never a transcript or multi-topic dump; focused memories retrieve better and read far faster.
|
|
174
|
+
|
|
175
|
+
### context_search: default first call for recall
|
|
176
|
+
|
|
177
|
+
```
|
|
178
|
+
context_search(
|
|
179
|
+
query="auth migration decisions",
|
|
180
|
+
agent_id="<your-agent-id>",
|
|
181
|
+
conversation_id="<session_conversation_id>",
|
|
182
|
+
datapack_id="<pinned datapack UUID, if any>")
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
Required parameters: `query`, `conversation_id`. It queries memory, the knowledge base, and the conversation-history cache in parallel and returns `{"results": {"memory": [...], "knowledge_base": [...], "conversation": {"hits": [...], "thread": [...]}}, "token_savings": {...}}`.
|
|
186
|
+
|
|
187
|
+
- Read every bucket. A KB document can supersede a memory or a past conversation; nothing is hidden by another source's hit.
|
|
188
|
+
- An empty bucket is ambiguous: either that source found nothing relevant, or it failed. `context_search` turns a failed source into an empty list and records the error only in the trace. Before you tell the user nothing is stored about X, confirm with `memory_search` or `knowledgebase_search`, which return errors.
|
|
189
|
+
- A bucket is `null` only when that source wasn't queried: `force_source` excluded it, or the server couldn't build a query vector for it.
|
|
190
|
+
- The conversation bucket is datapack-wide. It returns embedded turns from every user and agent on the datapack, and each hit carries its author's `user_id`. Don't present a hit as this user's own history.
|
|
191
|
+
- `limit` bounds the memory and KB buckets only; the conversation bucket returns up to 10 hits plus a thread of whole turns.
|
|
192
|
+
- The memory bucket has no similarity floor on the default path, so it can contain weak rows. Discount them against the other buckets instead of treating them as answers.
|
|
193
|
+
- Set `force_source` to `"memory"`, `"knowledge_base"`, or `"conversation"` only when you already know the one source you need.
|
|
194
|
+
- Use `memory_search` or `knowledgebase_search` directly when you need `run_id` filtering, the memory similarity floor, or exact document IDs for `knowledgebase_delete_document`.
|
|
195
|
+
|
|
210
196
|
### memory_search — correct call pattern
|
|
197
|
+
|
|
211
198
|
```
|
|
212
199
|
memory_search(
|
|
213
200
|
query="user role",
|
|
214
201
|
agent_id="<your-agent-id>",
|
|
215
202
|
conversation_id="<session_conversation_id>")
|
|
216
203
|
```
|
|
217
|
-
Required parameters: `query`, `agent_id`, `conversation_id`. On **`memory_search`** specifically, `conversation_id` is used only for Langfuse trace nesting — it does NOT filter results. Pass the session's UUID so the search span appears under the active conversation in Observe; passing `""` is accepted and means "don't nest under any trace." For conversation-scoped filtering use the separate `run_id` parameter.
|
|
218
204
|
|
|
219
|
-
`
|
|
205
|
+
Required parameters: `query`, `conversation_id`. On **`memory_search`** specifically, `conversation_id` is used only for Langfuse trace nesting — it does NOT filter results. Pass the session's UUID so the search span appears under the active conversation in Observe. Never pass `""`: production `memory_search` currently fails on an empty value (MEKO-707). If you have no conversation yet, pass a freshly generated 32-character lowercase hex id (a UUID with the hyphens removed); on a read it only nests the trace.
|
|
206
|
+
|
|
207
|
+
`agent_id` does not filter what `memory_search` returns — one call covers every agent's rows for this user, including the `meko_agent` bucket (see Read scoping above). Results below a server-configured similarity floor (default 0.2) are dropped, so an empty `results` list can mean "only weak matches", not "nothing stored".
|
|
208
|
+
|
|
209
|
+
Evidence going into reasoning follows operating contract 3 (retrieve ≤ ~25, pass ≤ ~10).
|
|
210
|
+
|
|
211
|
+
### memory_get_all — recent-window pattern
|
|
212
|
+
|
|
213
|
+
Follow operating contract 2: a ~20-row recent window plus an honest `total` — no pagination, no completeness claims. Use targeted `memory_search` or `memory_get_by_id` instead.
|
|
220
214
|
|
|
221
215
|
### knowledgebase_search — correct call pattern
|
|
216
|
+
|
|
222
217
|
```
|
|
223
218
|
knowledgebase_search(
|
|
224
219
|
query="...",
|
|
@@ -227,13 +222,16 @@ knowledgebase_search(
|
|
|
227
222
|
datapack_id="<datapack UUID>",
|
|
228
223
|
limit=10)
|
|
229
224
|
```
|
|
230
|
-
|
|
225
|
+
|
|
226
|
+
Required parameters: `query`, `conversation_id`, `datapack_id`. `datapack_id` has no default here. `agent_id` is ignored for filtering — results are the team's shared knowledge on the datapack regardless of what you pass.
|
|
227
|
+
|
|
228
|
+
For recalling working memories — especially recently-changed facts — prefer `memory_search`; the knowledge base is the team's publish/archive surface.
|
|
231
229
|
|
|
232
230
|
### memory_promote — explicit confirmation required
|
|
233
231
|
|
|
234
|
-
`memory_promote` is destructive and non-idempotent: it makes selected content visible to the datapack, moves the memories
|
|
232
|
+
`memory_promote` is destructive and non-idempotent: it makes selected content visible to the datapack, moves the memories into shared knowledge, and evicts the private records. There is no MCP rollback.
|
|
235
233
|
|
|
236
|
-
1. Use `memory_search` or `memory_get_all` to obtain exact memory UUIDs. Never pass
|
|
234
|
+
1. Use `memory_search` or `memory_get_all` to obtain exact memory UUIDs from the `id` field. Never pass any other identifier.
|
|
237
235
|
2. Present each exact candidate memory and its UUID to the user.
|
|
238
236
|
3. State that promotion is one-way, team-visible, and removes the private records.
|
|
239
237
|
4. Obtain explicit confirmation for those exact candidates before calling `memory_promote`.
|
|
@@ -246,7 +244,7 @@ The Cloud UI's Learnings tab remains an alternative user-driven path.
|
|
|
246
244
|
### Critical parameter rules
|
|
247
245
|
|
|
248
246
|
- **agent_id**: Per-session value, injected via `additionalContext` by the SessionStart hook. Shape: `<client>:<repo-basename>`. Pass verbatim on project-scoped writes and reads. Pass `"meko_agent"` for the cross-project common bucket (or empty/omit — server rewrites empty to `meko_agent`). Ignored on `knowledgebase_search`. See `tools-agent-id-conventions.md`.
|
|
249
|
-
- **conversation_id**:
|
|
247
|
+
- **conversation_id**: the conversation's ID *is* its trace ID, so every call carrying it becomes a span under that conversation in the Observe hub. On write tools (`memory_add`, `conversation_add_message`) pass a real UUID from `conversation_create` or the SessionStart hook — a nil/empty value orphans the trace. On read tools it only nests the trace (it does not filter), but it must still be a 32-hex id: `memory_search` fails on `""`, and most other tools reject it with `conversation_id_required`. Never pass `"current"` or other non-UUID junk.
|
|
250
248
|
- **When in doubt about optional parameters, omit them.** The server has sensible defaults.
|
|
251
249
|
|
|
252
250
|
### Verify after writing
|
|
@@ -254,7 +252,8 @@ The Cloud UI's Learnings tab remains an alternative user-driven path.
|
|
|
254
252
|
Never confirm a successful save to the user without first validating via a read-back. `{"status": "accepted"}` or HTTP 200 from a write tool is not proof of persistence — indexing lag, silent server errors, and wrong-datapack routing all surface as "the write looked fine but nothing is there." Always read back before reporting success.
|
|
255
253
|
|
|
256
254
|
- **After `memory_add`**: call `memory_search` with a distinctive token from the stored text (a name, UUID, rare phrase — not a common word). Assert the new memory appears in the results. Only then tell the user it was saved.
|
|
257
|
-
- **After `conversation_add_message`**: call `conversation_get(include_messages=true)` with the returned `conversation_id`. Assert `message_count` > 0 and that the new message is in the returned list.
|
|
255
|
+
- **After `conversation_add_message`**: call `conversation_get(include_messages=true)` with the returned `conversation_id`. Assert `message_count` > 0 and that the new message is in the returned list. On a long conversation whose trace is too large for Langfuse, `conversation_get` returns `not_found` even though the write landed. Follow "Long-running conversations" above instead of re-posting or recreating the conversation.
|
|
256
|
+
- **After `artifact_put`**: operating contract 4 — the locally-computed SHA-256 must match the returned `content_hash` (a rate-limited or errored put carries **none**); read back important artifacts via `artifact_get` and compare bytes.
|
|
258
257
|
- **On verification failure**: tell the user the save did not succeed — do **not** claim it did. Include the verification-failure detail (empty search, missing message, HTTP error) so they can act — wrong datapack, scope mismatch, expired API key are the common causes.
|
|
259
258
|
|
|
260
259
|
### First-run connection test
|
|
@@ -276,24 +275,15 @@ On the first Meko tool call in a fresh session (no prior Meko tool call since pr
|
|
|
276
275
|
|
|
277
276
|
**Reporting.** This is user-visible — the whole point is to give the user concrete proof. On success: `"Meko connection OK (canary round-trip succeeded)"`. On failure, name the failing step and include the raw error: `"Meko canary failed at memory_add: <error>. Likely causes: wrong datapack, expired API key, server unreachable."`
|
|
278
277
|
|
|
279
|
-
##
|
|
278
|
+
## Budgeting calls
|
|
280
279
|
|
|
281
|
-
|
|
282
|
-
2. **datapack_id routing**: DB, RAG, and memory tools accept optional `datapack_id` (default datapack if omitted). `knowledgebase_search` is the exception: `datapack_id` is **required** there.
|
|
283
|
-
3. **agent_id is multi-agent**: Each client+project uses its own `agent_id` (shape `<client>:<repo-basename>`). Writes are attributed to `(datapack_id, user_id, agent_id)`. Personal **memory** reads (`memory_search`, `memory_get_all`) are NOT filtered by `agent_id` — one call returns all of your memories for this user across every agent, scoped to `(datapack_id, user_id)`. Empty/missing `agent_id` on a write lands in the `meko_agent` common bucket. `knowledgebase_search` ignores `agent_id` entirely and returns the team-shared knowledge on the datapack. See `tools-agent-id-conventions.md`.
|
|
284
|
-
4. **Personal memory vs. team-shared knowledge**: Un-promoted memories (`mem0_collection`) are scoped per-user — readable across all of your agents, but no other user can see them. With explicit confirmation, `memory_promote` moves exact memories into Shared Knowledge; the Cloud UI's Learnings tab is an alternative. Promoted content is visible to every datapack member (user_id filter stripped). `knowledgebase_search` is the MCP read path for both Shared Knowledge and uploaded documents. See `tools-memory-vs-conversation.md`.
|
|
285
|
-
5. **conversation_id IS the Langfuse trace ID**: every MCP tool call inside a conversation becomes a span under that trace. Observable in the Meko UI's Observe hub (`/observe-hub?project=<langfuse_pid>&session=<conversation_id>`) or directly from a datapack's Conversations tab via the **Open in Observe** button. See `tools-memory-vs-conversation.md`.
|
|
286
|
-
6. **Adding documents or growing a knowledge base is UI-only on Cloud today**: users upload files via Datapack → Actions → **Add Knowledge** (PDF/TXT/MD/JSON/MP4, 5MB each). The MCP ingestion tools are not available on Cloud. See `tools-rag-workflow.md`.
|
|
287
|
-
7. **Conversation dedup**: `conversation_add_message` supports seed-based deterministic trace IDs to prevent duplicates.
|
|
288
|
-
8. **Memory latencies are not cheap**: observed on prod 2026-05-07 — `memory_add` 12-21s/call (calls OpenAI), `memory_search` 2-6s/call. Budget accordingly.
|
|
289
|
-
9. **Known limitations**: see `tools-known-limitations.md` before attempting write operations on tools that appear in the catalog but aren't available on Cloud.
|
|
290
|
-
10. **Error recovery**: Connection errors are common with memory tools — see `tools-troubleshooting.md` for retry strategies and fallbacks.
|
|
280
|
+
`memory_add` takes ~10s for a one-line fact and ~20-30s for document-sized text; `memory_search` ~2-6s. Sustained bulk ingest throttles to roughly per-call latency — run large ingests as background jobs. `memory_search`, `knowledgebase_search`, and `memory_add` also draw from **lifetime per-user quotas** on Free/Standard tiers, and `context_search` and `conversation_add_message` on the Free tier, so budget latency *and* call count. `datapack_id` is optional on most tools (default datapack) but **required** on `knowledgebase_search`. See `tools-known-limitations.md`.
|
|
291
281
|
|
|
292
282
|
## Reference sections
|
|
293
283
|
|
|
294
284
|
| File | What it covers |
|
|
295
285
|
|------|---------------|
|
|
296
|
-
| `tools-overview.md` | Complete catalog of all
|
|
286
|
+
| `tools-overview.md` | Complete catalog of all 25 tools available in production, with decision tree |
|
|
297
287
|
| `tools-cookbook.md` | Per-tool examples with correct parameters, responses, and error cases |
|
|
298
288
|
| `tools-memory-vs-conversation.md` | When to use memory tools vs conversation tools |
|
|
299
289
|
| `tools-datapack-workflow.md` | Datapack lifecycle and datapack_id routing |
|
|
@@ -301,4 +291,4 @@ On the first Meko tool call in a fresh session (no prior Meko tool call since pr
|
|
|
301
291
|
| `tools-agent-id-conventions.md` | Naming rules and constraints for agent_id |
|
|
302
292
|
| `tools-conversation-dedup.md` | Seed-based trace deduplication |
|
|
303
293
|
| `tools-troubleshooting.md` | Error recovery, retry strategies, stuck pipeline diagnosis |
|
|
304
|
-
| `tools-known-limitations.md` |
|
|
294
|
+
| `tools-known-limitations.md` | Lifetime quotas, the `memory_get_all` window, `run_id` scoping, missing capabilities |
|
|
@@ -6,7 +6,7 @@ description: Maps reference files to their topics for the meko-mcp-tools skill
|
|
|
6
6
|
# Reference Sections
|
|
7
7
|
|
|
8
8
|
## Tool Selection & Catalog
|
|
9
|
-
- [tools-overview.md](tools-overview.md) — Complete catalog of all
|
|
9
|
+
- [tools-overview.md](tools-overview.md) — Complete catalog of all 25 tools available in production, with a decision tree
|
|
10
10
|
|
|
11
11
|
## Tool-Specific Guidance
|
|
12
12
|
- [tools-memory-vs-conversation.md](tools-memory-vs-conversation.md) — Decision framework: memory_add vs conversation_create/conversation_add_message
|
|
@@ -18,7 +18,7 @@ description: Maps reference files to their topics for the meko-mcp-tools skill
|
|
|
18
18
|
|
|
19
19
|
## Conventions & Deduplication
|
|
20
20
|
- [tools-agent-id-conventions.md](tools-agent-id-conventions.md) — agent_id naming rules, hyphen prohibition, and namespace isolation
|
|
21
|
-
- [tools-user-id-conventions.md](tools-user-id-conventions.md) —
|
|
21
|
+
- [tools-user-id-conventions.md](tools-user-id-conventions.md) — how the server resolves user_id from your credentials, and how it and agent_id scope memory
|
|
22
22
|
- [tools-conversation-dedup.md](tools-conversation-dedup.md) — Seed-based deterministic trace IDs for Langfuse deduplication
|
|
23
23
|
|
|
24
24
|
## Practical Usage
|
|
@@ -26,4 +26,4 @@ description: Maps reference files to their topics for the meko-mcp-tools skill
|
|
|
26
26
|
|
|
27
27
|
## Troubleshooting & Limitations
|
|
28
28
|
- [tools-troubleshooting.md](tools-troubleshooting.md) — Error recovery, retry strategies, stuck pipeline diagnosis
|
|
29
|
-
- [tools-known-limitations.md](tools-known-limitations.md) —
|
|
29
|
+
- [tools-known-limitations.md](tools-known-limitations.md) — Lifetime quotas, the `memory_get_all` window, `run_id` scoping, missing capabilities
|
|
@@ -14,9 +14,18 @@ Each memory is written under an `agent_id` (stored on the row, shown as the UI b
|
|
|
14
14
|
| Loose client name | Non-coding agents (Claude Desktop, generic MCP clients) where there's no project concept. | `claude_desktop` |
|
|
15
15
|
| `meko_agent` | Cross-project common bucket — facts any agent should see regardless of project (user identity, global preferences). The server stores empty/missing `agent_id` here automatically. | `meko_agent` |
|
|
16
16
|
|
|
17
|
-
**Discover the value at session start.** The SessionStart hook injects the chosen `agent_id` into the first-turn `additionalContext
|
|
17
|
+
**Discover the value at session start.** The SessionStart hook injects the chosen `agent_id` into the first-turn `additionalContext`. Project-scoped ids are derived by walking parents of the session cwd for `.git` and taking the repo-root basename; the walk stops at `$HOME`, so a git-tracked home directory does not claim every directory beneath it. Sessions outside any repo get the bare client name (`claude_code`), not a leaf basename.
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
Use the injected value verbatim — do not re-derive it. A resumed session, or one that re-fires SessionStart (`/clear`, `/compact`), keeps the bucket its conversation already belongs to, and `MEKO_AGENT_ID` overrides either, so the injected value is not always what a fresh derivation would produce. If the block is absent, ask the user rather than guessing from the raw cwd basename (sibling directories like `docs/` or `webapp/` in unrelated repos would collide).
|
|
20
|
+
|
|
21
|
+
MEKO-590 changed new coding-session ids from the cwd leaf to the repository
|
|
22
|
+
root. Existing ownership does not change in place: migration checkpoints and
|
|
23
|
+
Kiro session intents keep their persisted pre-MEKO-590 id, because the server
|
|
24
|
+
does not allow an existing conversation's owner to change. Datapack pins also
|
|
25
|
+
fall back to the old cwd-leaf filename until the user pins or clears again.
|
|
26
|
+
New sessions without persisted state use the repository-root id.
|
|
27
|
+
|
|
28
|
+
For genuinely cross-project facts ("the user's name is Alice", "the user prefers dark mode") write with `agent_id="meko_agent"` so their attribution clearly identifies the common cross-project bucket.
|
|
20
29
|
|
|
21
30
|
**Pick a value that matches the running client — don't invent another client's shape.** A Claude Desktop session that writes with `agent_id="claude_code"` (or `claude_code:something`) creates rows the UI will attribute to Claude Code — a misleading badge for both clients. Use the pattern from the table that matches the client you're actually running under.
|
|
22
31
|
|
|
@@ -37,14 +46,12 @@ Pre-existing data in real datapacks includes a mix of legacy shapes — `agent`,
|
|
|
37
46
|
|
|
38
47
|
Filter tuple: `(datapack_id, user_id)`. `agent_id` is **not** applied on memory reads.
|
|
39
48
|
|
|
40
|
-
- `user_id` is **always enforced**: you can only see memories you wrote (or
|
|
41
|
-
- `agent_id` does **not** filter results
|
|
42
|
-
|
|
43
|
-
Empirically verified 2026-07-23 on Cloud prod: memories written under two distinct `agent_id`s were both returned by a `memory_search` passing a third, never-written `agent_id` (and by one passing empty string).
|
|
49
|
+
- `user_id` is **always enforced**: you can only see memories you wrote (or content shared via promotion). One user cannot read another's un-promoted memories from MCP.
|
|
50
|
+
- `agent_id` does **not** filter results: a memory written under `agent_id="cursor:foo"` IS returned to a search passing any other value. It scopes only the call's trace. One call sees all of your agents' memories, including the `meko_agent` bucket — nothing to fan out.
|
|
44
51
|
|
|
45
52
|
### Personal conversation reads — `conversation_get`, `conversation_list`
|
|
46
53
|
|
|
47
|
-
- `conversation_get` — agent-owned. Filter tuple `(datapack_id, user_id, agent_id)`: pass the exact `agent_id` that created the conversation; a wrong value returns `agent_id_mismatch`.
|
|
54
|
+
- `conversation_get`, `conversation_add_message`, `conversation_update`, `conversation_delete` — agent-owned. Filter tuple `(datapack_id, user_id, agent_id)`: pass the exact `agent_id` that created the conversation; a wrong value returns `agent_id_mismatch`.
|
|
48
55
|
- `conversation_list` — **not** agent-filtered. It lists by `(datapack_id, user_id)` only; `agent_id` on the call is trace-attribution only (like memory reads), so one call returns the datapack's conversations for your user regardless of which agent created them.
|
|
49
56
|
|
|
50
57
|
### Team-shared reads — `knowledgebase_search`
|
|
@@ -63,7 +70,7 @@ The originating `agent_id` is preserved in each result's `metadata_filters.agent
|
|
|
63
70
|
memory_add(agent_id=X, text=...)
|
|
64
71
|
│
|
|
65
72
|
▼
|
|
66
|
-
|
|
73
|
+
memory_store ── personal memories, tagged (datapack, user, agent)
|
|
67
74
|
│
|
|
68
75
|
│ memory_promote (exact UUIDs + explicit confirmation)
|
|
69
76
|
│ or UI "Promote to Knowledge" (Learnings tab)
|
|
@@ -83,23 +90,23 @@ knowledgebase_search(agent_id=anything, query=...)
|
|
|
83
90
|
|
|
84
91
|
## When to use what — broad-query guidance
|
|
85
92
|
|
|
86
|
-
If the user asks "what do you know about X?":
|
|
87
|
-
|
|
88
|
-
1. **`memory_search(agent_id="<your agent_id>", query="X")`** — returns all of your personal memories for this user, across every `agent_id` (your project bucket, the `meko_agent` common bucket, and any other project's rows). One call is the whole personal surface — `agent_id` doesn't filter memory reads, so there's nothing to fan out.
|
|
89
|
-
2. **`knowledgebase_search(agent_id="<anything>", datapack_id="<datapack>", query="X")`** — returns team-shared knowledge. Useful when the answer may have been promoted by the user or a teammate.
|
|
90
|
-
|
|
91
|
-
Always tell the user what scope you searched, so they understand why the answer is or isn't there. Example wording: "I found this in your personal memories" vs. "I found this in your team's shared knowledge."
|
|
93
|
+
If the user asks "what do you know about X?": one `context_search` returns the whole personal memory surface (every `agent_id`, nothing to fan out), team-shared knowledge, and matching past-conversation turns in separate buckets. Tell the user which surface each finding came from. Conversation hits can come from other users on the datapack.
|
|
92
94
|
|
|
93
95
|
## Optional sub-scoping
|
|
94
96
|
|
|
95
97
|
Optional parameters can narrow a call further:
|
|
96
|
-
- `
|
|
97
|
-
|
|
98
|
+
- `run_id` — on `memory_search` and `memory_delete_all` it is a **read/delete
|
|
99
|
+
filter** on the row's `meko_conversation_id`, so pass a *conversation id* to
|
|
100
|
+
scope the call to that conversation (consistent scoping landed in
|
|
101
|
+
MEKO-473/MEKO-474, #271). On `memory_add` it is Langfuse trace metadata only
|
|
102
|
+
and is not persisted as the conversation id, so scope writes with
|
|
103
|
+
`conversation_id` — a row written with `memory_add(run_id=X)` is not findable
|
|
104
|
+
via `memory_search(run_id=X)`.
|
|
98
105
|
|
|
99
|
-
|
|
106
|
+
Accepted by `memory_add`, `memory_search`, `memory_get_all`, `memory_delete_all`, and `conversation_create`. `memory_get_all` ignores it. No tool takes a `user_id` argument; the server resolves it from your credentials (see `tools-user-id-conventions.md`).
|
|
100
107
|
|
|
101
108
|
## Things I checked and found in-data on real Cloud datapacks
|
|
102
109
|
|
|
103
110
|
- `agent_id="agent"` appears on many legacy rows — it was the previous canonical constant. New writes should use the schema in the table above; memory reads still return the legacy rows.
|
|
104
|
-
- Memory Summary UI (`/datapacks/<name>/memory-summary`) is agent-id-agnostic — shows every row in the datapack, renders the stored `agent_id` as a badge. `memory_search` and `conversation_list` are likewise agent-agnostic (they return all your agents' rows for the user);
|
|
111
|
+
- Memory Summary UI (`/datapacks/<name>/memory-summary`) is agent-id-agnostic — shows every row in the datapack, renders the stored `agent_id` as a badge. `memory_search` and `conversation_list` are likewise agent-agnostic (they return all your agents' rows for the user); the conversation calls (`conversation_get`, `conversation_add_message`, `conversation_update`, `conversation_delete`) enforce `agent_id` (agent ownership), and `memory_delete_all` deletes only the passed `agent_id`'s bucket.
|
|
105
112
|
- Subagents spawned via the `Agent` tool in Claude Code do not automatically inherit the parent's `agent_id`. The parent must inject it into the spawn prompt. See the SKILL.md "When spawning subagents" section.
|