dsj1984/mandrel/tree/main/.agents/mods/mandrel-status
關於這個 mod
Mandrel
一套以 Story 為核心、建構在 GitHub 編排上的 AI 程式設計助手工作流程框架。規劃、執行與狀態都原生存在 GitHub Issues、Labels 和 Projects V2 中。
Prerequisites
Mandrel 以 mandrel npm 套件發佈,並將編排接到專案的 GitHub 儲存庫。你不需要事先建立 Git 儲存庫或 GitHub 遠端;bootstrap.js 會在冷啟動時一併建立它們(git init → gh repo create --push → gh project create)。你需要:
- Node.js >= 22.22.1(< 25)。
- 在 PATH 中的 git。
- 已完成驗證的 GitHub CLI gh >= 2.40。先執行一次 gh auth login,讓編排腳本從作業系統金鑰鏈取得權杖。一般權杖不具備建立 GitHub Projects V2 看板所需的 project scope;此時 bootstrap 會降級為 warn-and-skip-board,不會硬失敗。若要啟用看板建立,請在執行 bootstrap.js 前用 gh auth refresh -s project 授予 scope。
Quickstart
標準的冷啟動路徑是先執行一個命令,再執行一個斜線命令:
npx mandrel init # install mandrel → sync → prompt → bootstrap → onboarding tail → /mandrel-plan handoff
# then, inside Claude Code (commands load from .claude/commands/):
/mandrel-plan --seed "…" # interrogate → author one Story (default) → persist
/mandrel-deliver <id> # story-<id> → PR → main
當 ./.agents/ 不存在時,npx mandrel init 會安裝 mandrel,接著用 mandrel sync 實體化,然後詢問是否要現在設定(選項 1:執行 bootstrap.js,再跑堆疊偵測、文件腳手架選項、mandrel doctor 就緒閘門與 /mandrel-plan 交接),或停在只產生檔案(選項 2:之後隨時重新執行 mandrel init)。傳入 --assume-yes 可進行非互動執行,並將旗標轉交給 bootstrap。當 ./.agents/ 已存在時,init 會略過安裝與同步,直接進入提示。完成後執行 /mandrel-plan --seed "<idea>" 撰寫第一個 Story,再用 /mandrel-deliver <storyId> 交付(story-<id> → PR → main)。
Manual equivalent
如果你想手動執行 mandrel init 包裝的步驟,請在專案根目錄執行:
npm install mandrel # pin an exact, provenance-signed version
npx mandrel sync # materialize ./.agents/ from the package
node .agents/scripts/bootstrap.js
npm install mandrel 會在鎖定檔中固定精確且具來源簽章的版本。postinstall 鉤子會盡力執行 mandrel sync,所以 ./.agents/ 通常會自動實體化;明確執行 npx mandrel sync 是給 --ignore-scripts 或沙箱 CI 安裝用的加強保險。隨時執行 npx mandrel doctor 確認安裝健康。
pnpm 使用者——請提升 mandrel 的執行階段相依套件。 實體化的 ./.agents/scripts/*.js 會從專案根目錄執行,並從頂層 node_modules 解析第三方相依套件(ajv、js-yaml、…)。 npm 和 yarn 會自動把傳遞相依套件提升到那裡;pnpm 預設的隔離配置則不會——它會把套件留在 .pnpm 虛擬儲存區,因此框架腳本和 mandrel doctor 的 runtime-deps 檢查看不到它們。請在安裝前把以下內容加入 .npmrc:
# Lift mandrel's runtime deps to the top-level node_modules so the
# materialized .agents/scripts can resolve them.
shamefully-hoist=true
想要更精準的替代方案?把 shamefully-hoist 換成針對 .agents/runtime-deps.json 中每個套件的有範圍 public-hoist-pattern[]= 行。請讀取該檔案,不要直接複製清單,因為 complexity kernel 的閉包包含數個套件。如果 mandrel doctor 回報 runtime-deps missing: …,這就是修正方式。
bootstrap.js 在 TTY 上是互動式的,會自動接受它能從本機 git remote 和 git config user.name 推斷出的 owner、repo、base branch 和 operator handle,只詢問無法推斷的欄位(通常是選用的 Projects V2 number)。如果資料夾還不是 Git 儲存庫,或 GitHub 儲存庫不存在,它會執行 git init 加上第一個 commit,接著執行 gh repo create --source=. --push(用 --visibility private|public|internal 設定可見性,預設 private),再執行 gh project create。可以用 --owner、--repo、--base-branch 或 --operator-handle 覆寫推斷值。CI / 腳本化安裝請傳入 --assume-yes 和需要的覆寫。腳本具備冪等性,可安全重跑。
消費者參考資料與端到端工作流程說明請見 .agents/README.md 和 docs/SDLC.md。每個 .agentrc.json 鍵都記錄在 .agents/docs/configuration.md,斜線命令索引位於 .agents/docs/workflows.md。
Update
用一個命令把 mandrel 更新到最新發佈版本,並重新實體化 ./.agents/:
npx mandrel update
mandrel update 依序執行 Resolve(npm view mandrel version)、No-op short-circuit、Install、Sync、Migrate、Doctor 和 Surface。Install 會從鎖定檔自動判定 pnpm、yarn 或 npm,升級留在磁碟上但不執行 git add / git commit;最後顯示目標變更記錄章節。
Flags
- --dry-run 會列印目標版本與步驟計畫後離開,不升級相依套件、不寫檔、不執行 seam。
- --install-cmd "<cmd>" 會覆寫自動偵測的命令。pnpm-lock.yaml 使用 pnpm add -D …,yarn.lock 使用 yarn add -D …,否則使用 npm install …;{target} 會替換成最新版本,例如 --install-cmd "pnpm add -D mandrel@{target} -w"。登錄站探測始終使用 npm view。
Manual equivalent
npm install mandrel@latest # or pnpm add / yarn up
npx mandrel sync # re-materialize ./.agents/
npx mandrel doctor # verify the install
Benchmarking
Mandrel 的效果由獨立的配套儲存庫 mandrel-bench 衡量,它是已發佈 mandrel 套件的消費者。它固定特定框架版本,透過 mandrel sync 實體化,並在情境語料上驅動 /mandrel-plan→/mandrel-deliver 流程,另加裸模型對照組。每次執行會在 Quality、Planning fidelity、Autonomy、Efficiency 和 Overhead ratio 五個面向評分,並以帶雜訊帶的分佈回報,追蹤框架相對裸模型基線的附加價值。
基準測試刻意放在獨立儲存庫:固定 harness、改變 mandrel 版本可解耦 harness-version 與 framework-version;透過已發佈套件和 mandrel sync 路徑執行,則會實際演練消費者契約。相依方向是單向的,mandrel-bench 相依 mandrel,反之不然。維度、執行模型和新版本的基準測試方式請見 mandrel-bench README。
Contributors
已發佈的 mandrel 套件包含 .agents/、bin/、lib/ 三個目錄,以及 docs/CHANGELOG.md,並排除 .agents/ 和 lib/ 下的 tests 子樹。 .agents/ 是 mandrel sync 實體化到消費者 ./.agents/ 的負載;bin/mandrel.js 和 lib/ 實作留在 node_modules/mandrel/,支援本 README 中的 npx mandrel … CLI。docs/、tests/、.github/ 和根目錄工具設定都是內部開發工具,不會發佈。
npm run lint # biome + markdownlint + repo ratchets + generated-doc drift
npm run format # biome format — JavaScript/JSON only, not markdown
npm test # framework tests
npm run test:coverage # tests with coverage gate
更深入的參考資料位於 docs/:docs/architecture.md 說明模組圖、儲存庫配置、狀態機和技術堆疊;.agents/docs/configuration.md 說明每個 .agentrc.json 鍵;.agents/docs/workflows.md 是斜線命令索引;docs/CHANGELOG.md 是發行記錄;AGENTS.md 會連到 docs/onboarding.md;docs/release-operations.md 說明 Release Checklist、Install Matrix 發行閘門、單套件發行拓撲、PAT / npm-token 與大版本策略。發行由 release-please 自動完成,會在 main 上的 Conventional Commits 後開啟 chore: release main PR,CI 通過後 squash-merge、加標籤並發佈到 npm。
安裝腳本預設停用:.npmrc 設定 ignore-scripts=true,所以 npm install / npm ci 不會執行依賴生命週期鉤子,這是針對遭入侵傳遞套件的縱深防禦(CWE-1357)。CI 會明確傳入 --ignore-scripts,需要時只對單次呼叫使用 npm install --ignore-scripts=false。
CRAP 與 Maintainability 閘門會在 .husky/pre-commit、.husky/pre-push、close-validation 和 CI(ci.yml)觸發,都套用 .agentrc.json 中 delivery.quality.* 的相同閾值。四者全部阻擋;pre-commit 會在違規時拒絕提交,而綠色的 npm run lint / npm test / check-baselines.js 並不能預測結果。
License
MIT
安裝
請先查看作者 README,確認 marketplace 與外掛名稱;指令可能隨儲存庫結構而變動。
claude plugin marketplace add dsj1984/mandrel claude plugin install mandrel-status
原文 / README
Mandrel
An opinionated workflow framework for AI coding assistants built on Story-centric GitHub orchestration. Planning, execution, and state all live natively in GitHub Issues, Labels, and Projects V2.
Prerequisites
Mandrel is distributed as the
mandrel npm
package and wires its orchestration into your project's GitHub repository.
You do not need a pre-created Git repo or GitHub remote — bootstrap.js
provisions both as part of a cold start (git init → gh repo create --push
→ gh project create). You need:
- Node.js >= 22.22.1 (< 25).
giton yourPATH.- GitHub CLI
gh>= 2.40, authenticated — rungh auth loginonce so orchestration scripts pick up your token from the OS keychain. A vanillagh auth logintoken does not carry theprojectscope needed to provision the GitHub Projects V2 board; bootstrap degrades to warn-and-skip-board in that case (no hard failure). To enable board provisioning, grant the scope withgh auth refresh -s project(re-auth in the browser when prompted) before runningbootstrap.js.
Quickstart
The canonical cold-start path is one command, then one slash command:
npx mandrel init # install mandrel → sync → prompt → bootstrap → onboarding tail → /mandrel-plan handoff
# then, inside Claude Code (commands load from .claude/commands/):
/mandrel-plan --seed "…" # interrogate → author one Story (default) → persist
/mandrel-deliver <id> # story-<id> → PR → main
npx mandrel init installs mandrel (when ./.agents/ is absent),
materializes it via mandrel sync, then asks whether to configure now
(option 1 → runs bootstrap.js, then the onboarding tail: stack detection,
docs scaffolding offer, mandrel doctor readiness gate, and a /mandrel-plan
handoff) or stop at just the files (option 2 → re-run mandrel init
any time to configure). Pass --assume-yes for a non-interactive run that
proceeds straight to configure (and forwards the flag to bootstrap). When
./.agents/ is already present (you ran npm install mandrel first), init
skips the install/sync and goes straight to the prompt. Once mandrel init
completes, you land at the /mandrel-plan handoff — run /mandrel-plan --seed "<idea>" to
author your first Story, then deliver it with /mandrel-deliver <storyId>
(story-<id> → PR → main).
Manual equivalent
If you prefer to drive the steps mandrel init wraps by hand, run them from
your project root:
npm install mandrel # pin an exact, provenance-signed version
npx mandrel sync # materialize ./.agents/ from the package
node .agents/scripts/bootstrap.js
npm install mandrel pins an exact, provenance-signed version in
your lockfile. The package's postinstall hook runs mandrel sync
best-effort, so ./.agents/ is usually materialized automatically; the
explicit npx mandrel sync above is the belt-and-suspenders step for
--ignore-scripts or sandboxed-CI installs. Run npx mandrel doctor any
time to confirm the install is healthy.
pnpm users — hoist mandrel's runtime deps. The materialized
./.agents/scripts/*.jsrun from your project root and resolve their third-party deps (ajv, js-yaml, …) from your top-levelnode_modules. npm and yarn hoist transitive deps there automatically; pnpm's default isolated layout does not — it keeps them in the.pnpmvirtual store, so the framework scripts (andmandrel doctor'sruntime-depscheck) cannot see them. Add the following to your.npmrcbefore installing:# Lift mandrel's runtime deps to the top-level node_modules so the # materialized .agents/scripts can resolve them. shamefully-hoist=truePrefer a surgical alternative? Replace
shamefully-hoistwith a scopedpublic-hoist-pattern[]=line per package listed in.agents/runtime-deps.json— read the file rather than copying a list from here, since the complexity kernel's closure is several packages. Ifmandrel doctorreportsruntime-deps missing: …, this is the fix.
bootstrap.js is interactive on a TTY and auto-accepts the
owner/repo/base branch/operator handle it can infer from your local
git remote and git config user.name — you only get prompted for
fields it can't infer (typically the optional Projects V2 number). When the
folder is not yet a git repo, or the GitHub repo doesn't exist, it
provisions them: git init plus a first commit, then
gh repo create --source=. --push (use --visibility private|public|internal,
default private, to set the new repo's visibility), then gh project create
for the Projects V2 board. Override anything inferred with --owner,
--repo, --base-branch, or --operator-handle. For CI / scripted installs
pass --assume-yes plus whichever overrides you need. The script is
idempotent — safe to re-run anytime.
For the consumer reference and the end-to-end workflow narrative, see
.agents/README.md and
docs/SDLC.md. Every .agentrc.json key is
documented in .agents/docs/configuration.md, and the
slash-command index lives in
.agents/docs/workflows.md.
Update
Advance mandrel to the newest published version and
re-materialize ./.agents/ in one command:
npx mandrel update
mandrel update runs an ordered cycle:
- Resolve the newest published version (a
npm view mandrel versionregistry probe) and the currently installed version. - No-op short-circuit — already on the newest version ⇒ nothing to do.
- Install the target version with the project's package manager —
auto-detected from the lockfile (
pnpm-lock.yaml⇒ pnpm,yarn.lock⇒ yarn, otherwise npm) so the bump lands in your real lockfile. The dependency bump is left staged on disk —mandrel updateperforms nogit add/git commit, so you review and commit the lockfile change yourself. - Sync — re-materialize
./.agents/from the freshly installed payload. - Migrate — apply version-keyed migration steps for the crossed range.
- Doctor — run the check registry to verify the resulting install.
- Surface the target changelog section.
Flags
--dry-run— print the resolved target version and the ordered step plan, then exit. No dependency is bumped, no file is written, no seam runs.--install-cmd "<cmd>"— override the auto-detected install command. The package manager is normally detected from your lockfile (pnpm-lock.yaml⇒pnpm add -D …,yarn.lock⇒yarn add -D …, otherwisenpm install …), so an override is rarely needed. When you do pass one, a{target}placeholder is substituted with the resolved newest version — e.g.--install-cmd "pnpm add -D mandrel@{target} -w"— so the override can still consume the auto-probed version. The registry probe always stays onnpm view(it is a PM-agnostic registry query).
Manual equivalent
If you prefer to drive the steps by hand:
npm install mandrel@latest # or pnpm add / yarn up
npx mandrel sync # re-materialize ./.agents/
npx mandrel doctor # verify the install
Benchmarking
Mandrel's effectiveness is measured by a separate companion repo,
mandrel-bench — a consumer of
the published mandrel package. It pins a specific framework version,
materializes it via mandrel sync, and drives Mandrel's own /mandrel-plan→/mandrel-deliver
pipeline (plus a bare-model control) over a scenario corpus. Each run is scored
across five dimensions — Quality, Planning fidelity, and Autonomy (what the
scaffolding buys) versus Efficiency and Overhead ratio (what it costs) —
reported as distributions with a noise-band, tracking the framework's
value-add over the bare-model baseline across versions and models.
The benchmark lives in its own repo on purpose: holding the harness fixed while
varying the pinned mandrel version cleanly decouples harness-version from
framework-version, and running through the published-package + mandrel sync
path exercises the real consumer contract. The dependency is one-directional —
mandrel-bench depends on mandrel, never the reverse. See the
mandrel-bench README for the
dimensions, run model, and how to benchmark a new version.
Contributors
The published mandrel package ships three directories — .agents/, bin/,
and lib/ — plus the single file docs/CHANGELOG.md, and excludes the
__tests__ subtrees under .agents/ and lib/ (see the files array in
package.json).
.agents/ is the payload mandrel sync materializes into a consumer's
./.agents/ directory; bin/mandrel.js and its lib/ implementation stay
inside node_modules/mandrel/ and back the npx mandrel … CLI used
throughout this README. Everything else in this repository — docs/,
tests/, .github/, the root tooling configs — is internal development
tooling and is not published.
Common commands while developing the framework itself:
npm run lint # biome + markdownlint + repo ratchets + generated-doc drift
npm run format # biome format — JavaScript/JSON only, not markdown
npm test # framework tests
npm run test:coverage # tests with coverage gate
Deeper reference material lives in docs/ rather than inline here:
docs/architecture.md— module map, repo layout, state machine, and tech stack..agents/docs/configuration.md— every.agentrc.jsonkey explained..agents/docs/workflows.md— slash-command index (auto-generated from the workflow set).docs/CHANGELOG.md— release history.AGENTS.md— the repository-level orientation pointer; it links on todocs/onboarding.mdfor the layout, commands, and development standards.docs/release-operations.md— the Release Checklist, the Install Matrix release gate, the single-package release topology, PAT / npm-token setup, and the major-version policy. Releases are automated byrelease-please: land Conventional Commits onmainand it opens a combinedchore: release mainPR that squash-merges itself once CI is green, tagsmain, and publishesmandrelto npm.
Install scripts are disabled by default: the committed
.npmrc sets ignore-scripts=true, so npm install / npm ci
will not execute dependency lifecycle hooks — a defense-in-depth measure
against malicious lifecycle scripts in compromised transitive packages
(CWE-1357). CI passes --ignore-scripts explicitly. If you knowingly need
install scripts for a specific install, run
npm install --ignore-scripts=false for that invocation only.
CRAP and Maintainability gates fire at four sites — .husky/pre-commit
(quality-preview.js --staged, scored on the staged index), .husky/pre-push
(diff-scoped against origin/main), close-validation (story close), and CI
(ci.yml, push + PR) — against the same thresholds from
delivery.quality.* in .agentrc.json. All four are blocking: the
pre-commit hook fires earliest and refuses the commit on a threshold
violation, and a green npm run lint / npm test / check-baselines.js
run does not predict it.
License
MIT

