logiSA 2.0 / DOCS

Design baseline · 24 SEP 2026 · 22 / 23

Patterns, rules & cookbook

Những quy tắc bắt buộc khi thêm một năng lực mới.

RuleCách áp dụng
R01 · Tenant everywhereTenant trong PK/FK, repository filter, cache key, RAG, trace context và integration scope. Không tin tenant từ client.
R02 · Database is truthRole dùng chung facts; memory có provenance/TTL. Chỉ validator/orchestrator commit.
R03 · Version everything executablePin role/skill/flow/task schema/context policy khi plan; active run không đọc latest config tùy ý.
R04 · At-least-once + idempotencyKhông hứa exactly-once từ provider. Inbox/outbox + stable keys + receipts + reconciliation.
R05 · No role-to-role callsStructured result → orchestrator → next task. Causal chain luôn truy vết được.
R06 · AI output is a proposalParse schema, validate references, enforce permissions, business rules và state CAS.
R07 · No arbitrary flow codeTyped blocks và allowlisted conditions/mappings. Tool registry giới hạn executor.
R08 · Evidence before confidenceConfidence model không đủ để VERIFIED; cần field validation, provenance và expected-data checks theo policy.
R09 · Bounded workBudget token/tool calls, timeouts, retries, context và ảnh có giới hạn cấu hình; exhausted → FAILED với reason và audit.
R10 · Public docs, private operationsVí dụ giả; không publish credentials, Zalo IDs thật, Sheet links thật hay ảnh khách hàng.

Cookbook A · Thêm task type

  1. Viết story, input/result schemas, invariants và error codes.
  2. Đăng ký task type và allowed roles; thêm context profile tối thiểu.
  3. Chọn skill đơn hoặc flow version; khai báo quyền tool/integration.
  4. Thêm positive/negative dispatcher fixtures và business acceptance.
  5. Publish cấu hình tenant pilot; kiểm tra trace, review, retry và receipt trước mở rộng.

Cookbook B · Thêm skill

  1. Chốt typed input/output và evidence contract; chọn CODE/AI/HYBRID.
  2. Tách pure business logic khỏi adapter IO; inject tools qua ports.
  3. Ghi timeout, retryable errors, idempotency semantics, side effects và compensation.
  4. Test output schema, permission denied, dependency failure và duplicate execution.
  5. Tạo version mới; không sửa version đang được instance tham chiếu.

Cookbook C · Thêm kênh hoặc MCP

  1. Map provider payload sang InboundEvent và provider receipt sang DeliveryReceipt.
  2. Resolve tenant/session; durable inbox trước ACK; redaction logs.
  3. Chuẩn hóa tool schemas và secret reference; limit tải ảnh/URL và request timeout.
  4. Test outage/replay/out-of-order/UNKNOWN; chỉ enable khi có credentials thật và scoped acceptance.

Definition of done

Mỗi thay đổi có schema/contract, migration additive khi cần, tests cho invariant thực tế, trace IDs, UI failure states và cookbook update. Một demo happy path hoặc model trả JSON đúng chưa đủ chứng minh workflow chạy bền vững.

logiSA 2.0 · Public development cookbook · Design target; implementation status in Delivery.