Skip to content

The coding-agent plugins' defaults and the memory skill's receipt text agree with the server - #2190

Open
zlareb1 wants to merge 4 commits into
mainfrom
fix/plugin-agrees-with-server
Open

zlareb1 wants to merge 4 commits into
mainfrom
fix/plugin-agrees-with-server

Conversation

@zlareb1

@zlareb1 zlareb1 commented Dec 5, 2026 •

Copy link
Copy Markdown
Member

Related: #1232

Changelog category (leave one):

  • Bug Fix (user-visible misbehavior in a release)

Changelog entry (one or two sentences a user of Loom can read without the diff; the release pull request collects these into the release notes):

The Claude Code and Codex plugins send LOOM_CONTEXT_TOKEN_BUDGET within the 200 to 12,000 that context.pack takes, so a value outside that range keeps the session's primer, and they post no observation of a call to the tools of the Loom server the plugin installs. The loom-memory skill reads a memory.set receipt by noop, merged_into_key, status: duplicate and conflict_verdict, so a write that merged into another key is not reported as saved at the key it named.

Why

Three places where the plugins sent or said what the server does not accept or return. The server is the reference in each and does not change.

  1. The primer budget. The session-start hook clamped LOOM_CONTEXT_TOKEN_BUDGET to a floor of 100 with no ceiling. context.pack takes token_budget from 200 to 12,000 (ContextPackInput in server/memory/api/models_context.py) and refuses any other value, so a session with the variable at 150 or 20000 started with no primer. The hook clamps to { min: 200, max: 12000 }: 150 is sent as 200, 20000 as 12000, and an unset variable as 1200.
  2. The skip list. The capture hook's DEFAULT_SKIP_TOOLS (lib/after-tool.mjs) lacked mcp__plugin_loom*, which the server's observe_skip_tools default has. The tools of the server the plugin installs arrive as mcp__plugin_loom_loom__*, so the hook posted an observation of each Loom call and the server stored it with no content. mcp__plugin_loom* joins the list after mcp__loom__*, and the two lists are equal, in order.
  3. The receipt. The loom-memory skill said "memory_id and version mean it was saved" and "status: conflicted names a row to revise". A merge answers memory_id, version, conflict_verdict: merge and noop: true and writes nothing at the requested key; no receipt carries status: conflicted (a stored row's receipt says active, duplicate or proposed, or carries no status); a contradiction answers conflict_verdict: conflict with peers and next. The skill reads the receipt by those fields:
    • a row was written unless noop is true;
    • conflict_verdict: merge with noop: true: the store already held the fact, under merged_into_key when that is set, and nothing was written at the requested key;
    • status: duplicate: duplicate_of holds the fact, leave both rows;
    • conflict_verdict: conflict: peers lists the rows and next names the op to revise with.

The "saved" rule is noop alone, not "a status and noop: false". A write of a type the server does not embed (episodic, profile) or of high sensitivity stores a row and answers an empty status (_set_plain_insert in server/memory/app/set_commit.py builds its receipt without one), and the skill itself sends a run's ledger as an episodic row. A rule that asks for a status would report those rows as not saved. noop is false on every receipt of a stored row and true on a merge and a dry run.

Scope and risk

  • Plugins only: one clamp, one list entry and the text of one skill, in integrations/claude-code-plugin/. The Codex plugin, the standalone skills/loom-memory/ and the copies the MCP transport serves (server/transport/served_skills/, with its manifest digests) are the generators' output. No op, field, table, setting or migration; no server code.
  • Skill size: SKILL.md is 4,730 bytes (4,731 before; tests/skills.test.mjs caps it at 5,200). The receipt bullet keeps its length by naming a merge and a conflict in words; reference.md, which a session opens on demand, carries the field: value form of each and grows from 10,638 to 10,954 bytes.
  • Observations: in memory mode a call to a tool of the plugin-installed server leaves no observation, as a call to mcp__loom__* or a meta tool already left none, so a session's observation count leaves those calls out. The server stored them with no content; a server whose observe_skip_tools lacks the glob stored the call's input, which for loom_memory_set is the memory itself.
  • Unchanged: the keys a Loom memory read served are still stashed for the run's recalled_keys (recordsToolCall hands the call to the hook whatever the skip list says); the code plane's trace stash and code.outcome reports do not read the skip list; LOOM_OBSERVE_SKIP_TOOLS still replaces the whole list; a session with no token, a disabled plane or an unreachable server sends nothing.
  • Hooks in a user's session: no new request and no new failure path. The clamp is arithmetic on a number already read.
  • The reviewed senders: tests/unit/session_content_senders.json pins the sha256 of each source that holds a reviewed sender, so a changed source is read again before its pin is renewed. The session-start hook is one of them, and the pins of its two copies are renewed here. The hook's diff is the two bounds of the clamp: it sends no new op and no new field, and the budget still goes only to context.pack.
  • Left alone:
    • Reading the bounds and the skip list from the server at session start: a request per session for two constants. The parity tests below fail when either side moves.
    • docs/guides/agent-integration.md (its receipt table and its last review paragraph) still says memory_id and version mean a write persisted, and the loom-mentor skill's reference still names a bare conflict. Neither is plugin default or loom-memory text.
    • The model comment on MemorySetOutput.status says it is empty only on a write that stored no row, which the receipt of an unembedded row contradicts. The server is not changed here.

Compatibility, rollout and rollback

  • Wire: none. Both plugin manifests go from 1.2.178 to 1.2.182; the open pull requests that edit a manifest hold versions up to 1.2.181.
  • Operator steps: none.
  • Rolling upgrade: every server build takes a token_budget of 200 to 12,000 and applies its own skip list, so no entry "needs the next server release" and MIN_SERVER_VERSION does not move.
  • Rollback: reverting restores the old clamp, list and text. Nothing is stored.

Tests

New, each failing on main's plugin files and passing here:

  • integrations/claude-code-plugin/tests/session-start.test.mjs
    • a budget below the server's floor is sent as the floor: runs the hook against a fake server with the variable at 150 and reads the context.pack body. Before the fix the body carried 150. It also pins the unset case at 1200.
    • a budget above its ceiling is sent as the ceiling: 20000 was sent as typed; it is sent as 12000.
  • integrations/claude-code-plugin/tests/after-tool.test.mjs
    • a tool of the plugin-installed server is not observed: runs the capture hook for mcp__plugin_loom_loom__loom_search and then for a Read, waits for the Read's observation to arrive, and requires it to be the only one. Before the fix the server also received mcp__plugin_loom_loom__loom_search.
    • its served keys are still stashed: the same run leaves the served key in the session's stash, and recordsToolCall still hands a memory read to the hook under the default list. It passes before and after: it fails if the skip also drops the hand-off.
  • tests/unit/test_plugin_agrees_with_server.py
    • test_the_plugin_skip_list_is_the_servers_default: reads DEFAULT_SKIP_TOOLS from lib/after-tool.mjs and compares it, in order, with the default of the observe_skip_tools setting.
    • test_the_plugin_budget_bounds_are_the_ops: reads the clamp from the hook and compares it with the ge and le of ContextPackInput.token_budget; the unset fallback must lie inside them.
    • test_the_memory_skill_names_only_receipt_fields_and_statuses: reads three passages of the skill, the receipt bullet of SKILL.md, the receipt bullets of reference.md and its "Saved" line. Every field or field: value a passage names is a field of MemorySetOutput, a named status is one the write path stamps, each passage names noop, the field the saved rule reads, and none names memory_id or version, which a merge also answers. On main's skill text none of the three names noop, all three name memory_id and version, SKILL.md names status: conflicted and reference.md a bare conflict. With the old saved rule put back in any one of the three passages and the rest as here, the test fails. The SKILL.md bullet and the reference.md bullets name noop in their merge clause as well, so the memory_id and version assertion is the one that fails them; the "Saved" line fails on noop.

Run on this branch:

  • node --test integrations/claude-code-plugin/tests/*.test.mjs: 1281 tests, 1272 passed, 9 skipped, 0 failed. This ran before two later text edits to the plugin (a comment in lib/after-tool.mjs and one bullet of reference.md).
  • On the first commit, the seven files the change reaches (after-tool, session-start, skills, hooks-doc, loom-capture, hook-contract, record-hook), one file at a time: 139 passed. An earlier run of the same seven, two files at a time on a loaded machine, failed once in record-hook.test.mjs (a session that ends before the prompt's copy has started leaves no run open, a timing test of the run ledger, which this diff does not touch); that file then passed alone, 39 of 39.
  • node --test integrations/grep-shim/tests/*.test.mjs: 21 passed, 3 skipped. node --test integrations/cline/tests/*.test.mjs: 23 passed. bash integrations/cursor/test.sh and PYTHON=.venv/bin/python bash integrations/generic/test.sh: exit 0. CI's loops (node --check over every hook, helper, shim and adapter, sh -n over the launchers, test -x over the entry points): no failure.
  • pytest tests/unit/test_plugin_agrees_with_server.py with the plugin, skill and release unit files (test_codex_plugin.py, test_agent_plugin.py, test_cursor_plugin.py, test_standalone_skills.py, test_served_skills_codegen.py, test_mcp_served_skills.py, test_skill_eval.py, test_plugin_eval_mocks.py, test_loom_code_skill.py, test_plugin_checkout_bytes.py, test_plugin_code_query_contract.py, test_release_prepare.py, test_published_links.py): 286 passed.
  • The repository-wide scans (test_package_contracts.py, test_op_transport_contract.py, test_tunable_constants.py, test_store_names_refused.py, test_degraded_unnoted.py, test_public_copy.py, test_doc_links.py, test_agent_instructions.py): 591 passed, 10 skipped. tests/analyzer: 10 passed, 2 skipped (the two that need a ClickHouse; the diff has no statement).
  • make typecheck: the mypy gate reports 0 errors and mypy --strict sdk/python/loom passes.
  • ruff format --check and ruff check on the new test, Biome on the changed .mjs and .json files and Prettier on the three changed pages pass. The secret gate passes; the function-length gate reports 52 functions over 50 statements against a baseline of 52.
  • agent_plugin_sync, standalone_skills and served_skills were run, and each passes with --check.
  • claude plugin validate .: passed, with advice about the README's install line. claude plugin validate integrations/claude-code-plugin --profile directory --strict: exits 1 on one warning, that a plugin with files in bin/ is refused by one host; the diff changes nothing under bin/.
  • The second commit changes only test_the_memory_skill_names_only_receipt_fields_and_statuses. Run again on it, with the same results: the fourteen unit files (286 passed), the scans and tests/analyzer, make typecheck, ruff format --check and ruff check on the test, the three generators with --check, the secret gate and the function-length gate. The Node suites, Biome, Prettier and claude plugin validate were not run again: the commit changes no file they read.
  • The third commit renews the two pins of the session-start hook in tests/unit/session_content_senders.json, and the fourth changes that test again. tests/unit/test_session_content_senders.py was not among the files run on the first two commits, and its first test failed on both, on those two pins. Run with both changes in place: the fourteen unit files with test_session_content_senders.py (304 passed), the scans and tests/analyzer (601 passed, 12 skipped), make typecheck, ruff format --check and ruff check on the test, the three generators with --check, the secret gate and the function-length gate, with the results above. With the old saved rule put back in one passage at a time, the receipt test fails for each of the three. The Node suites, Prettier and claude plugin validate were not run again: the two commits change no file they read, and Biome's configuration leaves the pins file out.

Not run:

  • claude plugin eval integrations/claude-code-plugin, which a skill change asks for, and the agent-session.mjs end-to-end run: both call a model. They are left to the QA pass that runs once the roadmap of the linked issue is merged.
  • The integration suite: no server code changed, so no ClickHouse or server was started. The full unit suite, the other generator checks of make lint and the shell format check run in CI; rustfmt, gofmt and shfmt are not installed on this machine, and the diff has no op, Rust, Go or shell file.

AI assistance in the code (leave one; writing this description with AI is fine):

  • AI-generated (an agent wrote most of the diff): Claude Code wrote the diff from an agreed design, wrote each test to fail first, and ran the checks listed under Tests. It read the write path to check the receipt fields the skill names, which is where the noop rule comes from. No person has reviewed it yet.

  • I can explain every line of this diff and how it interacts with the rest of Loom.

Checklist

  • Local format, lint, type checks and focused tests pass. The full make test-unit and applicable integration results are reported by CI; a full local run is not required before pushing.
  • Generated files are regenerated in this PR, not by hand: the SDK op tables, docs/reference/configuration.md and the docs/reference/ tables (python scripts/codegen/docs_reference.py), the reach manifest, schemas/schema.sql (make schema-dump), the Codex plugin copies (python3 scripts/codegen/agent_plugin_sync.py) and the standalone skill bundles (python3 scripts/codegen/standalone_skills.py).
  • A new migration is additive and numbered after the latest on main; no merged migration is edited.
  • A behaviour change to any file a plugin ships (hooks/, lib/, bin/, skills/, .mcp.json, the Codex plugin-defaults.json) bumps both plugin manifests' version, and no other open PR uses that version.
  • The frontend builds (npm --prefix frontend run build) and its tests pass, if frontend/ changed.
  • Docs under docs/ describe the system as it now is, and this description names any operator steps and wire changes.
  • Repository text has no dates, people, host names, internal namespaces, ticket or decision numbers; the history goes in this description (tests/unit/test_public_copy.py).
  • Commits are signed off (git commit -s), as CONTRIBUTING.md asks.
  • I signed the Contributor License Agreement (CLA) if CLA assistant requested a signature.

🤖 Generated with Claude Code


Note

Low Risk
Plugin-only behavior and agent-facing skill text; no server wire or storage changes, with regression tests guarding parity.

Overview
Aligns the Claude Code and Codex plugins (v1.2.182) with three server behaviors so sessions are not broken or mis-instrumented.

Session primer budget: loom-session-start now clamps LOOM_CONTEXT_TOKEN_BUDGET to 200–12,000 (was floor 100, no ceiling), matching what context.pack accepts so out-of-range values no longer drop the SessionStart primer.

Capture hook skip list: DEFAULT_SKIP_TOOLS adds mcp__plugin_loom* so calls to tools exposed as mcp__plugin_loom_loom__* are not posted to observe.record, in line with the server’s observe_skip_tools default. Memory keys from those reads are still stashed for the run.

loom-memory skill: Receipt guidance now treats a write as saved when noop is not true, and documents merges (noop: true, merged_into_key), duplicates, and conflict_verdict instead of relying on memory_id/version or non-receipt statuses like conflicted.

Docs, Codex copies, served skill bundles/manifest digests, hook integration tests, and test_plugin_agrees_with_server.py lock these defaults to the server models/settings; session-start sender SHA pins are updated.

Reviewed by Cursor Bugbot for commit 52e51fb. Bugbot is set up for automated code reviews on this repo. Configure here.

…t agree with the server

Three places where the plugins sent or said what the server does not accept
or return:

- The session-start hook sends LOOM_CONTEXT_TOKEN_BUDGET within 200 to
  12,000, the range context.pack takes for token_budget. A value outside it
  was sent as typed, the op refused it, and the session started with no
  primer.
- The capture hook's default skip list is the server's observe_skip_tools
  default: it gains mcp__plugin_loom*, which matches the tools of the server
  the plugin installs. The hook posted an observation of each of those calls
  and the server stored it with no content. The keys a memory read served
  are still stashed for the run's close.
- The loom-memory skill reads a memory.set receipt by the fields the op
  answers: a row was written unless noop is true; a merge wrote nothing at
  the requested key and merged_into_key holds the fact; status: duplicate
  leaves both rows; a contradiction is conflict_verdict: conflict with peers
  and next. The skill said memory_id and version mean saved, which a merge
  also answers, and named a status: conflicted that no receipt carries.

tests/unit/test_plugin_agrees_with_server.py compares each of the three with
the server's model or setting, so a change on either side fails there.

Signed-off-by: Mohammad Lareb Zafar <lareb.zafar@clickhouse.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@vercel

vercel Bot commented Dec 5, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
loom-docs Ready Ready Preview Dec 5, 2026 1:15am UTC
loom-telemetry Ready Ready Preview Dec 5, 2026 1:15am UTC

Request Review

zlareb1 and others added 3 commits December 5, 2026 00:47
…ved from noop

test_the_memory_skill_names_only_receipt_fields_and_statuses checked that
each field the loom-memory skill's receipt text names is a field of
MemorySetOutput and that a named status is one a receipt carries. memory_id
and version are fields of the model, so a passage saying that those two mean
a write was saved passed every assertion. A merge answers both and writes
nothing at the requested key, which is the defect the skill text fixes.

Each of the three passages (the receipt bullet of SKILL.md, the receipt
bullets of reference.md and its "Saved" line) must now name noop, the field
the saved rule reads. The test passes on the skill as it is and fails when
any one of the three reads saved from memory_id and version.

Signed-off-by: Mohammad Lareb Zafar <lareb.zafar@clickhouse.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…k as it is

tests/unit/session_content_senders.json pins the sha256 of each source
that holds a reviewed sender, and
test_shipped_automatic_senders_have_an_admission_class_or_reviewed_exception
fails when a pinned source changes. The session-start hook is pinned, in
the Claude Code plugin and in its Codex copy, and the clamp of
LOOM_CONTEXT_TOKEN_BUDGET changed its bytes, so that test failed.

The hook's diff is the two bounds passed to envNumber: it sends no new
op and no new field, and the budget still goes only to context.pack.
Both pins are renewed to the hook's sha256.

Signed-off-by: Mohammad Lareb Zafar <lareb.zafar@clickhouse.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…or version

test_the_memory_skill_names_only_receipt_fields_and_statuses required
each receipt passage to name noop. The receipt bullet of SKILL.md and
the receipt bullets of reference.md name noop in their merge clause as
well, so the rule "memory_id and version mean it was saved" put back
beside that clause passed the test.

The test also fails a passage that names memory_id or version, the two
fields a merge answers while it writes nothing at the requested key.
None of the three passages names them. With the old rule put back in
one passage at a time, the test fails for each of the three.

Signed-off-by: Mohammad Lareb Zafar <lareb.zafar@clickhouse.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant