AWKit (Antigravity Workflow Kit) là khung điều phối các tác tử AI chuyên nghiệp, được thiết kế để code mượt mà, quản lý tiến độ bằng Symphony và tối ưu hóa bối cảnh context. AWKit (Antigravity Workflow Kit) is a professional AI agent orchestration framework, designed for seamless vibrance coding, Symphony lifecycle task tracking, and extreme context optimization.
- .project-identity: Chứa thông tin gốc của dự án (Name, Tech Stack). Cập nhật file này để cấu hình lại các tác vụ AI nền. Contains the project metadata (Name, Tech Stack). Update this file to configure background AI tasks.
- CODEBASE.md: Bản đồ kiến trúc code sống của dự án. AI tự động cập nhật thông tin lớp, luồng chạy qua lệnh đồng bộ. The living architecture map of the project. AI automatically updates codebase map and structural changes.
- AGENTS.md & CLAUDE.md: Các file hiến pháp định hướng nguyên tắc và hành vi cốt lõi của tác tử AI. The constitutional files defining strict rules and behavioral constraints for all AI agents.
Mọi tác vụ MODERATE hoặc COMPLEX đều được AI chạy khép kín qua 7 Cổng kỷ luật để đảm bảo chất lượng cao nhất: Every MODERATE or COMPLEX task is processed through 7 strict lifecycle gates to guarantee production-grade code quality:
System Metrics
Ràng Buộc Bảo Mật Security Constraints
Hệ thống tuân thủ nghiêm ngặt hiến pháp CONSTITUTION.md. Các hành vi hủy hoại code hoặc tự ý force push không được phép thực hiện mà không có sự đồng ý của người dùng. The system strictly obeys the project CONSTITUTION.md. Destructive actions, direct force pushes, or database drops are forbidden without explicit user approval.
AWKit cung cấp giao diện dòng lệnh mạnh mẽ để kiểm tra trạng thái hệ thống, cấu hình Model Registry và thiết lập thứ tự ưu tiên gán vai trò của sub-agents. AWKit provides a robust command-line interface to inspect system environments, set model registries, and configure routing prioritisations for sub-agents.
1. Chẩn đoán môi trường & Kiểm tra sức khỏe 1. Environment Diagnostics & Health Checks
Trước khi thực hiện bất kỳ thay đổi nào, bạn nên kiểm tra xem các binary và hiến pháp dự án đã được resolve đúng chưa: Before applying overrides, check whether environment paths and active rules are resolved correctly:
2. Cấu hình Model Registry 2. Model Registry Configuration
Model Registry lưu trữ thông tin về các endpoints, API key và capability profiles của mô hình hoạt động. The Model Registry stores configurations regarding backend endpoints, API keys, and model capability profiles.
3. Cấu hình Vai trò Logic (Model Roles) 3. Logical Role Prioritization
Gán các model vật lý vào các vai trò logic phục vụ cho Hybrid Orchestrator. Các giá trị cấu hình được lưu vào .project-identity và ~/.awkit/config.json.
Maps physical models to logical workflow roles. Settings are persisted in local configs and .project-identity.
4. Ví dụ Ủy nhiệm/Chạy trực tiếp Sub-agent (awkit exec) 4. Direct Sub-agent Delegation Examples
Sử dụng lệnh awkit exec để triệu hồi trực tiếp một sub-agent với model và timeout tùy chọn, kết hợp với các cấu hình lọc bối cảnh (ContextPack):
Invoke a dedicated sub-agent instantly using the awkit exec CLI command with targeted context configurations:
src/db.js thay vì nạp toàn bộ file thô.
Example 2: Requests refactoring from Qwen, packing only structural signatures of src/db.js instead of raw file contents.
Hệ thống AWKit vận hành thông qua sự hợp tác phân cấp giữa Main Agent (Orchestrator) đóng vai trò tổng chỉ huy và các Sub-agent (Designer, Reasoning, Runner, Audit) chịu trách nhiệm thực thi chuyên biệt. AWKit operates via hierarchical collaboration. The Main Agent acts as the central Orchestrator while specialized Sub-agents execute narrow-scope tasks.
1. Quy trình phối hợp giải quyết Task phức tạp (Symphony Flow) 1. Collaboration Loop for Complex Tasks (Symphony Flow)
[User Request]
│
▼
┌──────────────┐
│ Orchestrator │ (Gemini Flash)
│ (Triage) │ Create sub-tasks in task.md
└──────┬───────┘
├─────────────────────────┐
▼ ▼
┌──────────────┐ ┌──────────────┐
│ Designer │ (Luna) │ Reasoning │ (Fable/Sol)
│ (UI Assets) │ Mockups │ (SystemPlan) │ implementation_plan.md
└──────┬───────┘ └──────┬───────┘
│ │
└──────────┬──────────────┘
▼
┌──────────────┐
│ Runner │ (Qwen/Spark)
│ (Write Code) │ Edit file contents / Write logic
└──────┬───────┘
│
▼
┌──────────────┐
│ Audit │ (Fable/Sol)
│ (CodeReview) │ Lint check, run unit tests & commit
└──────────────┘
2. Ví dụ Hội thoại và Phân phối Tác vụ Thực tế 2. Real-World Dialogue & Automation Delegation Example
Dưới đây là kịch bản cụ thể mô phỏng một phiên làm việc thực hiện tính năng "Màn hình Đăng nhập (Login View)": Here is a step-by-step transcript of a session implementing a "Google Login Button & Flow":
1. Thiết kế assets/mockup nút Đăng nhập.
2. Lên kế hoạch cấu hình Firebase Auth.
3. Viết code giao diện và logic đăng nhập." "Task received. I am breaking it down into structured items:
1. Generate button UI assets/mockup.
2. Plan Firebase Auth setups.
3. Code view layout and auth hook logic."
# 1. Call Designer to draw assets
awkit exec -m gpt-5.6-luna -t 300 "Vẽ asset nút đăng nhập Google dạng grid 8x6 và lưu vào docs/design/"
# 2. Call Reasoning to outline plans
awkit exec -m fable -t 180 "Lập implementation_plan.md cho cấu hình Firebase Auth trong Expo"
# 3. Call Runner to implement code
awkit exec -m qwen -t 300 "Viết code giao diện Login.tsx sử dụng asset nút và Firebase Auth SDK"
# 4. Call Audit to perform code reviews
awkit exec -m fable -t 120 "Review mã nguồn Login.tsx tránh lộ API keys, chạy lint và tsc"
# 5. Commit changes automatically
awkit gate git auto "feat(auth): implement google login view and firebase integration"
Khi làm việc với các codebase lớn, dung lượng context bị phình to là nguyên nhân chính gây mất bối cảnh, lỗi logic và tăng chi phí API. AWKit áp dụng các cơ chế kỹ thuật nén token và tối ưu RAM cực độ cho Main Agent. When working inside large-scale codebases, large context payloads trigger model amnesia, bugs, and latency. AWKit implements technical context pruning to save token spaces.
1. Cơ chế Nén Context của AWKit (Context Compression Engine) 1. AWKit Context Compression Engine (CCE)
AWKit tự động thực hiện nén bối cảnh thông qua bộ lọc AST và các thuật toán tóm tắt để gom bối cảnh hội thoại và codebase lại thành các gói nhỏ gọn (ContextPack): AWKit automatically compresses raw histories and code modules using AST parsing and summarization pipelines into tight ContextPacks:
[Lịch sử chat / Raw History (60k tokens)] ────► [Caveman Compressor] ──► [Condensed History (3k tokens)]
│
[Mã nguồn thô / Raw Codebase (400k tokens)] ──► [AST Signature Filter] ──► [Code Signatures (5k tokens)] ──► [Optimized Prompt]
│
[Hiến pháp / System Guidelines] ─────────────► [RTK AST Compressor] ───► [Clean Rules (2k tokens)]
2. Các Cấp Độ Nén Token (Token Compression Levels) 2. Token Compression Levels
- RTK (Rust Token Killer): Là module tiền xử lý viết bằng Rust tích hợp sẵn trong pipeline gửi tin. RTK tự động phân tích mã nguồn (AST parsing), loại bỏ khoảng trắng thừa, dọn sạch bình luận code không liên quan, và nén cấu trúc JSON/XML trước khi gửi. Giúp tiết kiệm từ 20% - 30% tổng lượng token đầu vào. A Rust pre-processor module hooked in the compilation pipelines. RTK parses code syntax (AST), strips redundant spaces/tabs, formats braces, and cleans comments before API transmissions, saving 20% - 30% on input tokens.
- Caveman Mode (Lịch sử tối giản): Khi tổng số token lịch sử chat vượt quá 50% cửa sổ context của mô hình, Orchestrator tự động kích hoạt nén Caveman. Nó loại bỏ toàn bộ các câu chào hỏi xã giao, các đoạn giải thích văn bản dài dòng của AI, và chỉ giữ lại cấu trúc logic kỹ thuật thuần túy dưới dạng bullet points. Tiết kiệm lên tới 75% context hội thoại cũ. Automatically triggered when chat history exceeds 50% of the model context window. Caveman Mode strips conversational fluff, polite warnings, and wordy explanations from past messages, compressing histories into concise logic logs. Saves up to 75% on history context.
-
ContextPack Isolation (Cờ CLI):
Cho phép chạy lệnh cô lập hoàn toàn. Với cờ
--no-context, sub-agent sẽ không nhận bất kỳ lịch sử chat nào trước đó, chỉ nhận đúng chỉ thị hiện tại và tệp code mục tiêu, ngăn chặn hiện tượng phình to context. Khi dùng cờ--files, hệ thống chỉ trích xuất cấu trúc định nghĩa hàm/lớp thay vì nạp file thô. Provides absolute context boundaries. Adding the--no-contextflag feeds only the targeted files and immediate orders to sub-agents, preventing history spillover. When using the--filesflag, it reads class signatures and structures instead of loading the entire raw file.
3. Tối ưu hóa Bộ nhớ cho Main Agent (Memory Preservation) 3. Memory Preservation for Main Agent
-
Spec Digest Boundary (Ranh giới Spec):
Theo hiến pháp dự án, Main Agent TUYỆT ĐỐI CẤM đọc trực tiếp các tài liệu đặc tả thiết kế, API specs, hoặc log file có độ dài lớn hơn 200 dòng. Việc đọc file lớn trực tiếp sẽ làm đầy bộ nhớ ngắn hạn của mô hình, dẫn đến suy giảm khả năng tư duy logic.
Cơ chế xử lý: Main Agent tự động ủy nhiệm cho một sub-agent siêu nhẹ (Gemini Flash qua CLIagy) đọc file thô lớn, chắt lọc toàn bộ API contracts, hằng số, quy định UI và lưu thành bản tóm tắt cực gọn tạiscratch/digest-<spec_name>.md(< 80 dòng). Main Agent chỉ đọc file digest này để ra quyết định. Main Agents are **STRONGLY FORBIDDEN** from reading specs, designs, or log files exceeding **200 lines** directly. Bloating context degrades logical precision.
The Solution: The Orchestrator delegates a light agent (Gemini Flash viaagy) to read the raw files, distill API specs/UI rules, and write a compressed summary insidescratch/digest-<spec>.md(< 80 lines). The Main Agent reads only this tiny digest. - Brain Artifact Cleanup: Các file brainstorm tạm được cô lập trong thư mục session riêng (`brain/<projectId>/`) thay vì lưu rải rác ngoài workspace. Điều này giúp dọn sạch thư mục làm việc và tránh việc các công cụ scan vô tình nạp đệ quy các tài liệu rác vào context. Draft plans, critiques, and brainstorm outputs are boxed in a private session folder (`brain/<projectId>/`), keeping workspace clean and preventing indexing engines from feeding trash files back into prompt contexts.