# Spindle — complete documentation bundle

> Generated by scripts/build_docs.py from the pages of https://lavallee.github.io/spindle/.
> One file for an agent's context. Source: https://github.com/lavallee/spindle · MIT licensed.

<!-- https://lavallee.github.io/spindle/index.html -->

skills for coding agents v0.4

## Keep a small house. Find the rest when the work calls for it.

Spindle gives every agent you run the same short list of rules and skills, a large catalog of pinned skills it searches only when a task needs one, and a record of whether each skill actually helped.

Skills are instruction files an agent loads to do a kind of work well. Good ones are everywhere now: your own, your team's, and public collections with hundreds each. Installing all of them makes agents worse. A harness shows the model every installed skill's name and description, and the model picks less accurately as that list grows. Spindle splits the list in two: a few skills that are always on, and everything else, which is searched, judged, and handed over only for the task at hand.

### Three parts

##### The house

One versioned directory of rules every harness loads and a small kernel of skills linked into every harness. Install it per machine with one command; projects opt into named patterns.

spindle house

##### The catalog

Skill sources pinned to exact commits, indexed without running anything in them. Hundreds of skills stay available and none of them crowd the model's list.

spindle catalog

##### Choose and learn

For each task, rank the catalog, let a judge decide whether any skill would materially help, hand it over by path, then record how the work was judged. The next choice uses that record.

find · use · brief · report

### Two minutes in

```text
# install the CLI, then point this machine at your house
$ uv tool install "git+https://github.com/lavallee/spindle@v0.4.2"
$ spindle house init ~/src/my-skills/house
$ spindle house setup                # rules + kernel into every harness found
$ spindle catalog sync               # export pinned sources, build the index

# during work: what would help with this task?
$ spindle find "vet a benchmark result before reporting the speedup"
* 0.88  upstream/benchmark-checklist   Vet a perf measurement before you report it
  0.46  upstream/verification          Use before claiming work is complete
$ spindle use upstream/benchmark-checklist      # prints the SKILL.md path to read
$ spindle report --outcome accepted --helped upstream/benchmark-checklist
```

The first column is the judge's probability that the skill would materially improve the work; a star marks a selection. With no judge configured, `find` returns a ranked shortlist and says so, and whoever receives it does the judging. Selecting nothing is a valid answer: asking for help renaming a variable returns no skill at all.

**by path:** An offered skill is a file to read, not an install. Any harness or sandbox that can read files can use it, with no reload and no leftover state.

### Who it is for

#### You run several harnesses →

Keep one set of house rules and kernel skills, and install them into Claude Code, Codex, and Hermes on every machine from the same directory.

#### You want public skill collections →

Pin them by commit, see exactly what a newer commit would change, and reach any skill on demand without installing the collection.

#### You dispatch agent jobs →

One call before dispatch picks the skills, one call after grading records the outcome, and the job's receipt says exactly which skill bytes the agent was given.

#### You need to vet a skill first →

Inspect it without running it, try it in a disposable session, lease it, and adopt it only with evidence. Every step is reversible.

### What makes it different

**Selection is judged**

Text search finds the neighbourhood but cannot tell "relevant" from "shares words with the task". A judge model gives a calibrated yes-or-no per candidate, and an optional expander turns a commission into the phrases a skill description would use.

**Outcomes close the loop**

Every offer, read, and graded outcome lands in a local ledger. Skills that keep helping rise; skills that keep getting rejected sink. Reviewers can see what guidance a producer was given.

**Pins, not floating installs**

A source is a full commit. Moving the pin shows the skills added, changed, and removed, and any new network, credential, or shell indicators, before you accept it as a reviewed diff.

**Nothing third-party runs**

Sources are exported without hooks, install scripts, or package managers. Spindle reads skill text; it never executes a catalog skill's code.

**Your rules travel**

House rules land in a managed block of each harness's always-loaded instruction file. Text outside the block is never touched, and a project can embed the rules for environments that never run setup.

A skill should earn its place in the context, task by task, with a record of whether it helped.The always-on list stays short so both it and the long tail stay useful.

### Deeper: the vetting lifecycle

Some skills belong in a harness's native list, or need more care than a file read: a skill with scripts, a team-wide default, a skill under evaluation. For those, Spindle keeps the full lifecycle it started with: `inspect` explains a package without executing it, `try` opens one disposable session, `borrow` grants an expiring lease, startup verifies the exact desired set, and only `adopt` creates lasting custody. Paired evaluations decide whether a skill improves held-out work. See the lifecycle and evaluation.

**for your agent:** Agents can read this site as llms.txt or as one file, bundle.md, generated from these pages.

---

<!-- https://lavallee.github.io/spindle/rationale.html -->

rationale

## Why not just install every good skill?

Because the model chooses from the list you give it, and a longer list gets worse choices. Skills are easy to install and quietly expensive to select among, combine, keep current, and remove.

Agent skills are one of the best ideas to arrive in coding agents: a small file of hard-won instructions that makes the agent reliably good at a task. The trouble starts not with any one skill but with the twentieth. Skills accumulate the way dependencies do — and, like dependencies, an unmanaged pile carries costs that don't show up until they compound.

### The list is the bottleneck

A harness shows the model the name and description of every installed skill and lets it decide which to open. That decision is made from a list, in passing, at the start of a task. With ten good skills the model usually picks well. With two hundred, from five authors who each describe their skills in their own words, it picks the wrong one, or none, far more often. Every addition makes every other skill a little harder to find.

**selection accuracy:** The reason for Spindle's split is the quality of the choice, not token cost. Descriptions are cheap; a poor choice is not.

Spindle's answer has two halves. A house keeps the always-on list short: rules every agent follows and a kernel of skills most sessions use. A catalog keeps everything else available but out of the list. When a task arrives, search narrows the catalog to a handful of candidates, a judge decides whether any of them would materially help, and the agent gets a path to read. The outcome of the work is recorded against the skill, so the next choice is better informed. Both lists stay useful: the short one because it is short, the long one because it is searched with the task in hand.

install everything

##### The pile

- The model picks from hundreds of descriptions.

- Nobody knows which skill shaped which result.

- Upstream updates arrive unreviewed, or never.

- Your own rules compete with everyone else's.

with spindle

##### House and catalog

- A short always-on list; the rest is searched per task.

- Each job's receipt names the exact skills offered.

- Pins move only through a reviewed diff.

- House rules load first, in every harness.

The rest of this page is the older, still-true argument for treating the skills you *do* install as dependencies with a lifecycle.

### Cost 0 — install and hope

The usual workflow compresses several different decisions into one action: copy a skill into a discovery directory and hope the model notices it, the harness loads the intended version, its permissions are acceptable, it does not conflict with ambient state, and somebody will retest it after the next model upgrade. Installation answers none of those questions.

install and hope

##### Ambient dependency

- Presence stands in for intent and authority.

- The installed name stands in for exact bytes.

- Configuration stands in for activation.

- Old anecdotes stand in for current evidence.

with spindle

##### Evidence-bearing custody

- Inspect before granting authority.

- Try or borrow before adopting.

- Verify exact startup and per-agent activation.

- Rebaseline, update, roll back, and retire explicitly.

The instinct is to install every useful skill globally so it's always available. It's the right instinct and the wrong result. A global pile is never vetted as a *set*: it was assembled one convenient addition at a time, by different authors, for different situations. Below is what that costs, and what composition buys instead.

the default

##### The pile

- Every repo gets every skill.

- Instructions crowd the context window.

- Skills from different authors collide.

- Each skill grows to cover every case.

- Guardrails can be edited or crowded out.

with spindle

##### The blend

- Each surface gets the subset it justifies.

- Only relevant skills spend context.

- The set is linted for coherence before it lands.

- Skills stay small; coherence lives in composition.

- Guardrails accumulate and can't be dropped.

### Cost 1 — context budget

Every skill an agent loads is instruction it reads before it does any work. A pile of forty skills is forty skills' worth of preamble competing with the task for attention and tokens — most of it irrelevant to the repo in front of it. A React app doesn't need the database-migration skill; a data pipeline doesn't need the accessibility-audit skill. Loading them anyway is pure overhead, and the overhead is worst exactly when the task is hardest and the context is fullest.

**the subset is the product:** The house kernel and each project pattern are deliberately small, and a managed blend installs the *resolved subset* for a surface. Fewer, sharper skills beat more, vaguer ones.

### Cost 2 — incoherent blends

Skills authored independently combine in ways no author ever tested. Two skills both bind the `/review` command. One assumes the output format another produces. A planning skill says "always write tasks to the tracker" while a lightweight skill says "never leave the working directory." When you pour many upstreams into one agent, you get a **pidgin**: a combination that no single upstream ever vetted as a whole.

Blending sources risks a combination no single upstream ever vetted. Coherence has to be checked where the blend is made.The anti-pidgin guard, from Spindle's composition layer.

Spindle resolves a blend as a first-class object and *lints it* before anything is written: it catches command collisions and duplicate skills, records every override as a shadow, and refuses to materialize an incoherent set unless you force it. The check runs at the one place that has the whole picture — the surface where the skills will actually run together.

**shadow:** When a more-specific channel overrides a skill from a broader one, Spindle records the override rather than silently dropping it — so the blend is auditable.

### Cost 3 — one-size-fits-all skills

There's a tempting way to make a skill "just work everywhere": keep adding caveats and special cases until it covers every situation. The result is a skill that is long, generic, and slightly worse for every specific surface — it spends its words hedging instead of helping. And it never fully succeeds, because the situations genuinely conflict.

Spindle takes the opposite position, and it is the load-bearing idea:

Coherence belongs at the composition layer — not inside ever-larger skills.

Keep each skill small and canonical: write it once, for the case it's actually good at. Let *composition* — which skills travel together, in what order, phrased for which surface — carry the burden of making them work as a set. A small skill that's right for this surface beats a big skill that's adequate for all of them.

### Cost 4 — the wrong surface

"The right skills" is surface-relative in three independent ways, and a flat global pile can express none of them:

**three axes:** What to include, how to phrase it, and how much scaffolding to keep — each is a different surface property.

#### App type

A Python network service and a React frontend want different skills. Spindle classifies the repo and resolves per-cluster channels accordingly.

#### Harness

A Claude harness and a Codex harness phrase and locate skills differently. The harness is both a selection key and a rendering dialect.

#### Model

A frontier model reads faster without restated context and worked examples a smaller model relies on. Rendering trims scaffolding by model tier.

Same source skill, three surfaces, three different materialized results — computed, not hand-maintained. Rendering is how one canonical skill becomes the right text for each target.

### Cost 5 — guardrails you can't accidentally drop

The moment an agent can recompose its own skills, it can — in principle — compose away its own safety rules. Spindle makes that structurally impossible in two places. Absolutes (the `ALWAYS`/`NEVER` rules a channel puts in force) are *unioned* across every layer and are never dropped by precedence: guardrails only accumulate. And at render time, every guardrail clause present in a skill's source must survive, word for word, in the rendered output — if a paraphrase or an LLM rewrite drops one, the bind fails closed and materializes nothing.

**fails closed:** A dropped guardrail or an incoherent blend stops the bind. Nothing lands unless the whole set checks out. See the safety floor.

### "But it adds a control plane"

It does. The payoff is that the decisions already being made implicitly—what to load, which version, for how long, under which authority, and whether it helped—become inspectable and reversible. The correct-state path stays small: cached bootstrap and stable native hooks verify desired state without network access or evaluation in the startup callback.

Composition is deterministic and cached; re-binding an unchanged surface is nearly free. Startup uses local metadata and content identities. The **advance team** can precompute managed blends, while lease and adoption changes remain mutable state behind stable hook definitions.

**advance team:** `spindle advance run` binds every configured surface up front, so the common case is precomputed rather than paid for on demand.

Second, the step is where the value is created. It's the one moment that has enough context to make the pile coherent, sized, phrased, and safe. Skip it and you haven't saved work — you've pushed that work onto the agent at runtime, where it's slower, less reliable, and unverifiable. And when a surface needs something ad-hoc, the **liaison** logs the request as a demand signal, so today's one-off becomes tomorrow's precomputed skill.

**liaison:** The in-repo edge that owns the *what* and defers the *how* to Spindle, capturing needs as a per-surface demand stream.

Third — and this is what makes the step more than bookkeeping — binding proves a skill is *present and coherent*, but never that it's *good*. Spindle separates those questions on purpose and answers the second one with real evidence.

Availability is not activation, and activation is not improvement. Each deserves its own evidence.

That's the payoff a pile can never give you: a skill set that is not just present but sized, coherent, surface-fit, guardrail-safe, and — where it matters — measured.

---

<!-- https://lavallee.github.io/spindle/house.html -->

the house

## One set of rules, in every harness, on every machine.

A house is a directory you keep under version control. It holds the rules every agent should follow, the few skills every agent should always have, and named patterns for kinds of project.

### What is in a house

```text
house.toml      # version, kernel skill list, project patterns, sourcing
RULES.md        # rules every harness loads on every machine
patterns/*.md   # extra rules for one kind of project (optional)
catalog.toml    # pinned sources of on-demand skills (see Catalog)
```

```text
schema = "spindle.house/v1"
version = "0.3.0"
skill_roots = ["../packages"]          # where the named skills live

[kernel]
skills = ["orient", "review"]          # linked into every harness

[patterns.data-publication]
description = "Static data sites"
rules = "patterns/data-publication.md"
skills = ["chart-review", "publish-gate"]
```

**Keep the kernel small.** Every always-on skill competes with the others for the model's attention. A skill belongs in the kernel only when most sessions in most projects would use it. Anything narrower belongs in a pattern, and anything occasional belongs in the catalog.

**kernel:** The skills linked into every harness's native skill list. Indexed in the catalog but never offered by search, since they are already loaded.

### Install it on a machine

```text
$ spindle house init ~/src/my-skills/house
$ spindle house setup --dry-run      # the plan, nothing written
$ spindle house setup                # every harness found on this machine
$ spindle house status
house v0.3.0 at ~/src/my-skills/house
  claude  rules current v0.3.0; kernel 2/2 linked; 0 dead links
  codex   rules current v0.3.0; kernel 2/2 linked; 0 dead links
```

`setup` writes `RULES.md` into a managed block of each harness's always-loaded instruction file and links each kernel skill into its skill directory:
| Harness | Rules | Kernel skills |
| --- | --- | --- |
| Claude Code | `~/.claude/CLAUDE.md` | `~/.claude/skills/` |
| Codex | `~/.codex/AGENTS.md` | `~/.agents/skills/` |
| Hermes | `~/.hermes/SOUL.md` | `~/.hermes/skills/spindle/` |

**What setup will not touch:** Text outside the managed block is never edited. A skill link is created or retargeted only when it is missing, dead, recorded as installed by an earlier `setup`, or an older Spindle render. Anything else is reported as a conflict and left alone. `--prune-dangling` also removes dead symlinks from those skill directories, and `spindle house remove` undoes the setup for a harness.

### Keep it current

After you edit the house, bump `version`. Then one command, suitable for a daily timer, brings a machine up to date:

**stale or edited:** `status` reports rules that are behind the house, or that were edited by hand inside the managed block.

```text
$ spindle house update
house updated; v0.3.0
21 already current, 3 changed
catalog: 270 skills from 7 sources
```

`update` fast-forwards the Git checkout that holds the house, and leaves it alone if that is not a clean fast-forward. It then reinstalls rules and kernel for the harnesses this machine already has set up and rebuilds the catalog index. `--no-catalog` skips the rebuild.

Point production machines at a dedicated clone of the house rather than a checkout you edit in. Then a half-finished edit never reaches a running agent, and the timer only ever moves to a commit you merged.

### Projects carry their pattern

```text
$ cd ~/src/data-site
$ spindle house setup --here --pattern data-publication
$ spindle house status --here
```

This writes the pattern's rules into a managed block in `AGENTS.md`, and in `CLAUDE.md` when that file exists and does not import `AGENTS.md`. A missing `CLAUDE.md` is created as a one-line import. The pattern's skills are copied to `.agents/skills/<name>`, with a relative link from `.claude/skills/<name>`.

The copies are meant to be committed, so they work in worktrees, on other machines, and in dispatched jobs. `.spindle/house.json` records the pattern, the house version, and each skill's digest. A later `setup --here` updates from the house and refuses to overwrite a copy edited in the repository unless you pass `--force`.

**ignored copies:** If the repository's ignore rules exclude a vendored skill, setup says so and exits non-zero. An ignored copy stays on one machine and never reaches a job.

Add `--with-house-rules` to embed the full house rules in the repository, for environments that never run the machine setup: a hosted agent, a container, a teammate's laptop.

### Writing good house rules

- **Rules for every task, everywhere.** Anything specific to a kind of project goes in a pattern; anything specific to one repository goes in that repository's own `AGENTS.md`.

- **Say what to do, and why.** A rule that names the behavior and the reason survives contact with edge cases. A bare prohibition does not.

- **Prefer a check to a rule.** Nothing fails when an agent skips a sentence. When a rule keeps being broken, move it into a lint, a test, or the structure of the code, and delete the sentence.

- **Tell agents how to reach the catalog.** One short section naming `spindle find`, `use`, and `report` is enough for an agent to source skills on its own.

---

<!-- https://lavallee.github.io/spindle/catalog.html -->

the catalog

## Hundreds of skills available. None of them in the way.

The catalog lists skill sources pinned to exact commits. Nothing in it is installed. An agent or a job runner asks for help with a task and gets back the few skills a judge thinks would matter, as files to read.

### Sources and pins

```text
[[source]]
slug = "ours"
path = "../packages"                 # a local directory, read in place

[[source]]
slug = "upstream"
ref = "github:owner/skills@<40-character commit>"
track = "main"
include = ["plugins/upstream/skills/*"]   # optional: index only these
exclude = ["plugins/upstream/skills/setup-*"]
notes = "Shown to agents beside each skill from this source."
```

```text
$ spindle catalog sync               # export pinned sources, rebuild the index
$ spindle catalog sync upstream      # or one source
$ spindle catalog list
$ spindle catalog update             # what would a newer upstream commit change?
$ spindle catalog update upstream --apply
```

A Git source must pin a full commit. `update` compares the pin with the tracked branch and lists the skills added, changed, and removed, with any new static indicators. `--apply` rewrites the pin, and you review it as an ordinary diff to the house. `include` and `exclude` take globs over each skill's directory, relative to the source root, so one plugin can be taken from a repository of many and its harness-specific setup skills left out.

**refs:** Each skill is `source/name`. The name is the skill's frontmatter `name`, or its directory name when that is a display name such as "Review Mode".

For every skill the index records its digest, the commit it came from, whether it hard-codes its own install location (and so cannot be used from a snapshot), and static indicators of network, credential, or shell use.

### Find, use, report

```text
$ spindle find "agents keep making the same mistake in this repo"
* 0.80 1.00  upstream/correct    Find the mistakes agents keep repeating and make each impossible
  0.45 0.92  other/retro         Conduct a retrospective on a coding session
$ spindle use upstream/correct              # the SKILL.md path; --print for the text
$ spindle report --outcome accepted --helped upstream/correct
$ spindle usage                             # counts and the prior per skill
```

The two numbers are the judge's probability and the text-match score relative to the best match. `use` hands over a path, which works in any harness that can read files and needs no install, lease, or reload. Use a lease (try or borrow) only when a skill has to appear in a harness's native skill list.

### How a choice is made

##### Expand

An optional command rewrites the task as phrases a skill description would use.

[sourcing] expand

##### Recall

Full-text search ranks the catalog per phrase and for the task, then fuses the rankings.

BM25 + RRF

##### Weigh

Ranks are weighted by each skill's record. Kernel skills are left out.

usage prior

##### Judge

Would this skill materially help? At or above 0.6 is selected. None is a fine answer.

--judge auto|jev|none

##### Receipt

The selection is saved with its candidates, scores, and skill digests.

~/.spindle/selections

**The expander** is any executable named in `house.toml` that reads the task on stdin and prints short search phrases, one per line. It is usually a small model call. A missing command, a non-zero exit, a timeout, or empty output means no expansion. `--expand none` skips it.

**task text leaves the machine:** The expander and the judge both see the task. Use `--expand none` and `--judge none` when that is not acceptable.

**The judge** is the Jev decision model: one call, a calibrated probability per candidate. Enable it with `TYPESAFE_API_KEY`, or name a key file with `SPINDLE_JEV_KEY_FILE` or `jev_key_file` in `~/.spindle/house.toml`. It is advisory and fail-soft: a missing key, a timeout, or a malformed answer falls back to the text-match shortlist, marked `lexical`, and says so.

**why a judge:** Text match finds the neighbourhood. It cannot tell a skill that would help from one that only shares vocabulary with the task.

### Feedback

Every step appends to `~/.spindle/usage.jsonl`: what was offered and selected, what was read, and how the work was judged. `report --helped` and `--hurt` are direct verdicts. An outcome on a run that merely had a skill loaded counts as weak evidence. The resulting prior lifts skills that keep helping and lowers skills that keep being rejected, and `spindle usage` shows both.

### For job runtimes

A runner that dispatches agent jobs needs one call before dispatch and one after grading:

```text
$ spindle brief --json --task-file - --repo "$WORKTREE" < commission.md
$ spindle report --selection "$SELECTION" --job "$JOB_ID" \
    --outcome accepted --loaded upstream/systematic-debugging
```
| `brief --json` field | What the runtime does with it |
| --- | --- |
| `prompt_block` | Append to the agent's prompt. It lists each offered skill with the path to read, so the agent pays for a skill only if it uses it. Empty means nothing was offered. |
| `skills` | Store beside the job's own receipt: selection id, how it was chosen, delivery mode, and each skill's ref, digest, and judged probability. A reviewer then sees what guidance the producer had. |
| `selection` | Pass to `report` after grading. |
| `read_roots` | Add to the agent's read allow-list in a sandbox, so it can open an offered skill, or one it finds itself, by path. |

- **No judge, no offer.** A shortlist built from a whole commission is mostly noise, so without a judge `brief` returns a short "skills on demand" section that tells the agent how to run `find` once it knows what it is about to do. `--unjudged shortlist|none` changes that.

- **Inline only when you must.** `--inline` embeds skill text for sandboxes that cannot read outside their workspace, at most two skills and only ones scored 0.7 or higher. Embedded text is paid for whether or not it is used.

- **Attribution without plumbing.** Set `SPINDLE_JOB` in the agent's environment and every `find` and `use` it runs is attributed to the job, so `report --job` joins them.

- **Rules for bare runtimes.** `--rules` returns the house rules in the same answer, for runtimes that load no harness instruction file.

- **Never a gate.** Treat any failure like an empty `prompt_block`. Skill sourcing should never stop a job.

### What Spindle will not do

**Run a source**

Sources are exported through the same non-executing snapshot path as `spindle inspect`: no hooks, no install scripts, no package managers.

**Float a version**

A Git source without a full commit is refused. Upstream work arrives only through `catalog update --apply`.

**Let a skill outrank the task**

The handover tells the agent a skill is guidance. It never overrides the task, its acceptance criteria, or the house rules.

**Hide what was offered**

Every selection has a receipt, and every offered skill a digest, so an evaluator can pin the exact bytes in play.

---

<!-- https://lavallee.github.io/spindle/lifecycle.html -->

the vetting lifecycle

## Try first. Adopt deliberately. Keep evidence.

Most skills are reached on demand from the catalog and never installed. For the ones that must live in a harness's native list, or that need more care, Spindle keeps a reversible chain from intent to exact runtime behavior. Temporary use is easy; durable custody has to be earned.

A skill is more than its `SKILL.md`. Its effect depends on exact package bytes, the other skills a harness can see, the model actually served, available tools, policy, and whether the instructions still improve the current generation of model. Spindle keeps those facts distinct and joins them with content-addressed receipts.

inspect→ try / borrow→ compose→ bootstrap→ activate→ evaluate→ adopt / release

### The harness is the front door

`spindle harness setup --harness codex --here` or its `claude` counterpart projects a minimal, versioned operator into the harness's native project-skill directory. Invoke it as `$spindle` in Codex or `/spindle` in Claude Code. The operator calls `spindle harness context --here --json` for the live surface lock, effective inventory, custody, blockers, hook heartbeat, authorization rule, and exact dry-run/apply commands. It does not carry a stale second copy of the lifecycle in model context.

When one harness launches another, inherited environment markers can name both. Spindle uses the nearest named harness process as stronger runtime evidence and otherwise fails closed for an explicit `--harness`. Installing the operator proves neither that a hook ran nor that another skill was activated, useful, or adopted.

### Intent before authority

`spindle inspect` builds an intent card without importing or executing candidate code. It separates package facts from contextual fit, reports provenance, contents, authority requirements, context cost, and known evidence, and leaves the package inactive.

```text
$ spindle inspect ./candidate/review \
    --for "review this migration" --harness codex --here --json

$ spindle inspect \
    'github:owner/repository@0123456789abcdef0123456789abcdef01234567#review' \
    --harness claude --here --json
```

### Temporary before durable

try

##### One disposable session

- Exact content-addressed snapshot.

- Read-only harness posture by default.

- Startup, activation, run, and cleanup receipts.

- No durable adoption.

borrow

##### One expiring lease

- Overlays the actual incumbent blend.

- Names permitted surface, harness, agents, and authority.

- Rechecked on launch, resume, and compaction.

- Released or expired without rewriting history.

### Desired state beats ambient state

A surface lock names exact adopted and leased inputs. At startup, Spindle inventories repository, ancestor, user, administrator, plugin, and known system scopes; compares desired with observed state; and classifies every entry. It may repair or remove only a projection whose current path and target still match an immutable ownership receipt.

**Foreign means preserve:** A user-managed directory, unowned symlink, plugin, or same-name collision is never silently deleted. A collision blocks strict startup until an exact, content-bound decision exists. Post-discovery repair reports `restart-required` instead of pretending the session is clean.

```text
$ spindle inventory --effective --harness codex --here
$ spindle bootstrap --harness codex --here --check
$ spindle hooks install --harness codex --scope repo --here --dry-run
$ spindle launch codex --here --
```

### One package, agent-local realizations

Parent and child agents independently resolve from the model actually served, effort, role, harness build, effective tools, policy, and active blend. The package stays immutable: Spindle combines its invariant core with at most one evaluated overlay and writes a realization receipt. The adapter separately records whether that exact agent loaded it.

Harness mechanics belong in deterministic adapters, not in portable skill prose.Version checks, routing, permissions, startup, and receipt writing stay outside `SKILL.md`.

### Evidence before promotion

Evaluation reports availability, activation, routing, authorization, behavior, and adapter conformance as separate gates. Named arms include no-skill, invariant core, candidate overlay, incumbent, and ablations. A smaller or empty overlay qualifies only when repeated held-out results clear a predeclared non-inferiority margin, hard floor, and efficiency threshold for the exact runtime coordinate.

### Adoption is maintenance custody

`spindle adopt` promotes the exact bytes from a successful trial. Updates are new candidates tested beside the incumbent; they do not inherit old evaluation claims. Health reports source, package, cache, inventory, model, harness, toolset, and policy drift independently. Rollback creates a new exact decision without rewriting prior records.

```text
$ spindle adopt sha256:<lease-id> --here --dry-run --json
$ spindle update try review --harness codex --task-file task.md --here
$ spindle health --harness codex --here
$ spindle rollback review --harness codex --reason regression --here
$ spindle retire review --harness codex --reason obsolete --here --dry-run
```

### Custody survives failure

Immutable records can rebuild mutable indexes after a crash. Deterministic state bundles import only absent or byte-identical files. Cache garbage collection uses an exact plan and protects all current locks, leases, and adoption history. Legacy migration audits preserve ambient state and never turn an old install into an adoption by inference.

### Adapters are certified per build

Spindle's reference matrices fail closed on unobserved runtime facts. The checked evidence certifies Claude Code 2.1.220 and Codex CLI 0.146.0 with independently activated mixed-model parent and child agents. A new harness build, model, tool composition, policy, package digest, or active blend is a new coordinate—not permission to reuse an old claim.

---

<!-- https://lavallee.github.io/spindle/how-it-works.html -->

how it works

## From candidate intent to verified activation.

Spindle is a control loop. Exact package bytes receive bounded authority, composition resolves desired state, startup reconciles the harness, each agent gets its own realization, and evidence determines whether the skill should stay.

### Two paths to a skill

A skill reaches an agent in one of two ways. The light path, used for almost everything, is the catalog: an index of pinned sources, a judged choice per task, a path to read, and a usage ledger. It writes nothing into the harness and leaves no state behind but receipts. The managed path, described on the rest of this page, installs a skill into a harness's native list with exact custody, startup verification, and per-agent realization. The house kernel and project patterns sit between them: a few skills installed everywhere, from one versioned directory.

**state on disk:** `~/.spindle/catalog/index.json`, `source-snapshots/`, `selections/`, and `usage.jsonl` for the light path; content-addressed lifecycle records for the managed one.

### The lifecycle record chain

No single “installed skill” record can answer where bytes came from, why they are authorized, what an agent loaded, and whether they helped. Spindle keeps those questions separate:

SourceRef→ PackageRevision→ IntentCard→ Lease / Adoption→ SurfaceLock→ Realization→ Activation→ Evaluation
| Record | Question answered |
| --- | --- |
| `PackageRevision` | Which exact source and skill bytes are under review? |
| `IntentCard` | What outcome, trigger boundary, authority, and context cost does the candidate claim? |
| `Lease` | Who may use these bytes temporarily, where, until when, and with what authority? |
| `AdoptionRecord` | Who accepted durable maintenance custody after which successful trial? |
| `SurfaceLock` | Which exact adopted and leased inputs should this harness expose? |
| `AgentRealization` | Which invariant core and evaluated overlay fit this actual agent coordinate? |
| `ActivationReceipt` | What model, tools, policy, and projection did the harness actually expose? |
| `EvaluationClaim` | Did this intervention help on this bounded artifact/runtime/task distribution? |

### Composition vocabulary

The original composition nouns remain the machinery for authored, managed blends:

skill→ package→ distribution→ channel→ blend→ profile→ surface

**skill**

A directory with a `SKILL.md` (YAML frontmatter `name`/`description` + a Markdown body). The canonical, authored-once unit. Kept small on purpose.

**package**

A pip-installable project that ships skills and advertises capabilities, declared with `[tool.spindle.package]`. Spindle discovers installed packages through that metadata.

**distribution**

A pip-installable bundle that groups packages (as ordinary dependencies) and carries surface-wide assets — doctrine, channels, profiles — declared with `[tool.spindle.distribution]`.

**channel**

A versioned `(scope × harness)` manifest listing which skills a surface should receive at that scope, plus the absolutes in force and optional routing tiers.

**surface**

A repo or agent that consumes a blend. Carries a name, a harness, an autonomy mode, one or more app-class clusters, and a target model.

**profile**

A data-driven, versioned renderer. A *harness* profile sets dialect; a *model* profile sets density. Each names a transform: `identity`, `terse`, `trim`, or `llm`.

**blend**

The resolved skill subset for one surface — the composition — together with the absolutes in force and a record of every override (shadow). The thing that actually lands.

**doctrine**

The versioned first-principles set (preferences, absolutes, meta-principles) that skills are checked against. One coherent frame per distribution.

**Scope:** A channel or doctrine entry has a **scope**: `system`, `cluster`, or `repo`. Scope drives both the order in which channels are selected (broad to narrow) and which layer wins when two define the same skill (narrow wins). Guardrails are the exception — they accumulate across all scopes.

### The `bind` composition pipeline

`spindle bind <repo> --harness claude` runs six stages. It is a **fail-closed** pipeline: if rendering drops a guardrail or the lint finds a problem, nothing is materialized (unless you pass `--force`).

##### Classify

Read the checkout's `pyproject.toml`/`package.json` into a signal; derive an app-class cluster key.

appclass.py

##### Select

Subscribe to channels broad → narrow: system, per-cluster, repo — for this harness.

channels.py

##### Resolve

Merge the channel layers into one blend; narrow overrides broad; record shadows; union absolutes.

composition.py

##### Render

Rewrite each skill for the harness dialect, then the model density. Verify guardrails survived.

render.py

##### Lint

Check the blend for coherence — command collisions, duplicates, unsafe irreversibles. Gate.

composition.py

##### Materialize

Symlink the resolved skills into the harness's native skills dir; touch only spindle-owned links.

materialize.py

#### 01 · Classify

Spindle reads the repo's manifests (`pyproject.toml`, `package.json`) into a `RepoSignal` — language, dependencies, notable files — and classifies it into an app-class with a single stable **cluster key** like `lang:python|network-service|uses-llms`. The surface's clusters come from that key; a repo that changes shape gets re-clustered on the next bind.

**cluster key:** A stable string describing the kind of repo. It's how a channel says "these skills are for Python services" without naming any specific repo.

#### 02 · Select

The surface subscribes to an ordered list of channels, least- to most-specific: `(system, system)`, then one `(cluster, <key>)` per cluster, then `(repo, <name>)`. Each resolves to a file on disk under the active distribution's `source_dir`:

```text
channels/<scope>/<name>/<harness>/channel.toml
```

The harness is applied *here*: a Claude surface only ever reads the `claude/` manifests. Missing manifests are simply skipped — a surface legitimately has only a system channel. A channel manifest is small:

```text
# channels/system/system/claude/channel.toml
version = "0.1.0"
absolutes = ["A1", "A2"]        # doctrine ids in force at this scope
skills = ["clarify", "design", "tasks", "review"]

[tiers]                         # optional routing hints (advisory)
clarify = "judgment"
design  = "judgment"
tasks   = "judgment"
review  = "judgment"
```

Skill names are resolved through an index built from the installed packages. A name with no installed package is dropped — which is exactly why a bind that finds nothing prints `resolved 0 skills`: the channel named skills that aren't installed.

**version matters:** A channel's `version` feeds the binding coordinate, so bumping it is how you signal that a surface's blend has meaningfully changed.

#### 03 · Resolve

Resolution merges the selected layers into one `Composition`. Each skill occupies a **slot** keyed by its command (falling back to its name); a more-specific layer overrides a less-specific one for the same slot, and every override is recorded as a **shadow** rather than silently dropped. Absolutes are *unioned* across all layers and never lost to precedence — the guardrail floor only rises. The default precedence is `system → cluster → repo`.

#### 05 · Lint

With the blend assembled (and already rendered), the linter runs pure coherence checks over its metadata: no two skills may claim the same command, no skill may appear twice, and a genuinely irreversible skill must carry the matching absolute. Problems stop the bind unless forced. The linter inspects *structure*, not prose — which is why the guardrail check lives in rendering (below), not here.

#### 06 · Materialize

Finally, Spindle symlinks each resolved skill into the harness's native location and reports a per-skill action — `linked · updated · kept · removed · skipped`. It reads the surface's previous binding to know which links it owns, and removes only those: a file you added by hand is never touched.

**install location:** `claude → .claude/skills`, `codex → .agents/skills`, `pi → .pi/skills` (fallback `.<harness>/skills`).

Then it **records** the binding: a stable coordinate over the skills, the doctrine, and the channel versions, appended to a per-surface history so any prior coordinate is a rollback target. `spindle unbind` reverses it, removing exactly the links Spindle owns.

### Startup and activation

Materialization is desired state, not proof of what a running harness saw. Before discovery, `spindle bootstrap` resolves active adoptions and leases, inventories every observable scope, compares exact content identity, and plans any ownership-safe repair. The portable `spindle launch` wrapper performs that work before starting Claude or Codex.

Stable native hooks then recheck session start, resume/compaction, and subagent start. Hook definitions contain no mutable pins: they invoke the same Spindle bootstrap command while desired state stays in the surface lock. The normal hook path is local and cache-only, emits one compact status marker, and keeps full findings in a startup receipt.

desired

##### Surface lock

- Exact adopted package and skill digests.

- Active lease IDs and expiries.

- Expected projection paths and ownership.

- Explicit foreign-conflict decisions.

observed

##### Activation receipt

- Projection actually loaded.

- Model actually served to this agent.

- Harness build and effective tool envelope.

- Effective policy and permission denials.

A pre-discovery mismatch can be repaired only when exact ownership matches. The same mismatch found after discovery returns `restart-required`. Foreign state is preserved in both cases.

### Rendering & profiles

Selection decides *which* skills; rendering decides *what text* each one becomes for this surface. Because rendering produces new text, its output can't be a symlink — it's written to a content-addressed store and the blend is repointed at it. Two profile axes compose, dialect then density:

axis 1 · harness

##### Dialect

- `identity` — verbatim (Claude is the reference dialect).

- `terse` — deterministic whitespace collapse; content-preserving by construction.

- `llm` — an actual model rewrite into the harness dialect; skipped if no client is configured.

axis 2 · model

##### Density

- `identity` — keep all scaffolding (what weaker models want).

- `trim` — strip author-marked scaffold fences, then `terse`.

- `llm` — model-driven densification.

Profiles are tiny, versioned TOML files:

```text
# profiles/claude/profile.toml — harness dialect
version = "1"
transform = "identity"

# profiles/models/frontier/profile.toml — model density
version = "1"
transform = "trim"
tier = "frontier"
```

The `trim` transform is the "optimize things *out*" half of tuning. An author marks a passage that only smaller models need, and a frontier profile removes it — the same canonical skill, rendered denser for a model that reads faster without it:

**author once, render many:** One `SKILL.md` serves every model tier. The scaffolding is written once and trimmed per surface, never duplicated.

```text
<!-- scaffold:examples -->
Worked example a smaller model benefits from…
<!-- /scaffold -->
```

### Doctrine

Doctrine is the coherent first-principles frame, kept as a versioned, hand-editable, machine-readable TOML artifact. It has three entry kinds:

- **preferences** — "favor X over Y," scoped, with a note and provenance.

- **absolutes** — `ALWAYS`/`NEVER` hard rules, scoped and rare; densest at system scope.

- **meta-principles** — rules about how the other principles are written.

```text
# doctrine/doctrine.toml (excerpt)
version = "0.1.0"

[[preference]]
id = "P1"
scope = "system"
favor = "clear acceptance evidence"
over  = "performative process"

[[absolute]]
id = "A2"
scope = "system"
mode = "NEVER"
statement = "fabricate missing facts"
```

Doctrine matters because it makes "coherence" a defined, versioned, testable property instead of a vibe. Its **coordinate** — `<version>+<hash>` — is pinned into every render cache key and every binding record, so a rollback can re-fetch the exact doctrine that produced a blend. `spindle doctrine validate` refuses a malformed doctrine before it can ever render into skills.

**shared vocabulary:** The absolute *ids* (A1, A2, …) are the shared language between channels (`absolutes = […]`) and doctrine — one place defines them, the other puts them in force.

### The safety floor

Two mechanisms make it structurally hard to compose away safety. First, absolutes accumulate: because resolve unions them across every layer, a narrow channel can add a guardrail but never remove one. Second, rendering verifies preservation:

Every guardrail clause in a skill's source must survive, normalized, in the rendered output — or the bind fails closed.render.verify_preserved

Guardrail clauses are lines matching `ALWAYS`, `NEVER`, `MUST NOT`, or `DO NOT`. The coherence linter reads metadata and can't catch a paraphrase that quietly drops one — so this deterministic check is the backstop, and it holds even when an `llm` profile ignores its instructions. A dropped clause raises an error and the binder materializes nothing.

### Determinism & caching

Everything is content-addressed, which is what makes the "extra step" cheap to repeat. A rendered skill is cached under `sha256(doctrine × harness-profile version × model-profile version × skill content)`; change any input and the cache invalidates, change nothing and the render is reused. A binding's coordinate is `sha256(skills + doctrine + channel versions)`. Re-binding an unchanged surface is nearly free, and every past coordinate is a precise rollback target.

**warm cache:** This is why `spindle advance run` can precompute every surface ahead of time — see the rationale and guide.

---

<!-- https://lavallee.github.io/spindle/evaluation.html -->

evaluation

## Availability is not improvement.

A projection can exist without loading, load under the wrong model or policy, and still fail to improve behavior. Spindle reports those gates separately, then evaluates paired or named-arm interventions on an exact runtime coordinate.

It is tempting to treat "the skill is installed" as "the skill works." It isn't. A skill can be present, coherent, and safely rendered and still make no difference — or make things worse. Spindle draws a hard line between the two questions and refuses to let a bind stand in for an effectiveness claim.

startup + activation

##### Runtime correctness

- Were exact bytes available?

- Did this agent load the intended realization?

- Did routing and authorization match?

- Did the adapter prove its runtime facts?

spindle eval

##### Improvement

- Does the skill improve behavior?

- On this task family, model, and harness?

- Versus running without it?

- **Measured on held-out cases.**

Availability is not activation. Activation is not authorization. None of them is improvement.The boundaries the evaluation contracts enforce.

### Two kinds of evidence

Everyday use produces cheap evidence. Each report records whether work that was offered a skill was accepted, and whether the skill helped or hurt. That ledger tunes the catalog's ranking, but it is observational: the work was not run without the skill, so it cannot say the skill caused the result. Promotion needs the stronger evidence described below, a paired experiment on held-out cases. Use the ledger to decide what to evaluate, and the evaluation to decide what to keep.

**ledger vs. experiment:** `spindle usage` answers "how has this fared?". `spindle eval run` answers "does it help, against a baseline?".

### The paired experiment

Every selected case runs *twice*: once as the **baseline** (skill off) and once as the **variant** (skill on). Comparing the same case with and without the skill is the only way to attribute a difference to the skill rather than to the case. Case order and the within-pair arm order are both shuffled from the manifest's `seed` — randomized to avoid ordering bias, yet perfectly reproducible.

**arm:** One side of the pair: `baseline` or `variant`. The runner must actually invoke the skill on the variant and not on the baseline — Spindle checks.

An evaluation is a manifest. It names the skill, the runner, the frozen dimensions (model, harness), and a set of cases split into `development` and `held_out`:

```text
# eval.toml (excerpt)
schema_version = 1
id = "diagnosing-bugs-v1"
skill = "diagnosing-bugs"
skill_path = "candidate/SKILL.md"
runner = ["python", "runner.py"]     # an argv contract, not a model client
seed = 20260711
min_held_out_cases = 10
min_improvement = 0.05

[acceptance]
required_variant_gates = ["task_closed", "facts_correct", "no_harm"]

[dimensions]
harness = "isolated-executor"
model = "frozen-model-coordinate"

[[cases]]
id = "unseen-regression"
split = "held_out"
fixture = "fixtures/unseen-regression.json"
```

### The held-out promotion gate

**Development** cases exist so you can iterate on fixtures and graders; they never make a run promotion-eligible. Promotion is decided only on **held-out** cases the skill author was not tuning against. A run may promote only if all applicable conditions hold:

**why held-out:** Tuning a skill until it passes the cases you're watching proves nothing. A gate that only counts unseen cases is the difference between a measurement and a rationalization.

≥ Nheld-out cases met

0runner errors

100%complete pairs

allrequired gates pass

Δ > 0variant over baseline

When `min_improvement` is zero, the variant mean must be *strictly* above baseline; otherwise it must clear the configured margin. The held-out mean is a necessary gate, not the whole decision — Spindle's own docs are explicit that you should still review case-level regressions, cost, latency, and human-correction time before you adopt. Rejected and null receipts are kept as evidence for that exact skill hash.

### Failures that cannot average away

A manifest may optionally declare `[acceptance].required_variant_gates`. Each named gate in every held-out variant result must have a Boolean `passed` value and non-empty `evidence`. One missing, malformed, or false required gate blocks promotion regardless of score. Passing every gate is still not enough: the variant must also clear the comparative held-out improvement bar. Baseline and development gate outcomes are diagnostic receipt evidence, not independent promotion blockers.

```text
"gates": {
  "task_closed": {"passed": true, "evidence": "completion signal observed"},
  "facts_correct": {"passed": true, "evidence": {"checked_claims": 4}},
  "no_harm": {"passed": true, "evidence": "no misleading claims found"}
}
```

The runner or skill package defines the gate meanings and oracles; Spindle enforces their conjunction. This prevents factual, harm, or task-closure failures from disappearing inside an average without creating a universal UX score. A model critic may identify risks, but it cannot override a deterministic gate or stand in for observed user behavior. The deterministic `outcome-uat` example shows the contract.

### Named arms and evidence-driven minimalism

The paired baseline/variant format remains useful and supported. The v0.2 matrix contract adds the comparisons needed when frontier models may no longer need yesterday's instruction scaffolding:

#### No skill

Rebaseline the model and harness default instead of assuming the old intervention still adds value.

#### Invariant core

Measure the portable intent and safety residue without any tuned overlay.

#### Candidate overlay

Test the smallest proposed steering delta for this exact agent coordinate.

#### Incumbent + ablations

Compare current behavior and remove one bounded instruction at a time.

Every result reports six independent gates:
| Gate | What it establishes |
| --- | --- |
| availability | The exact artifact was present. |
| activation | The intended agent actually loaded it. |
| routing | The correct realization reached the correct agent. |
| authorization | The effective tool and policy envelope matched the grant. |
| behavior | The task-specific grader passed with retained evidence. |
| adapter | The named harness build could prove the required runtime facts. |

A smaller candidate qualifies only when repeated held-out pairs clear a predeclared one-sided non-inferiority bound, every run stays above a hard floor, required runtime gates pass, and the artifact reduction is material. A zero-byte overlay is valid—it is never assumed successful. Changing model, harness build, toolset, policy, package digest, active blend, or task distribution requires rebaselining.

```text
$ spindle eval matrix validate matrix.toml
$ spindle eval matrix run matrix.toml
$ spindle eval matrix freshness receipt.json \
    --coordinate model=gpt-5.6-sol --coordinate harness=codex \
    --coordinate harness_build=0.146.0 --coordinate toolset_digest=sha256:… \
    --coordinate policy_digest=sha256:… \
    --coordinate active_blend_digest=sha256:…

$ spindle eval distill classify ./candidate/review
$ spindle eval distill plan ./candidate/review --json
$ spindle eval distill stage ./candidate/review \
    --proposal sha256:… --destination ./trials/review-smaller --dry-run
```

Distillation classifies behavioral steering, reference knowledge, deterministic procedures, tool integrations, fixtures, and obsolete workarounds. Deterministic candidates move toward tools or Chip; rich reference material remains progressively disclosed. Staging creates a local trial revision and never auto-adopts it.

### The runner is an argv contract

Spindle never calls a model provider. A manifest names an argv `runner`, and Spindle invokes it once per case per arm — with no shell — passing everything through environment variables. The runner may wrap an isolated executor, a benchmark harness, or a deterministic local fixture; it writes one JSON result and exits.
| Variable | Meaning |
| --- | --- |
| `SPINDLE_EVAL_ARM` | `baseline` or `variant` |
| `SPINDLE_EVAL_SKILL_ENABLED` | `0` or `1` — must match the arm |
| `SPINDLE_EVAL_SKILL_FILE` | candidate skill path (variant); empty for baseline |
| `SPINDLE_EVAL_FIXTURE` | absolute path to the case fixture |
| `SPINDLE_EVAL_SPLIT` | `development` or `held_out` |
| `SPINDLE_EVAL_DIMENSIONS` | JSON of the frozen `[dimensions]` |
| `SPINDLE_EVAL_REQUIRED_VARIANT_GATES` | JSON array from `[acceptance].required_variant_gates` |
| `SPINDLE_EVAL_RESULT_PATH` | where the runner must write its JSON result |

The result is small and validated. `score` is bounded to `[0,1]`; `skill_invoked` must match the arm; `evidence` must be non-empty. A timeout, a nonzero exit, a malformed result, missing evidence, or an arm mismatch is an evaluation error — and an error blocks promotion. `passed` is runner-supplied diagnostic evidence; promotion uses the comparative score and any explicitly configured required gates.

**freeze the coordinates:** The runner should hold model, tools, and budgets constant across arms and declare them in `[dimensions]` and its own evidence — so a measured delta is attributable to the skill alone.

```text
// the JSON the runner writes to $SPINDLE_EVAL_RESULT_PATH
{
  "score": 0.82,
  "passed": true,
  "skill_invoked": true,
  "evidence": {"grader": "exact-regression-check", "receipt": "…"},
  "gates": {
    "task_closed": {"passed": true, "evidence": "completion signal observed"}
  },
  "metrics": {"false_positives": 0, "corrections": 1},
  "artifacts": [".../agent-output.txt"]
}
```

### Receipts — durable, not intrusive

Each run writes a receipt that keeps input hashes, pair order, exit state, duration, stdout/stderr *hashes*, scores, metrics, and the promotion decision — but not full transcripts. It's enough to audit and reproduce a decision for a specific skill hash without hoarding potentially sensitive agent output.

```text
$ spindle eval validate examples/evaluation-sample/eval.toml
$ spindle eval run      examples/evaluation-sample/eval.toml
$ spindle eval show     examples/evaluation-sample/receipts/<receipt>.json
```

### The task families it starts with

#### Diagnosis

Exact symptom reproduction, loop determinism, pre-edit hypothesis testing, regression sensitivity — plus completion, time, and cost.

#### Code review

True findings, severity, false positives, spec-vs-standards attribution, missed seeded issues, correction time — with clean controls.

#### Handoff

Repeated exploration, missing decisions, invalid assumptions, time to first correct action, and completion in a fresh context.

**One gate, two jobs:** Spindle's optimizer and distillation workflow consume these evidence gates. Optimizing prose, deleting redundant steering, and evaluating behavior remain separate from adoption—and a proposed edit that drops a guardrail is rejected outright.

---

<!-- https://lavallee.github.io/spindle/guide.html -->

guide

## Using Spindle.

Set up a house and a catalog first; that covers most days. When a skill has to be installed, inspect it, try it in one disposable session, and adopt it only after the runtime evidence is sound. Composition and authoring are deeper paths, not prerequisites.

### Set up a machine

```text
# the CLI, pinned to a release
$ uv tool install "git+https://github.com/lavallee/spindle@v0.4.2"
# a dedicated clone of the repository that holds your house
$ git clone https://github.com/you/my-skills ~/.local/share/spindle/house
$ spindle house init ~/.local/share/spindle/house/house
$ spindle house setup --dry-run
$ spindle house setup
$ spindle catalog sync
# optional: a judge for find and brief
$ echo 'jev_key_file = "/path/to/typesafe.env"' >> ~/.spindle/house.toml
```

Run `spindle house update` from a daily timer to pull merged house changes, reinstall rules and kernel, and rebuild the index. Start a new harness session after setup so it loads the rules. See the house for what each step writes.

### Give a project its pattern

```text
$ spindle house patterns
$ spindle house setup --here --pattern data-publication
$ git add AGENTS.md CLAUDE.md .agents .claude .spindle && git commit -m "Vendor house pattern"
```

Commit the vendored copies so worktrees, other machines, and dispatched jobs see them. When the house version moves, run `setup --here` again; `status --here` says when the copy is behind.

### Add a skill source

1. Add a `[[source]]` to `catalog.toml` with a full commit, and `include`/`exclude` globs if you want only part of the repository.

2. Test it in a scratch home before it reaches any agent: `SPINDLE_HOME=/tmp/s SPINDLE_HOUSE_DIR=./house spindle catalog sync <slug>`, then `spindle catalog list` and a few `spindle find` queries you expect it to win and to lose.

3. Merge the change to the house, then `spindle house update`.

4. Later, `spindle catalog update <slug>` shows what upstream changed; `--apply` moves the pin as a reviewable diff.

### Wire a job runner

Before dispatch, call `spindle brief --json` with the commission and append its `prompt_block` to the agent's prompt. Store its `skills` record with the job, add its `read_roots` to any sandbox read allow-list, and set `SPINDLE_JOB` in the agent's environment. After grading, call `spindle report --selection … --job … --outcome …`. Treat any failure as "no skills offered". The catalog page lists each field.

### Drive it from Codex or Claude Code

Install Spindle from the public marketplace, then let its namespaced operator inspect and set up one small project-local operator as the ordinary control surface. The catalog name is shared, but each harness has its own marketplace manifest and commands:

```text
# Codex: install once, then start a new session
$ codex plugin marketplace add lyra-forge/marketplace
$ codex plugin add spindle@lyra-forge
› $spindle:spindle set up Spindle for this repository

# Claude Code: install once, then start a new session
$ claude plugin marketplace add lyra-forge/marketplace
$ claude plugin install spindle@lyra-forge
› /spindle:spindle set up Spindle for this repository
```

The plugin includes the exact pinned Spindle source and a deterministic launcher, so it needs no separate Python package install. Python 3.11 or newer is required. Marketplace skills are namespaced to avoid conflicts; after project setup and a new session, use the shorter `$spindle` in Codex or `/spindle` in Claude Code.

The project-local operator reads live lifecycle state and exact command contracts from the CLI, so its prose stays small while Spindle evolves:

```text
$ spindle harness setup --harness codex --here --dry-run
$ spindle harness setup --harness codex --here

# after starting a new Codex session
› $spindle show me which skills are active and why

# Claude Code uses its native slash invocation
› /spindle try this review skill once; do not adopt it
```

`harness setup` snapshots the operator's exact bytes into the Spindle cache, projects an owned symlink into `.agents/skills/spindle` or `.claude/skills/spindle`, and merges stable project startup hooks. It can bootstrap even when unrelated ambient conflicts already block strict startup; the operator then reports those conflicts rather than hiding or deleting them. The operator link points to a machine-local immutable cache and should not be committed. Review the hook configuration separately: commit it as shared project policy, or ignore it for a local-only setup.

**Three separate checks:** `harness status` reports operator version/custody, hook definition, and observed hook heartbeat separately. For Codex, trust the project layer and exact command through `/hooks`; definition presence alone is `configured-unverified`. Run `harness remove --dry-run` to preview removal of only Spindle-owned state.

### Inspect, try, and borrow

Local inspection imports nothing, runs nothing, and writes no candidate state. A remote inspection may populate only a verified provenance/source cache; it does not activate the candidate.

```text
$ spindle inspect ./candidate/review \
    --for "review this migration" --harness codex --here --json

# preview, then run one disposable read-only session
$ spindle try ./candidate/review --harness codex \
    --task-file task.md --here --dry-run
$ spindle try ./candidate/review --harness codex \
    --task-file task.md --here

# keep the exact snapshot temporarily without adopting it
$ spindle borrow ./candidate/review --harness codex \
    --until 2h --here --dry-run
$ spindle release sha256:<lease-id> --harness codex --here --dry-run
```

`try` retains startup, activation, run, and cleanup receipts but no adoption. `borrow` adds one exact, expiring lease over the current blend. Executable resources, network, credentials, and tool expansion are separate grants; an inspection result is never permission to execute them.

### Verify startup

Use the portable pre-discovery boundary even when native hooks are available. It compares the exact surface lock with the effective harness inventory and reconciles only receipt-owned projections:

```text
$ spindle inventory --effective --harness codex --here
$ spindle bootstrap --harness codex --here --check
$ spindle bootstrap --harness codex --here --reconcile-owned
$ spindle launch codex --here --

# stable definitions; mutable pins remain in Spindle state
$ spindle hooks plan --harness codex --scope repo --here
$ spindle hooks install --harness codex --scope repo --here --dry-run
$ spindle hooks status --harness codex --scope repo --here --effective
```

Foreign state is inventoried and preserved. A same-name collision blocks strict startup unless an exact path-and-content decision exists. A mismatch found after discovery reports `restart-required`.

### Adopt, update, and retire

A successful zero-exit lease can be promoted into durable maintenance custody. Updates are tested beside the incumbent and never inherit its evaluation claims:

```text
$ spindle adopt sha256:<lease-id> --scope repo --here --dry-run --json
$ spindle health --harness codex --here
$ spindle update plan --harness codex --here --json
$ spindle update try review --harness codex --task-file task.md --here
$ spindle rollback review --harness codex --reason regression --here
$ spindle retire review --harness codex --reason obsolete --here --dry-run
```

Rollback and status changes append decisions rather than rewrite history. Retirement removes only the current projection proven by an ownership receipt. Use `vendor` or `distill` to inspect alternate custody paths without changing adoption.

### Managed distributions

Spindle also supports authored, pip-installable distributions carrying packages, doctrine, channels, and profiles. This is the composition path for a managed skill set, not a prerequisite for candidate trials:

```text
$ uv sync --extra dev

# install the reference distribution and its packages, then activate it
$ spindle dist install examples/spindle-sample/distributions/spindle-sample
$ spindle dist activate spindle-sample

# confirm what's live
$ spindle dist list
$ spindle doctrine show
$ spindle skill list
$ spindle capability list
```

`dist install` is the durable compatibility path: it installs the distribution, links its skills into Spindle's global skill surface, and records the event and ownership. Activation selects the doctrine, channels, and profiles used for managed composition. Use `inspect`, `try`, or `borrow` when you do not want a durable global install.

**$SPINDLE_HOME:** Per-machine state — bindings, rendered cache, the active pointer, ledgers. Defaults to `~/.spindle`.

### Bind a managed blend

`bind` classifies a repository, resolves its active distribution channels, renders the selected skills for the harness and model, checks the blend, and materializes it with exact ownership:

```text
$ spindle bind /path/to/repo --harness claude

# target a model tier (changes rendering density), or preview first
$ spindle bind /path/to/repo --harness claude --model frontier
$ spindle bind /path/to/repo --harness claude --dry-run

# see how Spindle classifies a repo without binding
$ spindle appclass /path/to/repo

# remove exactly the skills Spindle materialized
$ spindle unbind /path/to/repo --harness claude
```

The materialized skills land in the harness's native directory — `.claude/skills/` for Claude — so the agent discovers them with no extra configuration. Useful flags: `--dry-run` (compute, don't write), `--no-render` (select only, skip profiles), and `--force` (materialize despite lint problems — use sparingly; it's the escape hatch past the fail-closed gate).

### Work ahead: advance & liaison

Because a bind is deterministic and cached, you can do it *before* anyone needs it. The **advance team** binds every configured surface up front — from an `advance/surfaces.toml` or a project registry — so the common case is a warm cache, and the "extra step" is already paid.

**amortized:** Re-binding an unchanged surface reuses the render cache; precomputing turns the per-repo step into a single batch job.

```text
# precompute blends for every known surface
$ spindle advance run --from-registry

# capture an ad-hoc need as a demand signal (optionally bind it now)
$ spindle liaison request /path/to/repo --intent "audit accessibility" --bind
$ spindle liaison log repo
```

The **liaison** records what a surface asked for, so a recurring one-off can graduate into a precomputed skill instead of being re-derived every time.

### Build your own

A package is an ordinary pip project with a `[tool.spindle.package]` table; a distribution is one with `[tool.spindle.distribution]` that depends on packages. Scaffold both:

```text
$ spindle package new my-tools --dest ./packages/my-tools \
      --skill clarify --skill review --capabilities planning

$ spindle dist new my-dist --dest ./distributions/my-dist \
      --source-dir ../../ --package my-tools==0.1.0
```

#### Author a skill

A skill is a directory with a `SKILL.md`: YAML frontmatter plus a short, canonical body. Keep it small; put guardrails as `ALWAYS`/`NEVER` lines so rendering will protect them:

```text
# packages/my-tools/my_tools/skills/design/SKILL.md
---
name: design
description: Convert a clarified request into an implementation design.
---

# design

Use after the request has a clear outcome and acceptance criteria.

1. Read the relevant code and existing conventions first.
2. Propose the smallest coherent change that satisfies the outcome.
3. Name the affected files, data contracts, and tests.

ALWAYS prefer existing local patterns over new abstractions.
```

#### Declare the package

```text
# packages/my-tools/pyproject.toml
[tool.spindle.package]
name = "my-tools"
version = "0.1.0"
distribution = "my-dist"
skills = ["clarify", "design", "review"]
capabilities = ["technical-design", "plan-review"]

[[tool.spindle.package.sources]]        # provenance, optional
peer = "upstream-lib"
url  = "https://github.com/org/upstream-lib"
transposed_at = "2026-07-11"
```

#### Write a channel

A channel decides which of your installed skills a surface receives at a given scope and harness. Place it under the distribution's `source_dir` at `channels/<scope>/<name>/<harness>/channel.toml`. The system channel is the broad default; add cluster channels for app-types and a repo channel to override a single surface.

**narrow wins:** A `repo` channel overrides a `cluster` one, which overrides `system` — but absolutes from every layer stay in force.

```text
# channels/system/system/claude/channel.toml
version = "0.1.0"
absolutes = ["A1", "A2"]
skills = ["clarify", "design", "review"]

[tiers]
review = "judgment"
```

#### Tune per surface with profiles

Add a harness profile (dialect) and a model profile (density) to change how skills render without touching their source. See Rendering for the transforms.

```text
# profiles/codex/profile.toml
version = "1"
transform = "terse"

# profiles/models/frontier/profile.toml
version = "1"
transform = "trim"
tier = "frontier"
```

### Evaluate a skill

Before you trust a new or edited skill, prove it helps. Write an `eval.toml`, point it at a runner, and gate on held-out scores:

```text
$ spindle eval validate examples/evaluation-sample/eval.toml
$ spindle eval run      examples/evaluation-sample/eval.toml
$ spindle eval show     examples/evaluation-sample/receipts/<receipt>.json
```

The full contract — the runner's env vars, the result JSON, and the promotion gate — is on the Evaluation page. Named-arm matrices add no-skill, invariant-core, candidate-overlay, incumbent, and ablation comparisons with explicit runtime gates:

```text
$ spindle eval matrix validate matrix.toml
$ spindle eval matrix run matrix.toml
$ spindle eval distill classify ./candidate/review
$ spindle eval distill plan ./candidate/review --json
```

Use `spindle optimize` for the older paired-edit path. Use `eval distill stage` for one bounded deletion proposal; staging never changes adoption.

### Policy, certification, and recovery

Harness claims are tied to one build. Organization policy can restrict source providers, authority ceilings, required hooks and attestations, exact adapter builds, and certification requirements:

```text
$ spindle adapter matrix --harness codex --build 0.146.0
$ spindle adapter verify certification.json
$ spindle policy check --harness codex \
    --harness-build 0.146.0 --here --json

# deterministic custody and crash recovery
$ spindle state export spindle-state.tar.gz --dry-run --json
$ spindle state recover --json
$ spindle state gc --json
$ spindle migrate plan --harness codex --here --json
```

Import merges only absent or byte-identical files. Recovery rebuilds mutable indexes from immutable receipts. GC applies an exact rechecked plan over unreferenced verified cache bytes. Migration audits legacy state without adopting or deleting it.

### Extending Spindle

Spindle is open-core: the compose-render-materialize-evaluate machinery and the contracts are public; the infrastructure behind them is meant to be your own. The core ships local reference sinks (JSONL files under `$SPINDLE_HOME`) and swaps them out through environment variables and injectable callables. Private adapters depend on Spindle — never the reverse.
| Seam | Env var | Default |
| --- | --- | --- |
| State root | `SPINDLE_HOME` | `~/.spindle` |
| Active distribution | `SPINDLE_ACTIVE_DIST_NAME` / `_DIR` | the activated dist |
| Task sink | `SPINDLE_TASK_QUEUE` / `SPINDLE_TASK_URL` | local JSONL queue |
| Gate sink | `SPINDLE_GATE_QUEUE` | local JSONL queue |
| Scout runner | `SPINDLE_SCOUT_COMMAND` | illustrative default |
| LLM render / propose | `ANTHROPIC_API_KEY` | absent → those steps skip, not fail |

Around the core sits an *optional* learning & marketplace layer — `scout`, `peers`, `verdict`, `roster`, `broker`, `gate`, `ingest`, `fleet`. Treat it as a set of extension seams: discovery passes, a judgment store, a marketplace facade, decision-gate and task queues, and cross-machine ledger sync. The public base wires the contracts and offline defaults; the live providers are yours to supply.

**honest status:** The learning/marketplace modules are intentionally skeletal — contracts and reference stubs, not finished infrastructure. Build the adapters your organization needs against them.

### CLI reference

The command surface, grouped by what it touches:
| Area | Commands |
| --- | --- |
| House | `house init · setup · update · status · rules · patterns · remove` |
| Catalog / sourcing | `catalog sync · list · update` · `find` · `use` · `brief` · `report` · `usage` |
| Distributions | `dist list · show · install · uninstall · activate · new` |
| Packages / skills | `package list · show · new` · `skill list · show` · `capability list · show` |
| Inspect / lease | `inspect` · `try` · `borrow` · `release` · `source` |
| Harness operator | `harness setup · status · context · remove` |
| Compose / activate | `bind` · `bootstrap` · `launch` · `hooks` · `realize` · `inventory` · `why` · `diff` |
| Maintain | `adopt` · `update plan · try` · `health` · `rollback` · `disable · enable · deprecate · retire` |
| Doctrine | `doctrine show · validate` |
| Evaluate / tune | `eval validate · run · show · matrix · distill` · `optimize` · `rate` |
| Adapter / policy | `adapter matrix · certify · verify` · `policy show · check` |
| Learn / market | `peers` · `verdict` · `roster` · `broker` · `acquisitions` · `scout` |
| Infra sinks | `ingest` · `gate file · from-result` · `fleet status · sync` |
| Custody | `state show · rebuild · export · import · recover · gc` · `migrate plan · apply` |

Run any command with `--help` for its flags, or read the bundle for the whole story in one file.
