Skip to content
Leashr

Leashr plugin

Skills

Leashr is a set of skills for coding agents. Each one does one job. One card per skill of the public plugin, grouped by role, with a real command, the output it printed, what it covers and where it stops.

Every example was replayed on 2026-11-28 (Windows 11 Home, Node v24.14.0) in a throwaway project by site/tools/skills-examples.mjs. Nothing is typed by hand. Some skills are not released yet: their card says so.

The skills are open source. Open source on GitHub

Protect

Stop a dangerous call or a spend before it happens.

lsh-rules

Plugin leashr-guard

Checks every tool call against allow, ask or deny rules before it runs, and logs each decision.

Protects
Force pushes, recursive deletes, secret files, downloaded scripts piped into a shell, including their spellings through quotes, bash -c or chained commands.
Limit
A guard rail, not a sandbox: variables, aliases and scripts that run a dangerous command internally are not resolved.
Real example
echo '{"session_id":"s1","cwd":"<project>","hook_event_name":"PreToolUse","tool_name":"Bash","tool_input":{"command":"git push --force origin main"},"tool_use_id":"t1"}' | node .leashr/bin/evaluate.js
Leashr blocked this Bash call (rule deny-git-force-push): Force push rewrites shared history (--force-with-lease is allowed).

exit 2

echo '{"session_id":"s1","cwd":"<project>","hook_event_name":"PreToolUse","tool_name":"Bash","tool_input":{"command":"git status"},"tool_use_id":"t2"}' | node .leashr/bin/evaluate.js
{"hookSpecificOutput":{"hookEventName":"PreToolUse","permissionDecision":"allow","permissionDecisionReason":"Leashr rule allow-read-only-shell: Read-only or test command."}}

exit 0

Output replayed on 2026-11-28.

Measured on the benchmarks page

lsh-cap

Plugin leashr-guard

Sets a spending cap per mission and per day, refuses tool calls and prompts once it is reached, and has a kill switch.

Protects
Spend, from Claude Code's own cost estimate; a missing or stale signal blocks.
Limit
The check runs before each call: text the model is already writing and background requests still cost. In claude -p without the collector, every call is refused.
Real example
node .leashr/bin/cap.js set --mission 5 --day 20
Caps written to .leashr/cap.json: mission $5, day $20, warning at 80%.

exit 0

node .leashr/bin/cap.js kill
Kill switch ON: every tool call and prompt is now blocked in this project.

exit 0

echo '{"session_id":"s1","cwd":"<project>","hook_event_name":"PreToolUse","tool_name":"Bash","tool_input":{"command":"ls"},"tool_use_id":"t3"}' | node .leashr/bin/cap.js guard
Leashr blocked this tool call (cap rule kill_switch): Leashr kill switch is on. Every tool call and prompt is blocked until a human runs "cap.js resume".

exit 2

node .leashr/bin/cap.js resume
Kill switch off.

exit 0

Output replayed on 2026-11-28.

Measured on the benchmarks page

Measure

What the agents cost, what they did, what is left.

lsh-cost

Plugin leashr-cost

Reports the estimated cost and tokens of agent work per mission, model and agent, from real signals only.

Measures
Cost per mission, sub-agents included, from OpenTelemetry; tokens only from transcripts.
Limit
An estimate by Claude Code at list price, not an invoice. Transcripts carry no cost: from a transcript alone it prints n/a instead of guessing.
Real example
node skills/lsh-cost/scripts/report.js

By mission

missionreq (requests)in (tokens_in)out (tokens_out)c.read (cache_read)c.write (cache_write)cost $ (cost_usd_est)
checkout-fix121961677665530.001577
TOTAL121961677665530.001577

By model

modelreq (requests)in (tokens_in)out (tokens_out)c.read (cache_read)c.write (cache_write)cost $ (cost_usd_est)
claude-haiku-5-5121961677665530.001577
TOTAL121961677665530.001577

By agent (main = main session)

agentreq (requests)in (tokens_in)out (tokens_out)c.read (cache_read)c.write (cache_write)cost $ (cost_usd_est)
main121961677665530.001577
TOTAL121961677665530.001577

By agent name (main = main session, all runs of a name together; custom = name masked, set OTEL_LOG_TOOL_DETAILS=1)

agent namereq (requests)in (tokens_in)out (tokens_out)c.read (cache_read)c.write (cache_write)cost $ (cost_usd_est)
main121961677665530.001577
TOTAL121961677665530.001577

Source: OpenTelemetry api_request events (cost as estimated by Claude Code, not a bill). Requests: 1 (duplicates skipped: 0, unparsable lines: 0)

Checks by mission: sum of lines 0.001576560 USD = total 0.001576560 USD -> OK by model: sum of lines 0.001576560 USD = total 0.001576560 USD -> OK by agent: sum of lines 0.001576560 USD = total 0.001576560 USD -> OK by agent_name: sum of lines 0.001576560 USD = total 0.001576560 USD -> OK cost metric (claude_code.cost.usage, 1 points): 0.001576560, gap vs requests +0.000000000

exit 0

Output replayed on 2026-11-28.

Measured on the benchmarks page

lsh-audit

Plugin leashr-guard

Reads the journal of every allow, deny, ask and cap decision, filtered, summarised or exported as JSON, JSONL or CSV.

Measures
Which call ran under which rule, session, agent and mission; secrets are masked in every output.
Limit
The journal is a plain file without a hash chain: it is not tamper-proof.
Real example
node .leashr/bin/audit.js --limit 6

Journal: <project>/.mission/events (11 events)

timetypedecisionruletooltargetsessionagentmission
2026-11-28T22:58:46Zguard.denieddenydeny-git-force-pushBashgit push --force origin mains1maincheckout-fix
2026-11-28T22:58:47Zguard.allowedallowallow-read-only-shellBashgit statuss1maincheckout-fix
2026-11-28T22:58:47Zcap.setmaincheckout-fix
2026-11-28T22:58:47Zcap.kill_onmaincheckout-fix
2026-11-28T22:58:47Zcap.denieddenykill_switchBashlss1maincheckout-fix
2026-11-28T22:58:47Zcap.kill_offmaincheckout-fix

exit 0

Output replayed on 2026-11-28.

Measured on the benchmarks page

lsh-quota

Plugin leashr-cost

Shows how much of the 5-hour and 7-day subscription windows is used, when they reset, and a linear projection.

Measures
Subscription rate limits, only from samples the statusline recorded.
Limit
Interactive sessions only: claude -p has no statusline, so it prints n/a, as here.
Real example
node skills/lsh-quota/scripts/quota.js
Quotasubscription rate limits. Source: lsh-cap statusline (rate_limits), <project>/.leashr/state/quota.jsonl
Samples0
n/ano rate_limits sample yet. Claude Code passes rate_limits to the statusline (interactive sessions only, after the first API response, observed with a Max subscription);the lsh-cap statusline records them. claude -p has no statusline, and API-key usage has no such quota (see lsh-cap for spend).
OpenTelemetryn/a: no rate-limit field in the Claude Code OpenTelemetry export (not seen in the 2.1.310 captures)

exit 0

Output replayed on 2026-11-28.

lsh-status

Plugin leashr-guard

One read-only recap: current mission, kill switch, estimated cost against the caps, and what was refused or failed in a loop.

Measures
Where the project stands, from local files only.
Limit
Local only: it does not read GitHub, and an ask says a human was asked, not what they answered.
Real example
node skills/lsh-status/scripts/status.js
Missioncheckout-fix "Fix checkout rounding" (current, started 2026-11-28T22:58:46.884Z)Sessions bound: 1; last journal activity: 2026-11-28T22:58:47.455Z
Kill switchoff
Cost (estimated by Claude Code, from cost.request events)n/a: no cost.request event in the journal (the lsh-cost collector is not running or telemetry is off).The cap hook also counts the status line signal: lsh-cap status is the reference for a refusal.
Blocked in the last 24h (mission checkout-fix)cap.denied kill_switch x1, last 2026-11-28T22:58:47.235Z, Bash ls (main)guard.denied deny-git-force-push x1, last 2026-11-28T22:58:46.955Z, Bash git push --force origin main (main)failing in a loop (3+): Bash npm test x3, last 2026-11-28T22:58:47.455Z, exit 1
Journal1 day file(s), 11 event(s)

Leashr status - <project>

exit 0

Output replayed on 2026-11-28.

Understand

Which mission, which agent, which loop, what fills the context.

lsh-mission

Plugin leashr-guard

Sets, shows and ends the current mission so that cost and audit events are attributed to it, sub-agents included.

Shows
The mission of each session, across /clear and resumed sessions.
Limit
Cost attribution through OTEL_RESOURCE_ATTRIBUTES works with Claude Code only.
Real example
node .leashr/bin/mission.js start checkout-fix --title "Fix checkout rounding"
Mission checkout-fix started.
To attribute OpenTelemetry cost to this mission, start the agent from a shell where:
  export OTEL_RESOURCE_ATTRIBUTES="leashr.mission=checkout-fix"
  $env:OTEL_RESOURCE_ATTRIBUTES = "leashr.mission=checkout-fix"
On Claude Code, "start --claude-local-settings" sets it for every session in this project instead.

exit 0

Output replayed on 2026-11-28.

lsh-agents

Plugin leashr-learn

Declares model-tier and role agents once and installs them as a Claude Code plugin: lsh:fast, lsh:review and your own.

Shows
The model and effort of each sub-agent, and whether the reviewer runs on another model.
Limit
Two different models do not make a review good: review-check only checks that they differ. Only Claude Code is verified.
Real example
node skills/lsh-agents/scripts/agents.js list  # .leashr/agents.json declares fast and review
lsh:fast           fast      claude-haiku-5-5   effort=-       new
lsh:review         review    claude-opus-5-5    effort=medium  new
run label (Agent tool "description"): demo · <summary>

exit 0

Output replayed on 2026-11-28.

lsh-learn

Plugin leashr-guard

Spots tool calls that fail in a loop or are retried after a refusal, and proposes a rule or a fix, never applied automatically.

Shows
Repeated failures, with the exact rule a human can copy into the rules file.
Limit
It only sees failures that reach PostToolUseFailure: a command that prints an error but exits 0 counts as a success.
Real example
node .leashr/bin/learn.js analyze  # after npm test failed 3 times
Thresholds: 3 or more failures of the same call in one session within 30 min; proposed decision "ask" (defaults).
Failures recorded: 3. Loops found: 1 failing, 0 retried after a refusal.
Nothing is applied: every proposal below waits for a human to review it.

LOOP 1  Bash  "npm test"
  failed 3 times between 2026-11-28T22:58:47.344Z and 2026-11-28T22:58:47.455Z (3 in total), session s1, mission checkout-fix
  exit codes: 1
  last error: "Exit code 1"
  Fix first: the call fails the same way each time; find the cause (missing script, dependency, wrong path, config) instead of retrying.
  Or add this rule to .leashr/rules.json (lsh-rules), then run "rules.js check" and "rules.js test":
  {"id":"ask-loop-npm-test","decision":"ask","tool":"Bash","command":"^\\s*npm\\s+test\\s*$","reason":"Failed 3 times within 30 min (lsh-learn, 2026-11-28): ask a human before retrying."}

exit 0

Output replayed on 2026-11-28.

lsh-context

ExperimentalPlugin leashr-learn

Shows what fills a session's context, writes a handoff before /clear and loads it back; with lsh-init --context it guides /compact.

Shows
Tokens of the last call, the biggest tool results, and the failed commands and refusals a summary tends to forget.
Limit
The guided /compact hook is experimental and the handoff path is not measured yet. It reads Claude Code's internal transcript format.
Real example
node skills/lsh-context/scripts/context.js report --transcript bench/context/frozen/t01-shipping/session.jsonl --top 3
Leashr context - session 65e87e17-e04f-4837-8516-bd3a5b50d15d, mission checkout-fix
Transcript: <repo>/bench/context/frozen/t01-shipping/session.jsonl
Last call (claude-haiku-5-5): 49633 tokens = input 2 + cache write 318 + cache read 49271 + output 42
Compactions in this transcript: 0
Biggest tool results (11 in total):
     37429 bytes  Read  8874d837-393f-4068-907f-a916dd50d8d7  BIG (> 20000): delegate such reads to a sub-agent or read with offset/limit
     14248 bytes  Read  a16ff273-dbba-4658-92bb-6910ac14dce3
      8020 bytes  Read  45a35142-4791-4e8e-adb3-c4f1370e825b
Handoff preview (2103 characters, what /lsh-handoff would write without decisions):
  | # Handoff checkout-fix - session 65e87e17-e04f-4837-8516-bd3a5b50d15d - 2026-11-28T22:58:47.862Z
  | Git: feature/demo @ d6cb46b, 3 changed file(s)
  | 
  | ## Objective (user requests, verbatim)
  | - We're starting ticket SHIP-2291 for the BLUE-HERON release. The problem: checkout charges the flat 690-cent shipping fee on every parcel, so heavy parcels lose money and light ones overpay. In this part we only investigate and plan: no code changes until I explicitly say so. First, read the whole file logs/shipping-2026-11.log with the Read tool (the full file, no grep) and tell me in two lines which incident matters for this ticket.
  | - Do not implement anything yet, just take note. Constraints for the implementation: add a function `computeTieredShipping(weightKg, subtotalCents)` to `src/shipping.js` that returns the shipping fee in integer cents. Do not touch `src/legacy/tax-legacy.js` at all, the invoicing batch still reads it. No new dependencies of any kind. Keep the existing `flatShipping` export exactly as it is. The fee must be an integer number of cents, never a float. Put the new tests in `test/unit/shipping.test.js`.
  | - Don't implement anything yet, I'm going to lunch and we'll continue after. Reply with OK and one line saying what's next.
  | 
  | ## Dead ends: commands that failed, do not retry blindly
  | - `npm test` failed 1x (exit 1): > node scripts/check-env.js SHOPCART_DB_URL && node --test test/**/*.test.js  check-env: SHOPCART_DB_URL is not set. This target needs SHOPCART_DB_URL (see docs/environments in the ops wiki).
  | - `npm run lint:fix` failed 1x (exit 2): > node scripts/lint.js --fix  lint: --fix was removed in lint v2 (it rewrote files outside src/). Run the linter without --fix and correct by hand.
  | - `npm run build:prod` failed 1x (exit 1): > node scripts/check-env.js SHOPCART_REGION && node scripts/build.js  check-env: SHOPCART_REGION is not set. This target needs SHOPCART_REGION (see docs/environments in the ops wiki).
  | 
  | ## Proofs that passed
  | - `node --test test/unit/*.test.js`
  | - `npm run test:unit`
  | - `node -e "console.log(require('./package.json').scripts['lint:fix'])"`

exit 0

Output replayed on 2026-11-28.

Measured on the benchmarks page

Configure

Install the governance, link the dashboard, ask for a second opinion.

lsh-init

Plugin leashr-guard

Installs Leashr in a project: default rules, guard and cap hooks, statusline, failure recorder, mission folder and telemetry settings.

Covers
Writes only inside the project, merges without overwriting, and a second run changes nothing.
Limit
It writes Claude Code settings and is tested with Claude Code 2.1.310 only.
Real example
node skills/lsh-init/scripts/init.js --target .
Leashr init (project scope) -> <project>
  write     .leashr/rules.json  (default rules)
  write     .leashr/bin/evaluate.js  (runtime copy of lsh-rules/scripts/evaluate.js)
  write     .leashr/bin/mission.js  (runtime copy of lsh-mission/scripts/mission.js)
  write     .leashr/bin/events.js  (runtime copy of lsh-mission/scripts/events.js)
  write     .leashr/bin/cap.js  (runtime copy of lsh-cap/scripts/cap.js)
  write     .leashr/bin/learn.js  (runtime copy of lsh-learn/scripts/learn.js)
  write     .leashr/bin/audit.js  (runtime copy of lsh-audit/scripts/audit.js)
  write     .claude/settings.json  (added: PreToolUse (rules), PreToolUse (cap), UserPromptSubmit (cap), PostToolUseFailure (learn), SessionStart, statusLine)
  write     .leashr/.gitignore  (runtime state (statusline cost, collector heartbeat) stays out of git)
  mkdir     .mission/

Spending cap: none set (Leashr does not pick an amount). Set one with:
  node .leashr/bin/cap.js set --mission <usd> --day <usd>

OpenTelemetry: Claude Code ignores telemetry switches in project settings (observed on 2.1.310).
Enable it in user settings (lsh-init --scope user --target <claude config dir>) or in the shell:
  export CLAUDE_CODE_ENABLE_TELEMETRY=1
  export OTEL_METRICS_EXPORTER=otlp
  export OTEL_LOGS_EXPORTER=otlp
  export OTEL_EXPORTER_OTLP_PROTOCOL=http/json
  export OTEL_EXPORTER_OTLP_ENDPOINT=http://127.0.0.1:4318
  export OTEL_METRIC_EXPORT_INTERVAL=10000
  export OTEL_LOGS_EXPORT_INTERVAL=5000

Claude Code 2.1.310: proved (tested on 2.1.310)

exit 0

Output replayed on 2026-11-28.

Measured on the benchmarks page

lsh-sync

Plugin leashr-cost

Sends the cost, token and decision metrics of the local journal to the hosted dashboard, only after an explicit link with a per-repository token.

Covers
What leaves the machine: a fixed list of fields per event type, written down in the skill.
Limit
It needs a dashboard that serves POST /api/v1/events. Without a link, push sends nothing, as here.
Real example
node skills/lsh-sync/scripts/sync.js status
not linked: <project> (push sends nothing)

exit 0

Output replayed on 2026-11-28.

lsh-advisor

ExperimentalPlugin leashr-learn

Holds a risky call once (deletes, migrations, CI or auth files, a call failing again and again) until a stronger model has advised on a short brief.

Covers
Risky steps, with the cost of each advice written to the journal and capped per mission.
Limit
The advisor sees a brief, not the session, and the agent can skip it by changing the command. The conformity scores of 26/11 cannot be replayed: the hand labels were not saved.
Real example
node skills/lsh-advisor/scripts/advisor.js check --tool Bash --command "git branch -D feature/old"
ADVISE delete: git branch delete

exit 0

node skills/lsh-advisor/scripts/advisor.js check --tool Bash --command "npm test"
no rule

exit 0

Output replayed on 2026-11-28.

Measured on the benchmarks page

Deliver

From an intention to a reviewed pull request, with proofs.

Delivery chain

Plugin leashr-ship

Takes an intention to a reviewed pull request with two human gates only: approving the PRD and merging.

Skills of the chain

  • lsh-prd PRD with numbered criteria, linted, approved by you.
  • lsh-prove Replays every criterion: pass, fail or unproved.
  • lsh-review Read-only review by another model family.
  • lsh-pr Pull request body built from the proofs.
  • lsh-ship Chains them, resumes where it stopped.
Guarantees
Each acceptance criterion names the command that proves it; a box is ticked only when that proof passed.
Limit
The independent reviewer on another model uses Claude Code's Agent tool; other agents have to run the same brief in a separate session.
Real example
node skills/lsh-prd/scripts/prd.js lint specs/cash-rounding.md --strict
OK specs/cash-rounding.md: status draft, 2 CA, 1 phases

exit 0

node skills/lsh-prd/scripts/prd.js approve specs/cash-rounding.md  # after the user said yes
approved specs/cash-rounding.md sha256 41a2988ed313bce096ace41d4933bcb36a156532cbb8109ed80ad0948d652884

exit 0

node skills/lsh-prove/scripts/prove.js run specs/cash-rounding.md --out proof.json  # CA-02 has no test yet
CAPhaseStatusCommandEvidence
CA-01P1pass`node --test test/round.test.js`exit 0, 0.2 s
CA-02P1FAIL`node --test test/decimals.test.js`exit 1, 0.1 s: Could not find 'test/decimals.test.js'

Proof of specs/cash-rounding.md (sha256 41a2988ed313, approved), 2026-11-28 22:58 UTC: 1 pass, 1 fail, 0 unproved, 0 denied.

exit 1

Output replayed on 2026-11-28.

Measured on the benchmarks page