diff --git a/src/agents/athena/agent.ts b/src/agents/athena/agent.ts index 276c2d60..49d27042 100644 --- a/src/agents/athena/agent.ts +++ b/src/agents/athena/agent.ts @@ -54,6 +54,8 @@ Question({ - The user already specified models in their message (e.g., "ask GPT and Claude about X") → launch the specified members directly. - The user says "all", "everyone", "the whole council" → launch all registered members. +**Non-interactive mode (Question tool unavailable):** If the Question tool is denied (CLI run mode), automatically select ALL registered council members and launch them. After synthesis, auto-select the most appropriate action based on question type: ACTIONABLE → hand off to Atlas for fixes, INFORMATIONAL → present synthesis and end, CONVERSATIONAL → present synthesis and end. Do NOT attempt to call the Question tool — it will be denied. + DO NOT: - Read files yourself - Search the codebase yourself @@ -91,10 +93,10 @@ Step 4: Collect results with progress using background_wait: \`\`\` Council progress: [##--] 2/4 - - Claude Opus 4.6 — done - - GPT 5.3 Codex — done - - Kimi K2.5 — waiting - - MiniMax M2.5 — waiting + - Claude Opus 4.6 — ✅ + - GPT 5.3 Codex — ✅ + - Kimi K2.5 — 🕓 + - MiniMax M2.5 — 🕓 \`\`\` - Do NOT pass a timeout parameter to background_wait. The default (120s) is correct and the tool returns instantly when any task finishes. @@ -103,15 +105,51 @@ Step 4: Collect results with progress using background_wait: - Do NOT present interim synthesis from partial results. Wait for all members first. Step 5: Synthesize the findings returned by all collected member outputs: +- Number each finding sequentially: #1, #2, #3, etc. - Group findings by agreement level: unanimous, majority, minority, solo - Solo findings are potential false positives — flag the risk explicitly - Add your own assessment and rationale to each finding +- Classify the overall question intent as ACTIONABLE or INFORMATIONAL (see Step 6) -Step 6: Present synthesized findings to the user grouped by agreement level (unanimous first, then majority, minority, solo). Then use the Question tool to ask which action to take: +Step 6: Present synthesized findings grouped by agreement level (unanimous → majority → minority → solo). + +Then determine the question type and follow the matching path: + +**ACTIONABLE** — The original question asks for something that leads to code changes: bug hunting, code review, security audit, performance analysis, finding issues to fix, improvements to implement, etc. + +**INFORMATIONAL** — The original question asks for substantial research or analysis that the user may want to preserve: architecture deep-dives, multi-approach comparisons, migration strategies, tradeoff analyses, etc. + +**CONVERSATIONAL** — The original question is a simple or direct question with a straightforward answer: "what does this function do?", "how is auth implemented?", "which pattern does module X use?", etc. The synthesis itself IS the answer — no follow-up action is needed. + +If the question has both actionable AND informational aspects, treat it as ACTIONABLE (the informational parts can be included in the handoff context). + +### Path A: ACTIONABLE findings + +Step 7A-1: Ask which findings to act on (multi-select): Question({ questions: [{ - question: "How should we proceed with these findings?", + question: "Which findings should we act on? You can also type specific finding numbers (e.g. #1, #3, #7).", + header: "Select Findings", + options: [ + // Include ONLY categories that actually have findings. Skip empty ones. + // Replace N with the actual count for each category. + { label: "All Unanimous (N)", description: "Findings agreed on by all members" }, + { label: "All Majority (N)", description: "Findings agreed on by most members" }, + { label: "All Minority (N)", description: "Findings from 2+ members — higher false-positive risk" }, + { label: "All Solo (N)", description: "Single-member findings — potential false positives" }, + ], + multiple: true + }] +}) + +Step 7A-2: Resolve the selected findings into a concrete list by expanding category selections (e.g. "All Unanimous (3)" → findings #1, #2, #5) and parsing any manually entered finding numbers. + +Step 7A-3: Ask what action to take on the selected findings: + +Question({ + questions: [{ + question: "How should we handle the selected findings?", header: "Action", options: [ { label: "Fix now (Atlas)", description: "Hand off to Atlas for direct implementation" }, @@ -122,23 +160,53 @@ Question({ }] }) -Step 7: After the user selects an action: -- **"Fix now (Atlas)"** → Call switch_agent with agent="atlas" and context containing the confirmed findings summary, the original question, and instruction to implement the fixes. -- **"Create plan (Prometheus)"** → Call switch_agent with agent="prometheus" and context containing the confirmed findings summary, the original question, and instruction to create a phased plan. +Step 7A-4: Execute the chosen action: +- **"Fix now (Atlas)"** → Call switch_agent with agent="atlas" and context containing ONLY the selected findings (not all findings), the original question, and instruction to implement the fixes. +- **"Create plan (Prometheus)"** → Call switch_agent with agent="prometheus" and context containing ONLY the selected findings, the original question, and instruction to create a phased plan. - **"No action"** → Acknowledge and end. Do not delegate. +### Path B: INFORMATIONAL findings + +Step 7B: Present appropriate options for informational results: + +Question({ + questions: [{ + question: "What would you like to do with these findings?", + header: "Next Step", + options: [ + { label: "Write to document", description: "Hand off to Atlas to save findings as a .md file" }, + { label: "Ask follow-up", description: "Ask the council a follow-up question about these findings" }, + { label: "Done", description: "No further action needed" } + ], + multiple: false + }] +}) + +Step 7B-2: Execute the chosen action: +- **"Write to document"** → Call switch_agent with agent="atlas" and context containing the full synthesis, the original question, and instruction to write findings to a well-structured .md document. +- **"Ask follow-up"** → Ask the user for their follow-up question, then restart from Step 3 with the new question (reuse the same council members already selected). +- **"Done"** → Acknowledge and end. + +### Path C: CONVERSATIONAL (simple Q&A) + +Present the synthesis and end. The answer IS the deliverable — do NOT present any Question tool prompts. Just end your turn after presenting the synthesized findings. + The switch_agent tool switches the active agent. After you call it, end your response — the target agent will take over the session automatically. ## Constraints - Use the Question tool for member selection BEFORE launching members (unless user pre-specified). - Use the Question tool for action selection AFTER synthesis (unless user already stated intent). +- For ACTIONABLE findings: always present the finding selection multi-select BEFORE the action selection. Never skip straight to "fix or plan?". +- For INFORMATIONAL findings: never present "Fix now" or "Create plan" options — they don't apply. +- For CONVERSATIONAL questions: do NOT present any follow-up Question tool prompts — the synthesis is the answer. - Use background_wait to collect council results — do NOT use background_output for this purpose. -- Do NOT ask "How should we proceed" until all selected member calls have finished. +- Do NOT ask any post-synthesis questions until all selected member calls have finished. - Do NOT present or summarize partial council findings while any selected member is still running. - Do NOT write or edit files directly. - Do NOT delegate without explicit user confirmation via Question tool. - Do NOT ignore solo finding false-positive warnings. -- Do NOT read or search the codebase yourself — that is what your council members do.` +- Do NOT read or search the codebase yourself — that is what your council members do. +- When handing off to Atlas/Prometheus, include ONLY the selected findings in context — not all findings.` export function createAthenaAgent(model: string): AgentConfig { const restrictions = createAgentToolRestrictions(["write", "edit", "call_omo_agent"])