Skip to content

Commit 580a4e5

Browse files
committed
--spawn command
1 parent 28b83b6 commit 580a4e5

File tree

4 files changed

+17
-1
lines changed

4 files changed

+17
-1
lines changed

.agents/prompts/base-prompts.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ export const baseAgentUserInputPrompt = (
252252
'Important: You must spawn a file-explorer agent first to explore the codebase from different perspectives for non-trivial requests. This is an inexpensive way to get a lot of context on the codebase.',
253253
`Important: you *must* read as many files with the read_files tool as possible from the results of the file picker agents. Don't be afraid to read ${isLite ? '8' : '20'} files. The more files you read, the better context you have on the codebase and the better your response will be.`,
254254

255-
'If the users uses "@AgentName" in their message, you must spawn the agent with the name "@AgentName". Spawn all the agents that the user mentions.',
255+
'If the users uses "@agent-id" or "@AgentName" in their message, you must spawn that agent. If you don\'t know what input parameters that agent expects, use the lookup_agent_info tool to get the agent metadata. Spawn all the agents that the user mentions.',
256256

257257
!isGPT5 &&
258258
'Be extremely concise in your replies. Example: If asked what 2+2 equals, respond simply: "4". No need to even write a full sentence.',

npm-app/src/cli-definitions.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,12 @@ export const cliOptions: CliParam[] = [
4343
menuDescription: 'JSON parameters for the agent',
4444
hidden: false,
4545
},
46+
{
47+
flags: '--spawn <agent-id>',
48+
description: 'Spawn a specific agent by ID',
49+
menuDescription: 'Spawn a specific agent by ID',
50+
hidden: false,
51+
},
4652
{
4753
flags: '--model <model>',
4854
description:

npm-app/src/index.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ async function codebuff({
5151
print,
5252
cwd,
5353
trace,
54+
spawn,
5455
}: CliOptions) {
5556
enableSquashNewlines()
5657
const workingDir = getWorkingDirectory()
@@ -94,6 +95,11 @@ async function codebuff({
9495
trace,
9596
})
9697

98+
// Handle --spawn flag by converting to @agent-id syntax
99+
if (spawn) {
100+
initialInput = initialInput ? `@${spawn} ${initialInput}` : `@${spawn}`
101+
}
102+
97103
const cli = CLI.getInstance()
98104
await cli.printInitialPrompt({ initialInput, runInitFlow })
99105

@@ -136,6 +142,8 @@ Examples:
136142
$ codebuff publish my-agent # Publish agent template to store
137143
$ codebuff --agent file-picker "find relevant files for authentication"
138144
$ codebuff --agent reviewer --params '{"focus": "security"}' "review this code"
145+
$ codebuff --spawn researcher "analyze this code"
146+
$ codebuff --spawn file-picker
139147
140148
Direct Commands (via shell shims):
141149
$ codebuff shims install codebuff/base-lite@1.0.0 # One-step setup!
@@ -307,5 +315,6 @@ For all commands and options, run 'codebuff' and then type 'help'.
307315
print: options.print,
308316
cwd: options.cwd,
309317
trace: options.trace,
318+
spawn: options.spawn,
310319
})
311320
}

npm-app/src/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ export interface CliOptions {
1414
cwd?: string
1515
trace?: boolean
1616
publish?: string
17+
spawn?: string
1718
}
1819

1920
/**

0 commit comments

Comments
 (0)