Build OpenSymphony as a Rust implementation of the Symphony service specification using OpenHands agent-server for execution and FrankenTUI for the optional terminal UI.
This repository is an orchestrator. It is not a chat app, not a general workflow engine, and not a thin wrapper around OpenHands.
When sources disagree, use this order:
- upstream
openai/symphonySPEC.md - pinned OpenHands SDK agent-server docs and the wire-contract notes in
docs/websocket-runtime.md - this repository's
docs/ - the task file currently being implemented
- local code comments and tests
Do not silently invent behavior when the upstream spec or chosen integration contract is explicit.
- The Rust orchestrator is the sole authority over scheduling state.
- Workers report events and outcomes to the orchestrator.
- No background task may mutate scheduling state except through orchestrator-owned commands or messages.
- Tracker polling remains required even though agent runtime updates use WebSockets.
- Every issue maps to exactly one sanitized workspace key.
- Workspace paths must remain inside the configured workspace root.
- The agent runtime must execute with
cwd == issue_workspace_path. - Never run agent code in the orchestrator repository root, temp root, or an unsanitized path.
- Target the SDK agent-server HTTP and WebSocket contract.
- Do not implement against
openhands serve. - Do not implement against the web-app Socket.IO protocol.
- Operations are REST. Runtime streaming is WebSocket.
- The WebSocket readiness barrier is the first
ConversationStateUpdateEvent. - Always reconcile events after WebSocket readiness and after reconnect.
- Harness interrupts for OpenHands-backed runs use
POST /api/conversations/{conversation_id}/interruptas the primary mid-turn stop request. UsePOST /api/conversations/{conversation_id}/pauseonly as an older-server fallback when/interruptis unavailable, and record that fallback in diagnostics. Report acknowledgement only after attach/reconcile observes a stopped state such aspaused, or after the configured timeout path records a timeout diagnostic. - One OpenHands conversation is reused per issue by default.
- A fresh conversation gets the full workflow prompt. A resumed conversation gets continuation guidance only.
- Local MVP uses one local agent-server subprocess shared across issues, not one server per issue.
- Local MVP does not require Docker per workspace.
- OpenHands subscription credentials are feature-gated behind
openhands-subscription-credentials. Inopenai_subscriptionmode, workflow config stores environment-variable names and credential-bootstrap metadata (auth_directory_env,auth_method,open_browser,force_login), while the conversation request resolves only the short-lived access token reference and optional account identity header. Do not persist raw OAuth tokens, refresh material, or resolved account identifiers in manifests or debug output.
- The orchestrator reads Linear directly.
- Tracker writes are done by agent-side GraphQL helpers and checked-in query assets unless a future operator API explicitly documents otherwise.
- Scheduler correctness must not depend on agent-side tracker writes succeeding.
- FrankenTUI is optional.
- The daemon must remain correct without any UI attached.
- The UI consumes the control-plane snapshot and event stream only.
- UI code must not reach into orchestrator internals directly.
- Graph-visualization work (knowledge graph, task graph arrows) iterates
against the shared fixtures and desktop
?fixturesworkbench described indocs/graph-view.md("Graph visualization workbench"). Do not recreate ad-hoc demo data; extendpackages/graph/src/viz-fixture.tsandpackages/api-client/src/graph-viz-demo.tsinstead, and keep the scene math covered bypackages/ui-core/__tests__/knowledge-graph-scene.test.ts(including the THREE.js projection-parity test).
opensymphony runis the real local orchestrator entrypoint.opensymphony daemonis demo-only and exists for smoke tests or UI-focused development.- When documenting, validating, or operating the system, prefer
opensymphony rununless the task is specifically about the demo control-plane publisher. opensymphony appand the visible aliasopensymphony desktopare the lazy desktop bundle installer/launcher path. They must remain separate from the execution-planeopensymphony runentrypoint.- The desktop launcher caches verified bundles under
~/.opensymphony/desktop/<version>/and uses a bundle manifest containing version, platform, architecture, relative executable path, and executable SHA-256 checksum. Local materialization must not add Tauri, npm, or platform desktop build dependencies to the default Cargo install. opensymphony memory export-okf --visibility public|private [--output DIR]exports a directory OKF bundle. Public export skips private concepts, runs public redaction checks through OKF lint, stages output before promotion, and requires the output directory to be new or empty.opensymphony memory import-okf <bundle-root> [--force]imports a repo-contained, non-overlapping directory OKF bundle into the configured memory root while preserving unknown concept types and frontmatter fields. It preflights target conflicts before copying and does not overwrite existing Markdown files unless--forceis supplied. Import is not transactional after preflight: a write or reindex failure can leave already-copied Markdown files, so document recovery guidance indocs/memory.mdwhen changing this path.
Preferred crate and trait boundaries:
opensymphony-domainopensymphony-workflowopensymphony-workspaceopensymphony-linearopensymphony-openhandsopensymphony-codexopensymphony-acpopensymphony-orchestratoropensymphony-controlopensymphony-cliopensymphony-tuiopensymphony-testkit
Add new crates only when there is a clear ownership boundary.
OpenSymphony publishes as a single opensymphony crate. The crates/opensymphony-*
directories are internal source-module boundaries, not independently packaged
Cargo crates. They should be included from the root crate with #[path = ...]
module declarations and should not have their own Cargo.toml files or appear
as [workspace].members unless the user explicitly approves splitting the
project into multiple published packages.
The orchestrator should own mutable runtime state in one async task.
Use channels and message passing for worker reports, retries, and control-plane publication.
Avoid spreading Arc<Mutex<...>> through the daemon.
The runtime client must:
- connect after conversation creation
- wait for readiness
- reconcile the REST event backlog
- deduplicate by event ID
- preserve timestamp order
- reconnect with bounded exponential backoff
- refresh cached state after reconnect
- Public harness metadata belongs in
opensymphony-gateway-schema::capability::HarnessCapabilityand the/api/v1/capabilitiesresponse. - Use stable harness kind strings such as
openhands_agent_server,codex_app_server,acp, andrust_native; do not expose private adapter type names to clients. - Concrete harness adapters should implement the domain
HarnessAdaptercapability boundary and keep OpenHands, Codex, or future in-process protocol details inside their adapter modules. - Future or experimental harnesses may be advertised as unavailable capability entries, but their feature gaps must be explicit.
- When changing harness capability discovery, update gateway schema round-trip tests, the gateway capabilities endpoint test, adapter-boundary tests, and
docs/harness-adapter-compatibility.md.
The ACP harness uses named profiles through the production opensymphony run
worker backend and the retained opensymphony_acp::SessionHost. Keep protocol
ownership inside that module and scheduling decisions in the orchestrator.
Persist the selected profile and route for recovery; never replay an uncertain
submission. ACP-only execution must not start an OpenHands server. Public ACP
capabilities distinguish adapter support, profile preflight and negotiated run
support; see docs/harness-adapter-compatibility.md.
The local Codex app-server harness uses the opensymphony_codex internal module
boundary and is advertised as an available local stdio capability. Keep Codex
app-server launch, JSON-RPC lifecycle, event-normalization, generated-contract,
and benchmark evidence documented in docs/codex-app-server-harness.md. The old
codex-app-server-prototype Cargo feature has been removed; local stdio harness
capability must stay available in normal builds. Do not advertise hosted worker
pools, remote routing, or loopback WebSocket as production-ready until those
paths have their own hardening evidence.
OpenHands event schemas can evolve. Implement:
- typed decoding for known high-value events
- raw JSON retention for unknown events
- compatibility tests against the pinned version
- version notes in
docs/sources.md
OKF bundle parsing, legacy capsule mapping, bundle-relative path validation, and
unknown frontmatter preservation belong in opensymphony-memory. Keep the
logical bundle layout and migration model documented in docs/memory.md and
docs/specs/okf-memory-spec.md. Do not move the durable .opensymphony/memory/ store
to the final OKF layout unless a task explicitly includes that migration.
memory.context --include-code-intel uses the Tree-sitter provider first for
supported requested Rust paths, then falls back to CodebaseAnalyzer for
unsupported languages, parser diagnostics, oversized files, and empty-path
repository summaries. Mixed supported and unsupported requests should keep both
AST evidence and fallback trace visibility without changing the public
memory.context contract. The memory MCP server may expose read-only
code.ast.status, code.ast.outline, code.ast.symbols,
code.ast.references, code.ast.query, code.ast.context, and
code.ast.diagnostics tools only when code_intel.enabled and
code_intel.ast.enabled are true. These tools are evidence APIs, not edit APIs:
keep path containment, file/match/capture limits, parser/query-pack/source
citations, and trace output intact. code.ast.query is local read-only by
default and becomes admin-gated whenever a memory admin token is configured.
The rendered code-intelligence provider trait and provider artifact types live in
opensymphony_code_intel; memory keeps its legacy CodeIntelIndex and
CodeIntelArtifact compatibility surface as an adapter around the provider
contract and converts provider errors for memory.context, but AST/composite
providers must not import memory internals.
Symphony workspace hooks:
after_createbefore_runafter_runbefore_remove
These are owned by OpenSymphony.
OpenHands hook configuration such as pre_tool_use is a separate, optional agent runtime feature. Do not conflate them.
The local MVP is a trusted-environment mode.
- Expect host filesystem access.
- Expect host process execution.
- Do not overstate isolation.
- Harden later for hosted mode with remote or container-backed workspaces.
- Document risky defaults clearly in
README.mdanddocs/operations.md.
- Rust 1.97.1 toolchain
cargo fmtcleanclippyclean under repo lints- explicit error enums with context
- structured logs, not ad hoc print-only debugging
tokiocancellation handled deliberately- serde models for all external payloads
- integration code isolated inside
opensymphony-openhands - no direct OpenHands protocol types leaking into orchestrator core types
DuckDB is bundled by default so cargo install opensymphony, release builds,
and normal user builds do not require a separate system DuckDB installation.
For iterative OpenSymphony development on this macOS/Homebrew environment,
prefer the system-linked DuckDB aliases. They use the pinned Homebrew DuckDB
installation, currently DuckDB 1.5.6, and avoid both bundled source
compilation and per-workspace download caches:
cargo check-system-duckdb
cargo test-system-duckdb
cargo test-system-duckdb --test memory
cargo clippy-system-duckdbIf system DuckDB is unavailable, fall back to the downloaded prebuilt aliases:
cargo check-dev
cargo test-dev
cargo clippy-devThe system aliases set DUCKDB_LIB_DIR, DUCKDB_INCLUDE_DIR, and
DYLD_LIBRARY_PATH for the aliased command. The fallback aliases set
DUCKDB_DOWNLOAD_LIB=1 for the aliased command. Both alias families run Cargo
with --no-default-features --features duckdb-prebuilt. cargo fmt is
unaffected because it does not compile dependencies. If a fallback command must
override CARGO_TARGET_DIR, use the default target directory or an absolute
path. Because the system aliases link whatever Homebrew exposes at
/opt/homebrew/opt/duckdb, verify duckdb --version is still the expected
1.5.6 after any Homebrew upgrade or unpin before trusting system-linked test
results. Homebrew's duckdb formula has moved to the 2.x line, so a fresh
brew install duckdb no longer provides 1.5.6; use the -dev aliases until
the host library matches. Before release-sensitive, packaging, or dependency changes, also run the
default bundled-mode validation commands such as
cargo clippy --all-targets -- -D warnings and cargo test.
For any release version bump, keep the root crate and desktop app metadata in
lock-step before tagging or publishing, including apps/desktop/package.json,
apps/desktop/src-tauri/Cargo.toml, apps/desktop/src-tauri/Cargo.lock, and
apps/desktop/src-tauri/tauri.conf.json; verify the parity guard with
npm run package:release --workspace=@opensymphony/desktop -- --dry-run.
- front matter parsing
- strict template rendering failure modes
- env indirection
- extension namespace validation
- path normalization
- identifier sanitization
- containment checks
- hook timeout handling
- create and reuse semantics
- terminal cleanup behavior
- conversation create payload
- event send and run trigger
- WebSocket readiness
- event reconciliation
- out-of-order event ordering
- reconnect and replay
- terminal
execution_statusdetection - conversation reuse and reset paths
- candidate sorting
- active vs terminal reconciliation
- bounded concurrency
- normal continuation retry
- failure backoff
- stall detection
- restart recovery
- snapshot derivation
- control-plane API serialization
- no daemon mutation from UI
- pane layout state
- log and event rendering
When changing behavior in any of these files, update the corresponding docs in the same change:
docs/architecture.mddocs/configuration.mddocs/openhands-agent-server.mddocs/websocket-runtime.mddocs/workspace-and-lifecycle.mddocs/linear-and-tools.mddocs/operations.mddocs/testing-and-operations.md
When changing milestones or task sequencing, update docs/implementation-plan.md.
When changing the pinned OpenHands assumptions, update docs/sources.md.
README.md: project summary and implementation pathdocs/architecture.md: runtime architecturedocs/specs/symphony-spec-alignment.md: upstream spec mappingdocs/openhands-agent-server.md: agent-server integration choicesdocs/codex-app-server-harness.md: local Codex app-server stdio harness, launch contract, JSON-RPC lifecycle evidence, and benchmark resultsdocs/websocket-runtime.md: wire contract and recovery behaviordocs/workspace-and-lifecycle.md: workspace ownership and hooksdocs/linear-and-tools.md: Linear integration and GraphQL helper assetsdocs/memory.md: project memory capture, DuckDB indexing, documentation sync, and archive guard designdocs/code-intelligence.md: agent and operator workflow for AST-backed code intelligencedocs/ui-frankentui.md: operator UI designdocs/repository-layout.md: crate ownershipdocs/deployment-modes.md: local MVP and hosted follow-ondocs/installer-and-distribution.md: future signed installer, component selection, update, and DuckDB runtime packaging strategydocs/configuration.md: target repo bootstrap and runtime configdocs/operations.md: doctor, rehydration, diagnostics, packaging, and local opsdocs/testing-and-operations.md: test strategy and validation layersdocs/tasks/: issue-ready implementation work items
This repository uses an automated AI PR review system. The active provider is
recorded under Automated AI PR review in WORKFLOW.md: the OpenHands PR
Review plugin (current) or Codex code review (see
docs/codex-code-review-setup.md).
- OpenHands provider: the
.github/workflows/ai-pr-review.ymlworkflow runs on PR events using the OpenHands PR review plugin with repository-specific guidance - Codex provider: the Codex GitHub integration reviews PRs on open and on an
exact
@codex reviewcomment, applying the## Review guidelinesguidance in the closestAGENTS.md - Every PR receives one clean full-PR scan for the current head and at most eight scans total when automated review is active. Stop on a clean no-issues or 👍 result; re-trigger only after remediation changes the head. After scan 8, use exact-commit local review instead of scan 9.
- Reviews focus on correctness, security, and maintainability
- The AI reviewer is advisory only and does not count as a human approval
The .agents/skills/custom-codereview-guide.md file contains project-specific rules:
- Async/concurrency safety (locks, cancellation, blocking operations)
- Error handling patterns (explicit enums, context-rich errors)
- Workspace safety (path containment, sanitization)
- WebSocket resilience (reconnect, reconciliation)
- State machine correctness
- Forward compatibility (serde patterns)
- Testing requirements
Substantive PRs should include an Evidence section showing:
- Test output for behavior changes
- Benchmarks for performance changes
- Usage examples for new features
- Reproduction case and verification for bug fixes
With the OpenHands provider, the AI review runs automatically on:
- PR opened (non-draft, same-repo)
- PR marked ready for review
review-thislabel added
When remediation changes the head after a non-clean scan, an additional scan
(up to scan 8) is explicit: remove any existing review-this label and add it
again. Ordinary pushes do not trigger another scan, and a clean scan is not
re-triggered.
With the Codex provider, the initial review runs automatically on PR open;
request a needed post-remediation scan, up to scan 8, by posting a comment that
is exactly @codex review. Do not re-trigger a clean scan.
Never mention
@codex with any other text (it starts a cloud task billed to general Codex
usage, outside the orchestration), and never ask Codex to fix or push changes.