Bắt Đầu Nhanh Getting Started

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ẹo: Tip: AWKit hoạt động theo phương châm tự động hóa. Khi bạn ra lệnh bằng tiếng Việt hoặc tiếng Anh trong chat, Orchestrator sẽ tự động chạy các Gates phù hợp. AWKit acts as an automation driver. When you issue prompt directives, the Orchestrator will automatically trigger the appropriate quality Gate.

Quy trình 7 Cổng (7-Gate System) 7-Gate System Workflow

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:

Gate 1: Spec Design Opus
Phân tích yêu cầu, thống nhất đầu ra và lập file BRIEF.md sơ bộ. Analyze requirements, align on outputs, and draft preliminary BRIEF.md.
Gate 1.5: Module Spec Opus
Lập hồ sơ validation, các edge-cases và flow người dùng chi tiết trước khi code. Map validation bounds, edge cases, and user flow specifications before coding.
Gate 2: Architecture & Contracts Opus
Thống nhất DB Schema, API contracts, cấu trúc các hàm và kiểm duyệt rủi ro. Align DB schemas, API contracts, class signatures, and assess downstream impact.
Gate 2.5: Visual & UI Mockup Designer
Tạo spritesheet, mockup UI và visual flow. Generate spritesheets, UI mockup mock-data, and visual design assets.
Gate 3: Symphony Ticket Separation Opus
Xé nhỏ công việc thành các task chi tiết trong task.md và nạp vào DB Symphony. Decompose the plan into structured, component-level tasks in task.md and sync to DB.
Gate 4: Three-Phase Execution Runner
Code theo 3 giai đoạn: Infra → UI Shell (mock data) → Logic (real data) có chốt kiểm thử giữa các chặng. Code sequentially: Infra → UI Shell (mocks) → Logic (real APIs), verifying after each phase.
Gate 5: Safety Audit & Complete Audit
Chạy build, verify chất lượng, auto-commit và lập báo cáo walkthrough.md tổng kết. Run static tests, compile sanity checks, execute auto-commit, and document walkthrough.md.

System Metrics

Symphony Engine Active
Total Skills Load 124 Active
Primary Orchestrator Gemini 3.5 Flash
Reasoning Engine Claude Fable 5
Runner Model Qwen Code / Spark

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.

Cấm tự ý chỉnh sửa file hiến pháp gốc. Never edit the root constitution files without order.

Hướng dẫn Cấu hình AWKit CLI đầy đủ AWKit CLI Comprehensive Configuration Guide

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:

awkit env Hiển thị thông tin môi trường chi tiết bao gồm resolved path của các CLI binaries (claude, codex, qwen, agy), trạng thái Project Constitution. Displays runtime shell parameters, resolved binary execution paths (claude, codex, qwen, agy), and active project constitution links.
awkit doctor Quét sức khỏe toàn bộ hệ thống (workflows, schemas, active configs) để đảm bảo không bị lỗi cấu trúc. Performs static verification checks (validates workflows, schemas, and config files) to ensure stable environment states.

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.

awkit model list Liệt kê tất cả các model đã đăng ký trong registry và live status của chúng (online/offline). Lists all models defined in the registry along with their real-time latency and connectivity status.
awkit model ping gpt-5.6-sol Kiểm tra kết nối và độ trễ phản hồi (latency) của một model cụ thể trong registry. Pings a specific model endpoint to test responsiveness and active network configurations.

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~/.awkit/config.json. Maps physical models to logical workflow roles. Settings are persisted in local configs and .project-identity.

awkit config set automation.multiAgent.models.runner "['qwen', 'spark', 'flash']" Cấu hình danh sách ưu tiên cho vai trò runner (Agent viết/sửa code). Khi model đầu bị lỗi hoặc hết quota, hệ thống sẽ tự động fallback sang model tiếp theo. Sets priority list for the runner role (write/edit code). If the primary candidate hits quota or fails, the orchestrator fallbacks down the list.
awkit config set automation.multiAgent.models.reasoning "['fable', 'sol']" Cấu hình danh sách ưu tiên cho vai trò reasoning (Agent lập kế hoạch, phân tích thiết kế kiến trúc). Configures the priority list for the reasoning role (structural designs, architecture plans).
awkit config set automation.multiAgent.models.designer "['luna']" Cấu hình vai trò designer chuyên trách tạo visual assets, mockup UI (mặc định: gpt-5.6-luna). Sets model for the designer role (mockups, visual assets; defaults to gpt-5.6-luna).

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:

awkit exec -m gpt-5.3-codex-spark -t 300 --no-context "Viết test case cho database service" Ví dụ 1: Gọi Spark viết code trong môi trường cô lập, hoàn toàn không nạp bối cảnh hội thoại cũ để tiết kiệm tối đa token. Example 1: Delegates coding task to Spark with 300s timeout under absolute clean environment, skipping chat history to save tokens.
awkit exec -m qwen -t 200 --files src/db.js "Refactor hàm getQuery" Ví dụ 2: Gọi Qwen refactor code, chỉ nạp cấu trúc/chữ ký hàm của tệp 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.
awkit exec -m fable -t 180 --context-summary "Tìm giải pháp thiết kế cho tính năng thanh toán" Ví dụ 3: Gọi Claude Fable phân tích hệ thống, ép buộc mô hình tóm tắt nén toàn bộ lịch sử hội thoại trước khi nạp vào context. Example 3: Calls Claude Fable, forcing the compiler to compress chat logs into a bullet-point digest before evaluation.

Mô hình Tác tử Phối Hợp (Multi-Agent Symphony) Multi-Agent Symphony Model

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":

👤 Người dùng: 👤 User: "Thiết kế và lập trình giao diện Đăng nhập bằng Google cho ứng dụng Expo." "Design and code a Google login button and workflow inside my Expo mobile application."
🤖 Orchestrator (Main Agent - Flash): "Tôi đã tiếp nhận yêu cầu. Tôi sẽ phân rã thành các task sau:
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."
⚙️ Lệnh CLI tự động chạy: CLI Commands Run Automatically:
# 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"
                
👤 Người dùng: 👤 User: "[Đồng ý với kế hoạch]" "[Approves Plan]"
🤖 Orchestrator (Main Agent - Flash): "Tiến hành code và kiểm định an toàn:" "Initiating code write and security checkpoints:"
⚙️ Lệnh CLI tự động chạy: CLI Commands Run Automatically:
# 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"
                

Tối ưu hóa Token và Bộ nhớ (Context Engineering) Token & Memory Compression (Context Engineering)

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-context flag feeds only the targeted files and immediate orders to sub-agents, preventing history spillover. When using the --files flag, 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 CLI agy) đọ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ại scratch/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 via agy) to read the raw files, distill API specs/UI rules, and write a compressed summary inside scratch/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.