Hệ thống AI Agent tự động hóa lập trình — vận hành trên vòng lặp Perception → Action → Observation, module hóa thành 6 layer rõ ràng.
An AI Agent system for programming automation — operating on a Perception → Action → Observation loop, modularized into 6 distinct layers.
Tiếp nhận yêu cầu & kiểm soát quyền truy cập
Receives requests & controls access permissions
Tiếp nhận yêu cầu từ CLI, IDE (VSCode, JetBrains), và CI/CD pipeline.
Accepts requests from CLI, IDE (VSCode, JetBrains), and CI/CD pipelines.
Multi-sourceDuy trì trạng thái phiên: Resume (tiếp tục), Fork (rẽ nhánh), Persist (lưu trữ).
Maintains session state: Resume, Fork, and Persist modes.
StatefulChốt an ninh YAML 3 cấp: Deny → Approve → Allow. Quan sát mọi thứ trước khi vào agent loop.
3-level YAML security gate: Deny → Approve → Allow. Observes everything before entering the agent loop.
SecurityBộ não cung cấp dữ liệu — tối ưu xử lý ngữ cảnh lớn
The brain that supplies data — optimized for large context processing
Nén ngữ cảnh 3 lớp (ngưỡng 92%): Summarize → Prune → Truncate. Ghi ra .agent_memory.md.
3-layer context compression (92% threshold): Summarize → Prune → Truncate.
92% thresholdLưu trữ bộ nhớ xuyên phiên: Long-term, Short-term, và Episodic memory.
Cross-session memory storage: Long-term, Short-term, and Episodic memory.
Cross-sessionTiêm (inject) kỹ năng vào prompt theo ngữ cảnh — on-demand injection.
Injects skills into prompts based on context — on-demand injection.
On-demandSắp xếp ưu tiên & dependencies giữa các tác vụ — DAG-based scheduling.
Prioritizes & manages task dependencies — DAG-based scheduling.
DAGTrái tim hệ thống — vòng lặp Perceive → Act → Observe
The heart of the system — Perceive → Act → Observe loop
Tự phát hiện lỗi và thử lại với cách tiếp cận khác.
Auto-detects errors and retries with a different approach.
Theo dõi mục tiêu cuối cùng, không lạc hướng giữa các bước.
Tracks the final goal, stays on course between steps.
Quyết định gọi tool trực tiếp hoặc spawn subagent cho task phức tạp.
Decides to call tools directly or spawn subagents for complex tasks.
Nơi các hành động thực sự diễn ra
Where actual actions take place
Model Context Protocol — auto-discover tools từ Filesystem, Git, Custom servers.
Model Context Protocol — auto-discovers tools from Filesystem, Git, Custom servers.
Auto-discoverBộ điều phối: bash, read, write, grep, edit — mỗi tool có handler riêng biệt.
Dispatcher: bash, read, write, grep, edit — each tool has a dedicated handler.
ModularThực thi song song (parallel execution) theo thời gian thực.
Real-time parallel execution of tool calls.
ParallelTái sử dụng stable prefix — giảm chi phí gọi model xuống còn ~10%.
Reuses stable prefix — reduces model call cost to ~10%.
Cost: 10%Chia nhỏ tác vụ phức tạp cho các agent con
Breaks down complex tasks for child agents
Tạo agent con với ngữ cảnh cô lập — giao việc rành mạch, không chia sẻ state.
Creates child agents with isolated context — clear delegation, no shared state.
IsolatedRedis pub/sub — gửi tin nhắn tức thời giữa các agent. FSM: IDLE → REQUEST → WAIT → RESPOND.
Redis pub/sub — instant messaging between agents. FSM: IDLE → REQUEST → WAIT → RESPOND.
Redis pub/subBranch riêng cho từng task — zero conflicts. Atomic lock từ Autonomous Board đảm bảo merge an toàn.
Separate branch per task — zero conflicts. Atomic lock ensures safe merges.
Zero conflictsGiám sát, trả kết quả & feedback loop
Monitoring, delivering results & feedback loop
Bắt sự kiện vòng đời (lifecycle hooks): tool_start, tool_end, error, session_end.
Captures lifecycle events: tool_start, tool_end, error, session_end.
LifecycleDaemon threads chạy non-blocking: logging, metrics, state persistence.
Non-blocking daemon threads: logging, metrics, state persistence.
Non-blockingOutput đã xác minh — tự động cập nhật Memory Store để hệ thống "học" từ thao tác vừa thực hiện.
Verified output — auto-updates Memory Store so the system "learns" from performed actions.
Verified| Layer | Files trong Scaffold · Scaffold Files | Vai trò · Role |
|---|---|---|
| Input & Permission | .claude/settings.json |
Permissions, hooks, model selection |
| Knowledge | CLAUDE.md · .claude/rules/ · .claude/skills/ |
Context, rules, on-demand skills |
| Agent Loop | Claude Code runtime (built-in) | Core orchestration engine |
| Integration | .mcp.json · .claude/hooks/ |
MCP servers, event scripts |
| Multi-Agent | .claude/agents/*.md |
Subagent definitions |
| Observability | .claude/hooks/ · Event scripts |
Monitoring, output, feedback |