feat: Add page size linting to enforce documentation limits

This commit is contained in:
Matteo Cherubini 2026-05-09 17:25:36 +02:00
parent 7f10a4f770
commit 14d78d65ea
2 changed files with 27 additions and 0 deletions

View file

@ -152,6 +152,30 @@ check_knowledge_decay() {
return 0
}
# ---------------------------------------------------------------------------
# check_page_size <file>
# Enforces the page length limits defined in agents-genome.md:
# soft cap: 400 lines → warn
# hard cap: 800 lines → error
# These limits ensure pages fit within the LLM context window without
# attention degradation and keep the wiki atomically navigable.
# ---------------------------------------------------------------------------
check_page_size() {
local file="$1"
local lines
lines=$(wc -l < "$file")
if [[ $lines -gt 800 ]]; then
error "Page too long (${lines} lines, hard cap 800): $file"
error " Split this page into focused sub-pages and link them."
return 1
elif [[ $lines -gt 400 ]]; then
warn "Page approaching limit (${lines} lines, soft cap 400): $file"
fi
return 0
}
# ---------------------------------------------------------------------------
# check_broken_links <file>
# Basic check for internal [[wikilinks]] that cannot be resolved locally.

View file

@ -38,6 +38,9 @@ for entry in "${GENOMES[@]}"; do
check_privacy_consistency "$md_file"
TOTAL_ERRORS=$((TOTAL_ERRORS + $?))
check_page_size "$md_file"
TOTAL_ERRORS=$((TOTAL_ERRORS + $?))
check_knowledge_decay "$md_file"
stale=$?
TOTAL_STALE=$((TOTAL_STALE + stale))