Expand description
Merging the steering hook into a Claude Code settings file. The merge runs
through the comment- and layout-preserving ct-patch engine
(crate::patch): the existing file is parsed only to decide which edits
to make, and those edits are byte-range splices against the original text,
so the user’s comments and formatting survive.
Enums§
- Scope
- Which settings file the hook is written to.
- Tool
- A harness tool the steering hook can be installed to gate. Each becomes
its own
PreToolUsematcher entry;Bashis the default.
Functions§
- hook_
command - The
PreToolUsehook command written into settings, built onhead— the invocation prefix,"ct steer hook"by default or a pinned"<abs-path> hook"(see--pin). Tool-call logging is on by default (to.ct/tclog/), so the bare command already logs;no_log/log_dirbake in the logging override, andnudge_pipelinesbakes in--nudge-pipelines. - install
- Install the steering hook into
existingsettings text (or create a fresh document), gating each tool intools. Returns the new text and whether it changed. Idempotent: re-installing the same command/tools is a no-op; a--modechange rewrites the command in place; a new tool adds its matcher. Comments and layout inexistingare preserved. - install_
post - Install the
PostToolUserecorder (--measure) as a single*matcher runningcommand, so every executed call is logged for effectiveness analysis. Idempotent, comment-preserving, and independent of thePreToolUsesteering hook. - post_
command - The
PostToolUsecommand written into settings by--measure(records each executed call), built onhead("ct steer post"or a pinned form). - uninstall
- Remove every steering hook (
PreToolUsesteer andPostToolUserecorder) fromexistingsettings text, pruning emptied matcher entries and thehookscontainers when they end up empty. Comments and layout elsewhere are preserved.