[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-92995":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":9,"language":10,"languages":9,"totalLinesOfCode":9,"stars":11,"forks":12,"watchers":13,"openIssues":14,"contributorsCount":14,"subscribersCount":14,"size":14,"stars1d":14,"stars7d":14,"stars30d":15,"stars90d":14,"forks30d":14,"starsTrendScore":14,"compositeScore":16,"rankGlobal":9,"rankLanguage":9,"license":17,"archived":18,"fork":18,"defaultBranch":19,"hasWiki":20,"hasPages":18,"topics":21,"createdAt":9,"pushedAt":9,"updatedAt":34,"readmeContent":35,"aiSummary":36,"trendingCount":14,"starSnapshotCount":14,"syncStatus":37,"lastSyncTime":38,"discoverSource":39},92995,"fable5-mode","cozytab\u002Ffable5-mode","cozytab","Fable 5-grade work discipline for any Claude model — a Claude Code skill + guard hooks (plan gate, model ceiling, per-task enforcement) that make Opus 4.8 or any non-frontier model plan, self-verify, and route sub-agents like Fable 5, without Fable 5.",null,"Python",105,3,1,0,42,46.01,"MIT License",false,"main",true,[22,23,24,25,26,27,28,29,30,31,32,33],"agent-hooks","ai-agents","anthropic","claude","claude-code","claude-skills","fable-5","fable5","llm","opus","prompt-engineering","subagents","2026-07-22 04:02:07","# fable-mode\n\n**English** | [简体中文](README.zh-CN.md)\n\n**A work-discipline protocol that makes Opus 4.8 (or any non-frontier model) operate at Fable-5-grade quality.**\n\nfable-mode is a [Claude Code](https:\u002F\u002Fclaude.com\u002Fclaude-code) skill plus a set of\nguard hooks. Its premise:\n\n> **output quality = model capability × work discipline**\n\n---\n\n## Quickstart\n\n```bash\n# 1. Install the skill (honors CLAUDE_CONFIG_DIR; falls back to ~\u002F.claude)\ngit clone https:\u002F\u002Fgithub.com\u002Fcozytab\u002Ffable5-mode \\\n  \"${CLAUDE_CONFIG_DIR:-$HOME\u002F.claude}\u002Fskills\u002Ffable-mode\"\n\n# 2. (optional) register the enforcement hooks — merges into your settings.json,\n#    resolves its own path, idempotent:\nbash \"${CLAUDE_CONFIG_DIR:-$HOME\u002F.claude}\u002Fskills\u002Ffable-mode\u002Finstall.sh\"\n```\n\n```text\n# 3. In Claude Code, just ask for it — in any language:\n   \"use fable mode\"   ·   \"用 fable 模式\"   ·   \"do this rigorously, one-shot\"\n```\n\n```bash\n# 4. For a project you're taking seriously, turn on enforcement:\nmkdir .fable\nprintf -- '- [ ] 1. first card (with a machine-checkable acceptance test)\\n' > .fable\u002FLEDGER.md\n```\n\nThe skill works on its own; step 2 is **optional** (it turns the discipline into\nhard blocks). Claude replies in **your** language even though the skill is\nauthored in English.\n\n## Design intent & what it changes\n\n**Why it exists.** Weaker models mostly don't fail by being dumb in the moment;\nthey fail by *process*: thinking while typing and changing their mind halfway,\ndeclaring \"looks right\" without running anything, fanning work out with no\nverification, and quietly stopping mid-task. Those are process failures, and\nprocess is fixable with structure. Since the \"discipline half\" of frontier\noutput is model-independent, you can hand a cheaper model the *working habits* of\na stronger one and recover a real chunk of the gap — paying in orchestration\nsteps instead of a bigger model.\n\n**What you actually get.**\n\n- Thinking happens in the cheapest phase (a written plan gate), not mid-implementation.\n- \"Done\" means an acceptance command passed — not \"looks right.\"\n- Critical output survives an adversarial *refute* pass before it ships.\n- Context stays clean across long runs, via external SPEC\u002FPROGRESS memory instead of a bloated transcript.\n- The two rules models shirk most — *write a plan before fanning out* and *don't stop with unfinished work* — are enforced by hooks, not hope.\n- It's honest about its ceiling: on a real capability wall (a long from-scratch derivation, holding a huge codebase at once, fine aesthetic judgment) it tells you to switch to a stronger model instead of faking it.\n\n**What it does not do.** It won't turn Opus into Fable 5. It closes the\n*discipline* gap, not the *capability* gap. The cost is real — more orchestration\nsteps and slower wall-clock on small tasks — which is exactly why you don't use\nit on small tasks. (Net token cost depends on the task; on rework-prone work the\ndiscipline can even come out lower.)\n\n## The six levers\n\n| # | Lever | What it forces |\n|---|---|---|\n| 1 | **Plan Gate** | Write `docs\u002FSPEC.md` (requirements + approach + task cards, each with a *machine-checkable* acceptance test) before writing code. Concentrate thinking in the cheapest phase. |\n| 2 | **Small-card execution** | Each card runs in a fresh context; don't advance until its acceptance command passes; on 2 failures, escalate instead of flailing. |\n| 3 | **Adversarial self-check** | Don't \"generate and ship.\" Dispatch independent viewpoints to *refute* critical output; for wide-open problems, generate N approaches + judge + synthesize. |\n| 4 | **Real-product verification** | All-green static checks ≠ it works. Run the real product end-to-end each milestone and leave evidence (screenshots, logs, test output). |\n| 5 | **Context hygiene** | SPEC + PROGRESS are external memory. Restore state by re-reading them, not by dragging failed-attempt reasoning through a bloated context. |\n| 6 | **Checkpoint autonomy** | Long background tasks get a watchdog and resumable checkpoints, so a hang or crash costs at most one card. |\n\nThe full protocol lives in **[`SKILL.md`](SKILL.md)** — the text Claude actually reads.\n\n## The enforcement layer (the part that's more than a prompt)\n\nSix levers written as prose still rely on the model's honor. Four hooks turn the\nmost-shirked rules into hard blocks:\n\n| Hook | Event | Effect |\n|---|---|---|\n| **Profile Injector** | `SessionStart` | Auto-injects the discipline, **sized to the ledger state** — full during an active round, a one-liner when idle or paused — plus the model-appropriate tier and open-item recovery. |\n| **Spawn Guard** | `PreToolUse` (Agent\u002FTask\u002FWorkflow) | Blocks a detailed spawn before a ledger exists (forces the plan gate), and blocks any spawn requesting a model **stronger than the session's** — the model ceiling is mechanical, not just prose. |\n| **Fail-Streak Reminder** | `PostToolUse` (Bash) | Advisory, never blocks: at every 3rd consecutive failing command it injects the **attribution ladder** (suspect the harness → prove the new code is running → only then debug the product, and fix the class via an invariant) — cures grinding on the wrong layer. |\n| **Close Guard** | `Stop` | Blocks ending the turn while the ledger still has unchecked items — cures early stopping \u002F spinning. Also enforces **evidence-on-close**: a `- [x]` card without an `-- evidence:` note blocks the stop (\"report evidence, not adjectives\" as a hard rule). |\n\nPlus **`hooks\u002Ffable_lint.py`** — not a hook but a one-shot CLI: checks the SPEC\ncarries `[measured]\u002F[inferred]\u002F[not-shown]` source tags, every open card names\nits acceptance, every closed card carries evidence. Run it at wrap-up (or in CI):\n`python3 hooks\u002Ffable_lint.py \u003Cproject_dir>`.\n\nDesign properties that make this safe to register globally:\n\n- **Opt-in per project** via a `.fable\u002F` directory (searched upward, bounded at\n  the git root). No `.fable\u002F` → the hooks pass through silently. They never touch\n  projects you didn't opt in.\n- **Fail-open** — any hook error passes through (exit 0). A bug in a guard can\n  never brick your session.\n- **Loop-safe** — the close guard honors `stop_hook_active`, so you're never trapped.\n- **Exemptions** — small spawns (\u003C 1500 chars) and forks are never blocked.\n\nSee **[`hooks\u002FREADME.md`](hooks\u002FREADME.md)** for the mechanics.\n\n## Install\n\n**Prerequisites**: [Claude Code](https:\u002F\u002Fclaude.com\u002Fclaude-code), and `python3`\n(standard library only — no third-party deps; needed only if you use the hooks).\n\nYour Claude config directory is `$CLAUDE_CONFIG_DIR` if that variable is set,\notherwise `~\u002F.claude`. Everything below derives from it, so it works no matter\nwhere your config lives.\n\n### Option A — automated (recommended; this is what an AI can run for you)\n\n```bash\ngit clone https:\u002F\u002Fgithub.com\u002Fcozytab\u002Ffable5-mode \\\n  \"${CLAUDE_CONFIG_DIR:-$HOME\u002F.claude}\u002Fskills\u002Ffable-mode\"\nbash \"${CLAUDE_CONFIG_DIR:-$HOME\u002F.claude}\u002Fskills\u002Ffable-mode\u002Finstall.sh\"\n```\n\n`install.sh` **resolves its own location** (so the hook paths are correct no\nmatter where you cloned it), honors `CLAUDE_CONFIG_DIR`, and **merges** the three\nhooks into your `settings.json` without disturbing existing config. It's\nidempotent — re-run it after moving the skill and it re-points the paths. Remove\nthe hooks any time with `bash install.sh --uninstall`.\n\nOr just tell Claude Code:\n\n> Install the skill at https:\u002F\u002Fgithub.com\u002Fcozytab\u002Ffable5-mode by following its README.\n\n**Updating**: after `git pull`, re-run `install.sh`. A new version can add hook\nevents (e.g. a `PostToolUse` hook), and only the installer updates your\n`settings.json` — a plain `git pull` ships the files but won't register new\nhooks. It's idempotent, so re-running is always safe.\n\n### Option B — manual\n\nClone as above, then **merge** these four entries into the `hooks` object of\n`\u003Cconfig-dir>\u002Fsettings.json` (don't overwrite the file; if you already have a\n`hooks` key, add these under it). Use the absolute path to where you actually\ncloned it — the `${CLAUDE_CONFIG_DIR:-$HOME\u002F.claude}` below is expanded by the\nshell at hook-run time:\n\n```json\n\"hooks\": {\n  \"SessionStart\": [{\"hooks\": [{\"type\": \"command\",\n    \"command\": \"python3 ${CLAUDE_CONFIG_DIR:-$HOME\u002F.claude}\u002Fskills\u002Ffable-mode\u002Fhooks\u002Ffable_profile_inject.py\"}]}],\n  \"PreToolUse\": [{\"matcher\": \"Agent|Task|Workflow\",\n    \"hooks\": [{\"type\": \"command\",\n      \"command\": \"python3 ${CLAUDE_CONFIG_DIR:-$HOME\u002F.claude}\u002Fskills\u002Ffable-mode\u002Fhooks\u002Ffable_spawn_guard.py\"}]}],\n  \"PostToolUse\": [{\"matcher\": \"Bash\",\n    \"hooks\": [{\"type\": \"command\",\n      \"command\": \"python3 ${CLAUDE_CONFIG_DIR:-$HOME\u002F.claude}\u002Fskills\u002Ffable-mode\u002Fhooks\u002Ffable_fail_streak.py\"}]}],\n  \"Stop\": [{\"hooks\": [{\"type\": \"command\",\n    \"command\": \"python3 ${CLAUDE_CONFIG_DIR:-$HOME\u002F.claude}\u002Fskills\u002Ffable-mode\u002Fhooks\u002Ffable_close_guard.py\"}]}]\n}\n```\n\nThe skill alone is enough to trigger fable-mode by asking for it; skip the hooks\nif you only want the protocol.\n\n### For AI assistants installing this\n\nWhen a user asks you to install fable-mode from this repo:\n\n1. Config dir = `$CLAUDE_CONFIG_DIR` if set, else `~\u002F.claude`.\n2. `git clone` the repo into `\u003Cconfig-dir>\u002Fskills\u002Ffable-mode`.\n3. Run `bash \u003Cconfig-dir>\u002Fskills\u002Ffable-mode\u002Finstall.sh` — it merges the hooks\n   idempotently and resolves paths itself. If you instead register hooks by\n   editing `settings.json` yourself, **merge** into the existing `hooks` object\n   (never overwrite the file) and use the **absolute** clone path — do not\n   hardcode `~\u002F.claude` if the user relocated their config.\n4. Tell the user the hooks are optional and stay inert until a project has a\n   `.fable\u002F` directory.\n\n## Use\n\n**Trigger the skill by asking for it by name** — \"use fable mode\", \"work like\nFable 5\", \"rigorous mode\", or the Chinese equivalents (\"用 fable 模式\",\n\"严谨模式\"). It deliberately does **not** auto-trigger just because a task is\nbig or important — no surprise process tax; at most it may *offer* to enable\nitself. The other explicit path is a project armed with `.fable\u002F`, where the\nhooks carry the discipline in automatically.\n\n**Enable the mechanical enforcement** on a project you're taking seriously:\n\n```bash\nmkdir .fable\ncat > .fable\u002FLEDGER.md \u003C\u003C'EOF'\n- [ ] 1. first card (with a machine-checkable acceptance test)\n- [ ] 2. second card\nEOF\n```\n\nFrom then on, in that project: sessions auto-load the discipline and the right\ntier; you can't dispatch a detailed agent without a ledger; you can't end a turn\nwith unchecked cards. Mark cards `- [x]` (done + verified) or\n`- [~] ... -- deferred: reason` to close them. To turn enforcement off, check\neverything or `rm -rf .fable`.\n\n**Big project, small tasks?** Enforcement is per-*round*, not per-*keystroke*:\nwith all cards closed (idle) the guards stay quiet and quick fixes flow freely\nwith near-zero injection. Mid-round, drop a `PAUSED: reason` line into\n`.fable\u002FLEDGER.md` to do unrelated work without being nagged (the model ceiling\nstays active); remove it to resume the round.\n\n## Concurrency tiers\n\nfable-mode's concurrency isn't a fixed number.\n\n- **Conservative (default)** — cap of ≤5 concurrent subagents, a local rate-limit\n  guardrail. Right for everyday, quota-sensitive, quality-first work.\n- **Throughput (opt-in)** — dispatch parallel subagents readily, communicate\n  async, don't block. No fixed cap; field deployments range 10–500+. It trades\n  more tokens for throughput and risks rate limits — so it's enabled only when you\n  ask, or auto-selected when the running model is Fable 5.\n\nThe Profile Injector picks the tier automatically by model\n(`FABLE_MODE_PROFILE=auto|conservative|throughput` overrides).\n\n**Model routing (capability-matched)**: neither \"never downgrade\" nor \"offload\nto cheap\" is right. fable-mode routes by what the card demands — design,\ndebugging and **all verification** stay on the session model; a well-specified\nimplementation card may drop one tier; mechanical gather\u002Fformat work goes to a\ncheap tier at low effort. This mirrors Anthropic's own practice (Opus-class lead\n+ Sonnet-class subagents in their research system, +90.2% over single-agent).\nWhat makes downgrading safe is the safety net: only cards with machine-checkable\nacceptance are downgraded, two failed acceptances escalate the model tier —\n**capped at the session model** (the top of the ladder is pulling the card back\ninline, never a stronger model: fable-mode exists to get Fable-5-grade results\n*without* Fable 5, so it never quietly reaches upward) — and the verifier is\nalways at least as strong as the implementer. When unsure, inherit the session\nmodel.\n\n## The Fable 5 habit set\n\nBeyond the six levers, the skill transplants the concrete behaviors Anthropic\ndocuments for Fable 5 — so any model in a fable-mode project inherits them:\nground every progress claim in a tool result; never end a turn on a promise you\ncould act on; lead with the outcome; pause only where the user is genuinely\nneeded; assessment before action; fresh-context verifiers over self-critique;\nmodel & effort routed by task (verification never downgraded); pass the *why*\nalong when delegating; keep a lessons file; **act once you have enough\ninformation** (no re-litigating settled decisions); **do the simplest thing\nthat works** (no unrequested refactors or defensive code); write the final\nsummary as a **re-grounding** for a reader who saw none of the work; **triage\nmulti-part requests** so no sub-ask is silently dropped; write code that blends\ninto the surrounding file. The highest-value habits are auto-injected into\nevery fable-mode session by the Profile Injector.\n\nStarter skeletons live in [`templates\u002F`](templates\u002F) — SPEC, LEDGER, PROGRESS,\nand an engine-neutral fresh-eyes [verifier prompt](templates\u002FVERIFIER_PROMPT.md).\n\n**Why a skill + hooks, not a plugin or agent?** A plugin restructure would add\ndistribution convenience but no new enforcement capability, and we don't ship\nforms we can't verify end-to-end; an \"agent\" can only advise, not block. The\ncurrent form installs with one clone + one script and is verified on a real\nmachine. Plugin packaging is deferred, not rejected.\n\n## No stronger model? It degrades, never stalls\n\nfable-mode is honest about capability walls — but \"switch to Fable 5\" is a dead\nend if you can't run Fable 5. So a non-Fable session is automatically told **not\nto defer hard steps to a stronger model or stall waiting for one**. Instead it\ncompensates on the model you have: decompose the wall into smaller verifiable\nsteps, best-of-N + a judge, make tools\u002Ftests the ground truth, and flag residual\nrisk instead of blocking. If you *do* have a stronger tier to hand off to, set\n`FABLE_ESCALATION=on`.\n\n## Layout\n\n```\nfable-mode\u002F\n├── SKILL.md              # the protocol Claude reads (the six levers, tiers, red lines)\n├── README.md             # this file\n├── README.zh-CN.md       # 简体中文\n├── install.sh            # merge\u002Fremove the hooks in settings.json (path-resolving, idempotent)\n├── templates\u002F            # SPEC \u002F LEDGER \u002F PROGRESS skeletons + fresh-eyes verifier prompt\n├── hooks\u002F\n│   ├── README.md         # hook mechanics, ledger format, install\n│   ├── _fable_common.py  # shared helpers (stdin, upward .fable\u002F search, ledger parse)\n│   ├── fable_profile_inject.py   # SessionStart: per-model tier + context recovery\n│   ├── fable_spawn_guard.py      # PreToolUse: design gate (open card required) + model ceiling\n│   ├── fable_fail_streak.py      # PostToolUse(Bash): attribution-ladder reminder on fail streaks\n│   ├── fable_lint.py             # not a hook: one-shot discipline lint CLI\n│   └── fable_close_guard.py      # Stop: open cards \u002F hollow evidence → block turn end\n└── tests\u002F\n    ├── test_guards.py    # spawn\u002Fclose guards, model ceiling, PAUSED, evidence, fail-streak, lint\n    ├── test_inject.py    # per-state injection, tiers, routing, escalation policy\n    └── test_install.py   # install.sh: fresh\u002Fmerge\u002Fidempotent\u002Fre-point\u002Funinstall\n```\n\n## Tests\n\nNo third-party dependencies:\n\n```bash\npython3 tests\u002Ftest_guards.py    # opt-in detection, ledger presence, exemptions, git-root boundary, loop-safety, fail-open\npython3 tests\u002Ftest_inject.py    # per-model tier, env override, context recovery, JSON envelope, fail-open\npython3 tests\u002Ftest_install.py   # install.sh: fresh, merge, idempotent, re-point, uninstall, bad-JSON refusal\n```\n\n## License\n\n[MIT](LICENSE) © 2026 cozytab.\n\nYou may use, copy, modify, merge, publish, distribute, sublicense, and sell it —\nincluding commercially, and including in closed-source work. **The only\nrequirement**: keep the copyright notice and the MIT permission text (i.e. the\n`LICENSE` file) in all copies or substantial portions. It's provided \"as is\",\nwith no warranty and no liability on the author.\n","fable5-mode 是一个面向 Claude 系列大模型（特别是 Opus 4.8 等非前沿模型）的工作纪律增强协议，通过集成 Claude Code 技能与可选的守卫钩子（plan gate、model ceiling、per-task enforcement），强制执行类 Fable-5 的结构化工作流：包括前置规划、自动验证、子智能体路由及未完成任务阻断。其核心不提升模型固有能力，而是弥补过程性缺陷（如边写边改、跳过验证、中途停止），适用于需高可靠输出的中大型代码任务、复杂推理或工程级协作场景。部署轻量，支持多语言指令触发，可按需启用硬性约束。",2,"2026-07-11 02:30:35","CREATED_QUERY"]