🔍 Bóc tách repo openai/symphony: 14 module Elixir, 6 skill, 1 WORKFLOW.md

🔍 Bóc tách repo openai/symphony: 14 module Elixir, 6 skill, 1 WORKFLOW.md

Repo openai/symphony chỉ có 2 thư mục code chính, nhưng đằng sau là 5,517 dòng Elixir/OTP, 14 module GenServer, 6 Codex skill1 file WORKFLOW.md điều khiển vòng đời agent. Dưới đây là chuyến đi xuyên repo.

📁 Cấu trúc top-level: 2 cách dùng

Top-level chỉ có 5 entry: README.md, SPEC.md (vendor-neutral spec), LICENSE Apache 2.0, NOTICE, và 2 thư mục .codex/ cùng elixir/. README ghi rõ 2 cách dùng: đưa SPEC.md cho Codex tự build theo stack bạn muốn, hoặc xài luôn reference impl trong elixir/. OpenAI nói thẳng đây là prototype, khuyến cáo team tự fork và harden lại.

🧩 14 module trong lib/symphony_elixir/

Sắp theo độ phức tạp:

  • orchestrator.ex (1,655): GenServer chính, poll Linear, dispatch worker. Có @continuation_retry_delay_ms 1_000@failure_retry_base_ms 10_000 cho exponential backoff.
  • status_dashboard.ex (1,952): LiveView observability, file lớn nhất repo.
  • workspace.ex (483): workspace isolated per-issue, hỗ trợ SSH remote.
  • agent_runner.ex (203): chạy 1 issue trên 1 worker, life-cycle hooks và Codex turns.
  • workflow_store.ex (153): hot-reload WORKFLOW.md không restart.
  • workflow.ex (123): parse YAML front-matter và Liquid template.
  • ssh.ex (100), http_server.ex (88), prompt_builder.ex (64).
  • path_safety.ex (50): chống path traversal, critical với agent có quyền write.
  • tracker.ex (46): GraphQL Linear thin wrapper.

Phía Web có Phoenix stack, observability_api_controller.ex expose /api/v1/state, /api/v1/<id>, /api/v1/refresh.

🎯 6 Codex skill trong .codex/skills/

Mỗi skill là thư mục có SKILL.md, prompt agent load runtime:

  • commit: commit theo convention. debug: chiến lược debug.
  • land: watcher loop merge PR khi CI green, kèm land_watch.py. Agent KHÔNG được gọi gh pr merge trực tiếp.
  • linear: gọi Linear GraphQL qua linear_graphql. pull: rebase origin/main. push: push remote, update PR.

Cộng .codex/worktree_init.sh bootstrap worktree. Đây chính là "harness engineering".

📜 WORKFLOW.md thực Symphony tự dùng

File elixir/WORKFLOW.md (326 dòng) là YAML + Liquid:

agent:
  max_concurrent_agents: 10
  max_turns: 20
codex:
  command: codex --config 'model="gpt-5.5"'
    --config model_reasoning_effort=xhigh app-server
  approval_policy: never
  thread_sandbox: workspace-write

Mặc định code an toàn hơn: reject mọi sandbox approval. Body markdown là prompt với state map Linear: Backlog → Todo → In Progress → Human Review → Merging → Rework → Done. Rule cứng: workpad comment 1 nguồn duy nhất, không hỏi user, file follow-up issue thay vì expand scope.

🚀 Cách chạy thật

Repo dùng mise.toml quản lý Elixir/Erlang:

cd symphony/elixir
mise trust && mise install
mise exec -- mix setup && mix build
mise exec -- ./bin/symphony ./WORKFLOW.md

--logs-root, --port bật Phoenix dashboard. make e2e chạy thật, tạo Linear project tạm, spawn codex app-server, 2 scenario local và SSH workers qua docker-compose.

💡 Học được gì từ repo

  1. Elixir/OTP chọn vì supervise long-running process và hot code reload không stop subagent đang chạy.
  2. Sandbox an toàn mặc định: workspace-write rooted tại issue workspace, policy reject mọi escalation.
  3. Skill folder là pattern hay để versioning prompt như code.
  4. Path safety chỉ 50 dòng vẫn tách riêng, nhắc rằng agent code phải nghĩ tới attack surface.

Bạn đã clone openai/symphony đọc thử chưa? Muốn deep-dive tiếp orchestrator.ex hay status_dashboard.ex?

#OpenAISymphony #Elixir #OpenSource #Codex #VibeAICoder

Bài viết liên quan

🔍 Bóc tách repo openai/symphony: 14 module Elixir, 6 skill, 1 WORKFLOW.md | Vibe AI Coder