Files
solution-erp/.claude/commands/fable-clone.md
pqhuy1987 00a1c67e55 [CLAUDE] Infra: W2 GOP-1-COMMIT - San-1 gate + PA-2a + roster 12->14 (2 monitor H24) + h24_cadence + counter + STATUS 2 row
Wave adap-6-broadcast W2 = 1 OWNER / 1 COMMIT co chu dich. Cac manh phu-thuoc nhau, tach ra la vo
duong dang chay (R2-C3): gate o W2 ma co o W3 => moi /fable-clone >=3 lane THROW ngay truoc khi W3 kip va.

(1) hmw.js - 1 EDIT, 4 viec
    - SAN-1 GATE co-khi-hoa: taskList>=3 && !args.run => THROW STOP-HARD.
      Truoc S121 san nay chi la CHU trong doc ("script no-fs KHONG tu ep") => phu thuoc lead NHO.
      Do that @S119: git grep args.run .claude/commands/ = 0 hit => 4/4 wrapper KHONG co => san danh-nghia.
      Vi sao >=3: chet giua run dai ma khong co runs/<run-id>/ => per-turn returns mat theo phien,
      CHI file tren dia song sot => /tiep §4 khong co vat-lieu cat-got => chay lai TU DAU (S118
      raw-Agent 7-spawn => 0 run-folder). THROW chu khong fail-soft (fail-soft = dut am-tham).
    - VALID_ROLES 12->14 (+lead-view-auditor +lead-omission-auditor).
    - PA-2a: TIER2_EXPECTED_FULL_ID = 'claude-opus-4-8'. La HANG-SO KHAI-BAO, KHONG phai co-che neo
      (neo-tai-spawn bat-kha-thi: param chi nhan alias; SE 0 full-id vi H8 all-inherit). Doc boi
      scripts/spawn-model-audit.ps1 (W1b) - thieu hang-so => script FAIL-LOUD.
    - H23 note CHUA-VERIFY giu nguyen nac: precedence spawn-param vs frontmatter khi CA HAI hien-dien
      = CHUA TUNG TEST; phan-biet duoc CHI o phien lead=Fable => DEFER, khong ban qua nac. + fix#8a chua thu.

(2) 4 co wrapper CUNG COMMIT voi gate (San-1 (c))
    fable-clone.md / fable-real.md / ultra-on.md => args.run: 0 -> 3 hit.
    Wrapper thu 4 = raw-invoke em-main: KHONG co file de gan co => duoc GATE chan truc tiep
    (chinh cu fault-inject duoi day di duong do). Khai that: gate chi phu hmw.js; nguong "hoac uoc
    >5 phut" KHONG co-khi-hoa duoc (script khong do truoc thoi-luong) => van la ky-luat lead;
    raw Workflow/Agent tool = ke CON-LAI khong gate duoc.
    + go so roster stale (view-stale-role-desc): "roster 12"/"12 sub"/"8-agent"/"9-agent" -> tro
    canonical docs/STATUS.md §Sub-agents (B1). session-start.md con "roster 12" = W3 so-huu, KHONG dung.

(3) 2 vai MOI - H24 §2(1), cookie-cutter frontmatter monitor san
    lead-view-auditor  = view LECH source (5 class view-*)
    lead-omission-auditor = cai BI THIEU (5 class gap-*)
    model:inherit / memory:project / maxTurns:18 / 8 tool read-only / NO Write-Edit / propose-only.
    KHONG gop vao tooling-auditor(H1)/harvest-curator(H2): H24 "gop la mat tieu-diem; can cap mat
    CHI danh cho lead". Tu-vung view/omission chon tranh va-cham (detectors:15 da so-huu
    derived-staleness; GAP qua-tai). 2 file 0-CR + block-scalar (giu ': ' N/A).

(4) memory-budget.json - single-source H24 §2(3)
    h24_cadence { light_every:6, deep_every:15, jump_on_class_repeat:3 } (anh chot Q2).
    lead_self_audit.flag_classes = enum DONG 10 class (5 view-* + 5 gap-*) - vai CAM tu che class
    (v2 M4: enum song trong dau 1 lane => worker khong bao gio thay => tu che => loang thong-ke).
    Honest-caveat giu de bao hub: hub dan "dung chep 3 con-so nay"; SE chon trung 6/15/3 = anh chot
    CO CHU-DICH lam khoi-diem, KHONG phai chep vo-thuc; re-tune sau chu-ky-2.

(5) .claude/governance/.session-counter.json (NEW) - seed UNTICKED trung thuc
    Content-based (idempotent-key = HEAD sha), KHONG blind-increment: hook wal-flush auto-commit
    agent-memory/ MOI TURN => dem mu se vo nghia. Dat o .claude/governance/ CO CHU-DICH = ngoai
    3 path hook (.claude/WAL.md, agent-memory/, workflows/runs/) => khong bi quet vao commit wal:.
    counter=0 + last_ticked_*=null = SU THAT tai S121 (nghi-thuc tick land o W3); seed tick gia
    se lam phep do cadence dau tien noi doi - dung thu H24 sinh ra de bat.

(6) STATUS.md 2 row - CUNG LANDING roster (R3-M2: lech => detector BAO tren chinh thay doi cua H24)
    | Sub-agents | 12 -> 14 |
    | Policies | 216 | ROW MOI - GAP-3 can no de resolve token 'policy'.
    216 GROUND TU MA NGUON, khong chep tu spec: |MenuKeys.All| x |MenuKeys.Actions| = 54 x 4
    (Program.cs:82-89 AddPolicy loop; MenuKeys.cs:167 Actions=[Read,Create,Update,Delete]).
    => Policies la DERIVED = Menu keys x 4 => 2 row BUOC doi cung nhau (ghi thang vao row).

VERIFY LEAD TU DO (khong tin return):
  14/14/14 (roster / VALID_ROLES / agents-*.md tru README) = acceptance ② EOL.
  Glob tho = 15 => xac nhan R2-C1: acceptance CU "ls agents/*.md = 14" se FAIL tren impl DUNG.
  Hop-dong cheo W1<->W2 khep CA HAI chieu, do bang chinh script W1:
    detector H24-2: "h24_cadence missing" -> "M = h24_cadence.light_every = 6 (read from config)"
    spawn-model-audit: "expected constant missing" -> "[OK] expected = claude-opus-4-8 = owner-ratified"
    GAP-3 policy: MISSING -> 216, va BAT NGAY permission-matrix/SKILL.md:3 "writes 240 policy but
      canonical=216" (+:81 "writes 48") => TOTAL 49->50 (-1 fail-loud cadence, +2 policy) = so cong khop.
  eol-check tu nhan 2 vai moi: scoped 37->39 (dem bang glob, khong hardcode).
  FAULT-INJECT SAN-1 2 CHIEU (bai hoc W0.3: chi test 1 chieu thi dieu-kien viet nham van PASS):
    (b) 3 task + KHONG args.run -> THROW, agent_count=0, subagent_tokens=0, 14ms (chan TRUOC spawn)
    (a) 2 task + KHONG args.run -> gate IM, workflow launch binh thuong => khong over-fire, nguong
        dung la >=3. Neu viet nham `if (!wave)` thieu nguong thi /fable-real 1-lane se chet oan.

CHUA VERIFY (khai that, KHONG gia vo):
  14/14 spawn-probe SONG = PHAI chay SAU RESTART (registry = anh-chup khoi-phien; S120+S121 da do
  2 lan xac nhan KHONG hot-reload agent MOI). Static-check KHONG du (broadcast ④d).
  => 2 vai moi hom nay moi chi TON TAI tren dia + trong VALID_ROLES, chua chung duoc SPAWN duoc.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-15 13:04:21 +07:00

50 lines
6.3 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
description: /fable-clone <vai> <đề-bài> — ENGINE-ĐẮT LỆNH-B per-invocation (H21): vai anh GÁN chạy ENSEMBLE tier-2-mạnh-nhất (N lane đa-lăng-kính CÙNG 1 VAI qua hmw.js parallel + em-main refute+synthesize) cho đề-bài đó — KHÔNG marker, KHÔNG mode persist. Thiếu/sai vai → em main hỏi lại anh 1 dòng, KHÔNG tự chọn. Cặp /fable-real.
argument-hint: <vai roster 14> <đề-bài phán-quyết> — vd "reviewer rà commit X" · "investigator-codebase truy bug Y"
---
# /fable-clone — ENGINE-ĐẮT LỆNH-B: 1 vai × ENSEMBLE tier-2 (per-invocation, H21)
> Cặp **`/fable-real`** (lệnh-A single top-model). 🔴 restart Claude Code sau khi tạo/sửa (no hot-reload).
> **Adopt H21 S110 (2026-07-11)** — supersede semantics **toggle-marker H19 (S101)**. KHÔNG còn mode-ảo mặc-định để "về", KHÔNG còn marker: cả 2 lệnh giờ = engine-đắt **per-invocation**, chỉ SỐNG trong lượt anh gõ.
> 📘 **Runbook:** [`docs/governance/fable-real-runbook.md`](../../docs/governance/fable-real-runbook.md) · 🔧 **Guard §K:** [`docs/governance/harness-11-engine.md`](../../docs/governance/harness-11-engine.md) §K (engine).
**Vai + đề-bài lượt này:** $ARGUMENTS
## 🔴 Semantics per-invocation (H21 ①/②)
- **`/fable-clone <vai> <đề-bài>`** = vai anh gán chạy **ENSEMBLE tier-2-mạnh-nhất** = **N lane đa-lăng-kính CÙNG 1 VAI** (qua HMW `parallel`) + em-main **refute + synthesize** (P3/P4) = "bản sao Fable". Rẻ quota top-model, giữ tầng phản-biện chống-đồng-thuận-sai.
- **Hiệu-lực CHỈ lượt đó** — **KHÔNG còn "về mặc-định"**, KHÔNG marker, KHÔNG persist (H19 mode thật/ảo đã retired H21). Lượt sau muốn ensemble = gõ lại lệnh.
## 🔴 Vai BẮT BUỘC ∈ roster 14 (H21 ②)
`investigator-codebase` · `investigator-api` · `implementer-backend` · `implementer-frontend` · `frontend-designer` · `database-agent` · `office-document` · `test-specialist` · `reviewer` · `cicd-monitor` · `tooling-auditor` · `harvest-curator` · `lead-view-auditor` · `lead-omission-auditor`.
- **Thiếu `<vai>` HOẶC vai ngoài roster** → em main **hỏi lại anh 1 dòng**, **KHÔNG tự chọn vai**.
-**VALID_ROLES đủ roster 14** — canonical đếm ở [`docs/STATUS.md`](../../docs/STATUS.md) §Sub-agents (B1 derived-trỏ-canonical; **KHÔNG chép số ở đây khi roster đổi** — đó chính là class `view-stale-role-desc``lead-view-auditor` soi). Lịch-sử: 10→12 (S110, +2 monitor `tooling-auditor`/`harvest-curator`) → **12→14 (S121 W2, +2 monitor H24 `lead-view-auditor`/`lead-omission-auditor`)**. *(🧊 limitation cũ 10-vai + H6-design "monitor ngoài workflow" superseded; monitor vẫn INFORM-only, lane RETURN-only.)*
- 🔒 **Honest-note (a/b):** bảo-đảm = **owner-gated tầng lệnh + kỷ-luật lead**, **KHÔNG code-enforced**; lệnh/alias = cách anh **gán vai nhanh**, hệ **KHÔNG tự chọn vai**.
## 🔴 Spec-file 3-mục BẮT BUỘC mỗi run (H21 ①)
Mỗi lần chạy engine-đắt PHẢI kết-tinh 1 spec theo pipeline **propose → verify → ghi → thực-thi**:
1. **Engine propose-only** — vai chạy ensemble đề-xuất [đề-bài · cách làm · checklist]. Engine KHÔNG tự ghi.
2. **Lead verify** — lead soi + chỉnh (P3/P4 refute + synthesize N lane).
3. **Lead ghi** file `.claude/workflows/runs/<run-id>/spec-<tên-tính-năng>-<dd-mm-yyyy>.md`**3 heading cố-định:** ① Tính-năng/đề-bài · ② Cách implement · ③ Checklist (vai + deliverable + acceptance **ĐO ĐƯỢC**).
4. **Worker thực-thi THEO spec** — spec bơm **QUA ARGS/prompt** (worker KHÔNG tự Read file).
- 🔒 **Honest-note (c):** file spec do **LEAD ghi SAU khi verify** — engine KHÔNG tự ghi.
- 🔒 **Honest-note (d):** run **chấm/verify CŨNG sinh spec-file** (kế-hoạch xử issue = "cách làm" cần kết-tinh).
## 🔴 Cờ `args.run` — RUN-TRACE BẮT BUỘC khi ≥3 lane (Sàn-1 H22, cơ-khí-hoá S121 W2)
🔴 **`/fable-clone` ensemble hầu như LUÔN ≥3 lane** (run S119 = 5 lane) ⇒ **cờ này gần như LUÔN bắt buộc**.
Trước khi gọi Workflow `hmw`, lead **PHẢI** @P1:
1. Scaffold `.claude/workflows/runs/<run-id>/` (TRACKED) + `run.md` kèm **`## taskList snapshot`**.
2. Truyền `args.run = { name:'<run-id>', dir:'.claude/workflows/runs/<run-id>' }`.
**Thiếu cờ + ≥3 task ⇒ `hmw.js` THROW (STOP-HARD), KHÔNG fail-soft.** Vì sao gate: script chạy JS-sandbox **KHÔNG filesystem** ⇒ tự nó không tạo được folder ⇒ trước S121 sàn này chỉ là **kỷ-luật người** (đo thật @S119: `git grep args.run .claude/commands/` = **0 hit** ⇒ 4/4 wrapper KHÔNG cờ ⇒ sàn danh-nghĩa). Hậu-quả thật khi thiếu: chết giữa run ⇒ **per-turn returns mất theo phiên, chỉ file trên đĩa sống sót**`/tiep` §4 không có vật-liệu cắt-gọt ⇒ chạy lại TỪ ĐẦU (S118 raw-Agent 7-spawn ⇒ 0 run-folder).
🔸 **Khai thật:** gate chỉ phủ đường `hmw.js`. Ngưỡng *"hoặc ước >5 phút"* **KHÔNG cơ-khí-hoá được** (script không đo trước thời-lượng) ⇒ phần đó vẫn là kỷ-luật lead. **raw `Workflow`/`Agent` tool = kẽ CÒN-LẠI**, đi thẳng không qua file này ⇒ mất writeGuard + run-trace.
## 🔴 Guard ensemble (§K engine — 3 floor-fidelity)
- **ảo-ensemble = N lane CÙNG 1 vai phán-quyết** (multi-lens trên 1 vai), **KHÔNG** mixed-roster fan-out (`hmw.js` VALID_ROLES = **roster đầy-đủ**, canonical → [`docs/STATUS.md`](../../docs/STATUS.md) §Sub-agents; KHÔNG gate vai — all-inherit **che** leak tới khi Fable về + phân-tầng).
- **N lane RETURN-only**; em-main **single-writer** (B3) ghi **1 MEMORY entry** đúng vai đó + **gắn nhãn engine đã dùng** (hmw SCHEMA `memoryDelta` KHÔNG field engine → em-main stamp @P3 harvest).
- **Một vai = một trí-nhớ** dù N lane (chống AS-10 fragment N-lane).
## 🔴 Floor model-tier v3 + lead-discipline
- **Lead = frontier-class do ANH chọn per-session** {Fable 5 | Opus 4.8 — **1M MAX**}; **CẤM Sonnet/Haiku-class ghế lead**. Engine-đắt per-invocation = đường DUY NHẤT nâng 1 vai lên hạng-nhất.
- ⚠️ **Lead KHÔNG tự ý gọi engine-đắt****kể cả khi HMW-mode ON**; chỉ chạy khi anh gõ lệnh.