feat(doc-standards): documentation tiers, budgets, and the ceiling gate
Standing docs accrete a paragraph per PR with nothing pushing back; the
root AGENTS.md reached 8,130 words in 50 commits with the same rule
stated two and three times. This encodes the counter-pressure:
- docs/AGENTS.md becomes the documentation standard: the tier taxonomy
(one home per fact), target word budgets, and the slop checklist.
- verify-doc-budgets joins doc-sync: word ceilings for the six
accretion-prone standing docs, manifest-driven, frozen at current
sizes and ratcheted down as each doc is brought to target.
- .agents/skills/dsh-doc-standards: the thin placement/audit/red-gate
workflow over the standard, mirroring the dsh-translate-docs split.
- RFC (implemented/process) records the decision, alternatives, and
the first audit cycle's deferred work list.
The gate's first catch was the standard itself (1,057 > 1,000); it
ships condensed to 984 words rather than with a raised ceiling.
2026-07-04 13:53:43 +08:00
/ * *
2026-07-12 03:36:43 +08:00
* Enforce ` wc -w ` - style ceilings from ` scripts/doc-budgets.manifest.json ` .
* Missing files and invalid ceilings fail ; ` --list ` reports current usage .
2026-07-13 23:27:00 +08:00
* Only listed standing docs are budgeted . Ceilings ratchet down with at least
* 5 % headroom ; raising one requires the justification defined in
* ` docs/AGENTS.md ` .
feat(doc-standards): documentation tiers, budgets, and the ceiling gate
Standing docs accrete a paragraph per PR with nothing pushing back; the
root AGENTS.md reached 8,130 words in 50 commits with the same rule
stated two and three times. This encodes the counter-pressure:
- docs/AGENTS.md becomes the documentation standard: the tier taxonomy
(one home per fact), target word budgets, and the slop checklist.
- verify-doc-budgets joins doc-sync: word ceilings for the six
accretion-prone standing docs, manifest-driven, frozen at current
sizes and ratcheted down as each doc is brought to target.
- .agents/skills/dsh-doc-standards: the thin placement/audit/red-gate
workflow over the standard, mirroring the dsh-translate-docs split.
- RFC (implemented/process) records the decision, alternatives, and
the first audit cycle's deferred work list.
The gate's first catch was the standard itself (1,057 > 1,000); it
ships condensed to 984 words rather than with a raised ceiling.
2026-07-04 13:53:43 +08:00
* /
import { existsSync , readFileSync } from 'node:fs'
import { resolve } from 'node:path'
const root = resolve ( import . meta . dirname , '..' )
const MANIFEST_PATH = resolve ( root , 'scripts/doc-budgets.manifest.json' )
/** `wc -w` equivalent: count whitespace-delimited tokens. */
function countWords ( text : string ) : number {
return text . split ( /\s+/ ) . filter ( Boolean ) . length
}
const manifest = JSON . parse ( readFileSync ( MANIFEST_PATH , 'utf8' ) ) as Record < string , number >
const listOnly = process . argv . includes ( '--list' )
const failures : string [ ] = [ ]
const rows : string [ ] = [ ]
for ( const [ path , ceiling ] of Object . entries ( manifest ) ) {
if ( ! Number . isInteger ( ceiling ) || ceiling <= 0 ) {
2026-07-04 14:27:49 +08:00
rows . push ( ` BAD ${ '—' . padStart ( 6 ) } / ${ String ( ceiling ) . padEnd ( 6 ) } ${ path } ` )
feat(doc-standards): documentation tiers, budgets, and the ceiling gate
Standing docs accrete a paragraph per PR with nothing pushing back; the
root AGENTS.md reached 8,130 words in 50 commits with the same rule
stated two and three times. This encodes the counter-pressure:
- docs/AGENTS.md becomes the documentation standard: the tier taxonomy
(one home per fact), target word budgets, and the slop checklist.
- verify-doc-budgets joins doc-sync: word ceilings for the six
accretion-prone standing docs, manifest-driven, frozen at current
sizes and ratcheted down as each doc is brought to target.
- .agents/skills/dsh-doc-standards: the thin placement/audit/red-gate
workflow over the standard, mirroring the dsh-translate-docs split.
- RFC (implemented/process) records the decision, alternatives, and
the first audit cycle's deferred work list.
The gate's first catch was the standard itself (1,057 > 1,000); it
ships condensed to 984 words rather than with a raised ceiling.
2026-07-04 13:53:43 +08:00
failures . push ( ` ${ path } : ceiling must be a positive integer, got ${ ceiling } ` )
continue
}
const abs = resolve ( root , path )
if ( ! existsSync ( abs ) ) {
2026-07-04 14:27:49 +08:00
rows . push ( ` MISS ${ '—' . padStart ( 6 ) } / ${ String ( ceiling ) . padEnd ( 6 ) } ${ path } ` )
feat(doc-standards): documentation tiers, budgets, and the ceiling gate
Standing docs accrete a paragraph per PR with nothing pushing back; the
root AGENTS.md reached 8,130 words in 50 commits with the same rule
stated two and three times. This encodes the counter-pressure:
- docs/AGENTS.md becomes the documentation standard: the tier taxonomy
(one home per fact), target word budgets, and the slop checklist.
- verify-doc-budgets joins doc-sync: word ceilings for the six
accretion-prone standing docs, manifest-driven, frozen at current
sizes and ratcheted down as each doc is brought to target.
- .agents/skills/dsh-doc-standards: the thin placement/audit/red-gate
workflow over the standard, mirroring the dsh-translate-docs split.
- RFC (implemented/process) records the decision, alternatives, and
the first audit cycle's deferred work list.
The gate's first catch was the standard itself (1,057 > 1,000); it
ships condensed to 984 words rather than with a raised ceiling.
2026-07-04 13:53:43 +08:00
failures . push ( ` ${ path } : budgeted file does not exist (renamed or deleted? update scripts/doc-budgets.manifest.json in the same change) ` )
continue
}
const words = countWords ( readFileSync ( abs , 'utf8' ) )
rows . push ( ` ${ words <= ceiling ? 'ok ' : 'OVER' } ${ String ( words ) . padStart ( 6 ) } / ${ String ( ceiling ) . padEnd ( 6 ) } ${ path } ` )
if ( words > ceiling ) {
failures . push ( ` ${ path } : ${ words } words exceeds the ${ ceiling } -word ceiling — relocate or condense per docs/AGENTS.md (raising the ceiling requires justification in the PR) ` )
}
}
if ( listOnly ) {
console . log ( rows . join ( '\n' ) )
process . exit ( 0 )
}
if ( failures . length > 0 ) {
console . error ( 'verify-doc-budgets failed:\n' )
for ( const failure of failures ) console . error ( ` ${ failure } ` )
console . error ( '\nSee docs/AGENTS.md for the documentation standard and the relocation-first rule.' )
process . exit ( 1 )
}
console . log ( ` verify-doc-budgets: ${ Object . keys ( manifest ) . length } budgeted docs within ceiling. ` )