shelf Docs
On this page

Usage

terminal
shelf <command> [arguments] [options]
shelf <command> --help
shelf --version

Run shelf from anywhere inside a project for commands that act on "this project": shelf finds the project root by walking up to the nearest .agents/shelf.lock.json, else the nearest git root, else the working directory. Library commands work from anywhere.

Global options

Every command except guide, ui and hook accepts these:

OptionEffect
--jsonPrint one line: a JSON envelope { schemaVersion, ok, data | error }.
--actor <name>Who is acting, recorded in the activity log. Default: auto-detected (see Environment).
--help, -hPrint the command's usage, arguments and options.

shelf --version prints the version (0.4.0). shelf guide and shelf ui accept --json but not --actor.

The JSON envelope

With --json, the command prints exactly one line on stdout, whether it succeeds or fails:

json
{"schemaVersion":1,"ok":true,"data":{"skill":"release-notes","previousDueAt":"2026-11-06T05:51:38.699Z","dueAt":"2026-12-06T05:51:38.699Z"}}
json
{"schemaVersion":1,"ok":false,"error":{"code":"LOAN_LIMIT","message":"Due date 2027-06-24T05:34:17.582Z is beyond the 90-day loan limit","hint":"The latest allowed due date is 2027-01-05"}}
FieldTypeMeaning
schemaVersionnumber1. Bumped only on a breaking change to the envelope or any command's data.
okbooleanWhether the command succeeded.
dataobjectThe result, when ok is true. Its shape is documented on each command's page.
error.codestringA stable error code, when ok is false. See Errors.
error.messagestringWhat went wrong, in words.
error.hintstring or nullWhat to do about it, often an exact command.

Dates in data are ISO 8601 strings in UTC. Revisions are full hashes (sha256: plus 64 hex characters). Paths are absolute.

With --json, usage errors (an unknown command, a missing argument) are envelopes too, with code INVALID_ARGUMENT:

json
{"schemaVersion":1,"ok":false,"error":{"code":"INVALID_ARGUMENT","message":"Missing required positional argument: SKILL","hint":"Run `shelf --help` or `shelf <command> --help` for usage"}}

Human output

Without --json, results go to stdout as plain text: tables with two-space columns, short hashes (10 hex characters), dates as YYYY-MM-DD. Errors go to stderr as error: <message> and hint: <hint>. An unexpected (internal) error also prints its stack trace.

Text output is for people and may change between versions. Scripts and agents should use --json.

Exit codes

ExitMeaning
0Success.
1INTERNAL error, or shelf lint found errors.
2INVALID_ARGUMENT, INVALID_SKILL, or a usage error (unknown command, missing argument).
3NOT_INITIALIZED
4SKILL_NOT_FOUND, NOT_BORROWED
5SKILL_EXISTS, CONFLICT
6LOCAL_CHANGES
7LOAN_LIMIT
8NOT_ALLOWED

shelf hook always exits 0. See Errors for every code.

Conventions

  • Never prompts. Every command runs to completion without input, so agents and scripts can run it.
  • Safe to retry. Borrowing a borrowed skill, keeping a kept one, init in an initialized project and setup are all no-ops the second time.
  • Refuses to lose work. Anything that would discard local edits needs --force; importing needs --yes.
  • Several names. borrow, keep, used, update, lint, audit and adopt accept several names in one call.
  • Comma-separated lists. Options that take lists (--skill, --project, --add, --remove) split on commas.
  • Negative due shifts. Arguments starting with - are read as options, except negative shifts for shelf due: shelf due api-design -7d needs no --.
  • Concurrency. Several shelf processes can run at once, in the same project or not. Writes are serialised on the database and the lockfile is rewritten under the same lock.

Commands

Getting started

CommandDescription
shelf setupCreate the shelf home, install the shelf skill and the hooks that renew skills on use (safe to re-run)
shelf initRegister the current project with shelf (creates .agents/shelf.lock.json)
shelf statusShow this project's loans and suggested next steps (returns overdue skills)
shelf guidePrint the full guide for agents

Library

CommandDescription
shelf newCreate a skill in your library
shelf catalogList library skills, optionally filtered by search terms
shelf searchFind library skills by what they say: names, descriptions, SKILL.md and references
shelf showPrint a library skill's SKILL.md and file list
shelf logShow a skill's revisions and which projects borrow each
shelf diffDiff two versions of a skill: borrowed, library, project, or a revision
shelf propagatePush the library's latest revision of a skill to every borrowing project
shelf restoreMake an earlier revision of a skill the library's latest again
shelf loan-daysShow or set a skill's loan length (how long loans and renewals last)
shelf setGroup library skills into sets, borrowed together with shelf borrow @<set>
shelf set listList your skill sets
shelf set saveCreate a set, or replace its skills (accepts @set to extend another set)
shelf set deleteDelete a set (borrowed skills and loans are unaffected)
shelf renameRename a library skill (its directory and frontmatter name), keeping its history
shelf duplicateCopy a library skill to a new name, as a new skill with its own history
shelf archiveMove a library skill to the archive (nothing is deleted)
shelf lintCheck skills' SKILL.md against the Agent Skills format (exits 1 on errors)

Loans in the current project

CommandDescription
shelf insightsContext each project loads at session start, and which skills agents actually use (30 days)
shelf suggestSuggest library skills that match what this project uses (its dependencies, files)
shelf borrowCopy library skills into this project with a due date
shelf renewRenew a loan: due the loan length (or --days) from today, unless already due later
shelf usedRecord that borrowed skills were used, which renews them (hooks do this for you)
shelf dueMove a loan's due date: +14d, -7d, +2w or 2026-12-01
shelf keepKeep borrowed skills: they never expire (--off to stop keeping)
shelf returnRemove a borrowed skill from this project
shelf updateUpdate borrowed skills to the library's latest revision (all if none named)
shelf promotePublish this project's edits to a skill back to the library
shelf detachStop managing a skill; its files stay in the project
shelf syncReturn overdue skills, restore missing copies, apply updates to --follow loans
shelf targetsShow or change which harness skill directories this project uses

Bringing skills in: existing copies, or from outside

CommandDescription
shelf scanFind skill copies under a directory and group duplicates and drifted versions
shelf adoptImport existing skill directories into the library and manage them as loans
shelf addImport skills from a git repository or directory (reviews first; --yes imports)
shelf pullUpdate an imported skill from its source (shows diff and audit; --yes applies)
shelf auditScan library skills for risky content (all, or the named ones)

Across projects

CommandDescription
shelf projectsList every project using shelf, with loan counts
shelf sweepRun sync in every registered project (e.g. from a daily cron job)
shelf doctorCheck shelf's state for problems; --fix repairs what it safely can
shelf uiOpen the local dashboard (projects, loans, library editor)

Called by harness hooks, not people

CommandDescription
shelf hookRun a harness hook (installed by shelf setup; reads the payload on stdin)