Commit Graph

5235 Commits

Author SHA1 Message Date
ismeth 513a5c90b1 fix(athena): force athena-junior to background and exempt from hard TTL
Council sessions are long-running: athena-junior launches members then
waits for them via background_wait. Two changes prevent premature kills:

- Force run_in_background=true when subagent_type resolves to athena-junior,
  avoiding the 10-minute sync poll timeout (MAX_POLL_TIME_MS)
- Exempt athena-junior from the 30-minute TASK_TTL_MS hard cutoff since
  council members have their own independent TTLs
- Fix missing bulk_launch field in AthenaOverrideConfigSchema (type error)
2026-04-15 16:48:47 +09:00
ismeth 5e71d84a69 feat(athena): add bulk_launch config for council launch strategy
New config: agents.athena.bulk_launch (boolean, default false)
- false: launch members one-by-one via task() for TUI inspectability
- true: launch all members at once via athena_council tool

Prompt uses {BULK_LAUNCH_STEP_5_2} placeholder injected at runtime
based on config value. Schema, caller, and tests updated.
2026-04-15 16:48:47 +09:00
ismeth febffeebb1 fix(tools): deny council tools globally via permission system
The config.tools boolean false wasn't blocking plugin-registered tools.
Add prepare_council_prompt, council_finalize, athena_council to global
permission deny — same pattern as task: deny. Per-agent allow on
athena/athena-junior overrides the global deny.
2026-04-15 16:48:47 +09:00
ismeth c384fd0a02 fix(athena): grant athena_council tool to athena primary agent
Council tools (prepare_council_prompt, council_finalize, athena_council) are
globally disabled and only re-enabled for athena and athena-junior. Athena
was missing athena_council — now both agents have symmetric access.

Also fix parity test to include council_finalize and athena_council in
ATHENA_HANDLER_GRANTS for complete coverage.
2026-04-15 16:48:47 +09:00
ismeth 30cf71a845 fix(athena-junior): remove synthesis and question from council result JSON
Keep the council result JSON lean as a metadata envelope. Full synthesis
is already persisted at {archive_dir}/synthesis.md — duplicating it in
the JSON created noise that obscured structural fields like archive_dir.

Also instructs athena-junior to remind the caller to read the full
synthesis and member responses from the archive directory.
2026-04-15 16:48:47 +09:00
ismeth 102b754f1e fix(athena): remove athena primary from delegation list and switch_agent targets
Athena primary should not be routable via switch_agent or appear in the
delegation table. Only athena-junior (subagent) remains delegatable via task().

- Remove athena from ALLOWED_AGENTS and DESCRIPTION in switch-agent tool
- Remove ATHENA_PROMPT_METADATA from agentMetadata, agent.ts, barrel export
- Update switch-agent test to assert athena rejection
- Remove ATHENA_PROMPT_METADATA test block
2026-04-15 16:48:47 +09:00
ismeth efc53de531 feat(athena): complete delegation routing fix with mode-aware delegation table
- Re-add ATHENA_PROMPT_METADATA with tight triggers and avoidWhen guardrails
- Update switch_agent tool description with permanent handoff guardrail
- Make buildDelegationTable mode-aware: switch_agent for primary, task() for subagent
- Pass agent mode through general-agents to AvailableAgent interface
- Improve primary agent error messages in subagent-resolver with alternatives
- Add council-first bias to Athena interactive prompt
- Update athena-junior trigger text for clearer task() invocation guidance
- Add tests for ATHENA_PROMPT_METADATA shape, triggers, useWhen, avoidWhen
2026-04-15 16:48:46 +09:00
ismeth 7ffdd15b52 feat(athena-junior): add athena_council bulk launch tool
- Create src/tools/athena-council/ with council-launcher, tool factory, types
- Launch all council members in parallel via BackgroundManager with writeOutputToFile: true
- Wire tool into registry with backgroundManager + councilConfig dependencies
- Grant athena-junior athena_council permission, remove task permission
- Update non-interactive prompt to use athena_council instead of task tool
- Add explicit stop-after-result instruction to prevent post-output text
- 23 tests (14 tool + 9 launcher) using real temp files, no mock.module
2026-04-15 16:48:46 +09:00
ismeth ffde7a6853 fix(test): update model-requirements test for 13 builtin agents
Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-04-15 16:48:46 +09:00
ismeth 149d065d68 feat(athena): split into athena (interactive) and athena-junior (subagent)
Split the Athena council orchestrator into two distinct agents:
- athena: primary mode, interactive prompt with Question tool and switch_agent
- athena-junior: subagent mode, non-interactive prompt with structured JSON output

Key changes:
- Create athena-junior-agent.ts factory (mode=subagent, denies question+call_omo_agent)
- Revert athena agent.ts to primary mode (no env var switching)
- Make buildAthenaRuntimeGuidance mode-aware (strips action_paths for non-interactive)
- Add mode parameter to council_finalize tool
- Register athena-junior in builtin-agents, tool-config, model-requirements
- Replace "athena" with "athena-junior" in call_omo_agent ALLOWED_AGENTS
- Update all tests for new architecture

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

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-04-15 16:48:46 +09:00
ismeth deb2a2754e feat(athena): add non-interactive fields to override schema
Extend AthenaOverrideConfigSchema with non_interactive_mode,
non_interactive_members, non_interactive_member_list. Replace
Record<string, unknown> casts with proper typed access.

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

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-04-15 16:48:45 +09:00
ismeth 05d4ecf2ff feat(athena): inject non-interactive config placeholders into prompt
Add 4 new .replace() calls for NON_INTERACTIVE_MODE, NON_INTERACTIVE_MEMBERS,
NON_INTERACTIVE_MEMBER_LIST, and BACKGROUND_WAIT_TIMEOUT_MS. Pass athena
non-interactive config from agent-config-handler to createBuiltinAgents.

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

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-04-15 16:48:45 +09:00
ismeth 61ccd7f9a7 fix(athena): include MODE=all agents in uiSelectedModel passthrough
The general-agents.ts isPrimaryAgent check only considered mode=primary,
causing Athena (now mode=all) to lose uiSelectedModel resolution.
Also adds metadata tests for non-interactive triggers.

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

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-04-15 16:48:45 +09:00
ismeth 6fb6d1256c feat(athena): dual prompt selection with MODE=all
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-04-15 16:48:45 +09:00
ismeth e01742c8b2 feat(athena): add athena to switch-agent and call-omo-agent allowed lists 2026-04-15 16:48:45 +09:00
ismeth cee2baf421 feat(athena): add non-interactive prompt
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-04-15 16:48:45 +09:00
ismeth 6a889d472d feat(athena): extend config schema with non-interactive fields
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-04-15 16:48:45 +09:00
ismeth 1c27867fc9 feat(athena): extract interactive prompt to dedicated file
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-04-15 16:48:45 +09:00
ismeth 3468c72dfa test(council): add comprehensive meta-yaml-formatter tests 2026-04-15 16:48:45 +09:00
ismeth 9e196a21d7 fix(council): fix nudge retry cap bypass and add memory cleanup 2026-04-15 16:48:45 +09:00
ismeth e15ce7b279 fix(council): increase archive ID entropy and remove unused toolContext param
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-04-15 16:48:45 +09:00
ismeth 3d36f6c5d8 fix(council): handle whitespace around COUNCIL_MEMBER_RESPONSE tags
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-04-15 16:48:45 +09:00
ismeth 93b77046cf refactor(athena): extract shared guidance boilerplate into shared module 2026-04-15 16:48:45 +09:00
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 4a7ddae53f refactor(council): move hasCouncilResponseTag to council-response-extractor
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 45d3eb65df fix(council): add error logging to empty catch in council-finalize-helpers
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 9eb91ab631 fix(athena): use constants.ts as single source of truth for council defaults
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 d87d0256ba test(council-archive): add comprehensive coverage for council-finalize-helpers
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 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 d742512181 fix(council-continuation): increment nudge count only after successful dispatch
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 88c615ee97 fix(prepare-council-prompt): suppress ENOENT in cleanup timer and eliminate redundant resolveCouncilIntent
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 ffb0fad26e refactor(council-archive): remove dead isPathEscaping check and unused log import
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 17ac08a02b fix(council-archive): add movePromptFile error logging and fix isPathEscaping false positives
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 36e52d28b4 fix(council-archive): handle CRLF line endings in structural tag detection
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 6e57d060e1 fix(council-finalize): append runtime guidance to tool response for same-turn delivery
Remove contextCollector dependency from council_finalize and append
Athena runtime guidance directly to the tool's JSON response string.
This fixes the timing bug where guidance registered via contextCollector
only arrived on the next message cycle, too late for Athena's same-turn
synthesis.

- Remove ContextCollector import, RegisterContext type, and collector.register() block
- Append buildAthenaRuntimeGuidance() output after JSON result with \n\n separator
- Simplify createCouncilFinalize() factory call in tool-registry (no options)
- Update unit tests: replace collector mock assertions with direct output string checks
- Update integration tests: wrap JSON.parse with extractJson() helper for hybrid output
2026-04-15 16:48:44 +09:00
ismeth 951f004a65 fix(test): align assertions after cherry-pick merge from 3 worktrees
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 b4dd379b38 fix(council-archive): handle literal tag mentions inside response content
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-04-15 16:48:19 +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 a13cc7b877 fix(council-finalize): patch path traversal vulnerabilities in name, task_ids, and prompt_file 2026-04-15 16:48:07 +09:00
ismeth a33a3d1095 refactor(athena): remove redundant council_read tool, use Read instead
council_read was a sandboxed readFile wrapper for .sisyphus/ archives.
Now that council_finalize extracts member responses into plain files,
the standard Read tool serves the same purpose. Removes the tool, its
tests, and updates Athena's prompt to reference Read directly.
2026-04-15 16:48:07 +09:00
ismeth 225a612b3a fix(test): update council-finalize assertions to match current runtime guidance wording 2026-04-15 16:48:01 +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 75f07b4d8e fix(agent-switch): add missing session.create mock to hook tests 2026-04-15 16:47:57 +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