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.

Install

pip install -e '.[dev]'

CLI

shelf-spec init PATH --name "My shelf" --profile memory --categories topics,research,sessions
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 CANDIDATE.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 fileshelf.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.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

shelf_spec-0.1.0.tar.gz (41.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

shelf_spec-0.1.0-py3-none-any.whl (27.8 kB view details)

Uploaded Python 3

File details

Details for the file shelf_spec-0.1.0.tar.gz.

File metadata

  • Download URL: shelf_spec-0.1.0.tar.gz
  • Upload date:
  • Size: 41.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for shelf_spec-0.1.0.tar.gz
Algorithm Hash digest
SHA256 19b516a499e9fe4ea9c9cdb3f44a331f738943267cf0a18c5487b6c4be7644ae
MD5 4febdde57a217b27e3a2ca32e5cfadbd
BLAKE2b-256 7d20166ad165669af2c3247ce461cec87bd6474cb054c544329bc5d44d184127

See more details on using hashes here.

Provenance

The following attestation bundles were made for shelf_spec-0.1.0.tar.gz:

Publisher: release.yml on ignatenkofi/shelf-spec

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file shelf_spec-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: shelf_spec-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 27.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for shelf_spec-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3a24ab9d4663d469b75f9783279766737eec7e72446afb4ea189a48bf6803f71
MD5 4c724666dfb9135367e683e2d0b42b5b
BLAKE2b-256 80f4cb21334d5f4557f368e5ab924db1916b4bce9edfb660032366ea3e844091

See more details on using hashes here.

Provenance

The following attestation bundles were made for shelf_spec-0.1.0-py3-none-any.whl:

Publisher: release.yml on ignatenkofi/shelf-spec

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page