feat: add working_dir parameter to spawn tool for project-specific subagents#1935
Open
GodGMN wants to merge 2 commits intoHKUDS:mainfrom
Open
feat: add working_dir parameter to spawn tool for project-specific subagents#1935GodGMN wants to merge 2 commits intoHKUDS:mainfrom
GodGMN wants to merge 2 commits intoHKUDS:mainfrom
Conversation
Add a working_dir parameter to spawn so subagents can operate in a specific directory instead of always using the root workspace. When a working_dir is provided, file tools, exec, and the system prompt all use that path. Skills and AGENTS.md are loaded from the target directory as well.
This was referenced Mar 14, 2026
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
Adds a
working_dirparameter to thespawntool, allowing subagents to operate in specific project directories and automatically inherit project conventions fromAGENTS.mdas well as theSKILLS.Problem
Previously, subagents always operated from the agent's workspace, making it difficult to:
AGENTS.md)SKILLSin the project directorySolution
working_dirparameter toSpawnToolJSON schemaworking_dirthrough toSubagentManager.spawn()AGENTS.mdfromworking_dirinto subagent system promptThe new parameter is completely optional. In case it isn't included, it just functions normally.
I have added to the AGENTS.md of my coding nanobot that every subagent spawned should include a workdir parameter. Seems like it works well for strictly structured projects that may have very specific workflow/architecture instructions in the AGENTS.md. Previously, subagents would missplace files somewhat often, and they never followed the more strict project conventions.