Files
solution-erp/.claude/commands/fable-real.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

47 lines
5.6 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-real <vai> <đề-bài> — ENGINE-ĐẮT LỆNH-A per-invocation (H21): vai anh GÁN chạy 1 LẦN SINGLE top-model THẬT (Fable 5; outage → single-Opus-1M/run) deep-pass cho ĐÚNG đề-bài đó, hiệu-lực CHỈ lượt đó — 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-clone.
argument-hint: <vai roster 14> <đề-bài phán-quyết> — vd "reviewer rà-soát commit X" · "investigator-codebase truy nguồn bug Y"
---
# /fable-real — ENGINE-ĐẮT LỆNH-A: 1 vai × SINGLE top-model deep-pass (per-invocation, H21)
> Cặp **`/fable-clone`** (lệnh-B ensemble). 🔴 restart Claude Code sau khi tạo/sửa (command `.md` no hot-reload).
> **Adopt H21 S110 (2026-07-11)** — supersede semantics **toggle-marker H19 (S101)**. KHÔNG còn `.claude/fable-real-mode.on`, KHÔNG còn mode persist qua session/compact: engine-đắt CHỈ SỐNG trong **lượt anh gõ lệnh** này.
> 📘 **Runbook vận-hành** (hàm/biến/checklist per-invocation + AC + anti-patterns): [`docs/governance/fable-real-runbook.md`](../../docs/governance/fable-real-runbook.md).
> 🔧 **Guard ensemble / single-writer:** [`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-real <vai> <đề-bài>`** = vai anh gán chạy **1 LẦN top-model THẬT** (sâu nhất, đắt nhất) cho ĐÚNG đề-bài đó. Fable up = single-Fable; Fable **outage** (H5, lỗi `"Model isn't available"`) = single-**Opus-1M** fallback **theo từng lần chạy** (KHÔNG mode toàn-cục).
- **Hiệu-lực CHỈ lượt đó** — hết lượt là hết. KHÔNG marker, KHÔNG persist. Lượt sau muốn engine-đắt = 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`.
> Số vai canonical → [`docs/STATUS.md`](../../docs/STATUS.md) §Sub-agents (B1 derived-trỏ-canonical). +2 @S121 W2 = 2 monitor H24 lead-self-audit.
- **Thiếu `<vai>` HOẶC vai ngoài roster** → em main **hỏi lại anh 1 dòng** ("engine-đắt cần vai đích-danh — vai nào?"), **KHÔNG tự chọn vai**.
- 🔒 **Honest-note (a):** "không tự chọn vai" = tầng **KỶ-LUẬT owner-gated** (anh phải gõ vai) — **KHÔNG claim code-enforced**.
- 🔒 **Honest-note (b):** lệnh/alias = cách anh **GÁN VAI NHANH**, vẫn phải anh gõ — 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 top-model đề-xuất [đề-bài · cách làm · checklist]. Engine KHÔNG tự ghi.
2. **Lead verify** — lead soi + chỉnh nội-dung propose.
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).
## 🔴 Floor model-tier v3 (broadcast 2026-07-11)
- **Lead = frontier-class do ANH chọn per-session** {Fable 5 | Opus 4.8 — cả hai **1M MAX**}. **CẤM lớp model thấp (Sonnet/Haiku-class) ngồi ghế lead.**
- **Engine-đắt per-invocation = đường DUY NHẤT nâng 1 vai lên hạng-nhất**, chỉ trong lượt lệnh anh gõ. Ngoài lệnh, mọi vai giữ model roster mặc-định (**H8 all-inherit** — **toàn roster** `model: inherit` theo lead; số vai canonical → [`docs/STATUS.md`](../../docs/STATUS.md) §Sub-agents, B1 KHÔNG chép số ở đây).
- ⚠️ **Lead KHÔNG tự ý gọi engine-đắt****kể cả khi HMW-mode ON**. Engine-đắt chỉ chạy khi anh gõ `/fable-real|/fable-clone <vai> <đề-bài>`.
## 🔴 Cờ `args.run` — RUN-TRACE (Sàn-1 H22, cơ-khí-hoá S121 W2)
Lead **PHẢI** @P1 scaffold `.claude/workflows/runs/<run-id>/` (TRACKED, kèm `run.md` + `## taskList snapshot`) rồi truyền `args.run = { name:'<run-id>', dir:'.claude/workflows/runs/<run-id>' }` khi gọi Workflow `hmw`.
🔸 **Khai thật — ở lệnh NÀY gate hiếm khi cắn:** `/fable-real` = **single deep-pass 1 lane**`taskList.length = 1` < 3 `hmw.js` **KHÔNG throw**. Nhưng cờ vẫn **PHẢI** truyền, §H21 buộc run này **kết-tinh spec-file** vào `runs/<run-id>/` cần run-folder làm **dấu-vết artifact** cho `/tiep` + harvest; nếu lúc lệnh này fan-out 3 thì gate cắn ngay. Đừng đọc "gate không cắn" thành "khỏi cần cờ".
## 🔴 Guard (§K engine — bất-biến)
- **Single deep-pass 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ớ** chạy thật/ảo/engine nào (chống AS-10 fragment). Guard ensemble N-lane đầy-đủ (khi cặp `/fable-clone` chạy) §K.