docs(rules): collapse docs into .rules, gate PRs, auto-version - #197
Open
echobt wants to merge 2 commits into
Open
docs(rules): collapse docs into .rules, gate PRs, auto-version#197echobt wants to merge 2 commits into
echobt wants to merge 2 commits into
Conversation
Delete the human `docs/` site and make the repo strict about the three surfaces that remain: `README.md` for humans, `AGENTS.md` for the agent / operator contract, and `.rules/` for the enforceable rules every coding agent must read before opening or readying a PR. Gate-pinned normative content is relocated, not dropped: `.rules/contracts/` now holds BUNDLE_SPEC, DESIGN_CHALLENGE (+ checklists), PRISM, PRISM_RECIPE, THREAT_MODEL, and the miner-facing `external-miner/` tree with its examples. `spec-check`, `design-check`, and `external-docs-check` are repointed at the new paths, and the design baseline `include_str!` sites plus `deploy/Dockerfile` follow the move. New xtask gates keep this honest: `rules-check` fails if `docs/` returns, a `.rules/` file goes missing, `AGENTS.md` / `README.md` stop pointing at the rules, the PR template drifts from the attestation CI enforces, the local gate list stops matching CI, or a markdown link dangles. `pr-check` fails a ready PR whose body is missing the attestation. `version` owns the workspace version end to end. `pr-gate.yml` runs the attestation and bump gates on pull requests. CONTRIBUTING, CODE_OF_CONDUCT, and SUPPORT were prose duplicates of the README and `.rules/`; LICENSE, SECURITY.md, and CODEOWNERS stay at root. Co-authored-by: Mathis <echobt@users.noreply.github.com>
Single source of truth is `[workspace.package] version`; every member inherits it and `Cargo.lock` is derived from it. Minor rather than patch: this branch adds xtask subcommands and CI gates, and moves the documented contract paths, so it is new behaviour for anyone driving the repo. `prism-pipeline` was the one crate pinning a literal version on an intra-workspace path dependency, which made any bump unresolvable. Dropped, and `version check` now fails on that pattern so it cannot come back. Co-authored-by: Mathis <echobt@users.noreply.github.com>
echobt
marked this pull request as ready for review
August 29, 2026 08:28
|
Too many files changed for review (147 files, 100 file limit). Bypass the limit by tagging |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Repo-discipline overhaul. The human
docs/site is gone; what is left is threesurfaces with clear owners:
README.mdAGENTS.md.rules/first".rules/Nothing normative was dropped. Everything a gate pins was relocated to
.rules/contracts/and the gates were repointed in the same commit.Why
Stale prose was accumulating faster than anyone read it: 23 markdown articles
plus an
evidence/andspikes/tree, with commands that no longer existed(the deleted
docs/OPERATOR_SECURITY.mdtold operators to runcargo run -p xtask -- agent-challenge-check, a subcommand that has not existedfor a long time). Meanwhile the things that actually must not rot — the frozen
byte contracts, the local gate list, the naming freeze — had no machine check
tying them to reality. This PR inverts that: fewer documents, and the ones that
remain are gated.
Deleted vs relocated
Relocated (gate-pinned or normative, nothing lost):
docs/BUNDLE_SPEC.md,docs/BUNDLE_SPEC_CHECKLIST.md.rules/contracts/docs/DESIGN_CHALLENGE.md,docs/DESIGN_CHALLENGE_CHECKLIST.md.rules/contracts/docs/PRISM.md,docs/PRISM_RECIPE.md.rules/contracts/docs/THREAT_MODEL.md(D19 pinned word-for-word).rules/contracts/docs/external-miner/**incl.examples/.rules/contracts/external-miner/docs/NAMING.md.rules/60-naming.md(promoted to a numbered rule)Repointed to match:
xtask spec-check,design-check,external-docs-check,the four
include_str!sites for the design baseline(
crates/design-challenge/src/corpus.rs, its two test files,crates/design-sandbox/src/lib.rs),crates/prism-verda/tests/live_dense.rs,and
deploy/Dockerfile'sCOPY.Deleted (human prose; recoverable from git history):
docs/ARCHITECTURE.md→ condensed intoREADME.md§ Architecture (topology,one-epoch data flow, crate/process table).
docs/AGENTS.md,docs/COMPLETENESS.md,docs/GITHOOKS.md,docs/SITE_API.md→ superseded by.rules/andREADME.md.docs/OPERATOR_SECURITY.md→ the load-bearing assertions became.rules/20-pre-prod-local.md§ 5 (digest pins, master-only gateway,evil-gatewayabsent, admin 401/403, trust-root verify, file modes,pg_dumpbefore promote).docs/runbooks/**(9 files) → the live operator surface isdeploy/README.mddeploy/AGENTS.md+./deploy/scripts/local-e2e.sh --help, which sit nextto the scripts they drive. The local-before-prod path is now
.rules/20-pre-prod-local.md.docs/evidence/**,docs/spikes/**→ non-normative history.CONTRIBUTING.md,CODE_OF_CONDUCT.md,SUPPORT.md→ prose duplicates ofREADME.mdand.rules/.Kept at root, deliberately:
LICENSE(Apache-2.0, unchanged),CODEOWNERS,AGENTS.md(an agent contract, not a doc article), andSECURITY.md— GitHub surfaces the security policy in its own UI and in theprivate-vulnerability-reporting flow, so it is a platform integration point
rather than a
docs/article. Its two dangling links were repointed.Two
docs/strings were left alone on purpose:config/challenges.staging.tomlcarries a detached owner signature(
.sig) and editing a comment would invalidate it, and hashed artifacts(
crates/db/migrations/*.sql,crates/prism-recipe/anchors/v3.json) must notchange bytes for a comment tidy.
.rules/10-maintenance.mdand.rules/60-naming.mdsay so, so the next agent does not "fix" them.How an agent is supposed to use
.rules/.cursor/rules/00-read-dot-rules.mdc(alwaysApply: true) and the firstline of
AGENTS.mdboth say: read.rules/before touching anything.pre-prod-local, PR, agents, versioning, naming. They are short and
imperative.
.rules/contracts/file your change touches. Never weaken a pin tomake a diff pass.
.rules/20-pre-prod-local.mdlocally. That file ismachine-tied to CI:
rules-checkfails ifci.ymlruns acargoorbash deploy/command the file does not list, so the "local gates" can neversilently drift from the real ones.
rules-checkalso fails ifdocs/comes back, if a.rules/file goesmissing, if
AGENTS.md/README.mdstop pointing at the rules, if the PRtemplate drifts from the attestation
pr-checkenforces, or if any relativemarkdown link in
README.md,AGENTS.md,SECURITY.md,deploy/*.md, or.rules/**points at a file that does not exist. It found one genuinely brokenpre-existing link on the first run (
PRISM_RECIPE.mdpointed atprism_harness.py; the file isharness/main.py).How versioning works
Single source of truth:
[workspace.package] versionin the rootCargo.toml.All 89 members inherit it with
version.workspace = true, andCargo.lockisrewritten from it. No
VERSIONfile, no second packaging system.Level is derived from Conventional Commit subjects on the branch:
feat→minor,
!orBREAKING CHANGE:→ major, everything else → patch. Zero-majorrule: while the version is
0.y.z, a breaking change maps to minor, becausecargo treats
0.yas the compatibility unit — the repo does not promote itselfto
1.0.0by accident.Enforcement:
pr-gate.ymlrunsversion verify-bumpon every PR and fails whenthe version is unchanged versus the merge base, went backwards, or is a smaller
bump than the commits require. Narrow exemption for PRs that touch only
deploy/pins/,deploy/digests/, ormetadata/— machine-written pinartifacts.
ci.ymladditionally runsversion checkon pushes, so ahand-edited manifest or a stale lockfile fails there too.
Implementing this surfaced a real trap:
crates/prism-pipelinewas the onecrate pinning a literal
version = "0.1.0"on an intra-workspace pathdependency, which made any bump unresolvable. Dropped, and
version checknowfails on that pattern so it cannot return.
Releases stay as they were: annotated tags
vX.Y.Zcut onmain(
git tag -a v0.2.0 -m 'v0.2.0' && git push origin v0.2.0→deploy-prod.yml).No history was rewritten.
PR attestation gate
.github/PULL_REQUEST_TEMPLATE.mdnow carries four checkboxes, and.github/workflows/pr-gate.ymlenforces them onopened | edited | reopened | synchronize | ready_for_review | converted_to_draftso ticking a box or flipping a draft re-runs the gate. On a draft it reports
the open items without failing; the moment the PR is marked ready it must be
complete. The PR body arrives via an env var, never inline interpolation.
The phrases live in exactly one place (
REQUIREDinxtask/src/pr_check.rs);rules-checkasserts the template still contains them, so a filled-in templatealways passes.
Residual org settings I cannot flip from the repo
These need someone with admin on
CortexLM/cortex:main— requireciandpr-gateas requiredstatus checks, and require a PR before merge. This PR adds the checks; only
org settings can make them blocking.
productionenvironment reviewers fordeploy-prod.yml.drop Conventional Commit subjects, since
version verify-bumpreads them.Risk
No product code paths changed.
crates/design-challenge,crates/design-sandbox, andcrates/prism-verdachanged only the path ininclude_str!/ a test fixture join — the embedded bytes are identical, so theagentic-review corpus anchor is unchanged.
deploy/Dockerfilecopies the samefiles from the new path. No incentive, scoring, consensus,
BASE_*, or domain-tagsemantics were touched. No Relearn work and no Prism/Design product changes are
in this PR. Signed trust roots and hashed artifacts were deliberately not
edited. No secrets added.
Test plan
Run locally on this branch, exit status checked on each:
pr-checkwas also exercised negatively: an empty body, a body with nochecklist, and a body with unticked boxes each fail with a pointed message
naming the offending line, and
--draftdowngrades the same findings to anotice instead of a failure.
CI on this PR is green and covers what this environment could not run (no Docker
daemon here):
Still needs an operator machine, not CI:
./deploy/scripts/local-e2e.sh --smokeand the challenge submission matrix in
.rules/20-pre-prod-local.md§ 3–4(wallets + testnet egress). This branch changes no challenge behaviour, and the
design baseline fixtures it relocates are exercised by
cargo test --workspace(
crates/design-challengee2e_simandcheat_fixtures,crates/design-sandbox), which compile the movedagent.py/pyproject.tomlin via
include_str!.Rules attestation (required —
pr-gatefails a ready PR without all four)Tick only what you actually did. See
.rules/30-pr.md..rules/before opening this PR and before marking it readyAGENTS.md,README.mdand.rules/are accurate for this change, or N/A with a reason below.rules/20-pre-prod-local.mdall passed.rules/50-versioning.mdVersion before → after: 0.1.0 → 0.2.0
N/A reasons: every gate in
.rules/20-pre-prod-local.md§ 1–2 passed locally,and CI additionally confirmed
assert-compose-matrix.shgreen. The wallet- andtestnet-dependent § 3–4 items cannot run in this environment and are itemised
under Test plan rather than silently claimed.
Naming
I did not rename
BASE_*environment variables, deployed host paths(
/opt/base,/run/base, …), GHCRbaseintelligence/basepackage names, orbase-*-v1cryptographic domain tags.docs/NAMING.mdmoved to.rules/60-naming.mdwith its content intact and its status raised fromreference doc to numbered rule.