CHR Governance
CHR is a lightweight project-fact governance layer. It keeps Codex anchored to
current, trusted documents and the local git state. It does not replace tests,
OpenSpec validation, code review, debugging, release workflows, or architecture
audits.
Core Rules
- Treat only
status: active governed documents as current implementation
authority.
- Treat
draft, deprecated, superseded, and archived documents as
non-current unless explicitly needed as history.
- Treat
README.md as a human portal by default, not implementation authority.
- Treat
AGENTS.md as an agent entry map, not a knowledge base.
- Anchor checks to
HEAD plus staged, unstaged, and untracked local changes.
- Say "affected document was touched" or "may need review"; do not claim that a
document is semantically synchronized unless the content was actually reviewed.
Deterministic Script
Prefer the bundled script for checks:
python3 <skill-dir>/scripts/chr.py check --root <repo>
Python 3.11+ is required. The script reads .chr.toml, .chr/waivers.toml,
governed document frontmatter, relative links, and local git status.
Legacy wrappers are kept for compatibility:
python3 <skill-dir>/scripts/check_docs_lifecycle.py --root <repo>
python3 <skill-dir>/scripts/docs_inventory.py --root <repo>
User Workflows
General request: "use chr for document governance"
- Run
scripts/chr.py check --root <repo>.
- If the project is
not_initialized, run scripts/chr.py init --root <repo>
unless the user requested check-only behavior.
- Fix deterministic governance issues you can safely fix: missing metadata,
broken governed links, stale
AGENTS.md links, superseded/archived references,
and missing minimal governance entry files.
- Use the git-aware impact report to identify affected active docs. Update only
docs that are clearly affected by the local changes.
- If an impact is real but intentionally does not require a doc update, add a
time-limited waiver in
.chr/waivers.toml.
- If impact semantics are unclear, leave a warning in the final answer instead
of inventing architecture claims.
- Run
scripts/chr.py check --root <repo> again and report the version anchor,
changed governance files, and remaining warnings.
chr:check
Run the checker and report health. Do not edit files.
chr:sync
After code/spec/product changes, run the checker, update affected active docs,
adjust lifecycle metadata on touched docs, add waivers only when justified, and
run the checker again.
chr:gc
Run the checker and clean lifecycle issues the user expects you to clean now.
CHR is not a daemon; cleanup is user-triggered or stage-triggered. Do not rely on
time passing to perform cleanup automatically.
References
Load only what is needed:
references/commands.md: command behavior and final-report expectations.
references/project-config.md: .chr.toml and .chr/waivers.toml schema.
references/frontmatter.md: governance metadata and status semantics.
references/agents-md-rules.md: AGENTS.md constraints.
references/policy-template.md: recommended DOCS_POLICY.md.
references/openspec-integration.md: CHR and OpenSpec boundaries.
references/gc-checklist.md: user-triggered cleanup checklist.
1---2name: chr-governance3description: Govern project documentation and AI-facing instruction files with CHR. Use when the user says chr:check, chr:sync, chr:gc, "use chr for document governance", "用 chr 进行文档治理", or asks to initialize, check, synchronize, or clean AGENTS.md, DOCS_POLICY.md, .chr.toml, governed docs, OpenSpec docs, stale docs, superseded docs, archived docs, waivers, or git-aware documentation impact.4---56# CHR Governance78CHR is a lightweight project-fact governance layer. It keeps Codex anchored to9current, trusted documents and the local git state. It does not replace tests,10OpenSpec validation, code review, debugging, release workflows, or architecture11audits.1213## Core Rules1415- Treat only `status: active` governed documents as current implementation16 authority.17- Treat `draft`, `deprecated`, `superseded`, and `archived` documents as18 non-current unless explicitly needed as history.19- Treat `README.md` as a human portal by default, not implementation authority.20- Treat `AGENTS.md` as an agent entry map, not a knowledge base.21- Anchor checks to `HEAD` plus staged, unstaged, and untracked local changes.22- Say "affected document was touched" or "may need review"; do not claim that a23 document is semantically synchronized unless the content was actually reviewed.2425## Deterministic Script2627Prefer the bundled script for checks:2829```bash30python3 <skill-dir>/scripts/chr.py check --root <repo>31```3233Python 3.11+ is required. The script reads `.chr.toml`, `.chr/waivers.toml`,34governed document frontmatter, relative links, and local git status.3536Legacy wrappers are kept for compatibility:3738```bash39python3 <skill-dir>/scripts/check_docs_lifecycle.py --root <repo>40python3 <skill-dir>/scripts/docs_inventory.py --root <repo>41```4243## User Workflows4445### General request: "use chr for document governance"46471. Run `scripts/chr.py check --root <repo>`.482. If the project is `not_initialized`, run `scripts/chr.py init --root <repo>`49 unless the user requested check-only behavior.503. Fix deterministic governance issues you can safely fix: missing metadata,51 broken governed links, stale `AGENTS.md` links, superseded/archived references,52 and missing minimal governance entry files.534. Use the git-aware impact report to identify affected active docs. Update only54 docs that are clearly affected by the local changes.555. If an impact is real but intentionally does not require a doc update, add a56 time-limited waiver in `.chr/waivers.toml`.576. If impact semantics are unclear, leave a warning in the final answer instead58 of inventing architecture claims.597. Run `scripts/chr.py check --root <repo>` again and report the version anchor,60 changed governance files, and remaining warnings.6162### `chr:check`6364Run the checker and report health. Do not edit files.6566### `chr:sync`6768After code/spec/product changes, run the checker, update affected active docs,69adjust lifecycle metadata on touched docs, add waivers only when justified, and70run the checker again.7172### `chr:gc`7374Run the checker and clean lifecycle issues the user expects you to clean now.75CHR is not a daemon; cleanup is user-triggered or stage-triggered. Do not rely on76time passing to perform cleanup automatically.7778## References7980Load only what is needed:8182- `references/commands.md`: command behavior and final-report expectations.83- `references/project-config.md`: `.chr.toml` and `.chr/waivers.toml` schema.84- `references/frontmatter.md`: governance metadata and status semantics.85- `references/agents-md-rules.md`: `AGENTS.md` constraints.86- `references/policy-template.md`: recommended `DOCS_POLICY.md`.87- `references/openspec-integration.md`: CHR and OpenSpec boundaries.88- `references/gc-checklist.md`: user-triggered cleanup checklist.