Skip to content

feat(claude): rules and hints from the background-session audit - #14

Draft
CosmDandy wants to merge 1 commit into
mainfrom
feat/session-audit-hints
Draft

feat(claude): rules and hints from the background-session audit#14
CosmDandy wants to merge 1 commit into
mainfrom
feat/session-audit-hints

Conversation

@CosmDandy

Copy link
Copy Markdown
Owner

Source: audit of six autonomous sessions on kvt-cosmdandy-dev (2026-09-02..08); report at ~/.claude/reports/2026-09-08-kvt-session-audit.md locally.

CLAUDE.md — one line per loss pattern

  • Code: edits through Edit/Write, heredocs only for new scripts in $CLAUDE_JOB_DIR/tmp (36 of 50 harness rejections, a third of context)
  • Definition of done: numeric check before the screenshot loop; thresholds from a median of 3+ runs
  • Tools: one wait per background task, kill by PID; stop what you started
  • Agents: references and unfamiliar code read once by a subagent; review per finished part
  • DELEGATED: foreign task to a new session; gh pr create after push

Hooks

  • posttooluse-bashhint.sh: hint on the worktree-isolation rejection ("too complex to verify") with a per-session repeat counter; hint on a push whose output says the branch has no PR
  • precompact-snapshot.sh: append what the transcript tail already read and ran, so the summary stops losing it
  • new posttooluse-bashhint.test.sh (9 cases)

Checks

shellcheck clean; bashhint 9/9; pretooluse-guard 187/0; session-lifecycle 25/0; precompact smoke-tested on a synthetic transcript.

Unverified: whether the harness routes its own worktree rejection through PostToolUseFailure (the hook is registered there); if it does not, the first hint never fires and only the CLAUDE.md line applies.

Eight CLAUDE.md lines, one per loss pattern found across six autonomous
sessions: edits through Edit/Write instead of heredocs, a numeric check
before the screenshot loop, thresholds from a median, one wait per
background task, stop what you started, references read once by a
subagent, review per finished part, foreign tasks to a new session,
gh pr create after push.
bashhint: hint on the worktree-isolation rejection with a per-session
repeat counter, and on a push whose output shows the branch has no PR.
precompact: append what the transcript tail already read and ran, so
the summary stops losing it.
Sign up for freeto 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

@CosmDandy