Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Cursor?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/dmiyding-cursor)
---
name: auto-ship
description: Turn plain-language requests into verifiable Git engineering delivery with brief compilation, digest-bound review, and lossless cross-session handoff.
---
# auto-ship (Grok Build (formerly Cursor) Adapter)
Host-agnostic protocol backed by pure Node.js (>=20.11 LTS) CLI (`runtime/core/bin/auto-ship.mjs` relative to the installed skill directory).
## Assurance Boundaries
- **Layer 1 (Skill instructions):** Token-lean batching, zero foreground polling, concise choices, serial build/E2E, labeled ≤6-line continuation prompt.
- **Layer 2 (State CLI):** Enforces strict JSON, CAS `revision`, brief confirmation, `head + digest` candidate binding, automatic review invalidation on edits, `unknown` effect reconciliation, monotonic budgets, atomic `batch` state transitions, pre-validated one-shot `checkpoint` commands, atomic handoff claims, and anti-hijacking.
- **Layer 3 (Host):** L1-cli-enforced: rules instruct the agent; only the CLI enforces protocol state. No native interception, telemetry, or automatic spawn is bundled.
## 1. Startup & Anti-Hijacking (1 Shell Call)
1. Run read-only startup inspection in **one** shell call (never split `doctor`/`workspace`/`policy`/`brief` into separate model turns; never auto-loads historical state):
```sh
node <skill-dir>/runtime/core/bin/auto-ship.mjs startup --cwd <repo> --request "<user request>"
```
- Propagate `doctor.envHint.childCommandPrefix` (fixed Node `PATH` + isolated `ZDOTDIR` when zsh is slow) into EVERY spawned child process / independent reviewer so child shells never drift to x64 Node or stall on slow zsh startup.
- If `doctor` flags `worktree-git-dir`, grant the external `<gitCommonDir>` to any sandboxed child reviewer that runs `git` using the host-supported directory option.
- If `doctor` flags `node-modules-symlink` (or when creating an isolated temp checkout/worktree), use an independent dependency copy or `npm ci` instead of symlinking `node_modules` (symlinks can trip repository dependency/license audits).
2. **Task identity first:** If the user starts a new task or cites a checkpoint path only as background/reference, NEVER read historical `state.json`. Verify with `state check-resume <abs-state.json> --new-task`.
3. Only recover on `--explicit-resume` or an exact `goal` + canonical `checkout` match on an in-progress task (`active` / `review`).
## 2. Brief Compiler (Colloquial → Task Card)
Run `brief assess --cwd <repo> --request "<user request>"` before editing code:
- **`mode: "direct"`:** Clear, bounded, low-risk local work. Initialize state (`brief.status: "auto-clear"`, passing authorized `budgets` if overriding policy) and execute immediately.
- **`mode: "confirm-brief"`:** Vague or high-risk request. Ask **only 1–2 concise multiple-choice questions** plus the compiled Task Card (`Goal / Scope / Acceptance / Prohibitions / Delivery Gate / Stop Points`). Initialize in `brief-pending`; call `state confirm-brief --compact` only after explicit user confirmation.
## 3. Token-Lean Bookkeeping & Verifiable Delivery
- **Never hand-edit `state.json`.** Always pass `--expected-revision N` (and `--compact` on routine `state` mutations; use full `state show` when inspecting brief/evidence/effects during takeover).
- **1-Call Bookkeeping Rule (Mandatory):** Use **`checkpoint`** (`--rev <N>` or `--expected-revision <N>`; supports `confirmBrief`, `resumePaused`, `syncCandidate`, `writerState`, `evidence`, `review` with optional `reviewerRequests`/`reviewerTokens`, `effects`, `progress`, `pause`, `complete`, `pack`, `prepareHandoff`) or **`batch --compact`** instead of burning separate LLM turns per state mutation:
```sh
node <skill-dir>/runtime/core/bin/auto-ship.mjs checkpoint <abs-state.json> --rev <N> --data '{
"syncCandidate": true, "writerState": "stopped",
"evidence": [{"id": "check", "value": "pass"}],
"review": {"module": "core", "status": "approved", "evidence": "0 P1 / 0 P2", "reviewerRequests": 8},
"progress": {"requests": 24, "steps": 3}
}'
```
- Any code edit (even uncommitted) updates `candidate.digest` and automatically invalidates unmerged `approved` reviews to `stale`.
- Record external actions (`push`, `pr`, `patch`, `merge`) as `pending` before invoking, then `done` (via `checkpoint` or `state record-effect --compact`). If a receipt is lost, mark `unknown` and reconcile externally (`unknown -> pending` is forbidden).
- Finish via `checkpoint` (`"complete": {"summary": "..."}`) or `state complete --compact`. `local-candidate` completes legally without requiring a merge.
## 4. Zero-Polling Handoff, Budgets & Quota Guard
- **Zero Foreground Polling:** NEVER use `sleep` or repeated `wait` loops in a high-context foreground session to watch a background `codex exec`. Wait synchronously in a single command or use a zero-token shell runner.
- **Never Brick Tasks on Env/Sandbox/Quota Blocks:** Use `checkpoint` with `"pause": {"reason": "..."}` (`phase: "paused"`, `writerState: "stopped"`). NEVER set terminal `phase: "stopped"` on recoverable environment or permission blockers.
- No host quota telemetry is bundled. Monitor exposed host quota around major milestones. **If `shortWindowRemainingPercent < 5%`**, immediately save a clean `paused` checkpoint via `checkpoint` and stop before hitting rate limits.
- Cumulative `requests`, `steps`, `autoHops`, `reviewAttempts`, and `microFixAttempts` never reset on handoff or `resume-paused`; use `state authorize-round --compact` only with explicit user approval evidence.
- Only dispatch a successor when `handoff.mayDispatch === true`. The successor verifies live candidate + evidence and runs `handoff claim <abs-state.json> --id <id> --session <host>:<new-id>` before its first write.
- When returning control on a pause or blocker, emit a clearly labeled **≤6-line continuation block** (specify **Local Same-Machine Continuation** vs **Cross-Machine Git/Relay Handoff**) with exact checkout, candidate, checkpoint path, remaining steps, prohibitions, and any unknown effects.
## Explicit Milestones & Budget Reserve
- **Visible takeover protocol (mandatory):** After `handoff claim` or `authorize-round`, the FIRST LINE of the FIRST visible reply MUST display the returned `handoverBanner` / `displayBanner`. For structured `handoverBanner`, render its source/successor, candidate, approved modules, and next action clearly. Include the `timeline.md` path and `auto-ship status <abs-state.json> [--tail <N>]` entry point in that reply. Desktop notifications are best effort and do not replace this visible reply.
- At key milestones and every cross-session takeover, show the returned `displayBanner` to the user. On `handoff claim`, also show `handoverBanner`: source and successor sessions, exact `head + digest`, approved modules, and remaining `nextAction`.
- Point to the returned `timelinePath` (`timeline.md` beside `state.json`, normally `.auto-ship/tasks/<task-id>/timeline.md`). This local-only timeline records init, checkpoint, handoff prepare/claim, and authorize-round events; keep it inside the private ignored state directory.
- When a receipt contains `budgetWarning`, proactively save a clean `paused` checkpoint (sync candidate, stop writer, record progress and a concise resume pack) BEFORE starting long tests, heavy re-verification, or a new independent review. Preserve round totals; request explicit user authorization only if a new round is needed.
- `progress` accepts partial totals: `{ "steps": 4 }` preserves requests and `{ "requests": 20 }` preserves steps. Supplied counters must remain monotonic. Fix all errors listed by checkpoint preflight in one retry.
## 5. Quota-Lean Independent Review (省额分级审核纪律)
- **Tiered review (`light` vs `standard`):** Follow `brief.reviewPolicy.tier` returned by `startup` / `brief assess`:
- **`light`** (test-only, docs-only, or tiny copy edits with zero high-risk tags): use a single small-context diff review; avoid multi-round subagent ceremony.
- **`standard`** (production logic, state machines, security/auth, or release boundaries): run an independent read-only reviewer bound to the exact `head + digest`.
- For purely mechanical release/packaging/install/regression scripts, run the repository script directly without wrapping it in an `auto-ship` state machine.
- **Reuse digest-bound receipts (do NOT re-run full tests in review):** Pass `head + digest`, exact `git diff <base>..HEAD`, and verified test/E2E receipts to the independent reviewer. Instruct the reviewer to inspect only the diff, necessary callers, and receipt integrity — **NEVER re-run already-passed full test or E2E suites** unless a receipt is missing, stale, or suspect.
- **Built-in P1/P2 blocking redline:** Every independent review prompt MUST explicitly state: block **ONLY** on real P1/P2 behavior, state, security, or regression defects; mark pure wording or style preferences as **non-blocking P3** so tasks do not burn quota on whack-a-mole micro-fix loops.
- **Mandatory cost visibility:** Always pass `reviewerRequests` (and `reviewerTokens` when available) into `checkpoint.review`, and include the returned `displayBanner` in the final delivery reply (as well as on takeovers and pauses).
## Anti-Whack-a-Mole Micro-Fix (防打地鼠微修纪律)
- When fixing re-review P2 findings, audit adjacent equivalent boundaries in the same file, regex, or component in the SAME batch: Chinese/English punctuation, optional spaces, possessives/variants, truncated states, and disabled-state copy. Search the shared pattern and fix the relevant family before requesting re-review.
- Validate first with targeted unit tests and the repository's existing `typecheck` (when available). Re-run full E2E only after the batch is stable or when integration risk requires it; never burn the budget by repeating full E2E after every tiny fix.
- Preserve cumulative `microFixAttempts` and reviewer usage in checkpoints. Re-review the final candidate digest, and pause with a clear remaining-work summary if the round budget cannot cover verification.
## Rule bridge
Cursor and Grok Build Desktop load `.cursor/rules/auto-ship.mdc`; Grok Build TUI loads `.grok/rules/auto-ship.md`. The project installer bundles this skill at `.agents/skills/auto-ship`. Use owner `cursor:<session-id>` (or `grok-build:<session-id>`), preserving exact identity on handoff. Rules provide instructions, never L3 enforcement.