PK Init: Khởi tạo + cập nhật objective, tools, constraints
SOT chính: objective.md và tools.md.
Modes
| Mode |
Trigger |
Mô tả |
new |
Chưa có .cockpit/ |
Tạo toàn bộ cấu trúc + SCHEMA.md + registries |
update-objective |
Sửa objective/KR/KI/start_date/end_date/capacity/budget/gaps_risks |
Sửa objective.md |
update-tools |
Sửa tools (thêm/bỏ công cụ) |
Sửa tools.md |
SOT quyền ghi
| File |
Fields |
| objective.md |
Objective text, KR/KI targets, start_date, end_date, status, capacity, budget, gaps_risks, type, review_cycle |
| tools.md |
Bảng tools 4 cột |
| SCHEMA.md |
Chỉ khi mode new (tạo lần đầu) |
| schema-signals.md |
Chỉ khi mode new (tạo lần đầu) |
| AGENTS.md block |
Tạo lần đầu (mode new); regenerate là việc pk-lint |
Subset của bảng canonical ../pk-shared/references/sot-ownership.md.
Nguyên tắc
- Hỏi từng câu một, không hàng loạt.
- BẮT BUỘC confirm bảng trước ghi. Ngoại lệ: khi nhận payload
pre_confirmed: true từ pk-track (delegate protocol), SKIP confirm, ghi ngay; vẫn hiển thị block lý do + diff + (Đã được confirm tại track. Ghi ngay.). Xem Delegate Protocol tại ../pk-shared/references/cross-call-rules.md.
- Quality Gate 3 câu trước mỗi follow-up (
../pk-shared/references/quality-gate.md).
- Snapshot Contract (
../pk-shared/references/snapshot-contract.md):
- Mode
new: KHÔNG ensure snapshot (.cockpit/ chưa tồn tại, đây là bước tạo cấu trúc). Marker SNAPSHOT_LOADED chưa cần.
- Mode
update-objective / update-tools: cần ensure snapshot trước khi đọc objective.md/tools.md (theo Snapshot Contract, mục "Nguyên tắc idempotent"). Phiên chưa có marker → tự nạp full rồi đặt marker.
- Solo only: 1 user, 1 objective.
- Đề xuất + lý do, user quyết.
Flow: mode new
Bước 1: Tạo cấu trúc thư mục
mkdir -p .cockpit/{actions,inbox,raw,log,archive/{actions,inbox,knowledge,skills,workflows},knowledge,skills,workflows}
Bước 2: Sinh SCHEMA.md
Chứa quy ước dữ liệu:
- Cấu trúc thư mục
.cockpit/
- Quy ước naming (actions: AXXX-slug.md, inbox: YYYY-MM-DD-HHmm-slug.md, knowledge: {type}-{slug}.md, log: YYYY-MM-DD.md)
- Wiki page types (6 types: decision, pattern, concept, troubleshooting, lesson, resource)
- Frontmatter bắt buộc theo loại file
Nội dung khởi tạo sinh theo quy ước canonical: ../pk-shared/references/schemas.md.
Bước 3: Sinh registries rỗng
knowledge/index.md: bảng 8 cột (Slug, Type, Title, Tags, Status, Pinned, Usage, Updated)
skills/registry.md: bảng 6 cột (Skill, Mô tả, Khi nào dùng, Version, Tags, Cập nhật)
workflows/registry.md: bảng 7 cột (Workflow, Mô tả, Khi nào dùng, Skills dùng, Version, Tags, Cập nhật)
schema-signals.md: header + 2 section (Đang chờ xử lý / Đã xử lý)
Bước 4: Hỏi tools
Hỏi user: "Dự án dùng công cụ gì? (CLI, MCP, API, manual)". Ghi vào tools.md theo format canonical tại ../pk-shared/references/schemas.md (tools.md format).
Bước 5: Hỏi objective (OPTIONAL)
Hỏi user: "Mục tiêu dự án là gì? (Bỏ qua nếu chưa sẵn sàng, chạy knowledge-only mode)".
Nếu user cung cấp:
- Thu thập objective text + KR/KI
- Hỏi
start_date và end_date (ngày bắt đầu và kết thúc kỳ)
- Hỏi
capacity (giới hạn năng lực), budget (ngân sách), gaps_risks (khoảng trống/rủi ro), ghi vào 3 field riêng
- Hỏi
type: project hoặc ongoing. Nếu ongoing, hỏi tiếp review_cycle (đề xuất 14 ngày)
- Ghi
objective.md
Nếu user skip:
- Tạo
objective.md rỗng (chỉ frontmatter status: empty)
- KHÔNG tạo
plan.md
- Hệ thống hoạt động ở knowledge-only mode
Nội dung objective.md sinh theo format canonical tại ../pk-shared/references/schemas.md (Objective file format).
Bước 6: Attach hướng dẫn vào AGENTS.md
Ghi block hướng dẫn vào AGENTS.md tại root workspace theo format canonical ../pk-shared/references/schemas.md (mục "AGENTS.md block format").
- Bao block bằng marker
<!-- personal-assistant:start --> / <!-- personal-assistant:end -->.
- Idempotent: chưa có file → tạo mới; có file chưa marker → append; có marker → replace giữa hai marker. (Chi tiết quy tắc ghi: xem canonical.)
- Nội dung: mô tả nhiệm vụ tổng thể hệ Project Cockpit + 6 dòng
@.cockpit/... auto-load + 3 mục hành vi ambient (### Tự capture..., ### Dùng lại..., ### Nhắc xử lý inbox) — đầy đủ theo canonical, ≤ 45 dòng giữa marker. KHÔNG copy description per-skill.
- KHÔNG tạo/sửa CLAUDE.md. Việc nối
CLAUDE.md → AGENTS.md (để Claude Code expand @) thuộc về user.
Flow: mode update-objective
- Đọc objective.md hiện tại
- Hỏi user thay đổi gì
- Quality Gate mỗi follow-up
- Confirm bảng diff
- Trước khi ghi đè body: đọc body hiện tại (bất biến:
../pk-shared/references/snapshot-contract.md, mục "Bất biến đọc body trước khi ghi body"). Ghi file.
Flow: mode update-tools
- Đọc tools.md hiện tại
- Hỏi user thay đổi gì
- Confirm
- Trước khi ghi đè body: đọc body hiện tại (bất biến:
../pk-shared/references/snapshot-contract.md, mục "Bất biến đọc body trước khi ghi body"). Ghi file.
Quy tắc
- KHÔNG ghi file trước confirm (trừ pre_confirmed: xem Ngoại lệ ở Nguyên tắc).
- KR không SMART → chỉ rõ thiếu gì + gợi ý sửa.
- Không tạo plan.md hay action files (việc pk-plan).
- Không sửa action status (việc pk-track).
- Không tạo/sửa knowledge pages (việc pk-distill).
1---2name: pk-init3description: Khởi tạo dự án mới hoặc sửa KR target/mục tiêu/constraints/tools (cấu trúc mục tiêu). Tạo cấu trúc .cockpit/ lần đầu. Dùng khi user bắt đầu dự án từ đầu, sửa OKR, thêm/bớt công cụ, thay đổi constraints, hoặc cần thiết lập lại mục tiêu. KHÔNG dùng khi cập nhật KR current tiến độ hàng ngày (dùng pk-track).4---56# PK Init: Khởi tạo + cập nhật objective, tools, constraints78SOT chính: `objective.md` và `tools.md`.910## Modes1112| Mode | Trigger | Mô tả |13| --- | --- | --- |14| `new` | Chưa có `.cockpit/` | Tạo toàn bộ cấu trúc + SCHEMA.md + registries |15| `update-objective` | Sửa objective/KR/KI/start_date/end_date/capacity/budget/gaps_risks | Sửa objective.md |16| `update-tools` | Sửa tools (thêm/bỏ công cụ) | Sửa tools.md |1718## SOT quyền ghi1920| File | Fields |21| --- | --- |22| objective.md | Objective text, KR/KI targets, start_date, end_date, status, capacity, budget, gaps_risks, type, review_cycle |23| tools.md | Bảng tools 4 cột |24| SCHEMA.md | Chỉ khi mode new (tạo lần đầu) |25| schema-signals.md | Chỉ khi mode new (tạo lần đầu) |26| AGENTS.md block | Tạo lần đầu (mode new); regenerate là việc pk-lint |2728> Subset của bảng canonical `../pk-shared/references/sot-ownership.md`.2930## Nguyên tắc3132- Hỏi từng câu một, không hàng loạt.33- BẮT BUỘC confirm bảng trước ghi. **Ngoại lệ**: khi nhận payload `pre_confirmed: true` từ pk-track (delegate protocol), SKIP confirm, ghi ngay; vẫn hiển thị block lý do + diff + `(Đã được confirm tại track. Ghi ngay.)`. Xem Delegate Protocol tại `../pk-shared/references/cross-call-rules.md`.34- Quality Gate 3 câu trước mỗi follow-up (`../pk-shared/references/quality-gate.md`).35- **Snapshot Contract** (`../pk-shared/references/snapshot-contract.md`):36 - Mode `new`: KHÔNG ensure snapshot (.cockpit/ chưa tồn tại, đây là bước tạo cấu trúc). Marker `SNAPSHOT_LOADED` chưa cần.37 - Mode `update-objective` / `update-tools`: cần ensure snapshot trước khi đọc objective.md/tools.md (theo Snapshot Contract, mục "Nguyên tắc idempotent"). Phiên chưa có marker → tự nạp full rồi đặt marker.38- Solo only: 1 user, 1 objective.39- Đề xuất + lý do, user quyết.4041## Flow: mode new4243### Bước 1: Tạo cấu trúc thư mục4445```bash46mkdir -p .cockpit/{actions,inbox,raw,log,archive/{actions,inbox,knowledge,skills,workflows},knowledge,skills,workflows}47```4849### Bước 2: Sinh SCHEMA.md5051Chứa quy ước dữ liệu:52- Cấu trúc thư mục `.cockpit/`53- Quy ước naming (actions: AXXX-slug.md, inbox: YYYY-MM-DD-HHmm-slug.md, knowledge: {type}-{slug}.md, log: YYYY-MM-DD.md)54- Wiki page types (6 types: decision, pattern, concept, troubleshooting, lesson, resource)55- Frontmatter bắt buộc theo loại file5657Nội dung khởi tạo sinh theo quy ước canonical: `../pk-shared/references/schemas.md`.5859### Bước 3: Sinh registries rỗng6061- `knowledge/index.md`: bảng 8 cột (Slug, Type, Title, Tags, Status, Pinned, Usage, Updated)62- `skills/registry.md`: bảng 6 cột (Skill, Mô tả, Khi nào dùng, Version, Tags, Cập nhật)63- `workflows/registry.md`: bảng 7 cột (Workflow, Mô tả, Khi nào dùng, Skills dùng, Version, Tags, Cập nhật)64- `schema-signals.md`: header + 2 section (Đang chờ xử lý / Đã xử lý)6566### Bước 4: Hỏi tools6768Hỏi user: "Dự án dùng công cụ gì? (CLI, MCP, API, manual)". Ghi vào `tools.md` theo format canonical tại `../pk-shared/references/schemas.md` (tools.md format).6970### Bước 5: Hỏi objective (OPTIONAL)7172Hỏi user: "Mục tiêu dự án là gì? (Bỏ qua nếu chưa sẵn sàng, chạy knowledge-only mode)".7374Nếu user cung cấp:75- Thu thập objective text + KR/KI76- Hỏi `start_date` và `end_date` (ngày bắt đầu và kết thúc kỳ)77- Hỏi `capacity` (giới hạn năng lực), `budget` (ngân sách), `gaps_risks` (khoảng trống/rủi ro), ghi vào 3 field riêng78- Hỏi `type`: project hoặc ongoing. Nếu ongoing, hỏi tiếp `review_cycle` (đề xuất 14 ngày)79- Ghi `objective.md`8081Nếu user skip:82- Tạo `objective.md` rỗng (chỉ frontmatter `status: empty`)83- KHÔNG tạo `plan.md`84- Hệ thống hoạt động ở knowledge-only mode8586Nội dung `objective.md` sinh theo format canonical tại `../pk-shared/references/schemas.md` (Objective file format).8788### Bước 6: Attach hướng dẫn vào AGENTS.md8990Ghi block hướng dẫn vào `AGENTS.md` tại root workspace theo format canonical `../pk-shared/references/schemas.md` (mục "AGENTS.md block format").9192- Bao block bằng marker `<!-- personal-assistant:start -->` / `<!-- personal-assistant:end -->`.93- Idempotent: chưa có file → tạo mới; có file chưa marker → append; có marker → replace giữa hai marker. (Chi tiết quy tắc ghi: xem canonical.)94- Nội dung: mô tả nhiệm vụ tổng thể hệ Project Cockpit + 6 dòng `@.cockpit/...` auto-load + 3 mục hành vi ambient (`### Tự capture...`, `### Dùng lại...`, `### Nhắc xử lý inbox`) — đầy đủ theo canonical, ≤ 45 dòng giữa marker. KHÔNG copy description per-skill.95- KHÔNG tạo/sửa CLAUDE.md. Việc nối `CLAUDE.md → AGENTS.md` (để Claude Code expand `@`) thuộc về user.9697## Flow: mode update-objective98991. Đọc objective.md hiện tại1002. Hỏi user thay đổi gì1013. Quality Gate mỗi follow-up1024. Confirm bảng diff1035. Trước khi ghi đè body: đọc body hiện tại (bất biến: `../pk-shared/references/snapshot-contract.md`, mục "Bất biến đọc body trước khi ghi body"). Ghi file.104105## Flow: mode update-tools1061071. Đọc tools.md hiện tại1082. Hỏi user thay đổi gì1093. Confirm1104. Trước khi ghi đè body: đọc body hiện tại (bất biến: `../pk-shared/references/snapshot-contract.md`, mục "Bất biến đọc body trước khi ghi body"). Ghi file.111112## Quy tắc113114- KHÔNG ghi file trước confirm (trừ pre_confirmed: xem Ngoại lệ ở Nguyên tắc).115- KR không SMART → chỉ rõ thiếu gì + gợi ý sửa.116- Không tạo plan.md hay action files (việc pk-plan).117- Không sửa action status (việc pk-track).118- Không tạo/sửa knowledge pages (việc pk-distill).