Symphony v2: Complete architecture redesign#2
Open
shivamstaq wants to merge 2 commits into
Open
Conversation
Replace the v1 orchestrator with a ground-up redesign that addresses cost
leaks, implicit state transitions, lack of process visibility, and
GitHub-only tracker support.
Key changes:
Architecture:
- Declarative FSM with 9 states, 16 events, 28 guarded transitions
- Single-goroutine event loop (no mutexes) with typed event handlers
- Three adapter layers: Tracker (GitHub/Linear), Agent (Claude/OpenCode/
Codex), CodeHost (GitHub)
- Per-repo .symphony/ configuration with symphony.yaml
- PTY-based agents with Unix socket attach support
New packages:
- internal/domain/ — WorkItem model + exhaustive FSM
- internal/engine/ — Event loop, eligibility, retry, stall, budget,
handoff, reconcile
- internal/agent/{claude,opencode,codex,mock}/ — Multi-agent adapters
- internal/tracker/{github,linear,mock}/ — Multi-tracker with factory
- internal/codehost/github/ — PR creation, project status updates
- internal/config/ — symphony.yaml parser + validator
- internal/prompt/ — Field-based template routing
- internal/server/ — HTTP API with webhook endpoint (HMAC-SHA256)
- internal/tui/views/ — Bubble Tea dashboard (overview, detail, logs)
- test/property/ — FSM property tests (55K+ random sequences)
- test/scenario/ — 7 end-to-end scenario tests
Removed v1 packages:
- internal/adapter/ (replaced by internal/agent/)
- internal/orchestrator/ (replaced by internal/engine/)
- internal/webhook/ (merged into internal/server/)
- test/integration/ (replaced by test/scenario/)
CLI: init, run, doctor, status, attach, logs, pause, resume, kill,
events, config validate/show
177 tests passing across 15 packages.
Closes #1
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes #1
Motivation
The v1 architecture had critical issues:
What changed
New architecture
FetchCandidates,FetchStates,ValidateConfigStart(ctx, config) → *SessionUpsertPR,CommentOnItem,UpdateProjectStatusFSM (9 states, 16 events, 28 transitions)
All transitions are declarative in
domain/fsm.gowith typed guards. Invalid transitions are compile-time checkable. Property tests verify 55K+ random event sequences.Engine event loop
Single-goroutine processes events sequentially — no mutexes on state:
Multi-turn support
Workers loop up to
max_turnssessions, re-checking work item state between turns. No-commits after all turns →needs_human(prevents silent cost leaks).CLI commands
Package changes
internal/adapter/internal/agent/{claude,opencode,codex,mock}/internal/orchestrator/internal/engine/internal/webhook/internal/server/api.go(webhook endpoint)internal/config/{workflow,service_config,watcher}.gointernal/config/symphony_config.gotest/integration/test/scenario/+test/property/internal/domain/internal/engine/internal/codehost/internal/tracker/{github,linear,mock}/internal/prompt/internal/tui/views/internal/logging/Webhook endpoint
POST /api/v1/webhooks/githubwith HMAC-SHA256 signature verification. Triggers coalesced poll via the engine's buffered event channel.Doctor command
Validates:
.symphony/directory,symphony.yamlparse + validation, directories, prompt template parseability, agent binary on PATH, git availability, auth credentials, GitHub API connectivity (authenticated).Test plan
go build ./...— compiles cleanlygo test ./... -count=1— 177 tests passsymphony init→symphony doctor→symphony run --mock🤖 Generated with Claude Code