feat(coding-agent): added prompt markers to system prompt assembly

- Added explicit prompt markers and wrappers across system templates, including `[env]`, `[role]`, `[coop]`, `[closure]`, and `[now]`.
- Removed `renderTemplate` and `sectionSeparator` flows, deleted `task/template.ts`, and switched to per-task `renderSubagentUserPrompt` rendering.
- Updated system prompt assembly to `shortenPath`-normalize `cwd`, append rendered now metadata, and preserve trailing `[now]` blocks.
- Removed legacy template tests and added prompt-composition tests for ordered `[contract]`->`[project]`->`[now]` blocks and context-only system placement.
- Reworked shared prompt utilities by collapsing consecutive blank lines and removing obsolete `OPENING_HBS`/`LIST_ITEM` helper behavior.
This commit is contained in:
can1357
2026-05-10 12:27:45 +02:00
parent f1d01fa14e
commit 32e1b41889
16 changed files with 345 additions and 433 deletions
+9 -5
View File
@@ -139,6 +139,7 @@ export interface ExecutorOptions {
agent: AgentDefinition;
task: string;
assignment?: string;
context?: string;
description?: string;
index: number;
id: string;
@@ -994,17 +995,20 @@ export async function runSubprocess(options: ExecutorOptions): Promise<SingleRes
skills: options.skills,
promptTemplates: options.promptTemplates,
workspaceTree: options.workspaceTree,
systemPrompt: defaultPrompt => [
prompt.render(subagentSystemPromptTemplate, {
base: defaultPrompt.join("\n\n"),
systemPrompt: defaultPrompt => {
const subagentPrompt = prompt.render(subagentSystemPromptTemplate, {
agent: agent.systemPrompt,
context: options.context?.trim() ?? "",
worktree: worktree ?? "",
outputSchema: normalizedOutputSchema,
contextFile: options.contextFile,
ircPeers: ircEnabled ? renderIrcPeerRoster(id) : "",
ircSelfId: ircEnabled ? id : "",
}),
],
});
return defaultPrompt.length === 0
? [subagentPrompt]
: [...defaultPrompt.slice(0, -1), subagentPrompt, defaultPrompt[defaultPrompt.length - 1]];
},
sessionManager,
hasUI: false,
spawns: spawnsEnv,