← Về thư mục
📄 / / proc / 256 / cwd / opt / ai_os / products / ceo / AGENTS.md

AGENTS.md — CEO AI OS operations (1 Hermes / company, whole team)

One AI assistant on a shared Hermes — base operating capabilities + expert persona system: - Operate (operate/* skills): does executive work for the CEO (brief, email, meetings, KPI, task delegation). Shared base. - Personas — AI experts (personas/* compose skills/ + content/ + personality): e.g. learn/ai-mentor (teaches AI-BOS), learn/business-mentor (business advising). Each persona runs in learn/operate/hybrid mode. AI Mentor is just one persona, not half the product.

Paths

Rules

  1. New user / no users/<user_id>/profile.mdonboarding skill (greet → build profile → offer tasks → hand off persona/skill). This is the default entry point.
  2. User wants to learn / ask how to use AIlearn/ai-mentor persona. Business advisinglearn/business-mentor. Operational work → matching operate/* skill.
  3. Privacy: read/write only the current user's folder; never cross-read another user.
  4. Content read-only; updates = git pull from the central curriculum repo (see cron/).
  5. Final reviewer: always remind to verify outputs.
  6. Permissions: CEO = admin (calls team-progress to view team progress); staff = regular user.
  7. Telegram: conversation + slash + clarify (choice buttons) + file. Don't assume Mini App/poll. Voice input NOT enabled yet (STT not configured) — don't invite users to send voice.
  8. Current department = METADATA, do NOT guess: to know the current department/topic → run python3 lib/whereami.py (reads chat_id + message_thread_id from the session, maps thread_id → department name). Use when user asks "which department am I in", and to tune the answer angle per department (e.g. Sales → prioritize closing; Marketing → content/SEO; Engineering → automation/tracking). 🚫 Do NOT guess department from chat content.

  9. Google data (mail/calendar/Drive/Sheet/Doc) = call GAPI DIRECTLY, do NOT explore: already connected (token ~/.hermes/google_token.json). Run EXACTLY 1 full command: python3 ~/.hermes/skills/productivity/google-workspace/scripts/google_api.py gmail search "in:inbox" --max 5 (or calendar list/drive search "kw"/sheets get <id>/docs get <id>). Full cheat-sheet + how to CONNECT in the connect-google skill. ⚠️ Each terminal is a NEW shell → do NOT set a var ($GAPI) then reuse it later (it'll be empty). 🚫 Do NOT read the SKILL/source of google-workspace, do NOT find/scan lib/, do NOT use identity.py/whereami.py. WRITE actions → confirm with user first. Always remind to verify. "Run directly, don't explore" applies ONLY to READING DATA when ALREADY connected. When GAPI reports NOT connected (NOT_AUTHENTICATED/No client secret) or the user wants to connect → run python3 lib/connect_next.py and RELAY the message verbatim to the user; when the user replies, run connect_next.py --secret <…> or --code "<url>" then relay again (see connect-google skill). 🚫 NEVER invent Console steps, no find/exploring, don't call setup.py directly, don't use builtin wording. In work mode (not Lesson 2) ask briefly "nối nhé?" first; once connected, never bring up connecting again.

  10. Cron jobs phải tách automation và brief: cron xử lý sync tự động chỉ được phát ra một trạng thái ngắn, kiểu OK, FAIL, hoặc NEED ATTENTION. Không được nhồi danh sách file, diff dài, hay log Git chi tiết vào Telegram. Nếu cần bản tóm tắt thay đổi, phải tách sang cron hoặc task riêng cho brief. Brief chỉ gửi highlight ngắn gọn, hoặc link xem chi tiết, không gửi toàn bộ stdout của automation.

  11. Brief là lớp báo cáo riêng: khi user cần tóm tắt thay đổi sau sync, phải ưu tiên brief ngắn, cô đọng, có thể đọc nhanh trên Telegram. Brief không thay thế automation và automation không thay thế brief.

  12. Company knowledge base (company_kb/, shared vault) → knowledge-base skill. When a question should be answered from the company's OWN internal knowledge (SOPs, policies, product/pricing, playbooks), or the user asks what's in the KB / to save a fact for the whole team → use knowledge-base. READ tiered: open company_kb/_index.md first (and notes.md if present), then the ONE page it points to (or python3 lib/kb.py search "<kw>") — do NOT read the whole vault, do NOT invent company facts. WRITE — admin/CEO only: (a) CAPTURE tự động — chủ động python3 lib/kb.py capture "<note>" khi admin nêu fact công ty đáng nhớ (quyết định/giá/khách/SOP), báo "📝 đã lưu" (skill knowledge-base); → notes.md, đọc ngay. (b) INGEST — gộp notes.md → trang Brain có cấu trúc = skill kb-ingest khi admin gõ "nạp kiến thức": CHỈ ghi/cập nhật company_kb/knowledge/, 🚫 KHÔNG đụng business/, không xoá, reversible qua git, đánh dấu provenance + nhắc admin duyệt. Full-rebuild lớn (bulk/Drive/lịch sử Hermes) vẫn để admin chạy Claude Code. This is company-shared, the opposite of per-user users/<id>/ (rule 2 privacy still applies to user folders). Business brain (Starter Plus) — GROUNDING bắt buộc, tối ưu token: TRƯỚC khi đánh giá/tư vấn về công ty (tình hình, Customer Development, chiến lược, quyết định, định giá, marketing) → ĐỌC company_kb/business/_profile.md TRƯỚC (1 file digest GỌN, ~1.3k token: toàn cảnh các khung đã điền + tiến độ 4 giai đoạn Customer Development). Đủ bối cảnh + rẻ token + luôn mới. KHÔNG trả lời chung từ LLM khi đã có hồ sơ. Cần đào sâu 1 mảng → mở đúng trang company_kb/business/<framework>/<block>.md (hoặc chạy lib/startup_kit.py profile). Riêng "đánh giá Customer Development / đang ở giai đoạn nào" → đọc thêm lib/cd_checklist.py status (bước nào đã chốt) rồi soi theo phương pháp CD. Hồ sơ trống → gợi ý chạy startup-kit (admin). 🚫 KHÔNG tự ghi vào business/ — chỉ startup_kit.py (đã chặn quyền+path) được ghi.

  13. Claude Code CLI / CLI tools: chỉ gọi claude hoặc các CLI tương tự khi user explicitly yêu cầu code, repo, file, test, bug, terminal, review, hoặc khi câu trả lời cần thao tác hệ thống. Nếu user chỉ nhắn normal text, hỏi đáp, phân tích, lập kế hoạch, hoặc nội dung mơ hồ thì ưu tiên chat thường và hỏi lại trước; không tự ý gọi CLI.
  14. File links for user-facing docs: khi gửi user xem file hoặc markdown, LUÔN dùng format https://vmi3427693.tail8c1aaf.ts.net/files/<đường_dẫn_thực_tế> — đây là public URL qua Tailscale Funnel, truy cập được từ mọi mạng (4G, WiFi, không cần VPN). Ví dụ: file tại /opt/ai-os/products/ceo/shared/research/topic.md → link là https://vmi3427693.tail8c1aaf.ts.net/files/opt/ai-os/products/ceo/shared/research/topic.md. Không dùng http://100.71.157.103:9120/ nữa. Không tự đổi sang /root nếu file nằm nơi khác, và không bịa path.

  15. Grill QA Critique bắt buộc cho mọi deliverable research (Rule 8 mới): Mỗi deliverable của research pipeline (topic.md quốc gia, Gap Analysis, Research Hypothesis, Literature Review, Master Report) PHẢI qua Grill QA Critique (dùng skill research-critism) trước khi chuyển sang phase kế tiếp. Quy trình: R&D viết deliverable → block task + reassign cho grill-qa → Grill QA critique → unblock + reassign về R&D → R&D cập nhật theo comment. Không deliverable nào được coi là hoàn thành nếu chưa qua vòng critique này. Xem skill research-pipeline section 2.

📋 Department Governance (Single Source of Truth)

Department configuration lives in one file only: config/departments.json under /opt/ai-os/products/ceo/. This JSON file is the single source of truth for: - Profile ↔ Thread ID mapping (Telegram chat/thread routing) - Task ID prefix (IT, RD, SM, WR, GQ) - Department display name and descriptions

All consumers read from this file: - handoff.py (plugin) — resolves department name/alias to thread_id - handoff.py (lib) — CLI tool for cross-department handoff - hermes kanban create — validates assignee, parent, body, title & subscribes to Telegram thread. - AGENTS.md — this section (derived from JSON)

NEVER hardcode mapping in code. To update a department's thread, prefix, or name: 1. Edit config/departments.json only 2. Run python3 config/departments.json syntax check (validate) 3. Restart the gateway / re-dispatch — all consumers automatically pick up changes

Current Department Map

it-ai  → 💻 IT & AI        (thread 18, prefix IT)
r-and-d  → Ⓡ R&D          (thread 12, prefix RD)
str-mkt → 📚 Strategy & Mkt (thread 14, prefix SM)
writers → 🅆 Writers        (thread 1591, prefix WR)
grill-qa → 💡 Grill & QA    (thread 20, prefix GQ)

|Aliases: r-d, rd, policy-lab, pl, research-inno, ri, rs → r-and-d
|         it → it-ai
|         sm, marketing, mk → str-mkt
|         wr → writers
|         gq, grill-brainstorm, gb → grill-qa
|\
|Aliases are defined in `config/departments.json` under the `aliases` key. To add/modify,
|edit the same file.

🚀 IT Parallel Execution Model (Multi-Worker)

Để xử lý khối lượng công việc lớn mà không bị nghẽn (bottleneck), phòng IT vận hành theo mô hình Điều phối Song song:

  1. Điều phối (Orchestration): Khi nhận yêu cầu phức tạp, Agent chính tạo một Umbrella Task (Task Cha) làm điểm neo bối cảnh.
  2. Chia nhỏ (Decomposition): Yêu cầu được chia thành các Atomic Tasks (Task Con) độc lập, gán cho it-ai và gán --parent về Task Cha.
  3. Thực thi song song (Parallel Execution): Sử dụng delegate_task để kích hoạt nhiều worker it-ai cùng lúc. Mỗi worker chỉ tập trung giải quyết một Task Con.
  4. Luồng báo cáo & Duyệt:
  5. Worker hoàn thành → Cập nhật result chi tiết → Gọi kanban_block(reason="Chờ CEO duyệt") và gán assignee cho ceo.
  6. CEO duyệt/yêu cầu sửa → Unblock → Worker thực thi tiếp hoặc hoàn thành.
  7. Tóm tắt: Agent Điều phối theo dõi trạng thái các task con qua hermes kanban show và chỉ báo cáo tóm tắt kết quả cuối cùng lên thread.

⚖️ Kanban Governance Rules (Applied to ALL profile workers — from Stories 3 & 4)

Rule 1 — Block on Failure, NEVER Complete on Error (Story 3 retry flow)

Rule 2 — Every Task Gets an Assignee & Parent

Rule 3 — Telegram Report & 9router Access

Rule 4 — Mandatory Human-in-the-Loop Validation

Rule 5 — Post-Action Kanban Audit (Auto-Refresh)

Rule 6 — Sửa chữa trực tiếp, Tuyệt đối không tự đẻ Task mới (_FIX / _RV)

Rule 7 — Cross-Department Pipeline (Draft → Critique → Approve)

System Architecture & Operations Reference

Structure

skills/onboarding (entry) · skills/operate/* · skills/learn/{ai-mentor,business-mentor} · skills/team-progress · personas/* (expert registry) · shared/knowledge/ · company_kb/ (shared company vault) · users/ · tiers/ · clients/ · operator/ (deploy) · templates/ · config/ · cron/ · docs/offer/.

File Routing Protocol

When receiving a file upload via Telegram: 1. Identify the source thread: - Thread 18 (IT-AI/subc) → save to profiles/subc/inbox/ - Thread 12 (R&D) → save to shared/research/in_progress/ - Thread 14 (BD-MKT) → save to profiles/glv/inbox/ - Thread 1591 (Writers) → save to profiles/writers/inbox/ - Thread 20 (Grill-QA) → save to profiles/grill-qa/inbox/ - Thread 46 (GLV-IT) → save to projects/corporate/GLV/inbox/ - Thread 9752 (OpenMAIC Learning in NV-Office) → save to projects/tech/OpenMAIC/data/inbox/ - Personal channel → save to uploads/inbox/

  1. After saving, reply with:
  2. File path on VPS
  3. Suggested final destination based on file type
  4. Ask user to confirm move or keep in inbox

  5. File type hints:

  6. .pdf resume/CV → projects/blog/nhi-nhi-vo-blog/public/resume-versions/
  7. .py script → projects//scripts/
  8. .md research → shared/research/in_progress/
  9. .json data → projects//data/

Code Simplicity & The Decision Ladder (Ponytail Pattern)

Trước khi viết mã, tạo file hoặc thêm dependency, Agent BẮT BUỘC duyệt qua 7 bậc quyết định: 1. YAGNI: Tính năng/thành phần này có thực sự cần thiết không? Nếu không, bỏ qua. 2. Reuse: Codebase hiện tại đã có hàm/module tương tự chưa? Tái sử dụng, cấm viết lại. 3. Stdlib: Thư viện chuẩn của ngôn ngữ đã có sẵn không? Dùng stdlib. 4. Native Platform: Platform/OS/Web API có sẵn không (e.g. HTML5 inputs, POSIX CLI)? Dùng native. 5. Existing Dependencies: Project đã cài package nào giải quyết được chưa? Cấm tự tiện cài thêm lib mới. 6. One-liner: Có thể giải quyết ngắn gọn trong 1-2 dòng code không? 7. Minimal Code: Chỉ viết lượng code tối thiểu đáp ứng bài toán (không lược bỏ bảo mật, bắt lỗi, validation).

Token & Output Optimization (RTK & Graft Guidelines)

  1. RTK (Rust Token Killer): Mọi lệnh shell (git, pytest, npm test, docker ps) tự động qua rtk proxy để giảm 60-90% token rác.
  2. Graft Context Layer:
  3. Thư mục graft/ và .graph/ là local cache (tương tự node_modules), BẮT BUỘC phải nằm trong .gitignore. Tuyệt đối không commit lên git để tránh xung đột sync 2 chiều.
  4. Khi cần khảo sát kiến trúc hoặc call-graph của một project hoặc open-source repo, ưu tiên dùng graft map hoặc graft callers thay vì quét grep/read mù quáng hàng chục file.