@adlc/premortem

中文文档
1.12.0发布于 2026/10/10MITES Module构建来源已验证近 30 天下载 8220

Failure-first spec stress test — inverts sycophancy to surface failure modes (C2/P1).

原始使用文档
文档目录10 节
  1. Usage
  2. Arguments
  3. Examples
  4. Exit codes
  5. Output format
  6. ADLC phase served
  7. LLM configuration
  8. Recording the operator's prompt-only verdict
  9. Core gaps
  10. Relationship to sibling tools

@adlc/premortem

Failure-first spec stress test — ADLC phase C2 / P1 gate.

Inverts sycophancy: instead of asking "any problems with this plan?", it tells a frontier model the project already failed and asks it to write the postmortem. The model generates concrete, checkable risks anchored to the actual spec content. Output feeds back as interrogation questions for the next P1 review.

Runs once per spec. Cheap. No bespoke judgement needed.


Usage

premortem <spec.md> [--tier cheap|mid|frontier] [--out report.md] [--json] [--prompt-only] [--record-verdict <file|-> --ticket <id>]

Arguments

Argument / FlagDescriptionDefault
<spec.md>Path to the spec file to analyse (required)—
--tierModel tier: cheap, mid, or frontierfrontier
--out <path>Write markdown report to this file instead of stdoutstdout
--jsonEmit machine-readable JSON { causes: [...] }false
--prompt-onlyPrint the exact system + user prompt, then exit 0 — no API key neededfalse
--record-verdict <file|->With --prompt-only: read the operator's answer from <file> (or stdin when -) and record it into .adlc/manifest.jsonl via gate-manifest. Requires --ticket — an unbound record could satisfy another ticket's P1 gate—
--ticket <id>Ticket to bind the recorded verdict to (required with --record-verdict)—
--helpPrint usage and exit 0false

Examples

# Run against a spec, print to stdout
premortem specs/checkout-v2.md

# Write the report to a file
premortem specs/checkout-v2.md --out reports/premortem-checkout.md

# Machine-readable output for orchestrators
premortem specs/checkout-v2.md --json

# Inspect the prompt without spending tokens
premortem specs/checkout-v2.md --prompt-only

# Use a cheaper model for quick iteration
premortem specs/checkout-v2.md --tier mid

Exit codes

CodeMeaning
0Report produced successfully (or --prompt-only / --help)
1Operational error — missing spec file, no LLM provider configured, malformed model response
2(reserved for future gate-fail use; not currently emitted)

Output format

The default markdown report contains:

  1. Failure Causes table — cause, earliest observable signal, and prevention per item.
  2. Questions to fold into interrogation — numbered list of interrogation questions, one per cause, ready to paste into the next P1 spec review.

ADLC phase served

C2 — P1 stress test. Sits at the end of the P1 (spec approval) phase. After a spec has passed speccheck (C1), premortem runs one frontier-model completion with the adversarial postmortem charter. The resulting questions are appended to the spec review checklist before the spec is locked.


LLM configuration

The tool requires exactly one of:

ANTHROPIC_API_KEY   → uses claude-opus-4-8 at frontier tier
OPENAI_API_KEY      → uses gpt-5.1 at frontier tier
GEMINI_API_KEY      → uses gemini-2.5-pro at frontier tier

Force a provider: ADLC_PROVIDER=anthropic Override model by tier: ADLC_MODEL_FRONTIER=claude-opus-4-8

Use --prompt-only to get the exact prompt for pasting into any harness when no key is available.


Recording the operator's prompt-only verdict

In Claude Code (and similar harnesses without a bare API key) --prompt-only is how premortem is normally run: the tool prints the failure-mode prompt, and the operator (the model itself) answers it and applies judgment. Without --record-verdict, that self-assessed verdict — and any spec hardening it produced — never enters the audit trail; only the fact that a prompt was printed is observable. --record-verdict <file|-> closes that gap: after printing the prompt as usual, it reads the operator's answer from <file> (or stdin when -) and records it into .adlc/manifest.jsonl via @adlc/gate-manifest's own record() — reusing its hash-chaining/signing logic rather than reimplementing it.

# Operator writes their conclusion to a file, then records it
premortem specs/checkout-v2.md --prompt-only --record-verdict verdict.txt --ticket T1

# Or pipe the answer straight from stdin
echo "confirmed: process.chdir throws under vitest threads pool" \
  | premortem specs/checkout-v2.md --prompt-only --record-verdict - --ticket T1

--record-verdict requires --prompt-only (exit 1 otherwise) and --ticket (exit 1 otherwise — the p1 gate scopes spec-lint/premortem evidence per ticket, so an unbound record could otherwise satisfy a different ticket's approval). The recorded entry's gate is premortem, data.verdict holds the operator's text verbatim, and data.specPath records which spec the prompt covered.


Core gaps

None. All required functionality (complete, extractJson, detectProvider, promptOnly, opError, parseArgs, printJson, readStdin) is available in @adlc/core. Recording prompt-only verdicts reuses @adlc/gate-manifest's record() directly (see lib/verdict.mjs) rather than reimplementing its hash-chain/signing logic.


Relationship to sibling tools

  • speccheck (C1) — runs before premortem; ensures every acceptance criterion has a verification method.
  • coldstart (C3) — runs after premortem; stress-tests individual tickets for missing information.
  • premortem is advisory (exit 0 on success) because it produces questions, not binary pass/fail. A future integration could promote flagged questions to tickets and gate on them via coldstart.

版本与发布记录

@adlc/premortem 共发布 18 个版本,首次发布于 2026/06/14;过去 12 个月发布了 18 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
1.12.0latest2026/10/1027 天前
1.11.12026/09/091 个月前
1.11.02026/08/252 个月前
1.10.02026/08/112 个月前
1.9.02026/08/092 个月前
1.8.02026/08/082 个月前

关于 @adlc/premortem 的常见问题

@adlc/premortem 是什么?

Failure-first spec stress test — inverts sycophancy to surface failure modes (C2/P1).

如何安装 @adlc/premortem?

在项目目录运行 npm install @adlc/premortem,或使用 pnpm add / yarn add / bun add。它还提供命令行工具 premortem,可以用 npx premortem 直接运行。

@adlc/premortem 支持 TypeScript 吗?

该包的 package.json 没有声明类型入口。需要类型提示时,可以在 npm 上查找社区维护的 @types/adlc__premortem 是否存在。

@adlc/premortem 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@adlc/premortem 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=18。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@adlc/premortem 可以商用吗?

@adlc/premortem 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@adlc/premortem 的下载量有多少?

根据 npm 官方下载统计,@adlc/premortem 在 2026/10/05 – 2026/11/03 这 30 天内被下载 8,220 次,日均约 274 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@adlc/premortem 还在维护吗?

最新版本 1.12.0 发布于 2026/10/10(27 天前);至今共发布 18 个版本,其中过去 12 个月发布了 18 个;首次发布于 2026/06/14。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。