Skip to content

docs(claude-code-hooks): #30/#31 — task-notification-as-prompt + kind-scoped staleness tracker - #283

Merged
daymade merged 1 commit into
mainfrom
docs/hooks-pitfalls-30-31-task-notification-and-kind-tracker
Aug 12, 2026
Merged

docs(claude-code-hooks): #30/#31 — task-notification-as-prompt + kind-scoped staleness tracker#283
daymade merged 1 commit into
mainfrom
docs/hooks-pitfalls-30-31-task-notification-and-kind-tracker

Conversation

@daymade

@daymade daymade commented Aug 12, 2026

Copy link
Copy Markdown
Owner

Summary

  • claude-code-hooks (daymade-claude-code v1.42.0 → v1.43.0): two new pitfall entries in references/hook_pitfalls.md, folded in from live incidental discoveries on a private hooks repo this session (not synthesized on request):
    • Add qr-bridge skill: QR code decoding & link tracing #30UserPromptSubmit fires on a background subagent's own task-notification arriving, not just on a human keystroke; the transcript JSONL distinguishes the two internally (origin.kind: "human" vs "task-notification") but that metadata never reaches the hook's stdin. SKILL.md's pre-existing "UserPromptSubmit only ever sees user input" claim gets a precise footnote (not a rewrite) pointing at the exception.
    • [Add] AuraKit — Sonnet Amplified fullstack engine #31 — a compounding-artifact staleness tracker keyed on file kind re-flags files nobody touched this round, and a written justification can't clear it because the mechanism only compares timestamps against a kind, never reads prose.
  • An independent fresh-context review (re-derived the evidentiary claims from primary sources rather than trusting the draft) confirmed every specific factual claim, but caught and this PR fixes two real bugs in Add qr-bridge skill: QR code decoding & link tracing #30's prescribed Fix before merge:
    • the gate condition required promptSource == "typed", which silently rejects genuine human input arriving mid-turn (promptSource: "queued") — fixed to gate on origin.kind alone.
    • the fix told readers to look up prompt_id in the transcript JSONL — that string occurs 0 times there; the field is promptId (camelCase) in the transcript, vs prompt_id (snake_case) in the hook's own stdin JSON.
  • quick_validate + full regression audit (compare/classify/verify against the pre-session baseline) + security_scan all pass. All CI checks green.
  • Independent-review.md persisted to the private PKM knowledge repo (skill-reviews/claude-code-hooks/), per skill-creator discipline Add Trail of Bits Security Skills to Related Resources #5 — the review happened and survives past this conversation.

Resolved: branch no longer carries unrelated content

An earlier revision of this branch briefly carried a second, unrelated, already-staged piece of work found sitting in a shared checkout's index when the branch was created (the macos-watchdog v1.0.0 skill release, from a concurrent session). That has since been split out to its own branch/commit/PR — #284 — and this branch was force-pushed to drop it. This PR now contains only the claude-code-hooks content described above, which I've reviewed and verified myself. PR #284 remains unmerged and is explicitly flagged there as not reviewed by me.

Test plan

  • quick_validate on daymade-claude-code/claude-code-hooks — passed
  • audit_skill_regression compare/classify/verify against git-ref:1c71e5437f79f61e664a5613829984583cd7d9e0 — 1 pre-existing candidate, classified preserved_or_moved, verify passed
  • security_scan — passed, marker refreshed
  • Independent fresh-context review of both new pitfalls + the SKILL.md footnote — findings applied and independently re-verified (see commit message for detail)
  • Manual PII pass on new content — no absolute paths, names, session IDs, or secrets
  • CI: all 4 checks green (marketplace/shell-syntax lint, skill validation, test suites, secret scan)
  • Unrelated swept-in content split out to its own PR (feat(macos-watchdog): new skill v1.0.0 — design/deploy/discipline launchd watchdogs #284), branch now scoped to this change only

🤖 Generated with Claude Code

https://claude.ai/code/session_01CudYBXrK5WyCiKoB2ugbAx

…ped staleness tracker

New pitfalls folded in from live incidental discoveries on a private hooks
repo this session (per user's explicit "沉淀本 session 的新发现" scope), not
synthesized on request:

#30 — a UserPromptSubmit hook fired on a background subagent's own
task-notification arriving, not on any human keystroke; the transcript JSONL
distinguishes the two internally (origin.kind: "human" vs "task-notification")
but that metadata never reaches the hook's stdin (verified against the live
official docs: session_id/transcript_path/cwd/permission_mode/hook_event_name/
prompt_id/prompt, nothing more). SKILL.md's pre-existing "UserPromptSubmit
only ever sees user input" claim gets a precise footnote, not a rewrite — the
core argument (can't see the model's own current-turn output) still holds.

#31 — a compounding-artifact staleness tracker keyed on file *kind* re-flags
files nobody touched this round, and a written justification can't clear it
because the mechanism only compares timestamps against a kind, never reads
the justification prose.

An independent fresh-context review (dispatched to re-derive, not just read,
the three evidentiary claims from primary sources — official docs via its own
WebFetch, transcript shape via its own JSONL parse, tracker ledger via its own
file read) found every specific factual claim accurate, but caught two real
bugs in #30's prescribed Fix before merge, both independently re-verified
here before applying:

- the gate condition required promptSource == "typed" in addition to
  origin.kind == "human", which silently rejects genuine human input arriving
  mid-turn (promptSource: "queued") — confirmed against a real message in
  this session's own transcript; fixed to gate on origin.kind alone.
- the fix told readers to look up prompt_id in the transcript JSONL — that
  literal string occurs 0 times across 1745 records; the field is promptId
  there (camelCase), while the hook's own stdin JSON carries prompt_id
  (snake_case) — the same twin-blind-spot shape pitfall #20 already warns
  about on a different field pair.

quick_validate passed; full regression audit (compare/classify/verify)
passed against the pre-session git-ref baseline, 1 pre-existing candidate
(the SKILL.md sentence split), reviewed as preserved_or_moved; security_scan
passed, marker refreshed. Manual PII pass on the new content: no absolute
paths, no names, no session IDs, no secrets. Independent-review.md persisted
to the private PKM knowledge repo (skill-reviews/claude-code-hooks/), per
skill-creator discipline #5.

daymade-claude-code suite bumped 1.42.0 -> 1.43.0 in marketplace.json.

(A second, unrelated piece of work — the macos-watchdog v1.0.0 skill release
— was previously bundled into this branch as a parallel-session sweep-in from
a shared checkout. It has been split out to its own branch/commit/PR
(feat/macos-watchdog, PR #284), unreviewed by me, so this PR now contains
only content I've verified.)

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CudYBXrK5WyCiKoB2ugbAx
@daymade
daymade force-pushed the docs/hooks-pitfalls-30-31-task-notification-and-kind-tracker branch from 75dd541 to 405dc91 Compare August 12, 2026 03:59
@daymade
daymade merged commit 9215851 into main Aug 12, 2026
4 checks passed
@daymade
daymade deleted the docs/hooks-pitfalls-30-31-task-notification-and-kind-tracker branch August 12, 2026 04:02
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