@yugabytedb/meko-mcp 1.2.0 → 2.0.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 +28 -19
- package/assets/hooks-handlers/before-submit-prompt.sh +2 -2
- package/assets/hooks-handlers/lib/capture.js +209 -144
- package/assets/hooks-handlers/lib/checkpoint-timer.js +23 -11
- package/assets/hooks-handlers/session-start.sh +6 -2
- package/assets/scripts/meko-statusline.sh +119 -0
- package/assets/scripts/package-desktop-skill.sh +27 -24
- package/assets/skills/meko-mcp-tools/SKILL.md +42 -50
- package/assets/skills/meko-mcp-tools/references/_sections.md +1 -1
- package/assets/skills/meko-mcp-tools/references/tools-cookbook.md +75 -150
- package/assets/skills/meko-mcp-tools/references/tools-datapack-workflow.md +30 -36
- package/assets/skills/meko-mcp-tools/references/tools-known-limitations.md +6 -22
- package/assets/skills/meko-mcp-tools/references/tools-memory-vs-conversation.md +9 -8
- package/assets/skills/meko-mcp-tools/references/tools-overview.md +35 -42
- package/assets/skills/meko-mcp-tools/references/tools-rag-workflow.md +28 -92
- package/assets/skills/meko-mcp-tools/references/tools-scope-permissions.md +5 -9
- package/assets/skills/meko-mcp-tools/references/tools-troubleshooting.md +1 -81
- package/assets/skills/meko-mcp-tools-desktop/SKILL.md +100 -107
- package/assets/skills/meko-mcp-tools-desktop/desktop/README.md +41 -11
- package/assets/skills/meko-mcp-tools-desktop/references/_sections.md +1 -1
- package/assets/skills/meko-mcp-tools-desktop/references/tools-cookbook.md +71 -150
- package/assets/skills/meko-mcp-tools-desktop/references/tools-known-limitations.md +12 -18
- package/assets/skills/meko-mcp-tools-desktop/references/tools-memory-vs-conversation.md +12 -15
- package/assets/skills/meko-mcp-tools-desktop/references/tools-overview.md +35 -42
- package/assets/skills/meko-mcp-tools-desktop/references/tools-rag-workflow.md +28 -92
- package/assets/skills/meko-mcp-tools-desktop/references/tools-scope-permissions.md +5 -9
- package/assets/skills/meko-mcp-tools-desktop/references/tools-troubleshooting.md +1 -81
- package/assets/skills/meko-select-datapack-desktop/SKILL.md +198 -0
- package/assets/skills/meko-select-datapack-desktop/references/cookbook.md +121 -0
- package/assets/skills/meko-select-datapack-desktop/references/troubleshooting.md +66 -0
- package/bin/create-meko-setup.mjs +29 -0
- package/lib/clients/claude-code.mjs +133 -6
- package/lib/clients/claude-desktop.mjs +37 -12
- package/lib/clients/codex.mjs +306 -5
- package/lib/clients/common.mjs +41 -1
- package/lib/clients/cursor.mjs +75 -19
- package/lib/config.mjs +26 -0
- package/lib/installer.mjs +24 -0
- package/lib/mcp-transport.mjs +5 -0
- package/lib/validate.mjs +0 -1
- package/package.json +1 -1
- package/scripts/bundle-assets.mjs +8 -0
- package/assets/skills/meko-mcp-tools/references/tools-db-query-patterns.md +0 -38
- package/assets/skills/meko-mcp-tools/references/tools-write-guardrails.md +0 -30
|
@@ -13,10 +13,14 @@ TRANSCRIPT_PATH="$(printf '%s' "$HOOK_INPUT" | node -e '
|
|
|
13
13
|
process.stdout.write(p);
|
|
14
14
|
' 2>/dev/null)"
|
|
15
15
|
|
|
16
|
-
# Spawn background checkpoint timer (periodic capture without interrupting the agent)
|
|
16
|
+
# Spawn background checkpoint timer (periodic capture without interrupting the agent).
|
|
17
|
+
# Send the daemon's stderr to a log file instead of /dev/null so startup
|
|
18
|
+
# failures and crashes are diagnosable; stdout is still discarded.
|
|
17
19
|
if [ -n "$TRANSCRIPT_PATH" ] && [ -f "$TRANSCRIPT_PATH" ]; then
|
|
20
|
+
MEKO_LOG_DIR="${MEKO_WATERMARK_DIR:-$HOME/.claude/meko-capture}"
|
|
21
|
+
mkdir -p "$MEKO_LOG_DIR"
|
|
18
22
|
nohup node "$SCRIPT_DIR/lib/checkpoint-timer.js" "$TRANSCRIPT_PATH" \
|
|
19
|
-
</dev/null >/dev/null 2
|
|
23
|
+
</dev/null >/dev/null 2>>"$MEKO_LOG_DIR/timer.log" &
|
|
20
24
|
disown 2>/dev/null || true
|
|
21
25
|
fi
|
|
22
26
|
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# meko-statusline.sh — Claude Code statusline contribution showing the active Meko datapack pin.
|
|
3
|
+
#
|
|
4
|
+
# Composable: if --inner-cmd is provided (or MEKO_INNER_STATUSLINE env var), runs it first and
|
|
5
|
+
# appends our suffix. So a user with an existing statusLine doesn't lose it.
|
|
6
|
+
#
|
|
7
|
+
# Usage in ~/.claude/settings.json (after installer wires it):
|
|
8
|
+
# { "statusLine": { "type": "command", "command": "$HOME/.claude/meko-statusline.sh --inner-cmd <existing-cmd>" } }
|
|
9
|
+
#
|
|
10
|
+
# Or, if you maintain the inner command separately, set MEKO_INNER_STATUSLINE=<cmd> in env.
|
|
11
|
+
#
|
|
12
|
+
# Outputs nothing (empty string) when no pin is set, so the indicator is invisible until you pin.
|
|
13
|
+
# The output goes on stdout — Claude Code displays it as-is, supporting ANSI color codes if you
|
|
14
|
+
# wrap the suffix.
|
|
15
|
+
#
|
|
16
|
+
# Reads JSON from stdin (Claude Code passes session metadata) and forwards it verbatim to the inner
|
|
17
|
+
# command. The inner command's stdout is printed first, then our suffix.
|
|
18
|
+
|
|
19
|
+
set -u
|
|
20
|
+
|
|
21
|
+
INNER_CMD=""
|
|
22
|
+
if [[ "${1:-}" == "--inner-cmd" && -n "${2:-}" ]]; then
|
|
23
|
+
INNER_CMD="$2"
|
|
24
|
+
elif [[ -n "${MEKO_INNER_STATUSLINE:-}" ]]; then
|
|
25
|
+
INNER_CMD="$MEKO_INNER_STATUSLINE"
|
|
26
|
+
fi
|
|
27
|
+
|
|
28
|
+
# Buffer stdin once so we can pipe the same JSON to both the inner command and our derivation.
|
|
29
|
+
STDIN_PAYLOAD=""
|
|
30
|
+
if [[ -p /dev/stdin || ! -t 0 ]]; then
|
|
31
|
+
STDIN_PAYLOAD="$(cat)"
|
|
32
|
+
fi
|
|
33
|
+
|
|
34
|
+
# --- Inner command first (preserves any pre-existing statusline content) ---
|
|
35
|
+
|
|
36
|
+
if [[ -n "$INNER_CMD" ]]; then
|
|
37
|
+
if [[ -n "$STDIN_PAYLOAD" ]]; then
|
|
38
|
+
INNER_OUT="$(printf '%s' "$STDIN_PAYLOAD" | eval "$INNER_CMD" 2>/dev/null || true)"
|
|
39
|
+
else
|
|
40
|
+
INNER_OUT="$(eval "$INNER_CMD" 2>/dev/null || true)"
|
|
41
|
+
fi
|
|
42
|
+
# Strip a single trailing newline so our suffix appears on the same line.
|
|
43
|
+
INNER_OUT="${INNER_OUT%$'\n'}"
|
|
44
|
+
printf '%s' "$INNER_OUT"
|
|
45
|
+
fi
|
|
46
|
+
|
|
47
|
+
# --- Derive agent_id from cwd ---
|
|
48
|
+
#
|
|
49
|
+
# Mirrors deriveAgentId() in skills/hooks-handlers/lib/capture.js:51-65:
|
|
50
|
+
# - basename of cwd, lowercased
|
|
51
|
+
# - non-[a-z0-9-]+ → '-'
|
|
52
|
+
# - trim leading/trailing '-'
|
|
53
|
+
# - max 64 chars
|
|
54
|
+
# - prefix with 'claude_code:'
|
|
55
|
+
#
|
|
56
|
+
# Then mirrors datapackPinSlug() in capture.js:341-348:
|
|
57
|
+
# - non-[A-Za-z0-9._-]+ → '_'
|
|
58
|
+
# - trim leading/trailing '_'
|
|
59
|
+
#
|
|
60
|
+
# Prefer cwd from the JSON stdin payload (Claude Code's session metadata format), falling back
|
|
61
|
+
# to PWD if stdin was empty / not piped.
|
|
62
|
+
|
|
63
|
+
CWD="$PWD"
|
|
64
|
+
if [[ -n "$STDIN_PAYLOAD" ]]; then
|
|
65
|
+
# Best-effort extraction without requiring jq. Look for "cwd":"…" first; fall back to "workspace":{"current_dir":"…"}.
|
|
66
|
+
# Isolate the exact key/value pair with grep -oE before extracting so a greedy `.*` can't grab a
|
|
67
|
+
# different key that merely ends in `cwd`/`current_dir` earlier on the same line.
|
|
68
|
+
EXTRACTED="$(printf '%s' "$STDIN_PAYLOAD" | grep -oE '"cwd"[[:space:]]*:[[:space:]]*"[^"]+"' | sed -E 's/.*"([^"]+)"$/\1/' | head -n 1)"
|
|
69
|
+
if [[ -z "$EXTRACTED" ]]; then
|
|
70
|
+
EXTRACTED="$(printf '%s' "$STDIN_PAYLOAD" | grep -oE '"current_dir"[[:space:]]*:[[:space:]]*"[^"]+"' | sed -E 's/.*"([^"]+)"$/\1/' | head -n 1)"
|
|
71
|
+
fi
|
|
72
|
+
if [[ -n "$EXTRACTED" ]]; then
|
|
73
|
+
CWD="$EXTRACTED"
|
|
74
|
+
fi
|
|
75
|
+
fi
|
|
76
|
+
|
|
77
|
+
# MEKO_AGENT_ID overrides the cwd-derived id, matching resolveSessionAgentId() in
|
|
78
|
+
# capture.js (the env override wins verbatim when non-empty).
|
|
79
|
+
if [[ -n "${MEKO_AGENT_ID:-}" ]]; then
|
|
80
|
+
AGENT_ID="$MEKO_AGENT_ID"
|
|
81
|
+
else
|
|
82
|
+
BASENAME="$(basename "$CWD")"
|
|
83
|
+
PROJECT_SLUG="$(printf '%s' "$BASENAME" | tr '[:upper:]' '[:lower:]' | sed -E 's/[^a-z0-9-]+/-/g; s/^-+|-+$//g')"
|
|
84
|
+
PROJECT_SLUG="${PROJECT_SLUG:0:64}"
|
|
85
|
+
|
|
86
|
+
if [[ -z "$PROJECT_SLUG" || "$PROJECT_SLUG" == "-" ]]; then
|
|
87
|
+
AGENT_ID="claude_code"
|
|
88
|
+
else
|
|
89
|
+
AGENT_ID="claude_code:$PROJECT_SLUG"
|
|
90
|
+
fi
|
|
91
|
+
fi
|
|
92
|
+
|
|
93
|
+
PIN_SLUG="$(printf '%s' "$AGENT_ID" | sed -E 's/[^A-Za-z0-9._-]+/_/g; s/^_+|_+$//g')"
|
|
94
|
+
# Match datapackPinSlug() in capture.js: an empty slug falls back to the common bucket
|
|
95
|
+
# (meko_agent), so both components look for the same pin file.
|
|
96
|
+
if [[ -z "$PIN_SLUG" ]]; then
|
|
97
|
+
PIN_SLUG="meko_agent"
|
|
98
|
+
fi
|
|
99
|
+
PIN_FILE="${MEKO_WATERMARK_DIR:-$HOME/.claude/meko-capture}/pin-${PIN_SLUG}.json"
|
|
100
|
+
|
|
101
|
+
# --- Read the pin file and append the suffix if a valid pin is present ---
|
|
102
|
+
|
|
103
|
+
if [[ -f "$PIN_FILE" ]]; then
|
|
104
|
+
# grep -oE isolates the exact "datapack_name":"…" pair before extracting, so a
|
|
105
|
+
# greedy `.*` can't grab a different key that merely ends in datapack_name.
|
|
106
|
+
PIN_NAME="$(grep -oE '"datapack_name"[[:space:]]*:[[:space:]]*"[^"]+"' "$PIN_FILE" | sed -E 's/.*"([^"]+)"$/\1/' | head -n 1)"
|
|
107
|
+
if [[ -n "$PIN_NAME" ]]; then
|
|
108
|
+
SUFFIX="Meko: $PIN_NAME"
|
|
109
|
+
# Add a separator only if the inner command produced output.
|
|
110
|
+
if [[ -n "${INNER_OUT:-}" ]]; then
|
|
111
|
+
printf ' \xe2\x80\xa2 %s' "$SUFFIX"
|
|
112
|
+
else
|
|
113
|
+
printf '%s' "$SUFFIX"
|
|
114
|
+
fi
|
|
115
|
+
fi
|
|
116
|
+
fi
|
|
117
|
+
|
|
118
|
+
# Always finish with a newline so subsequent shell renders cleanly.
|
|
119
|
+
printf '\n'
|
|
@@ -1,36 +1,39 @@
|
|
|
1
1
|
#!/usr/bin/env bash
|
|
2
|
-
# Package
|
|
2
|
+
# Package the Claude Desktop skills as importable .skill files.
|
|
3
3
|
# Usage: bash scripts/package-desktop-skill.sh
|
|
4
|
-
#
|
|
4
|
+
# Outputs: meko-mcp-tools-desktop.skill and meko-select-datapack-desktop.skill
|
|
5
5
|
|
|
6
6
|
set -euo pipefail
|
|
7
7
|
|
|
8
8
|
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
|
9
9
|
SKILLS_ROOT="$SCRIPT_DIR/../skills"
|
|
10
|
-
|
|
11
|
-
OUTPUT="$SCRIPT_DIR/../$SKILL_NAME.skill"
|
|
10
|
+
SKILL_NAMES=("meko-mcp-tools-desktop" "meko-select-datapack-desktop")
|
|
12
11
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
12
|
+
for SKILL_NAME in "${SKILL_NAMES[@]}"; do
|
|
13
|
+
if [ ! -d "$SKILLS_ROOT/$SKILL_NAME" ]; then
|
|
14
|
+
echo "Error: Skill directory not found at $SKILLS_ROOT/$SKILL_NAME" >&2
|
|
15
|
+
exit 1
|
|
16
|
+
fi
|
|
17
17
|
|
|
18
|
-
if [ ! -f "$SKILLS_ROOT/$SKILL_NAME/SKILL.md" ]; then
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
fi
|
|
18
|
+
if [ ! -f "$SKILLS_ROOT/$SKILL_NAME/SKILL.md" ]; then
|
|
19
|
+
echo "Error: SKILL.md not found in $SKILLS_ROOT/$SKILL_NAME/" >&2
|
|
20
|
+
exit 1
|
|
21
|
+
fi
|
|
22
|
+
done
|
|
22
23
|
|
|
23
|
-
|
|
24
|
-
|
|
24
|
+
for SKILL_NAME in "${SKILL_NAMES[@]}"; do
|
|
25
|
+
OUTPUT="$SCRIPT_DIR/../$SKILL_NAME.skill"
|
|
26
|
+
rm -f "$OUTPUT"
|
|
25
27
|
|
|
26
|
-
# Package skill + references (exclude OS artifacts and desktop README)
|
|
27
|
-
cd "$SKILLS_ROOT"
|
|
28
|
-
zip -r "$OUTPUT" \
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
28
|
+
# Package skill + references (exclude OS artifacts and desktop README)
|
|
29
|
+
cd "$SKILLS_ROOT"
|
|
30
|
+
zip -r "$OUTPUT" \
|
|
31
|
+
"$SKILL_NAME/SKILL.md" \
|
|
32
|
+
"$SKILL_NAME/references/" \
|
|
33
|
+
-x "*.DS_Store" "*__pycache__*"
|
|
32
34
|
|
|
33
|
-
echo "Created $OUTPUT ($(du -h "$OUTPUT" | cut -f1))"
|
|
34
|
-
echo ""
|
|
35
|
-
echo "Contents:"
|
|
36
|
-
unzip -l "$OUTPUT" | grep -E "^\s+[0-9]" | grep -v "files$"
|
|
35
|
+
echo "Created $OUTPUT ($(du -h "$OUTPUT" | cut -f1))"
|
|
36
|
+
echo ""
|
|
37
|
+
echo "Contents:"
|
|
38
|
+
unzip -l "$OUTPUT" | grep -E "^\s+[0-9]" | grep -v "files$"
|
|
39
|
+
done
|
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: meko-mcp-tools
|
|
3
|
-
description: Behavioral guide for AI agents using Meko MCP tools. Triggers when calling MCP tools, storing memories, persisting knowledge, managing datapacks, or
|
|
3
|
+
description: Behavioral guide for AI agents using Meko MCP tools. Triggers when calling MCP tools, storing memories, persisting knowledge, managing datapacks, or searching shared knowledge bases through Meko.
|
|
4
4
|
license: MIT
|
|
5
5
|
metadata:
|
|
6
6
|
author: Meko
|
|
7
|
-
version: "
|
|
8
|
-
tags: mcp,
|
|
7
|
+
version: "3.0.0"
|
|
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 22 MCP tools.
|
|
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 (`memory_search`, `knowledgebase_search`), and the **few** save cases automatic extraction cannot reach. Details below.
|
|
14
16
|
|
|
15
17
|
## What Meko enables
|
|
16
18
|
|
|
@@ -54,15 +56,14 @@ See `tools-agent-id-conventions.md` for the full model, including how promotion
|
|
|
54
56
|
|
|
55
57
|
Some pre-existing rows in real datapacks use the older `agent_id="agent"` constant or other ad-hoc shapes (`claude_code`, `cursor:<slug>`). They remain readable — query them with `agent_id="agent"` explicitly. New writes should follow the schema above.
|
|
56
58
|
|
|
57
|
-
## Critical: Use Meko
|
|
59
|
+
## Critical: Use Meko, not local storage
|
|
58
60
|
|
|
59
|
-
**
|
|
61
|
+
**Meko is the memory store — never write memories to local files, markdown notes, or any file-based memory system.** Meko's memory is persistent across all agents, sessions, and team members; local files are not. On Claude Code, memory reaches Meko two ways, and neither is a local file:
|
|
60
62
|
|
|
61
|
-
-
|
|
62
|
-
-
|
|
63
|
-
- Conversation worth preserving → call `conversation_create`, NOT save to a local log
|
|
63
|
+
- **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.
|
|
64
|
+
- **Explicit `memory_add`** (the narrow path) — only for the cases extraction can't reach (see "When to call memory_add" below).
|
|
64
65
|
|
|
65
|
-
If a Meko
|
|
66
|
+
To recall, call `memory_search` on the MCP server, NOT read local files. If a Meko read/write call fails, you may fall back to local storage and tell the user — but Meko is always the first choice.
|
|
66
67
|
|
|
67
68
|
## When spawning subagents
|
|
68
69
|
|
|
@@ -112,49 +113,38 @@ If the inherited block is **absent**, the subagent MUST NOT guess — see the se
|
|
|
112
113
|
|
|
113
114
|
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.
|
|
114
115
|
|
|
115
|
-
## Core principle:
|
|
116
|
+
## Core principle: capture is automatic — recall, don't re-store
|
|
116
117
|
|
|
117
|
-
**
|
|
118
|
+
Meko is your long-term memory, but on Claude Code you do **not** build it by hand. The hooks capture every turn of this session and the server extracts durable memories from them automatically. **A fact the user states in conversation — name, role, preferences, org conventions, corrections, casual asides — is already saved. Calling `memory_add` for it just duplicates what extraction stored.** (Verified empirically: the server extracts conversationally-stated facts verbatim, including multi-fact turns and precise multi-clause facts.)
|
|
118
119
|
|
|
119
|
-
|
|
120
|
+
So your Meko reflexes are:
|
|
120
121
|
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
| User states a preference ("I prefer dark mode", "always use Python") | Store as personal preference | `memory_add` |
|
|
125
|
-
| User shares org convention ("we write in Go", "our standard is X") | Store as organizational memory | `memory_add` |
|
|
126
|
-
| User teaches domain knowledge ("Meko traces are decision traces") | Store as memory; consider suggesting they promote it to Shared Knowledge from the Learnings tab | `memory_add` |
|
|
127
|
-
| User corrects your behavior ("don't do X, do Y instead") | Store the correction as a learning | `memory_add` |
|
|
128
|
-
| User asks "what do you know about X?" | Three-call sweep: your project's memories, then the cross-project common bucket, then team-shared knowledge | `memory_search(agent_id=<yours>)` → `memory_search(agent_id="meko_agent")` → `knowledgebase_search` |
|
|
129
|
-
| User asks "what do we (as a team) know about X?" or about uploaded documents | Query the team's Shared Knowledge directly | `knowledgebase_search` (returns uploaded docs + promoted memories) |
|
|
130
|
-
| Session produced a valuable multi-turn exchange | Preserve the full conversation | `conversation_create` + `conversation_add_message` |
|
|
131
|
-
| Significant learnings accumulated during session | Offer to persist key takeaways; remind the user they can promote important ones to Shared Knowledge from the Cloud UI | Summarize and propose `memory_add` calls |
|
|
132
|
-
| User provides structured/tabular data (CSV, data dictionary) | Not natively supported via MCP on Cloud today — `db_run_write_query` returns `{"error": "not_available"}`. Store the key facts as memories or point the user at the UI's knowledge-base upload for file form | `memory_add` for facts, UI "Add Knowledge" for files |
|
|
133
|
-
| 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). The MCP ingestion tools are not available on Cloud. | UI only |
|
|
122
|
+
1. **Recall first.** When the user asks what's known, or before you act on something they may have an opinion about, search — don't assume.
|
|
123
|
+
2. **Save only what capture can't reach** (the three narrow cases below).
|
|
124
|
+
3. **Never** re-store a fact the user just said. **Never** write memories to local files.
|
|
134
125
|
|
|
135
|
-
###
|
|
126
|
+
### When the user shares information
|
|
136
127
|
|
|
137
|
-
|
|
128
|
+
| Signal in conversation | What to do |
|
|
129
|
+
|---|---|
|
|
130
|
+
| User states a fact about themselves, their team, tools, or preferences | **Nothing — automatic capture + extraction stores it.** Just answer. |
|
|
131
|
+
| User corrects your behavior or negates a prior fact ("actually, we use Nomad now") | The new fact is captured automatically, but extraction is **additive** — it does not remove the old one. If a stale, contradicted memory must not survive, `memory_search` for it and `memory_update` / `memory_delete_by_id`. |
|
|
132
|
+
| User explicitly says "remember this" / "save this to memory" | `memory_add` (verbatim). This is the clearest explicit-save case. |
|
|
133
|
+
| A durable fact appears only in YOUR output or a tool result, never in the user's words | `memory_add`. Extraction reads only the **user** turn, so facts you derive or a tool surfaces are never captured otherwise. |
|
|
134
|
+
| User asks "what do you know about X?" | Three-call sweep: `memory_search(agent_id=<yours>)` → `memory_search(agent_id="meko_agent")` → `knowledgebase_search`. |
|
|
135
|
+
| User asks "what do we (as a team) know about X?" or about uploaded documents | `knowledgebase_search` (returns uploaded docs + promoted memories). |
|
|
136
|
+
| 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. |
|
|
137
|
+
| 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. |
|
|
138
138
|
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
│ files via the UI's Datapack → Actions → Add Knowledge flow
|
|
149
|
-
├── A correction or learning ("don't do X", "always do Y")
|
|
150
|
-
│ → memory_add — behavioral feedback
|
|
151
|
-
├── Full conversation worth preserving (multi-turn, reasoning traces)
|
|
152
|
-
│ → conversation_create + conversation_add_message — verbatim
|
|
153
|
-
└── Structured/tabular data (CSV rows, schemas, data dictionaries)
|
|
154
|
-
→ Not MCP-supported on Cloud today (db_run_write_query returns
|
|
155
|
-
{"error": "not_available"}). Extract key facts to memory_add
|
|
156
|
-
or tell the user this isn't a Cloud feature yet.
|
|
157
|
-
```
|
|
139
|
+
### When to call memory_add (the whole list)
|
|
140
|
+
|
|
141
|
+
Automatic capture handles the rest, so explicit `memory_add` is reserved for exactly three cases:
|
|
142
|
+
|
|
143
|
+
1. **Explicit request** — the user says "remember this" / "save this."
|
|
144
|
+
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).
|
|
145
|
+
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).
|
|
146
|
+
|
|
147
|
+
When you do call it, store the fact verbatim in the user's own words; do not summarize.
|
|
158
148
|
|
|
159
149
|
## Automatic conversation capture
|
|
160
150
|
|
|
@@ -203,9 +193,11 @@ If a relevant feedback memory exists (e.g., "always ask before deleting content"
|
|
|
203
193
|
In the examples below, `<your-agent-id>` means the value the SessionStart hook injected into `additionalContext` — for Claude Code, something like `claude_code:meko-mcp-server`. Not the literal string `"<your-agent-id>"`.
|
|
204
194
|
|
|
205
195
|
### memory_add — correct call pattern
|
|
196
|
+
|
|
197
|
+
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:
|
|
206
198
|
```
|
|
207
199
|
memory_add(scope="write",
|
|
208
|
-
text="
|
|
200
|
+
text="Remember: deploy scripts must be run from the repo root, never a subdir",
|
|
209
201
|
agent_id="<your-agent-id>",
|
|
210
202
|
conversation_id="<session_conversation_id>")
|
|
211
203
|
```
|
|
@@ -276,7 +268,7 @@ On the first Meko tool call in a fresh session (no prior Meko tool call since pr
|
|
|
276
268
|
|
|
277
269
|
## Key concepts
|
|
278
270
|
|
|
279
|
-
1. **
|
|
271
|
+
1. **22 tools in 5 groups**: Memory (8), Conversation (6), Knowledge Base (1 — `knowledgebase_search`), Datapack (5), Artifacts (2 — `artifact_put`, `artifact_get`). KB ingestion is UI-only (Datapack → Actions → Add Knowledge); raw SQL is not exposed. See `tools-overview.md`.
|
|
280
272
|
2. **Scope hierarchy**: `read < write < admin` — every tool validates scope at entry. Only three valid values: `"read"`, `"write"`, `"admin"`. Using anything else (e.g., `"all"`) will fail. Tool docstrings sometimes say `"Pass 'admin'"` but the code only requires `"read"` or `"write"` — use the minimum the code actually enforces.
|
|
281
273
|
3. **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.
|
|
282
274
|
4. **agent_id is multi-agent**: Each client+project uses its own `agent_id` (shape `<client>:<repo-basename>`). Writes are scoped to `(datapack_id, user_id, agent_id)`. Personal reads (`memory_search`, `memory_get_all`) filter strictly on this tuple. Empty/missing `agent_id` lands in the `meko_agent` common bucket — use it explicitly for cross-project facts. `knowledgebase_search` ignores `agent_id` entirely and returns the team-shared knowledge on the datapack. See `tools-agent-id-conventions.md`.
|
|
@@ -292,7 +284,7 @@ On the first Meko tool call in a fresh session (no prior Meko tool call since pr
|
|
|
292
284
|
|
|
293
285
|
| File | What it covers |
|
|
294
286
|
|------|---------------|
|
|
295
|
-
| `tools-overview.md` | Complete catalog of all
|
|
287
|
+
| `tools-overview.md` | Complete catalog of all 22 tools with decision tree |
|
|
296
288
|
| `tools-cookbook.md` | Per-tool examples with correct parameters, responses, and error cases |
|
|
297
289
|
| `tools-memory-vs-conversation.md` | When to use memory tools vs conversation tools |
|
|
298
290
|
| `tools-datapack-workflow.md` | Datapack lifecycle and datapack_id routing |
|
|
@@ -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 22 tools 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
|