Status: Draft v2 — revised per review feedback
Date: 2026-03-06
Every file in the Quorum codebase should be self-documenting at two levels:
- Machine-parseable metadata — what is this file, who owns it, what version
- Human-readable context — why does this exist, what are the key decisions
This standard defines a universal header schema and two documentation strategies based on file complexity.
Every source file gets a metadata block at the top, using @KEY: value pairs inside the language's native comment syntax.
Python:
# @module: quorum.critics.code_hygiene
# @purpose: Code quality evaluation grounded in ISO 25010 + CISQ
# @grounding: critics/CODE_HYGIENE_FRAMEWORK.md
# @owner: code-hygiene-critic
# @version: 0.3.0
# @tier: tier-2 (default model assignment)
# @relationships: quorum-relationships.yamlMarkdown:
<!-- @doc: guides/CROSS_ARTIFACT_DESIGN.md -->
<!-- @purpose: Architectural decisions for cross-file consistency checking -->
<!-- @status: design-complete -->
<!-- @version: 1.0 -->
<!-- @approved-by: Daniel Cervera, 2026-03-06 -->
<!-- @describes: models.py (Locus, Finding schemas) -->YAML:
# @config: quorum-relationships.yaml
# @purpose: Declared file relationships for cross-artifact consistency
# @schema-version: 1.0
# @see: guides/CROSS_ARTIFACT_DESIGN.mdShell:
# @script: nist-query.sh
# @purpose: LATM query tool for NIST library database
# @version: 1.0| Key | Required? | Description |
|---|---|---|
@module / @doc / @config / @script |
Yes | Identity — what this file IS (use the type-appropriate key) |
@purpose |
Yes | One-line description of why this file exists |
@version |
Yes | Semantic version or project version this file belongs to |
| Key | When to Use | Description |
|---|---|---|
@grounding |
Critics, frameworks | Which framework/spec document grounds this code |
@owner |
Components with clear ownership | The critic/module/subsystem that owns this |
@tier |
Model-routed components | Default model tier assignment |
@relationships |
Files with cross-artifact contracts | Pointer to manifest: quorum-relationships.yaml |
@implicit-deps |
Non-obvious dependencies | Runtime dynamic loading, execution order contracts, assumptions not visible from imports |
@status |
Design docs, WIP files | draft / design-complete / implemented / deprecated |
@approved-by |
Decision documents | Who approved this and when |
@describes |
Docs referencing schemas/code | Code files this document describes (for docs only) |
@schema-version |
Config/data files | Version of the schema format |
@changelog |
Frequently updated files | Pointer to changelog or inline date |
- Headers go at the very top — after shebang/encoding lines and SPDX license headers, before imports
- One key per line — no multi-line values in headers
- No duplication — if the SPDX header already has copyright, don't add
@author - Keep it short — headers are metadata, not documentation. If you need more than 8 keys, the file is complex enough for a reference doc
For files with a single clear responsibility where @purpose adequately explains why the file works the way it does.
The @KEY header block + a standard module/class docstring is sufficient. No separate documentation file needed.
Example: critics/completeness.py — one critic, one responsibility. The @KEY header + class docstring tells you everything. No non-obvious design tradeoffs a future reader couldn't reconstruct from the code.
Heuristic: If @purpose can adequately explain why the file works the way it does, Strategy A is sufficient. If the file contains decisions a reader (human or agent) couldn't reconstruct from the code alone, it needs Strategy B.
Applied to:
- Individual critic files (
correctness.py,completeness.py,security.py,code_hygiene.py) - Config files (
quorum-config.yaml,quorum-relationships.yaml) - Utility modules (
output.py,prescreen.py) - Simple scripts
For subsystems spanning multiple files, components with non-obvious design tradeoffs, or any file where @purpose alone can't explain why it works the way it does.
Create a man-page style reference doc in docs/ with:
# [COMPONENT] Reference
## Synopsis
One paragraph: what it does, when to use it.
## Architecture
How the pieces fit together. Diagram if helpful.
## Configuration
All config keys, defaults, and examples.
## API / Interface
Public functions, their signatures, what they return.
## Design Decisions
Why it works this way. Link to decision docs if they exist.
## Known Limitations
What it can't do. What's deferred.
## Examples
Concrete usage examples.Applied to:
- The pipeline (
pipeline.py+cli.py+config.py— multi-file subsystem) - The pre-screen system (
prescreen.py— 10 checks with non-obvious regex choices) - The critic framework (the base class + how critics are registered and coordinated)
- The rubric system (loader + built-ins + custom rubric authoring)
- Cross-artifact consistency (when built — spans relationships, critic, pipeline coordination)
For agents and pre-screen checks to validate headers, a companion schema defines enum values, formats, and validation rules:
File: quorum-header-schema.yaml (to be created alongside adoption)
keys:
status:
type: enum
values: [draft, design-complete, implemented, stable, deprecated]
version:
type: semver
pattern: "^\\d+\\.\\d+\\.\\d+$"
tier:
type: enum
values: [tier-1, tier-2, tier-3]
approved-by:
type: string
pattern: "^.+, \\d{4}-\\d{2}-\\d{2}$" # "Name, YYYY-MM-DD"
purpose:
type: string
max_length: 120 # one line
grounding:
type: filepath # must resolve to an existing file
relationships:
type: filepath # must resolve to an existing fileThis enables a future pre-screen check (PS-011: Header validation) that mechanically enforces the standard, closing the loop between "we have a standard" and "we enforce the standard."
-
critics/code_hygiene.py— new file, include headers from creation -
critics/security.py— add headers during revision -
critics/correctness.py— retrofit -
critics/completeness.py— retrofit -
critics/base.py— retrofit -
critics/__init__.py— retrofit
-
models.py -
pipeline.py -
cli.py -
config.py -
output.py -
prescreen.py
-
critics/CODE_HYGIENE_FRAMEWORK.md -
critics/SECURITY_CRITIC_FRAMEWORK.md -
guides/CROSS_ARTIFACT_DESIGN.md -
SPEC.md -
CHANGELOG.md
-
quorum-config.yamlexamples - Built-in rubric JSON files
-
pyproject.toml(version key only)
| Component | File | Priority |
|---|---|---|
| Pipeline & CLI | docs/PIPELINE_REFERENCE.md |
High — users need this |
| Pre-Screen System | docs/PRESCREEN_REFERENCE.md |
High — 10 checks need documentation |
| Critic Framework | docs/CRITIC_ARCHITECTURE.md |
Medium — developers extending Quorum |
| Rubric System | docs/guides/RUBRIC_BUILDING_GUIDE.md |
Already exists ✅ |
| Cross-Artifact | docs/CROSS_ARTIFACT_DESIGN.md |
Already exists ✅ |
- Grep-able metadata —
grep -r "@grounding" *.pyinstantly shows which framework grounds each critic - Automated validation — pre-screen check PS-011 can validate headers against
quorum-header-schema.yaml - Onboarding — new contributors can understand any file's purpose from the header alone
- Single source of truth — relationships live in
quorum-relationships.yaml, not scattered across headers;@relationshipsis a pointer, not a declaration
Draft: 2026-03-06. Pending approval.