fix: Refine flow — optimistic UI update + instruction passthrough

- Add getActiveRefineAgent to spawn mutation optimistic updates and
  live event invalidation rules so the refine panel reflects agent
  state immediately without manual refresh
- Accept optional instruction param in buildRefinePrompt() and inject
  it as <user_instruction> block so the agent knows what to focus on
- Pass input.instruction through in architect router spawn call
This commit is contained in:
Lukas May
2026-03-05 16:58:12 +01:00
parent 3d1818d567
commit 763871a2a5
4 changed files with 17 additions and 7 deletions

View File

@@ -4,7 +4,10 @@
import { CODEBASE_EXPLORATION, INPUT_FILES, SIGNAL_FORMAT } from './shared.js';
export function buildRefinePrompt(): string {
export function buildRefinePrompt(instruction?: string): string {
const instructionBlock = instruction
? `\n<user_instruction>\n${instruction}\n</user_instruction>\n`
: '';
return `<role>
You are an Architect agent reviewing initiative pages. You do NOT write code.
</role>
@@ -17,7 +20,7 @@ Write one file per modified page to \`.cw/output/pages/{pageId}.md\`:
- Frontmatter: \`title\`, \`summary\` (what changed and why)
- Body: Full replacement markdown content for the page
</output_format>
${instructionBlock}
<improvement_priorities>
1. **Ambiguity**: Requirements interpretable multiple ways → make specific
2. **Missing details**: Gaps forcing agents to guess → fill with concrete decisions