Epic: Migrate ADF Claude agents to Agent SDK
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức phù hợp với người mới
- 25/100
Hướng nghiên cứu
Start with cto-executive-system/knowledge/claude-agent-sdk-reference.md and cto-executive-system/plans/adf-architecture-improvements.md, then inspect crates/terraphim_spawner/src/lib.rs and dependency #688. The first deliverable is a spike comparing the three bridge options while preserving the Rust orchestrator; document the selected approach and split implementation work into the listed sub-issues.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Context
ADF spawns Claude agents as claude -p subprocesses with stdout/stderr capture. This causes SIGPIPE bugs, fragile output parsing, cold-start waste, and no native cost tracking. The Claude Agent SDK (renamed from Claude Code SDK) provides query() async iterator with typed hooks, native session resume/fork, and in-process cost tracking.
Proposal
Replace subprocess spawning for Claude-based agents with Agent SDK query() calls. Codex agents remain as subprocesses (no SDK equivalent).
Migration Strategy
- Create thin Python wrapper per agent that calls Agent SDK
query()and forwards typed JSONL events to stdout using the RPC envelope (#688) - Migrate one agent at a time: product-development first (lowest risk), then security-sentinel
- Preserve orchestrator reconciliation loop, Safety/Core/Growth layers, NightwatchMonitor
What This Eliminates
- SIGPIPE bug (async iterator, no pipes)
- Stdout/stderr parsing fragility (typed message stream)
- Cold-start waste (native
resume=session_id) - Cost tracking complexity (hooks on every API call vs output parsing)
- Session management complexity (
ClaudeSDKClienthandles state)
Open Question: Bridge Architecture
- Option A: Rust orchestrator -> thin Python wrapper (subprocess) -> Agent SDK
- Option B: Rust orchestrator -> local HTTP server running Agent SDK -> typed responses
- Option C: Implement Agent SDK protocol directly in Rust (high effort, fragile)
- Spike needed to determine which approach best preserves Rust orchestrator while gaining SDK benefits
Sub-issues (to be created during design phase)
- Spike: validate Agent SDK wrapper bridge pattern
- Migrate product-development agent to Agent SDK
- Implement cost tracking via Agent SDK hooks (supersedes #638 approach)
- Implement session resume via Agent SDK (supersedes #639 approach)
- Migrate security-sentinel agent to Agent SDK
References
- Agent SDK reference:
cto-executive-system/knowledge/claude-agent-sdk-reference.md - Current ADF subprocess model:
crates/terraphim_spawner/src/lib.rs - Comparison table: Agent SDK reference, "Comparison with Current ADF Setup" section
- Plan:
cto-executive-system/plans/adf-architecture-improvements.md(item 2.1) - Depends on: #688 (RPC envelope)
- Related: #637 (Paperclip epic), #638, #639
- Ngôn ngữ chính
- Rust
- Star
- 62
- Fork
- 5
- Merge trung bình
- 2 giờ 27 phút
- Pull request đã merge (30 ngày)
- 1
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của terraphim/terraphim-ai
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 25/100
terraphim/terraphim-ai#885 ·
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 55/100
terraphim/terraphim-ai#871 ·
-
enhancement
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 25/100
terraphim/terraphim-ai#810 · 2 bình luận ·
-
enhancement
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 35/100
terraphim/terraphim-ai#729 ·
-
enhancement
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 35/100
terraphim/terraphim-ai#728 ·
Tất cả issue của terraphim/terraphim-ai
Issue tương tự
-
risk:low runtime status:in-progress type:test
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 92/100
zeroclaw-labs/zeroclaw#11023 ·
-
good first issue refactor
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 86/100
kwakseongjae/auto-hwp#319 ·
-
area:cli bug filter-quality good first issue priority:medium
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 72/100
bevyengine/bevy#25861 ·