fix: remove TaskCreate mode-check hook that contradicts admiral exception (#112)#116
Merged
Merged
Conversation
…tion (#112) The PreToolUse hook on TaskCreate blanket-rejected the call whenever mode was not agent-team. The hook payload provides no field to distinguish the admiral from a captain, so the admiral itself was blocked from creating its own Ctrl+T visibility task list in subagents mode — directly contradicting the documented admiral exception in references/tool-mapping.md and references/standing-orders/wrong-ensign.md. Relax the hook: drop the over-enforcement, keep the admiral exception, and rely on the SKILL.md convention for captain discipline (captain TaskCreate in an isolated subagent context is harmless — its task list never reaches the admiral's Ctrl+T view). - Remove the TaskCreate matcher from hooks/hooks.json - Delete cmd_mode_check, its subparser, dispatch entry, and docstring line from hooks/nelson_hooks.py - Delete TestModeCheck and the cmd_mode_check import from hooks/test_nelson_hooks.py - Update the README enforcement-hooks table to drop the removed row settings.json is left untouched: its Agent|TeamCreate|TaskCreate matcher runs nelson-phase.py validate-tool, not nelson_hooks.py mode-check, and is out of scope.
7 tasks
harrymunro
added a commit
that referenced
this pull request
May 8, 2026
…on marker PR #116 removed the PreToolUse:TaskCreate mode-check hook because it blanket-rejected the admiral's own Ctrl+T visibility tracking. This reinstates enforcement properly by discriminating admiral from captain via the hook payload's transcript_path (each subagent gets its own). - session-init (SessionStart): records admiral transcript_path to .nelson/admiral.session - session-check (PreToolUse:TaskCreate): rejects with wrong-ensign only when mode is subagents/single-session and the payload transcript_path does not match the recorded admiral marker - preflight: opportunistically backfills the marker if init ran after SessionStart fired - stand-down: best-effort marker cleanup - All paths fail-open on uncertainty (missing marker, empty transcript, no mission), so non-Nelson projects and edge cases are unaffected
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
PreToolUse:TaskCreatemode-checkhook that blanket-rejectedTaskCreatewhenever mode ≠agent-team, blocking the admiral from creating its own Ctrl+T visibility task list insubagentsmode (the dominant Nelson mode).references/tool-mapping.mdandreferences/standing-orders/wrong-ensign.md. Result: a hook directly contradicting the docs, as reported in Bug: PreToolUse:TaskCreate hook and tool-mapping.md at odds #112.TaskCreatein an isolated subagent context never reaches the admiral's Ctrl+T view, so misuse is harmless).Changes
hooks/hooks.json— drop theTaskCreatematcher block.hooks/nelson_hooks.py— deletecmd_mode_check, its subparser, its dispatch entry, and themode-checkline from the module docstring.hooks/test_nelson_hooks.py— delete theTestModeCheckclass and thecmd_mode_checkimport; update the docstring.README.md— drop the now-stale row from the enforcement-hooks table.settings.jsonis intentionally left untouched: itsAgent|TeamCreate|TaskCreatematcher invokesnelson-phase.py validate-tool, notnelson_hooks.py mode-check, and is out of scope.Out of scope
TaskCreatein an isolated subagent context is harmless; SKILL.md guidance is sufficient.Test plan
pytest hooks/test_nelson_hooks.py -q— 48 passed (was 52; 4TestModeCheckcases removed)pytest skills/nelson/scripts -q— 278 passed (no regression)bash scripts/check-references.sh— OK, no broken cross-refsecho '{...}' | python3 hooks/nelson_hooks.py mode-checknow exits withinvalid choice: 'mode-check'(dispatch entry confirmed gone)subagents-mode mission, confirm the admiral canTaskCreatefor visibility without surfacingStanding order violation (wrong-ensign)Closes #112.