Skip to content

PRD — Pyramid Schema (SCHEMA)

Product requirements for bamr87/SCHEMA. Derived from the README, agent docs, config and code in this repo. Anything not stated in those sources is marked TBD; success metrics are proposals.

1. Overview / problem

Pyramid Schema defines the SCHEMA.md protocol and linter that let AI agents look up repository structure instead of guessing it. A SCHEMA.md in every directory records a structure table and placement/forbidden rules, making structure local, cheap and verifiable.

1.1 Missions

Pyramid Schema's direction is to become the ultimate open home for all things repository structure — data, tools, resources and transparency, gathered in one place that anyone can inspect and reuse.

  1. Provide data, tools, resources and transparency for all stakeholders, software practitioners, agent builders and the general public. Repo maintainers, monorepo owners, AI coding agents, and the general public are first-class audiences. The aim is a shared, open commons: the same sources, the same tools, and the same trail of evidence for everyone.
  2. Make repository structure local, cheap, queryable and verifiable, so agents look it up instead of guessing. A SCHEMA.md in every directory records a structure table and placement/forbidden rules; a linter scaffolds, checks and auto-fixes the pyramid.
  3. Put that protocol and linter in every builder's hands. Serve it through a versioned spec, a seed template and a distribution contract so adopters can vendor copies without drift — an open toolkit for working with all things repository structure.

These missions set the course; they do not claim the work is finished. They serve the PRD goals in §3: a versioned specification, a linter, and a content-addressed distribution contract. The earlier mission paragraph is absorbed into these three. Every feature must trace to them.

2. Target users

  • Repo maintainers adopting agent-friendly structure docs
  • AI coding agents navigating repositories
  • Monorepo owners federating schemas across submodules

3. Goals and non-goals

Goals

  • A versioned specification (spec/)
  • A linter to scaffold, check and auto-fix schema pyramids
  • A content-addressed distribution contract for vendored copies

Non-goals

  • Source code, specs or scratch files at repo root
  • Hand-editing DISTRIBUTION.yml

4. Core features (current)

  • tools/schema_lint.py (scaffold/check/fix)
  • Federation checks across submodule seams
  • DISTRIBUTION.yml + tools/schema_dist.py
  • CLAUDE.md protocol snippet (protocol/)
  • Seed templates and lint-green example fixture repos
  • Scenario test suite

Feature catalog

Every user-facing capability has a stable id in the feature catalog features/features.yml. Each entry names the PRD requirements it serves (prd:); the trace below is the reverse view.

ID Feature Status Where Requirements
SCHEMA-001 tools/schema_lint.py shipped tools/schema_lint.py · README.md FR1
SCHEMA-002 Federation checks across submodule seams shipped tools/schema_lint.py · README.md FR3
SCHEMA-003 DISTRIBUTION.yml + tools/schema_dist.py shipped DISTRIBUTION.yml · README.md FR4
SCHEMA-004 CLAUDE.md protocol snippet shipped protocol · README.md FR5
SCHEMA-005 Seed templates and lint-green example fixture repos shipped templates/SCHEMA.template.md · README.md FR2
SCHEMA-006 Scenario test suite shipped tests/test_schema_lint.py · README.md FR1, FR2, NFR3
SCHEMA-007 Missions in constitution §1 planned docs/constitution.md §1.1
SCHEMA-008 schema_lint check --json planned tools/schema_lint.py · README.md FR6
SCHEMA-009 AGENTS.md protocol snippet planned protocol · README.md FR7

Requirement → feature trace

Requirement Features
FR1 SCHEMA-001, SCHEMA-006
FR3 SCHEMA-002
FR4 SCHEMA-003
FR5 SCHEMA-004
FR2 SCHEMA-005, SCHEMA-006
NFR3 SCHEMA-006
FR6 SCHEMA-008
FR7 SCHEMA-009
§1.1 SCHEMA-007

5. Requirements

Functional

  • FR1: Every listed path in a SCHEMA table must exist and every unlisted path is flagged
  • FR2: Fixtures under example/ stay lint-green
  • FR3: check <repo> --federation verifies each submodule seam (the mount is a terminal row in its parent's SCHEMA.md, and the child carries its own root SCHEMA.md at the expected spec version) without linting child interiors
  • FR4: DISTRIBUTION.yml is a content-addressed manifest of every vendored file; schema_dist.py check fails when it is stale or the package contradicts itself, and verify <repo> audits a consumer's copies
  • FR5: The package ships the agent protocol text adopters paste into their agent instructions file (protocol/CLAUDE.snippet.md)
  • FR6 (planned, #16): schema_lint.py check --json emits one JSON object (errors, warnings, passed) to stdout and nothing else, with today's exit codes
  • FR7 (planned, #18): the distribution payload includes a protocol snippet suitable for pasting into AGENTS.md

Non-functional

  • NFR1: tools/ is stdlib-only Python 3.10+, so adopters can vendor single files without installing anything
  • NFR2: Spec changes are versioned
  • NFR3: Linter and distribution behaviour is covered by stdlib-only scenario test suites that CI runs on every change

6. Success metrics (proposed — not defined in sources)

  • Number of adopting repos
  • Lint false-positive rate: TBD

7. Roadmap / open questions

  • Spec 1.0 stability criteria: TBD