Skip to content

Architecture ​

How the code is laid out, which module may depend on which, what happens in a review, how a release is built and published, and how the suite runs. For a reader who changes quorum, or wants to know where a behaviour lives before trusting it.

Modules ​

ModuleHolds
src/core/The core, with no access to the environment, the network, files or the process. quorum.ts is createQuorum: the input checks, the compiled profiles, the review that runs them and, beside it, the judge, which runs the panel of each profile alone on findings it is given. types.ts holds the shared types, ports.ts the Provider port and the ranges of what a provider states, EventSink, ProfilePorts and QuorumPorts, and the ReplyStore port with the StoredCall it keeps, which the call path in stages/context.ts looks each send up in and saves each checked reply and cut-off in, clock.ts the time and the randomness the core reads, the system's unless a spec injects its own, retry.ts the retry policy: which failures are retried and how long a call waits before the next attempt, lanes.ts how many calls a review has in flight: a lane per provider object that grows on the rate-limit headers, halves on a throttle, pauses for a Retry-After and paces by the headers, under the review's ceiling of 16 calls in all, or the one limit concurrency pins, with the record meta.concurrency holds, clocks.ts what a review learns of how its providers' streams pace: each attempt's ceiling sized to its reply budget, the stall window learned from a provider's longest silence, and the length at which a path cuts its calls, with the reply budget that cut lets through, per provider object, facts.ts the readers of what a provider's value says of itself, as own data and never a getter, a message or a class: ownData, the failure's kind and status (providerFailure), what a reply lacked (lackOf), a refusal as too large or as a stream, the usage a reply or a failure reports and the rate-limit headers, watch.ts what one attempt of a streamed call has seen of its stream (the watch the stall timer and the attempt's timings read), the signals an adapter hands over, and the call's call:progress reports, at most one in PROGRESS_MS, limits.ts the token cap's ledger, the review's deadline and the failure a limit ends a call with, adapt.ts what quorum moves by itself in one review, per provider object and setting: the first call whose failure a setting answers is its probe, sent once more with the new setting while the provider's new calls wait for it and the calls in flight at the old setting are sent once more at the settled one, so each setting is probed once and a thinking level or a prompt mode holds for the rest of the review, with the findings a research request asks for once a reply shows no reasoning, down.ts which provider is down in one review: three of its calls in a row that ended with a failure of their own (http, network, timeout, process, unsupported or invalid-response), kept per provider object across the profiles and roles that share it, reset by a reply, and unmoved by a refusal, a cut-off or a limit, after which a call to it fails inside its slot before its request is built, tokens.ts the bound of a text's tokens, which the core and the size guard share, and the counts the budgets, the clocks and the estimate share (VOTE_TOKENS, EXPECTED_REPLY_TOKENS, BOUND_OVER_CODE and expectedOf), so that the core holds no import cycle (cycles.spec.ts), duration.ts elapsedWords, a duration in words with whole seconds throughout (2m14s), which the failure lines of errors.ts and the view's lines share, and errors.ts the error classes, isSafeSegment and issuePath, which build every issue path, result-schema.ts the one strict schema of a result and of its public view, which the bench's records and readResult share, and of the settings record a review is given (settingsSchema), event-schema.ts the strict schema of each event of a review and of a line of --progress json (progressLineSchema), made of the parts and lists of result-schema.ts that the events share with a result, and version.ts VERSION, read from package.json, which a review writes as meta.version and the reader compares
src/core/stages/The stages of one profile: research.ts, dedup.ts, panel.ts, and context.ts, which they share: the compiled profile, a call inside its provider's lane, or the one limit concurrency sets, with each attempt's reservation and its retries, the store's lookups and the stage events, attempt.ts, one attempt with its ceiling, its stall timer and the join to the review's halt, and resend.ts, the re-send of a failure a setting answers, as the setting's probe, and which replies are bad, to be sent once more. research.ts also holds checkFindings, the code checks every finding passes before a panel judges it (against the diff, near the change, its rule, then its name), which research runs on a finder's findings. related.ts, beside them, is a review's related code: it works out each finding's excerpts from its cited row through the reader a review is given (the port RelatedCodeReader, which src/context/related.ts fills), once for every finding that cites the row, in the findings' order and one finding at a time for each profile, so a profile has at most one lookup in flight while the votes of its earlier findings are cast; it holds the review's reads (each file once, within 32 MiB), the pick and the related-code event of each finding, the checks of the reader a review is given, what run:start says, and the sums meta.relatedCode records; the panel hands each pick to the votes of the lenses that ask. given.ts, beside the stages, is the judgment's: it reads the fields of the findings a judgment is given (givenIssues) and runs those checks on each, refusing any a check would drop or change (checkGiven)
The rest of src/core/policy.ts: the rules, thresholds, confidence and where a verdict lands. profile.ts: the profile checks and warnings, and the fail-on levels. documents.ts: the documents a profile reads as policy, its guidelines and do-not-report text, its configuration's documents and a review's repository ones: the caps, cleanProse applied to each, the joined texts and the records of meta.context, and the checks of a profile's documents and of a review's context. rules.ts: a profile's review rules, their checks, the rules a review sends for the files of a change (rulesSent) and the rules block a research request carries, which documents.ts cleans, caps and records as documents of kind rules. outcome.ts: what a review comes to, for the exit code and the reports: its status, the code that says it, and whether --allow-incomplete lifted it, and isIncomplete, whether a gating profile has a gap or an unreviewed finding before a kept finding takes precedence and before the lift, which SARIF's executionSuccessful reads. budgets.ts: the reply budget of each request kind and the findings a research request asks for, from a provider's stated window, maxTokens and thinking (replyBudget), and one profile's budgets from its providers' (profileBudgets), as plain functions. prompts.ts: templates, fences, the line that asks for at most N findings, and the notices, and requestDigest, the SHA-256 of the logical content of a request one of its builders made, which the saved state keys by and never the request's bytes, since every fence carries a nonce. output.ts: the strict parsing of replies. diff.ts: splitting a diff and locating a line in it, diffSections, every section in order, a header it cannot read included, on which splitDiff is built, parseHunks, the one reading of a hunk that locate, the packer and a vote's context share, firstLineOutside, the first line of a range that no hunk holds as locate reads them, with which the suite loader checks each location, decodeQuoted, the one reading of git's quoted names, which the all-added writer of src/sources/ shares, namedPaths, the paths a section's own lines name, headerNames, the words of its diff --git line, and namesOldSide, whether a --- line writes the old side of a header that names one path on both sides, which the hold reads, and decodeDiff with MAX_DIFF_BYTES, which read a diff's bytes as UTF-8 for the CLI and for a suite's patches: a byte-order mark dropped, a byte that is not UTF-8 replaced, a diff past 16 MiB refused. verify.ts: checking findings against the diff, their evidence, and the row of it that shows the cited line. concurrency.ts: the shared limiter. sanitize.ts: the hidden-character class, and the inert rendering of a line, of JSON, of Markdown's code spans and fenced blocks, and of plain text a viewer may link. inert-vectors.ts: the hostile inputs of the inert-text vectors and what the display functions of sanitize.ts make of each, which schema/inert-text.vectors.json publishes. flags.ts: the advisory flags read from the diff, from the files a source left out, and, as documentFlags, from the repository documents of a review: a guideline-edited flag for each profile and path a section of the diff names. exclude.ts: the patterns of exclude, their checks and a matcher written by hand, segment by segment, with no regular expression. secrets.ts: what holds a file back from every review, the names, the template rule, the content check of gitleaks 8.30.1's rules for seven providers and pre-commit's private-key markers, the decision for one section and the whole-deletion check, pure functions. skips.ts: the skip rules of a path review, by a path's name and by a file's content: the lists of vendored, lockfile, minified and test names, the minified rule by content, the Git LFS pointer check and the binary probe (isBinary); they sit in the core because the gates of the files related code may read apply them too, and the secret rule is always secrets.ts's, taken before them. languages.ts: the language table of related code, nine languages as frozen data (their extensions, comment markers, quotes, keywords and the patterns of a definition, of a function header and of a row that imports a name) and the pure functions over one row or one file's rows: languageOf, the comment scanner (commentRows, startsComment), blanked, definedName, headerName, isImportRow and indentOf. Its patterns read a row in linear time, and definedName, headerName and isImportRow read no row over MAX_ROW_LENGTH (1000) characters, so a long row a diff makes costs no more than its length; the scanner's functions read a row of any length whole, each in linear time. related.ts: related code's starting values (RELATED_VALUES) and the gates of the files it may read, as pure functions of a path or a source: readableForRelated (a language the table knows, no name like instructions for an agent, no default skip, a secret's name among them) and relatedCommit, the commit a source is read at. The rules that pick what to read are pure functions of a diff's rows and the hits of a lookup: rowsAround, citedRowOf, touchedPaths, lookupNames, climb and functionOf read a finding's cited row (rowsAround from the diff alone, citedRowOf with the listing's gate on it), the paths the change touches and the function around the row, which functionOf also names for every verdict's function whatever the listing admits, and selectRelated picks the definitions of the row's names (at most 4) and the callers of the function (at most 3) from the hits, leaving to the diff what the change defines, dropping a name or function with too many hits (counted once, though the row names the function too) and ranking by the nearest directory, each count kept. A row that imports or re-exports the function is no call site, and a call-shaped row comes before the other sites of its file. excerptsOf cuts an excerpt from the bytes of each file chosen, a capped run of rows with its comment rows left out behind one marker, and holds one whole, never sent, that carries a credential, a hidden character or text addressed to a reviewer; blockText, fitted and quotesShown make a vote's block, tell how many excerpts a budget holds and tell whether a reasoning quotes a row of them, and RELATED_RULES_VERSION names the rules as they ship. words.ts: plural, a count with its noun in the form the count takes, which report/lines.ts re-exports. coverage.ts: what of a diff a review covers: git's markers of content the diff does not carry, read section by section, the files held back as secrets by secrets.ts's decision for each file, one verdict for the sections of a path, the files left out, the gaps they leave, the diff less the excluded and the held sections, and every file of the diff once, in its order. parts.ts: a large change in parts: the packing of a diff's sections into parts within partTokens and the room a request leaves, never cutting a hunk, cutSection, the one reading of a section's hunks, the text of a part, the files a part's request names, each profile's coverage, a part read by its pieces when recovery split it, a judgment's coverage (judgedCoverage), which reads a file left out as a review does and every other file as not-researched, and, for a vote whose voter's window does not hold the cited file's section, the hunks nearest the cited line, as plain functions. recovery.ts: how a research part is split when its reply is cut off or saturated: halves, the two halves of a piece, between its slices or between the hunks of its one file, at the boundary that leaves their token counts nearest, to a floor of one unit and MAX_DEPTH (3) splits, and unitsOf, the units a piece holds, as plain functions that the research stage's recovery loop runs (Recovering a cut-off part). estimate.ts: what a review may cost before any call, which Quorum.estimate answers with. It plans each profile's research as review does and builds the requests the research would send, so each part's figure is what the ledger reserves for it, bounds each lens's vote on the largest section of the filtered diff and a finding at the caps the harness cleans a finder's text to, counts each research part at a third of its input and its reply at the lesser of its budget and a usual reply in the expected spend (expectedOf, in tokens.ts), bounds the worst case with every vote, every part recovered and the calls an adaptation sends once more, and sums the largest bounds the concurrency lets run at once. reports.ts: the bounds a scanner report is read within, the reads (MAX_REPORT_BYTES, MAX_REPORTS, MAX_RUNS, MAX_RESULTS, SONARQUBE_SEARCH_CAP) and the length each text is cut to before a reader hands it to the core (READ_*), with cutRead, which applies one, so that the readers of src/context/ and the core's own checks share each number. candidates.ts: what a scanner's reports give a review, as pure functions: scanReports, which places each issue of each report against the filtered diff under one outcome (held, unmapped, left out, not in the change, used, unchanged or capped), refuses a report that states another commit than the review's, and returns each report's record, each profile's candidates, at most maxScannerIssues of them, and the gaps its reports leave; candidateFindings, which names a profile's candidates as findings after the finder's, from the ranks the finder's were ranked in, with the text of each one's rule; and scannerReportIssues, the shape check of a context's reports
src/profiles/Profiles, as data: security.ts
src/providers/Adapters behind the Provider port, and what they share. openai-compatible.ts, anthropic.ts, gemini.ts and ollama.ts are the HTTP adapters, each with the reader of its replies, and claude-code.ts is the adapter that runs the user's claude CLI instead: its options and their checks, the command line, the child's environment and the reading of its JSON result as pure functions, then the process, a directory per request, the spawn, stdin, the output caps, the process group, abort and cleanup. http.ts is the request: no redirect is followed, the runtimes' own timers are off, reads are capped, every failure becomes a ProviderError, and the key, the base URL's path and the header values are redacted from what a server sends back. options.ts holds the shared options and their checks, under the rules each adapter declares: the body fields it writes, its tool fields, the fields that set its reply limit, the headers it always sends and its structured-output modes; and prepareHttp, which runs those checks, then the adapter's own, and builds what every request sends, the URL, the headers, the values to redact and a copy of extraBody. presets.ts holds the presets, frozen data. build.ts builds a provider from a spec that names a preset or a protocol, claude-code included, after the spec's checks and the adapter's, and hands a claude-code adapter the environment it is given; resolve.ts calls it to check each provider and fromConfig to build each one, and it is not exported from the package. reply.ts holds what the readers share: the failure, the token counts, the message of a reply that ended early, and the joined text of its parts. stream.ts holds the two readers of a streamed reply, server-sent events and NDJSON, which share one line splitter: they decode UTF-8 across chunk boundaries, count the body, each line and each event after decoding, and end a read that passes a cap, or holds an event that is not JSON, as an invalid-response with the body cancelled first. messages.ts places the system text, natively or inline. size.ts is the size guard every adapter runs before a request, with a reserve of its own for what the adapter adds (4096 tokens for claude-code): it bounds the request by one token per UTF-8 byte of its text (each code point at its longest form, as it is, decomposed or compatibility-decomposed, the bound of core/tokens.ts), a reserve for the chat template and the reply budget, and refuses one that may not fit contextTokens. It also counts the worst case of one attempt, which every adapter states through worstCase, and the room a request leaves (roomTokens), which every adapter states through room: checkFits refuses exactly when it is negative.
src/config/The config layer, which the CLI and runQuorum call through loadConfig and fromConfig: src/index.ts exports them with defineConfig and the types, and scripts/contracts.ts calls the schema to build the JSON Schema. schema.ts holds the zod schemas of a config, strict at every level: the file variant, for YAML and JSON, which is data only, and the code variant, for TS and JS, where a provider may also hold its key or be an object implementing Provider; their types, QuorumConfig and QuorumConfigFile; the issues a parse reports, which repeat no value and print a key that is not a safe name as *; and the JSON Schema of the file variant. load.ts is readConfigFile, which reads one named file into a checked config: a regular file of at most 1 MiB in UTF-8, holding YAML 1.2 of the core schema, which refuses an unknown tag, a YAML 1.1 tag such as !!binary, an alias and a repeated key; JSON, which refuses a repeated key; or a module whose default export is the config. Its value must be plain data, a provider object aside, with no __proto__ key, and at most 10000 values; then the schema checks it, and every prompt file and every guidelines, do-not-report and rules file it names is read once, however many profiles and entries name it: at most 64 KiB each and 1 MiB in all. A prompt or document path is read as given, relative to the config file or absolute, and is not confined to its directory: a config is trusted like code. parse.ts holds the readers of text that the loader, the profile resolution and readContext share: decode, parseYaml, parseJson and parseRules, which reads a rules file as a strict list of rules, YAML or JSON by the extension of its path. The readers it is built from are exported, and the suite loader of src/bench/ reuses them: readBounded, whose noFollow option also refuses a symbolic link, readHandle, the part of it that reads an open handle and closes it, decode, lstatOf, parseYaml, isPlainObject and dataIssues, and the writer the bench, --output and the state directory share: writeAtomic, which writes a file whole through a new file and a rename, with WriteFailure and errorCode. env.ts reads the QUORUM_* variables, their deprecated aliases and the voter they derive, which never carries a key or a model to another origin. profiles.ts resolves the profiles that run, each from a built-in profile or its own fields, and cleans, caps and hashes the documents an entry names. resolve.ts layers a config with the environment and the built-in defaults, binds the roles, reads the keys and the claude executable of each claude-code provider a profile uses, and checks every provider with the builder, and returns the frozen resolved config. settings.ts is the view of a provider that --print-config and a result's meta.settings share (providerView, whose result sink leaves out the origin, the command, the args and the key), the rule that writes an extraBody value only when it is safe, and reviewSettings, which builds the record a review is given. command.ts is findExecutable, the lookup of an executable on the absolute entries of PATH that claude-code.ts and the git sources share. claude-code.ts finds that executable: QUORUM_CLAUDE_CODE_COMMAND, else a code config's command, else claude, looked up in the absolute entries of PATH only, and holds the billing warning of a key that Claude Code would bill. from-config.ts is fromConfig, which checks a program's config as a code config is checked, builds each provider and wraps each provider object under its config key; loadConfig, in load.ts, reads the file configPath or QUORUM_CONFIG names, never one it finds, and resolves it. define.ts is defineConfig
src/git/run.ts, the one place quorum runs git: a closed set of typed operations, each built into one argument vector and spawned with no shell, with the pins that keep a repository's config, attributes, hooks and pager from running a program or reshaping the bytes, an environment allowlist, a floor of git 2.41, a deadline and caps on what a call may print, and GitError. openRepository checks a working directory and hands back the operations a source calls. No program a repository names is run. tree.ts, the tree reader. It lists a commit's entries with ls-tree -r -z --long, every size of an entry it keeps known before any read, and a missing one refused, and reads blobs by id through one cat-file --batch, never the working tree, a <rev>:<path> or a pathspec. The path source, the repository's documents, related code's reader and the bench's clones read with it. grep.ts, grepNames, the lookup of a few names at a commit: one grep operation of the runner per cited row, which runs git grep -I -F -w -n -z over the commit's tree with the commit's own attributes (--attr-source, never the working tree's), --no-textconv, --no-recurse-submodules, --no-column, --no-color and no pathspec, each name checked as an identifier of 3 to 64 characters (at most 16 names, each once) before any vector is built. git does not say which pattern matched a line, so each record is attributed in code to the names its text holds as whole identifiers (namesIn, stricter than -w: $user holds no user), and the records are read as they stream: a path over 4096 bytes or a path keep refuses, a row over 1000 bytes and anything that is no strict UTF-8 are dropped as they arrive and count toward nothing, a name whose kept hits pass 256 KiB is dropped whole, git is stopped once every name is, and a record quorum cannot read is a GitError
src/sources/read.ts, readSource, the one entry: it takes a source's kind and answers with the diff, where it came from and the files it left out, and cuts no diff and reads nothing outside the top level. diff.ts, the diff source: a diff's text as it is, and the reading of a diff file or stdin that the CLI used to do, in a ConfigError that names no path. repository.ts, which opens the repository for a git source: it refuses Windows before any spawn and finds git on PATH. range.ts, the range source: both sides of <base>...<head> resolved to full ids, their merge base diffed with the head under the runner's pins, attributes from the base. local.ts, the local and staged sources: the trust check that refuses a repository whose own config names a filter program, the diff of the index or of the working tree against HEAD, and the untracked files, which quorum reads itself inside the top level and never through a link. beneath.ts, reading an untracked file beneath the top level, on macOS with O_NOFOLLOW_ANY and on Linux through its parent's handle: the reader local.ts reads each untracked file and link through, which refuses a platform with no such mechanism. paths.ts, the path source: a commit's tree listed once and filtered in code by the selection, exclude, the secret rule and the skip rules, each blob read by id, never the working tree, and the files written as new files. The skip rules of a path review, the secret names and the check for a credential in a file's text are the core's: src/core/skips.ts and src/core/secrets.ts, which the hold on every diff and the files related code may read share, and paths.ts applies them, the secret rule whatever the default skips say, unless the context's send names the file. added.ts, the all-added writer. It writes files as git's new-file diff, its names quoted as git quotes them so diffSections reads them back, and cuts a file into hunks of at most 4 KiB, a longer line alone in its hunk, so research in parts spreads a large file across parts
src/context/read.ts, readContext, which reads what a review takes from files besides its diff, the documents of the repository, the scanner reports and the lcov coverage reports: the { repository } entries of a resolved config, from the commit the review's source names, documentCommit, with the refusals of a diff and of a repository with no commit, one for each entry, before any git runs for it, and otherwise the repository opened once as the source's flag opens it (sources/repository.ts), for the documents and for the top level a report's paths are placed against; reports.ts, reportRequestIssues, the configuration errors of the reports a review is asked to read (a profile that does not run, none while several run, an lcov report while no profile reads test coverage), and readReports, which reads each named file one at a time through the config layer's bounded reader, as a regular file never through a link, at most 16 MiB, hashes its bytes and hands its text to the reader of its format, a file that cannot be read being a report with its problem and no throw, and keeps the scanner reports and the coverage reports apart; sarif.ts and sonarqube.ts, the readers of a SARIF 2.1.0 log and of a saved api/issues/search response, each handing over issues with every text cut and none cleaned, since the core cleans them; lcov.ts, the reader of an lcov tracefile, handing over the lines each file record lists, with their hits and missed branches, and holding no text of the file but the paths it places, which are compared with the diff's and never opened; paths.ts, the path rules that place a report's paths against the scan root and the top level, and isScanRoot, the check of a --scan-root; documents.ts, readRepositoryDocuments: one listTree keeping the named paths, the modes and sizes checked before the one readBlobs, each blob decoded (a NUL among its first 8000 bytes is no text), cleaned and checked against its caps and the profile's cap of all of them (a rules file parsed by its extension, its rules checked one by one and then against the profile's own, its config's and the files before it), every problem reported at once as one ConfigError; and related.ts, openRelatedCode, the one reader of a repository for related code, which opens the repository as the source's flag opens it, resolves the commit relatedCommit names, lists it once with listTree keeping the regular files of at most 1 MiB that readableForRelated admits, looks names up through grepNames on those files alone and reads their blobs by id with readBlobs, after checking their listed sizes against the bytes asked; a commit it cannot read, a partial clone's missing blob and a listing of more than 16 MiB of names are a ConfigError before any call, and nothing is cached or fetched. It never reads the working tree, and its documents are checked again by the core: Rules and guidelines, and Scanner reports
src/bench/The code of quorum bench, which reads a suite, runs its reviews and reports them. suite.ts reads and checks a suite with the config loader's own readers: the schema and its caps, the kinds of case, an attack case's twin, goal, carrier and encoding, the spans of every location and decoy against their patches, the patches, and the suite's two hashes: the review hash of its case ids, its trials and its patches, and the scoring hash of the bytes of suite.yaml; it reads the patch kind alone, and refuses a suite of kind: panel. panel.ts holds the panel kind, whose cases are findings with known answers in a repository's history, and which ships no code: its schema (panelSuiteSchema, which the contract file of a panel suite is generated from), the clone layout of a repository (clonePlace, cloneDirectory), its two hashes, and loadBenchSuite, which reads suite.yaml once and hands it to either kind. It holds the types of the seam to a clone, CaseReader, CaseChange, Fetch and CaseMissingError, and checkPanelCases, which validates the cases through a reader it is handed and asks each configuration's estimate of the case's finding, with no model: the bench runs no git, so the one reader of a clone is the CLI's. score.ts decides whether a review's findings catch a case's bug, and counts the kept findings that catch nothing; it also checks them against the decoys of a forced keep, and judges each finding of known truth, a catch of a location true and a catch of a decoy false, for the lenses' error correlation. stats.ts holds the Wilson interval, the exact sign test, the nearest-rank percentile, phi of a table of two lenses' errors and the effective number of votes, written by hand and held to reference values. attacks.ts scores the attack cases against their twins, trial by trial and twin by twin, and reads the advisory flags from the patches before any call. independence.ts is the lenses' error correlation: one table of errors per pair of lenses over the findings of known truth, and the mean phi. fingerprint.ts is the salted fingerprint of a resolved configuration, and providerIdentity, the form of one provider as sorted JSON, which the state layer hashes into the key of its entries and never keeps. records.ts holds the formats of run.json and of a line of results.jsonl, as strict schemas: a line holds a review's result, read through the result's schema in src/core/result-schema.ts. run-dir.ts is every read and write of a run directory, none of them through a symbolic link, and it writes its two data files readable by their owner only. It writes through writeAtomic of src/config/load.ts, which src/cli/outputs.ts writes the --output files through too. runner.ts runs the planned reviews, each through a quorum of its own and at most --jobs at once, and hands each that resolved to a callback that records it; a review that rejects is a failure, which is not recorded. report.ts builds the report from the scores and renders it as Markdown and as JSON, with its attack section and the lenses' error correlation. Benchmarks says what each does for a user
bench/The repository's own suites, bench/bugs/ and bench/injection/, and the licenses of their cases in bench/LICENSES/, and the panel suite bench/findings/, whose cases ship no code: data for quorum bench, which no package, binary or image ships. bench/injection/ holds a manifest, manifest.yaml, from which scripts/injection-corpus.ts writes its suite.yaml and cases/
src/state/The file store behind --state, store.ts: openFileStore, a ReplyStore that counts the calls it kept (kept()), removes its directory (discard()) and, for the default directory, makes the directory's missing parents, and default.ts, defaultStateDirectory, the default state directory in the user's cache; the store keeps one file per answered call in a directory it refuses unless it is a directory no link, owned by the user and writable by no other, outside every git work tree, and either empty or made by quorum (its marker quorum-state.json), with mode 0700 for the directory and 0600 for a file. An entry is named by the SHA-256 of quorum's version, the provider's identity and the core's key, read with readBounded under 8 MiB through a strict schema, and written through writeAtomic; anything else is a miss, and a write that fails is a warning. It reads no process: its caller hands it the owner, the platform, the version and the providers' identities (Saved state)
src/mcp/The code of quorum mcp, the one place that imports the MCP SDK. sdk.ts holds the SDK's name and pin, read from the peer dependency of package.json, and sdkProblem, which says before any import whether the copy installed beside quorum is the pinned one: it resolves the SDK's entry as the import would and reads the package.json above it, and a resolution that throws, as in a compiled binary, is left to the import. result.ts is what a calling agent receives of a review: the result of agentResult, from the public view, in a fixed shape of code-checked fields first, each file name through showHidden, each claim through inertPlain at 300 code points and the whole within 10,000 bytes of JSON, whose budget drops whole items, those over 2,048 bytes first and then last first, each counted, budget.ts is the session budget (sessionBudget), the tokens one server may spend over its life, which reviewCall counts at each provider call's spent tokens and, for a review that ends without a result, at its whole cap, and which a call starts only while the cap fits in what is left, tool.ts is the tool: the input schema, whose every message is fixed text, checkedCall, which checks a call's usage before any git or model, and reviewCall, which never throws and holds the one review that may run, with the session (openSession) it runs in; progress.ts counts a review's research parts and findings decided into the notes a client that asked for progress receives, with a heartbeat each minute; and serve.ts, the one module that imports the SDK as a value, builds the server (reviewServer) and serves it over stdio (serveMcp)
src/report/The reporters, which write a result for a person or a program: reporter.ts, the Reporter interface, the ReportInput it renders, a result or its public view, and the ReportContext it is given, the color and the review's outcome; registry.ts, REPORTERS by name, renderReport and the checks of a format's name; json.ts, the result as inertJson writes it; brief.ts, one line of counts and code words; text.ts, the report for a person, its lines built from pieces so that color decorates only what quorum wrote; markdown.ts, the summary a pull request or a job summary shows, written from the public view with every text a model or the diff wrote in a code span or a fenced block and held within 60 000 characters; payload.ts, the document quorum-action posts, its summary, its comments' bodies and its count of the findings no line holds, written by inertJson from the public view; sarif.ts, SARIF for GitHub's code scanning, one run of the public view written by inertJson, with its levels from the rule that sets the exit code, its messages through inertPlain, its paths as relative URIs and a notification for each gap, with the shared placement of a finding on a file of the diff that payload.ts uses; and lines.ts, the count of a noun, a file left out, where a flag points, the fixed words of each gap's reason, the words of a verdict, a source, a finding's level and votes and its place among the findings, the rows of its evidence and the coverage line, a token count scaled and a duration, durationText, in the one form every line a person reads writes (4.3s, 42s, 7m48s), which the text report, the summary and the CLI's progress lines write one way; and view.ts, the public view, which every public sink renders. read.ts is readResult, the other direction: it reads a saved result or public view back from text, under a cap, the release check and the strict schema, in refusals that hold nothing of the text. A reporter renders a result it is given, pure; a new one is a module and one line of the registry. The report says what each writes
src/cli/The CLI: bin.ts, the process entry point, which holds exit code 3 until the run settles; main.ts, runCli and the usage, which reads a diff file or stdin through src/sources/diff.ts and every source through readSource, opens the reader of related code at the commit the source names when it is on (openRelatedCode, before the banner and any call), opens the --state directory as a file store, derives a path review's token cap and deadline from its estimate, writes the report renderReport makes of the result, and returns the exit code outcome gives; io.ts, the I/O a run gets, the exit codes of a review, the lines of a failure and parseFlags, the strict flag parser, which main.ts and bench.ts share; bench.ts, runBench, the subcommand's flags, plan, progress lines and exit codes, which runCli hands the arguments after bench; clones.ts, openClones, the one reader of a panel suite's clones and so the implementation of the bench's CaseReader seam: it reads each case's change from the clone at <dir>/<host>/<owner>/<name> through the sources (openSourceRepository and readSource, with the range or paths the case names) and the tree reader (listTree and readBlobs, which count the lines of each file a refutation stands on), every git call through the runner of src/git/run.ts, so it never fetches, and reports a clone or a commit it lacks as what to fetch; report.ts, runReport, quorum report's flags, its reading of a result from a file or stdin and its exit codes, which runCli hands the arguments after report, and which calls no model, reads no config and runs no git; render.ts, the banner, the estimate's lines and viewFacts, the numbers of the config the view reads; view/, the view of a review, whose modules are model.ts, a fold of the review's events into a bounded state, lines.ts, every line it writes, eta.ts, the time left, plain.ts, the writer plain mode uses with its heartbeat, summary.ts, the summary every view but JSON and none ends with, its lines and each gap's fix, glyphs.ts, the Unicode and the ASCII glyph sets and the check of the locale that chooses one, width.ts, the width of a text in columns, counted with no table, and its cut with an ellipsis, and frame.ts, the block of a live review, at most 8 lines of its parts, calls, tokens, time left and a hint, and fewer on a short terminal (at most the rows less two, none under 4 rows), each cut to the terminal's width less one, terminal.ts, the live writer, which draws the block under the log lines in one synchronized write per frame, erases it before the report and puts the terminal back on every exit path, json.ts, the writers of JSON mode and of --progress none, and progress.ts, progressMode, which chooses the mode from --progress, QUORUM_PROGRESS, the stream and the environment, and viewWriter, which builds the writer of a mode, behind the ViewWriter of writer.ts that the CLI, quorum mcp and runQuorum write every stderr line through; bin.ts hands runCli a set of exit hooks, the restorers it runs on the second signal, on a failure nothing caught and at the process's exit; outputs.ts, reportPlan, the report a run writes on stdout, its format from --format or, with none, text on a terminal and json elsewhere, and its color from --color and NO_COLOR, the one variable it reads, and the files --output also names: checkOutputs, which refuses before any call a path that is a link, no regular file or in no directory, and writeOutputs, which writes each report, never colored, after stdout through writeAtomic of src/config/load.ts; print-config.ts, the YAML of --print-config, which writes the provider view of src/config/settings.ts; mcp.ts, runMcp, quorum mcp's flags and the checks that come before the server starts, which loads src/mcp/ with import() alone, which runCli hands the arguments after mcp
src/index.tsThe public API, readSource and openRelatedCode, which fill in the platform of the process, fileStore, which fills in the owner, the platform and the version of the process, and the deprecated runQuorum
schema/The contract files: quorum.schema.json, the JSON Schema of a YAML or JSON config, for editors, generated from the file variant, and result.schema.json and public-view.schema.json, the structure of a result and of its public view, generated from resultSchema and publicViewSchema of src/core/result-schema.ts, progress.schema.json, one line of --progress json, generated from progressLineSchema of src/core/event-schema.ts, and panel-suite.schema.json, a panel suite's suite.yaml, generated from panelSuiteSchema of src/bench/panel.ts, and inert-text.vectors.json, no schema but data, the inputs of INERT_TEXT_INPUTS of src/core/inert-vectors.ts with what the display functions make of each. Each schema is draft-07, each file is generated by bun run schema, which runs scripts/schema.ts over the table of scripts/contracts.ts, and committed, and each is attached to a release: The contract files
scripts/The programs bun run starts, which no module of src/ imports: contracts.ts holds the table of the files of schema/, each with the function that builds it, schema.ts writes every file of that table (bun run schema), build-binaries.ts compiles the binaries of a release, copies the contract files beside them and writes their checksums (bun run compile:release), live-claude-code.ts checks the claude-code adapter against the real claude (bun run live:claude-code), github-markdown.ts renders the hostile corpus of the Markdown reporters on GitHub's Markdown API and checks the HTML (bun run live:github-markdown), and injection-corpus.ts writes bench/injection/ from its manifest, run by hand with bun run ./scripts/injection-corpus.ts. Specs beside them, scripts/**/*.spec.ts, run with the suite
.github/workflows/ci.yml, which checks every pull request, and cd.yml, which builds and publishes the release: The release
src/testing/The test helpers, among them the fetch stub the adapter specs share, the provider contract suite every adapter's spec runs, each protocol's recorded replies, a fake claude (fake-claude.mjs and claude.ts) and the results of real Claude Code runs it replays, the bench's fixture suites and fake models (bench.ts), the CLI's in-memory I/O (cli.ts), the recorded event lists of whole reviews that the view's specs replay (events.ts), the fake terminal the live view's specs draw on, which interprets the sequences quorum writes, throws on any other, and keeps the screen and the history, with or without re-flowing its rows on a resize (terminal.ts), the fake spawn of the git runner (git.ts), the builder of a real repository from a list of commits, with an isolated git (repository.ts), which the real-git specs of the runner's grep use and the fixture origin repository the clone reader's specs clone over file://, with no network (clones.ts), builds on, and the fake credentials of the secret rule's specs, each built at run time from pieces so that no source holds a whole key (credentials.ts). Spec files import them; bun run lint refuses an import from any other file

The dependency rule ​

The core knows no domain, no model vendor and no process. A profile is data, an adapter sees the core only through its port, and only the outer layers touch the process:

LayerMay importMay not use
src/core/Other core modules, zod, node:crypto and the package.json versionThe globals process, fetch, WebSocket, EventSource, Worker, Bun, globalThis, global and self
src/profiles/Types from src/core/, and nothing elseThe same globals
src/providers/Its own modules, and core/ports.ts, core/errors.ts, core/types.ts and core/tokens.tsprocess, Bun, globalThis, global and self; it may use fetch, WebSocket, EventSource and Worker
src/providers/claude-code.tsThe same, and node:child_process, node:fs, node:fs/promises, node:os and node:pathBun, globalThis, global and self; of the providers, it alone reads process, for its environment and its process group
src/config/Its own modules, src/core/, src/profiles/, src/providers/, zod, yaml, node:fs, node:fs/promises, node:path and node:urlfetch, WebSocket, EventSource, Worker, globalThis, global and self; it may read process
src/bench/Its own modules, src/core/, src/config/, zod, yaml, node:fs, node:fs/promises, node:path and node:cryptoThe globals process, fetch, WebSocket, EventSource, Worker, Bun, globalThis, global and self; and never src/cli/ or src/testing/
src/git/Its own modules, core/errors.ts, core/types.ts and core/clock.ts, node:child_process and node:pathThe globals process, fetch, WebSocket, EventSource, Worker, Bun, globalThis, global and self; and files, the config layer and the sources
src/sources/Its own modules, src/core/, src/git/, src/config/, node:fs, node:fs/promises and node:pathThe same globals; and node:child_process, so it reaches git only through src/git/run.ts
src/context/Its own modules, src/core/, src/git/, src/config/, src/sources/repository.ts, the types of src/sources/read.ts (and no value of it), zod and node:crypto (for the scanner reports it reads), node:fs, node:fs/promises and node:pathThe globals process, fetch, WebSocket, EventSource, Worker, Bun, globalThis, global and self; and never another module of src/sources/. The core, src/config/, src/sources/, src/git/ and src/bench/ never import it
src/report/Its own modules, src/core/ and zodThe same globals as the core: process, fetch, WebSocket, EventSource, Worker, Bun, globalThis, global and self
src/state/Its own modules, src/core/, src/config/load.ts, zod, node:fs, node:fs/promises, node:path and node:cryptoThe globals process, fetch, WebSocket, EventSource, Worker, Bun, globalThis, global and self: its caller hands it the owner, the platform and the version; and never src/cli/ or src/testing/
src/mcp/Its own modules, src/core/, src/report/, src/sources/, src/config/, src/git/, src/cli/io.ts, package.json, the MCP SDK (@modelcontextprotocol/server and its /stdio), zod, node:fs, node:fs/promises, node:path, node:url and node:streamThe globals process, fetch, WebSocket, EventSource, Worker, Bun, globalThis, global and self
src/cli/view/Its own modules, src/core/ and src/report/The globals process, fetch, WebSocket, EventSource, Worker, Bun, globalThis, global and self: the CLI hands it the clock, which CliIO.clock lets a spec move; and never src/config/, src/providers/ or src/testing/
src/cli/, src/index.tsAny layer but src/testing/, and src/mcp/ through import() alone: no static import of it, and none of the MCP SDK

The MCP SDK is the one dependency only a single command loads: only src/mcp/ imports it, and the CLI loads src/mcp/ with import(), which the lint rule does not read, so no static import of src/mcp/ or of the SDK reaches quorum or the library, and a quorum that does not run quorum mcp never loads the SDK. The core never imports a profile. A provider imports core/tokens.ts besides the port, the errors and the types: its size guard counts a text with the bound the core counts a request with. No inner layer imports src/report/: only src/cli/ (its view/ included) and src/index.ts do. Nothing but src/cli/, src/index.ts and src/testing/ (its recorded events fold into the view's state, and its fake terminal counts widths with the view's) imports src/cli/view/, and src/core/ and src/mcp/ never do: src/mcp/ reaches the view only through the observe sink src/cli/mcp.ts hands it. No inner layer imports src/bench/: only src/cli/ and src/index.ts do. src/cli/bench.ts hands it the environment, the signal and the working directory it may not read for itself, and src/cli/main.ts and src/index.ts take providerIdentity of it for the state directory. Only src/cli/ and src/index.ts import src/context/, which opens a repository through the one module that finds git and refuses Windows, src/sources/repository.ts, rather than copying that rule. Only src/cli/ and src/index.ts import src/state/: the core never does, and reaches a store only through the ReplyStore port. src/config/ reads the config file it is named, the prompt and document files that file names, and process.env when loadConfig or fromConfig is given no environment, src/cli/ is the one module that holds stdin and writes stdout and stderr, and src/sources/diff.ts reads the diff from a file or from that stdin, for the CLI, and runQuorum in src/index.ts calls loadConfig with no options, so it reads process.env and the file QUORUM_CONFIG names, which must be an absolute path. The adapter in src/providers/claude-code.ts is the first module that starts a process, and src/git/run.ts the second, which starts git alone; src/sources/ reaches git only through it. src/config/claude-code.ts only looks its executable up, with findExecutable of src/config/command.ts, which uses node:fs and node:path. src/providers/http.ts reads one property of the global object, the symbol under which Node keeps its fetch's dispatcher, on one line that lint allows by name. bun run lint enforces the table through the overrides at the end of eslint.config.js, on every production file; a spec file may import across layers, and src/testing/. src/testing/server.ts, a fake server on 127.0.0.1, is the one module that uses node:http, and only spec files import it: a lint rule refuses its import, and node:http, a bare http and node:http2, to every other test helper and to the CLI and the public API. src/lint.spec.ts lints a probe file in each layer through ESLint's API, so a boundary that stops refusing an import or a global fails the suite.

The stages of a review ​

review runs every profile of the quorum at once, on the diff less the sections exclude leaves out and the files held back as secrets, split into one section per file once for all of them, under one set of lanes, a limit for each provider within a ceiling for the review, or the one concurrency limit when it is set. Before any stage, the hold: the files whose name is a secret's or that hold a credential, but for those the input's send names, leave the diff whole, so no stage reads a line of them, and exclude is applied first. The harness then reads the advisory flags from the whole diff, the excluded and the held files included, and lists the files the review leaves out: those exclude matches, those whose change the diff does not carry and those held back as secrets, each a gap of every profile but an excluded file and a file named as a secret that the change deletes whole. The input's own leftOut, the files a source left out before the diff was written, comes first in that list and is merged with the diff's own, and each skipped file of it whose rule is secret, each secret file and each deleted-secret file raises a secret-file flag, before the diff's flags, and a section of the diff that edits, renames, copies, adds or deletes the path of a repository document of the review's context raises a guideline-edited flag, after them, unless the review is a path review, and a section that names a scanner's ignore or config file, a CI workflow too when the review reads a scanner or a coverage report, raises a scanner-config-edited flag after those, as an added line that holds a scanner's suppression marker raises a suppression-added flag among the diff's, and a path review raises neither. The research of each profile is planned before any call, on the room its own research provider states, so two profiles whose models have different windows pack on their own. A path review is estimated before the review: the CLI asks Quorum.estimate of its diff, which plans each profile's research as the review will and states what the ledger reserves for each part, prints the estimate, and gives the review the bounds the estimate derives, never holding it for its size: with maxReviewTokens unset the cap is the estimate's worst case, never below 2000000, and with reviewTimeoutMs unset the deadline is 24 hours, passed to review as its own limits (--large only warns): The bounds of a path review. Each profile goes through three stages on its own:

  1. Research. One call to the profile's research provider, or, for a diff larger than partTokens or than one request of its window, one call per part, a profile's parts submitted largest first (dispatchOrder), at most concurrency at once, 16 when it is unset, each call waiting for its provider's lane: Research in parts. A part whose reply is cut off or saturated is split in two by code in its own worker, each half asked as a part, depth first, at most three splits deep: Recovering a cut-off part. A call carries the profile's research instructions, the fenced diff, or the part's share of it, and the guidelines. Each reply is parsed strictly as it arrives; once every part has answered, only the finding cap (findingsCap, else maxFindings) of the findings they list in all are read, each reply's first finding, then each one's second, and so on, kept in the parts' order, and each is checked against the whole diff: a finding that cites code outside the diff is dropped, and one the harness cannot read is a gap. Each finding that passes the check is named by its id and its fingerprint and tagged with its profile.
  2. Dedup. Plain code drops a finding that repeats the file, line and category of an earlier one. For one key it keeps the first finding the finder anchored itself, else the first, so a finding the harness moved to its quote never displaces a well-anchored one.
  3. Panel. Every finding goes to every lens, each vote to the lens's own provider, each voter receiving the claim, the evidence, the diff section of the cited file, and the guidelines when the profile has them. When the voter states a room that the section does not fit, it receives the section's header and the hunks nearest the cited line instead, but only when a hunk holds the cited line and the header and that hunk fit that room together; otherwise it receives the whole section, which its provider refuses as too large. The verdict is computed in code from the votes, by the profile's thresholds. In a review given a reader of related code, the panel of a profile with a lens that asks has the related code of each finding worked out before its votes, one finding at a time in the profile's order while the votes of the findings before it are cast, and sends the lenses that ask the first excerpts that fit their room, in a block of their own first in the vote: the diff block is chosen as it is with no related code, and every other lens's vote is the one it would be without it, digest for digest (review).

judge runs the same path less its research, for findings it is given (Quorum.judge): it checks the input as review does and refuses a context that holds a scanner report, checks the given findings as fields (givenIssues), then by the code that checks a finder's (checkGiven, which calls checkFindings of research.ts) against the diff as a review reads it, and refuses the call, before any call is made, with an issue for each finding a check would drop or change. Each profile then goes through dedup and panel alone, on the findings it was given, with the signal, the deadline, the interrupt, the store and the token ledger of a review, so each vote is asked as the review would ask it of the same finding, digest for digest, and a store holds the votes of one for the other. The result is a review's with a research record of no part, a coverage that says no file was researched (judgedCoverage), the gaps of the panel and of the limits alone, and meta.judged. Quorum.estimate takes the same findings and runs the same checks.

Every attempt of every call reserves its worst case in the review's token ledger before it is sent and settles when it ends: a call the cap stops is its profile's token-cap gap, never a failed review (The token cap). The review arms a deadline on its own clock, cleared however it ends: at it every call in flight and every wait is stopped at once with the deadline's failure, a second stop beside the review's signal, so what it left undone is a review-deadline gap and the review resolves, where an abort rejects (The review's deadline). The interrupt is a third stop, armed on the review's interrupt signal: it aborts stop, which ends every wait and every new call, and a timer of its grace aborts halt, which the attempts in flight and the store's reads and writes read, so a call that ends within the grace is read and saved, and what the interrupt left undone is an interrupted gap and the review resolves (Interrupting a review). A research part that fails is its profile's research-failed gap, and a provider three of whose calls in a row failed for a reason of its own is called no more (down.ts): the call that would reach it fails inside its slot, before its request is built, so the parts and votes it was never sent are provider-down gaps and the calls in flight are read as any is. The review rejects, with a ProviderDownError, only when no part of any profile was read (When the research call fails).

The result joins the profiles' verdicts and gaps in profile order, its meta.usage, meta.calls and invalidFindings are counted from the review's own events, its meta.settings a copy of the record the caller gave, its meta.leftOut the files left out, its meta.flags the flags, and each profile's coverage, every file of the diff with how much of it the profile's research reviewed, and each event reaches the sink as a copy. Every stage and every call checks the review's signal: Abort.

The release ​

.github/workflows/cd.yml cuts a release and publishes what it ships: the npm package, four binaries with the contract files, and a container image. It runs on every push to main, except one that only touches files under .github/, and by hand, and it calls the shared workflows of this-is-tobi/github-workflows at @v0. Every artifact is built in the run that creates the release, from the commit that release is tagged on: the jobs that check out the repository get the commit the push made, which for a release is the commit that merged the release pull request, the one release-please tags v<version>. release-guard fails a run that would release another commit's pull request, and release-check stops the package, the image and the attestations of a run whose release is tagged on another commit: the paragraphs on them below say what neither can do. No artifact is built anywhere else and attached afterwards.

JobRunsDoes
expose-varsOn every pushReads the Bun version pinned in mise.toml and hands it to the jobs that install Bun, so the binaries and the npm package are built with the Bun that the build stage of the Dockerfile pins too: src/dockerfile.spec.ts keeps the two equal
build-binariesOn every pushInstalls the production dependencies from the frozen lockfile, running no lifecycle script, runs bun run compile:release and uploads bin/release/ as the artifact quorum-binaries, which holds the four binaries, the contract files and SHA256SUMS, which lists them all, and nothing else, and expires after three days
release-guardOn every push, once build-binaries has passedFails the run when a merged release pull request is still labelled autorelease: pending and merged another commit than the run's: see below
releaseOn every push, once build-binaries and release-guard have passedCalls release-app as the repository's GitHub App, so that the release pull request it opens runs CI. release-please opens or updates that pull request, and when it is merged release-app creates the tag v<version> and the GitHub release, moves the tags v<major> and v<major>.<minor> to that commit, and attaches every file of quorum-binaries to the release
release-checkOnly when release created a releaseFails the run when release-please tagged the release on another commit than the run's, or reports none, so that the three jobs below do not run: see below
attest-binariesOnly when release created a release, once release-check has passedDownloads quorum-binaries and attests the build provenance of the four binaries and of each contract file
npmOnly when release created a release, once release-check has passedCalls release-npm, which installs from the frozen lockfile, runs bun run build and publishes the package with provenance
dockerOnly when release created a release, once release-check has passedCalls build-docker, which builds the Dockerfile for linux/amd64 and linux/arm64, each on a runner of its own architecture, and pushes ghcr.io/this-is-tobi/quorum tagged with the version, its minor, its major and latest, and with the short commit SHA, which build-docker adds by default
attestAfter dockerCalls attest-docker on the digest docker pushed

build-binaries runs on every push because release attaches the binaries to the release it creates, and a push is not known to create one until release has run. So a push that creates no release uploads an artifact that expires unused, and a compile that fails stops release as well: no release pull request is opened or updated until it compiles again. Each job holds the permissions it uses and no others, none at the level of the workflow, and the checkouts of cd.yml itself keep no credential in .git/config.

release-guard keeps the tag and the artifacts on one commit. release-please releases every merged release pull request that is still labelled autorelease: pending, and tags that pull request's merge commit, whatever commit the run is on. If the run of a release commit fails before release-please, in build-binaries for instance, the next run on main would create that release from its own commit: the tag on the release commit, and the binaries, the package and the image built from the later one. release-app attaches the binaries itself, so the guard runs before it, right after build-binaries, to check when the release is about to run and not before minutes of compiling. It lists the merged release pull requests of the branch through the API, with pull-requests: read and no checkout, and fails the run, naming the pull request and its merge commit, when one is still pending and its merge commit is not the run's; a call that fails fails the guard too. The same check fails the run of a commit pushed to main while a release commit's run has not released yet.

release-check covers what the guard cannot see, a merge that lands after it. In the seconds between the guard and the moment release-please lists the pull requests, the release pull request can be merged, and the run that is already past its guard releases it: the tag is on the merge commit, but the binaries release attaches, and the commit the tags v<major> and v<major>.<minor> are moved to, are that run's. release-check runs after release when it created a release, with no permission and no checkout. It reads the commit release-please reports it tagged, and fails the run when that is empty or is not the run's commit, so attest-binaries, npm and docker do not run, nor attest after docker. It cannot take back what release did before it: the binaries and the moving tags may already be on the release, and the recovery below corrects them.

What recovers depends on whether the release exists. A run can be re-run up to 30 days after its first attempt, a re-run keeps the commit and the ref of the original run, and "Re-run failed jobs" also re-runs the jobs that depend on the failed ones and leaves the others their outputs, which the new jobs use: Re-running workflows and jobs.

  • The run of the release commit failed before the release existed, in build-binaries for instance, or in release before release-please created the release: this is what the guard of a later run reports. Use "Re-run failed jobs" on that run. The failed job runs again with the jobs that depend on it, and release creates the release from the release commit.
  • A publish job failed after the release existed: attest-binaries, npm, docker or attest. Use "Re-run failed jobs" on that run. release and release-check passed, so their outputs carry over, release-created and the version among them, and the failed job runs again from the release commit, with the jobs after it. attest-binaries also reads the artifact quorum-binaries, which expires three days after the run.
  • release failed after release-please created the release, or release-check failed. "Re-run failed jobs" does not help. The release exists and its pull request is labelled autorelease: tagged, so a second release creates nothing and sets no release-created, and every job that waits for it is skipped for that version for good; release-check run again alone reads the same outputs and fails again. Delete the release and its tag (gh release delete v<version> --cleanup-tag), put the label autorelease: pending back on the release pull request in place of autorelease: tagged, then use "Re-run all jobs" on the run of the release commit, which is not the failed run when a run of another commit released it. It runs again from the release commit: the binaries are built again, release-please releases the pull request again, release-app moves the major and minor tags back to the release commit, and the jobs that publish follow.
  • A manual dispatch is none of these. It builds the head of main, which is not the release commit once another commit follows it, so release-guard refuses it while a release is pending on another commit.

Where each artifact's attestation is:

  • The binaries and the contract files. One build provenance attestation per binary and per contract file, none for SHA256SUMS: attest-binaries makes them with actions/attest-build-provenance, and GitHub stores them in the attestations of the repository. gh attestation verify quorum-<target> --repo this-is-tobi/quorum checks a downloaded binary against its attestation, and the same command checks a contract file: The contract files.
  • The image. attest-docker signs the digest with cosign, keyless, and attaches an SPDX SBOM that Trivy generates with cosign attest, as an attestation of type spdxjson: both are stored in the registry beside the image. It also attests the build provenance, which goes to GitHub's attestations and to the registry. gh attestation verify oci://ghcr.io/this-is-tobi/quorum:<version> --owner this-is-tobi checks the provenance, and cosign checks the signature and the SBOM. The certificate of that provenance names two workflows. Its signer, which gh matches, is the attest-docker workflow of this-is-tobi/github-workflows, and it records this repository's cd.yml as the build configuration. Since gh matches the signer, the command names the owner and not the repository: --repo this-is-tobi/quorum alone refuses it.
  • The npm package. npm publishes through npm's trusted publishing: the registry accepts the identity of the workflow run in place of a token, so the repository holds no npm token, and --provenance makes the publish fail rather than go out without its provenance. The registry holds the provenance statement of each version, which names the repository, the workflow file, the commit and the run that built it, and the package's page on npmjs.com links to the commit and the run. npm audit signatures checks it for a package a project installed.

The binaries and the image bundle the MCP SDK, so quorum mcp runs from either with nothing installed beside it. The SDK is a development dependency and an optional peer of the package at one pinned version, so the binary build and the image install every locked dependency, bun install --frozen-lockfile --ignore-scripts: a production install leaves the SDK out, since it is a development dependency, and a compiled binary holds only what the code imports, so the development tools never reach it. A build without it fails, and a binary never ships without the SDK: src/mcp/serve.ts imports it statically, inside the module the CLI loads with import(), and bun build --compile bundles what a module imports statically and fails on one it cannot resolve, where a bare import() of a missing package would build in silence. The npm package leaves the SDK to the user, who installs the pinned version beside it: Installation.

Renovate decides whether a dependency bump cuts a release: release-please lists a build commit under Dependencies and cuts a patch release for it, and a chore commit does neither. renovate.json commits as build what the artifacts embed, the runtime dependencies, the Bun pin and the base images of the Dockerfile. The MCP SDK's two pins, the development dependency and the optional peer, move together, exactly, as a build commit since the binaries embed it, once a release is 14 days old. The Bun pin of mise.toml, the packageManager field of package.json and the oven/bun tag of the Dockerfile move in one pull request, since the suite fails when the tag and the pin differ. The Node pin, the development tools and the CI actions stay chore. TypeScript stays below 7 until typescript-eslint, which the lint runs, supports it, since TypeScript 7.0 ships no JavaScript API.

Testing ​

bash
bun run test        # the whole suite, once
bun run test:cov    # the same, with coverage
bun run typecheck   # tsc --noEmit
bun run lint        # eslint, the Markdown pages and their code blocks included
bun run format      # eslint --fix
bun run schema      # write every file of schema/ from the zod schemas
bun run build       # tsc: the npm package, into dist/
bun run compile:release   # the four binaries of a release, the contract files and SHA256SUMS, into bin/release/
bun run live:claude-code   # four calls to the real claude CLI, by hand
bun run live:github-markdown   # one request per document to GitHub's Markdown API, by hand
  • bun run test runs Vitest under Node, once, on every src/**/*.spec.ts and scripts/**/*.spec.ts. Never run bare bun test, which starts Bun's own test runner instead of the Vitest setup the specs are written for, and never run Vitest in watch mode.
  • At most two test workers, set in vitest.config.ts, so the suite stays light on a laptop.
  • No network and no model call. Every test uses fake providers, a stubbed fetch, a fake server on 127.0.0.1 or a fake claude. The fake server, src/testing/server.ts, is the one real socket, and a lint rule holds that only spec files import it: src/providers/stream-server.spec.ts streams each adapter's reply from it one byte at a time through the real fetch, and aborts an OpenAI-compatible attempt mid-body to see the server's connection close, and a src/providers/stream.spec.ts row reads a stream from it the same way. The controls of the threat model are checked by structure in the default suite, such as no environment value in any request, and vote requests that are the same whatever the other voters answer.
  • Time and randomness are injected: the deadlines and the waits of the call path run on a fake clock in src/core/stages/context.spec.ts, and a review's deadline runs on the fake clock through createQuorumWith, which only the specs use, so no test waits for one, and a test through a review, the CLI or the bench that makes a provider fail in passing pins Math.random to 0, so its backoff is a 0 ms timer.
  • bun run test:cov measures coverage with Istanbul over src/**/*.ts, the specs and src/cli/bin.ts left out, and not over scripts/.
  • Files and processes. src/config/load.spec.ts writes the files it reads to fresh temporary directories, removed afterwards, and runs one node process on the loader: vitest's own import transforms TypeScript that Node itself refuses, such as an enum, so only a real node shows what Node reports. src/cli/main.spec.ts writes its config files to a temporary directory too, and src/cli/bin.spec.ts runs node on bin.ts, for what only a process shows: the exit code it sets, a run that stops with nothing left to wait for, an error nothing caught, SIGTERM, and a second SIGINT. src/lint.spec.ts starts ESLint once, about a second, and lints a probe file in each layer through its API, in memory: it writes no file.
  • The bench. The specs of src/bench/ and src/cli/bench.spec.ts write their suites and their run directories to temporary directories, which each spec removes, and no spec calls a model: the runner and the command review with fake providers, and the command runs through runCli with fake I/O. src/bench/suites.spec.ts validates bench/bugs/, bench/injection/ and bench/findings/ in the default suite, as every run does. It holds the counts of the first, the spread of its languages, its provenance, its licenses and its patch sizes, and, of the second, its twins equal to their cases of bench/bugs/, its spread of goals, carriers and encodings, its provenance, that none of its twins raises a flag, and that every request and every vote of its cases fits a window of 32 768 tokens. scripts/injection-corpus.spec.ts holds the generator's arithmetic on small synthetic patches, that the committed corpus is the generator's output byte for byte, and that no payload holds a URL, an e-mail address or a key-like string. src/cli/clones.spec.ts runs the real git on a repository src/testing/clones.ts builds once in a temporary directory, with a HOME of its own, no user or system git config and fixed authors and dates, and clones it over file:// into a directory of each test's own, so no spec reaches a network; the git seam's fake spawn stands in for the cases that must show that no git ran.
  • The fake claude. src/testing/fake-claude.mjs stands in for claude: it replays a captured result as its stdout and records its argv, environment, stdin, working directory and system file. Each spec reaches it through a /bin/sh wrapper in its temporary directory that runs this Node, so neither an execute bit in git nor PATH matters. Six requests spawn it: in src/providers/claude-code.spec.ts a round trip, an exit without JSON, a helper outside the group that holds the pipes while the stdout goes past 16 MiB, SIGTERM and SIGKILL, and in src/cli/main.spec.ts one review through the CLI. The first request on a command runs claude --version before its own run, which the fake answers with 2.1.311 (Claude Code), or FAKE_CLAUDE_VERSION after FAKE_CLAUDE_VERSION_DELAY_MS, and records on a line of its own, so it never overwrites the request's record. Three more tests run it for the version check alone, with a version that is too old, one that cannot be read and one that never answers (a delay far past the deadline, which the spec shortens by holding that one timer to 0.4 s). One more call in the adapter's spec fails to spawn at once, with a command that does not exist. The adapter's spec points TMPDIR at its own directory, to see every run directory go.
  • The real git. One block of src/git/real-git.spec.ts runs the real git, one test at a time, on repositories it builds in temporary directories with the user's and the system's git config off, and removes them afterwards. A hostile program there is a /bin/sh script that only appends its name to a log, and most tests first run a plain git on the same repository, to show that what the pins stop does happen without them. The block fails on a machine without git 2.41 or later, and never skips. The block of the runner's grep builds its repositories once, with src/testing/repository.ts: one with an uncommitted .gitattributes, a committed one and a submodule, one with a file name that holds a line break and the grep.column and color.grep settings, and a sha256 one, a plain git beside it where a pin needs showing. Every other test reaches git through the fake spawn of src/testing/git.ts, which answers each call from a function and records it.
  • bun run live:claude-code is not part of the suite: no test and no CI job runs it. You run it by hand, with Claude Code installed and logged in, and it makes four real calls on haiku, each capped at $0.05, from a directory that holds a planted CLAUDE.md and a canary file: structured output, the prompt mode, a message that names the canary file as @<its path>, and the error of an unknown model. It passed against Claude Code 2.1.311 at under a tenth of a cent: Stopping, nesting and the version.
  • bun run live:github-markdown is not part of the suite either: no test and no CI job runs it. You run it by hand, and it sends the hostile corpus of src/testing/github-corpus.ts, which holds no secret, to GitHub's public Markdown API, one request per document, one at a time. A GITHUB_TOKEN is optional and raises the rate limit, and no line prints it. It writes src/testing/fixtures/github-markdown.json only when every check of the HTML passes. scripts/github-markdown.spec.ts stubs fetch and holds the request, the checks and that importing the script makes none: Checked against GitHub's renderer.
  • scripts/contracts.spec.ts fails when a file of schema/ differs from what bun run schema writes from the code, byte for byte, or when schema/ holds a file the table of scripts/contracts.ts does not list: run bun run schema after changing a schema, and commit the files. It also compiles every schema file of the table with Ajv, the one development dependency that reads a JSON Schema, and holds them to what the code writes and forged documents: the result's and the view's to the results the testing helpers write and to a text that holds each input of the inert-text vectors, refusing an unknown key at the top, in meta and in a verdict, a value outside a closed list, and a result read as a view and a view as a result; the progress line's to every line of the recorded reviews, of one sample of each event type and of each level of the CLI's own lines, as --progress json writes them; and the panel suite's to bench/findings/suite.yaml, refusing a case with an unknown key or no finding. It holds every file of the table to ASCII, since each is written with every character above U+007E escaped, and the vectors' file to every input it gives back through JSON.parse.
  • bun run build writes the npm package into dist/, which is not committed: the JavaScript of src/, its relative imports rewritten to .js, and the declarations, with no spec and nothing of src/testing/, as tsconfig.build.json says. No test builds it: src/package.spec.ts reads package.json, that file, release-please-config.json and the first line of src/cli/bin.ts, for what the package names, ships and runs on, and for the .env and bunfig.toml flags of bun run compile. The typecheck job of ci.yml runs the build after the typecheck, on every pull request: the build sets a rootDir, emits declarations and rewrites the import extensions, which tsc --noEmit does not, so a change can pass the typecheck and fail the build, and the release's own run is not the first to build the package.
  • bun run compile:release compiles the binaries of a release, quorum-linux-x64, quorum-linux-arm64, quorum-darwin-x64 and quorum-darwin-arm64, and copies the contract files beside them, with a SHA256SUMS file of all of them, to bin/release/, which is not committed. scripts/build-binaries.ts empties bin/release/ first, runs bun build --compile once per target with the flags of bun run compile, so no binary reads a .env or a bunfig.toml from the directory it runs in, copies each contract file as committed, and writes the checksums only when all four builds succeeded and every file is there. It builds only when it is run directly, and no test compiles a binary: scripts/build-binaries.spec.ts checks the arguments of the four builds, the checksum line against a known digest, that every contract file is copied flat in the table's order and attested by cd.yml after the binaries, and that importing the script starts no build, with node:child_process mocked.
  • src/cd.spec.ts reads .github/workflows/cd.yml as data, with no network: that the workflow grants nothing at its top level and each job exactly the permissions it uses, that release-guard holds pull-requests: read alone, waits for build-binaries and compares merge commits with the run's, that release waits for it and attaches the artifact build-binaries uploads, that release-check holds no permission and compares the commit release-please tagged with the run's, failing on an empty one, that attest-binaries attests the four binaries and the contract files, and not SHA256SUMS, that the attestations, the package and the image are made only when a release is created and wait for release-check, that npm passes no token, and that every uses: is a catalog workflow at @v0 or an action pinned by a commit SHA. Nothing in the suite runs the workflow, publishes or reaches a registry.
  • docker build -t quorum:local . builds the image from the Dockerfile: a build stage on Bun's image installs the production dependencies from the frozen lockfile with no lifecycle script and runs bun run compile, and a final stage on a distroless cc base holds that one binary, run as nonroot. Both base images are ARG defaults pinned by tag and digest, which Renovate updates. No test builds an image: src/dockerfile.spec.ts reads the Dockerfile and the .dockerignore for the pins, the Bun version of mise.toml, the install and compile steps, the user, the entrypoint and what stays out of the build context.
  • bun run lint applies @antfu/eslint-config and the dependency rule. From an editor's terminal, run it as CI=1 bun run lint: the config turns some rules off when it detects an editor.
  • src/docs.spec.ts holds these pages to their links: every relative link resolves to a file and every anchor to a heading of it, every page outside the start page and the reference section ends with a ## Next that names one page, the table of contents in the README's ## Documentation section lists every page, and neither the README nor any page holds a hidden character.

When you commit, the Git hooks that bun install sets up run lint-staged, which runs eslint on the staged files, and commitlint on the message, which must follow Conventional Commits.

  • Library API — what src/index.ts exports, and how a review runs from a program.
  • Threat model — the controls these modules implement.
  • Prompts — what prompts.ts builds for every call.

Released under the MIT License.