Skip to content

refactor(markdown-format,typos-format): trim model-coaching prose from injected hook reports - #2055

Merged
kyle-sexton merged 2 commits into
mainfrom
refactor/formatter-coaching-trim
Aug 9, 2026
Merged

kyle-sexton merged 2 commits into
mainfrom
refactor/formatter-coaching-trim

Conversation

@kyle-sexton

@kyle-sexton kyle-sexton commented Aug 8, 2026 •

Copy link
Copy Markdown
Member

No linked issue

Summary

Executes issue #2021's remediation line (3): trims the model-conduct coaching prose from the two formatter plugins that classification pass marked as hybrids — markdown-format and typos-format. Facts the tools measured (findings, counts, applied rewrites, file names) stay; sentences that instruct the model how to behave are removed or shortened. The classification's keep-list is untouched: the deterministic transforms, the lint/typo finding relays, both-channel mutation disclosure, and markdown-format's fail-closed code-execution trust gate on .cjs/.mjs configs.

Fix

markdown-format 0.10.0 → 0.10.1 (hooks/markdown-format.sh):

  • Delta-gate repeat line drops the "a rule firing in bulk here (a house style markdownlint does not know about) is configured away once in this repository's markdownlint config, not re-read every edit" lecture; the fact stays ("Unchanged from the previous run on this file; per-finding detail omitted.").
  • Truncation hint "… more finding(s), omitted to bound context. Raise markdown_format_max_findings to see them, or configure the dominant rule in this repository's markdownlint config." shrinks to "… more finding(s) (cap: markdown_format_max_findings)." — the count and a terse config pointer, no instruction.

typos-format 0.5.1 → 0.5.2 (hooks/typos-format.sh):

  • The per-finding remediation tail ("— if intentional, add it to extend-words / extend-identifiers … in your typos config"), formerly repeated on every residual finding line (up to 10× per report), is replaced by finding facts only plus ONE trailing pointer line for the whole list.
  • The applied-path (write-mode) disclosure paragraph is cut roughly in half: keeps the facts (built-in dictionary source, no-memory re-correction, allow-list route — the test-pinned disclosure deliverable), drops the exemplifying lecture.
  • The report-only header drops its option-explainer parenthetical ("(typos_format_write_changes is off — the shipped default)"); the report-only statement and "NOT modified" fact stay.

Both plugin.json versions bumped patch with matching CHANGELOG entries. Patch is correct per the current official manifest reference: version is "Optional. Semantic version. Setting this pins the plugin to that version string, so users only receive updates when you bump it", and "If you use explicit versions, follow semantic versioning (MAJOR.MINOR.PATCH) … Document changes in a CHANGELOG.md" (https://code.claude.com/docs/en/plugins-reference, fetched 2026-08-08).

Verification

  • bash plugins/typos-format/hooks/typos-format.test.sh — PASS=79 FAIL=2; the two failures are wall-clock performance assertions (stub/scale / stub/scale-residual, 15s handler-budget checks) that fail identically on an unmodified checkout of main on the same machine (65s/60s baseline vs 59s/75s here) — pre-existing environment-speed failures, not introduced by this change. Every content assertion passes, including the ones pinning kept strings: extend-words remediation present on both the applied and residual paths, report-only + NOT modified mode statement, applied-rewrite disclosure on both channels.
  • bash plugins/markdown-format/hooks/markdown-format.test.sh — locally PASS=129 FAIL=1; the single failure is telemetry/slow-sink, a wall-clock fd1-leak detector whose measured delta varied 5269ms → 12118ms across two local runs (threshold-based timing assertion). The measured path is byte-identical to main — hooks/hook-utils.sh and the test file are unchanged, and the diff touches only two CTX string literals in the report composer. All string-pinning assertions pass, including Unchanged from the previous run and the and N more finding remainder count the trimmed strings still carry.
  • CI is the authoritative run: the plugin-gate lane executes every plugins/**/*.test.sh (both suites, timing assertions included) on ubuntu-24.04 and passes on this PR — the local failures above are Windows machine-speed artifacts.
  • shellcheck -x and shfmt -d clean on both edited hooks.
  • node scripts/generate-catalog.mjs / node scripts/generate-cheatsheet.mjs: both already in sync, no diff, nothing to commit.

Related

🤖 Generated with Claude Code

…m injected hook reports

Issue #2021's hook-surface classification marked both formatter plugins
hybrids whose only ablatable surface is injected conduct-coaching prose
(remediation line 3). This trims exactly that surface:

markdown-format 0.10.0 -> 0.10.1:
- delta-gate repeat line drops its configure-it-away lecture; the
  unchanged-from-previous-run fact stays
- truncation hint shrinks to a terse (cap: markdown_format_max_findings)
  pointer

typos-format 0.5.1 -> 0.5.2:
- per-finding "if intentional, add it to extend-words..." tail (repeated
  up to 10x per report) replaced by facts-only finding lines plus one
  trailing pointer for the whole list
- applied-path disclosure keeps its facts (dictionary source, no-memory
  re-correction, allow-list route) at roughly half the length
- report-only header drops the option-explainer parenthetical

Kept intact per the classification: the deterministic transforms, the
finding relays, both-channel mutation disclosure, and markdown-format's
fail-closed code-execution trust gate on .cjs/.mjs configs.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@cursor

cursor Bot commented Aug 8, 2026

Copy link
Copy Markdown

Bugbot is not enabled for your account, so this pull request was not reviewed.

Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs.

@claude

claude Bot commented Aug 8, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @kyle-sexton's task in 1m 0s —— View job


Security review: no issues found

  • Gather context (PR diff, changed files)
  • Review changed files for security issues
  • Post findings

Scope reviewed (via git show 8bf8a11 — the PR's single commit): plugins/markdown-format/hooks/markdown-format.sh, plugins/typos-format/hooks/typos-format.sh, both plugin.json manifests, both CHANGELOG.md files.

Findings: none. This PR is a pure prose-trim of hardcoded string literals injected into hook reports (CTX/SYSMSG composition). Specifically:

  • No control-flow, conditional, or gating logic changed — every edit is inside an existing branch (SAME_AS_LAST, FINDING_COUNT > shown, WRITE_CHANGES checks, RESIDUAL_COUNT > 0) whose condition and behavior are untouched.
  • No new interpolation of external/attacker-influenced data into these strings — the token/filename interpolation via jq (e.g. \(tok), \(corr1), line \(.line_num // 0)) already existed before this diff on the untouched lines; the shortened text only removes trailing lecture prose after those existing interpolations.
  • markdown-format's fail-closed code-execution trust gate on .cjs/.mjs configs is outside the diff's line ranges and confirmed unmodified.
  • No changes to permissions, hook wiring, .mcp.json, dependency pins, or CI workflows — this PR touches no .github/workflows/* files.
  • plugin.json changes are version-string bumps only (0.10.0→0.10.1, 0.5.1→0.5.2); CHANGELOG.md changes are documentation only.

No injection surfaces, authorization gaps, secret handling, or supply-chain risk in this diff.

Branch: refactor/formatter-coaching-trim

@claude

claude Bot commented Aug 8, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @kyle-sexton's task in 2m 50s —— View job


Review complete

  • Gather context (PR description, diff, CLAUDE.md/AGENTS.md rules)
  • Review plugins/markdown-format/hooks/markdown-format.sh diff
  • Review plugins/typos-format/hooks/typos-format.sh diff
  • Cross-check trimmed strings against each plugin's test suite's pinned assertions (static)
  • Check plugin.json version bumps + CHANGELOG entries
  • Check repo-wide for stale references to the removed prose
  • Post final review

Overall: clean, well-scoped mechanical trim. The two hook diffs do exactly what the description claims — remove instructional/coaching clauses while keeping every fact (counts, file names, mode statements, allow-list mechanism names). Nothing in this diff touches the deterministic transforms, the finding relays, the both-channel mutation disclosure, or markdown-format's .cjs/.mjs trust gate, matching the classification's keep-list from #2021.

Checks I ran myself:

  • Read the full commit diff (git show HEAD) rather than relying on the PR description.
  • Grepped both plugins' test files (markdown-format.test.sh, typos-format.test.sh) for every string literal touched by this diff. All pinned assertions still match the new text:
    • and 30 more finding (markdown-format.test.sh:1612) is still a substring of the new ... and N more finding(s) (cap: markdown_format_max_findings). line.
    • Unchanged from the previous run (markdown-format.test.sh:1804) is preserved verbatim.
    • extend-words on the applied path (typos-format.test.sh:283-286) is still present in the trimmed applied-path fact paragraph at typos-format.sh#L401.
    • extend-words|extend-identifiers|extend-ignore-re on the residual-only path (typos-format.test.sh:673) is still present via the new single trailing pointer at typos-format.sh#L424 — I traced the control flow (lines 397-425) to confirm that pointer fires whenever RESIDUAL_COUNT > 0, independent of the applied/report-only/write-mode branch, so it still covers the report-only-with-residual-only case the test exercises.
    • report-only + NOT modified (typos-format.test.sh:328) both survive the header trim.
  • Confirmed bash -n isn't available to me in this sandbox (every bash <script> invocation, including syntax checks and the test suites, hit a permission wall requiring approval I can't grant here) — so I could not independently execute the test suites, shellcheck, or shfmt. The PR body's test-run and lint numbers are author-claimed and unverified by me; treat them as such until CI confirms.
  • Grepped the repo for any other file quoting the removed strings verbatim (docs, READMEs) — none found, so no stale documentation left behind.
  • Confirmed both plugin.json version bumps (0.10.0→0.10.1, 0.5.1→0.5.2) are patch-level, consistent with the official manifest guidance the PR cites, and that both CHANGELOG entries have matching version headers and accurately describe the diff.
  • Confirmed the PR body satisfies the repo's PR-linkage contract (No linked issue literal line + non-empty ## Related section referencing Hook-surface classification: 44 wired hooks classified policy vs behavioral (report-only) #2021).

Two minor style nits (left as inline comments, neither blocking):

  1. typos-format.sh#L348-350 — the two residual-finding wordings now punctuate slightly differently (colon vs. none) after the trim.
  2. typos-format.sh#L424 — "the repo's typos config" (new residual pointer, also used at L401) vs. "your typos config" (still-live SYSMSG line at L408) — a small phrasing split across three near-duplicate remediation pointers in the same file.

No correctness, architecture, error-handling, or test-coverage issues found. Security is out of scope for this lane per REVIEW.md.
· branch refactor/formatter-coaching-trim

@github-actions

github-actions Bot commented Aug 8, 2026 •

Copy link
Copy Markdown
Contributor

Claude has reviewed this PR 2 times. The lane skips further automatic reviews after 5; deleting this comment resets the count.

…g-pointer phrasing

Review follow-ups on #2055: the disallowed branch drops its colon
separator to match the "should be" branch's parenthetical-then-period
form, and the SYSMSG remediation pointer says "the repo's typos config"
like the other two pointers instead of "your typos config".

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@claude

claude Bot commented Aug 9, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @kyle-sexton's task in 1m 9s —— View job


Security review: no issues found

  • Gather context (gh pr diff, read changed files)
  • Review changed files for security issues
  • Post findings

Scope reviewed (full cumulative diff, both commits, origin/main...HEAD via gh pr diff 2055): plugins/markdown-format/hooks/markdown-format.sh, plugins/typos-format/hooks/typos-format.sh, both plugin.json manifests, both CHANGELOG.md files.

Findings: none.

Every hunk in this diff replaces a hardcoded string literal that is concatenated into CTX/SYSMSG (the hook's agent-channel and user-channel report text) or into a jq map(...) template string. I traced each edit against the existing interpolation points rather than trusting the description:

  • markdown-format.sh#L954 and #L964 — pure literal-text shortening; no variable interpolation added on either line.
  • typos-format.sh#L347-350 — only the trailing remediation clause (after the existing \(tok)/\(corr1)/.line_num jq interpolations) is trimmed; the interpolation points themselves are unchanged lines from before this PR, so no new injection surface into the jq template.
  • typos-format.sh#L401, #L409, #L411, and the new #L424-425 — all pure literal text; $BASE (line 411, 396) is a pre-existing, unmodified interpolation (basename "$FILE", already quoted/used identically before this PR) and is outside this diff's changed surface.

No control-flow, conditional, or gating logic changed anywhere in either script — every edit sits inside an existing branch (SAME_AS_LAST, FINDING_COUNT > shown, APPLIED_COUNT > 0, WRITE_CHANGES checks, RESIDUAL_COUNT > 0) whose condition and behavior are untouched. markdown-format's fail-closed code-execution trust gate on .cjs/.mjs configs is outside the diff's line ranges and unmodified. No changes to permissions, hook wiring, .mcp.json, dependency pins, or .github/workflows/*. plugin.json changes are version-string bumps only (0.10.0→0.10.1, 0.5.1→0.5.2); CHANGELOG.md changes are documentation only.

No injection surfaces (command/path/template), authorization gaps, secret/token handling, or supply-chain risk in this diff. This is a mechanical prose trim with no data-flow or trust-boundary changes.

Branch: refactor/formatter-coaching-trim

@claude

claude Bot commented Aug 9, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @kyle-sexton's task in 2m 1s —— View job


Review complete

  • Gather context (PR diff via gh pr diff, both commits' history)
  • Review plugins/markdown-format/hooks/markdown-format.sh diff
  • Review plugins/typos-format/hooks/typos-format.sh diff
  • Review plugin.json / CHANGELOG updates
  • Cross-check against CLAUDE.md/AGENTS.md/REVIEW.md guidelines
  • Post final review

Overall: no blocking issues. This is a clean, mechanical prose trim that does exactly what it claims. Both hook diffs remove instruction/coaching clauses while keeping every measured fact (counts, mode statements, config-pointer mechanism names); no control-flow, branch condition, or interpolation changed.

Notable: the second commit already resolves the prior review's two nits. Commit a52900e (pushed after the earlier review pass) fixed both punctuation inconsistency (typos-format.sh#L347, disallowed-branch now matches the "should be" branch's parenthetical-then-period form) and the "your" vs. "repo's" config-pointer phrasing split (typos-format.sh#L409, now consistent with the other two pointers). I re-diffed both spots and confirm they now read identically in style across all three remediation pointers in the file.

Verification I ran myself (not author-claimed):

  • gh pr diff 2055 — read the actual cumulative diff directly, not the PR description's prose summary.
  • Traced typos-format.sh control flow at L395-426: the new single trailing residual-block pointer (L424-425) fires whenever RESIDUAL_COUNT > 0 regardless of applied/report-only/write-mode branch, so it covers all three header paths that precede it.
  • Grepped markdown-format.test.sh and typos-format.test.sh for every string literal touched by this diff — confirmed and 30 more finding (L1612) and Unchanged from the previous run (L1804) survive in markdown-format's test file; extend-words/extend-identifiers/extend-ignore-re (L283, L673), report-only + NOT modified (L328) all survive in typos-format's test file.
  • Read both full CHANGELOG.md diffs — ## [X.Y.Z] header format (no date) matches every prior entry in each file, and scripts/check-changelog-parity.sh's documented contract (bracketed version header must be new vs. the prior ref) is satisfied by both bumps (0.10.0→0.10.1, 0.5.1→0.5.2 — both correctly PATCH per the manifest reference the PR body cites).
  • Confirmed via mcp__github_ci__get_ci_status that the ci workflow run (31300487764) — which runs the full plugin-gate test lane including both edited plugins' *.test.sh suites — completed with conclusion success on this HEAD SHA. This independently corroborates the PR body's author-claimed local test results; I did not execute the test suites or shellcheck/shfmt myself (every bash <script>/shellcheck invocation in this sandbox requires an approval I cannot grant here), so treat only the CI-passing fact as independently verified, not the specific PASS/FAIL counts quoted in the PR body.

Scope discipline: matches CLAUDE.md's fresh-docs mandate correctly — this diff touches only report-string prose inside existing hook logic, not a manifest schema/hook-contract surface, so the fresh-docs WebFetch requirement doesn't apply here; the PR body's manifest-versioning citation was for the plugin.json version-bump justification specifically, which is the one piece of this diff that is in that mandate's scope, and it's correctly sourced with a URL and fetch date.

No architecture, error-handling, test-coverage, or maintainability issues found in the current diff state (both prior inline nits are resolved). Security is out of scope for this lane per the repo's lane split.
· branch refactor/formatter-coaching-trim

@kyle-sexton

Copy link
Copy Markdown
Member Author

Both findings fixed in a52900e: the residual-line branches now share one punctuation form ("is disallowed, no known correction.") and all three remediation pointers say "the repo's typos config". Scoped verification: string-only edits inside typos-format.sh; the typos-format suite passed and CI is green on the commit.

@kyle-sexton
kyle-sexton merged commit 141dbc5 into main Aug 9, 2026
1 check passed
@kyle-sexton
kyle-sexton deleted the refactor/formatter-coaching-trim branch August 9, 2026 07:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant