Skip to content

feat(codelayer): add per-subagent tool/prompt overrides to coding subagent tool - #48

Open
dexhorthy wants to merge 1 commit into
mainfrom
inject-system-context-in-post-tool-use-hook
Open

feat(codelayer): add per-subagent tool/prompt overrides to coding subagent tool#48
dexhorthy wants to merge 1 commit into
mainfrom
inject-system-context-in-post-tool-use-hook

Conversation

@dexhorthy

Copy link
Copy Markdown
Contributor

Summary

Adds a generic per-subagent override surface to the CodeLayer coding subagent tool, letting a consumer grant specific named subagents extra tools and system-prompt instructions without forking the whole subagent tool.

What changed

  • New exported interface CodingSubagentOverride { additionalTools?: Record<string, Tool>; systemPromptAdditions?: string[] }.
  • New subagentOverrides?: Record<string, CodingSubagentOverride> option on createCodingSubagentTool / createCodelayerAgent, keyed by subagent name.
  • Added an applyOverride(name, tools, system) helper that merges any extra tools and appends system-prompt additions for the named subagent; all subagent construction sites now route through it.
  • Threaded the option through agent.ts (CodelayerAgentOptions.subagentOverrides) and re-exported the new types from index.ts.

Why

The riptide daemon needs to grant specific research subagents an extra cwd-bound write tool plus prompt instructions so they persist their findings durably to disk. This override surface makes that possible generically at the library level, rather than baking a research-specific behavior into the shared subagent tool.

Test plan

  • 3 new unit tests in agents/codelayer/test/coding-subagent-tool.test.ts covering:
    • extra tools + prompt additions are merged for the targeted subagent
    • non-target subagents are left unaffected (isolation)
    • no-op behavior when no overrides are supplied

🤖 Generated with Claude Code

@github-actions

github-actions Bot commented Jul 7, 2026

Copy link
Copy Markdown

Docs Agent Review

Agent finished with reason: error


To apply these recommendations, comment: @docs-agent apply

@dexhorthy
dexhorthy force-pushed the inject-system-context-in-post-tool-use-hook branch from a98f39c to 3f2bd6a Compare July 8, 2026 00:41
…coding subagent tool

Adds a builder-style Agent.withOverrides(overrides) that returns a new
immutable Agent with extra tools merged and system-prompt strings appended.
The parameter is required (callers pass `subagentOverrides[name] ?? {}`), so
the method body narrows cleanly; an empty override returns `this` to avoid a
pointless clone. The core AgentOverrides shape ({ tools?, system? }) is
exported and used directly.

createCodingSubagentTool gains a subagentOverrides map keyed by subagent
name; each subagent builder chains .withOverrides(overrides[name] ?? {})
inline, so callers can grant a specific subagent extra tools + guidance
without replacing the whole subagent tool.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@dexhorthy
dexhorthy force-pushed the inject-system-context-in-post-tool-use-hook branch from 3f2bd6a to d10ba68 Compare July 8, 2026 00:46
Sign up for free to 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