spawned-directive.ts
Shared helper holding the directive text for the AskUserQuestion hooks in spawned sessions, so the two hooks give the same instructions.
- Kind
- Hook
- Works with
- Claude Code
- Languages
- TypeScript / JavaScript
- Source
- garrytan/gstack @ 01593aa67c94
- Path
- hosts/claude/hooks/spawned-directive.ts
- License
- MIT
- Jobs
- Guardrails
InstallCopy it from the source repository, or sign in and let the assistant adapt it for your project.
/** * Shared spawned-session directive text for the AUQ hooks (#2733). * * Hook processes inherit the HARNESS env, so a per-command * `GSTACK_SESSION_KIND=spawned` prefix inside a subagent's bash call can * never reach a hook — the only levers a hook has for the subagent case are * (a) env-level markers that ARE session-wide (OPENCLAW_SESSION, or a harness * launched with GSTACK_SESSION_KIND in its env) and (b) directive TEXT the * model reads. Both AUQ hooks (question-preference PreToolUse deny, * auq-error-fallback PostToolUse directive) carry the same escape sentence; * it lives here as one constant so the two paths can never drift into * contradictory instructions. * * Destructive semantics are unified across every spawned surface (dispatch * prompt, spawned-session block, AUQ prose rule, both hooks): * conservative-continue, never prose-STOP — a prose brief with no reader is * always wrong in a spawned session, and the conservative choice guarantees * nothing irreversible happens. */ /** Appended to prose-directing hook texts so a marked subagent that slips * and calls AUQ still resolves to auto-choose instead of prose-STOP. */ …