Skip to main content

shelf-spec

shelf-spec — a portable, vendor-neutral memory format for AI agents — plus a thin validator/scaffolder around it.

A shelf is a git repository of human-readable Markdown: categories, an INDEX.md catalog, per-category metadata, an optional journal (ledger.tsv) and policy (POLICY.md). Any MCP client attaches the same shelf; migration between vendors is git clone. The product is the format (spec/SPEC.md); the reference implementation is docshelf-mcp.

Status: v0 (draft, descriptive) — the spec fixes what already works on live shelves. Final name: shelf-spec (decided 2026-07-26, ADR 0007; before the production repo).

What is in this repo

  • spec/SPEC.md — shelf-spec v0 (RFC 2119).
  • spec/shelf.schema.json — JSON Schema (draft 2020-12) for shelf.yml.
  • spec/examples/ — example manifests (memory, document, reserved multi).
  • src/shelf_spec/ — engine (manifest loader, validator, scaffolder, info) with two thin transports: an MCP server and a CLI.
  • docs/advisory-ci.md — drop-in advisory CI stage for shelf repos.
  • docs/shelf-direction-and-channels.md — direction of the shelf family (selection, ownership, provenance; pull vs push) and the outreach channels. In Russian.

Install

pip install shelf-spec

From a checkout, for development:

pip install -e '.[dev]'

CLI

shelf-spec init [PATH] [--name NAME] [--mode single|multi]
               [--profile memory|document] [--categories a,b,c]
shelf-spec validate [PATH]              # human-readable report
shelf-spec validate --ci [PATH]         # machine JSON on stdout, exit 0/1/2
shelf-spec validate --json [PATH]       # JSON report
shelf-spec validate --manifest MANIFEST.yml [PATH]   # validate a tree against
                                       # an external manifest without touching it
shelf-spec info [PATH]                  # manifest + index summary for a client
shelf-spec serve                        # MCP server on stdio

Exit codes: 0 — shelf conforms (warnings allowed; --strict promotes warnings to failure), 1 — spec violations (error findings), 2 — config-error (manifest missing / unparseable / schema-invalid; checked before any rule).

The default shelf root is $SHELF_SPEC_ROOT, falling back to the current directory.

MCP server

Three tools, same engine as the CLI:

tool type what it does
shelf_init write (local) scaffold a shelf: shelf.yml, docs root and categories, POLICY.md stub, .gitignore; idempotent
shelf_validate read lint a shelf against the spec; report with findings and severities
shelf_info read manifest + index summary for a connecting client

Tools take flat keyword arguments — a hand-written tools/call looks like {"name": "shelf_validate", "arguments": {"shelf_path": "/path/to/shelf"}}, no wrapper object.

Client configuration (stdio):

{
  "mcpServers": {
    "shelf-spec": {
      "command": "shelf-spec",
      "args": ["serve"],
      "env": { "SHELF_SPEC_ROOT": "/path/to/your/shelf" }
    }
  }
}

Validation and info never scaffold a shelf silently: pointing them at a directory without a manifest is a config-error, not an invitation to create one.

Compatibility promise

An existing docshelf/memshelf shelf becomes spec-conformant by adding one file — shelf.yml with mode: single. Nothing is migrated (ADR-0005). .docshelf.json remains a legal implementation detail; shelf.yml is the contract. Ready-to-apply manifests for the shelves named in the roadmap live in docs/adoption/.

License

MIT.

Metadata

Release files for shelf-spec 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for shelf-spec 0.2.0
File Size Uploaded
shelf_spec-0.2.0.tar.gz 50.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for shelf-spec 0.2.0
File Interpreter ABI Platform
shelf_spec-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 79.4 kB

Release files / shelf_spec-0.2.0.tar.gz

Download URL shelf_spec-0.2.0.tar.gz
Size 50.6 kB
Tags Source
SHA-256 checksum
How to use checksums
877a70c504ca54147fdee005257cd9c53fe3491690db03dc762362b02720d65b
BLAKE2b-256 checksum
How to use checksums
6677f4ea79d432b64b6cae5ce0b1e5469409a84ed73095df4855a6d1a1337e0d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 9, 2026.

Transparency log

Release files / shelf_spec-0.2.0-py3-none-any.whl

Download URL shelf_spec-0.2.0-py3-none-any.whl
Size 28.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3d7509f3ce2bd0518b08d13bd3167fc775c28ef440becdbcba5b0e4412d56144
BLAKE2b-256 checksum
How to use checksums
d123b496d6e3a04ba481a6b6b64a750945134c7c86037b454eaa8b7685876a8d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 9, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page