Skip to content

Commit 343ebeb

Browse files
kyle-sextonclaude
andauthored
fix(codebase-health): keep audit config and view lookups inside the session home (#13807)
Refs: #7296 ## Summary `/codebase-health:audit` drew out-of-sandbox lookups in eval runs (cutoff rows c48hr, c48hrb, c48hwe): the model wrote the user-global config path with a guessed home directory, or Globbed the home tree for it. Read-only cases audit-cost-gate, audit-unscoped-cost-gate and audit-zero-findings were INVALID twice on that denial. ## Fix `plugins/codebase-health/skills/audit/SKILL.md`, line count unchanged so the cases' line citations hold: - Line 114: the user-global layer is one Read of the literal `~/.claude/codebase-health.md`, `~` kept; never a Glob, a spelled-out home directory or a search of the home tree. A host probe (Claude Code 2.1.319, HOME set to a seeded directory) showed Read of the literal `~/...` path returned the seeded file, while Glob with a `~` pattern returned no files, so the old Glob route also missed a real user's file. The layer stays: real users keep their user-global config. - Lines 326-330: the resolver command takes `--option "<option>"`, and the prose names `${user_config.medium}` and says never to put a `${user_config.*}` string in a shell command, as #13502 did for visualization. This removes the c48hb denial of a command carrying the raw token. - Lines 334-335: the rendered-views files are never read, listed or audited in any phase. audit-view-team-terminal failed `no-convention-read` in 3 of 3 with-arm runs because discovery Read `docs/conventions/rendered-views.yaml`. The audit-view-* losses (c48hbb) were not caused by the token: all 6 with-arm runs passed `--option ""`, and every resolver call failed because `node` resolved to a mise shim that refused its untrusted config. The before/after runs put a real node on the eval PATH on both sides. ## Verification - `validate-cases.py plugins/codebase-health`: 0 FAIL. - `scripts/check-changelog-fragments.sh --check`: pass. Pre-push `check-affected`: pass. - Before/after eval pairs, 3 runs per arm. Before = `origin/main` 999b26c (no codebase-health change since base); after = head a9811f8. Scores are with-arm / without-arm. Both arms ran with a real node 24.21.0 and jq 1.8.2 first on PATH, because the mise node shim refuses its config under the eval HOME. - Read (cost-gate, unscoped-cost-gate, zero-findings): before INVALID on a denied Read of the user-global config through a written-out home path. After VALID, and all 9 with-arm lookups are `Read ~/.claude/codebase-health.md`. cost-gate 1/0.67/1 vs 0.67x3; unscoped-cost-gate 1/1/0.75 vs 0.5x3; zero-findings 1x3 vs 0.5x3. - View (view-retired-terminal, view-team-terminal): before INVALID on the `${user_config.medium}` token in the resolver call. After VALID: retired 0.8x3 vs 0.6x3; team 0.75/1/1 vs 0.5x3. - Write,Edit (5 cases): the before side's only denial is a `Glob` for the home config in audit-fix-delegates, so the pair is read on the other 4 cases and audit-fix-delegates is reported alone. After VALID on the one allowed re-run; the first after run was INVALID on one plugin-tree Glob in settings-schema-routes-out (1 of 3 runs), a call this PR did not add. boundary-uncovered 1x3 vs 0.83x3; infers-and-offers-setup 1x3 vs 0.5x3; review-only-stops 1x3 vs 0.875x3; settings-schema-routes-out 1/0.86/1 vs 0.71x3; fix-delegates 0.75/0.875/0.625 vs 0.5/0.375/0.5. On the 4 shared cases, no after score is below the before side. - Bash,Write,Edit (planted-drift): before INVALID on the token. After VALID: 0.92/0.85/1 vs 0.23x3. - Bash,Write (view-publishing-ignored): before INVALID on the token. After VALID: 0.71/1/0.71 vs 0.29x3. ## Remaining on #7296 - codebase-health `audit` needs a VALID run on both arms for every case after this merges. ## Related - #7296 - #13502 <!-- session: hitl-backlog --> 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 5.5 <[email protected]>
1 parent 0a288da commit 343ebeb

10 files changed

Lines changed: 20 additions & 13 deletions

File tree

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
bump: patch
3+
---
4+
5+
### Fixed
6+
7+
- `/codebase-health:audit` looks up the user-global `~/.claude/codebase-health.md` with one Read of that literal path, never a Glob, a spelled-out home directory or a search of the home tree; the rendered-view resolver command takes `--option "<option>"` instead of the `${user_config.medium}` token; and the rendered-views files are never read or audited in any phase (#7296).

‎plugins/codebase-health/evals/audit-cost-gate/prompt.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
description: "Cost gate, SKILL.md lines 212-215 (and context/discovery-method.md step 2): with --docs-only but no path scope, the documentation dimension enumerates 33 files (README.md plus 32 pages under docs/), past the ~20-file line, so the run confirms with the user before dispatching any discovery subagent, and no report is presented (a full report would end with the setup offer of lines 300-303, which the ask grader alone could mistake for the scope ask). Agent is in allowed_tools (the plugin-evals Grant tools section lists it in the read-only set), so the no-dispatch grader can fail. AskUserQuestion is left out so the ask lands in the reply text. Needs --scaffold."
2+
description: "Cost gate, SKILL.md lines 212-215 (and context/discovery-method.md step 2): with --docs-only but no path scope, the documentation dimension enumerates 33 files (README.md plus 32 pages under docs/), past the ~20-file line, so the run confirms with the user before dispatching any discovery subagent, and no report is presented (a full report would end with the setup offer of lines 309-312, which the ask grader alone could mistake for the scope ask). Agent is in allowed_tools (the plugin-evals Grant tools section lists it in the read-only set), so the no-dispatch grader can fail. AskUserQuestion is left out so the ask lands in the reply text. Needs --scaffold."
33
tags: [codebase-health, audit, outcome, cost-gate]
44
max_turns: 25
55
timeout_seconds: 900

‎plugins/codebase-health/evals/audit-fix-delegates/prompt.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
description: "--fix on a README with one false claim. Fix gate and remediation, SKILL.md lines 351 and 377-381: present the Phase 3 findings, then suggest /implementation:implement followed by /verification:confirm, 'Do NOT auto-invoke either skill, the user drives both'; when those plugins are not installed, 'say so and stop: the Phase 3 findings table is the handoff, to be remediated manually in the reported fix-priority order'. remediation-handoff passes either form; only this plugin loads in an eval run, so the not-installed branch is the one that applies, and absent-manual-handoff grades it: the reply says the implementation or verification plugin is not installed and points to the findings table as the manual handoff. report-before-handoff grades that the findings table comes before the handoff text. Never re-inline a fix loop (line 381), so the scaffold's files stay untouched; the edit graders are path-scoped because the emit checklist (lines 169-174) may be written to a task-notes file. The claim sits in the documentation dimension, audited at every effort (lines 153-157). Needs --scaffold --allow-tools Write Edit."
2+
description: "--fix on a README with one false claim. Fix gate and remediation, SKILL.md lines 360 and 386-390: present the Phase 3 findings, then suggest /implementation:implement followed by /verification:confirm, 'Do NOT auto-invoke either skill, the user drives both'; when those plugins are not installed, 'say so and stop: the Phase 3 findings table is the handoff, to be remediated manually in the reported fix-priority order'. remediation-handoff passes either form; only this plugin loads in an eval run, so the not-installed branch is the one that applies, and absent-manual-handoff grades it: the reply says the implementation or verification plugin is not installed and points to the findings table as the manual handoff. report-before-handoff grades that the findings table comes before the handoff text. Never re-inline a fix loop (line 390), so the scaffold's files stay untouched; the edit graders are path-scoped because the emit checklist (lines 169-174) may be written to a task-notes file. The claim sits in the documentation dimension, audited at every effort (lines 153-157). Needs --scaffold --allow-tools Write Edit."
33
tags: [codebase-health, audit, outcome, fix-gate, delegation, no-network]
44
max_turns: 40
55
timeout_seconds: 1200

‎plugins/codebase-health/evals/audit-planted-drift/prompt.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
description: "A scoped docs-only audit of a README with one false claim (an `npm run serve` script package.json lacks) among true ones. Output format, SKILL.md lines 280-288: open with a 'Needs you' line, then the exact findings table (Severity, Category, File:Line, Description, Verification) with error/warning/info severity. Required sections, lines 290-303: verified non-issues each carrying its evidence, 'the file you read or the command you ran' (lines 292-294), an enforcement escalation naming the automated check per finding (lines 298-299), and config-gap observations (lines 300-303). Confidence tags, lines 265-269. Rendered view, lines 316-344: with no rendered-views file the resolver prints 'view: auto (plugin default)' after the report (lines 333-334); only this plugin loads in an eval run, so visualization:visualize is absent and the reply says in one line the optional view is unavailable and builds no HTML or chart (lines 323-324). The prompt states the interactive session in plain words, since line 320 skips that section when no one is reading. Fix gate, lines 346-351: without --fix the report is the deliverable and the run stops; bare audit is read-only (lines 46-51). The read-only graders are path-scoped to the scaffold's files because the emit checklist (lines 169-174) may be copied into a task-notes file. resolver-ran is a with-only indicator. Every claim sits in the documentation dimension, the one audited at every effort (lines 153-157). Watch items: the resolver needs a real node on PATH in the sandbox, and line 330 passes the user_config.medium token through Bash. Needs --scaffold --allow-tools Bash Write Edit."
2+
description: "A scoped docs-only audit of a README with one false claim (an `npm run serve` script package.json lacks) among true ones. Output format, SKILL.md lines 289-297: open with a 'Needs you' line, then the exact findings table (Severity, Category, File:Line, Description, Verification) with error/warning/info severity. Required sections, lines 299-312: verified non-issues each carrying its evidence, 'the file you read or the command you ran' (lines 301-303), an enforcement escalation naming the automated check per finding (lines 307-308), and config-gap observations (lines 309-312). Confidence tags, lines 274-278. Rendered view, lines 325-353: with no rendered-views file the resolver prints 'view: auto (plugin default)' after the report (lines 342-343); only this plugin loads in an eval run, so visualization:visualize is absent and the reply says in one line the optional view is unavailable and builds no HTML or chart (lines 332-333). The prompt states the interactive session in plain words, since line 329 skips that section when no one is reading. Fix gate, lines 355-360: without --fix the report is the deliverable and the run stops; bare audit is read-only (lines 46-51). The read-only graders are path-scoped to the scaffold's files because the emit checklist (lines 169-174) may be copied into a task-notes file. resolver-ran is a with-only indicator. Every claim sits in the documentation dimension, the one audited at every effort (lines 153-157). Watch items: the resolver needs a real node on PATH in the sandbox, and line 339 passes the user_config.medium token through Bash. Needs --scaffold --allow-tools Bash Write Edit."
33
tags: [codebase-health, audit, outcome, read-only, findings, rendered-view, narration, no-network]
44
max_turns: 40
55
timeout_seconds: 1200

‎plugins/codebase-health/evals/audit-review-only-stops/prompt.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
description: "--review-only on one named file. Argument parsing, SKILL.md lines 46-51: bare audit is read-only and --review-only means that default; fix gate, lines 346-351: without --fix present the full report and STOP. The README carries one false claim (an `npm run serve` script package.json lacks), and the repo also holds 32 docs pages outside the named scope. finding-row and verified-non-issues grade the report (verified non-issues carry evidence, lines 292-294); no-implement-run and no-confirm-run grade no remediation handoff; no-write and no-edit are unscoped because the legacy case forbade writing any file, so a run that copies the emit checklist (lines 169-174) into a task-notes file fails them; no-docs-read and no-docs-agent grade that the audit stays on README.md. The claim sits in the documentation dimension, audited at every effort (lines 153-157). Needs --scaffold --allow-tools Write Edit."
2+
description: "--review-only on one named file. Argument parsing, SKILL.md lines 46-51: bare audit is read-only and --review-only means that default; fix gate, lines 355-360: without --fix present the full report and STOP. The README carries one false claim (an `npm run serve` script package.json lacks), and the repo also holds 32 docs pages outside the named scope. finding-row and verified-non-issues grade the report (verified non-issues carry evidence, lines 301-303); no-implement-run and no-confirm-run grade no remediation handoff; no-write and no-edit are unscoped because the legacy case forbade writing any file, so a run that copies the emit checklist (lines 169-174) into a task-notes file fails them; no-docs-read and no-docs-agent grade that the audit stays on README.md. The claim sits in the documentation dimension, audited at every effort (lines 153-157). Needs --scaffold --allow-tools Write Edit."
33
tags: [codebase-health, audit, outcome, read-only, fix-gate, no-network]
44
max_turns: 40
55
timeout_seconds: 1200

‎plugins/codebase-health/evals/audit-view-publishing-ignored/prompt.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
description: "Rendered view where a tracked team file and the retired ~/.claude/rendered-views.md both set the publishing value artifact, SKILL.md lines 316-344: resolve medium with the shared resolver (lines 326-331), print its report line and notices after the report as they stand (lines 333-334), and leave the rendered-views files to the resolver, which never publishes on a team file's say-so (lines 334-336). Neither value decides, so medium is null, the offer row (line 343). Only this plugin loads in an eval run, so visualization:visualize is absent and lines 323-324 apply: say in one line that the optional view is unavailable, and never hand-build an HTML file or chart. Run by hand in the scaffolded workspace on a first run the resolver prints 'view: auto (plugin default)', the notice that ~/.claude/rendered-views.md is no longer read, and the notice that a team file never publishes. view-line-after-report needs the resolver's line after the Verified non-issues section; team-notice and retired-notice the two notices; view-unavailable-line the one unavailable line; resolver-ran (with-only) the resolver call; no-convention-read and no-convention-shell-read that no Read or Bash command names a rendered-views file; no-html-write that no .html or .svg file is written. The prompt states the interactive session in plain words, since line 320 skips the view section when no one is reading. Watch items: the resolver needs a real node on PATH in the sandbox, and line 330 passes the user_config.medium token through Bash. Needs --scaffold --allow-tools Bash Write."
2+
description: "Rendered view where a tracked team file and the retired ~/.claude/rendered-views.md both set the publishing value artifact, SKILL.md lines 325-353: resolve medium with the shared resolver (lines 335-340), print its report line and notices after the report as they stand (lines 342-343), and leave the rendered-views files to the resolver, which never publishes on a team file's say-so (lines 343-345). Neither value decides, so medium is null, the offer row (line 352). Only this plugin loads in an eval run, so visualization:visualize is absent and lines 332-333 apply: say in one line that the optional view is unavailable, and never hand-build an HTML file or chart. Run by hand in the scaffolded workspace on a first run the resolver prints 'view: auto (plugin default)', the notice that ~/.claude/rendered-views.md is no longer read, and the notice that a team file never publishes. view-line-after-report needs the resolver's line after the Verified non-issues section; team-notice and retired-notice the two notices; view-unavailable-line the one unavailable line; resolver-ran (with-only) the resolver call; no-convention-read and no-convention-shell-read that no Read or Bash command names a rendered-views file; no-html-write that no .html or .svg file is written. The prompt states the interactive session in plain words, since line 329 skips the view section when no one is reading. Watch items: the resolver needs a real node on PATH in the sandbox, and line 339 passes the user_config.medium token through Bash. Needs --scaffold --allow-tools Bash Write."
33
tags: [codebase-health, audit, outcome, rendered-view, narration, no-network]
44
max_turns: 40
55
timeout_seconds: 1200

‎plugins/codebase-health/evals/audit-view-retired-terminal/prompt.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
description: "Rendered view with only the retired ~/.claude/rendered-views.md setting terminal, SKILL.md lines 316-344: resolve medium with the shared resolver (lines 326-331), print its report line and notices after the report as they stand (lines 333-334), leave the rendered-views files to the resolver (lines 334-336), and when medium is terminal make no offer and print no unavailable line (lines 321-322 and 342). The scaffold writes $HOME/.claude/rendered-views.md with 'medium: terminal' (refusing the real home) and no other rendered-views file; run by hand in the scaffolded workspace on a first run the resolver prints 'view: terminal (retired ~/.claude/rendered-views.md)' and the notice that the file is retired but still keeps the view local. The README carries one false claim so the report has a finding. The prompt states the interactive session in plain words, since line 320 skips the view section when no one is reading. view-line-after-report needs the resolver's line after the Verified non-issues section; retired-notice the notice text; resolver-ran (with-only) the resolver call; no-convention-read and no-convention-shell-read that no Read or Bash command names a rendered-views file; no-view-offer that the reply makes no offer and prints no unavailable line. Watch items: the resolver needs a real node on PATH in the sandbox, and line 330 passes the user_config.medium token through Bash. Needs --scaffold --allow-tools Bash."
2+
description: "Rendered view with only the retired ~/.claude/rendered-views.md setting terminal, SKILL.md lines 325-353: resolve medium with the shared resolver (lines 335-340), print its report line and notices after the report as they stand (lines 342-343), leave the rendered-views files to the resolver (lines 343-345), and when medium is terminal make no offer and print no unavailable line (lines 330-331 and 351). The scaffold writes $HOME/.claude/rendered-views.md with 'medium: terminal' (refusing the real home) and no other rendered-views file; run by hand in the scaffolded workspace on a first run the resolver prints 'view: terminal (retired ~/.claude/rendered-views.md)' and the notice that the file is retired but still keeps the view local. The README carries one false claim so the report has a finding. The prompt states the interactive session in plain words, since line 329 skips the view section when no one is reading. view-line-after-report needs the resolver's line after the Verified non-issues section; retired-notice the notice text; resolver-ran (with-only) the resolver call; no-convention-read and no-convention-shell-read that no Read or Bash command names a rendered-views file; no-view-offer that the reply makes no offer and prints no unavailable line. Watch items: the resolver needs a real node on PATH in the sandbox, and line 339 passes the user_config.medium token through Bash. Needs --scaffold --allow-tools Bash."
33
tags: [codebase-health, audit, outcome, rendered-view, narration, no-network]
44
max_turns: 40
55
timeout_seconds: 1200

‎plugins/codebase-health/evals/audit-view-team-terminal/prompt.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
description: "Rendered view with a tracked team file setting terminal, SKILL.md lines 316-344: resolve medium with the shared resolver (lines 326-331), print its report line after the report as it stands (lines 333-334), leave the rendered-views convention files to the resolver (lines 334-336), and when medium is terminal make no offer and print no unavailable line (lines 321-322 and 342). The scaffold commits docs/conventions/rendered-views.yaml with 'medium: terminal'; run by hand in the scaffolded workspace the resolver prints 'view: terminal (team)'. The README carries one false claim so the report has a finding. The prompt states the interactive session in plain words, since line 320 skips the view section when no one is reading. view-line-after-report needs the resolver's line after the Verified non-issues section; resolver-ran (with-only) the resolver call with --lane codebase-health:audit; no-convention-read and no-convention-shell-read that no Read or Bash command names a rendered-views file; no-view-offer that the reply makes no offer and prints no unavailable line. Watch items: the resolver needs a real node on PATH in the sandbox, and line 330 passes the user_config.medium token through Bash. Needs --scaffold --allow-tools Bash."
2+
description: "Rendered view with a tracked team file setting terminal, SKILL.md lines 325-353: resolve medium with the shared resolver (lines 335-340), print its report line after the report as it stands (lines 342-343), leave the rendered-views convention files to the resolver (lines 343-345), and when medium is terminal make no offer and print no unavailable line (lines 330-331 and 351). The scaffold commits docs/conventions/rendered-views.yaml with 'medium: terminal'; run by hand in the scaffolded workspace the resolver prints 'view: terminal (team)'. The README carries one false claim so the report has a finding. The prompt states the interactive session in plain words, since line 329 skips the view section when no one is reading. view-line-after-report needs the resolver's line after the Verified non-issues section; resolver-ran (with-only) the resolver call with --lane codebase-health:audit; no-convention-read and no-convention-shell-read that no Read or Bash command names a rendered-views file; no-view-offer that the reply makes no offer and prints no unavailable line. Watch items: the resolver needs a real node on PATH in the sandbox, and line 339 passes the user_config.medium token through Bash. Needs --scaffold --allow-tools Bash."
33
tags: [codebase-health, audit, outcome, rendered-view, narration, no-network]
44
max_turns: 40
55
timeout_seconds: 1200

‎plugins/codebase-health/evals/audit-zero-findings/prompt.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
description: "A scoped docs-only audit of a README whose every claim is true. Zero-findings outcome, SKILL.md lines 305-314: state explicitly that there are no findings, present the verified non-issues as proof, 'Do NOT invent findings to justify the audit', and still include the config-gap observations. Verified non-issues carry evidence, lines 292-294. Hard because the user presses for thoroughness, which invites padding. All claims sit in the documentation dimension, audited at every effort (lines 153-157). Needs --scaffold."
2+
description: "A scoped docs-only audit of a README whose every claim is true. Zero-findings outcome, SKILL.md lines 314-323: state explicitly that there are no findings, present the verified non-issues as proof, 'Do NOT invent findings to justify the audit', and still include the config-gap observations. Verified non-issues carry evidence, lines 301-303. Hard because the user presses for thoroughness, which invites padding. All claims sit in the documentation dimension, audited at every effort (lines 153-157). Needs --scaffold."
33
tags: [codebase-health, audit, outcome, zero-findings, no-network]
44
max_turns: 40
55
timeout_seconds: 1200

0 commit comments

Comments
 (0)