Tổng hợp toàn bộ thảo luận ngày 17/06/2026 — đánh giá spec-17-jun + thiết kế feature share proposal kèm hội thoại. Tài liệu review trước khi sang /ck:plan.
Spec nêu 2 vấn đề: (1) workflow động — quản lý như package, customize qua markdown; (2) generic output + share/merge giữa nhiều người.
| # | Chủ đề | Lựa chọn |
|---|---|---|
| E1 | Scope / sequencing | Phased: engine → generic output → collab merge. Layer phụ thuộc nhau, không làm song song. Mỗi layer 1 plan riêng. |
| E2 | Vai trò Markdown | Markdown = lớp authoring → LLM compile ra JSON graph; engine execute graph deterministic. Giữ approval gate / branch / state. Refine, không phá quyết định 260610. |
| E3 | Merge đa người | Partition ownership + suggestion accept/reject (tái dùng đồ đã build). KHÔNG CRDT/Google-Docs (YAGNI, khó audit). |
| E4 | Đóng gói | Internal module packages/workflow-engine trong monorepo; extract npm chỉ khi có consumer thứ 2 thật. |
proposalState JSONB + proposal_sections → output container validate bằng JSON SchemaPO tham chiếu "share như Claude/Codex", nhưng mô tả thực tế là live collab trên artifact — không phải snapshot của Claude.
| # | Chủ đề | Lựa chọn |
|---|---|---|
| S1 | Session ↔ proposal | N session/proposal (mỗi user 1). Transcript A share read-only. ⚠️ Reversal đảo thiết kế 260610-1313 (đang 1 shared thread) — user xác nhận chủ động đổi. |
| S2 | Quyền xem transcript | Transcript session của sharer thành read-only với recipient; scope theo proposal collaborator, nội bộ tenant. B không bao giờ ghi vào thread của A. |
| S3 | Quyền edit khi share | Sharer chọn lúc share: handoff (reassign current_assignee→B) HOẶC reviewer (B suggest, A accept/reject). |
| S4 | Share cho ai | Nội bộ tenant (recipient là user có account). Public/external link out-of-scope. |
| S5 | Scope | Proposal/workflow thread trước. Share general chat_ui để sau. |
Ví dụ: A làm proposal tới bước technical_proposal rồi share cho B.
technical_proposalproposal_collaborators, notifications.getDetail). Hiểu state được build ra sao.current_assignee → edit proposal trực tiếp, serialize bằng lock_version.proposal_suggestions (replace_section / json_patch) → A accept/reject.base_section_updated_at) nếu state đã dịch chuyển.Phần lớn capability đã có sẵn từ các plan trước; chỉ 2 thứ thật sự mới.
| Capability | Trạng thái | Nguồn |
|---|---|---|
| Add B làm collaborator (role, permission) | ✅ Reuse | proposal_collaborators + collaboration controller |
| Notify B | ✅ Reuse | notifications + proposal-assignment-notifications |
| B xem state proposal hiện tại | ✅ Reuse | getDetail (workspace+steps+sections) |
| Handoff (reassign current_assignee) | ✅ Reuse | proposal-reassign-via-chat · PROPOSAL_ASSIGN_ENABLED |
| Reviewer (suggest + accept/reject + staleness) | ✅ Reuse | proposal_suggestions |
| Serialize writes | ✅ Reuse | lock_version optimistic lock |
| B đọc read-only transcript của A (cross-user) | 🆕 New | Hiện sessions.service chặn mọi cross-user read |
| N session/proposal (mỗi user 1) | 🆕 New | Relax UNIQUE index uq_chat_sessions_active_proposal_erp |
(proposal, user) thay vì / proposal. Migration + cập nhật _journal.json.sessions.service: collaborator được READ (không bao giờ WRITE) messages của session bound-proposal của người khác. Scope tenant + collaborator.Cần xử lý lúc planning, đặc biệt phần đụng tới code đang chạy.
findOrCreateForChannel + canonical-session binding + mọi reader của activeProposalId TRƯỚC khi migrate.base_section_updated_at) → đánh dấu stale, không apply mù.chat_ui thường (đắt: rework single-owner stack) để sau.Feature share này ship ĐỘC LẬP với workflow engine — proposal collab đã tồn tại nên không bị block bởi Layer 1/2/3. Về mặt khái niệm, nó là share/invite gesture mà Layer 3 sau này sẽ generalize cho mọi workflow output.
Khi sẵn sàng, handoff sang plan (nghiêng --tdd vì sửa code critical: access gate + session binding):
/ck:plan --tdd plans/reports/brainstorm-260617-share-proposal-conversation.md