Bỏ qua để đến nội dung

Kiến trúc

Bestie là runtime local-first, tự host được. Cùng một runtime core phục vụ terminal chat, Telegram, UI local tương lai, MCP và các extension sau này.

User / Channel
-> Channel Adapter
-> Runtime Orchestrator
-> Mode Detector
-> Memory Router
-> Prompt Builder
-> LLM Adapter
-> Safety / Permission Layer
-> Tool / Plugin / MCP Router
-> Response
-> Logs + Memory Update

CLI sở hữu các lệnh user-facing:

  • onboard
  • chat
  • status
  • logs
  • doctor
  • memory
  • telegram
  • tools
  • mcp

CLI nên gọi runtime services, không duplicate business logic.

Một turn đi qua các bước:

  1. Nhận message từ terminal, Telegram hoặc adapter khác.
  2. Load config, env, character files và memory context.
  3. Build prompt.
  4. Gọi OpenAI-compatible LLM.
  5. Chạy tool loop nếu được phép.
  6. Gửi response.
  7. Lưu logs đã redact và memory updates được duyệt.

Bestie load character từ file local như character.json, system-prompt.md, style examples và safety boundaries.

Mục tiêu là một AI best friend có cá tính: hài, thẳng, biết quan tâm, có thể phản biện nhưng không hạ nhục người dùng.

Memory hiện tại dùng SQLite local. Nó lưu active memories, pending memories, terminal/Telegram messages, pause state và pending approvals.

Zep có thể được thêm sau như lớp memory nâng cao, nhưng không nên thay thế character files hoặc memory controls local.

Mọi hành động ngoài text reply nên được phân loại:

  • read-only
  • local write
  • external write
  • public action
  • destructive
  • money/payment
  • unknown

Bestie bắt đầu với internal read tools và MCP read-only đã classify. Các hành động rủi ro hơn cần permission UX, logs và approval rõ ràng.