feat(modes): the kernel modes - a patch series and a mailing-list reply

Beside the push gates, crafter-review runs the pre-send review of a kernel
contributor's workbench: --mode series over a format-patch export with its
cover letter, --mode reply over a mail draft. The inventory partitions a
cover letter, a plain mail and the camera review's shape; ten kernel lenses
join the table with their gates (structure, code, artifact truth) and the
persona gate - one maintainer-persona instance per --reviewers entry, its
whole pass gating its blocks and pruning the units that are not theirs. A
series' code units are keyed on the code like the push gates'; every text
unit on its text, the references it cites and the anchor when it is dated.
The references an artifact cites are prefetched through utilities/lore.py
into the gate-state, with a digest in the run layer, and a persona's
calibration map is its lore listing. The kernel schema carries the persona
vocabulary, the kernel note kinds, the predicted review and the not-mine
list; the matrix the persona holes, the thin and the modelled units; gates
clean without a persona pass is GATES CLEAN. A reply's gate-state sits
beside the draft and is read once; a kernel mode needs --subsystem,
defaults the effort to max and the trees to work/linux,work/milos-linux,
and excuses no unit from the holes.

The kernel lenses and the common text ship verbatim; the table lists them
after the push gates' lenses and the config template holds them off, so a
repository that never turns them on changes nothing. Prompts, keys and plans
were checked byte for byte against the pipeline these modes replace, on its
own artifacts: two replies and a series, every system prompt, user prompt,
job and reuse key identical.
This commit is contained in:
Jorijn van der Graaf 2026-10-31 22:56:12 +01:00
commit 339f4b9b40
Signed by: jorijnvdgraaf
GPG key ID: 2937E59CDCC1BCFB
46 changed files with 5732 additions and 362 deletions

View file

@ -11,18 +11,23 @@ import :Memory;
import :PgWire;
import :State;
import :Platform;
import :Refs;
// Run: the driver for a commit range about to be pushed
// (process/prepush.md). One claude process per inventory unit per lens,
// whole passes where a lens has one (each gating its block passes),
// fail-closed coverage per unit, the matrix, per-unit reuse across hashes, a
// seat pool.
// (process/prepush.md), and for the kernel modes - a mailing-list reply or
// a patch series about to be sent. One claude process per inventory unit
// per lens, whole passes where a lens has one (each gating its block
// passes), fail-closed coverage per unit, the matrix, per-unit reuse across
// hashes, a seat pool.
//
// Gates: 1 repo-better-solution (approach) -> 2 repo-functional (the range
// exercised in the running application) -> 3 repo-bug-prover and
// repo-security -> 4 the owner. SEND-READY = push-ready. Exit codes: 0
// SEND-READY, 1 FIX FIRST, 2 INCOMPLETE / PARTIAL / CONFIRMING (gates clean,
// code units still owe clean reads - run the same line again), 3 preflight.
// Gates (commits): 1 repo-better-solution (approach) -> 2 repo-functional
// (the range exercised in the running application) -> 3 repo-bug-prover
// and repo-security -> 4 the owner. SEND-READY = push-ready. The kernel
// modes run their own gates (Plan::Gates), then the persona gate for every
// reviewer given; gates clean without a persona pass is GATES CLEAN, not
// SEND-READY. Exit codes: 0 SEND-READY, 1 FIX FIRST, 2 INCOMPLETE / PARTIAL
// / GATES CLEAN / CONFIRMING (gates clean, code units still owe clean reads
// - run the same line again), 3 preflight.
//
// A Run is built empty and filled field by field, as the tests fill one, so
// its attributes are public; Main builds and runs the real one.
@ -34,8 +39,15 @@ export namespace Crafter::Review::Run {
struct Arguments {
std::optional<std::string> config;
std::string mode = "commits";
// The journal subsystem: required in the kernel modes (its ledger,
// captures and threads are the lenses' evidence); optional in
// commits mode.
std::optional<std::string> subsystem;
std::string artifact;
std::optional<std::string> hash;
// The reviewers a persona reads as, comma-separated (the kernel
// modes).
std::string reviewers;
std::optional<std::string> dispositions;
std::string base;
std::string date;
@ -55,6 +67,9 @@ export namespace Crafter::Review::Run {
std::int64_t reads = Plan::Reads;
bool noReuse = false;
bool noSalvage = false;
// pruned: a persona's block passes skip the units its whole pass
// marked not-mine; all: every unit.
std::string personaBlocks = "pruned";
bool dryRun = false;
std::optional<std::string> claudeBin;
std::string models;
@ -154,6 +169,11 @@ export namespace Crafter::Review::Run {
Json PartFrom(const Json& job, const Json& rec, Json raw);
static Json DryPart(const Json& job);
std::vector<Json> RunGate(std::string_view title, std::vector<std::string> lensFiles);
// (lens file, persona) per lens instance: a persona's instance reads
// as that reviewer.
std::vector<Json> RunGate(std::string_view title, std::vector<std::pair<std::string, std::string>> specs);
// The kernel modes (reply, series).
bool Kernel() const;
std::unique_ptr<Pool::Admission> Admission(std::span<const std::string> lensFiles);
std::optional<Json> Resumable(const std::string& name, const std::string& lensFile, std::string_view title);
void Checkpoint(std::string_view title);
@ -191,6 +211,16 @@ export namespace Crafter::Review::Run {
std::map<std::string, std::int64_t> lensLayersBytes;
std::vector<Json> jobsRun;
std::map<std::string, std::string> summaries;
// The kernel modes: the reviewers with a persona, their calibration
// maps, the references the artifact cites and their digest, the
// anchor unit's text, and whether the persona gate passed.
std::vector<std::string> reviewers;
std::map<std::string, std::string> corpora;
Refs::Table refUrls;
Json refIndex = Json::object();
std::string refDigest;
std::string anchorText;
bool personaRan = false;
std::optional<std::string> abort;
Pool::Scheduler* sched = nullptr;
std::optional<Plan::CommitCode> commitCode;