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

@ -15,32 +15,57 @@ export namespace Crafter::Review::Prompt {
constexpr std::string_view SepRun = "\n\n==================== THIS RUN ====================\n\n";
extern const std::string_view GenericVocab;
// The kernel modes' vocabularies: every lens's, and a maintainer or
// recipient persona's.
extern const std::string_view GenericVocabKernel;
extern const std::string_view PersonaVocab;
// WHOLE_TEXT['first-repo'] and WHOLE_TEXT['functional'].
extern const std::string_view WholeFirstRepo;
extern const std::string_view WholeFunctional;
// WHOLE_TEXT['first'], ['all'] and ['persona']: the kernel modes' whole
// passes - the series as an approach, the consistency of the whole, the
// artifact read as one reviewer.
extern const std::string_view WholeFirst;
extern const std::string_view WholeAll;
extern const std::string_view WholePersona;
extern const std::string_view FunctionalBlockHint;
extern const std::string_view ShotRules;
// KIND_HINTS_REPO
extern const std::string_view HintOutside;
extern const std::string_view HintAbsent;
// KIND_HINTS: the kernel modes' hints - the anchor unit, the reference
// list, and the two per-patch slots.
extern const std::string_view HintAnchor;
extern const std::string_view HintRefs;
extern const std::string_view HintOutsideKernel;
extern const std::string_view HintAbsentKernel;
// The block hints of the commit-truth lens (2026-10-31): a message unit,
// and a unit of a documentation file.
// and a unit of a documentation file; and the kernel modes' text hint.
extern const std::string_view TextBlockHintRepo;
extern const std::string_view DocBlockHintRepo;
extern const std::string_view TextBlockHint;
// SLOT_DUTIES: what a slot pass of a lens covers beyond the slot's
// question; empty for every other lens and slot.
std::string_view SlotDuty(std::string_view lensFile, std::string_view unitId);
// _common-repo.md with the artifact kind filled in.
std::string SystemText();
// _common-repo.md with the artifact kind filled in; the kernel modes
// _common.md (a mailing-list reply, a patch series).
std::string SystemText(std::string_view mode = "commits");
// The lens's charter, read with universal newlines.
std::string Charter(std::string_view lensFile);
// INPUTS, the artifact with line numbers, the inventory. trees: as they
// are spelled to the lens; contextPaths may be empty.
// are spelled to the lens; contextPaths may be empty; a subsystem names
// the journal's ledger and captures the lenses may read.
std::string RunLayer(std::string_view artifactRel, std::string_view base, std::string_view date, std::span<const std::string> trees, std::string_view hash,
std::span<const std::string> lines, const Json& units, std::span<const std::string> contextPaths = {},
std::string_view repoName = "the repository");
std::string_view repoName = "the repository", std::string_view subsystem = {});
// The kernel modes' run layer: the journal's inputs, the trees, the
// reviewers with a persona, and the references digest after the
// inventory.
std::string RunLayerKernel(std::string_view mode, std::string_view artifactRel, std::string_view subsystem, std::string_view base, std::span<const std::string> reviewers,
std::string_view date, std::span<const std::string> trees, std::string_view hash, std::span<const std::string> lines, const Json& units,
std::string_view refDigest, std::span<const std::string> contextPaths = {});
// APPLICATION UNDER TEST: what the processes of a lens with the browser
// environment are told about the running application — from the
@ -63,18 +88,22 @@ export namespace Crafter::Review::Prompt {
std::string DbBlock(const Json& supabase, std::string_view sqlCommand, const std::optional<std::string>& dbUser, bool withApp = false,
const std::optional<std::string>& checked = std::nullopt, std::optional<bool> bypass = std::nullopt);
// The charter, the application and database blocks when there are
// any, the dispositions, the whole pass's summary.
// any, the dispositions, the whole pass's summary; for a persona first
// who they are and the calibration map (the first 6000 characters of
// their lore listing).
std::string LensLayer(std::string_view lensFile, std::string_view charterText, std::string_view dispositionsBlock, std::string_view app = {},
std::string_view wholeSummary = {}, std::string_view db = {});
std::string_view wholeSummary = {}, std::string_view db = {}, std::string_view persona = {}, std::string_view corpus = {});
// The scope of one pass: a whole pass's units, a slot's question, or a
// block's unit text.
// block's unit text. A kernel lens's job gets the kernel texts.
std::string Tail(const Json& job, const Json& units, std::span<const std::string> lines, std::string_view wholeSummary = {});
std::string BudgetLine(const Json& job);
// kernel: the kernel modes' line, which also says to read the prefetched
// raw files instead of fetching.
std::string BudgetLine(const Json& job, bool kernel = false);
// The appended system prompt of a pass: the common charter text, the run
// layer and the lens layer, byte-identical for every pass of a lens in a
// run.
std::string SystemPrompt(std::string_view systemText, std::string_view run, std::string_view lens);
// The stdin user message of a pass: only what differs between passes. A
// null job adds no budget line.
std::string UserPrompt(std::string_view tail, const Json& job = nullptr, std::string_view stack = {});
std::string UserPrompt(std::string_view tail, const Json& job = nullptr, std::string_view stack = {}, bool kernel = false);
}