Skip to content

fix(check-instructions): report missing bare and root-level paths (T801 t9, T863) - #197

Merged
bketelsen merged 2 commits into
mainfrom
lucilla/t801-t9-instruction-lint-bare-paths
Nov 5, 2026
Merged

bketelsen merged 2 commits into
mainfrom
lucilla/t801-t9-instruction-lint-bare-paths

Conversation

@frostyard-machines

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

Copy link
Copy Markdown
Contributor

Summary

Plan T801, task t9, repair after the whole-plan check (T863). core#191 merged, but acceptance line 2 failed: scripts/check-instructions.mjs skipped a backticked span with no /, and skipped a bare relative path whose first folder did not exist. So docs/missing.md (with no docs/) and a root-level MISSING.md exited 0.

  • scripts/lib/instruction-hygiene.mjs: new isBarePathShaped(span). A bare span (no ~/, /, ./, ../) is a path when every segment is a plain file name and either the last segment has a known file extension (md, mjs, json, yml, toml, go, mod, sh, … — a short closed list) or the first segment is a known top-level folder (docs, scripts, test, tests, .github, .agents, .memory). A dotted first segment before a / is a host name and is skipped; _test.go-style suffix patterns are skipped.
  • scripts/check-instructions.mjs: a span with no / is checked when it is path-shaped; a bare relative span is checked when its first folder exists (as before) or it is path-shaped. Resolved against --root and the file's folder, as before.
  • New --ignore-ref SPAN / --ignore-ref-file FILE: exact references not to check. The global instruction files name many files of other repositories (go.mod, core's docs/tenets.md); the monthly run records the checked ones once instead of exiting 1 every month.
  • .github/prompts/instruction-hygiene.prompt.md step 1: which spans are checked, and the ignore list.
  • test/check-instructions.test.mjs: 5 new tests (25 in all). The fixture of prose punctuation inside code spans stays in the sentence now creates docs/alpha.md and docs/beta.md: it referenced them with no docs/, which is now (correctly) a dead reference.
  • .memory/corrections.jsonl: 1 line (blocker → guard, T801).

Risk tier

Risk tier: 1 — a read-only local lint, its tests and a runbook. No workflow, authority, policy or risk path changes; the lint is not in verify/check.

Verification

  • node --test test/check-instructions.test.mjs: 25/25 pass. make ci passes, rebased on f1b62e0 (current main).
  • New tests: a missing root-level file (MISSING.md, mise.toml, from a subfolder) exits 1, and 0 once present; docs/missing.md with no docs/ exits 1, and 0 once present; test/e2e/ and .github/workflows (no extension) exit 1; plain words and identifiers stay unreported (e.g., i.e., v1.2, v1.2.3, 1.24, make ci, npm run check, gh, frostyard/core, owner/name#12, origin/main, URLs, github.com/…/x.go, globs, JSON.parse, process.env, .md, _test.go, .env, model names, @scope/pkg); --ignore-ref and --ignore-ref-file skip exact references only.
  • Revert test (scratch worktree at f4fabc5): scripts/check-instructions.mjs and scripts/lib/instruction-hygiene.mjs taken from the base f1b62e0, plus a stub export function isBarePathShaped() { return false; } so the test file imports; tests kept; node --test test/check-instructions.test.mjs. Result: 5 of 25 fail on assertions — dead docs/missing.md reference fails when docs does not exist (T863), a missing root-level file fails and passes once it exists (T863), a top-level folder name makes an extensionless span a path (T863), --ignore-ref and --ignore-ref-file skip exact references, library extracts spans and skips fenced blocks. The false-positive test passes on both, as it should. Worktree restored and removed.
  • Cross-review (reviewer openai/gpt-6.1-sol, coder github-copilot/claude-opus-5.5): initial review at f4fabc5 (base f1b62e0, all 5 paths): Ready, Blocking: none; 1 low finding (the prompt overstated which spans are checked), accepted and fixed in 3869bc9. Re-review 1 at 3869bc9: Ready, Blocking: none. Budget used: 1 review + 1 re-review.
  • CI green at 3869bc9; node scripts/check-docs.mjs passes after the prompt fix.

New findings on the real targets (data, not fixes)

Read-only runs; only the findings this change adds are listed (the 5 earlier errors in Odrade's plans stay as before).

--root ~/projects/pi-pocket-config on home/.pi/agent/AGENTS.md, home/.config/pi-pocket-team/agents/, home/.pi/agent/skills/: 26 new errors, all references to files of another repository or of the repository an agent works in. None is dead where the text points:

  • core (exist in core): docs/tenets.md (lucilla.md:40), docs/design/quality-loop.md (AGENTS.md:22), docs/design/shared-skills.md (cross-review:27).
  • the repository at hand (generic): .github/risk-paths.json (AGENTS.md:17, code-grooming:25, cross-review:91), .memory/corrections.jsonl (AGENTS.md:24, :27), AGENTS.md (code-grooming:29, repo-hygiene:15, :31, :135), go.mod, package.json, Cargo.toml (repo-hygiene:89-94).
  • other repositories or homes: decisions/decided.md, decided.md (clerk.md:16, :18, the Clerk's home), docs/backups.md, docs/storage.md (moneo.md:48, homewiki), dune.ts (sheeana.md:36, pi-pocket-dune), desk.ts (cross-review:83, pi-pocket-team), docs/agents/skills/, src/data/extensions.json (tamalane.md:20, :27), halogen.service, selfie-halogen.yml (teg.md:34, :36).
  • retired repository: src/policies/improvement-identifier.md (code-grooming:10, frostyard/yeti).

--root ~/agents/odrade on plans/night-muster.md, day-shift.md, schedules.md: 2 new errors, audit/daily.mjs and package.json (schedules.md:81, pi-pocket-team files).

On core itself: TEMPLATE.md (AGENTS.md:196, docs/README.md:123) and .svu.yml (docs/README.md:71) are generic names and are now reported; core's skills give many more (their paths are relative to the target repository, as the core#191 body said). Nothing runs the lint on core's files in CI.

Suggestion for the monthly run (Odrade's call): keep an ignore file with the checked cross-repository references, or write such paths with their repository (core:docs/tenets.md is not checked).

Docs housekeeping

  • Runbook updated (.github/prompts/instruction-hygiene.prompt.md); no new doc.

…01 t9, T863)

A bare relative span was checked only when its first folder existed, so
`docs/missing.md` with no docs/ and a root-level `MISSING.md` exited 0.
Decide by shape instead: a known file extension or a known top-level
folder. Add --ignore-ref and --ignore-ref-file for checked cross-repository
references. Tests, the revert test and a corrections line guard it.
@frostyard-machines frostyard-machines added the ready-for-human Reviewed, CI green: ready for Brian to review and merge label Nov 5, 2026
@bketelsen
bketelsen merged commit 408ec56 into main Nov 5, 2026
5 checks passed
@bketelsen
bketelsen deleted the lucilla/t801-t9-instruction-lint-bare-paths branch November 5, 2026 03:22
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