Skip to content

feat(scripts): instruction lint and the blind-review prompt (T801 t9) - #191

Merged
bketelsen merged 4 commits into
mainfrom
lucilla/t9-instruction-lint
Nov 4, 2026
Merged

bketelsen merged 4 commits into
mainfrom
lucilla/t9-instruction-lint

Conversation

@frostyard-machines

@frostyard-machines frostyard-machines commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Plan T801, task t9 (section "Gap 6: instruction hygiene"). Adds the tools for a monthly instruction-hygiene review; Odrade runs them on pi-pocket-config and her runbooks (outside the graph).

  • scripts/check-instructions.mjs (+ scripts/lib/instruction-hygiene.mjs): lint for Markdown instruction files.
    • Errors (exit 1): dead references — a backticked ~/…, /var/home/…, ./…/../… path, or a bare relative path whose first segment exists under --root or the file's folder, that does not exist; and any name from --retired / --retired-file (word-bounded, so bketelsen/stomp#4 matches and bketelsen/stomped does not).
    • Warnings (exit 0): the same sentence (≥ --min-words, default 8) in 2 or more files; over a --budget JSON limit (closed schema, unknown keys exit 2); line growth since --base <ref>.
    • Fenced code blocks are skipped for references and duplicates. Usage errors exit 2.
  • test/check-instructions.test.mjs: 20 tests.
  • .github/prompts/instruction-hygiene.prompt.md, indexed in .github/prompts/README.md: blind review — current file text only (no history, blame, diffs, PR threads or authors), a reviewer from another model family (Claude-written files → openai/gpt-6.1-sol), read-only, at most 15 items, each with quotes and file:line.
  • package.json: check:instructions script. Not added to verify: the lint is a periodic tool, not a gate.

Risk tier

Risk tier: 1 — a new read-only local script, its tests and a runbook; no workflow, authority, policy or existing script changes.

Verification

  • node --test test/check-instructions.test.mjs: 20/20 pass at 7907b49.
  • make ci: 94/94 tests pass; docs, organization and scripts gates green.
  • Revert test (scratch git worktree at 87084ba): removed the dead-reference addRecord, emptied the retired-name loop, and disabled the growth warning (node --test test/check-instructions.test.mjs). Result: 6 tests fail — dead docs/missing.md reference fails when docs exists, home-relative dead and present paths, retired name respects boundaries and retired-file works, double-backtick code spans normalize outer spaces, base ref reports line growth, base ref reports word growth at the same line count; 10 pass (the negative cases). Restored; worktree removed.
  • Cross-review (openai/gpt-6.1-sol, coder github-copilot/mai-code-2-flash), round 1 at 96da47a: Not ready, 5 blockers, all accepted and fixed in 87084ba with tests — retired names inside URLs, sentence split at inner dots (false duplicates), fences inside blockquotes and nested lists, multi-backtick code spans, word growth with the same line count.
  • Re-review 1 at 87084ba: 4 fixes confirmed; 1 new blocker (the container-fence fix hid text after indented code and after an ended blockquote). Fixed in dec9360: fences track quote depth and list content indent and end with their container. Revert test for it (scratch worktree at dec9360, scripts/lib/instruction-hygiene.mjs taken from 87084ba): 3 tests fail — four-space fence does not hide an following reference, ended blockquote fence does not hide an following reference, fence in a list item and ended list item are handled.
  • Re-review 2 at dec9360: the earlier fix confirmed; 1 new blocker (a single list indent lost the parent item when a nested list ended, so a valid fence in the parent was checked). Fixed in 7907b49 with a stack of list content indents. Revert test (lib from dec9360): a fence in the parent item after a nested list ends is skipped, and text after the list is checked fails.
  • Re-review 3 at 7907b49: Ready, Blocking: none (reviewer openai/gpt-6.1-sol; budget used: 1 review + 3 re-reviews).
  • Real-input run (read-only): --root ~ --retired bketelsen/stomp on ~/.pi/agent/AGENTS.md, the agent profiles, ~/.pi/agent/skills and Odrade's plans: 66 files, 2 errors (a bketelsen/stomp mention in a profile, a dead ~/projects/odrade path), 22 duplicate-sentence warnings. On core's AGENTS.md, docs/README.md and .github/prompts: 0 errors, 0 warnings.
  • Known limit: skills that describe paths in other repositories (for example the docs-site scaffold skill run against core) give dead-reference errors, because their paths are relative to the target repository. The lint is meant for the files the prompt names; the operator triages such hits.

Docs housekeeping

  • New runbook indexed in .github/prompts/README.md

Adds scripts/check-instructions.mjs (dead references and retired names
fail; duplicate sentences, size budgets and growth warn), its tests, and
.github/prompts/instruction-hygiene.prompt.md (plan T801, Gap 6).
Retired names match inside URLs; sentences keep inner punctuation;
fences inside blockquotes and nested lists are skipped; multi-backtick
code spans are read; word growth also warns.
Indented code (4 spaces, no list) opens no fence; a fence in a
blockquote or list item ends when that container ends.
@frostyard-machines frostyard-machines added the ready-for-human Reviewed, CI green: ready for Brian to review and merge label Nov 4, 2026
@bketelsen
bketelsen merged commit 182a399 into main Nov 4, 2026
3 checks passed
@bketelsen
bketelsen deleted the lucilla/t9-instruction-lint branch November 4, 2026 14:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-for-human Reviewed, CI green: ready for Brian to review and merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants