@adlc/lesson-foundry

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

Converts prosecution findings into permanent defenses — the compounding closer (P7).

原始使用文档
文档目录12 节
  1. What it does
  2. Usage
  3. Exit codes
  4. Emitted file shapes
  5. LINT: <name>.lint.json
  6. LINT: check-<name>.mjs
  7. SKILL: <name>.SKILL.md
  8. SPEC-GAP: interrogation-template.md
  9. Examples
  10. Relationship to sibling tools
  11. ADLC phase
  12. Core gaps

lesson-foundry

ADLC Phase: P7 (compounding closer)

Converts prosecution findings into permanent defenses. Every recurring finding is paid for exactly once.

C9 in the ADLC component inventory. Without this tool the lifecycle does not get cheaper — lessons are re-bought on every run.

What it does

  1. Reads prosecution findings from a JSONL ledger (default: .adlc/findings.jsonl)
  2. Skips entries with verdict === 'killed'; surfaces malformed lines
  3. Clusters findings by semantic similarity (token-set Jaccard >= 0.5)
  4. Routes each cluster of size >= --min to its cheapest permanent defense:
    • LINT — any member desc contains a quoted literal or recognizable marker (TODO, FIXME, eslint-disable, etc.) → emits a grep-gate JSON descriptor + a runnable check-<name>.mjs script
    • SKILL — category is convention, pattern, architecture, or style → emits a SKILL.md stub with frontmatter and evidence quotes
    • SPEC-GAP — otherwise → appends a question to interrogation-template.md for P1 to address
  5. By default: dry-run (prints what would be written). Add --write to emit files.
  6. With --gate: exits 2 if any cluster has no existing non-empty defense file in --out-dir, or if findings ledger contains unparseable/malformed lines exceeding --tolerate-malformed

Usage

lesson-foundry [options]

Options:
  --ledger <name>          Ledger name to read findings from (default: findings)
  --min <n>                Minimum cluster size to surface (default: 2)
  --out-dir <path>         Output directory for defense files (default: .adlc/lessons)
  --write                  Emit files (default: dry-run — prints what WOULD be written).
                           An existing non-empty artifact is kept; an empty one is regenerated
  --gate                   Exit 2 if any cluster >= --min has no non-empty defense file in --out-dir
  --allow-missing-ledger   Allow missing ledger file when --gate is set (bootstrap opt-in).
  --tolerate-malformed <n> Tolerate up to <n> unparseable/malformed ledger lines before failing --gate (default: 0)
  --llm                    Refine cluster wording via one mid-tier LLM call per cluster;
                           exits 1 (writing nothing) when no cluster could be refined
  --prompt-only            Print LLM prompts and exit 0 (works with zero API keys)
  --json                   Machine-readable output (stdout JSON, errors to stderr)

Exit codes

CodeMeaning
0Gate passes — no recurring unbanked lessons (or --gate not set)
1Operational error — bad input, unreadable ledger, write failure, or --llm refined no cluster
2Gate fails — one or more clusters have no non-empty defense file in --out-dir, or ledger contains malformed lines

Emitted file shapes

LINT: <name>.lint.json

{
  "name": "cluster-name",
  "pattern": "ESCAPED_LITERAL_OR_MARKER",
  "paths": ["**"],
  "message": "lesson-foundry: recurring finding — <desc>"
}

LINT: check-<name>.mjs

A runnable Node.js script that greps the repo for the pattern and exits 2 on match, 0 when clean. Run it as a CI gate.

SKILL: <name>.SKILL.md

Markdown with YAML frontmatter (name, description, category, triggers) and a body containing the rule, evidence quotes, and provenance count. Ready to load into any skill-mining pipeline.

SPEC-GAP: interrogation-template.md

Appended-to file with checkbox questions for each spec-gap cluster. Answer these in the P1 spec to prevent recurring findings.

Examples

Dry-run to see what would be produced:

lesson-foundry --ledger findings --min 2

Write defense files:

lesson-foundry --ledger findings --min 2 --write --out-dir .adlc/lessons

Gate in CI (fail if any recurring lesson is unbanked):

lesson-foundry --ledger findings --min 2 --gate

Machine-readable output:

lesson-foundry --min 2 --gate --json

Refine wording via LLM:

lesson-foundry --min 2 --write --llm

Print LLM prompts without calling any API:

lesson-foundry --min 2 --prompt-only

Relationship to sibling tools

ToolRelationship
adversarial-reviewPrimary source of findings — its JSONL output feeds the ledger lesson-foundry reads
skill-mininglesson-foundry emits SKILL.md stubs; skill-mining manages the full skill registry
spec-lintlesson-foundry appends to interrogation-template.md; spec-lint gates on spec quality
rails-guardDefense files emitted by lesson-foundry should be PR'd like rails — read-only to other tools

ADLC phase

P7 — the compounding closer. Runs after prosecution findings accumulate across multiple ADLC cycles. The effect is a ratchet: each lesson is paid for exactly once, and recurring findings are demoted from probabilistic detection (LLM review, ~dollars per catch) to deterministic detection (lint/grep, ~free forever).

Core gaps

None. All required functionality is available in @adlc/core.

版本与发布记录

@adlc/lesson-foundry 共发布 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/lesson-foundry 的常见问题

@adlc/lesson-foundry 是什么?

Converts prosecution findings into permanent defenses — the compounding closer (P7).

如何安装 @adlc/lesson-foundry?

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

@adlc/lesson-foundry 支持 TypeScript 吗?

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

@adlc/lesson-foundry 支持 ESM 还是 CommonJS?

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

@adlc/lesson-foundry 需要什么版本的 Node.js?

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

@adlc/lesson-foundry 可以商用吗?

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

@adlc/lesson-foundry 的下载量有多少?

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

@adlc/lesson-foundry 还在维护吗?

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