Repository navigation
Description
Problem
Two defects surfaced on 2026-10-01 while /plugin-quality:audit (0.11.1, Claude Code 2.1.286, Windows 11 Git Bash) audited harness-ops:plugins (then claude-ops:plugins). Both still hold on origin/main 0c5fd2898 (plugin-quality 0.12.2).
collect-categories.shrejects valid Windows-formsaved=paths.plugins/plugin-quality/skills/audit/scripts/collect-categories.sh:74setsDIR="$(cd "$(dirname "$NOTES")" && pwd -P)", which on Git Bash yields/c/Users/....check_sourcenormalizes eachsaved=path withrealpath -m(lines 102-105), which leavesC:/Users/...in drive form, soindex(path, dir "/") != 1at line 106 fails and the record is reported asresearch-<label>-path-outside-packet(line 107). The research agent and the Write tool both naturally produceC:/...paths on Windows, so a correct ledger fails the gate.- The auditor has no rule against writing the ledger through the shell.
plugins/plugin-quality/agents/auditor.md:33-37says Write is for packet files, but nothing says the ledger must be written with the Write tool and never by a shell heredoc,cat >, orcp. In the run the auditor's ledger exceeded the guardrails Bash command ceiling (MAX_COMMAND_LEN16384,plugins/guardrails/README.md:63) as one heredoc, so it drafted six scratch parts, concatenated them, andcp'd the result into the packet. That sidesteps the Write-tool path the packet rules reason about (formatterPostToolUserewrites and read-back,auditor.md:65-77), and the same session saw guardrails block acat >heredoc as a Write/Edit bypass, so recovery depended on which shell form slipped through. The guardrails limit is working as intended; the fix is in the auditor brief.
Evidence
Verified this pass:
- Read
collect-categories.sh:60-150on main. The path test is as described. - Probe in Git Bash on this host:
realpath -m -- 'C:/Users/<user>/nonexistent/x'printsC:/Users/<user>/nonexistent/x;cd C:/Users/<user> && pwd -Pprints/c/Users/<user>;cygpath -u 'C:/Users/<user>/x'prints/c/Users/<user>/x. collect-categories.test.shon main has noC:/orcygpathcase (itssaved=fixtures at lines 161-163 use POSIX-form paths).reference/categories.md:37-50says asaved=path is "an absolute path with no spaces, inside the directory that holds the ledger", without naming which absolute form is accepted.- Read
agents/auditor.md:26-80: Write is scoped to packet files; there is no Write-only ledger rule and no mention of the command-length ceiling. - guardrails
README.md:56,63,557documents the 16384-character ceiling and that it fails the command lane closed.
Reported by the producer, not reproduced here:
- A ledger whose tier records used
saved=C:/Users/...exited 1 withpath-outside-packetanddistinct-checked=0; rewriting everysaved=path to/c/Users/...made the same ledger exit 0. - One finding's primary passed while its corroborators reported
distinct-checked=0with no per-source problem line. Inferred from the code:close_finding(line 141) counts a corroborator only when its normalized URL (fragment, query and trailing slashes stripped at lines 122-124) is not already inseen_url. A corroborator whose URL matches the primary or an earlier corroborator is dropped with no problem line. That fits the observation; not confirmed against the run's ledger.
Proposed approach
- In
collect-categories.sh, normalize both sides to one form before the prefix test: whencygpathis on PATH (command -v cygpath), convertDIRand eachsaved=path withcygpath -ubeforerealpath -m; elsewhere keep the current behavior. Read the file through the normalized path.- Rejected: "compare
realpathof both sides". The probe above showsrealpath -mkeeps whatever drive form it is given, so a notes path and asaved=path in different forms still mismatch.
- Rejected: "compare
- In the same script, print a
research-<label>-duplicate-url section=... title=...problem line when a corroborator's normalized URL is already counted, sodistinct-checked=0always has a cause on screen. - In
reference/categories.md, state thatsaved=accepts either POSIX (/c/...) or Windows drive form (C:/...) on Windows. - In
agents/auditor.md, add: write every packet file, including the ledger, with the Write tool; never through a shell heredoc,cat >,tee, orcpinto the packet. Write has no 16384-character ceiling. If a Write is refused for a report-shaped name, the existingaudit-data.mdfallback (auditor.md:44-60) applies. - Add tests to
collect-categories.test.sh: aC:/-formsaved=path inside the packet passes on Git Bash (skip visibly wherecygpathis absent), aC:/path outside the packet still fails, and a duplicate corroborator URL prints the new problem line.
Files: plugins/plugin-quality/skills/audit/scripts/collect-categories.sh, plugins/plugin-quality/skills/audit/scripts/collect-categories.test.sh, plugins/plugin-quality/skills/audit/reference/categories.md, plugins/plugin-quality/agents/auditor.md, plugins/plugin-quality/.claude-plugin/plugin.json, plugins/plugin-quality/CHANGELOG.md.
Acceptance criteria
- On Git Bash, a ledger whose
saved=paths areC:/...form and inside the packet passescollect-categories.sh. - A
C:/...path outside the packet still fails withpath-outside-packet. - A corroborator whose normalized URL duplicates the primary prints a
duplicate-urlproblem line. -
reference/categories.mdnames the acceptedsaved=path forms. -
agents/auditor.mdrequires the Write tool for every packet file and forbids shell heredoc,cat >,tee, andcpinto the packet. -
collect-categories.test.shpasses on Linux and on Git Bash. - plugin-quality version bumped with a CHANGELOG entry;
scripts/check-changelog-parity.sh --checkand--check-orderpass.
Constraints and gotchas
- Do not raise or bypass the guardrails 16384-character ceiling; it is intentional (guardrails
README.md:557). - Packet files are write-once and formatter hooks rewrite them after a Write (
auditor.md:65-77); the new rule must not ask the auditor to edit a packet file in place. cygpathexists only on Git Bash/MSYS/Cygwin; guard it so Linux and macOS behavior is unchanged.- The awk program builds a shell command from the path (
realpath -m -- '<path>', quote-escaped at line 102); keep that escaping if the conversion is done inside awk.
Context
Source: local handoff item 20261001-143000-plugin-quality-audit-windows-path-and-guard-limit.md (retired into this issue and its sibling about the research seam). Related: #4239 (research-backed audit findings), #5819 (another plugin-quality Windows/locating issue), #5924 (Windows backslash paths in hook-utils, same family of path-form bugs).
Activity
fix(plugin-quality): accept Windows saved= paths and require Write fo…