Commit Graph

5214 Commits

Author SHA1 Message Date
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
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 e52ccd1b04 fix(agent-switch): create fresh session for handoff apply 2026-04-15 16:47:37 +09:00
ismeth 2c27298dc1 fix(council-archive): simplify finalize output and archive reads 2026-04-15 16:47:33 +09:00
ismeth f0aef077c8 fix(council): add background_wait and background_cancel to council member allowlist 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 f5829bf2fb fix(athena): resolve task output files to project directory instead of process.cwd()
task-output-writer wrote to process.cwd()/.sisyphus/task-outputs/ while
council_finalize read from ctx.directory/.sisyphus/task-outputs/. When
these differ, all output files appear missing.

Fix by passing directory to writeTaskOutput from BackgroundManager, and
adding basePath to council_read. Also removes process.chdir() from tests
that was masking the bug.
2026-04-15 16:47:20 +09:00
ismeth aa91c1fb19 fix(glob): extract directory prefix from pattern for ripgrep compatibility
Ripgrep's --glob flag silently returns no results when the pattern
contains a directory prefix (e.g. 'apps/backend/**/*.ts'). Models
naturally write patterns this way when exploring unfamiliar codebases.

Extract the static directory segments from the pattern, append them to
the search path, and pass only the glob portion to ripgrep.
2026-04-15 16:46:52 +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 684b746ee7 fix(tools): resolve relative paths in glob/grep against project directory
When models pass relative paths (e.g. 'apps/ios/CleanSlate') to glob/grep
tools, they were passed directly to ripgrep which resolved them against
process.cwd(). In OpenCode Desktop, process.cwd() is '/' causing all
relative path lookups to fail with 'No such file or directory'.

Fix: use path.resolve(ctx.directory, args.path) to resolve relative paths
against the project directory instead of relying on process.cwd().
2026-04-15 16:43:54 +09:00
ismeth 8676b1cdb9 fix(tools): resolve relative paths in glob/grep against project directory
When models pass relative paths (e.g. 'apps/ios/CleanSlate') to glob/grep
tools, they were passed directly to ripgrep which resolved them against
process.cwd(). In OpenCode Desktop, process.cwd() is '/' causing all
relative path lookups to fail with 'No such file or directory'.

Fix: use path.resolve(ctx.directory, args.path) to resolve relative paths
against the project directory instead of relying on process.cwd().
2026-04-15 16:43:54 +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 e198707e84 test(council-archive): add integration tests for full council flow 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 c644643aef feat(background-agent): integrate file writing in completion path and remove dead council code
- Add _isCompleting guard and writeTaskOutput call before status flip
- Propagate writeOutputToFile from LaunchInput to BackgroundTask
- Delete council-result-format.ts and tests (no longer needed)
- 38/38 tests passing
2026-04-15 16:43:17 +09:00
ismeth b6b956c4c3 feat(council-archive): register council tools and add write_output_to_file to task tool
- Register council_finalize and council_read in tool registry
- Add write_output_to_file param to delegate-task, propagate to LaunchInput
- Create council-archive barrel exports
2026-04-15 16:43:17 +09:00
ismeth 2a426860f6 feat(council-archive): add council_finalize and council_read tools, refactor background_wait to metadata-only
- council_finalize: batch extract, archive, and return council results
- council_read: secure file reader for archived council responses
- background_wait: stripped to metadata-only, returns completed_tasks array
- Removed all council-specific logic from background_wait
- 28/28 tests passing across all changed files
2026-04-15 16:42:49 +09:00
ismeth 116b8b4edd feat(background-agent): add task output file writer with atomic writes
- writeTaskOutput() writes session transcript to .sisyphus/task-outputs/
- YAML frontmatter with task metadata
- Atomic write via temp file + rename
- Returns null on failure (never throws)
- 8/8 tests passing
2026-04-15 16:42:49 +09:00