The 3x Documentation Scheme

A project-neutral system for explaining what, how, and why

Use one structured source to create a searchable project manual for people and agents. See the CLI and format reference for exact commands and fields.

Schema-drivenAgent-readableZero dependenciesStandalone HTML
The 3x reading contract: every entry explains what it does, how it works, and why it works that way.
No entries match that search.

The Core Model

The scheme documents observable behavior, implementation, and design intent as one reviewable unit.

The three-question contract

#
foundationreader contract

Every subject answers What, How, and Why in that order, and records the basis for its Why.

What it does

Provides a repeatable shape for documenting a component, command, workflow, policy, or architectural decision, plus an explicit provenance field for the third answer.

How it works

  1. What defines behavior, inputs, outputs, guarantees, and visible failure modes.
  2. How traces implementation, data flow, dependencies, and operational boundaries.
  3. Why records constraints, trade-offs, intent, and meaningful alternatives.
  4. why_basis records whether that rationale is recorded, observed, inferred, or external.

Why it works this wayrecorded

Readers usually need all three perspectives but at different moments. Keeping them adjacent prevents reference material from drifting away from implementation detail or design rationale, and the basis makes the confidence of the third answer visible.

Evidence
  • Content contract scheme/manual.schema.json
  • Example source scheme/example.manual.json

Manual structure

#
information architectureschema

Project metadata, presentation settings, review metadata, sections, and entries remain separate but composable.

What it does

Organizes a manual into reader-oriented sections containing stable, linkable entries. Each entry can include a summary, synopsis, tags, evidence, and related-entry links in addition to its required triad and why_basis. Manual metadata can record the last review.

How it works

The JSON hierarchy is deliberately shallow:

  1. Project metadata supplies reusable identity and version values.
  2. Manual metadata describes the document, its badges, and its review record.
  3. Sections create navigation groups and entries carry the actual explanations and provenance.
  4. Theme values alter presentation without changing content.

Why it works this wayrecorded

A predictable hierarchy is easy for humans to review, agents to generate, schemas to validate, and renderers to transform without parsing hand-authored HTML. Separate review metadata keeps freshness visible without mixing it into every entry.

Evidence
  • scheme/manual.schema.json scheme/manual.schema.json
  • scripts/manual.py scripts/manual.py

Authoring a Manual

Good 3x documentation begins with project discovery and treats uncertainty explicitly.

Scope and inventory

#
planningaudience

Choose subjects by reader need, not merely by source-tree shape.

What it does

Identifies which capabilities, boundaries, workflows, policies, and decisions deserve entries and which audience the manual serves.

How it works

  1. Name the primary audience and the decisions they need to make.
  2. Inventory user-visible capabilities and operational workflows.
  3. Map architecture boundaries and consequential design decisions.
  4. Group subjects into a learning path, then assign stable kebab-case IDs.

Why it works this wayrecorded

Mirroring folders produces implementation indexes rather than useful manuals. Reader-oriented scope keeps the document navigable and avoids exhaustive but low-value function commentary.

Evidence
  • README.md README.md

Facts, inference, and rationale

#
accuracyprovenance

Implementation claims require evidence; every rationale records its basis.

What it does

Separates observed project facts from interpretation and records the basis for each rationale so readers can judge confidence and trace important claims.

How it works

  1. Write What from behavior that can be demonstrated or tested.
  2. Write How from inspected source, configuration, runtime behavior, and operational records.
  3. Write Why from decision records or maintainer statements when available.
  4. Set why_basis to recorded, observed, inferred, or external. Use inferred only when the rationale comes from the author's reasoning, and name the evidence supporting it.

Why it works this wayrecorded

Plausible explanations are easy to invent and hard to detect later. A required basis turns provenance from an optional writing habit into a reviewable field and prevents a polished manual from becoming an authority for facts the project never established.

Evidence
  • README.md README.md
  • scheme/manual.schema.json scheme/manual.schema.json

Evidence and relationships

#
traceabilitynavigation

Entries expose supporting artifacts, their kind, and conceptual neighbors.

What it does

Attaches files, tests, decision records, commands, specifications, documents, or URLs to claims and records what kind of support each target provides. Related entries use stable IDs that the validator checks and the renderer turns into local links.

How it works

  1. Evidence accepts a path string or a labeled target object.
  2. Set kind to source, test, decision, spec, url, command, or document when the distinction matters.
  3. Use --check-evidence to verify local targets and --check-urls to probe HTTP targets.
  4. Related entries use stable IDs and render as local links.

Why it works this wayrecorded

Traceability shortens verification and maintenance. Kind labels let reviewers distinguish a demonstration from a decision record, and explicit relationships add useful navigation without forcing the section hierarchy to represent every conceptual connection.

Evidence
  • scheme/manual.schema.json scheme/manual.schema.json
  • scripts/manual.py scripts/manual.py

Optional writing lint

#
stylevalidationoptional

A separate command checks prose against an opt-in writing contract.

python3 scripts/manual.py lint SOURCE

What it does

Checks manual prose for em dashes, invisible or bidirectional characters, validating openers, seesaw definitions, and blended emotional plateaus. It is not part of check or build.

How it works

  1. Run lint against a source after check passes.
  2. The command validates structure first, then scans prose fields only.
  3. Findings exit nonzero; literal fields such as synopsis, tags, evidence targets, and IDs are skipped.

Why it works this wayrecorded

Structure can be enforced for every project, but prose conventions are a project choice. A separate command keeps the scheme neutral while giving teams a shared contract when they want one.

Evidence
  • scripts/manual.py scripts/manual.py
  • tests/test_manual.py tests/test_manual.py

Dynamic Adaptation

The same content contract supports local writing, automated releases, CI checks, and agent-assisted maintenance.

Metadata and runtime overrides

#
automationconfiguration

Change shared values once or inject release-specific values during a build.

python3 scripts/manual.py build SOURCE --set project.version=2.0.0 --output index.html

What it does

Resolves metadata placeholders throughout the document and permits scalar values to be overridden from the command line.

How it works

  1. Place a double-braced path such as project.name or project.version in textual fields.
  2. The builder resolves placeholders against the source document before validation.
  3. Each --set PATH=VALUE assignment updates an existing scalar before resolution.

Why it works this wayobserved

Versions, names, URLs, and theme values recur throughout documentation. Central values and build-time injection prevent repetitive edits and make release automation deterministic.

Evidence
  • scripts/manual.py scripts/manual.py
  • tests/test_manual.py tests/test_manual.py

Validation and visible gaps

#
quality gateCIreview

Incomplete triads and provenance fields fail; weaker traceability remains visible as a warning.

python3 scripts/manual.py check SOURCE [--check-evidence] [--check-urls] [--json]

What it does

Checks required structure, stable IDs, dimension content, why_basis, recognized placeholder text, reviewed metadata, evidence shape, evidence kind, and related-entry targets. Optional flags verify local evidence paths and HTTP targets.

How it works

  1. Structural defects and recognized unfinished-writing markers produce a nonzero exit.
  2. Missing evidence, unknown related IDs, missing review metadata, and stale reviews produce warnings that require judgment without blocking exploratory drafts.
  3. Add --check-evidence --root . to verify local targets and --check-urls to probe HTTP targets; both are opt-in because they inspect the environment.
  4. Use review --strict when CI should fail on review items, and --json when another tool consumes the diagnostics.

Why it works this wayrecorded

A manual should never silently present empty reasoning or an unexamined review date as complete. Separating errors from warnings preserves a firm minimum contract without pretending every quality concern can be decided mechanically.

Evidence
  • scripts/manual.py scripts/manual.py
  • tests/test_manual.py tests/test_manual.py
  • scheme/manual.schema.json scheme/manual.schema.json

Portable generation

#
HTMLsearchprintCI

One validated source becomes one searchable, responsive HTML file, and a check mode detects drift.

python3 scripts/manual.py build SOURCE --output manual.html [--check]

What it does

Produces a standalone manual with navigation, full-text filtering, stable anchors, responsive triad cards, provenance badges, evidence kind labels, review metadata, and print styles. build --check verifies an existing artifact without rewriting it.

How it works

  1. The standard-library generator escapes content, applies a deliberately small inline notation, embeds CSS and JavaScript, and writes a dependency-free HTML document.
  2. Use build --check in CI to compare a fresh render with the committed output and fail when it is missing or out of date.
  3. Use build --output to choose the destination; the default is manual.html.

Why it works this wayobserved

A single artifact is easy to preview locally, attach to a release, publish on any static host, archive, or inspect in restricted environments. A drift check keeps the committed artifact honest without making every local build rewrite it.

Evidence
  • scripts/manual.py scripts/manual.py
  • tests/test_manual.py tests/test_manual.py

Keeping It Alive

The scheme is most useful when documentation evolves with the project rather than following it later.

Maintenance lifecycle

#
workflowgovernancereview

Review documentation in the same change that alters behavior, and renew the review record on an explicit interval.

What it does

Treats manual source as maintained project material with validation, review reporting, and continuous integration.

How it works

  1. Run check and review --strict in CI for every proposed change.
  2. Set manual.reviewed to the date and commit of the last substantive review. interval_days defaults to 180 days.
  3. Use watch while restructuring or writing several entries.
  4. Update What when contracts change, How when implementation boundaries move, and Why when constraints or decisions change.
  5. Preserve entry IDs during title edits and review the built artifact before release.

Why it works this wayrecorded

Documentation drift is primarily a workflow problem. A review record shows when a person last examined the material, while co-located review and a minimum contract make stale reasoning easier to catch when relevant context is still available.

Evidence
  • README.md README.md
  • scripts/manual.py scripts/manual.py
  • .github/workflows/verify.yml .github/workflows/verify.yml

Review status and freshness

#
reviewfreshnessprovenance

A manual records when it was last reviewed and reports entries that still need attention.

python3 scripts/manual.py review SOURCE [--check-evidence] [--strict]

What it does

Reads manual.reviewed and reports unreviewed, stale, inferred, missing-evidence, and weak-evidence items without rewriting the source.

How it works

  1. Set manual.reviewed.date and manual.reviewed.commit when a human completes a substantive review.
  2. Set manual.reviewed.interval_days to the project's review cadence; the default is 180 days.
  3. Run review to list items for human attention, and review --strict when CI should fail on any item.
  4. Pair review with --check-evidence and --check-urls when the review should also verify targets.

Why it works this wayrecorded

A review date is only useful if readers can see it and maintainers are prompted to renew it. A separate report preserves human judgment while making neglect visible to automation.

Evidence
  • scheme/manual.schema.json scheme/manual.schema.json
  • scripts/manual.py scripts/manual.py
  • tests/test_manual.py tests/test_manual.py

Agent adaptation workflow

#
agentshandoff

Agents use the same schema, provenance expectations, review report, and validation gate as human authors.

What it does

Gives coding and documentation agents an explicit protocol for discovering, drafting, checking, reviewing, and handing off a project manual.

How it works

  1. Read the schema and the project sources in scope.
  2. Inventory behavior and architecture before drafting entries.
  3. Set why_basis and cite implementation-specific claims.
  4. Preserve stable IDs, run check, review, and build --check, then report warnings and review items that require human judgment.

Why it works this wayrecorded

Structured outputs reduce ambiguity between tools and sessions. Using the human workflow also keeps agent-produced documentation reviewable instead of creating a separate, opaque automation path.

Evidence
  • README.md README.md
  • scheme/manual.schema.json scheme/manual.schema.json
  • tests/test_manual.py tests/test_manual.py
  • .github/workflows/verify.yml .github/workflows/verify.yml