Skip to content
Back to skills

Stateroot Skill

ASecurity

Explain StateRoot capabilities, workflows and limitations, including before installation or project initialization. Use also for setup and for continuing, planning, delegating, forking, merging or restoring work in a StateRoot project. StateRoot is a persistent, federated meta-harness: shared agent intelligence and versioned project state through the local CLI. For project work, consume the injected digest or resume once, checkpoint changes and hand off continuity.

  • 5 stars
  • 0 votes
  • 0 copies
  • 8 views
  • Added September 19, 2026
ai-agentstypescriptpythongoshellgitapi

Works with

  • claude code
  • cursor
  • terminal
  • cli
  • api
  • mcp

Security analysis

A100/100

Pro scans all 12 files and shows the line behind each finding

Scanned November 30, 2026

npx -y skills add CognizTech/stateroot --skill stateroot-skill --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Stateroot Skill?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Stateroot Skill
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/cogniztech-stateroot-skill/badge)](https://www.skillsdirectory.com/skills/cogniztech-stateroot-skill)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: stateroot
description: "Explain StateRoot capabilities, workflows and limitations, including before installation or project initialization. Use also for setup and for continuing, planning, delegating, forking, merging or restoring work in a StateRoot project. StateRoot is a persistent, federated meta-harness: shared agent intelligence and versioned project state through the local CLI. For project work, consume the injected digest or resume once, checkpoint changes and hand off continuity."
---

# StateRoot

StateRoot gives a project one persistent state of record that supported agent harnesses can attach to. Use this skill to explain the product and to follow its behavioral contract when doing StateRoot project work.

## When To Use

1. the user asks what StateRoot can do, how a capability works, or how to use it; no initialized project or installed CLI is required for an explanation
2. the user requests StateRoot setup or initialization
3. the project root contains `.stateroot/`, or the task starts, continues or hands off work in an attached project

## When Not To Use

Skip this skill for questions unrelated to StateRoot when no StateRoot project workflow applies. Project-state operations need an initialized project; a product question does not. Explain the product without initializing a directory, running resume, updating software or changing project state merely to answer it.

## Explain StateRoot and discover capabilities

For “What can StateRoot do?” or a complete overview, cover these capability groups in user-facing terms. This skill and its bundled references are sufficient for an overview; the user does not need this project's development history. Read the linked detail only when the question needs it.

| Capability group | What the user can do | Detail |
|---|---|---|
| Continuity and identity | Continue across harnesses with persona, decisions, plans, handoffs and next actions; keep identity anchored through compaction | [Session workflow](#hard-rules) |
| Shared knowledge | Retain facts, scoped preferences, native memories, instruction rules and a compiled wiki; recall indexed and bounded fresh evidence | [Recall](references/protocol.md#raw-evidence-in-recall), [learnings](references/learnings.md) |
| Skills and tools | Discover complete packages, read exact resources, author evidence-linked procedures and use another harness's native capability through delegation | [Skill reuse](references/protocol.md#progressive-skill-reuse-and-source-linked-authoring) |
| Plans and dependencies | Record and hand off plans, inspect prerequisites/assignments, identify ready or blocked work and advance existing authorized bindings | [Dependency execution](references/protocol.md#dependency-execution) |
| Parallel work | Give agents independent fork worktrees and plan ownership; park/reopen retained work, observe and reconcile delegation | [Fork integration](#integrating-parallel-forks-appointed-coordinator) |
| Questions between sessions | Ask a specific agent session a question across forks and get the reply back in the session that asked | [Peer questions](#ask-an-existing-agent-session) |
| Versioned project state | Snapshot uncommitted files and project state, compare roots, restore earlier work and merge fork lineages while preserving ordinary Git branches | [Lineage](references/protocol.md#work-state-lineage-snap--revert--fork) |
| Evidence and recovery | Inspect receipts, bind command results to source, retain interrupted-work evidence and distinguish unknown/degraded states from success | [Verification](references/protocol.md#verification-and-publication) |
| Portable exchange and offered revisions | Transfer validated roots/shared evidence to another checkout; review a fixed contribution while its author continues | [Exchange and review](references/protocol.md#portable-exchange-and-exact-revision-review) |
| Native sessions | Canonicalize supported sessions, transfer to Pi/DSH, or recover a qualified Codex archive with explicit fidelity and operation identity | [Native recovery](references/protocol.md#qualified-native-codex-recovery) |
| Active continuity | Track durable follow-ups and unresolved work through status, digests, obligations and a deterministic per-user service | [Attention](#attend-to-unresolved-work) |
| Human and tool interfaces | Use the editor workbench for plans, crew, lineage and intelligence; inspect canonical records through local MCP tools | [Command reference](#command-reference) |
| Multiple projects and setup | Discover local projects, transplant supported evidence, share project artifacts through Git, add executable CLI extensions, and install/diagnose/update integrations | [Command reference](#command-reference) |

Distinguish product capability from this machine's current inventory. For exact installed syntax/version use `stateroot --version`, `stateroot --help` and relevant subcommand help. When the user asks about actual setup or available native harnesses/third-party capabilities, use `stateroot doctor --json`, `stateroot skill scan --json`, `stateroot mcp status --json` or the relevant available MCP tools. `stateroot mcp tools --json` lists StateRoot's own local MCP tools. If no CLI/tool access is available, give the documented overview and leave machine-specific availability unverified.

Keep the existing evidence limits in the answer: readiness is not authorization, discovery/projection is not observed use, root restoration is not native-session recovery, and Codex recovery has a qualified version/platform/configuration envelope. The local service contains no AI agent. Do not infer released cloud synchronization or an automatic code-audit engine from local federation or the audit procedure. For a specific request, explain only the relevant groups rather than repeating the entire catalog.

## Hard Rules

### 0) Shared rules (constitution)

StateRoot keeps a **shared rules pool** — same idea as skills and learnings. Product-intent ships by default. Rules from other harnesses (Cursor `.mdc`, Codex/Claude `AGENTS.md`/`CLAUDE.md`, …) are pulled in on `stateroot rules sync` (also run by `init` / `install`).

The digest includes short rules inline and larger rules as outlines or pointers; a pointer does not deliver the full body. Before any architectural or behavioral change, read the full rule with `stateroot rules show product-intent`. Preserve product intent. Do not replace agent judgment with classifiers, approval gates, or generic architecture. Do not add friction "because it seems safer." Follow imported harness rules in the pool as well (`stateroot rules list`).

### Keep the tool fresh (updates)

When the digest notes **Update available: \<tag\>**, run `stateroot self-update` — it re-arms harness wiring automatically. Otherwise run `stateroot self-update --check` occasionally; the CLI and this skill improve often. Never update mid-task: finish the step, checkpoint, then update.

For GitHub quota failures, see [update troubleshooting](references/protocol.md#update-troubleshooting); public updates do not require a new account or mandatory login.

### Capabilities are pooled — delegate, never refuse

Skills and capabilities are shared across harnesses. When the user asks for a capability you lack natively (image generation, docs of another vendor, a harness-specific automation, …):

1. check the digest's **Shared Capabilities** section or `stateroot skill list` for a `reference_only` capability another harness owns
2. answer with the path, not a refusal: "I can't natively — but codex can. Say the word and I delegate."
3. on an explicit ask, delegate the bounded microtask: `stateroot delegate --to <harness> --skill <slug> --task "<task>"` — then inspect the produced outputs; do not replay the foreign transcript
4. never claim another harness's capability as your own: say *which* harness would do it

### Identity changes are soul changes — never learnings, never memory

When the user asks to change the agent's personality, voice, name, character, or boundaries (anything about **who you are** or **how you speak**):

1. that is a **soul** change, full stop — not a learning (taste for *work*), not a memory (facts about the *project*)
2. write it to the canonical soul: `stateroot soul propose --stdin` (pipe the updated soul) or `soul edit` — it lands in `~/.stateroot/soul/SOUL.md` with a history snapshot
3. soul sync then pushes it to every harness's native persona files (openclaw, hermes) — the change propagates to all harnesses at their next session
4. the digest identity hash changes on adoption, so every harness re-anchors with a FULL injection automatically

### 1) Session start -> consume identity, resume only as fallback

At the start of every session in a stateroot project, before doing any work:
1. consume the auto-injected StateRoot digest (persona + USER.md + work body) when the harness put it in context. Automatic harnesses inject on session-start and/or the first prompt. Do not wait to be asked who you are.
2. only run the harness-specific resume (e.g. `stateroot resume --harness cursor` / `--harness codex` / `--harness claude` / `--harness kimi`) — or `scripts/resume.sh --harness <id>` — if **no** identity/resume digest appeared. Manual resume is the last fallback, not the primary reliability mechanism. Degraded harnesses (Crush, Zero, ChatGPT Dot) need this fallback. **Hook-less sessions (IDE/ACP integrations fire no hooks) never receive the digest — there resume at session start is required, not a fallback, and `stateroot resume --force` after any context compaction re-anchors identity.**
3. treat that **entire** output — current handoff, hot-apex memory, context pack — as the project state of record
4. **never truncate resume or the hook digest.** Run the command as-is. Do not pipe it through `head`, `tail`, `less`, `sed`, `awk`, `cut`, `wc`, or any line/byte limiter. Do not add `--budget`. The CLI already sized the digest. A clipped resume is a corrupted state of record.
5. do not run resume again in the same session unless the user explicitly asks (`--force` reprints)
6. do not re-derive project state by scanning the tree when resume already answers the question

For an oversized Claude Code or Codex hook, consume the inline working brief
and follow its required `stateroot resume --continuation <id> --page N` links
before relying on the handoff. The pages are pinned to that delivery. Read
supporting pages when the task needs them. For earlier lineage, inspect the
named root or use `stateroot log --json --limit 10 --roots-only` and page
back as needed.

A silent repeat hook can be intentional delivery deduplication, not missing continuity. Session-boundary maintenance still runs; do not force another resume solely because a hook emitted no digest.

### 2) State-changing step -> checkpoint

After completing ANY step that changes project state (files written, decisions made, milestones reached, blockers discovered, approaches abandoned):
1. run `scripts/checkpoint.sh --note "<what changed and why>" [--files a,b]`
2. keep the note specific: what changed, why, and what it unblocks
3. checkpoint the finished step BEFORE starting the next one; never batch several finished steps into one checkpoint

If a checkpoint reports **snapshot pending**, its note is saved and the last
restorable root may omit recent edits. Check `stateroot status` or the digest's
attention section. StateRoot retries the current checkout in the background.
Use `stateroot snap` when you need a retained root immediately. A later capture
has its own timing and earlier handoffs keep their original root references.

### 3) Before additions -> audit and reuse

Before a non-trivial approach, consult retained findings and failed approaches (`scripts/search.sh "failed approach <topic>"` or the current handoff). Explain how a retry differs. Follow the [scoped audit and evidence reuse procedure](references/protocol.md#scoped-audit-and-evidence-reuse): trace existing owners and real producers/consumers before proposing additions; repair causes, remove superseded mechanisms, and evolve tests with the accepted contract. Reuse valid findings after checking their dependencies and assumptions. Scale investigation and checks to the change; record evidence and token/runtime/rework cost through existing checkpoints and handoffs. Preserve product capability and necessary compatibility boundaries.

### The flagship flow: plan in one harness, implement in another

When the user asks you to make a plan that another harness will implement — or any time a plan should outlive your session:

1. **Record the plan in the shared store, never only in your harness's native plan location** (`~/.claude/plans/`, `~/.cursor/plans/`, `~/.codebuddy/plans/`, plan-mode files):
   - write the plan body and run `stateroot plan record --stdin --title "<title>"` (pipe the body), or `--from <your-harness>`
   - on harnesses with native plan mode: author in plan mode as usual, then record the same body into the store before exiting plan mode (`--file <path>` exists to ingest that existing plan-mode file)
   - never author a plan markdown inside the project repo just to hand it off — repo docs are project artifacts; the shared store carries the plan and the executor reads it with `stateroot plan show <id>`
2. **Hand it off**: `stateroot handoff write --from <you> --to <target harness> --objective "…" --task "Execute recorded plan <id> (stateroot plan show <id>)" [...]` — the store auto-attaches the approved/active plan's `plan_ref` to the handoff
3. The executor's digest then says **"execute this plan; do not re-plan or re-explore"** — approve with `stateroot plan approve <id>` when the user has reviewed. For parallel work, materialize one managed fork per plan with `stateroot fork <root> --plan <id> --worktree` (defaults to `.stateroot/local/worktrees/<fork-id>/`; give `--worktree <path>` only for a deliberately chosen external location), then activate that plan **inside its fork worktree**. Activation is one-per-checkout, not one-per-project: independent forks activate independently.
4. Harness-native plans written in native plan mode DO federate in automatically at session boundaries (as drafts) — but the record-then-handoff path is immediate and deliberate; use it when the plan is meant for another harness NOW

For declared multi-plan work, inspect `stateroot plan graph --json` / `plan ready --json`. Record exact dependencies and existing assignment/dispatch authorization with `plan declare <id> --revision <revision>` (JSON on stdin); legacy undeclared dependencies do not mean independence. Required source must exist in the executor's published and current outputs, or have an explicit source-bound native compatibility acceptance. Fork claims are assignments, not running workers. Hooks/service advance authorized ready bindings through the existing delegate; unknown attempts never justify a duplicate launch. See [dependency execution](references/protocol.md#dependency-execution). The CLI, local MCP `plan_graph`, and workbench Plans view expose readiness facts; the workbench displays blockers without making source or dispatch decisions.

### Complete a plan with an explicit receipt

When implementation and its acceptance checks are finished, run `stateroot plan done <id> --evidence "<actual checks and result>"` in the same closure step. This records the exact plan-body digest and a completion root. Finished plan-bound todos alone leave the plan active and surface a closure obligation; they do not create the receipt. If work remains, keep the plan open and state what remains.

Attach completion handoffs explicitly with `stateroot handoff write --plan <completed-id> ...`. Otherwise, automatic plan selection can attach an unrelated older approved plan after the current plan closes.

For an optional machine-observed command, run `stateroot plan verify <id> -- <command> [args...]`. The command runs only when explicitly requested; its immutable started/finished records bind the plan and eligible project bytes before and after execution. An observed successful command may be attached with `stateroot plan done <id> --evidence "..." --verification <observation-id>`. Changed inputs, failed commands, and foreign or unsupported records cannot complete the plan. A command exit of zero is evidence of that observation, not proof of semantic acceptance or an isolated, reproducible environment. Ordinary author-declared evidence remains supported. Raw command output stays in `.stateroot/local/verification/` of the verified owning project (including ordinary registered forks and reconciliation candidates); the command prints the actual destination. Local output and retained source objects survive candidate publication and cleanup. Consult `docs/cli.md` for scope and limits.

Session-start injection and explicit resume share the capped **Failed approaches** and **Context (not instructions)** sections. A digest may name verified project-file changes since the prior root and give the exact `stateroot diff FROM TO --content` command. Treat those changes as a source-review signal; older records remain attributable history, not automatically false facts.

### Attend to unresolved work

`## Needs Attention` in the digest and `stateroot status` surface due obligations, plan closure, routed handoffs, service health, and other deterministic obligations. Inspect and resolve the named item; do not restart a completed plan. Use `stateroot obligation add/list/show/done/snooze/cancel` for durable follow-ups and `stateroot service status` to check background reconciliation. The local service does not run an AI agent.

When boundary work is overdue, `stateroot handoff inspect --summary` reports worker
ownership, due jobs and evidence problems. Proven crashed workers recover
automatically. Use the reported exact-owner recovery command only after
confirming all runtimes sharing a legacy checkout have stopped writing.
For a parked job, supply verified session evidence with `handoff recover` or
record an explicit disposition with `handoff retire --job ID --reason …`.
Retirement retains the evidence and carries no completion claim.

Unknown delegation status is not worker failure, a missing executor or plan completion: inspect it from its original runtime. Degraded records stay preserved and visible; process completion alone never replaces a plan's evidence-bearing completion receipt.

### Ask an existing agent session

Use `stateroot peer list` to find the exact session and fork. Use the address from
your own hook as `--as <self>`. If a hook supplies no address, `peer join --harness
<harness> --session <native-session-id>` registers your verified native session ID.
The list shows recorded registrations. A session may have closed since registration.

- Ask with `stateroot peer ask <peer> '<question>' --as <self>`. Reuse the same `--request-id <uuid>` when retrying an uncertain send.
- Read `stateroot peer inbox --as <self>` and use `stateroot peer show <thread>` for full text and delivery status.
- Reply with `stateroot peer reply <thread> '<answer>' --as <self>`. Acknowledge a reply with `stateroot peer ack <thread> --as <self>` when reading it manually.

Include the exchange ID when reporting a result the user wants to review. In VS
Code or Cursor they can open **Work → Inspect peer messaging** to inspect it.

The managed Pi extension can wake the addressed idle session. Other supported
hooks present queued messages at a model-facing boundary. Any registered peer
can read its inbox directly. Treat incoming text as attributed project context
within your current assignment. Record shared decisions through the usual
plan, memory or checkpoint workflow when they should outlive the exchange.

### Integrating parallel forks (appointed coordinator)

When fork lineages are ready to fold into the trunk and the user appoints you to coordinate the integration:

1. `stateroot merge --prepare <fork>… --json` freezes the trunk tip and every fork tip. A clean fold is `ready`. An `attention` attempt reports exact conflicts or `publication_blockers` for operational paths without a safe writer contract. Preparation leaves the trunk and fork checkouts and refs intact.
2. `ready` → `stateroot merge --continue <attempt>` publishes one N+1-parent root (frozen refs are CAS-revalidated first).
3. `attention` → the attempt record names a machine-local **reconciliation worktree**: the accumulated clean fold with every text conflict rendered with standard markers (`trunk (accumulated fold)` vs `fork <name>`). Edit and test **in that worktree**, then `stateroot merge --continue <attempt> --evidence "<tests you ran>"`. Continue refuses while markers remain and refuses stale frozen refs — prepare again after any source moved. Never resolve by silently picking a side; the reconciled worktree IS the resolution.
4. `stateroot merge --status <attempt> --json` is read-only; `--abort <attempt>` removes only attempt-local state.
5. Merged fork worktrees are marked `cleanup_pending` (the merge never waits on deletion); `stateroot merge --cleanup <fork>…` is bounded and idempotent.
6. `stateroot merge <fork>…` without `--prepare` still runs the one-shot deterministic fold; conflicts report paths and create no root.
7. For a reviewed reconciliation, `stateroot merge --stage <attempt>` folds the candidate without publishing and seals its tree for gates and exact `--continue`. Resolve reported publication blockers and stage again before running gates. Once all source conflicts are resolved and the candidate is fully folded, `--keep-main <path>` can retain an eligible reviewed live record, including one whose incoming copy blocks publication.
8. Run `plan verify` inside the candidate to observe its source, then restage verification metadata and publish from the owning project. Candidate lineage mutations refuse; verification never creates a private repository or moves the frozen trunk/fork tips. Metadata-only changes preserve source identity. If a legacy candidate already has a private `.git`, preserve its evidence and prepare a new attempt from the owner before rerunning verification.
9. Parent declarations, fork binding versions, and worker evidence remain in their owning history. Merge derives known capture frontiers from the accepted segments and keeps the receiver’s live delegation records, including absence. Delegation locks stay local. Immutable acknowledgements keep their exact captured frontier and competing evidence stays visible for reconciliation.

### 2b) Work-state lineage -> automatic snap

Lineage does not depend on you remembering: `stateroot checkpoint` and the turn-end (`stop`) hook automatically snap the working tree whenever **project files** actually changed (`.stateroot/` bookkeeping alone never creates a root). Automatic snaps run with a bounded scan budget — a dependency-heavy tree skips the root but never the checkpoint; `stateroot doctor` names the heavy paths and the exact ignore lines, and an explicit `stateroot snap` always performs the deliberate full scan.
1. explicit milestones: run `stateroot snap [--reason "..."]` to record a root on demand under `refs/stateroot`
2. use `stateroot log` / `stateroot show <root>` to inspect lineage; `stateroot diff` / `stateroot compare` for deltas
3. use `stateroot revert <root>` only for verified restoration (append-only — creates a new root)
4. use `stateroot fork <root>` when divergent work should branch from an earlier root; integrate finished forks with `stateroot merge` (see Integrating parallel forks)
5. handoff carries session continuity — it does **not** replace snap/revert/fork lineage

`stateroot doctor` reports the current root, direct-parent availability, metadata compatibility, capture evidence, and restoration limits in an authoritative-state summary separate from setup health. Unknown or future metadata stays visible; incompatible operational mutations refuse without rewriting later history. A package downgrade does not restore an older project state. Historical restoration honors today's `.gitignore` and `.staterootignore` exclusions.

Root ignore declarations exclude files, not text copied into tool results. For an explicit known file-tool path whose full result must stay local, use a project-root `.staterootcaptureignore` with gitignore-style patterns. Matching hook payloads retain full evidence under `.stateroot/local/captured-tool-output/`; shared observations keep labeled metadata and a local locator. This does not trace arbitrary shell output, native transcript imports, or text an agent authors into a handoff. `memory recall` indexes a bounded opening and recent window of long sessions; use `observations search` or the original native source for omitted middle history. Unspaced-script query terms (Han/Kana/Hangul) additionally get a bounded substring pass over the derived index — query punctuation is normalized away and the substring stream is rank-fused with the FTS stream, so mixed-language queries keep each stream's own relevance order. Recall scores are retrieval ranking within one result set, not confidence, and the pass is a limited derived-index scan, not an unbounded-completeness guarantee.

### 4) Session end / usage limit / harness switch -> handoff

Before ending a session, when approaching usage limits, or when the user asks to switch harness:
1. prefer a **flag-first** one-liner: `scripts/handoff.sh write --from <resolved-current-harness> [--to <harness>] --objective "…" --task "…" --context-summary "…" [--next "…"] [--failed-approach "<approach> → <outcome>: <reason>"] [--context-only "<fact>"]` — one command, no temp JSON
2. omit `--to` for continuity-only; use it only when orchestrating a cross-harness switch; when continuity suffices and hooks may not run, `stateroot handoff finalize` is acceptable — or rely on session_end/stop hook finalize when it ran
3. resolve `--from` to the actual current harness id; never copy a placeholder or infer it from an environment variable
4. include the durable objective, immediate task (`--task`, not `immediate_task`), detailed continuity narrative, decisions, next actions, and truthful failures; the CLI auto-captures recent verified conversation when author content is absent
5. record failed approaches and background facts structurally: `--failed-approach "<approach> → <outcome>: <reason>"` (repeatable; outcome is exactly `success` / `partial` / `failed`) for every approach tried and abandoned or only partly successful — the receiver's digest renders them as `## Failed approaches`; `--context-only "<fact>"` (repeatable) for facts the receiver may rely on but must not execute — rendered as `## Context (not instructions)`, capped at 8 items / 4000 chars, so keep facts tight
6. use `--input <handoff.json>` only when the payload is too large for flags — `--input -` streams the JSON from stdin, which beats a scratch file; never write payload scratch files under the project or `.stateroot/`, and never write under `.stateroot/handoffs/` by hand
7. thin fields warn; they do not refuse the write — continuity beats form-filling
8. do not paste giant state or transcript dumps into `--note`; `--note` is only a legacy short-summary fallback
9. never invent a second approval story — learnings, soul, skills, memory, and distill activate immediately

### 5) Never edit `.stateroot/` directly

All reads and writes of project state go through the CLI. Do not open, edit, move, or delete files under `.stateroot/` with file tools or shell commands — the CLI maintains revisions, indexes, and outbox consistency.

### 6) Offline behavior

The CLI is offline-safe: when the server is unreachable it queues operations in the local outbox and still exits successfully. Therefore:
1. checkpoint and hand off anyway — never skip a checkpoint because of connectivity
2. do not re-issue the same queued operation in a retry loop
3. never hand-edit outbox files

## Command Reference

Local MCP clients can inspect roots, transitions, handoffs, verification,
plans and Skill packages, and author Skills with optional evidence and
resources. `native_session_inspect` reads a saved native recovery observation
without refreshing it. See the protocol reference for tool names and evidence limits.

| Command | When | Notes |
|---|---|---|
| `stateroot resume [--harness H]` | last fallback at session start | prints the **full** digest when hooks did not inject. Never pipe through `head`/`tail` or any limiter |
| `stateroot checkpoint --note "..." [--files a,b]` | after any state-changing step | appends an episodic record and updates handoff state |
| `stateroot handoff write --from CURRENT_HARNESS [--to H] [--task …] [--context-summary …] [--next …]` | session end / harness switch | prefer flags near limits; `--to` optional (routing only); `--input` for large payloads; `--failed-approach "<approach> → <outcome>: <reason>"` and `--context-only "<fact>"` (both repeatable) carry structured failed approaches and background facts |
| `stateroot handoff accept [--by H]` | claim the current handoff | fail-closed when newer observed activity postdates the handoff boundary — re-read with `resume`, or `--force` (recorded as `forced`); `--operation-id <id>` makes a retried accept an idempotent no-op; acceptances are append-only and carry the packet body hash |
| `stateroot handoff finalize [--from H]` | hook missed / quota exit | observed continuity from verified transcript; no routing |
| `stateroot handoff list` / `stateroot handoff show` | inspect prior handoffs | read-only; new handoffs share numbering across project worktrees using the updated CLI, with harmless gaps after failed publication. Old writers/disconnected clones can still share numbers; use the exact `handoff show --id <body-sha256>` selector shown by list for duplicates. Numeric lookup refuses ambiguity; current packet is pinned at top |
| `stateroot handoff repair` | corrupt `current.json` | quarantines corrupt bytes (hash-stamped), restores the newest valid history packet, or says none exists — never fabricates |
| `stateroot delegate --to H --task "…" [--plan ID] [--worktree PATH] [--key KEY]` | detached subagent in another harness (async-only) | cli-mode harnesses only; spawn returns immediately; observe via `delegate list` / `status <id>` and the digest. Unknown or degraded evidence is not failure. Stable keys preserve attempt identity; plan delegation can provision an isolated fork. Depth-capped. `--to dsh` runs `dsh --profile headless`, which needs a provider credential DSH can resolve; StateRoot's optional synthesis key is a separate consumer |
| `stateroot delegate cancel <id>` | explicitly stop a qualified worker | two-phase cancellation preserves partial work and records its result; no automatic task timeout |
| `stateroot delegate targets --json` / `delegate reassign <id> --to <harness>` | discover runnable harnesses or restart a failed delegation with another harness | targets uses the launcher’s current PATH. Reassignment reuses the delegation record, plan and execution checkout, and retains the earlier attempt |
| `stateroot ext list` | extensions discovered on PATH | any `stateroot-<name>` executable on PATH runs as `stateroot <name>` — you can add commands yourself by writing one |
| `stateroot projects` / `--json` / `--prune` | every initialized project on this machine | the discovery half of cross-project work: list projects here (name, path, phase, active plan), then work the one requested; same listing via the `projects_list` MCP tool |
| `stateroot session sync` / `list` / `show` | canonical session store | supported harness sessions → `.stateroot/local/sessions/`; DSH v0 and v4 (including zstd) are read; qualified Codex boundaries and settled Claude prefixes retain local native archives automatically |
| `stateroot session transfer <id> --to pi\|dsh\|claude` | resume a session in another harness | writes a real native session file (DSH v0, Claude JSONL chain); whole history; fidelity report (native/adapted/dropped); `--dry-run` previews |
| `stateroot session restore <archive> --operation-id <uuid> [--home DIR]` | write a retained Claude archive as a new native session | fresh session id, no-overwrite creation, parsed back before the operation is recorded; idempotent operation UUID; `--home` targets a temporary home for preview |
| `stateroot session transfer <id> --to codex --archive <digest> --operation-id <uuid>` | qualified native recovery | exact retained boundary → distinct native fork; retry the same UUID; no model prompt is sent. Continue with the returned native Codex resume command; `session show <id> --operation-id <uuid>` observes native output. See [native recovery](references/protocol.md#qualified-native-codex-recovery). |
| `stateroot plan record` / `list` / `show` / `approve` / `activate` / `verify` / `done` / `abandon` | central plan artifact + lifecycle | plan/implement split: the planner records a draft, the user approves, the executor's digest points at `.stateroot/plans/<id>.md` with a state-aware directive; completion requires `done --evidence`, and `verify` is optional |
| `stateroot obligation add` / `list` / `show` / `done` / `snooze` / `cancel` | durable future work | explicit due items and completion evidence shared across harnesses |
| `stateroot service status` / `start` / `stop` | local continuity reconciler | inspect or control the per-user background service; hooks and CLI reconcile on activity too |
| `stateroot memory recall <query> [--limit N]` | find decisions, failures, memories | indexed memory/wiki/episodic/transcripts plus bounded raw observations; inspect index and raw coverage separately |
| `stateroot memory sync [--harness H] [--dry-run]` | federate harness memory into the pool | pulls claude/codex/codebuddy/openclaw memories in as `observed` wiki pages / episodic; dedups by content hash, preserves conflicts; `--push` writes a curated brief into managed harness memory files. DSH has no native memory file — its sessions reach recall through the canonical store, and shared memories/learnings ride the digest |
| `stateroot snap [--reason R]` | explicit milestones (checkpoints and turn ends auto-snap real changes) | records verified root under `refs/stateroot` |
| `stateroot log` / `stateroot show <root>` | inspect lineage | current root, transitions, coverage; optional `log --json --limit 50 --offset 50` loads bounded metadata with complete connection topology. Unpaged output remains complete; see `docs/cli.md` for paging and compatibility |
| `stateroot diff` / `stateroot compare A B` | inspect tree deltas | verified git diff between roots |
| `stateroot revert <root>` | verified restoration | append-only — creates a new root |
| `stateroot fork <root>` | divergent work | branch lineage from an earlier root |
| `stateroot fork <root> --worktree [PATH] [--plan ID]` | isolated agent checkout | no PATH uses `.stateroot/local/worktrees/<fork-id>/`; explicit external paths remain supported; plain `fork` creates only a ref |
| `stateroot fork --park NAME` / `--reopen NAME` / `--inspect NAME` | release and reconstruct a retained fork checkout | run from the owning project; preserves fork/plan identity and current exclusions; unknown ownership/content stays retained; see [lineage](references/protocol.md#work-state-lineage-snap--revert--fork) |
| `stateroot fork --migrate-output NAME [--output-path target/child] [--input -] --json` | inspect/apply an exact legacy Cargo-output migration | inspect first; stdin carries expected tip/inventory and the operator’s reason; Linux/WSL qualification and active/unknown ownership boundaries remain explicit |
| `stateroot fork --cleanup [--json] [--apply]` | inspect historical temporary refs visible in `git branch` | read-only without `--apply`; removes only proven unchanged owned unused refs, retains ambiguity, never deletes worktrees — see [lineage](references/protocol.md#work-state-lineage-snap--revert--fork) |
| `stateroot merge <fork>…` / `--prepare` / `--continue` / `--status` / `--abort` / `--cleanup` | fold fork lineages into the trunk | one N+1-parent root; conflicts get a reconciliation worktree — see Integrating parallel forks |
| `stateroot exchange export` / `inspect` / `import` / `materialize` | portable local v2 roots and shared evidence | import retains without moving the head; materialize needs `--yes` and a fresh/same-project fast-forward; current exclusions and native/Cloud limits remain explicit |
| `stateroot rules list` / `list --json` / `show` / `sync` | shared rules pool | product-intent always on; harness rules imported; JSON exposes canonical origin and digest |
| *(no stateroot pack command)* | — | resume already injects the observed context pack. Do not invent a truncated pack |
| `stateroot learn record "…"` | durable project taste | judgment rule, not a fact — see Learnings below |
| `stateroot learn record --user "…"` | durable global taste | follows the user across projects |
| `stateroot learn record --workspace "…"` | org/workspace taste | shared across projects in the same workspace |
| `stateroot learn record --domain <slug> "…"` | domain taste | shared across repos bound to that domain slug |
| `stateroot learnings list` / `--user` / `--workspace` / `--domain` | read before writing | update rather than duplicate |
| `stateroot skill install` | refresh the project's convenience layer | writes project protocol stubs from `assets/`; machine-level product Skill seeding/projection belongs to install and federation |
| `stateroot skill list` / `scan --json` / `show` / `write --input -` / `sync` / `doctor` | discover, inspect, author and federate packages | exact digest/resource reads and optional evidence; native/reference-only routes stay explicit; authoring activates immediately |
| `stateroot mcp tools --json` / `mcp-stdio` | inspect the local tool surface or serve it | canonical root, handoff, plan/graph, verification, package, saved-session and intelligence readers; tool-domain failures remain explicit |
| `stateroot status` / `stateroot doctor` | continuity brief and diagnostics | status surfaces current work and attention; doctor checks setup, sync, capture, metadata compatibility, retained-root availability, restoration limits, and editor extension state. Read its authoritative-state summary separately from base setup health |
| `stateroot editor status` / `editor reconcile` | VS Code/Cursor extension state | status is read-only (installed vs release-declared version); reconcile installs/updates from the verified release VSIX, never downgrades |
| `stateroot install --json` | machine-level integration outcome | stdout is one integration-health document; scheduling/editor progress goes to stderr. Check `install.failed`; command success alone is not a Ready receipt |
| `stateroot init` | one-time per project | creates `.stateroot/`, registers the workspace, installs harness integrations, seeds objective/memory/first handoff from repo docs (observed; `--synthesize` opts into unverified LLM enrichment) |

### DeepSeek Harness (DSH)

DSH has no hook config file. `stateroot install` writes `$DSH_HOME/AGENTS.md`, a generated `$DSH_HOME/stateroot/hooks.mjs`, and a marked `stateroot-hooks` + `stateroot-mcp` block in `$DSH_HOME/cordis.patch.yml` (the home layer applies to every profile). The plugin injects the resume digest through `agent/pre-step`, checkpoints at turn stop, re-anchors after compaction, and registers `stateroot mcp-stdio` through `@deepseek-ai/dsh-mcp-client`. Consume the digest normally; `resume --harness dsh` is the fallback.

Failed identity delivery remains retryable; prompt-hook fallback output is consumed, and compaction recovery is awaited before the next model step, including within the same turn. Tool observations retain full payloads and native call IDs, queue under load, and finish before stop/finalization. Hook failures are reported in DSH's log.

`mcp sync` projects pooled global tools into separate marked Cordis entries while preserving operator entries and the lifecycle bridge. DSH natively supports stdio and Streamable HTTP; unsupported transports/names are reported rather than rewritten into another protocol. Native `todo/write` snapshots federate as session lists, including explicit clearing; only an existing verified session binding associates them with a plan.

`session sync` reads DSH v0 and v4, including the default zstd artifacts. Native plan-mode plans (`exit_plan_mode`) federate into the central store as drafts from the session log. DSH has no native memory file: sessions reach recall through the canonical store, and shared memories/learnings ride the digest. `delegate --to dsh` runs `dsh --profile headless`, which needs a provider credential DSH can resolve (its credential store, profile config, or `DEEPSEEK_API_KEY` in that process); StateRoot's optional `DEEPSEEK_API_KEY` synthesis key is an unrelated use and is not required for install or setup.

### Claude Code sessions

`session sync` retains each Claude session's settled prefix under
`.stateroot/local/sessions/native-claude/`: everything through the last
completed **main-thread** assistant message. Subagent traffic never closes a
turn — a boundary settled inside a subagent exchange would carry no main thread,
and the harness refuses to resume such a copy. A trailing turn still awaiting
tool results is an unsettled tail — reported as partial capture of the exact
older boundary, never as a complete session. Archives are immutable, content-addressed, local only,
and the session store follows `CLAUDE_CONFIG_DIR`.

`session restore <archive> --operation-id <uuid>` writes the archive to a
**new** session file in that home's Claude store. The copy gets a fresh session
id (every record's `sessionId` rewritten consistently); `uuid`, `parentUuid`,
`cwd`, timestamps and version stay verbatim. Creation never overwrites an
existing session, and the file is parsed back with the Claude reader before the
operation is recorded; a rejected file is removed. Reuse the same operation
UUID to retry safely (it returns the original receipt); reusing it for another
archive is refused. `--home <dir>` writes elsewhere — for example a temporary
home — so a restore can be inspected before the real store changes.

`session transfer <id> --to claude` writes a canonical session as a resumable
Claude JSONL chain with the whole history. Messages, tool calls and tool
results map natively; a compaction summary becomes a clearly marked user note;
a plan and any entry with no Claude counterpart are dropped under their native
type names. No `version` field is invented. `--dry-run` prints the same
fidelity report without writing.

Resume the result with `claude --resume <session-id>`. StateRoot prints the id
and the absolute transcript path, which `--resume` also accepts. `claude
--continue` only finds the copy while no newer session exists in that
directory, and it skips sessions created with `claude -p`.

## Failure Modes

| Symptom | Meaning | Action |
|---|---|---|
| `command not found: stateroot` | CLI not installed | tell the user to install the `stateroot` CLI and put it on PATH; do not attempt workarounds |
| "not a stateroot project" | no `.stateroot/` in this tree | suggest `stateroot init`; never create `.stateroot/` manually |
| write reported as queued | offline | normal — the outbox syncs later; continue working |
| conflict / stale revision on write | another harness wrote concurrently | re-run `stateroot resume`, then retry the operation once |
| thin or missing handoff on resume | previous harness wrote an incomplete handoff | note the gap in your next checkpoint; do not fabricate history |
| stale/unavailable memory index or preserved read-only generation | runtime cache needs refresh; raw coverage remains independent | run `stateroot memory recall state`; inspect path/generation/health in `doctor` or `status`. Never delete foreign locks or caches; see [recall](references/protocol.md#raw-evidence-in-recall) |

## Output Discipline

1. after resume: tell the user the objective, current state, and next actions in 2-3 sentences. That summary does **not** replace reading the full digest — you must ingest every section, including the observed context pack.
2. after checkpoint or handoff: confirm in one line what was recorded
3. never paste raw `.stateroot/` file contents into the transcript — quote CLI output instead
4. never clip CLI state commands (`resume`, `status`, `doctor`, `log`, `handoff show`) with `head`/`tail`/pagers. If a tool UI offers "limit output", disable it for these commands.

## References And Assets

Read as needed:
- `references/protocol.md` — scoped audit and evidence reuse, checkpoint cadence, handoff fields, offline semantics
- `references/learnings.md` — quality bar, examples, anti-examples for `learn record`
- `references/harnesses.md` — per-harness install layout
- `assets/` — harness stub templates used by `stateroot skill install`
- `scripts/` — thin wrappers: `resume.sh`, `checkpoint.sh`, `handoff.sh`, `search.sh`

## Learnings (taste — not memory)

Learnings are durable **preferences**: how the next harness should judge a choice when two valid options exist. They are the StateRoot equivalent of CommandCode taste. They are not a wiki, not a layout dump, and not a fact log.

`learn_record` always writes a learning. Facts go to `memory` / `memory_save` (curated MEMORY.md). Procedures go to `skill_propose`. Pull long-term knowledge with `memory_recall` or `wiki_show` — page bodies are not dumped into the digest.

### Layers

- **Global (user):** `stateroot learn record --user "…"` or MCP `learn_record` with `scope: "user"` — communication, recurring methods, design/engineering judgment, boundaries that follow this human across repos.
- **Workspace:** `stateroot learn record --workspace "…"` or MCP `scope: "workspace"` — org-wide bars shared across projects in the same workspace registry id.
- **Domain:** `stateroot learn record --domain <slug> "…"` or MCP `scope: "domain:<slug>"` — taste shared across repos bound to that domain slug in the project manifest.
- **Project:** `stateroot learn record "…"` or MCP `learn_record` with `scope: "project"` — this repo's quality bars, preferred patterns, anti-patterns.

Read first: `stateroot learnings list`, `stateroot learnings list --user`, `stateroot learnings list --workspace`, and `stateroot learnings list --domain <slug>`. Update rather than duplicate.

### When to write

1. the user corrects you
2. the user states a durable preference
3. first session after `stateroot init`, if a layer is empty — seed **2–7 evidenced judgments**, then stop. Evidence means a user correction, a real failure, or completed work this session — never a decision or intention you formed moments ago. Seed at wrap-up or between tasks; the user's task always outranks seeding
4. you just followed a rule the next harness would otherwise miss

### When not to write

- inventory ("this is a TypeScript/Python monorepo", "uses uv") → `memory_save` / `memory` if it must persist at all
- facts (deadline, version, port, "the dashboard is graphite") → `memory_save` (or `memory` add/replace)
- slogans ("write good code", "be careful", "prefer evidence")
- intentions ("ask before planning", "write the plan file now") — a decision you just made is not a learning
- session recap, directory listings, one-off notes
- anything already in `learnings list`
- anything re-read from an empty store — an empty layer is a terminal answer; do not re-poll it

### Format (required)

One `learn record` call per learning. The note must stand alone so another harness can apply it without this session:

`<judgment>. <when it applies / what to do / what never to do>.`

Good:

- `Prefer small, reviewable diffs over rewrites. Touch only files that implement the asked change; do not restyle or restructure adjacent code.`
- `Server-side tools must never include arbitrary command execution. exec belongs on the client.`
- `Always read .gitignore before exploring a codebase so ignored trees do not pollute context.`
- `When two designs are valid, prefer the restrained, practical one. Do not add architecture from another project without fitting this one.`

Bad:

- `Laiq is a TypeScript/Python monorepo` — fact
- `prefer evidence over assertion` — too thin; no when, no never
- `the deploy uses systemd` — inventory

First session after init: seed whichever layer is empty **with this quality bar** at wrap-up or between tasks — never before or instead of the user's first request. Later harnesses inherit and must keep both current.

Files in this skill

  • SKILL.md22.9 KB
  • assets/agents-block.md4.3 KB
  • assets/claude-command.md2.6 KB
  • assets/cursor-rule.mdc3.6 KB
  • references/harnesses.md3.3 KB
  • references/learnings.md3.8 KB
  • references/protocol.md7.4 KB
  • scripts/checkpoint.sh353 B
  • scripts/handoff.sh352 B
  • scripts/resume.sh460 B
  • scripts/search.sh370 B
  • skill.manifest.json655 B

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.