ClaudeMods
☰
JA
● 0 人がオンライン ・閲覧 0 回
スポンサー作品を投稿
GitHub リポジトリ · 投稿者 arazvan-ec

newspeak

成功条件のないリスト項目を指摘し、実行前に成功条件を1つ確認するようモデルに求める不備項目です。

arazvan-ec@arazvan-ec

arazvan-ec/xmarks/tree/main/mods/newspeak

翻訳済み

この mod について

flywheel 🎡

アドホックな「雰囲気でのコーディング」を、規律があり自己検証できる AI 支援開発の ループ に変える Claude Code プラグイン です。obra/superpowers、EveryInc/compound-engineering-plugin、karpathy/autoresearch、addyosmani/agent-skills、gszhangwei/open-spdd の実践知を、1 つの一貫したシステムにまとめています。

このリポジトリ 自体が プラグインで、xmarks マーケットプレイス(.claude-plugin/marketplace.json)から提供されます。

インストール(Claude Code)

/plugin marketplace add arazvan-ec/xmarks
/plugin install flywheel@xmarks

その後 /reload-plugins と /flywheel:help を実行します。リポジトリで flywheel を 自動有効化 するには、docs/add-flywheel-to-a-repo.md を参照してください。

Claude Code のみ — claude.ai のチャットアプリは別の Skills システムを使うため、Claude Code プラグインは実行しません。

Claude Code web — Web セッションはマーケットプレイスプラグインを自動インストールしません。そのため /plugin install も settings.json のマーケットプレイスキーも、そこで /flywheel:* を表示させません。代わりに scripts/install-vendored.sh を使って対象リポジトリに flywheel を一度 vendor 化 してください。以後はどのサーフェスでも /flywheel-help、/flywheel-loop、… が使えます。docs/add-flywheel-to-a-repo.md も参照してください。登録済みエージェントがないと flywheel 自身も +delegate ルートを実行できなかったため、install-vendored.sh --agents-only はガードが許す唯一の自己対象です。これは agents/*.md を .claude/agents/ に登録するだけで、skills や hooks は登録しません。配布版と登録版に差があれば scripts/check-agent-parity.sh が CI を失敗させます。兄弟オプション --hooks-only は、このリポジトリの hooks を .claude/settings.json に登録して scripts/ を指します。scripts/check-hook-parity.sh は hooks/hooks.json が宣言するすべての hook の登録も検証します。

発想:二重のループ

**外側のループ(開発サイクル)**では、1 つの作業が 6 つのゲートを順に通ります。

spec → plan → work → verify → review → compound

**内側のループ(work 内)**は、失敗するテストを書く → 実装 → 実行 → 観察 → 修正 を繰り返す短いサイクルです。客観的なチェックがグリーンになるまで「完了」とは宣言しません。

「問題なさそう」では進みません。verify は実際のアプリ/テストを実行し、完了した各サイクルは再利用できる知識を台帳に残して次のサイクルを準備します。

📚 ループの考え方が初めてなら、docs/getting-started-with-loops.md を参照してください。ターン単位、目標単位、時間単位、プロアクティブという 4 種類のループと、flywheel との対応を説明しています。

⏱️ flywheel をスケジュール実行または無人実行したい場合は、docs/proactive-loops.md を参照してください。/flywheel:verify/review と /loop、/schedule ルーチン、/goal、ワークフローを組み合わせます。

第 2 の柱:エージェントネイティブなランタイム(v0.15.0)

上のループはソフトウェアを 作ります。process/run の組み合わせを使うと、flywheel はソフトウェアを 運用 することもできます。リポジトリを agent-native に変え、Claude は後付けではなくランタイムの第一級要素になります。定期的な領域操作(「車を分析する」「リードを採点する」「レポートを取り込む」)のために静的なバックエンド関数を書く代わりに、プロセス契約を定義して Claude に実行させます。

  • /flywheel:process <desc> は .claude/flywheel/processes/<slug>.md を作ります。操作が必ず従う 固定ルール、出力スキーマ、結果を 永続化 する場所を定めます。データ戦略は .claude/flywheel/DATA.md に宣言されたリポジトリ独自のもの(例:リポジトリの client 経由の Postgres)に従い、flywheel がデータストアを押し付けることはありません。
  • /flywheel:run <slug> [input] は契約を バックエンドとして 実行します。ルールに従い、許された範囲だけ判断し、結果をデータストアに書き込み、着地を証明します(冪等で、読み戻し検証済み)。さらに証拠に基づく改良を 1 つ追記して契約を 成熟 させ、次の実行を鋭くします。

全体像と車の実例: docs/research/agent-native-processes.md。

コマンド

| コマンド | 内容 | | --- | --- | | /flywheel:help | オンボーディングとコマンド一覧。 | | /flywheel:loop <feature> | 全サイクルを最後まで実行し、フェーズ間にゲートを置く。 | | /flywheel:brainstorm <idea> | 仕様の前に曖昧なアイデアを合意済みの要件に絞る。 | | /flywheel:spec <feature> | REASONS の仕様契約と機械で検証できる成功指標を書く。 | | /flywheel:plan <spec-slug> | 仕様を順序付きタスクにし、それぞれにチェックを持たせる。 | | /flywheel:work <task> | 内側の反復で、グリーンになるまで実装する。 | | /flywheel:debug <symptom> | 系統的なデバッグ:再現 → 仮説 → 切り分け → 修正 → 回帰テスト。 | | /flywheel:verify | 客観的な PASS/FAIL ゲート。verifier エージェント経由で実際のアプリ/テストを実行する。 | | /flywheel:review <ref> | diff の種類に応じて複数の専門レビューを振り分け、統合する(ドキュメント diff ≠ 全面展開)。 | | /flywheel:compound | このサイクルの判断、注意点、パターンを台帳に追記する。 | | /flywheel:recall <query> | 必要なときに台帳を検索し、該当する学びを列挙して要求された 1 件を展開する。 | | /flywheel:route <task> | 計画外の作業を委任する前に、route-tiers.txt からツール、新しいセッション、サブエージェント、現在地での作業、そのモデルと effort を推奨する。 | | /flywheel:ship <title> | クリーンな commit と push、PR でサイクルを締める。 | | /flywheel:process <desc> | エージェントネイティブなプロセスを定義する。固定ルール、出力スキーマ、永続化を持つ再利用可能なプロンプト契約で、Claude が反復処理をバックエンドとして実行する。 | | /flywheel:run <slug> [input] | 定義済みプロセスをランタイムとして実行し、結果をリポジトリのデータストアに保存してから契約を成熟させる。 | | /flywheel:autoloop <goal> ⚡ | 自律的なメトリクス駆動ループ。予算を使い切るか目標に達するまで自動反復する。 | | /flywheel:sync <spec-slug> ⚡ | 仕様とコードの乖離を双方向で調整する。 | | /flywheel:update [vendored\|marketplace] | flywheel 自体を更新する。marketplace と vendored を自動判別するか、引数でモードを指定する。 |

エージェント

  • verifier はアプリ/テストを実行し、証拠付きの客観的 PASS/FAIL を返します。
  • reviewer-correctness、reviewer-security、reviewer-performance は /flywheel:review から並列で起動される敵対的な専門レビュアーです。このファンアウト自体はテストされていません(P32、v0.60.0)。評価エグゼキューターはサブエージェントで、サブエージェントを作れないため、このリポジトリの採点実行で reviewer-* が実際に起動したことはありません。skills/review/evals/ は、diff が導くレビュアーを成果物から読み取ることと、専門家が未実行だと報告に書かれることを確認します。実際のディスパッチはトップレベルのセッションから手動で実行する 1 本の手順だけです。
  • evaluator は /flywheel:autoloop が、曖昧な維持/破棄の結果と目標達成の直前に起動する独立検証器です。作業エージェントを信用せず、指標コマンドを自分で再実行します。
  • executor はステージルーティングの安価な層(Haiku、low effort)。完全に仕様化された機械的な計画タスクを 1 つ実行し、判断が残っていれば ESCALATE: <reason> と返します。/flywheel:work が haiku/low+delegate にルーティングしたときに起動します。

役割ごとのモデルルーティング(v0.9.0):機械的な verifier は Haiku でコマンドを実行して証拠を報告し、判断の重い reviewer-* は Sonnet で動きます。各エージェントの model: frontmatter(例:高リスクレビューの opus)で上書きするか、CLAUDE_CODE_SUBAGENT_MODEL で一括上書きできます。v0.39.0 以降、機械的な verifier/evaluator/executor は low、敵対的な reviewer-* は high の effort を固定します。

各タスクの check: は読まれるだけでなく実行される(v0.70.0)。すべての計画タスクに - check: が必要で、plan-route.sh はない計画を拒否します。bash scripts/check-task-closure.sh はタスクごとに PASS(許可リストのコマンドが実行され終了コード 0)、FAIL(終了コードが非 0)、UNRUNNABLE(許可されたコマンドがなく、実行も緑判定もされない)、PENDING(状態遷移行がなく未開始)を 1 行ずつ出します。行数はタスク数と一致します。実行可能な内容は scripts/task-closure-allow.txt が固定し、shell 演算子を含む範囲は拒否、残ったコマンドは shell を通さず argv として実行します。これは安全境界です。計画はどの PR でも書けるリポジトリ内容なので、任意の shell を実行できれば /flywheel:verify の gate.sh 信頼ストアが閉じるはずの露出を開いてしまいます。締切前に追加された計画はコーパスとして扱い、報告はしますが失敗にはせず、グリーンを得るために書き換えません(P18、P48)。ゲートが評価するのは周囲の文章ではなくコマンドの終了コードなので、これ以降の check: は完了時に成立する条件を記述します。

計画タスクごとのステージルーティング:モデル+effort(P27、v0.39.0)。計画は単一価格ではありません。/flywheel:plan は 3 層ルーブリックで route: <model>/<effort>[+delegate] を割り当てます。T1 は機械的で仕様が完全(haiku/low+delegate、executor が実行)、T2 は通常のテスト優先作業(sonnet/medium)、T3 は判断が必要で常に最も危険なステップ(opus/high)です。ルーティング表は計画ゲートの承認対象なので、モデル変更は途中で取る判断ではありません。/flywheel:work はルートを守り、2 回目の赤で 1 段階エスカレートして route(その場合は route_escalated_from)を状態遷移行に記録します。bash scripts/plan-route.sh <plan.md> はルートを lint して層の概要を出し、最も危険なステップが最上位層を下回る計画を 失敗 させます(層は scripts/route-tiers.txt にあります)。ここでは token 節約を主張しません。linter はタスクを数え、費用差は下記の cost proxy に乗ります(P18/P23)。

ループ内のアトミック commit(P28、v0.40.0)。/flywheel:work は各タスクのチェックがグリーンになった瞬間に commit して push します。git commit -m "<subject>" -- <the task's paths>(pathspec なので、そのタスクのパスだけを保持し、すでに dirty だった内容は含めません)と git push -u origin <branch> を使います。/flywheel:debug も修正と回帰テストに同じことをします。どちらも P21 の許可で事前承認された形式です。/flywheel:ship は残った台帳、仕様、ドキュメントだけを commit し、タスク履歴を squash、rebase、amend しません。書き換えは依頼された場合だけです。リポジトリ、remote、commit 対象がない、または push が拒否された場合は 1 度だけ報告し、ループは続きます。デフォルトブランチでは main に commit せず、先にフィーチャーブランチを作ります。

**Token の規律

インストール

まず作者の README で marketplace とプラグイン名を確認してください。コマンドはリポジトリの構成によって変わる場合があります。

claude plugin marketplace add arazvan-ec/xmarks
claude plugin install newspeak
原文 / README

flywheel 🎡

A Claude Code plugin that turns ad-hoc "vibe coding" into a disciplined, self-verifying loop for AI-assisted development. It distills the best practices from obra/superpowers, EveryInc/compound-engineering-plugin, karpathy/autoresearch, addyosmani/agent-skills, and gszhangwei/open-spdd into one coherent system.

This repository is the plugin, served through the xmarks marketplace (.claude-plugin/marketplace.json).

Install (Claude Code)

/plugin marketplace add arazvan-ec/xmarks
/plugin install flywheel@xmarks

Then /reload-plugins and run /flywheel:help. To make flywheel auto-activate in a repo, see docs/add-flywheel-to-a-repo.md.

Claude Code only — the claude.ai chat app uses a different Skills system and does not run Claude Code plugins.

Claude Code web — web sessions do not auto-install marketplace plugins, so neither /plugin install nor the settings.json marketplace keys make /flywheel:* appear there. Instead, vendor flywheel into the target repo once with scripts/install-vendored.sh; the commands then work on every surface as /flywheel-help, /flywheel-loop, … See docs/add-flywheel-to-a-repo.md. The same gap applied to flywheel itself: with no registered agents its own dev loop could not honor the +delegate routes it prescribes. install-vendored.sh --agents-only is the one self-target the guard allows — it registers agents/*.md into .claude/agents/ and nothing else (no skills, no hooks), and scripts/check-agent-parity.sh fails CI if the shipped and registered copies ever disagree in either direction. Its sibling --hooks-only registers this repo's own hooks into .claude/settings.json pointing at scripts/, and scripts/check-hook-parity.sh now also asserts that every hook hooks/hooks.json declares is registered there.

The idea: two nested loops

Outer loop (development cycle) — one unit of work flows through six gated phases:

spec → plan → work → verify → review → compound

Inner loop (inside work) — a tight write failing test → implement → run → observe → fix cycle that never declares "done" until an objective check is green.

Nothing advances on "seems right": verify runs the real app/tests, and every finished cycle deposits reusable knowledge into a ledger that primes the next one.

📚 New to loops as a concept? See docs/getting-started-with-loops.md — the four loop types (turn-based, goal-based, time-based, proactive) and how flywheel maps onto them.

⏱️ Want to run flywheel on a schedule or unattended? See docs/proactive-loops.md — composing /flywheel:verify/review with /loop, /schedule routines, /goal, and workflows.

The second pillar: an agent-native runtime (v0.15.0)

The loop above builds software. The process/run pair lets flywheel also operate it — turning the repo agent-native: Claude is a first-class part of the runtime, not a bolt-on. Instead of writing a static backend function for a recurring domain operation ("analyze a car", "score a lead", "ingest a report"), you define a process contract and let Claude run it.

  • /flywheel:process <desc> scaffolds .claude/flywheel/processes/<slug>.md: the fixed rules the operation always follows, its output schema, and where results persist — following the repo's own data strategy declared once in .claude/flywheel/DATA.md (e.g. Postgres via the repo's client), never a datastore flywheel imposes.
  • /flywheel:run <slug> [input] executes the contract as the backend: follow the rules, apply judgment only where the contract allows, write the result to the datastore and prove it landed (idempotent, read-back verified), then mature the contract — appending one evidence-based refinement so the next run is sharper. Fixed rules + a self-improving prompt, exactly as asked.

Full vision + the worked car example: docs/research/agent-native-processes.md.

Commands

| Command | What it does | | --- | --- | | /flywheel:help | Onboarding + command map. | | /flywheel:loop <feature> | Run the whole cycle end to end, gating between phases. | | /flywheel:brainstorm <idea> | Sharpen a fuzzy idea into agreed requirements before the spec. | | /flywheel:spec <feature> | Write a REASONS spec-contract + a machine-checkable success metric. | | /flywheel:plan <spec-slug> | Turn the spec into ordered tasks, each with its own check. | | /flywheel:work <task> | Implement with the inner iterate-until-green loop. | | /flywheel:debug <symptom> | Systematic debugging: reproduce → hypothesis → isolate → fix → regression test. | | /flywheel:verify | Objective PASS/FAIL gate — runs the real app/tests (via the verifier agent). | | /flywheel:review <ref> | Multi-specialist review routed by diff type (docs diff ≠ full fan-out), synthesized. | | /flywheel:compound | Append this cycle's decisions, gotchas, and patterns to the ledger. | | /flywheel:recall <query> | On-demand ledger search — list matching learnings cheaply, expand one on request. | | /flywheel:route <task> | Before delegating work outside a plan: recommends tool, fresh session, subagent or here, at which model and effort, from route-tiers.txt. | | /flywheel:ship <title> | Clean commit + push + PR to close out the cycle. | | /flywheel:process <desc> | Define an agent-native process — a reusable prompt-contract (fixed rules + output schema + persistence) for a recurring domain operation Claude runs as the backend. | | /flywheel:run <slug> [input] | Execute a defined process as the runtime — follow its rules, persist the result to the repo's datastore, then mature the contract from the run. | | /flywheel:autoloop <goal> ⚡ | Autonomous metric-driven loop — iterate hands-off until a metric is met or a budget is spent. | | /flywheel:sync <spec-slug> ⚡ | Reconcile drift between a spec and the code (bidirectional). | | /flywheel:update [vendored\|marketplace] | Update flywheel itself — autodetects marketplace vs vendored install, or takes the mode as an argument. |

Agents

  • verifier — runs the app/tests and returns an objective PASS/FAIL with evidence.
  • reviewer-correctness, reviewer-security, reviewer-performance — adversarial specialist reviewers dispatched in parallel by /flywheel:review. The fan-out itself is untested by the suites (P32, v0.60.0): an eval executor is a subagent, a subagent cannot spawn subagents, so no graded run this repo has ever made dispatched a reviewer-* at all. skills/review/evals/ covers what is left — which reviewers a diff draws (read from an artifact, not from the report's prose) and whether the report says the specialists did not run — and real dispatch has exactly one arm, run by hand from a top-level session, documented in that suite's README.
  • evaluator — independent cross-check dispatched by /flywheel:autoloop on ambiguous keep/discard results and before it declares its target met; re-runs the metric command itself instead of trusting the working agent's self-report.
  • executor — the cheap tier of stage routing (Haiku, low effort): does one fully-specified mechanical plan task in its own context and returns ESCALATE: <reason> rather than inventing a decision the task left open. Dispatched by /flywheel:work for a task routed haiku/low+delegate.

Model routing by role (v0.9.0): the mechanical verifier runs on Haiku (it runs commands and reports evidence); the judgment-heavy reviewer-* run on Sonnet. Override any agent via its model: frontmatter (e.g. a reviewer → opus for high-stakes reviews), or all at once with CLAUDE_CODE_SUBAGENT_MODEL. Since v0.39.0 each agent also pins its effort: — low for the mechanical verifier/evaluator/executor, high for the adversarial reviewer-*.

A task's check: is executed, not read (v0.70.0): every plan task must carry a - check: — plan-route.sh rejects a plan without one — and until now that field was linted for presence and never run, so "T4 is done" was a model grading its own work over a field that usually already held a runnable command. bash scripts/check-task-closure.sh runs it and prints one row per task: PASS (a command matched the allowlist, ran, exited 0), FAIL (it exited non-zero), UNRUNNABLE (no allowlisted command in the check — named and counted, never executed and never read as green), or PENDING (the cycle keeps a ledger and this task has no transition line in it, so it has not started — the loop commits a plan at its approval gate, before the work, and grading then would report not-started as broken). Rows equal tasks, so a dropped item is visible exactly where the count stops reconciling. What it may execute is pinned by scripts/task-closure-allow.txt — a span carrying a shell operator is refused before the allowlist is consulted, and what survives runs as argv with no shell, so an allowlisted prefix cannot append a second command. That file is a security boundary rather than a convenience list: a plan is repo content any PR can write, so running arbitrary shell out of it would hand /flywheel:verify the exposure gate.sh's trust store exists to close. Plans added before the cutoff are corpus — reported, never failed, never rewritten to buy a green (P18, P48). The gate grades the command's exit code, not the prose around it, so a check: written from here on states the condition that holds at close.

Stage routing: model + effort per plan task (P27, v0.39.0): a plan is not one price. /flywheel:plan routes every task with route: <model>/<effort>[+delegate] from a 3-tier rubric — T1 mechanical and fully specified (haiku/low+delegate, run by the executor agent), T2 ordinary test-first work (sonnet/medium), T3 judgment, and always the riskiest step (opus/high) — and the routing table is part of what the plan gate approves, so a model switch is a decision you signed, not one taken mid-task. /flywheel:work honors the route, escalates one tier on the second red instead of grinding cheap, and records route (plus route_escalated_from on an escalation) on the transition line. bash scripts/plan-route.sh <plan.md> lints the routes and prints the tier summary; it fails a plan whose riskiest step runs below the top tier (scripts/route-tiers.txt holds the tiers, so retuning them is a data edit). The payoff is deliberately not claimed in tokens — the linter counts tasks, and any cost delta rides on the cost proxies below (P18/P23).

Atomic commits inside the loop (P28, v0.40.0): a cycle no longer saves its work for the end. /flywheel:work commits each task the moment its check goes green and pushes it — git commit -m "<subject>" -- <the task's paths> (pathspec, so the commit holds that task and nothing that was already dirty) plus a force-free git push -u origin <branch>; /flywheel:debug does the same for a fix and its regression test. Both forms are exactly what the P21 grant already pre-approves, so the discipline costs no new permission surface. /flywheel:ship then commits only what is left (ledger, spec, docs) and never squashes, rebases or amends the task history — rewriting it is yours to ask for. Committing fails open everywhere: no repo, no remote, nothing to commit, or a rejected push is reported once and the loop carries on; on the default branch it creates a feature branch first rather than committing to main.

Token discipline (v0.12.0): /flywheel:autoloop treats its iteration budget as a hard stop and recommends piloting on a small budget before scaling; /flywheel:help points to /usage, /goal, and /workflows for spend visibility. See skills/autoloop/SKILL.md.

Delegation triggers (v0.13.0): /flywheel:work names advisory thresholds for handing off to a fresh-context subagent — reading 4+ files, touching 2+ non-trivial files, or ~20 tool calls deep without converging — to keep each turn's context lean.

Live progress (v0.16.0, two-tier since v0.30.0): every process run (/flywheel:run) and dev cycle (/flywheel:loop/work) materializes its steps as visible tasks in the host task system — states updated at every transition — and keeps per-execution telemetry at .claude/flywheel/runs/<slug>/<date>.jsonl (one appended JSON line per transition) plus an HTML report at …/<date>.html, rendered from the JSONL only at gates and at close and republished to a stable artifact URL. Output tokens are the expensive ones: a transition costs one line, never a regenerated page. Chat stays reserved for gates, blockers, and the final summary. Fail-open: reporting never blocks execution.

Cycle cost, measured (P23): each transition line carries a cost object — bytes_out, bytes_in, tool_calls, elapsed_s — and the rendered report ends with a cost block. These are proxies, labelled as such everywhere they appear, never token counts: a session cannot observe its own token usage, so recording one would put unverifiable evidence in the ledger (P18) — scripts/run-cost.sh warns if it finds a tokens key. bash scripts/run-cost.sh <run.jsonl> [baseline.jsonl] totals a run and prints the per-field delta against a baseline, so "this made the loop cheaper" becomes a number. Transitions from before the schema are reported as unmeasured, never counted as zero — otherwise every old run would look free. bytes_in (P40a) floors read volume (charged once per read, nothing for conversation) and is reported UNMEASURED, never 0, in old runs to prevent fabricating improvements. bytes_in and tool_calls are recorded as they happen (P44): scripts/read-meter.sh sits on PostToolUse and appends one line per call — the bytes of tool_response that entered context — so a transition line reads bytes_in, tool_calls and elapsed_s with read-meter.sh --since <previous ts> (or --since first on a cycle's opening transition, which has no previous ts — every run before P45 omitted elapsed_s on line 1 because a commit-time delta has no previous commit) instead of recalling a total nothing kept, which is why both fields were absent from every line in the repo's history. A write tool's response echoes the file it changed without that text reaching context, so the call counts and its bytes do not, and no meter at all reports UNMEASURED rather than a zero. bash scripts/check-telemetry.sh gates conformance (every runs JSONL line holds valid proxies) and coverage (every spec slug is instrumented unless exempted with a reason in scripts/telemetry-baseline.txt), failing the build if either rule breaks.

State it keeps (in the project you use it on)

  • .claude/flywheel/specs/<slug>.md — REASONS specs and .plan.md plans.
  • .claude/flywheel/processes/<slug>.md — agent-native process contracts (fixed rules + output schema + persistence + an append-only improvement log), created by /flywheel:process and matured by /flywheel:run.
  • .claude/flywheel/DATA.md — the repo's data-persistence strategy (Store / Access / Schema / Conventions) that every /flywheel:run writes through, so results land the way the repo already stores them.
  • .claude/flywheel/LEARNINGS.md — the compounding ledger. Typed entries (## <type>: <title> + a greppable <!-- fw: … --> metadata line; type ∈ decision/gotcha/pattern/bugfix/fixture) let the SessionStart hook inject only a relevance-scored, budgeted subset (branch/files/recency, default top 12, FLYWHEEL_LEARNINGS_INJECT to override) instead of a blind reload; /flywheel:recall <query> reaches the rest on demand. Created by /flywheel:compound. Older free-prose entries still load, as always-eligible low-priority entries.
    • fixture entries (v0.21.0) capture how to set up the world — the recipe to build a valid stub for a domain entity, seed the datastore, or stand up a test harness — the costliest thing a session otherwise re-derives. /flywheel:work offers to record one when it spends real effort building test data, and /flywheel:spec + work prime from any that match the task's entities before the rediscovery.
    • Evidence-gated (v0.25.0): flywheel gates knowledge the way it gates code. Each entry carries evidence= — what proved it (a test, a run/PR, a command → result). A lesson that can't point to a proof is written evidence=unverified explicitly, and the SessionStart injection + /flywheel:recall flag those so a wrong-but-plausible conclusion can never masquerade as proven context. /flywheel:compound records only what a cycle actually proved.
  • .claude/flywheel/runs/<slug>/<date>.jsonl + .html — per-execution telemetry for process runs and dev cycles (v0.16.0): one JSONL line appended per state transition; the HTML report (task ledger + states, gates, unit telemetry, verdict) rendered from the JSONL only at gates and close (v0.30.0).

Read-priming hook (advisory)

Before reading a file, a PreToolUse hook greps the ledger's files= metadata for that path and, if any typed entry names it, injects a short "prior learnings touch this file" note into context via the hook's additionalContext field (v0.18.0 — plain stdout is transcript-only and never reaches the model) — cheap context ahead of an expensive read. A bash pre-filter skips the python parser entirely for the no-match majority. It never blocks the read (unlike claude-mem's File Read Gate) and fails silently (no ledger, no match, or no python3) so it can never slow down or break a read.

Approval-coherent permissions

flywheel has exactly two deliberate approval gates, and both are conversational: the spec sign-off and the plan approval. The harness's tool-permission layer knows nothing about them — so without help it re-asks "allow?" for actions the approval already implied. Two allow-only PreToolUse hooks close the gap; everything they don't match keeps the normal permission flow, and (docs-guaranteed) a hook "allow" can never override a deny/ask rule you wrote yourself. Both are fail-open by contract: they never deny, never ask, never block; malformed input or a missing python3 just falls back to the ordinary prompt.

  • State writes (v0.27.0, Write|Edit|MultiEdit|NotebookEdit): a write whose target resolves inside <project>/.claude/flywheel/ is auto-allowed — specs, plans, the ledger, process contracts, run reports. Repo code and .claude/settings.json are out of scope. Paths are realpath-resolved before the containment check, so .. traversal, prefix siblings (.claude/flywheel-evil/) and symlinks planted inside the state dir that point elsewhere get no grant.
  • Loop-advancing git (v0.28.0, Bash): one plain git add, git commit, git stash (bare/push/pop/list), or a force-free git push [-u] origin <branch> where <branch> is the current, non-default branch — checked live against the repo. Any shell metacharacter outside single quotes (chaining, pipes, redirects, $(…)/backticks even inside double quotes) disqualifies the whole command, so git commit -m "x" && anything never rides the grant while a quoted -m "fix: A & B" passes. Global git flags (-C, -c, --git-dir), foreign remotes, refspecs, --force*, stash drop/clear and every other verb stay prompted.

The commands the plugin cannot know — your test/metric command, your DATA.md datastore write path — get their grant at the gate that approves them: /flywheel:spec and /flywheel:process offer at sign-off (never write unasked) to append the matching narrow rule (e.g. Bash(npm test:*)) to the project's .claude/settings.json permissions.allow, committed with the spec/contract; /flywheel:sync flags signed pre-v0.28.0 specs/contracts that lack their rule as drift.

Progress toolbar, enforced (P56, v0.74.0)

While a .claude/flywheel/specs/<slug>.plan.md that the current branch touches (vs its base, or uncommitted) still has a task with no transition line, the final reply of each turn must open with <🟢|⏸️|🔴|🏁> <done>/<total> <bar> · ▶ <item> · «<what, in the owner's words>». scripts/toolbar.sh enforces it as two hooks: UserPromptSubmit injects the format and the live count (slug done/total, open task ids) as context every prompt, and Stop blocks (exit 2) a final reply whose first line is not the toolbar or whose total is not the plan's. Mid-turn notes are exempt. stop_hook_active never re-traps, and anything it cannot read is a no-op.

A shipped cycle says what it learned (P69, v0.83.0)

scripts/compound-due.sh is a Stop hook: a runs/<slug>/*.jsonl this branch touches that has a phase: ship line and no phase: compound line blocks the turn (exit 2). /flywheel:compound appends that line with entries: N; a cycle that proved nothing durable records entries: 0 with a reason. Before it, 14 of 16 shipped runs in this repo carried no compound line.

Feedback about flywheel reaches flywheel (P70, v0.83.0)

A lesson about the plugin, learned in a repo that only uses it, used to stay in that repo's ledger. When /flywheel:compound writes one outside this repo, it offers scripts/upstream-issue.sh, which renders the entry as a prefilled flywheel feedback issue URL (label flywheel-feedback) with only flywheel paths kept. Nothing is sent until a human reviews the form and submits it. The same form is open to anyone using the plugin. The flow-audit process reads the open issues as input and gives each one a disposition.

A delegated review says it started (P57, v0.75.0)

A review sent to another session (create_session) that posts nothing reads the same whether it found nothing, could not post, or is still running. skills/review/references/delegated-review.md is the child's prompt template: post a 🔎 Review started … fw-review-start comment on the PR first, through the GitHub MCP tools (the container has no gh), then post the findings as one review with inline comments, or a "no findings" comment. The delegation guard's REVIEW family asks when a delegated review prompt lacks fw-review-start, naming the template.

Mods (P72, v0.84.0+)

Claude Code mods ship from this marketplace as separate, opt-in plugins under mods/<name>/, each with its own version and tests (scripts/check-mods.sh).

Claude Code web (cloud sessions): marketplace plugins are not installed there, mods included. Load mods by folder instead, with CLAUDE_CODE_PLUGIN_DIRS, verified in a cloud container on CLI 2.1.289. In the environment's settings (cloud environment menu → Edit), add to the setup script git clone --depth 1 https://github.com/arazvan-ec/xmarks /opt/xmarks, and set the environment variable CLAUDE_CODE_PLUGIN_DIRS=/opt/xmarks/mods/resource-committee:/opt/xmarks/mods/big-brother-token (absolute paths, :-separated). New sessions load them. A project's own settings.json cannot set this variable. Step by step, and what each mod measures: docs/mods-in-the-cloud.md.

| Mod | What it does | Install | | --- | --- | --- | | resource-committee | Assigns every turn its model and effort: sonnet/medium by default, opus/high for judgment, sonnet/low for mechanical work, classified once per prompt by Haiku so the cache survives. /committee shows the decision or pins haiku/sonnet/opus/auto; /committee stats sums each session's tally. Subagents keep their own model. | /plugin install resource-committee@xmarks | | big-brother-token | Live bytes read, session cost and context % in the status line; a toast for any single read over 8 KB and for a Write that rewrites a file already read; /ministry gives the dossier by tool and Bash bytes by command. Stores each session's summary, with its cost. | /plugin install big-brother-token@xmarks | | memory-hole | A prompt carrying a list (2+ numbered items or 3+ bullets, code fences ignored) holds Edit/Write/NotebookEdit until the list is written to a .plan.md, the scratchpad, or tasks.md/todo.md. /memory-hole release lets it go, logged. | /plugin install memory-hole@xmarks | | ventanilla-unica | /ventanilla [base] runs scripts/sweep.sh in the background and stamps each gate in a pane as its line arrives; a toast gives the verdict. A sweep the model runs through Bash is stamped too. /ventanilla status answers in text. | /plugin install ventanilla-unica@xmarks | | social-credit | A citizen score in the status line, kept across sessions: +1 per Edit, −5 for a Write over a file already read, ±3 for test-first on scripts/, +1 per commit, −10 per SKIP_*= or --no-verify. Below 80 a re-education section joins the system prompt. /social-credit lists acts; amnesty resets. | /plugin install social-credit@xmarks | | thought-police | At Stop, a reply whose fenced code repeats 8+ lines written this turn (Write/Edit) is blocked once with the reason: report what and where, the diff is in git. Never blocks twice in a row. | /plugin install thought-police@xmarks | | newspeak | For a prompt carrying a list, names the items with no success criterion (English or Spanish markers: so that, must, passes, para que, en verde, a number with a unit…) in a context note asking the model to get one first. Never blocks. Also counts multi-item asks written in prose, without nudging. /newspeak shows both. | /plugin install newspeak@xmarks | | ration-book | A per-session read ration: p75 of the last 10 sessions once 5 are recorded (floor 100 KB), else 400 KB. Coupons left in the status line, a toast at 80%, and at 100% Read/Grep/Glob/WebFetch/WebSearch are held (Bash and writes never). /ration grant <KB> adds coupons, announced. | /plugin install ration-book@xmarks | | black-market | Ledgers every SKIP_*=<reason>, --no-verify and Release-Exception: the session uses, with its reason; one without a reason (1, empty) raises a toast. /black-market audit totals the standing permits in scripts/*allow*.txt, *baseline*.txt, invocation-budget.txt and the git log's trailers. | /plugin install black-market@xmarks | | citizen-file | /expediente [slug] opens a pane on a cycle's run record (.claude/flywheel/runs/<slug>/*.jsonl, newest by default): each transition with its route, escalations marked, then transitions, bytes in and escalations totalled. list and status answer in text. | /plugin install citizen-file@xmarks | | telescreen | When a Read/Edit/Write touches a file a LEARNINGS.md entry cites (files=), a band above the prompt shows the newest such lesson, with Hide. No match, no band. /telescreen counts lessons loaded and slogans shown. | /plugin install telescreen@xmarks | | supervisor | Every N prompts (default 5, /supervisor every <n>) the turn is asked to name what closed with its evidence; a reply naming no file:line, backticked command or commit gets a toast. Never blocks, spawns nothing. /supervisor counts checks and evidenced replies. | /plugin install supervisor@xmarks | | general-strike | Tracks check commands (test, check, sweep, pytest, jest, go test…): the 3rd consecutive failure of the same one, with an edit since the last, holds Edit/Write/NotebookEdit and tells the next prompt to run /flywheel:debug. Reads and Bash keep running. Ends on a pass, on opening flywheel:debug, or /strike end. | /plugin install general-strike@xmarks |

Deterministic completion gate (opt-in)

Drop an executable .claude/flywheel/gate.sh in your project with your verification command (e.g. npm test && npm run lint). While it exists and you've trusted it, flywheel's Stop hook runs it whenever Claude tries to finish and blocks finishing if it fails — so nothing is declared "done" with checks red.

Trust it first (v0.20.0): because the gate is a repo file that runs automatically, a PR could plant a malicious one — so an unrecognized gate is not executed. The first time it's seen, the hook prints the one command to trust it (a content hash stored outside the repo, so a PR can't self-authorize); editing the gate revokes trust until you re-consent. It is a no-op when absent, skips re-running when the git-tracked working tree is byte-for-byte the last-passing state (a git-derived signature over tracked + untracked content; non-git state like env vars or ignored files isn't observed, and it only ever skips a re-run — a changed tree always re-runs), bounded to a few consecutive blocks per failing tree with a persisted bypass (so a red gate never re-traps you), and fails open on internal errors.

One suite run per cycle (v0.30.0): /flywheel:verify uses the project's gate.sh as its suite command when present, and after a PASS runs gate.sh seal — recording the passing tree's signature so the Stop hook cache-hits instead of re-running the same suite minutes later. Seal accepts the caller's evidence, never creates it: it refuses an untrusted gate (a planted gate can't arrive pre-passed) and covers exactly one tree signature — any change re-runs.

Auto-update runs pinned code (v0.61.0)

install-vendored.sh --auto-update writes .github/workflows/flywheel-update.yml into your repo: a thin caller of flywheel's reusable workflow that refreshes your vendored copy and opens a PR. That workflow runs in your CI, with contents: write + pull-requests: write, on a weekly cron, so what it executes is a trust boundary — the only Critical in docs/research/pillar2-threat-model.md. It used to git clone this repo's main and bash the result, which handed arbitrary code execution in your repo to anyone who could push here.

Pinning the caller's uses: alone does not fix that: a pinned workflow that still clones a moving branch executes the branch. So both halves are pinned — the caller names a full commit SHA and passes that same commit as a flywheel_sha input, and the reusable workflow checks that commit out, refusing before any vendored bash runs if the input is absent or is not a full 40-hex SHA. bash scripts/check-supply-chain-pin.sh asserts both halves independently, so deleting either one turns it red on its own; exceptions live in scripts/supply-chain-pin-allow.txt with a reason, and a stale entry fails. There is no github.job_workflow_sha to read the pin from — the field does not exist, which is why the caller passes it explicitly.

This buys one specific thing: a compromised flywheel release can no longer reach your repo by itself. It does not make a release you choose to adopt safe. The pin is now the update lever — nothing bumps it for you, so the weekly job no longer opens update PRs on its own. Discovery still works by the routes that have a human in them: the SessionStart hook polls this repo's plugin.json and prints ⬆️ flywheel X.Y.Z is available, and /flywheel:update refreshes on demand. What is gone is precisely the unattended part — which was the part executing unreviewed code. See upgrades/v0.61.0.md; repos installed before 0.61.0 carry an @main caller whose weekly job now fails until they re-vendor.

Skill evals (manual release gate — not in CI)

Skills are prompts, so structural checks can't catch a behavioral regression — verify starting to rationalize a FAIL into a PASS, work skipping the red step, or process emitting a contract with no fixed rules. The skills where that hurts most carry behavioral evals in the skill-creator format, each with evals.json (realistic prompts + objective assertions), fixtures whose ground truth is known, and benchmarks/<date>/ holding the committed evidence of the last graded iteration:

  • Pillar 1 — skills/verify/evals/, skills/work/evals/ and skills/loop/evals/: planted-bug mini-repos under evals/fixtures/, graded by a committed check.sh (last-line VERDICT: regex over the saved report.md/transcript.md; .check-log red-before-the-implementation-changed — a RESULT=FAIL at the pristine IMPL_SHA with no changed-sha entry before it — then a final PASS, plus a behaviour probe and an independent suite re-run). loop (P29, v0.41.0) is the only suite that runs a whole cycle, and therefore the only place work's cycle telemetry exists to be graded at all: its grader parses the transition JSONL, rejects a tokens key, resolves every recorded commit against git with cat-file (a plausible sha nobody made fails), rejects a commit that mixes .py source with .claude/flywheel/ state, and runs a second eval in a non-git workdir where the correct outcome is no commit field and none invented. A third eval (P30, v0.42.0) grades the other half — a cycle that cannot pass, because its work item demands a tax-inclusive total and that the existing ex-tax test keep passing. An honest run may stop at any gate and leave the suite green or red, so neither route nor colour is asserted; what is asserted is what every cheap way out must touch — the pre-existing assertion stays verbatim, the telemetry records the blockage, and no transition claims a verdict: PASS.
  • Pillar 2 — skills/process/evals/ and skills/run/evals/: a versioned mini target repo (DATA.md + the trivial plate-audit contract + a seeded datastore, its setup recipe captured as a type=fixture learning) and a committed grader script check.sh that greps the artifacts the run left behind.

All six graders share one contract — bash skills/<name>/evals/check.sh <id> <workdir>, one PASS:/FAIL: line per expectation, exit 0 only if all pass, exit 2 on an unknown id — and each mechanizes exactly the expectations in its own evals.json. Two CI gates keep them honest (P26), because both defects they exist to catch were found by accident rather than by a check:

  • scripts/test-eval-graders.sh runs every grader against an untouched fixture and requires a red — the question "can this assertion even fail?" is what exposed the hollow run eval-2 grader — and runs the pillar-1 graders against an ideal outcome to require a green, so a grader that can never pass is caught too. Those ideal outcomes are committed assets under skills/<name>/evals/solutions/<solution>/, applied by fixture-scratch.sh --solution (P33), so the gate grades exactly what a person can reproduce by hand. Each solution declares its fixture and eval ids in a MANIFEST — cart-feature/cart.py and cart-bugfix/cart.py are byte-identical, so a clean patch apply proves nothing about which fixture it was written for — and pins the fixture's tree digest in BASED-ON, since git apply detects drift only in a patch's own context lines. Edits to files the fixture already has are patch/ entries, never whole-file overlay copies: a copy of test_cart.py would shadow its KATA_HARNESS guard, the thing that makes .check-log trustworthy, and the green arm would stay green after the fixture moved. Solutions live outside fixtures/ because they are the answer key. Pillar 2's green side is still not built (that would reimplement what it grades); its green evidence is the committed benchmarks.
  • scripts/check-fixture-leaks.sh fails the build when a fixture file contains the assertion vocabulary (VERDICT:, baseline-sha, IMPL_SHA, "the eval asserts", "pristine", "eval fixture", …). Legitimate hits — run-tests.sh must name the .check-log it writes — are allowlisted per path and per pattern with a reason in scripts/fixture-leak-allow.txt; stale entries fail. Ground truth belongs in skills/<name>/evals/README.md, which is never copied into a workdir.

When to run: manually, before bumping the version on any release whose diff touches one of those skills. They are deliberately not in CI — one iteration costs roughly 300–800k tokens.

How to run one iteration (from a Claude Code session on this repo):

  1. Instantiate the eval's fixture into a scratch workdir with bash scripts/fixture-scratch.sh <skill> <eval-id> --keep, which prints the path. It reads evals.json, so it applies whichever schema the suite uses — copy the files list (pillar 1) or run the eval's own setup (pillar 2) — and --print-prompt emits the prompt with {{WORKDIR}} already substituted. Never point a run at the fixture template itself.

    Doing it by hand is a trap worth naming, because this step used to say W=$(mktemp -d): the setup commands are cp -r <fixture> "$W", which nests the fixture into $W/<fixture-name>/ when $W already exists, and every grader then fails on a workdir that is correct in every other respect.

  2. Spawn a fresh-context subagent per run, told to read skills/<name>/SKILL.md and execute it as if the user had invoked the eval's prompt, with every repo-relative path resolved against the workdir. Pillar 2 briefs add eval mode: gates are pre-approved and the host task system / artifact publishing are unavailable, so the skill's fail-open paths apply — the telemetry report still gets written. A baseline (no-skill) run per eval is optional: it measures the skill's value, while the release gate only needs the with-skill regression signal.

  3. Grade with the skill's committed grader — bash skills/<name>/evals/check.sh <id> "$W" for all six skills now (one PASS/FAIL line per expectation, exit 0 = all green). Pillar 2: export FW_EVAL_DATE=<run date> when regrading a workdir on a later day. Pillar 1 verify: the grader reads report.md and transcript.md from the workdir root — save them there, or point FW_EVAL_REPORT / FW_EVAL_TRANSCRIPT at them. Never grade by re-deriving regexes by hand: that is how a vacuous assertion survives.

    While designing a fixture — before any executor run exists to grade — chain the whole loop in one command instead of writing a scratch script: bash scripts/fixture-scratch.sh <skill> <id> --solution <name> --suite --check. It instantiates, applies the reference solution, runs the suite the grader would run (KATA_HARNESS=1, never run-tests.sh, which appends to the .check-log being graded), grades, prints one PASS:/FAIL: line per step, and tears the workdir down. --digest prints the value a new solution's BASED-ON needs.

  4. Aggregate into benchmark.json/benchmark.md (skill-creator schema) and commit them under skills/<name>/evals/benchmarks/<date>/ as the release evidence.

A regression (with-skill pass rate below the committed benchmark, or any planted-bug eval rationalized into a PASS) blocks the release until the skill text is fixed.

The baseline arm (value study) — documented, not yet run

The release gate needs only the with-skill arm: it answers "did this skill text regress?". A baseline arm — the same eval run by a subagent that is not given the skill — answers a different and unanswered question: "is this behavior the skill's, or would a strong model do it anyway?". Run it as a deliberate study, never as part of a release:

  1. Same fixture instantiation as step 1 above, into a separate workdir per arm so the two never share state.
  2. Spawn the baseline subagent with the eval's prompt and no reference to skills/<name>/SKILL.md — no summary of it, no paraphrase. Everything else (eval-mode briefing, pre-approved gates, path resolution) stays identical, or the comparison measures the briefing instead of the skill.
  3. Grade both arms with the same grader and record them as two configuration values (with_skill, without_skill) in one benchmark.json, as the pillar-1 benchmarks do.
  4. Report the delta per assertion, not just per eval — a tie on pass rate can still hide which specific contract the baseline broke.

Status: not run for process/run. Their committed iteration is with-skill only (~237k tokens), so their 49 green assertions are a regression baseline and not evidence that the skills beat an unaided model. Cost of closing that gap is roughly 120k tokens per skill. Until it is run, do not cite pillar-2 pass rates as skill value.

work's katas are regression-only, and that is now a measured conclusion rather than a caveat. Three iterations tried to make them discriminate and all three tied at 100%: the v0.31.0 run (prompt named ./run-tests.sh), the P25 run (prompt de-hinted, but the fixture README still stated the grading rule verbatim), and the 2026-07-30 run with that leak removed and the fixture reading like an ordinary repo — where the baseline still wrote the regression test first, ran it red against a pristine cart.py, and only then fixed it. A strong model does test-first on a kata this small whether or not the skill says so. That is a fact about the task, not a defect in the skill, and citing the 100% as skill value would be the kind of unverifiable claim these evals exist to remove. What the suite still earns its cost for: if a future edit to work/SKILL.md stops inducing the red step, the with-skill arm drops below 8/8 and that is a real regression signal. Evidence: skills/work/evals/benchmarks/2026-07-30/benchmark.json.

Repo layout

The plugin lives at the repo root: .claude-plugin/ (manifest + marketplace), skills/, agents/, hooks/, scripts/. Setup guides are in docs/, and upgrades/ holds the per-version, AI-authored migration notes that /flywheel:update executes in installed repos (CI requires one per release).

Design research and the improvement backlog live in docs/research/ — see improvement-proposals.md for the living roadmap (P1–P6).

関連作品