From 0757e1818e0260fe12dc6b7e61fb09ea972454f6 Mon Sep 17 00:00:00 2001 From: Mohammad Lareb Zafar Date: Sat, 5 Dec 2026 17:30:08 +0000 Subject: [PATCH] The mentor skill's reference names the read that lists differing definitions conflicts.list never lists two definitions of one name, and it was the only read the reference row "the namespace holds facts that disagree" named. The row gains "two definitions of one name: memory.definitions.disputes (via loom_op)", an op no MCP toolset lists. A unit test reads the mentor skill's SKILL.md and reference.md: every op they name is in the registry, and a loom_op call that names memory.definitions.disputes is routed to the op on a read-only connection. Both plugin manifests take 1.2.189. Signed-off-by: Mohammad Lareb Zafar Co-Authored-By: Claude Fable 5.2 --- .../.claude-plugin/plugin.json | 2 +- .../skills/loom-mentor/reference.md | 2 +- .../codex-plugin/.codex-plugin/plugin.json | 2 +- .../skills/loom-mentor/reference.md | 2 +- tests/unit/test_agent_instructions.py | 36 +++++++++++++++++++ 5 files changed, 40 insertions(+), 4 deletions(-) diff --git a/integrations/claude-code-plugin/.claude-plugin/plugin.json b/integrations/claude-code-plugin/.claude-plugin/plugin.json index 3025c9b0e39..ef26da16a07 100644 --- a/integrations/claude-code-plugin/.claude-plugin/plugin.json +++ b/integrations/claude-code-plugin/.claude-plugin/plugin.json @@ -1,7 +1,7 @@ { "name": "loom", "displayName": "ClickHouse Loom", - "version": "1.2.187", + "version": "1.2.189", "description": "Shared long-term memory and code intelligence for Claude Code, self-hosted on ClickHouse. MCP tools to save and recall decisions, preferences and corrections across sessions and teammates; lifecycle hooks that capture each session with no model call; a code index that answers where-is, who-calls and blast-radius questions with line-accurate units instead of whole-file reads.", "author": { "name": "ClickHouse" diff --git a/integrations/claude-code-plugin/skills/loom-mentor/reference.md b/integrations/claude-code-plugin/skills/loom-mentor/reference.md index 574c0773fb7..55eb764d034 100644 --- a/integrations/claude-code-plugin/skills/loom-mentor/reference.md +++ b/integrations/claude-code-plugin/skills/loom-mentor/reference.md @@ -37,7 +37,7 @@ hint to the user unless it changes what you are about to do. | know before deciding what the store already holds | `context.pack` once at session start (working memory, profile, relevant memories, procedures); `memory.search` / `loom_search` before a decision; `memory.brief` to orient on one question | writing without reading | | a `memory.get` says `found: false` | `memory.search` (by meaning), `memory.list prefix=` (the siblings); a moved key answers with `canonical_key` — pass `follow=true` | inventing the key again | | a write came back with `duplicate_of` or `conflict` | read the named row (`memory.get`, `memory.related`), revise THAT key, or `memory.link supersedes` if yours replaces it; a `conflict` → tell the user both values (`loom-memory`) | writing a third copy | -| the namespace holds facts that disagree | `conflicts.list` (over HTTP/SDK; the dashboard's Review queue) → `conflicts.resolve`; search penalises conflicted rows until then | leaving them | +| the namespace holds facts that disagree | `conflicts.list` (over HTTP/SDK; the dashboard's Review queue) → `conflicts.resolve`; search penalises conflicted rows until then; two definitions of one name: `memory.definitions.disputes` (via `loom_op`) | leaving them | | follow what is connected to an entity | `facts.traverse` from a seed entity, `facts.path` between two names (via loom_op), `memory.related` for a row's neighbours | a chain of searches | | do a piece of work whose outcome should grade the memories it used | `run.begin` before, its `run_id` on writes (`memory.set`, `observe.record`; reads carry the session's run), `run.complete(memories_used=[…], outcome=…)` after — callable via `loom_op` | nothing; the store cannot tell which memories helped | | make a decision that a future session should be able to check | `decision.record` (scenario, options, choice), later `decision.outcome`; `decision.precedents` before a similar decision — callable via `loom_op` | a memory row that says "we decided X" | diff --git a/integrations/codex-plugin/.codex-plugin/plugin.json b/integrations/codex-plugin/.codex-plugin/plugin.json index 58c8777c8af..c361cc263db 100644 --- a/integrations/codex-plugin/.codex-plugin/plugin.json +++ b/integrations/codex-plugin/.codex-plugin/plugin.json @@ -1,6 +1,6 @@ { "name": "loom", - "version": "1.2.187", + "version": "1.2.189", "description": "Shared long-term memory and code intelligence for Codex, self-hosted on ClickHouse. MCP tools to save and recall decisions, preferences and corrections across sessions and teammates; lifecycle hooks that capture each session with no model call; a code index that answers where-is, who-calls and blast-radius questions with line-accurate units instead of whole-file reads.", "author": { "name": "ClickHouse" diff --git a/integrations/codex-plugin/skills/loom-mentor/reference.md b/integrations/codex-plugin/skills/loom-mentor/reference.md index 574c0773fb7..55eb764d034 100644 --- a/integrations/codex-plugin/skills/loom-mentor/reference.md +++ b/integrations/codex-plugin/skills/loom-mentor/reference.md @@ -37,7 +37,7 @@ hint to the user unless it changes what you are about to do. | know before deciding what the store already holds | `context.pack` once at session start (working memory, profile, relevant memories, procedures); `memory.search` / `loom_search` before a decision; `memory.brief` to orient on one question | writing without reading | | a `memory.get` says `found: false` | `memory.search` (by meaning), `memory.list prefix=` (the siblings); a moved key answers with `canonical_key` — pass `follow=true` | inventing the key again | | a write came back with `duplicate_of` or `conflict` | read the named row (`memory.get`, `memory.related`), revise THAT key, or `memory.link supersedes` if yours replaces it; a `conflict` → tell the user both values (`loom-memory`) | writing a third copy | -| the namespace holds facts that disagree | `conflicts.list` (over HTTP/SDK; the dashboard's Review queue) → `conflicts.resolve`; search penalises conflicted rows until then | leaving them | +| the namespace holds facts that disagree | `conflicts.list` (over HTTP/SDK; the dashboard's Review queue) → `conflicts.resolve`; search penalises conflicted rows until then; two definitions of one name: `memory.definitions.disputes` (via `loom_op`) | leaving them | | follow what is connected to an entity | `facts.traverse` from a seed entity, `facts.path` between two names (via loom_op), `memory.related` for a row's neighbours | a chain of searches | | do a piece of work whose outcome should grade the memories it used | `run.begin` before, its `run_id` on writes (`memory.set`, `observe.record`; reads carry the session's run), `run.complete(memories_used=[…], outcome=…)` after — callable via `loom_op` | nothing; the store cannot tell which memories helped | | make a decision that a future session should be able to check | `decision.record` (scenario, options, choice), later `decision.outcome`; `decision.precedents` before a similar decision — callable via `loom_op` | a memory row that says "we decided X" | diff --git a/tests/unit/test_agent_instructions.py b/tests/unit/test_agent_instructions.py index 1d3192e53fe..07ec42f55e9 100644 --- a/tests/unit/test_agent_instructions.py +++ b/tests/unit/test_agent_instructions.py @@ -38,6 +38,8 @@ BUNDLES = sorted( ROOT / p for p in TRACKED if re.fullmatch(r"skills/loom-(memory|code|status)/[^/]+\.md", p) ) +# The plugin skill that routes a situation to an op; the Codex copy is synced from it. +MENTOR_SKILL = ROOT / "integrations" / "claude-code-plugin" / "skills" / "loom-mentor" NAME = re.compile(r"^[a-z0-9]+(-[a-z0-9]+)*$") # The open skill format caps a description at 1024 characters. MAX_DESCRIPTION = 1024 @@ -236,6 +238,40 @@ def test_a_bundle_names_only_ops_and_tools_the_server_serves(doc: Path) -> None: assert not unknown, f"no such MCP tool: {sorted(unknown)}" +def test_the_mentor_skill_names_only_ops_the_server_serves() -> None: + """The mentor skill sends an agent to an op by name. A name the registry lacks, or + the read of differing definitions refused by `loom_op`, leaves the agent with a + refusal where the skill promised an answer.""" + from server.operations.registry import OPERATIONS_BY_NAME + from server.transport import mcp_op + + groups = {name.split(".")[0] for name in OPERATIONS_BY_NAME} + named: dict[str, set[str]] = {} + for file in ("SKILL.md", "reference.md"): + mentions = operation_mentions((MENTOR_SKILL / file).read_text(), groups) + named[file] = {m.name for m in mentions if m.kind == "op"} + assert named[file], f"loom-mentor/{file} names no op" + unknown = named[file] - OPERATIONS_BY_NAME.keys() + assert not unknown, f"loom-mentor/{file}: no such op: {sorted(unknown)}" + # Routing is asserted for this op alone: the row that names it also names + # `conflicts.list`, which is kept off MCP and says so. + disputes = "memory.definitions.disputes" + assert disputes in named["reference.md"] + call = { + "jsonrpc": "2.0", + "id": 1, + "method": "tools/call", + "params": { + "name": mcp_op.LOOM_OP_TOOL_NAME, + "arguments": {"op": disputes, "arguments": {}}, + }, + } + # A read-only connection routes the fewest ops. + rewritten, refusal = mcp_op.route(call, toolset="readonly", auth=None) + assert refusal is None, refusal + assert rewritten["params"]["name"] == OPERATIONS_BY_NAME[disputes].mcp_tool_name + + def _matches(rule: str, command: str, strip_env: bool = True) -> bool: """This test's model of Claude Code's Bash rule match: `:*` and `*` are any text.