Skip to content

Drive Spek tasks through atomic claims, not todo writes - #4

Merged
teechoi merged 2 commits into
null-shot:mainfrom
teechoi:fix/skills-atomic-claims
Aug 26, 2026
Merged

teechoi merged 2 commits into
null-shot:mainfrom
teechoi:fix/skills-atomic-claims

Conversation

@teechoi

@teechoi teechoi commented Aug 26, 2026 •

Copy link
Copy Markdown
Collaborator

The problem

operating-nullshot tells agents to track Spek task state with update_jam_todo:

Use each synchronized plan task's todoId with update_jam_todo: mark it in_progress before editing and completed only after its verification passes.

The gateway's own instructions now say the opposite:

use start_jam_task, heartbeat the returned claim while working, and call complete_jam_task with verification evidence. Do not bypass atomic claim semantics with update_jam_todo.

Why the claim exists: more than one connected client can hold the same grant. Two agents reading the same plan pick the same dependency-ready task, and a todo write makes neither of them the owner — so they build it twice and overwrite each other. That's the collision the claim primitive was added to prevent.

This plugin predates it. I grepped all five skills for the work-claiming surface:

start_jam_task heartbeat_jam_task complete_jam_task release_jam_task list_available_work list_spek_projects get_spek_project list_workspace_inbox
0 0 0 0 0 0 0 0

Every other tool the skills name does still exist — this is the one surface that moved.

The change

operating-nullshot gains the full lifecycle: find → claim → heartbeat → complete once with evidence → or release. Argument and rejection semantics are taken from the live tool schemas via tool_schema, not guessed:

  • start_jam_task returns claimId, generation, and a workPacket; creates no branch and dispatches no hosted builder
  • heartbeat_jam_task takes ttlMs between 30s and 1h
  • complete_jam_task requires verificationEvidence with at least one property, reconciles tasks.md under a revision check, and notifies the workspace inbox
  • release_jam_task takes an optional reason
  • calls are rejected unless claimId, generation and the authenticated grant all match — so on rejection, re-read rather than retry

I spelled the heartbeat step out deliberately: a claim that stops being heartbeated expires and the task is silently reclaimed mid-build, which is not obvious from the tool names alone.

using-nullshot now points at that lifecycle instead of the todo path, and gains the two discovery calls plus list_workspace_inbox — the gateway can't push notifications, so it's the only way an agent ever learns what finished while it was away.

update_jam_todo is not banned outright; it stays available for todo content the plan doesn't own.

One test was asserting the bug

assert.match(operating, /plan task's `todoId` with `update_jam_todo`/);

That pinned the deprecated sentence in place, so the old guidance couldn't be changed without a test failure. It now asserts the replacement.

Verification

node scripts/validate.mjs clean · node --test test/*.test.mjs 7 pass, 0 fail (1 new).

Non-vacuous — the new test against the original skills:

# pass 5
# fail 2
operating-nullshot must document list_available_work

Relationship to #3

Independent; either can land first. #3 makes the gateway URL environment-aware. Together they're what I'd want in place before the Nullshot connect panel starts handing users these plugin commands instead of a plain claude mcp add.


Note

Low Risk
Documentation and test-only changes to agent skills; no runtime plugin or gateway behavior is modified.

Overview
Replaces deprecated Spek task tracking in the Nullshot plugin skills so agents align with gateway claim semantics and avoid multi-client collisions on the same grant.

operating-nullshot now documents a full find → claim → heartbeat → complete (with verification evidence) or release flow (list_available_work, start_jam_task, heartbeat_jam_task, complete_jam_task, release_jam_task) and explicitly forbids using update_jam_todo for Spek task lifecycle state. Direct execution still uses app file tools; claims do not create branches or dispatch hosted builders.

using-nullshot adds list_workspace_inbox on resume/long work, list_spek_projects / list_available_work when picking up existing work, points direct execution at the claim lifecycle, and clarifies OAuth against the configured gateway (including NULLSHOT_MCP_URL).

Tests in adapters.test.mjs add coverage for the claim lifecycle in skills and flip an assertion that previously pinned the old update_jam_todo guidance.

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

rokt added 2 commits August 26, 2026 10:45
The skills told agents to track Spek task state with `update_jam_todo` —
`in_progress` before editing, `completed` after verification. The gateway's own
instructions now say the opposite: "use `start_jam_task`, heartbeat the returned
claim while working, and call `complete_jam_task` with verification evidence. Do
not bypass atomic claim semantics with `update_jam_todo`."

The claim exists because more than one connected client can hold the same grant.
Two agents reading the same plan pick the same task, and a todo write makes
neither of them the owner, so they build it twice and overwrite each other. That
is the collision the claim primitive was added to prevent, and this plugin was
written before it landed: nothing in these skills mentioned
`list_available_work`, `start_jam_task`, `heartbeat_jam_task`,
`complete_jam_task`, `release_jam_task`, `list_spek_projects`,
`get_spek_project`, or `list_workspace_inbox`.

`operating-nullshot` now carries the whole lifecycle — find, claim, heartbeat,
complete once with evidence, or release — with the argument and rejection
semantics taken from the live tool schemas rather than guessed. The heartbeat
step is spelled out because a claim that stops being heartbeated expires and the
task is silently reclaimed mid-build. `using-nullshot` points at it and adds the
two discovery calls plus the inbox read, which is the only way work finished
while away is ever seen.

One existing assertion pinned the deprecated sentence, so it was asserting the
bug; it now asserts the replacement. A new test covers the lifecycle and fails
against the previous skills.
The skill told agents to OAuth against https://mcp.nullshot.ai/mcp by name.
An agent that reads an explicit URL in its instructions can reasonably use it
over the one it was configured with, which would defeat the point of a
configurable gateway and silently move a session to production.

Says "the gateway it is configured with" instead, and names the consequence:
the environments do not share accounts, jams or grants.
@teechoi
teechoi force-pushed the fix/skills-atomic-claims branch from 634372f to 81c2024 Compare August 26, 2026 17:45
@teechoi
teechoi merged commit 7b227c7 into null-shot:main Aug 26, 2026
1 check passed
teechoi pushed a commit that referenced this pull request Aug 31, 2026
`v0.2.0` was cut before #3, #4, #5 and #6, and every manifest still declared
0.2.0. Two consequences, both silent:

- The README's own Pi row installs `@v0.2.0`, so a Pi user pasting it today
  gets a plugin that can only reach production, teaches `update_jam_todo`
  instead of atomic claims, and carries the two invented Codex commands.
- Claude Code and Cursor read the version to decide whether an update exists.
  At an unchanged 0.2.0, an already-installed user is never offered any of it,
  including the Cursor gateway this branch adds.

So the version moves to 0.3.0 in all eight places the validator checks, and the
Pi row moves with it.

`scripts/validate.mjs` now asserts the README's pinned tag matches
package.json. It cannot prove the tag exists on the remote from here, but it
makes the pin move with the version, which turns four releases of silent
staleness into a release step someone has to take.

**Merging this requires `git tag v0.3.0 && git push origin v0.3.0`** on the
merge commit, or the Pi row points at a tag that is not there yet.

Verified: validate green at 0.3.0, 12/12 tests. Non-vacuous — restoring only
the README pin to v0.2.0 fails the new assertion.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
teechoi added a commit that referenced this pull request Aug 31, 2026
* Installing into Cursor now connects Cursor

`.cursor-plugin/plugin.json` declared `skills` and nothing else. A user who
completed Cursor's dashboard install got the planning skills — which name
`start_jam_task`, `upsert_jam_plan`, `list_available_work` — and no server to
call them on. Nothing errors in that state: the plugin is installed, the skills
load, the tools are simply absent. It is the least obvious way to be broken,
which is why it shipped.

The previous change documented this. This one fixes it.

## The manifest

`mcpServers` is a documented Cursor manifest field — a path, an inline object,
or an array — and the inline object here is the shape Cursor's own first-party
remote-MCP plugins use (`third_party/ahrefs`, `third_party/brevo`): no
transport gymnastics, inferred from `url`. It validates against Cursor's
published `schemas/plugin.schema.json`.

`commands` was missing for the same reason skills were not enough: ten command
files shipped in this repo that Cursor had no way to load.

## Why the URL stays literal

Cursor supports manifest `variables`, but they are values the user is PROMPTED
for, with no default. An unset one would write a literally unexpanded `${...}`
into the server URL — a broken server rather than a movable one, which is the
same reasoning that keeps `.mcp.json` plain for Codex. So Cursor remains
production-only, and the README now says where a non-production user goes
instead: the one-click Cursor button in Nullshot's Connect panel, which writes
that environment's gateway directly.

## Verification

- `node --test test/*.test.mjs`: 12 pass. The new test fails, and
  `scripts/validate.mjs` throws, against the manifest as it shipped.
- The URL the manifest now carries answers `POST /mcp` with 401 and a
  `WWW-Authenticate` naming its resource metadata, so the README's claim that
  Cursor discovers OAuth from a 401 is true for Cursor for the first time.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>

* Release 0.3.0, and stop the tag going stale again

`v0.2.0` was cut before #3, #4, #5 and #6, and every manifest still declared
0.2.0. Two consequences, both silent:

- The README's own Pi row installs `@v0.2.0`, so a Pi user pasting it today
  gets a plugin that can only reach production, teaches `update_jam_todo`
  instead of atomic claims, and carries the two invented Codex commands.
- Claude Code and Cursor read the version to decide whether an update exists.
  At an unchanged 0.2.0, an already-installed user is never offered any of it,
  including the Cursor gateway this branch adds.

So the version moves to 0.3.0 in all eight places the validator checks, and the
Pi row moves with it.

`scripts/validate.mjs` now asserts the README's pinned tag matches
package.json. It cannot prove the tag exists on the remote from here, but it
makes the pin move with the version, which turns four releases of silent
staleness into a release step someone has to take.

**Merging this requires `git tag v0.3.0 && git push origin v0.3.0`** on the
merge commit, or the Pi row points at a tag that is not there yet.

Verified: validate green at 0.3.0, 12/12 tests. Non-vacuous — restoring only
the README pin to v0.2.0 fails the new assertion.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>

---------

Co-authored-by: rokt <[email protected]>
Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
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