fix(hooks): inject condensed fallback instructions on SubagentStart#634
Open
Vrindakr3300 wants to merge 2 commits into
Open
fix(hooks): inject condensed fallback instructions on SubagentStart#634Vrindakr3300 wants to merge 2 commits into
Vrindakr3300 wants to merge 2 commits into
Conversation
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
This PR resolves the subagent token overhead issue by switching the
SubagentStarthook payload from the full mode-filteredSKILL.md(getPonytailInstructions) to the condensed fallback ruleset or independent mode pointer line.Why
The full instruction set contains comparison tables and slash-command directions designed for human session configuration. Subagent workers spawned for one-off tasks do not need these examples or controls.
By switching to the condensed instructions, we reduce the injected payload per subagent spawn by ~49% (saving roughly 600+ tokens per subagent) without losing any of the operational rules (the ladder, formatting, and boundary rules).
Furthermore, if the session is currently in an independent mode such as
review, we preserve the specific pointer line (PONYTAIL MODE ACTIVE — level: review. Behavior defined by /ponytail-review skill.) instead of using the generic developer fallback rules.Changes
hooks/ponytail-instructions.js: Created and exported thegetSubagentInstructions(mode)helper, which checks if the mode is independent (e.g.review) to output the pointer line, falling back togetFallbackInstructionsotherwise.hooks/ponytail-subagent.js: Replaced import and invocation ofgetPonytailInstructionswithgetSubagentInstructions.tests/hooks.test.js:IntensityorExamplesections, while keeping the regex matcher logic untouched.reviewmode pointer line is correctly preserved when running the subagent hook inreviewmode.Closes #597
Refs #502