diff --git a/apps/server/agent/manager.ts b/apps/server/agent/manager.ts index 066d51d..152ac3c 100644 --- a/apps/server/agent/manager.ts +++ b/apps/server/agent/manager.ts @@ -283,14 +283,15 @@ export class MultiProviderAgentManager implements AgentManager { }); const agentId = agent.id; - // 3a. Append inter-agent communication instructions with actual agent ID - prompt = prompt + buildInterAgentCommunication(agentId, mode); + // 3a. Append inter-agent communication + preview instructions (skipped for focused agents) + if (!options.skipPromptExtras) { + prompt = prompt + buildInterAgentCommunication(agentId, mode); - // 3b. Append preview deployment instructions if applicable - if (['execute', 'refine', 'discuss'].includes(mode) && initiativeId) { - const shouldInject = await this.shouldInjectPreviewInstructions(initiativeId); - if (shouldInject) { - prompt = prompt + buildPreviewInstructions(agentId); + if (['execute', 'refine', 'discuss'].includes(mode) && initiativeId) { + const shouldInject = await this.shouldInjectPreviewInstructions(initiativeId); + if (shouldInject) { + prompt = prompt + buildPreviewInstructions(agentId); + } } } diff --git a/apps/server/agent/prompts/conflict-resolution.ts b/apps/server/agent/prompts/conflict-resolution.ts index bb33ab7..e295b29 100644 --- a/apps/server/agent/prompts/conflict-resolution.ts +++ b/apps/server/agent/prompts/conflict-resolution.ts @@ -5,9 +5,7 @@ import { SIGNAL_FORMAT, - SESSION_STARTUP, GIT_WORKFLOW, - CONTEXT_MANAGEMENT, } from './shared.js'; export function buildConflictResolutionPrompt( @@ -29,7 +27,12 @@ You are a Conflict Resolution agent. Your job is to merge \`${targetBranch}\` in ${conflictList} ${SIGNAL_FORMAT} -${SESSION_STARTUP} + + +1. \`pwd\` — confirm working directory +2. \`git status\` — check branch state +3. Read \`CLAUDE.md\` at the repo root (if it exists) — it contains project conventions you must follow. + Follow these steps in order: @@ -57,7 +60,6 @@ Follow these steps in order: 8. **Signal done**: Write signal.json with status "done". ${GIT_WORKFLOW} -${CONTEXT_MANAGEMENT} - You are on a temporary branch created from ${sourceBranch}. You are merging ${targetBranch} INTO this branch — bringing it up to date, NOT the other way around. diff --git a/apps/server/agent/types.ts b/apps/server/agent/types.ts index 94737d9..975abae 100644 --- a/apps/server/agent/types.ts +++ b/apps/server/agent/types.ts @@ -61,6 +61,8 @@ export interface SpawnAgentOptions { branchName?: string; /** Context data to write as input files in agent workdir */ inputContext?: AgentInputContext; + /** Skip inter-agent communication and preview instructions (for focused agents like conflict resolution) */ + skipPromptExtras?: boolean; } /** diff --git a/apps/server/trpc/routers/initiative.ts b/apps/server/trpc/routers/initiative.ts index 1c317df..0077ad9 100644 --- a/apps/server/trpc/routers/initiative.ts +++ b/apps/server/trpc/routers/initiative.ts @@ -488,6 +488,7 @@ export function initiativeProcedures(publicProcedure: ProcedureBuilder) { initiativeId: input.initiativeId, baseBranch: initiative.branch, branchName: tempBranch, + skipPromptExtras: true, }); }), }; diff --git a/docs/agent.md b/docs/agent.md index 752a527..38f55db 100644 --- a/docs/agent.md +++ b/docs/agent.md @@ -24,14 +24,14 @@ | `accounts/` | Account discovery, config dir setup, credential management, usage API | | `credentials/` | `AccountCredentialManager` — credential injection per account | | `lifecycle/` | `LifecycleController` — retry policy, signal recovery, missing signal instructions | -| `prompts/` | Mode-specific prompt builders (execute, discuss, plan, detail, refine, chat, conflict-resolution, errand) + shared blocks (test integrity, deviation rules, git workflow, session startup, progress tracking) + inter-agent communication instructions | +| `prompts/` | Mode-specific prompt builders (execute, discuss, plan, detail, refine, chat, conflict-resolution, errand) + shared blocks (test integrity, deviation rules, git workflow, session startup, progress tracking) + inter-agent communication instructions. Conflict-resolution uses a minimal inline startup (pwd, git status, CLAUDE.md) instead of the full `SESSION_STARTUP`/`CONTEXT_MANAGEMENT` blocks. | ## Key Flows ### Spawning an Agent 1. **tRPC procedure** calls `agentManager.spawn(options)` -2. Manager generates alias (adjective-animal), creates DB record +2. Manager generates alias (adjective-animal), creates DB record. Appends inter-agent communication and preview instructions unless `skipPromptExtras: true` (used by conflict-resolution agents to keep prompts lean). 3. `AgentProcessManager.createWorktree()` — creates git worktree at `.cw-worktrees/agent//` 4. `file-io.writeInputFiles()` — writes `.cw/input/` with assignment files (initiative, pages, phase, task) and read-only context dirs (`context/phases/`, `context/tasks/`) 5. Provider config builds spawn command via `buildSpawnCommand()`