Commit Graph

513 Commits

Author SHA1 Message Date
ismeth 5837ec1b6b fix(athena): rewrite council member prompt to be intent-agnostic (Option B)
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-04-15 16:48:44 +09:00
ismeth 7bfd5f13d0 fix(athena): replace generic Option A/B labels with synthesis-derived fix approaches in audit one-by-one review
Athena misinterpreted generic per-finding option labels as execution agent names. Rewrite Step 3 "Mode: One by one" to use descriptive remediation approach labels derived from synthesis, add instruction block clarifying options vs execution methods, and show all three cases (multiple/single/no fix suggestions) in the example.
2026-04-15 16:48:44 +09:00
ismeth 96524c7a54 feat(athena): redesign Step 1 routing with two-phase classification and cross-check option
Replace the 3-route system (self-answerable/ambiguous/council-clear) with
6-category first-interaction routing (meta, wrong-agent, council-worthy,
simple/factual, tool/action, ambiguous) plus 2 pre-checks for explicit
opt-out and council requests. Add subsequent-interaction rules for direct
answers, auto-routing, and greetings. Add 'Cross-check with council'
action to all 8 guidance files for post-synthesis re-evaluation.
2026-04-15 16:48:44 +09:00
ismeth a9ce68c185 fix(athena): interpolate MIN_RESPONSE_LENGTH constant and add solo mode tests 2026-04-15 16:48:44 +09:00
ismeth d013a33a59 refactor(athena): split council-runtime-guidance into per-intent files under guidance/
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-04-15 16:48:44 +09:00
ismeth 06deead1e7 docs(agents): remove dead model-thinking-config references
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-04-15 16:48:44 +09:00
ismeth 8938e51596 feat(athena): add Step 12b for mandatory synthesis.md persistence
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-04-15 16:48:44 +09:00
ismeth e8e64d9f56 fix(athena): add agent capability awareness to switch_agent handoffs
Add <agent_handoff> block to ATHENA_SYSTEM_PROMPT documenting capabilities
and constraints for Prometheus, Atlas, Sisyphus, and Hephaestus agents.
Prometheus entry explicitly states READ-ONLY constraint with forbidden
context verbs. Fix runtime guidance labels from 'Execute (Prometheus)'
to 'Plan (Prometheus)' with /start-work references.
2026-04-15 16:48:19 +09:00
ismeth 7d2749cfe1 fix(athena): address 11 audit findings (H2,H3,H5,M1-M4,M8-M11)
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-04-15 16:48:13 +09:00
ismeth 34faa7c67c refactor(switch-agent): replace deferred hook system with direct session.create + promptAsync
Adopt the opencode-handoff pattern: switch_agent now creates a new session
and sends the context via promptAsync immediately in the tool's execute
function, then navigates the TUI to the new session.

Removes ~1700 LOC of complexity: persistent state management, event-based
hook monitoring, retry logic, session idle waiting, apply verification,
and terminal detection — all replaced by 3 SDK calls.

Deleted: src/features/agent-switch/ (14 files), src/hooks/agent-switch/ (4 files)
Updated: Athena prompt to announce handoff before calling switch_agent
2026-04-15 16:48:01 +09:00
ismeth 45db36a80d fix(athena): add closing tag example to council member prompt
The prompt showed only the opening <COUNCIL_MEMBER_RESPONSE> tag but
never the closing </COUNCIL_MEMBER_RESPONSE>, causing the test
assertion to fail. Added a concrete example block showing both tags.
2026-04-15 16:47:57 +09:00
ismeth 227a59a796 fix(athena): implement 10 prompt audit fixes from council review
- Fix 1: Clarify 'restart at Step 3' → 'restart the council workflow from Step 3 (intent classification)'
- Fix 2: Replace {council-session-name} with static references to council_finalize archive_dir
- Fix 3: Add documenting comment for call_omo_agent in solo mode allowlist
- Fix 4: Add delegation agent rationale comment to RUNTIME_GUIDANCE_BY_INTENT
- Fix 5: Type-safe COUNCIL_INTENT_ADDENDUMS with Record<CouncilIntent, string>
- Fix 6: Clarify FREEFORM wording re COUNCIL_MEMBER_RESPONSE tag requirement
- Fix 7: Remove dead Step 15 fallback from agent.ts
- Fix 8: Add compound question intent precedence guidance
- Fix 9: Fix AUDIT double-period typo
- Fix 10: Add edge case test for extractCouncilResponse with literal tag text
2026-04-15 16:47:57 +09:00
ismeth c265200f5f feat(athena): inject intent runtime guidance and action flows 2026-04-15 16:47:52 +09:00
ismeth ed2bb1ead7 fix(athena): harden council flow and resilience config 2026-04-15 16:47:46 +09:00
ismeth 2c27298dc1 fix(council-archive): simplify finalize output and archive reads 2026-04-15 16:47:33 +09:00
ismeth c27b309320 feat(athena): expand council intent system from 4 to 8 intents
Add DIAGNOSE, CREATE, PERSPECTIVES, FREEFORM intents to Athena's council
classification system. Refine existing AUDIT (add DIAGNOSE boundary),
EVALUATE (improve criteria guidance), and EXPLAIN (remove catch-all status).

Fix bug where prepare_council_prompt defaulted to AUDIT when no intent was
specified — this caused analytical frameworks to be injected into creative
requests (e.g. poetry). Now defaults to no addendum.

Derive validIntents from Object.keys(COUNCIL_INTENT_ADDENDUMS) to prevent
drift between the addendums record and the validation array.
2026-04-15 16:47:33 +09:00
ismeth 2b70130c08 feat(athena): council member continuation enforcer, tool allowlist, and prompt fixes
- Add council-continuation-enforcer to nudge council members until they
  output COUNCIL_MEMBER_RESPONSE, replacing the hacky post-compaction hack
- Add background_wait + background_cancel to council member tool allowlist
  so members can properly manage their explore agents before responding
- Update COUNCIL_DELEGATION_ADDENDUM prompt to instruct members to cancel
  pending tasks and wait for explore results before final response
- Fix council_finalize path resolution to use project directory
- Remove post-compaction-continuation.ts and recentlyCompactedSessions hack
- Add council-response-checker for detecting response tag in session messages
2026-04-15 16:46:05 +09:00
ismeth da446979f6 test(athena): add tests for intent addendums, hook enforcement, restriction parity, and council prompt regression 2026-04-15 16:43:48 +09:00
ismeth 6b450b42db feat(athena): add intent parameter to prepare_council_prompt + wire hook into plugin system + update exports 2026-04-15 16:43:17 +09:00
ismeth 386645ea6b refactor(athena): strip audit bias from council member prompt + add intent addendums + write boundary hook + relax restrictions 2026-04-15 16:43:17 +09:00
ismeth 22c82b6792 feat(athena): update prompt for archive-based council flow with follow-up and cross-check 2026-04-15 16:43:17 +09:00
ismeth 5a819d0914 fix(athena): address 5 audit findings — remove harmful thinking config, add error handling, improve tests
- Remove applyModelThinkingConfig and all callers (OpenCode handles thinking natively)

- Add try/catch error handling to prepare_council_prompt filesystem operations

- Add mode input validation to prepare_council_prompt tool

- Add 2 missing placeholder test cases (RETRY_FAILED_IF_OTHERS_FINISHED, CANCEL_RETRYING_ON_QUORUM)

- Remove redundant 'Do NOT use TodoWrite' prompt section from council member agent
2026-04-15 16:42:33 +09:00
ismeth a30d0a1427 test: add tests for council config schema, prompt content, and config injection 2026-04-15 16:42:28 +09:00
ismeth 9eea3224a5 feat(agents): inject council resilience config into Athena prompt at runtime 2026-04-15 16:42:28 +09:00
ismeth af57568a4f feat(agents): add failure handling, retry, and quorum logic to Athena prompt 2026-04-15 16:42:28 +09:00
ismeth a46bab1406 feat(agents): add COUNCIL_MEMBER_RESPONSE tag requirement to council member prompt 2026-04-15 16:42:28 +09:00
ismeth da6bb91cb2 feat(athena): adaptive synthesis format based on question intent
Classify question type BEFORE synthesizing instead of after. Adds 6
signal-based synthesis formats (AUDIT, COMPARISON, DECISION, ROADMAP,
ARCHITECTURE, RESEARCH) so council output shape matches the question
being asked. CONVERSATIONAL path now suggests a natural follow-up.
2026-04-15 16:42:22 +09:00
ismeth b8f3e5434f fix(athena): remove duplicate council prompt, add temp file cleanup, fix code quality
- Remove COUNCIL_MEMBER_PROMPT from temp file content since it's already
  provided as the council member's system prompt via agent config, saving
  ~350+ tokens per council member per invocation
- Add startup cleanup for stale athena-council-*.md files older than 30
  minutes in .sisyphus/tmp/ to handle cases where process exits before
  setTimeout cleanup fires
- Remove redundant intermediate permission object spread in createAthenaAgent
- Fix test style: it() -> test(), add #given/#then prefixes per conventions
2026-04-15 16:42:22 +09:00
ismeth 5cbf08eabc fix(athena): add solo/delegation addendums, recommend delegation mode
Both modes now inject explicit instructions: solo warns against subagent usage, delegation provides concrete call_omo_agent examples. Delegation is now the recommended default to reduce context window pressure on council members.

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-04-15 16:42:13 +09:00
ismeth 656907ada0 fix(athena): council review fixes — delegation bug, dead code, test coverage
- Add background_output to council-member allowlist (fixes delegation deadlock)
- Replace empty catch with error logging in prepare-council-prompt
- Remove unnecessary type assertion in agent.ts
- Remove dead hasAgentToolRestrictions function
- Fix incorrect test assertions (undefined vs false semantics)
- Add barrel export for athena module
- Add guard function test coverage (5 tests)
- Add parity test for triple-sync restrictions (9 tests)
2026-04-15 16:41:53 +09:00
ismeth fb543f88d5 fix(athena): harden council members — compaction recovery, block TodoWrite, analysis mode
- Add session.compacted handler in BackgroundManager to prevent premature
  task completion after compaction (defer first post-compaction idle)
- Explicitly block TodoWrite/TodoRead for council members in all sync
  points (AgentConfig permission + session tools + prompt instructions)
- Add council member prefix check to todo-continuation-enforcer skip list
  to prevent infinite continuation loops on completed council members
- Add optional analysis mode (solo/delegation) question to Athena setup:
  solo = thorough but heavier, delegation = fast via explore/librarian
- Allow call_omo_agent in council member allow-list for delegation mode
- Update COUNCIL_MEMBER_PROMPT with TodoWrite prohibition and delegation
  addendum for when delegation mode is selected
- Update prepare_council_prompt tool with mode parameter
2026-04-15 16:41:02 +09:00
ismeth c75ae6bffd fix(athena): write council prompt to .sisyphus/tmp/, switch to allow-list permissions
Council members now use an allow-list (read, grep, glob, lsp_*, ast_grep_search)
instead of a deny-list. Prompt file moved from /tmp/ to .sisyphus/tmp/ so no
external_directory permission is needed. COUNCIL_MEMBER_PROMPT is included in
the temp file for self-contained council member instructions.
2026-04-15 16:39:28 +09:00
ismeth da0fba3166 feat(athena): add prepare_council_prompt tool for faster council launches
Athena saves the analysis prompt to a temp file once, then launches each
council member with a short "Read <path> for your instructions" prompt.
This eliminates repeated prompt text across N task calls while preserving
individual clickable task panes in the TUI.
2026-04-15 16:39:28 +09:00
ismeth 636c66ca62 fix: sync council-member tool restrictions across all layers, optimize athena guards
- Add switch_agent/background_wait to agent-tool-restrictions.ts (boolean format)
- Add dynamic council member name matching via COUNCIL_MEMBER_KEY_PREFIX
- Move athena question permission from hardcoded to tool-config-handler (CLI-mode aware)
- Rename appendMissingCouncilPrompt -> applyMissingCouncilGuard
- Optimize tool-execute-before: check hasPendingCouncilMembers before resolving session agent
- Add fallback_models to council-member/athena in schema.json
- Remove unused createAthenaAgent export from agents/index.ts
- Add cross-reference comments for restriction sync points
2026-04-15 16:39:04 +09:00
ismeth 9edb75c02f fix: deny switch_agent and background_wait for council-member agent 2026-04-15 16:37:35 +09:00
ismeth 5972e428e8 fix(tests): update snapshots and positional arg indices for athena/council-member params
- Regenerate model-fallback snapshots to include athena agent config
- Fix createBuiltinAgents positional arg index for disableOmoEnv
  (shifted from index 12 to 13 by new councilConfig param)
- Fix utils.test.ts, config-handler.test.ts arg positions
2026-04-15 16:37:28 +09:00
ismeth 15b2fe2534 fix(athena): resolve 4 compatibility and correctness issues
- Use case-insensitive casing in duplicate name test to verify actual logic
- Align permission type with SDK AgentConfig pattern (as AgentConfig["permission"])
- Move duplicate-name validation from schema to runtime for graceful fallback
- Place skipped members details before 'end your turn' in council guard prompt
2026-04-15 16:34:01 +09:00
ismeth 9f541ed3ee fix(athena): address 9 council-audit findings — dead code, bugs, and hardening
Fixes from multi-model council audit (7 members, 19 findings, 9 selected):

- Use parseModelString() for cross-provider Anthropic thinking config (#3)
- Update stale AGENTS.md athena directory listing (#4)
- Replace prompt in appendMissingCouncilPrompt instead of appending (#5)
- Extract duplicated session cleanup logic in agent-switch hook (#6)
- Surface skipped council members when >=2 valid members exist (#9)
- Expand fallback handoff regex with negation guards (#11)
- Remove dead council-member agent from agentSources and tests (#12)
- Make runtime council member duplicate check case-insensitive (#14)
- Fix false-positive schema tests by adding required name field (#18)
2026-04-15 16:34:01 +09:00
ismeth 4ca623c29c fix(athena): provider-aware config + better council error messages
Use parsed.providerID/modelID in council member description instead of
raw model string (eliminates dead variable). Track skipped members with
reasons and surface them in the missing-council guard prompt so users
see why their council failed to register.
2026-04-15 16:34:01 +09:00
ismeth e79f374ea5 fix(athena): conditional prompt references for missing-council mode 2026-04-15 16:34:01 +09:00
ismeth 3cdac3eba6 chore(athena): remove dead exports and unused barrel file 2026-04-15 16:34:01 +09:00
ismeth b977ca9e63 refactor(athena): use z.infer types from Zod schema, delete manual interfaces 2026-04-15 16:34:01 +09:00
ismeth de8746226f refactor(athena): extract applyModelThinkingConfig shared utility 2026-04-15 16:34:01 +09:00
ismeth ad481472eb refactor(athena): consolidate parseModelString to single source of truth 2026-04-15 16:34:01 +09:00
ismeth aa3b5274c5 fix(athena): replace unsafe type cast with type-safe construction 2026-04-15 16:33:52 +09:00
ismeth afab3e658a feat(athena): harden council config — mandatory name, guard prompt, no-crash duplicates
- Add council config guard prompt: when Athena has no valid council members,
  inject a STOP instruction telling the user how to configure council members
  instead of failing messily with generic agents
- Make council member 'name' field mandatory (was optional with auto-naming)
- Remove humanizeModelId and UPPERCASE_TOKENS — no more fragile auto-naming
- Replace throw on duplicate names with log + skip (graceful degradation)
- Update schema, types, tests (87 pass), and documentation
2026-04-15 16:33:52 +09:00
ismeth 8c71221595 docs(athena): remove stale file references and fix tool restriction table
Remove non-existent council-orchestrator.ts and council-prompt.ts from AGENTS.md structure listing. Fix Athena denied tools (add call_omo_agent) and Council-Member denied tools (remove non-existent athena_council). Add council-member-agents.ts to builtin-agents listing. Fix stale athena_council reference in docs/features.md.

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-04-15 16:32:26 +09:00
ismeth 0540b905cc fix(athena): add non-interactive fallback and improve synthesis workflow
Add fallback for CLI run mode when Question tool is denied: auto-select all council members and auto-choose action by question type. Improve synthesis with numbered findings, question type classification (ACTIONABLE/INFORMATIONAL/CONVERSATIONAL), and multi-select finding selection.

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-04-15 16:32:17 +09:00
ismeth 5bdfbd51eb fix(athena): harden council registration with duplicate detection and count validation
Three registration improvements: gate council member registration on Athena enablement, throw on duplicate council member keys instead of silent overwrite, and disable council mode when valid members drop below 2 after model parsing.

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-04-15 16:32:17 +09:00
ismeth 5aa64932c5 feat(athena): add temperature support to council member schema
Allow per-member temperature overrides in council config. Adds temperature field to CouncilMemberSchema (0-2 range), CouncilMemberConfig type, and auto-generated JSON schema.

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-04-15 16:32:16 +09:00