Skip to content

Promote the AGENTS.md router split and the scripts/ gate harness to main - #457

Merged
ptr727 merged 2 commits into
mainfrom
develop
Jul 30, 2026
Merged

ptr727 merged 2 commits into
mainfrom
develop

Conversation

@ptr727

@ptr727 ptr727 commented Jul 30, 2026

Copy link
Copy Markdown
Owner

Promotes 3974ac2 (#455). Conflict-free, one commit ahead.

Promoting now so a new repo scaffolds against the router shape rather than the pre-split monolith. groundTruthBranch cannot name develop - AUDIT.md section 1 says a registry groundTruthBranch naming develop contradicts it for either workflow model, and the question was already settled that way for HomeAssistant-Config (#340). So the audit targets main, and until main carries GOVERNANCE.md a newly scaffolded repo either holds the pre-split shape or is audited against a branch that lacks what it carries. This removes that fork.

What lands

AGENTS.md becomes a thin router (87,457 -> 7,789 bytes) with the rule text in GOVERNANCE.md, and docs/token-cost.md records the measurement: re-reading the pre-split file cost $273 over 216 reads, only 36.9% of which used a range.

The scripts/ gates get tests. Five defects in them all reported success while doing nothing:

  • the charset table omitted U+21D2, U+2264, U+2265, three characters the rule names
  • the duplicate-word allowlist contradicted its own comment
  • discovery reached 246 generated files, against a rule that names those directories
  • lstrip ate every dotfile prefix, so --diff was blind to .github/
  • the table was first written with literal non-ASCII in the file the rule scans

Each fix carries the case that would have caught it. The charset table is driven by the codepoints parsed out of GOVERNANCE.md rather than a copy of them, and both modules assert a floor on what a healthy run reaches: with the workflow glob broken, repo_gate prints 0 issue(s) and reads exactly like a clean tree.

Scope is now every text file git tracks, binaries skipped by a NUL-byte check. CI gates the self-tests, both repo_gate checks, and the charset and duplicate-word rules. The semicolon rule stays warn-only, since going green needs the sweep the prose rule itself forbids.

Also carries the 26 recast semicolon splices and 25 repointed references that still attributed moved rule text to AGENTS.md across 13 files.

Fidelity note

Sections declared verbatim changed, so every downstream copy is now stale until re-vendored. spec/fidelity_honesty.py distinguishes stale from modified by hash, so the audit reports it correctly. That is the standing cost of a fleet-law edit and the reason to take it in one promotion rather than a section at a time.

🤖 Generated with Claude Code

AGENTS.md becomes a thin router (87,457 -> 7,789 bytes) with the rule text in GOVERNANCE.md, and docs/token-cost.md records the measurement behind it.

The scripts/ gates get tests, because five defects in them all reported success while doing nothing: the charset table omitted three characters the rule names, the duplicate-word allowlist contradicted its own comment, discovery reached 246 generated files against a rule that names those directories, `lstrip` ate every dotfile prefix so --diff was blind to .github/, and the table was first written with literal non-ASCII in the file the rule scans.

Each fix carries the case that would have caught it. The charset table is driven by the codepoints parsed out of GOVERNANCE.md rather than a copy of them, and both modules assert a floor on what a healthy run reaches: with the workflow glob broken, repo_gate prints 0 issue(s) and reads exactly like a clean tree.

Scope is now every text file git tracks, binaries skipped by a NUL-byte check. CI gates the self-tests, both repo_gate checks, and the charset and duplicate-word rules. The semicolon rule stays warn-only, since going green needs the sweep the prose rule itself forbids.

Also recast the 26 semicolon splices this branch introduced, and repointed 25 references that still attributed moved rule text to AGENTS.md across 13 files.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR promotes the agent-governance split (router AGENTS.md + rule-text GOVERNANCE.md) and the scripts/ gate harness to main, aligning the hub’s audited ground truth with the new layout and making the repo’s prose/repo gates self-tested and CI-enforced.

Changes:

  • Introduce GOVERNANCE.md as the rule-text authority and update cross-references across docs/spec/audit tooling.
  • Add deterministic scripts/ gates (prose_lint.py, repo_gate.py, pr_review.py) plus stdlib unittest self-tests, and run them in CI.
  • Update spec enforcement to validate that every declared section maps to a real ## heading in the hub copy.

Reviewed changes

Copilot reviewed 33 out of 33 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
WORKFLOW.md Update references from AGENTS.md to GOVERNANCE.md.
STANDUP.md Switch governance authority link to GOVERNANCE.md.
spec/validate.py Enforce declared sections resolve to real H2 headings.
spec/section-model.md Update section model for split AGENTS/GOVERNANCE.
spec/readme-structure.md Update rule references to GOVERNANCE.md.
spec/project-types.json Repoint intent references to GOVERNANCE.md where needed.
spec/files.json Declare GOVERNANCE.md baseline sections; slim AGENTS.md sections.
spec/fidelity-model.md Repoint workflow-contract references to GOVERNANCE.md.
spec/divergences.json Update example unit key to GOVERNANCE.md.
spec/audit.py Extend carried-doc checks and section advisories to GOVERNANCE.md.
scripts/test_repo_gate.py Add unit tests covering repo_gate checks and floors.
scripts/test_prose_lint.py Add unit tests covering prose_lint rules and discovery.
scripts/repo_gate.py Add repo gate checks for SHA pinning and EOL consistency.
scripts/README.md Document hub-only scripts and how they’re tested/run.
scripts/prose_lint.py Add prose gate for charset/dupword/semicolon/sentence rules.
scripts/pr_review.py Add compact Copilot review status/wait helper.
reports/homeassistant-purpleair/audit.md Update charset carve-out/codepoint references.
repo-config/README.md Repoint branching-model references to GOVERNANCE.md.
README.md Describe split: AGENTS router + GOVERNANCE rule text.
pyproject.toml Include scripts/ in mypy/pyright scope.
host-setup/agent-safety/README.md Repoint safety rule references to GOVERNANCE.md.
host-setup/agent-safety/gh-write-guard.py Update prose references to GOVERNANCE.md.
host-setup/agent-safety/claude-md-safety.md Update prose references to GOVERNANCE.md.
GOVERNANCE.md Add new cross-cutting fleet governance rule text.
docs/token-cost.md Add hub-only measurement doc motivating the split.
docs/repo-config-carry.md Repoint documentation-style/git-rule references to GOVERNANCE.md.
CODESTYLE.md Update cross-cutting process-rule references to GOVERNANCE.md.
AUDIT.md Update prose authorities to GOVERNANCE.md and links.
.github/workflows/validate-task.yml Run scripts self-tests + gates in CI validation job.
.github/copilot-instructions.md Repoint rule authority references to GOVERNANCE.md.
.gitattributes Pin new scripts/test files to LF by path.
.editorconfig Pin scripts/*.py to LF to match .gitattributes/shebang use.

Comment thread .github/copilot-instructions.md Resolved
Comment thread scripts/prose_lint.py Resolved
Comment thread GOVERNANCE.md Resolved
…rules at it (#458)

Answers the review findings on promotion #457.

The carried-files list omitted GOVERNANCE.md, which spec/files.json declares carried. And copilot-instructions.md said a reviewer-binding rule has to live in AGENTS.md to be provider-independent - the router holds no rule text, and the earlier sweep fixed the first half of that same line and left the clause.

A third finding is declined with evidence: git ls-files prints paths relative to its -C directory, not the repo top level, so the join in tracked_paths is correct. A case pins the invariant, since --full-name would flip it silently.
Copilot AI review requested due to automatic review settings July 30, 2026 01:46

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 33 out of 33 changed files in this pull request and generated no new comments.

Comments suppressed due to low confidence (2)

scripts/pr_review.py:87

  • digest() summarizes unresolved review threads from reviewThreads(first:100). If a PR has more than 100 threads, this will silently undercount (and can miss Copilot threads beyond the first page), which is risky for a tool meant to support merge-readiness checks.

Consider either paginating reviewThreads or at least flagging when results may be truncated so the output can’t be misread as "no unresolved threads".

    threads = pr['reviewThreads']['nodes']
    unresolved = [t for t in threads
                  if not t['isResolved']
                  and ((t.get('comments') or {}).get('nodes') or [{}])[0]
                  .get('author', {}).get('login') == REVIEWER]

scripts/README.md:14

  • python3 -m unittest discover doesn’t exit with code 5 when no tests are collected (it typically prints "Ran 0 tests" and exits 0), so this comment can mislead readers about what this command guarantees.

Either drop the exit-code claim or describe the actual guardrail (e.g., the per-module harness tests that assert a floor on the case count).

python3 -m unittest discover -s scripts          # both, and exits 5 if the suite vanishes

@ptr727
ptr727 merged commit 80a3c68 into main Jul 30, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants