From 14d78d65eabfbc5015460faceb6cb4c81515183e Mon Sep 17 00:00:00 2001 From: Matteo Cherubini Date: Sat, 9 May 2026 17:25:36 +0200 Subject: [PATCH] feat: Add page size linting to enforce documentation limits --- lib/lint.sh | 24 ++++++++++++++++++++++++ scripts/lint-genomes.sh | 3 +++ 2 files changed, 27 insertions(+) diff --git a/lib/lint.sh b/lib/lint.sh index e38b996..189105a 100644 --- a/lib/lint.sh +++ b/lib/lint.sh @@ -152,6 +152,30 @@ check_knowledge_decay() { return 0 } +# --------------------------------------------------------------------------- +# check_page_size +# 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 # Basic check for internal [[wikilinks]] that cannot be resolved locally. diff --git a/scripts/lint-genomes.sh b/scripts/lint-genomes.sh index 7c2a77e..20cf546 100644 --- a/scripts/lint-genomes.sh +++ b/scripts/lint-genomes.sh @@ -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))