Skip to content

Latest commit

 

History

History
381 lines (274 loc) · 160 KB

map.md

File metadata and controls

381 lines (274 loc) · 160 KB

The system map

system-map.json at the repository's root describes the system in plain words: its parts and the files each owns, the outside actors it talks to, the links between them, the files that belong to no part on purpose, and the laws that must stay true. system-map check holds the file to the repository, and npm run check, and so CI, runs it. The command and the library are the system-map/ crate (studio-system-map); it assumes nothing about plotkeeper.

The file

JSON, one object. A field the checker does not know fails the check.

  • version: 2. Any other value fails the check, and touched too, with a problem that names the value and says this checker reads version 2. A version 1 map fails the check with a problem saying to move it (below).
  • extractors: optional, the names of the extractors to run (below). A map that names none gets no computed edges.
  • parts: each has id, name, caption (a few words), purpose (the part's job, in one or two sentences), holds (below), tier (core, interface or black-box: the part's default; Daniel's own choice is outside the repository), paths (the ownership patterns) and an optional zone.
  • actors: each has id and name. An outside actor owns no files.
  • links: each has id, from and to, a part or an actor at each end, a kind and, for every kind but import, a reason (below).
  • ignored: path patterns that belong to no part on purpose.
  • laws: each has id, on (the id of a part, a link or a flow), backing (check or trust) and text, one plain sentence.
  • flows: optional. Each has id, name and hops, each hop a link id and one plain sentence text. A hop may run its link backwards; the sentence says which way. Readers that need a hop's direction (a PR brief's order key, a flow's micro-world) read it from the part the flow is at: a hop leaving through its link's to end runs backwards, and the first hop runs backwards when the second leaves from its link's from end and not its to (pr_brief::hop_ends).

A part's holds is a list, which may be empty, of the named things it holds, each { "name", "text", "paths" }: a name unique within the part, one sentence of text, and optional paths, the item's key files, in the parts' pattern syntax. Each of an item's paths must match a file its part owns. "One or two sentences" and "one sentence" are guidance; the check counts characters (spec #473):

  • purpose at most 240 characters, a held item's text at most 140, and at most eight held items per part;
  • an empty or blank purpose, held name or held text fails.

A failure names the part, the length and the cap, and says where the detail goes, for example part "server": purpose is 3,986 characters, the cap is 240; keep the job here, move the detail into a held item or the area's doc under docs/studio/behaviour/, or split the part.

Version 1 maps. A map with "version": 1 is version 1, whatever its fields. One conversion in the crate, system_map::convert, takes a map's JSON text and returns version 2 JSON: each part's description becomes its purpose, untruncated (a part with no description keeps the purpose it has), and its holds is empty; nothing else changes (a link without kind keeps none). A map of another version comes back as it was. The lenient reader (parse_lenient) converts first; the strict check still requires version 2. The server converts where it reads a map, a ref's (server/src/map.rs) and a commit's (server/src/history.rs), and stores and sends the converted text, so the page, ratify, staleness and the prompts see only version 2; fog converts both sides of each commit it walks, so an edited description in a version 1 project still fogs. One renderer, system_map::part_text, gives a part's purpose and held items as prompt text, for pre-flight, back a law (its draft and its run), micro-worlds and the part catch-up. A build from before version 2, 0.1.1 included, shows a version 2 map as unreadable.

A link's kind says what joins its ends (spec #473):

  • import: a code dependency, which the extractors can prove. It runs from the dependent part to the part it depends on, as a computed edge does, and the check holds its direction. It takes no reason and never ends at an actor, since an actor owns no code.
  • http, spawn and file: run-time links no extractor can see: a request over HTTP, a process one end starts, or a file one end writes and the other reads. file also covers a file embedded at build time, such as include_str! of the plugins' hook files in server/src/install.rs. These keep the reader's arrow, following the data, and their direction is not checked. Each needs a reason, one sentence of at most 140 characters on what crosses it; a blank or longer one fails.

One pair of ends may have an import link and run-time links both: the server imports the hook crate (server-hook, import), and the hook writes the event log the server follows (hook-server, file).

Ids are lowercase words joined by hyphens, unique across parts, actors, links, laws and flows. An id never changes when a name does. The checker only reads the file; edit it with ordinary tools.

Who owns a file

"The files" are what git tracks; an untracked or gitignored file is never counted. A pattern is relative to the repository's root: one ending in / owns everything under that folder, * matches within one path segment, ** matches across segments, and anything else names one file. Among parts the last pattern that matches a file wins, in the file's order. A file an ignored pattern matches belongs to no part, whatever the parts say.

Laws and tags

A law with backing: "check" has a test that stands behind it; one with "trust" has none. A test is tied to its law by the text @law: <id> in a comment of its own line in the test's source, such as // @law: wire-types-agree above the test. One test may carry several tags and one law may have several tests. Every tracked file is searched, ignored paths included. A tag proves a comment exists, not that the test passes.

What the check does

system-map check [--json] [--root <dir>] [--commit <rev>] prints one line per problem and exits non-zero when there is one. A pass prints one line of what it covered, so a pass with nothing checked shows: ok: 7 parts own 581 files (212 ignored); 18 links: 9 import (9 proven, 0 unproven), 5 http, 3 file, 1 spawn; 12 laws: 9 check, 3 trust, where "ignored" counts the tracked files no part owns on purpose and an import link is "proven" when a computed edge runs its way and "unproven" when an end is a part no extractor reads (below). The root is the git top level of the current folder unless given. It fails, naming the file, pattern, id or law and what to change, when:

  • the file is missing, is not JSON or does not match the shape above (an unknown field, a duplicate id, a link end, a law's on or a hop that names nothing, a tier outside the three);
  • a tracked file is owned by no part and matched by no ignored pattern;
  • a pattern of a part or of ignored matches no tracked file;
  • a part's pattern names only system-map.json;
  • a law says check and no tag names it, or says trust and a tag names it, or a tag names a law the file does not have;
  • a link has no kind, or a run-time link has no reason or one past 140 characters, or an import link has an actor at an end;
  • the link check fails (below).

The map file itself needs no owner and no ignored entry: check and touched both place system-map.json as ignored, and an ignored pattern that is exactly system-map.json never fails for matching nothing. So a new repository's map passes before and after it is first tracked.

The link check. A part is read when a named extractor reads at least one file it owns that is not one of its test files: rust-modules reads Rust files, cargo Cargo.toml files, typescript-imports script files, go-imports Go files, java-imports Java files, python-imports Python files, dart-imports Dart files, php-imports PHP files, c-includes C and C++ files and dotnet-projects project files (.csproj, .fsproj, .vbproj), so two parts inside one project stay unproven. Between two read parts:

  • an import link with no computed edge in its direction fails: a dead link, or a backwards one, whose problem says to turn it around;
  • a computed edge with no import link in its direction fails, whatever run-time links join the pair, so a run-time link never hides a new dependency. (Before spec #473 such an edge was only a note:.)

An import link with an end that is not read passes as unproven, and the pass line counts it so: a part in a language no extractor reads (Ruby, say) keeps its code dependencies as import links rather than mislabelled run-time ones. A map that names no extractor has every import link unproven. While a named extractor is unknown or cannot run (cargo metadata fails, say), an import link no computed edge proves passes as unproven too, beside that extractor's one problem, since the pairs it would read are missing. A problem names the link or the two parts and what to add or change, for example part "core" depends on part "workbench" in the code, and no import link runs from "core" to "workbench"; add { "from": "core", "to": "workbench", "kind": "import" }, even beside a run-time link.

Unsure files. An extractor that reads an import it cannot resolve with certainty, because the name could mean more than one target or is a path it cannot evaluate, reports the importing file as Unsure, with the name in doubt, a reason (such as declared twice or built from a property) and the tracked files the name could mean, its candidates. An Unsure file never fails the check. An import link from part P to part Q that no computed edge proves passes as unproven when P owns an Unsure file and Q owns one of its candidates; every other link from P is checked fully (spec #569, "Unsure", which narrows #529's rule from the whole part to the candidates' parts). The core holds the findings to the contract: one with no candidates in an extractor's own output is a problem, since it would relax nothing; one in an ignored, unowned or skipped file is dropped, as such a file's pairs are; candidates no part owns are dropped, and a finding left with none relaxes nothing and is no problem; and findings of one file, name and reason, from any extractor, are kept once with the union of their candidates. For the Unsure findings whose candidates another part owns, check prints notes on standard error, whether the check passes or fails, and the pass line counts those links as unproven. The findings are grouped by the part that owns the file and the set of parts whose links they relax, one line per group, sorted by part, then by those parts (#631: a repository with many doubled names printed thousands of notes). A group of one finding prints note: <file> is unsure of <name>; its links to <parts> pass as unproven; a larger group prints note: <n> files of <part> are unsure of <m> names (<names>); its links to <parts> pass as unproven; --json lists them, naming the first three names in sorted order and ending with … when there are more, and saying 1 file … is or 1 name when a count is one. An Unsure file whose owned candidates all sit in its own part relaxes no link and gets no note, though --json still lists it. go-imports, java-imports, php-imports, python-imports, dart-imports and dotnet-projects report them; their sections say when.

Detection. check runs only the extractors the map names. For each registered extractor it does not name that could read the repository, it prints note: <name> could read this repository; add it to extractors on standard error, so standard output keeps exactly the problems and the pass line. The note prints whether the check passes or fails, and never fails it. An extractor could read the repository when a tracked file that no ignored pattern matches is one it reads and no test file of its own; cargo could when a root Cargo.toml is on disk, even when the map ignores it, as plotkeeper's own map does, and go-imports when a tracked go.mod outside testdata/, vendor/ and folders starting with _ or . has a readable module line, ignored or not, so a repository whose only go.mod is a fixture's is never told to add it. dart-imports and php-imports keep the default rule: dart-imports needs no config file to read a Dart file's relative imports and php-imports none to read a PHP file's static requires, so a repository with a production .dart or .php file that no ignored pattern matches is told to add it. There is no mode that runs whatever is detected, since a stray examples/Cargo.toml would then make every check need Rust (spec #529, "Detection").

Notes. An extractor may also return notes, one line each, for what it did not read: check prints each as note: <line> on standard error beside the other notes, lists them as notes in its JSON when there are any, and never fails over one. Only python-imports gives any, for a layout key it cannot read or an ignored config that does not parse (its section says which).

--json prints the parts with their files, the links, the computed edges, each law with its tags (file and line), the problems, the pass line's counts (counts: parts, files, ignored, links as total, import, http, spawn, file, proven and unproven, and laws as check and trust), the names the notes suggest (suggested), and the Unsure files (unsure, each { "file", "name", "reason", "candidates" } with only owned candidates), a key left out when there are none. edges lists every edge the named extractors compute between two parts, sorted, as { "from": <part>, "to": <part>, "pairs": [...] }, each pair { "from": <file>, "to": <file>, "sites": [...] } once per file pair (the pairs that count and that the check holds), and each site { "file": <file>, "line": <n> }, where it imports (below, "Import sites"); a site with no known line has no line.

Commit mode (spec #477, "Reading a commit without checking it out"). --commit <rev> checks that commit, not the working tree, with nothing checked out: its tracked files come from git ls-tree -r, and the text of each regular file from one git cat-file --batch, so its map, its law tags and every file an extractor reads are the commit's, and an edit or an untracked file in the working tree changes nothing. A symlink or submodule is tracked but has no text, as on disk. cargo metadata needs a folder, so the commit's Cargo.toml files, Rust files and rust-toolchain file are written to a temporary folder for it, which is removed after; an untrusted commit's rust-toolchain and rust-toolchain.toml are left out, so the commit cannot choose the toolchain rustup resolves for cargo (#641). On the same tree it gives what working-tree mode gives, edges, sites and problems alike. A <rev> that names no commit is the one problem. The library's system_map::check_at(root, rev, trusted) is the same check, for plotkeeper to read a PR's head; a PR not by Daniel's own GitHub login is untrusted, and --commit on the command line is trusted.

The extractors

An extractor reads which tracked file depends on which; the checker turns each pair into an edge between the parts that own the two files and drops pairs inside one part or touching an ignored file. Each extractor is one module under system-map/src/extract/, behind one contract (spec #529), and is registered with one line in its registry.rs; the names a map may give in extractors are the registered ones. Every extractor keeps these rules:

  • Text only. It reads the repository's tracked files as text and runs no toolchain, so a check gives the same answer on any machine and in CI. The one exception is cargo metadata, which both Rust extractors run (docs/adr/0002-extractors-read-text-only.md).

  • The core's rules. The checker, not the extractor, drops a pair whose ends are not both tracked and a pair from a file to itself, and keeps a pair several extractors find once. It runs the extractors in the map's extractors order, so their problems print in that order.

  • Skipped files are its own. An extractor names the files of its language that the build leaves out, most often its test files, or ones the build never compiles. A skipped file gives no pair and never makes its part read. typescript-imports skips its test files, go-imports its test files and the files no build compiles, java-imports the files outside production source roots, python-imports its test files, dart-imports the files under its test folders or of a fixture package and the ones whose header it cannot lex, php-imports its test folders, the files only a classmap reaches and the files it cannot lex, c-includes its test folders and test-named files, and dotnet-projects its test projects (their sections say which); cargo and rust-modules skip none: they leave dev-dependencies out but read files under tests/ and #[cfg(test)] code.

  • Over-counts are stated. An edge the code may not really hold is allowed only where its section below says so, as the barrel over-counts of typescript-imports are.

  • Invisible dependencies are listed. A dependency the text shows no import for is a silent under-count, and its section lists it.

  • cargo: the workspace's crates and the workspace crates each depends on, from cargo metadata --no-deps --offline. Dev-dependencies are left out.

  • rust-modules: mod declarations and paths, each resolved through the module tree of the crate it names to the file that defines the module (the longest stretch of the path that names a module). It reads paths in use lines and inline, anywhere in the code, in a type, a field, a bound or an expression alike, with or without a leading ::; a use line's glob reaches the module it names (use studio_server::*; reaches the crate's lib.rs):

    • crate::<module>::…, from the file's own crate root;
    • a bare path whose first word is a module the file declares (or an inline module it sits in declares), such as ci_laws::CiCache in a crate root holding pub mod ci_laws;, or a name a use line brought in;
    • a path into another workspace crate, such as studio_server::runner::launch, which reaches server/src/runner.rs, not the crate's lib.rs. It is read only when the file's crate depends on that crate as a normal dependency (dev-dependencies are left out), or is that crate's own binary, test or other target. A crate is named by its library target's name in cargo metadata, not its package's (package studio-system-map, library system_map), or by the dependency's rename. When the repository has a Cargo.toml and cargo metadata fails, these paths are not read and the check prints one problem saying so; a repository without one has no workspace crates to read.

    Each pair of files counts once, however many paths join them. self:: and super:: paths are not read.

  • typescript-imports (system-map/src/extract/typescript.rs): import specifiers resolved to tracked files: a relative one (./, ../) to the file it names, a bare one to a workspace package's package.json. It takes a specifier only from import … from "x", import "x", import("x"), require("x") (import x = require("x") among them), the re-exports export { … } from "x", export * from "x" and export * as ns from "x", and export type … from "x"; a call written as a member (obj.require("x")) is not one. It skips // and /* */ comments, string literals, regular expressions and the text of template literals, but reads the code inside a template's ${}, so import-like words in prose or a string give no edge. JSX text is read as code, though: import-like text there can give an edge, and a stray backtick or /* in it can hide what follows. A specifier that resolves to no tracked file is skipped; a literal specifier, quoted or a template without ${}, is read, but a computed specifier or a path alias is not seen.

    The workspace's declared packages are the folders that match a pattern of the root package.json's workspaces (a list, or yarn's { "packages": [...] }) or of pnpm-workspace.yaml's packages (one - item per line, or one line packages: ['a/*', 'b']), less those a ! pattern matches, each holding a tracked package.json with a name. A bare specifier name or name/sub (a scoped @scope/name/sub splits after the scope) whose name is a declared package's is an edge to the part that owns that package.json, whatever the subpath. A package.json outside the patterns, a test fixture's say, and an installed package give no edge, even under a declared name. A name two declared packages share gives no edge, and the extractor reports it as one problem naming the package and its folders, since npm rejects a name declared twice. A {a,b} brace in a pattern is not expanded, so the folders it names are not declared. A package.json may start with a UTF-8 byte order mark. A repository with no workspace config resolves no bare specifier, and reports nothing for one.

    An import of a pure barrel is also an edge to the file behind it that exports what the import takes. A pure barrel is a script file whose statements are only re-exports, the imports a re-export uses (import { A } from "./a"; export { A };, export type { A } and export default A among them) and directives such as "use client", and that re-exports something; a file with code of its own, a side-effect import "x", an import no re-export uses or an export default of anything but an imported name among them, is not one and is not followed. Statements need no semicolons. A named or default import goes to the re-export that names it, an alias (export { default as X }, export { B as C }) included, and export type and import type count as the others do. A name no re-export names goes to every export * target, except default, which export * never carries, and a namespace import, import(), require() or export * of a barrel goes to every target: these two are over-counts, since the reader does not check which target really exports the name. A target that is itself a pure barrel is followed in turn, and a cycle of barrels ends. The followed edges are added and none dropped: the importer → barrel and barrel → target edges stay, so a part whose only file is a barrel keeps its edges and stays read. Following stays inside the repository and inside a package: an import of a workspace package stops at its package.json, and a relative import stops at a barrel that lies in a different declared package from the importer's. system-map imports counts the followed pairs too.

    A test file gives no pair and never makes its part read: a script file named *.test.* or *.spec.* (x.test.ts, x.spec.tsx), or one under a folder named __tests__, test or tests at any depth (ui/tests/dom.mjs, packages/a/test/x.ts). These are the defaults of Jest, Vitest, Mocha and Node's test runner, and the folder at any depth covers a workspace package's own test/ and tests/. It is an under-count: what a test, a fixture or a test helper under those folders imports gives no edge, and a part made only of test files is not read, so its import links pass as unproven. A pair into a test file still counts. The convention is by path only: a test under another name (x_test.ts, e2e/, cypress/) is read like any other file, and a production file under a test/ folder is skipped.

  • go-imports (system-map/src/extract/go/mod.rs): each import of a local Go package, paired with every package file of the folder it names. It reads every tracked go.mod and .go file as text and runs no go (docs/adr/0002-extractors-read-text-only.md).

    • The module index. Every tracked go.mod outside the excluded folders, a path element named testdata or vendor or starting with _ or ., judged from the repository root, is indexed by its module line: one line or a module ( … ) block, cut at //, its path bare, "…" or `…`. Its folder is the module's root. Every tracked go.mod, an excluded one too, is a module boundary. replace is not read, and every module is indexed whether or not anything reaches it (docs/adr/0003-go-imports-indexes-every-module.md). go.work only breaks ties (below, Resolution).
    • go.work. Every tracked go.work outside the excluded folders is read for its use directives, one line or a use ( … ) block, a path bare or quoted. Each path is joined to the go.work's folder and cleaned, so ./a, a/ and x/../a name one folder; one outside the repository, an absolute one, or a folder with no indexed go.mod declares nothing and is no problem, where Go would fail (docs/adr/0003-go-imports-indexes-every-module.md). When exactly one of the modules that declare a path is used by a go.work, and no other go.work picks a different one, it wins and the others are dropped from that path's entries; two go.work files that pick different winners leave the path declared twice.
    • The reader skips a byte order mark, // and /* */ comments, reads the package clause, then each import spec, single or grouped, plain, named (x "p"), dot or blank, quoted or backquoted, and stops at the first other token. So import-like text in a comment, a cgo preamble or an old // import "x" comment, and anything after the imports, gives no pair.
    • Resolution follows Go's rule for which module provides a package. For an import path, every indexed module whose path equals it or prefixes it at a / is an entry, one per go.mod; an entry other than the importer's own module that declares the importer's own path is dropped, so a file's own path always means its own module. An entry provides the package when its folder for the path lies in it with no tracked go.mod in between and directly holds a tracked .go file, whatever its name. With one provider whose path no other entry declares, after go.work settles a tie, the import is a pair to each package file of its folder: a tracked .go file directly in it, never in a subfolder, that is read and not skipped. With none, or when the folders hold no package file, nothing. With two providers, or one whose path another indexed module also declares, the importer is Unsure of the path, its candidates the package files, with the reason two modules provide it or declared twice. "C", relative and absolute paths, paths with a vendor element and paths with an escape, a space or a backslash are never resolved.
    • Dependent files. A pair starts only in a read, non-skipped .go file inside an indexed module, the one of its nearest tracked go.mod. A .go file under no go.mod, or whose nearest go.mod is excluded or malformed, gives no pairs and is not Unsure, since outside a module go builds no local package (go.dev/ref/mod, "Module commands outside a module"). Its part still counts as read, so an import link from a part made only of such files fails.
    • Read and skipped files. It reads a .go file with no excluded path element, its name included (testdata/, vendor/, _x/, .x/, _name.go, .name.go are never Go files to the map). It skips *_test.go, a package documentation file, and a file whose build constraint leaves it out of what go mod tidy would consider: ignore is false and every other tag is both true and false, so a file is skipped only when its constraint can never hold with ignore off (//go:build ignore && linux is skipped, //go:build linux and //go:build !ignore are not). The evaluator is Go's own eval and matchTag (cmd/go/internal/imports/build.go), read from the leading comments before the package clause as ShouldBuild reads them, after a leading byte order mark is dropped: a //go:build line there controls, with &&, ||, ! and parentheses, and one that does not parse (a double negation, !!linux or ! !linux, does not, though !(!linux) does), or two such lines, skips the file; with none, each // +build line above the header's last blank line must hold, its spaces OR and its commas AND, several lines ANDed. Go's size limits hold too: a //go:build line of more than 1000 operands does not parse, and a // +build line of more than 100 operators is passed over, as Go rejects it as too complex. A constraint after the package clause is never read.
    • Problems. A go.mod outside the excluded folders with no readable module line, more than one, or a ( block never closed is a problem naming it. A go.work outside them is a problem naming it and the line, and settles no tie, when Go's parser would reject it: a ( block never closed, a directive other than go, toolchain, godebug, use and replace, a block of a kind other than godebug, use and replace, a line that does not tokenise (an unclosed quoted string), or a use of both modules that declare one path. A repository with no go.mod outside the excluded folders gets one problem: go-imports found no go.mod outside testdata/, vendor/ and folders starting with _ or .; add one with a module line, or remove go-imports from extractors.
    • Groups. Each pair's group is the package's folder (pkg/store/, or ./ for the root), and its importer's own folder is its from group, so the imports report counts one import of a package once per part, with packages as its nodes (below, "How well the parts follow the imports").
    • Over-counts: files for every operating system, architecture and custom build tag, and cgo files; a pair to the local source where go would build another copy, a published version or the vendored copy (when the importing module's go version is 1.14 or higher and it has a vendor/ folder, go.dev/ref/mod, "Vendoring"); and a local module whose path collides with the standard library (net/http in a module named net), which Go reports as an ambiguous import.
    • Under-counts: non-Go files of a package (.c, .s, .syso) and //go:embed; imports from skipped files and folders, and imports into a testdata/, _x/ or .x/ package, which Go allows when imported by name (go mod tidy); and Unsure imports.
  • java-imports (system-map/src/extract/java/mod.rs): each import of a type the repository declares, paired with the file that declares it. It reads tracked .java files as text, needs no config file (no pom.xml, build.gradle or settings.gradle is read), and runs no javac, Maven or Gradle (docs/adr/0002-extractors-read-text-only.md). Its rules are the research note's, docs/studio/research/java-extractor.md, as spec #590 settled them.

    • The reader skips // and /* */ comments (which do not nest), string and char literals, and text blocks (""", then optional blanks and a line terminator, which \""" does not close), so import-like or class-like text in them gives no pair and no declaration. It reads the header as JLS §7.3 has it: leading annotations, an optional package line, then import declarations and stray ; until the first other token. A declaration is a class, interface, enum, @interface or record <Name> at brace depth 0, each when a name follows it, so @RunWith(Suite.class) and a field named record declare nothing. A leading byte order mark is dropped first. Lines are counted on the raw text, \r\n, \n and a lone \r each ending one.
    • Escapes and files it cannot lex. A pass before the lexer translates \uXXXX as JLS §3.3 has it: a backslash is eligible when an even number of backslashes precede it, one or more us may follow, and the four hex digits after the last u give the character, which takes part in no further escape. So \u0069mport is import, and a \u000a ends a // comment, while \\u000a is no escape. Import sites still come from the raw text, so a translated line break counts for no line. A file with a malformed escape, a comment, string, char literal or text block never closed, or a text block whose opening """ no line terminator follows, cannot be lexed and is skipped whole: no pair, no Unsure, no Problem, never making its part read, not counted by detection, its types left out of the index, and no note says so. A link that rested on it passes as unproven.
    • The source root and skipped files. A file's source root is its folder less a trailing package path, from its package line. When the folder does not end with the package path, or the file has no package line, the whole folder path is judged instead. A file is skipped when its root holds a src folder followed by a set that is not a production set (main, java, or java and digits, java24, a multi-release root; Lucene keeps its code in src/java/), so src/test, src/testFixtures, src/integrationTest, src/jmh and src/tools are skipped; or, when its root has no such src/<set> shape, when it holds a folder named test or tests (Guava's test/). So a production package named test under src/main/java is read, and error-prone's fixtures under src/test/java/.../testdata/, whose packages do not match their folders, are skipped by the whole-folder rule. Any error of the whole-folder rule skips a production file, never reads a test one. A skipped file gives no pair, is no target and never makes its part read.
    • The type index. Every top-level type of each read, non-skipped file the map does not ignore, with a package line, is registered as package.Name with the file. A file with no package line (a compact source file) is read for its imports but registers nothing, since a type in an unnamed package can never be imported. package-info.java and module-info.java are read for their imports and register nothing. A type is found by what files declare, never by path or letter case: a second type of Foo.java, a file whose folder does not match its package, a lower-case type and an upper-case package all resolve as javac would.
    • Resolution walks a dotted name from the left (JLS §6.5.4.2): the first prefix that the index knows as a package, with a top-level type named by the next segment, gives that type's file; the segments after it are member names, so a.b.Outer.Inner pairs with Outer's file. import a.b.C;, import a.b.C.D;, import static a.b.C.x; (the name less its last segment), import static a.b.C.*; and import a.b.C.*; of a type each give one pair. import a.b.*; of a package pairs with every file declaring a top-level type in it, from every source root and part. java.lang.* and the file's own package give nothing, and a name the index does not know (the JDK, a library, a Kotlin or generated type) gives nothing. Every pair keeps the line of its import as an import site.
    • Unsure. A name two or more files declare, after skips and ignored, makes the importer Unsure with name the dotted type name (a.b.C), the reason declared twice and every declaring file as a candidate, never a pair: a variant copy, a multi-release root or a fixture is never settled by a guess. A package wildcard over a package that holds a doubled name pairs with the files of the names declared once and makes the file Unsure for the doubled name's files. import module M; of a module the repository declares makes the importer Unsure with name M, the reason module import and as candidates every file under M's root that declares a type, never a pair. A module is declared by the module line of a module-info.java that is read, not skipped and not ignored, and its root is that file's folder; two declarers of one name give both roots. A module the repository does not declare (java.base) or a root with no such file gives no finding. exports, requires and requires transitive are not read, and no pairs are made between module-info.java files.
    • Groups. It sets none: every pair is its own unit and a file node in system-map imports, as Rust and TypeScript pairs are, so a package wildcard weighs once per file it pairs with.
    • ignored. A file the map ignores is left out of the type index, so a map author settles fixture projects and variant copies by ignoring them: an ignored copy of a type neither resolves an import nor makes one Unsure. Ignore fixture projects (a whole project under a test module that has its own build file) and whole variant trees such as Guava's android/ and guava-gwt/ (its GWT copies in src-super/, which gave 152 of the 160 Unsure findings of a Guava trial with android/ already ignored, #607), never one module of a variant tree: android/guava-testlib builds against android/guava, so ignoring only android/guava/ makes testlib's imports resolve to guava/, a false edge. Java follows ignored where Go's module index does not, and on purpose: Go's index leaves out the folders the go tool itself leaves out (testdata/, vendor/, _x/, .x/), a rule of the language, while Java's variant copies and fixture projects have no language rule that marks them, so only the map's author can say which they are. Neither is to be changed to match the other.
    • Over-counts: a package wildcard pairs with every file of the package, so over a package split across parts it demands a link to each part, even to one whose types the file never uses (a computed edge with no link fails), and in the imports report it weighs once per file; an unused import still makes a pair; and test or tooling code outside a src/<set> folder and under no folder named test or tests is read as production, such as Guava's guava-tests/benchmark/ and guava-gwt/test-super/ (#607), so a test part can count as read and carry pairs.
    • Under-counts: same-package use, and a split package as the case that can fail a true link; inline fully qualified names, extends a.b.C, permits, and module-info uses and provides; packages reached only through requires transitive, and files the reader cannot lex (a malformed \u escape, a comment, string, char literal or text block never closed, a text block opened with no line terminator), with the types they declare, which leave the index so an import of one gives no pair; types in unnamed packages; types outside .java files (Kotlin, Groovy, generated sources); production code in a source set not named main, java or java<N> (Android flavours such as src/free/ and build types such as src/debug/); a file with a mismatched package under a test folder or a non-production set; and Unsure imports.
  • python-imports (system-map/src/extract/python/): each import of a module of the repository, paired with the files the import runs. It reads every tracked .py file, pyproject.toml, setup.cfg and setup.py as text and runs no python (docs/adr/0002-extractors-read-text-only.md; spec #589, whose research note is docs/studio/research/python-extractor.md).

    • Roots. A top-level name resolves from a root: the repository root, each folder holding a tracked pyproject.toml, setup.cfg or setup.py, deduplicated, and each root's src/ when the repository tracks a file in it, unless the project declares a layout (below). A config under a folder named tests, test, testdata or fixtures (at any depth) is never read and makes no root, ignored or not. A config in a path the map ignores is read for roots and layouts exactly as an owned one is, and its layout notes print as usual, as cargo reads an ignored root Cargo.toml (#656: ignoring SQLAlchemy's pyproject.toml dropped where = ["lib"], and with it 20 of the 85 edges in #613's trial). So an ignored vendored project with a config is a root too, and a top-level name it shares with the repository's own code is provided by two roots. A script's own folder is not a root, though Python puts it first on sys.path: tools/a.py importing its sibling b with import b gives no pair.
    • Declared layouts. A project that declares where its packages live replaces its default src/ with the folders it names, each read from the project's folder; the project folder stays a root, where = ["lib", "src"] gives both and where = ["."] is the project folder, deduplicated. It reads, in pyproject.toml: setuptools' [tool.setuptools.packages.find] where and package-dir = {"" = "<dir>"}, Poetry's packages = [{ include, from }] (an entry with no from declares the project folder, so it too replaces src/), and Hatch's array sources = ["<dir>"] and packages = ["<dir>/<name>"] (the package's parent), under [tool.hatch.build] and any [tool.hatch.build.targets.<name>]. package-dir = {mypkg = "lib"} registers the top-level name mypkg as the folder lib/ itself, so import mypkg.sub pairs with lib/sub.py and a mypkg/ folder elsewhere makes the name provided by two roots; {alpha = "lib", beta = "lib"} makes both names the package at lib/, and a name renamed to the folder a root already gives it (mypkg = "src/mypkg", with src/ a root) is one provider, not two. setup.cfg is read by hand in the dialect of Python's configparser: keys in any case, = or :, # and ; comment lines, a line indented deeper than its key continuing the value; it reads [options] package_dir (= src and pkg = lib lines) and [options.packages.find] where (every entry, though setuptools uses the first). setup.py is code, so only the literal package_dir={"": "<dir>"} is read, as that project's root, and it is a guess. The layout note. Every other form leaves the project its default roots: Hatch's table form of sources, another shape of package_dir in setup.py, a dotted package-dir name, a path that leaves the repository, or a key of the wrong type such as where = "lib". For each, check prints note: python-imports did not read <key> in <file>; failing links into <folder> may be false on standard error (<folder> is the project's folder, . for the repository root; the JSON report lists them as notes), and never fails over it: a problem would relax every unmatched link in the repository, and a wrong-typed key in one of many projects must not do that. A duplicate key or section in [options] or [options.packages.find] of a setup.cfg gives the note too, naming the section, and no copy of that section is read, since configparser would raise; one in any other section ([flake8]) is ignored. No other extractor prints a note.
    • Read and skipped files. It reads a .py file. .pyi, .pyw and .ipynb files never make a pair. It skips test_*.py, *_test.py, conftest.py and any file with a path element named tests or test (pytest's defaults, plus the folder convention; unittest's test*.py is not used, and a configured python_files is not read). A skipped file gives no pair and never makes its part read. Detection is the contract's default, a tracked, non-ignored file it reads and does not skip, so a repository whose only .py files are tests is not told to add it.
    • The reader has its own lexer. A line ends at \n, \r\n or a lone \r, as in Python. It skips # comments and every string form (', ", ''', """, with the prefixes r u b f t, in any case and in the combinations Python allows), joins lines by a backslash or inside brackets, and reads the fields of an f-string or t-string as code with their nested strings (PEP 701), so import-like text in a string or a comment gives no pair. It keys on the import keyword, found at the start of a statement, after a ;, or after the : that ends a compound statement's header, with from or lazy before it on the same statement only: raise X from e and yield from g are never imports, and lazy = 1 is a name. It reads import a.b as c, d, from a.b import c as d, e, the parenthesised and backslash-joined forms and from a import *, at any depth, in a function, under if TYPE_CHECKING: or in a try. from __future__ import … gives nothing. It records each relative import's dots, ... counting three, and hands them to the relative rule below. Text that is not valid Python (a cookiecutter template, Python 2 code, an unterminated string) ends the statement it is in with no pair and no problem; an unterminated triple-quoted string ends the file. __import__, importlib.import_module, sys.path edits, .pth files and PYTHONPATH are not read.
    • Resolution of an absolute import follows Python's: only the first segment is looked up under the roots, and each later segment walks down from where the first was found. In one root, <name>/__init__.py beats <name>.py, which beats a .pyi stub, which beats a bare folder with no __init__.py; a stub is taken only when no .py module or package of that name exists. A first segment that no root provides, or that only the standard library does, gives no pair; one that two or more providers have is in doubt (below). The walk pairs with the __init__.py of each package it passes, then with the module's file: import a.b.c pairs with a/__init__.py, a/b/__init__.py and a/b/c.py. A walk that reaches no file, or goes below a module, gives no pair at all. from M import n pairs as import M does, and also with M.n's file when n is a submodule; * pairs with M only. It skips the __init__.py of every package whose folder holds the importer, the importer's own folder and the ones above it: that package ran before the importer, so from a.x import y inside a/ pairs with a/x.py alone.
    • Relative imports. The importing file's own package, its folder (the same for an __init__.py), is the anchor: one dot is the anchor and each further dot climbs one folder up, . and ... adding up, so from .. . import y is three dots. Pairs go only to the __init__.py files below the anchor that the import names and to the module: from .x import y pairs with x's file and with x/y's when y is a submodule, and from . import y with the anchor's own __init__.py, where y may be defined, and with y when it is a submodule (never with the importer itself). Two or more dots climb to a package that holds the importer, so from .. import y pairs with y only, never with that package's __init__.py. The __init__.py of a package holding the importer is otherwise skipped, as for an absolute import, so from .x import y and from mypkg.x import y inside mypkg/ give the same pairs.
      • The climb depends on the root the file is imported under. For each root holding the file, its depth is the number of folders between the root and the file, and a climb of k dots is legal there only at depth k or more, as CPython's _resolve_name requires. Legal under every such root: pair. Legal under some only: the importer is Unsure of the dotted name with its dots (..x), with the reason climbs past the top package under some roots and as candidates every file the import would pair with. The repository root is always a root, so a file in libs/a/pkg/m.py with from .. import z is Unsure when libs/a/ is a root as well. A package a project renames to a folder (package-dir = {mypkg = "lib"}) counts as a root of its own, with the package's name as the top folder: lib/m.py is mypkg.m, one folder deep. Legal under none, naming no file, or leaving the repository: no pair and no doubt.
    • Doubt. An Unsure import, absolute or relative, pairs with nothing: in from M import a, b, doubt over M.a leaves M, a and b all unpaired, and their files become its candidates (each module of import m, n is an import of its own). The first segment is looked up under every root and in the standard-library list, each a provider. A provider has the name when it holds a module (<name>.py, or a stub when nothing else) or a regular package (<name>/__init__.py); a bare folder with no __init__.py does not count as having it.
      • Two or more providers have it: the importer is Unsure of the import's dotted name, even when only one of them holds the final file, as the check cannot tell which one Python imports: that depends on sys.path, which no text fixes. The reason is two roots provide it, or shadows the standard library when one provider is the standard library, which a tracked logging.py or distutils/ is. The candidates are every file the import would pair to under each provider that has the name, __init__.py files included; a provider where the walk fails adds none, and an import left with no candidates is no finding.
      • The list is the union of sys.stdlib_module_names over CPython 3.10 to 3.15, written by scripts/system-map/python-stdlib.mjs from Python/stdlib_module_names.h at tags v3.10.0 to v3.15.0 into system-map/src/extract/python/stdlib.rs. It is run by hand when a Python version ships: it fetches from GitHub, so CI never runs it, and tests only the checked-in constant (distutils, which 3.12 removed, is in it; the union keeps names older versions had). Built-in and frozen names, which depend on how Python was built, are in the list, so a tracked file named like one (sys.py) makes the importer Unsure, though Python would never pick the local file. That is the cost of not knowing the build.
      • Bare folders merge. Folders with no __init__.py under several roots form one namespace package, as in PEP 420: the walk continues in all of them, and the same rule applies again at each segment below. A module or regular package beats a bare folder of its name in another root, at any segment; a bare folder never competes with the standard library (a repository's html/ gives no doubt, and no pair, as import html is the standard library's). Below merged folders, the importer is Unsure only when the final file is found more than once (from ns import c with ns/c.py under two roots is Unsure of ns.c).
      • A namespace __init__.py whose only statements extend its __path__ (__path__ = __import__("pkgutil").extend_path(__path__, __name__), pkgutil.extend_path after an import, or pkg_resources.declare_namespace(__name__), alone or in a try and except of the two) counts as a bare folder: it merges and gets no pair. Any other statement beside it makes it a regular package. This is an under-count: the file runs, but no pair names it.
    • Problems. A tracked pyproject.toml outside the excluded folders, in a path the map does not ignore, that does not parse as TOML is a problem naming it, and so is a setup.cfg with a line that is not blank or a comment before its first section header (configparser's MissingSectionHeaderError). An ignored config that does not parse is no problem: it gives note: python-imports did not read <file>, which does not parse; failing links into <folder> may be false, and its project keeps its default roots, so a deliberately broken config never switches off the whole check. "Does not parse" is all a problem means: a parsed config with a key the extractor cannot read gives the layout note instead. A repository with no config is no problem: it works from its root and its src/.
    • Groups. Each pair's group is the folder of its target file (a/b/, or ./ for the root), and its importer's own folder is its from group, so the imports report counts one unit per importing file, package folder and target part, with package folders as its nodes (below, "How well the parts follow the imports").
    • Over-counts: a pair with a/b/c.py when a/b/__init__.py defines a c that shadows it; TYPE_CHECKING imports, which can demand a link backwards along a cycle the code avoids at run time; the literal setup.py layout, which is a guess about code.
    • Under-counts: dynamic imports; sys.path edits, .pth files and pytest's pythonpath; * loading the submodules __all__ names; compiled modules whose source is .pyx or C, and Cython cimport; .pyw files, notebooks and extensionless scripts with a Python shebang; production code under a test/ folder (Django's django/test/: no pairs, the part not read, its links unproven) and test helpers; a script importing a sibling through its own folder on sys.path; the __init__.py of a pkgutil-style namespace package, which runs but gets no pair; configs under testdata/ and fixtures/; Unsure imports, which give no pair; a layout in a form the extractor does not read (the note says which).
  • dart-imports (system-map/src/extract/dart/): each import, export and part of a tracked .dart file, paired with the tracked file its URI names. It reads .dart files as text and runs no dart, flutter or pub, and reads no package_config.json (docs/adr/0002-extractors-read-text-only.md). It needs no config file: with no pubspec.yaml the relative imports still resolve and nothing is a problem.

    • The package index. Each tracked pubspec.yaml registers its name: with its folder, and package:n/p names lib/p of the folder of the package named n. The name is the value of the first line that starts at column 0 with name:, after a byte order mark if the file starts with one, bare or in matching single or double quotes, with a trailing # comment and blanks cut; no YAML library reads it. A pubspec is left out of the index when it is a fixture, or when its package has no tracked file under its lib/ that the map leaves unignored. A pubspec is a fixture when a folder strictly between its enclosing package's root (the folder of the nearest tracked pubspec above it, else the repository's root) and its own folder is named test, integration_test or test_driver, or when its enclosing package is itself a fixture: fixture status inherits down, so a member package of a fixture workspace (test/fixtures/ws/pkgs/a/pubspec.yaml) is a fixture too. The pubspec's own folder's name never counts: pkgs/test/pubspec.yaml is the package test, with or without a root pubspec above it, while test/fixtures/app/pubspec.yaml under a root pubspec is a fixture. This rule refines spec #621's, decided after its final review: the spec had one rule for the index and another for skipped files, and they disagreed on a package whose own folder is named test under a root workspace pubspec. The index reads no pubspec.lock, pubspec_overrides.yaml, dependency, workspace: or resolution: entry. Every tracked pubspec.yaml is a package boundary: a file's own package is set by its nearest tracked pubspec, whether that one is indexed or not, and when it is not (nameless or an ignored package) the file has no own package and never takes an outer one as its own. A file whose own package is a fixture is skipped, below.
    • Ignored packages. The index follows ignored, by a package's lib/ files: a package drops out only when the map ignores every tracked file of its lib/, never because its pubspec.yaml alone is ignored (plotkeeper's own map ignores its root Cargo.toml and package.json; ignoring a config file never drops a package, or every link resting on its package: imports would fail). Go's module index does not follow ignored (docs/adr/0003-go-imports-indexes-every-module.md): its doubled paths are settled by go.work, a language rule, while Dart's doubled names are mostly example apps that copy a package, which no language rule marks. The difference is deliberate; neither is to be changed to match the other. To settle a doubled name, ignore the example app that copies the package.
    • Problems. A tracked pubspec.yaml with no readable name: is a problem naming the file, and its folder declares no package; it is no problem for a fixture or when the map ignores it, as its file or its package's lib/.
    • The reader reads only the header, as the Dart SDK's tokenizeDirectives does. It skips a byte order mark and a #! line at the start; then, repeated, whitespace, comments, metadata and directives, until the first token that starts none of them, so an import after the first declaration, or inside a string, gives no pair.
      • Comments: // to the end of the line, and /* */, which nests. /// and /** */ are ordinary comments, so /// @docImport 'x.dart'; gives nothing.
      • Metadata: @, a dotted name, optional type arguments with an optional .constructor after them (@C<T>.named(…)), and an optional balanced ( … ). Strings inside it are lexed in full: quotes, triple quotes, raw strings, and ${…} with nested strings, braces and comments, so a string in an annotation never ends the header early or hides a directive.
      • Directives: library; import and export with their if (…) configurations, deferred, as, show and hide; part; part of. Reading goes on after part of.
      • A URI is one or more adjacent string literals, raw or not, joined ('a/' 'b.dart' names a/b.dart). A URI holding a $ interpolation in a non-raw literal gives no pair, as it is a compile error. An import or export followed by a name, an unquoted import that has not shipped, gives no pair: the reader skips to its ; and goes on.
    • Resolution. A relative URI is joined to the importing file's folder, with . and .. removed; a path that climbs above the repository's root gives no pair, and percent-escapes are not decoded. import and export pair with every URI they name, the first and each if (…) one. part pairs the library to the part with the part marked a declaration: the check needs the library-to-part link, and imports leaves the pair out of its counts, as it does a crate root's mod. part of gives no pair. dart:, dart-ext:, other schemes and absolute paths give no pair, and an empty URI names the file itself, so it gives none. An import of an untracked file, a generated .g.dart no one committed, gives none either.
      • package:n/p: p has its . and .. segments removed as in a relative URI, and one that climbs above lib/ gives no pair. When n is the importing file's own package, the target is lib/p of its folder. Otherwise no indexed pubspec declaring n (flutter, a third-party package) gives no pair; one gives the pair to lib/p of its folder; two or more make the importer Unsure, below. A package: import from inside lib/ and a relative import from outside it that name the same file give the same pair.
    • Unsure. When two or more indexed pubspecs declare n and neither is the importer's own package, the importer is Unsure of package:n, with the reason declared twice and as candidates each declarer's tracked lib/p; none tracked gives no finding. There is no tie-break beyond the own package, such as the nearest declarer or a path: dependency: a wrong guess would prove a false edge unseen. The Unsure file relaxes only its part's link to the parts owning a candidate, with the note and unsure in --json above; its other links are checked fully. Ignoring one declarer's package settles the doubt.
    • Pairs. dart-imports sets no group: each pair is its own unit, and each file a node in the imports report, as for Rust and TypeScript. A pair keeps the line of its directive's keyword as its import site; a line ends at \n, \r\n or a lone \r, as in Dart.
    • Skipped files. A file's own package is its nearest tracked pubspec.yaml at or above it. A file is skipped when that pubspec is a fixture (above), so every file of test/fixtures/app/ is; otherwise, when a folder named test, integration_test or test_driver sits in its path at any depth below its package's root, the folder of that pubspec or else the repository's root. So pkgs/test/lib/test.dart is read under its own pkgs/test/pubspec.yaml, where package:test lives. A file is skipped too when its header cannot be lexed (a comment, string or bracket never closed before the header ends) or the file cannot be read. The path is checked first. A skipped file gives no pair and never makes its part read. A name ending in _test.dart alone never skips a file: bloc_test.dart is a published library. example/, benchmark/ and tool/ are read unless the map ignores them, and so are generated files (*.g.dart, *.freezed.dart).
    • Over-counts: every URI of a conditional import or export, whichever platform it serves; a package: import of a local package that the importer's build takes from pub.dev (no workspace, path: dependency or override), paired with the local copy; and unused imports.
    • Under-counts: a part file's own use of its library's imports, which counts on the library file; imports of files the repository does not track; percent-escaped URIs, and URIs with a backslash escape ('b\x2Edart'), which are not decoded; unquoted imports and enhanced parts' own imports, until they ship; a production library under a folder named test inside its package; package: names no indexed pubspec declares (flutter, third-party packages, a package the map ignores) and a doubled name, which is Unsure; and a file whose header cannot be lexed. A link that rests only on such a file passes as unproven when that file is the only one its part reads, and fails as a dead link when the part has another read file, since the part is then read and no pair proves the link.
  • php-imports (system-map/src/extract/php/): each class use resolved through Composer's autoload rules, and each require or include whose path is static, paired with the file it names. It reads tracked .php files as text and runs no php or composer (docs/adr/0002-extractors-read-text-only.md; spec #647, whose research note is docs/studio/research/php-extractor.md). It needs no config file: with no composer.json it falls back cleanly and is no problem. A composer.json is read for its class paths, never vendor/composer/, composer.lock, require or replace.

    • The reader finds the PHP code in a file. Text outside <?php (followed by whitespace or the end of the file) and <?=, in any case, is HTML; a bare <? stays HTML, as PHP's shipped ini files set it. ?> leaves PHP mode, also from inside a // or # comment, which ends at the end of the line (a \n or a \r) or at ?>; a /* */ comment and a string do not end at it. #[ opens an attribute, read as code, and any other # is a comment. Single-quoted strings take only \\ and \'; double-quoted strings, backticks and heredocs read the code a {$ or ${ nests, with its own strings and braces. Nowdoc and heredoc close at a line of optional spaces or tabs and the label with no label character after it (PHP 7.3). __halt_compiler ends the code. A name is one token (Foo\Bar, \Foo, namespace\Foo) and keywords match in any case. Brace depth carries across HTML runs, so a class body split by inline HTML keeps its depth.
    • Statements. It reads namespace in both forms, several to a file, and top-level use (not followed by () in its full grammar: comma lists, as, a leading \, group and mixed group use, a trailing comma; use function and use const items give nothing. A class use item has the line of its name. A require, require_once, include or include_once is read anywhere in the code, inside a function or a condition too, unless it follows ->, ?-> or ::, so $this->include('x') is a method call.
    • The autoload index is built once per run, from the tracked texts (so --commit reads the commit's composer.json files). It holds every tracked composer.json that has no folder named tests or test (any case) or vendor in its path; one the map ignores is still read, so ignoring a config file never drops a package. From autoload and autoload-dev alike it reads psr-4 and classmap; psr-0, files and exclude-from-classmap are not read. A psr-4 value is a folder or a list of folders, a prefix's leading \ is stripped and "" is the fallback prefix; each folder, and each classmap path, is joined to the composer.json's folder and cleaned, and one that climbs out of the repository or is absolute names nothing. A key of another type elsewhere gives nothing.
    • Problems. A read composer.json is a problem naming it, and adds nothing to the index, when it is not valid JSON, when a non-empty psr-4 prefix does not end in \ (Composer refuses it), or when a psr-4 value is neither a string nor a list of strings. One under a test or vendor folder is never read, so it is never a problem.
    • Class resolution. A class use item names a class by its fully qualified name (an alias changes nothing, and the current namespace is not prepended). For each composer.json, Composer's walk: each prefix of the name that its table holds, from the longest down, each of that prefix's folders in order, then the "" folders; the first tracked <folder>/<rest of the name with \ as />.php is that file's answer, matched with exact case (as on Linux, so use Up\Rector; never pairs with rector.php). A prefix whose folders lack the file falls through to a shorter one. If that first hit is a file the map ignores, the composer.json gives no answer, so ignoring a copy settles a doubled class. Across the composer.json files: no answer gives no pair and no finding (an external or built-in class, a namespace import, a class only a classmap or a custom loader finds); one distinct answer is a pair; two or more make the importer Unsure, with the class name as the name, the reason two composer files map it and the answers as candidates. use function and use const items, a trait use in a class body and a closure's use (…) give nothing.
    • Requires pair only when the path is static: one base, then one or more string literals joined by ., with optional parentheses. The base is __DIR__, dirname(__FILE__), dirname(__DIR__[, n]), dirname(__FILE__, n) with n an integer literal of one or more, or nested dirname of these, each also as \dirname, with realpath() around any of them. A literal is single-quoted, or double-quoted with no $ and no backslash. The joined text is cleaned (. and ..) and the file it names is the target; a path out of the repository gives nothing. ./x.php and ../x.php (relative to the working directory), a bare x.php (tried against include_path first), an absolute path and one built from a constant or a variable (ABSPATH . 'x.php') give nothing. A literal with no leading / joins the folder's last name, as PHP does.
    • Read and skipped files. It reads .php files, not .blade.php or .phpt. It skips a file with a folder named tests or test, in any case and at any depth, in its path (Symfony keeps its tests in src/**/Tests/), checked first, and a file the reader cannot lex. A file ending in Test.php outside those folders is production (Laravel's CreatesMatchingTest.php). A skipped file gives no pair and never makes its part read. types/, stubs, fixture folders outside test folders and tracked tool vendor/ trees are read like any file; the map's ignored leaves them out. It also skips a file under a classmap path (a folder, or the file) of a read composer.json and under no PSR-4 folder of any read one: only a classmap loads it, and that needs the classes its files declare, which it does not index, so a classmap-only part's links pass as unproven instead of failing as dead. A file under both is read.
    • Files it cannot lex. A string, heredoc, nowdoc or /* */ comment never closed makes the file skipped: no pair, no Unsure, no problem, and its part is not read for it. A link that rested only on it passes as unproven when it was its part's only read file, and fails as dead when the part has another read file.
    • Groups. It sets none: every pair is its own unit and a file node in system-map imports, as Rust, TypeScript and Java pairs are. It makes no declaration pairs.
    • Over-counts: a use that only a docblock or nothing in the code uses; a PSR-4 file that does not declare the class (Composer would load it too); a composer.json read though no build installs its package (a nested package the root never requires); a require that never runs, in dead code or a branch no build takes.
    • Under-counts: a class in the same namespace, which needs no use; class names written inline (fully qualified, relative to the namespace, through an imported namespace) and dynamic names; use function and use const, and helper functions called with no import; classes reached only through classmap (their files are skipped), psr-0 or a custom autoloader; requires built from constants or variables (WordPress's ABSPATH . WPINC), and ./, ../ and bare paths; .phpt files and Blade's @use in .blade.php templates, which are not PHP until compiled; a bare <? read as HTML where a server enables short tags; files the reader cannot lex, with when a link resting on one passes and when it fails (above); production code under a folder named test or tests.
  • dotnet-projects (system-map/src/extract/dotnet.rs): each ProjectReference of a project file, paired with the tracked file its path names. It reads every tracked .csproj, .fsproj and .vbproj file (the extension in any case) as XML text and runs no dotnet, MSBuild or NuGet (docs/adr/0002-extractors-read-text-only.md); it needs no config file and no solution file. It reads at project level, as cargo reads crates: a part is read only when it owns a project file, so two parts inside one project stay unproven, and a part of .cs, .fs or .vb files with no project file is not read.

    • The reader is quick-xml. It strips a UTF-8 byte order mark and matches local names, so a legacy project in the 2003 MSBuild namespace and one with no namespace read alike; only the root must be the unprefixed Project, since MSBuild rejects a prefixed root (m:Project). Project, ItemGroup, Choose, When, Otherwise and Target are matched exactly and the item element ProjectReference in any case, as MSBuild does; the attribute Include is matched exactly. A mis-cased itemgroup or include= is a load error in MSBuild and is left unread here, silently.
    • Which items. A ProjectReference with an Include, in an ItemGroup that is a child of Project or of a When or Otherwise of a Choose at any depth, whatever Condition any of them carries. An Update or Remove item, anything inside a Target, a PackageReference, and a reference in an XML comment or CDATA give nothing. No metadata is read: ReferenceOutputAssembly, OutputItemType and Private change nothing.
    • The path, in MSBuild's order: the Include is split on ; while still escaped, each piece trimmed and empty ones dropped; a leading $(MSBuildThisFileDirectory), or $(MSBuildProjectDirectory) followed by a \ or /, is taken off with every \ and / after it, since both name the project file's own folder and MSBuild reads a/ joined to \..\b as a//../b (property names in any case; $(MSBuildProjectDirectory)Core.csproj, glued, is not taken off); %XX escapes are decoded; an absolute path (a leading / or \, or a drive letter and :) gives nothing; every \ becomes /, the path is joined to the project file's folder and ., .. and repeated separators are collapsed; the result is matched to a tracked file exactly, case included. A path that climbs out of the repository, names no tracked file or names the project file itself gives nothing. Any tracked file pairs, an .esproj or .vcxproj among them, but its part is not read, so its link stays unproven.
    • Unsure. A piece still holding $(, @(, * or ? after the two folder properties are taken off gives no pair and makes the project file Unsure, with the piece as written (trimmed, the folder property kept) as name and as reason the first that applies of built from a property, built from an item list and holds a wildcard. Its candidates are every other tracked, non-ignored file whose name ends in proj (an .esproj or .vcxproj too) and whose path ends, as text, with the piece's literal tail: the text after its last ), * or ?, %XX decoded, \ read as /, collapsed as above, with its leading .. segments dropped. Matching as text, not by segment, keeps every property path in doubt: $(Prefix)Core.csproj matches src/MyCore.csproj, and a piece with an empty tail ($(CoreProject)) matches every other project file, which relaxes more links and never fails one. A tail that matches no file gives no finding. The relaxation, the note and --json are the core's, above.
    • Skipped files. A project file is skipped, so it gives no pair and never makes its part read, unless it holds <IsTestProject>false</IsTestProject>, which wins over every rule below (a reference into a skipped project still pairs), and when any of these holds: its path has a folder named test or tests in any case, or a folder ending with .Tests, .UnitTests, .IntegrationTests or .PerformanceTests, at any depth; its name without the extension ends with one of those four suffixes, case-sensitively (Foo.Test.csproj is read); it holds <IsTestProject>true</IsTestProject>; a PackageReference with an Include (not Update) has Microsoft.NET.Test.Sdk among its ; pieces, in any case; or it uses the MSTest.Sdk SDK, by its Project element's Sdk attribute (a ; list, each with an optional /version), an <Sdk Name> or an <Import Sdk>. IsTestProject counts in any PropertyGroup under Project or a Choose branch, conditioned or not, never in a Target; its name, and its value (its text, references and CDATA decoded) once trimmed, are matched in any case. The file is parsed first: one that is not a project is never skipped, so a broken project under tests/ still gives its Problem. Only the project file is read, so a marker set in a Directory.Build.props is reached only through the folder and name rules.
    • Problems. A project file the map does not ignore that is not a project gives one problem naming it and why, and no pair: XML that is ill-formed (a mismatched or missing end tag, an unclosed comment or CDATA, an attribute error), a file with no root element, a root other than Project (a prefixed m:Project too), a second root, an element never closed, an unknown entity, or text other than whitespace outside the root (a file that is not UTF-8 reads as such). An ignored project file is not read, so a broken template or fixture is settled by ignoring it. Entities in an Include (&amp;) are decoded before the path is read.
    • Sites. The site of a pair is the line of its ProjectReference's <, the first line of a start tag spread over several lines. It has no group: each pair of project files is its own unit in the imports report.
    • Over-counts: a reference under any condition or Choose branch, paired for every build; a ReferenceOutputAssembly="false" reference, a build-order or analyzer dependency the code does not compile against; a literal reference that an evaluation-time Remove or an Exclude takes away again; the references of a test project that no rule names, such as one marked only in a Directory.Build.props.
    • Under-counts: transitive use (A's code using C through B with no reference from A to C); every reference of a skipped project, which the rules also take from a production project that sits under a test folder, carries a test name or holds a test marker, unless it says <IsTestProject>false</IsTestProject>; references written in Directory.Build.props, Directory.Build.targets or another imported file, which are not read; shared projects (.projitems); legacy <Reference> with a HintPath into another project's build output; linked sources (<Compile Include="..\Other\X.cs">), which compile another project's file with no reference; a wrongly cased reference, which builds on Windows and macOS but names no tracked file; and a mis-cased itemgroup or include=.
    • Unsure: a path built from a property other than the two read, from an item list, or holding a wildcard.
  • c-includes (system-map/src/extract/c/): each #include of a C or C++ file, paired with the tracked file it names (spec #806, whose research note is docs/studio/research/c-cpp-extractor.md and decision record docs/adr/0004-c-includes-an-ignored-copy-keeps-an-include-unsure.md). It reads tracked files as text, needs no config file (no CMakeLists.txt, Makefile or compile_commands.json is read) and runs no compiler (docs/adr/0002-extractors-read-text-only.md).

    • What it reads. A tracked file whose extension, in any case, is one of .c .h .cc .cpp .cxx .c++ .hpp .hh .hxx .h++ .inl .ipp .tcc, the thirteen the research scanned. .m, .mm, .cu, .inc, .def and .rc are not read. In commit mode it reads the commit's texts.
    • The lexer walks each file once. It skips // and /* */ comments (an unclosed block comment hides the rest of the file), string and character literals, and C++ raw strings (R"delim(...)delim"), so an include in them gives nothing. A ' inside a number (1'000, 0xFF'FF) is a digit separator and opens no character literal. A block comment counts as one space, so code after it is at a line's start only when the comment began at one. A backslash at a line's end joins it to the next line. A directive is a line whose first non-space character is #, then optional spaces or tabs, then include, then "path" or <path>; its site is the line of the #. #include followed by anything else (a macro name), #include_next, #import and __has_include give nothing. Conditional blocks are not evaluated: includes in every branch are read, #if 0 included.
    • Paths. A path is used as written, case-sensitively, less its . segments. An empty path, an absolute one (starting with /) or one holding a backslash gives nothing.
    • Skipped files. A file with a folder named, in any case, test, tests, testing, unittest or fuzz, or named *_test.*, *_tests.* or test_*.*, is skipped: it gives no pair, never makes its part read and is never an include's target. bench/ and names such as testutil.cc are not skipped. The scan's own test rule is another one.
    • Resolution, per include. Each include goes through these steps in order, the first that settles it wins:
      1. Next to the file. A quoted include whose path, joined to the including file's folder and cleaned (.. climbs), names a tracked file pairs with it, as the compiler's first search step finds it; an ignored or skipped file there gives no pair, and the search stops either way, as the compiler stops, with no fall-through to a match elsewhere.
      2. System names. An angle-bracket include whose path is on the system-header list gives nothing. The list (system-map/src/extract/c/system_headers.rs) is the C and C++ standard headers, the POSIX headers, any path under sys/, linux/, mach/, machine/, bits/, netinet/, arpa/ or net/, common platform headers (byteswap.h, cpuid.h, intrin.h and the like) and common Windows CRT and SDK headers; it never applies to a quoted include. Without it, bitcoin's <cpuid.h> would match src/compat/cpuid.h.
      3. Path-ending match. A path with a .. segment that did not resolve in step 1 gives nothing. Otherwise the candidates are the tracked files whose path equals the include's path or ends with / and the path, less skipped files; ignored files stay candidates. None, or only ignored ones: no pair. One live one: a pair. Some but not all ignored: Unsure. Two or more, none ignored: step 4.
      4. The folder tie-break. A candidate's implied folder is its path less / and the include's path (. when equal). A folder's evidence is the number of include directives, across all read files that are neither skipped nor ignored, that reached step 3 and had exactly one candidate (ignored or not) whose implied folder it is. When exactly one candidate's folder has evidence of 5 or more, that candidate is the pair; otherwise the include is Unsure. The evidence is counted over the whole repository before any tie is settled, so file order changes nothing.
    • Unsure. An include is Unsure for one of two reasons, an ignored copy matches it (step 3) or several files match it (step 4, with no tie-break beyond the evidence rule). The finding lists every candidate; the including file relaxes only its links to the candidates' parts, and --json lists it under unsure.
    • ignored. An ignored copy stays a candidate and keeps an include Unsure, even when the tie-break would pick a live file: redis's <sds.h> means deps/hiredis/sds.h while src/sds.h is also tracked, so dropping the ignored copy would draw a wrong line. This differs from java-imports on purpose, which leaves an ignored file out of its type index (ADR 0004). Includes inside an ignored file are never resolved.
    • Under-counts: includes reached through a build's -I folder that the path-ending match can't settle; macro includes, #include_next, #import; generated headers (curl_config.h, bitcoin-build-config.h); headers outside the repository; includes from skipped test files, and non-test code's includes of test helpers (bitcoin's src/bench/); .. paths that don't resolve next to the file; ties whose folders have fewer than 5 matches of evidence.
    • Over-counts: every #if branch, #if 0 included; an angle-bracket include of an outside library's header whose name isn't on the system list matches whenever exactly one tracked file anywhere has that path ending, the common case a wrapper named after the library it wraps (curl's lib/vtls/rustls.h for <rustls.h>); platform-only includes such as curl's VMS curlmsg_vms.h.
    • The trial set. The research ran it on curl, leveldb, bitcoin and redis (docs/studio/research/c-cpp-extractor.md, rounds 1 to 4). It sets no group: each include names one file.

Import sites (spec #477, "What an import site is"). Each file pair keeps the lines of the importing file that make it, each line once, and the core joins the lines when several extractors, or one twice, find the pair. A site is always in the importing file:

  • rust-modules: a use line is one site at its use, however many names its group brings in and however many lines it spans; an inline path is a site at its first word, once per line however many times the line writes it; a mod line is a site at its mod.
  • typescript-imports: an import, a re-export, an import() or a require() is a site at its first word (import, export, require), however many lines its braces span. A pair followed through a barrel has its site in the importing file, at the import of the barrel, not in the barrel.
  • go-imports: an import spec is a site at the line where it starts, its name or its path, in a group too.
  • java-imports: an import declaration is a site at the line of its import keyword, a wildcard's too, for each file it pairs with.
  • python-imports: an import statement is a site at the line where it starts, its from, lazy or import, however many names or lines it spans; import a, b is one site for each pair it makes.
  • dart-imports: an import, export or part directive is a site at the line of its keyword, however many lines its URIs, if (…) configurations and clauses span; each URI of a conditional directive makes its own pair with that one site.
  • php-imports: a class use item is a site at the line of its name, so a group use over several lines gives each item its own line; a require or include is a site at the line of its keyword, however many lines its path spans.
  • c-includes: an #include directive is a site at the line of its #, however many lines a backslash continuation spans.
  • dotnet-projects: a ProjectReference is a site at the line of its <, the first line of a start tag over several lines.
  • cargo: cargo metadata gives no lines, so the site is the importing crate's Cargo.toml at the line of the dependency's key (its rename, when it has one), found by a text search: a line key = … or key.… = …, bare or quoted, in a table of normal or build dependencies (a target's too, never dev-dependencies or a root manifest's [workspace.dependencies]), or a header [dependencies.key]. When no line matches, as for a top-level inline table dependencies = { … }, the site has no line.

The checker runs only git and, when the map names cargo or rust-modules, cargo; it reads no file outside the repository (in commit mode, none but the temporary folder it wrote), so it never reads through a tracked symlink (the link still counts as a tracked file for ownership), and needs no network.

Which parts a change touches

system-map touched [--json] [--root <dir>] [path...] names the parts that own the paths, with the ignored paths and the unowned ones listed apart. It takes paths as arguments or one per line on standard input, so git diff --name-only | system-map touched works. It matches by pattern alone, so a deleted or moved path is still placed. A map that fails the shape check, or names an id or reference wrongly, gets no answer: it fails with those problems, one per line on standard error, and exit status 2. A part's purpose and held items, their caps among them, are check's alone, so a map over a cap still answers.

How well the parts follow the imports

system-map imports [--json] [--root <dir>] tests a cut of the code into parts. It reads the map and runs the extractors it names, and counts the file pairs they find (each pair once) whose two files a part owns. A crate root's mod and pub mod lines and a Dart library's part lines are left out of the counts, since they declare the module tree or the library's own files rather than use them; the same pair still counts when the root also writes a path into that module, or the library also imports the part. A map that names cargo counts its manifest pairs too. It prints:

  • one line of totals: the imports between owned files, how many are inside parts and how many across, and the across share raw and weighted;
  • hubs: nodes whose degree (imports in plus out) is at least three times the mean degree, taken over the nodes with at least one counted import (Bunch's rule). They are listed apart, and their imports stay in the counts;
  • inside: each part's imports inside it;
  • across: each ordered pair of parts with the imports from the first to the second;
  • both ways: the pairs of parts that import each other.

What it counts are units. An extractor may give a pair a group, the one target an import named that covers several files (a Go package's folder or a Python package folder, say). The report counts one unit per importing file, group and target part, so an import of a package of several files is one unit, and one of a package split across parts P and Q, from a file in P, is two: one inside P and one across P→Q. A pair with no group is its own unit, which is how every cargo, rust-modules, typescript-imports, java-imports, dart-imports and php-imports pair counts. When two findings of one pair carry different groups, the pair keeps the lowest, none counting as lowest.

A unit differs by language: a TypeScript, Java, Dart or PHP pair is one file importing one file, a Go unit is an importing file and a package, and a Python unit is an importing file and a package folder. The counts of a mixed repository are therefore not comparable across its languages.

Degree, fan-in, fan-out, the mean degree and hubs are counted over nodes. A grouped pair's target is a slice, its group's files in one part, and its importer is the slice of its own group when the pair names one (go-imports names each importer's package, so a Go file counts as its package's slice, a main package nothing imports too; python-imports names each importer's folder, so a Python file counts as its folder's slice), else the file. An ungrouped pair's ends are files. A slice's hub names its group in file and its part in part; the text output adds (part) only when the group's files sit in more than one part, counting every owned file the extractor puts in the group (each package file, for go-imports; each read .py file of the folder, for python-imports) whether or not it imports or is imported, where a file's hub always shows its part.

Every count is given raw and weighted: each unit weighs 1 / the fan-in of its target, the number of distinct files that import that node. So a hub that many files import adds little weight, and a utility file does not make two parts look tangled. The weighted across share is across weight over total weight.

It suggests no grouping. To test a cut, edit the map's paths and run it again. It exits 0 on any counts; an extractor that cannot run prints a note: and its pairs are missing from the counts. A map that does not load exits 2 with its problems on standard error, as touched does. --json prints the same numbers: total, inside and across (raw, weighted), across_share (percentages), mean_degree, hubs (file, part, degree, fan_in, fan_out), parts and between (each with raw and weighted), both_ways, problems, and unsure as check --json lists it, left out when there are none.

The free scan

plotkeeper map scan [--json] [--root <dir>] proposes a repository's first map from the files git tracks, with no model and in well under a second (spec #753, "The free scan"). It reads the tracked file list, the root workspace manifests and the Go files, and never an import. It prints the number of parts with an id and a folder each, then the ignore candidates ([x] ticked, [ ] not), the loose files, the loose tests and the languages no extractor reads. --json prints the Scan: map, ignore_candidates, loose_files, loose_tests, read_languages and unread_languages. It exits 0, and 2 when git cannot list the files.

map is a version 2 map: one part per folder with an id from the folder's name (its parents' names are added while two parts would share one), tier: "interface", holds: [] and placeholder text, extractors the ones that detect a file they read, ignored the ticked candidates, and no actors, links or laws. A language whose code (tests apart) an extractor reads is named in read_languages, and one with files no extractor reads in unread_languages.

The rule is the lean rule of 2026-11-24 with four additions:

  • Step into the folder that holds most of the code. From the root, while one child folder holds at least 80% of the code files of its parent (tests not counted), the scan steps into it. At the frontier each child folder with code is a part. A folder with no folder of code in it is a part itself.
  • Workspaces and Go. When a root package.json (workspaces), pnpm-workspace.yaml, go.work or Cargo [workspace] is tracked, each member folder is a part at the frontier (a * matches one folder name; a pnpm ! entry excludes), and so is each folder holding a Go package main, as under cmd/. The code outside them becomes a part per top-level folder, with no stepping; a folder that holds a member is left to its loose files.
  • Loose files and tests. Every tracked file no part owns and no ticked folder holds is loose, code or not and hidden or not (a README.md, a docs/ or .claude/ folder), since the check asks a home for each; system-map.json itself never is, as the check ignores it with no entry for it: test files (in a tests, test, __tests__, spec or __mocks__ folder, or named *.test.*, *.spec.*, *_test.* or test_*) are never parts and are loose_tests, and the rest are loose_files. Parts come from code alone, and hidden folders are not read for them.
  • Reference copies. A top-level or frontier folder named vendor, third_party or third-party is ticked and ignored; one named external or deps, or with copy, reference or snapshot in its name, is listed unticked and stays a part until the person ticks it. A top-level folder with no such name is also listed unticked when it holds at least a fifth of the code, has no build manifest (package.json, go.mod, Cargo.toml, pyproject.toml and the like) at any depth, and no code file outside it contains its folder name as text (a text search, not the extractors, which need a map to run). It applies only when the repository tracks some manifest, so a repository with none lists no such folder.

At most 15 parts: while there are more, the deepest level's sibling folders fold into their parent folder's part, the parent with the fewest code files first. Parts at the top level cannot fold further.

The scan screen

A git repository whose map status is the empty state, with no map on the default branch, in the checkout or waiting on a PR, opens on the scan screen (ui/map-scan.ts, server/src/map_scan.rs, ticket #760), never a folder in no git repository or an Unreadable map. The page asks map_scan once each time the project's map opens, and says "Scanning this repository's folders…" until it answers. The server scans the main checkout, runs system_map::check_text on the skeleton in memory and adds the edges it computes to the skeleton as import links with no reason, one per pair of parts in the edge's direction; it answers with that map's text, each part's tracked file count, read_languages, unread_languages, and whether the runner would find claude. Nothing is written and no token is spent.

The canvas draws the skeleton's parts as grey plates (.plate.draft), each with its name and its folder and file count, and the links as lines from rim to rim. The plates are placed afresh on each draw and fitted to the canvas, with no fog, badges, footprints or marks, and no drag, pan or saved position. A card sits centred above the canvas in its own row (.map-scan-card), so the plates are fitted below it and none is covered. The card holds the title "No map yet", one line, "Claude can draft it from these N parts." ("Give the prompt to your own agent." without claude; "The scan found no code to propose parts from." with no parts), Draft the map with "Recommended · about N minutes" under it (a quarter of a minute a part, a minute at least; its hover says it runs on the Claude Code plan, never a dollar figure), and two openers: "Adjust parts (optional)" and "Use your own agent". Each opens a drawer at the screen's right edge (a light-dismissed popover with its title and Close); the drafting run Draft the map starts is the Map draft's (#762). When claude is not found, "Use your own agent" is the card's strong button above Draft the map, which is muted (aria-disabled), with no time hint, and "Needs the claude CLI, which is not on your PATH." under it. The copy-prompt carries the skeleton as JSON and asks the user's own agent to write system-map.json at the main checkout's root, fill each part's name, caption and purpose from its files, and run npx plotkeeper map check until it passes; once the file is there, the window's next focus reads it from the checkout and draws the map in the scan's place. A scan that fails (git cannot list the files) leaves the plain "No map yet" screen and its prompt (#669). Below 1007 px the panel sits under the canvas.

Editing the skeleton

Before drafting, the person may fix the scan's grouping in the Adjust drawer and on the plates (ticket #761, stories 7-10); none of it is needed, and nothing is written. The skeleton is a value the page holds: each edit sends it with the edit to the server (map_scan_edit), which makes the edit in memory, runs check_text on the result and answers with the same reply as map_scan, its links computed again. Edits go one after another, each with the skeleton the one before left; an edit that fails keeps the skeleton and says why in the panel. Draft the map starts from the skeleton as the page holds it then (#762). The reply also carries the scan's reference-copy candidates, each ticked while the skeleton's ignored holds it, the loose files and tests (tracked files, code or not, that no part owns and no ignored folder holds), and, by part, the subfolders Split by subfolders would make parts of.

The Adjust drawer says "Optional. The draft works without this." and offers the edits by recommendation, one row a top-level folder of the loose files and tests together (the root's own files are one row):

  • Recommended: leave out. The folders with no code (none of the scan's code files, by extension, and none in a hidden folder, as the scan reads none there) whose leaving out the server allows, and the copies the scan found and left unticked, as chips with their file count, and one button, "Leave out these N", that sends an ignore-folder edit for each folder and an ignore edit for each copy, one after another. A chip's × keeps that folder in the map for the session, with no edit sent: it moves down among the rows to give a part. "Leave out these N" sends what the latest draw listed, once. The root, and a folder holding a part's path, are never suggested, as ignored wins over the parts' paths.
  • Code no part holds yet. One row a top-level folder, with its file count ("· no code" when it holds none) and a picker: "Leave as is", "New part", any part, and "Leave out of the map" where the server allows it. Choosing a part sends home with the folder's files at once, no Add to press, and "Leave out of the map" sends ignore-folder; the files go to the part chosen, or to a new part named after their folder ("Root" for the root's own files): as their folder whole when no part's path is inside it, else each by its own path.
  • Left out. The folders left out and the copies ticked, as chips, each with Undo, which takes it out of ignored: a folder's files are loose again, making no part, and it may be suggested again; a copy holding code that no part covers becomes a part again, as unticking it does. After a press the focus goes to the first left-out folder's Undo, to the next row's picker, or to Leave out, else to the drawer's Close.

The drawer's foot holds "Tip: press a plate on the map to merge or split it." and the languages line.

  • Merge into… and Split by subfolders. A plate's press opens its actions beside it. Merge into… moves the part's paths into the part chosen. Split by subfolders makes a part of each subfolder holding the part's code; the part keeps its file paths, the files right in its folders and the subfolders with no code, and goes when it keeps nothing. It is offered when that leaves two parts owning code, else it is muted with the reason.

The parts' paths never nest, so which part owns a file never hangs on their order. A new part's id is its folder's name, with its parents' names added while the id is taken, then a number; its name is the folder's words. Each answer redraws the plates and lines; the panel is patched in place, so it stays open at its scroll and a focused box or button keeps the focus, and after a merge or a split the focus goes to the plate merged into or split. A draw of the same scan (a focus, a session's event) keeps the plates, and an open plate's actions with them.

The Map draft on the map

Draft the map waits for any edit still on its way, then sends the skeleton it left to map_draft_start (ticket #763; the drafting run is #762's, background runs); a refused start says why under the button. While the project has a Map draft, the Map view shows it in the scan's place (ui/map-draft.ts), whether it was started now or kept across a restart: the page asks map_draft with the scan, and again on each map-landed, which the server sends whenever the draft changes; of the answers only the newest asked is drawn. The plates are the skeleton's parts, placed as the scan's are, each with its stage at its top right: "Being written…" (its folder under its name until its text lands), "Being redrafted…", "Being checked" while its reviewer has not answered, "Checked", "Flagged: <verdict>" (an outlined plate), "Writing failed" or "Checking failed". A part stands as the latest group holding it does, so a redraft is what its plate says. A plate's press goes to its card in the panel.

The panel says how far the draft is ("1 of 3 parts checked · 1 being checked · 1 failed"), then each failed group with its parts, why it failed and Retry of that group alone (map_draft_retry), then "Mark the parts you work in as Core: they'll tell you when they change." and a card a part: its folder and stage, its name, caption and purpose, each edited in place and kept in the Map draft when committed (map_draft_edit, one field at a time; read-only while the part is being written), the reviewer's flag on its purpose with its verdict, its reason and the lines it cites, a tier picker (every part starts Interface), and Redraft this part (map_draft_redraft), muted while the part is being written or checked. What the writers left out follows. Accept's two ways out are muted with their reason until every group is done (ready), so a redraft locks them again until that part's reviewer answers; a flag never locks them ("Accepting" below). Discard asks first, then throws the Map draft away (map_draft_discard) and returns to the scan, with the skeleton as the page held it. Each answer patches the drawn screen, plates and panel alike, so a field being typed in keeps its words and its focus while a group lands; the other fields say the Map draft's text again.

A Map draft also shows over a system-map.json in the checkout that does not read, one that came after the draft started (#764): the scan is not offered for an Unreadable file, but the draft is, so Write can ask before replacing it.

Accepting

The panel's foot holds Accept's two ways out (#753, "Accepting", stories 23-30; tickets #764 and #765). Write system-map.json to <checkout> is the main one, with the line "It adds an uncommitted file to your checkout, like a CLAUDE.md: commit it the way you commit anything." Open a draft PR is the second: it writes nothing to the checkout, so git pull never meets an untracked copy of the file the PR brings.

Write (map_draft_accept) builds the accepted map from the Map draft: the skeleton's parts with their latest written text and the person's edits, the edges check_text computes on it as import links (<from>-<to>, no reason, which an import link needs none of), laws: [] and flows: [], its keys in the order this repository's own map gives them. The server runs check_text on it first and refuses Accept with the check's first three problems when it fails, writing nothing. It refuses too while a group is not done, and when the repository has a map: on the default branch, waiting on a draft PR, or a checkout file that reads. Then it writes the map to system-map.json at the main checkout's root, uncommitted, and deletes the Map draft; the page reads the map again, which now shows from the checkout with "Map not committed yet" in its head and no PR button.

The write never reaches out of the checkout or over the person's file unasked:

  • With no file there, the map is written to a temporary file beside it and moved into place only while no file is there, so a file that came meanwhile is never replaced.
  • A symbolic link there, even one to nothing, is refused: plotkeeper writes only a plain file there, so the link is never written through.
  • A file that does not read is replaced only on a yes. Write answers with the file's first problem, as the Map view names it, and a hash of the file as it read it (seen); the page asks "Replace system-map.json?" naming the problem, Cancel focused, and on a yes sends Write again with that hash. The server reads the file again then, and replaces it by a rename only while it still holds what was asked about; a file changed since is asked about again. A no writes nothing and keeps the Map draft.

Open a draft PR (map_draft_pr) is muted with its reason when a system-map.json is in the checkout (one that reads is a map; one that does not would come before plotkeeper's copy in the read order, so the map would not show from that copy), when gh is not found or when gh auth status fails; a pass is trusted for a minute. It reuses Back a law's draft-PR flow (back_a_law::open_draft): it fetches the default branch and refuses when that branch has a map by now, then makes a detached temporary worktree of it in the data folder, a branch first-map/<id> there, the accepted map built as Write builds it but checked against that branch's files, a commit with the person's own git identity, a push to origin and gh pr create --draft, then removes the worktree and the local branch. Nothing is written to the checkout, and no hook of the person's runs. The map is kept as first-map/<project>.pending.json with the PR's number and branch (the read order's third source), and the Map draft is deleted; the page reads the map again, which shows from that copy with "Map waiting on PR #N" in its head. While the PR opens, both ways out are muted and the button says "Opening the draft PR…". It refuses as Write does, writing nothing. Its branch and map are kept with the Map draft before the push, so a press again after one that stopped short (gh failing past the push, or saying no number, or the copy not saved) finds that press's PR as Back a law does (back_a_law::earlier_pr, gh pr list --head <branch> --state all) and keeps the map waiting on it, or pushes that branch anew, and never opens a second PR.

Following the PR. The tray's PR lookups cannot follow it: they skip drafts, and a PR gone from the open list cannot be told merged from closed. So when the Map view opens or the window gains focus, after the map's fetch and under the same per-repository cooldown and in-flight guard (a slot of its own in Fetches, so a session's turn-end fetch, which shares the map fetch's slot, never keeps it from running), the server asks gh pr view <number> --json state,mergedAt for the pending PR alone (MapDrafts::follow):

  • MERGED deletes the pending file when the project's last fetch passed, the Map view's own or a turn end's, and the default branch's map, fetched just before, takes over; after a failed fetch the copy stays on show, and a later lookup deletes it.
  • CLOSED keeps it and marks it closed: the head says "Map not in the repo", and under it the line "PR #N closed without merging, so this map is only plotkeeper's copy." and three ways forward: Write system-map.json to <checkout> (map_pending_write, Write's own steps, the replace question included, then the copy goes), Open a draft PR (map_pending_pr, a new PR on a new branch, muted and recovered as Accept's is, its press kept with the copy; the map then waits on it) and Discard (map_pending_discard, asked first; the copy goes and the scan returns).
  • OPEN changes nothing, nor does a gh or network error, a timeout (15 s) or an answer it cannot read: the next lookup asks again. The pending file goes only on MERGED, Write or Discard, and the three ways forward are refused while the PR is open.

The promotion PR gets no Map diff or Ratify items, since its base has no map, and its brief takes the quiet path ("no brief: nothing you track changed"); no code overrides either.

Keep it current

The Keep it current card (ui/map-keep.ts, #753, ticket #766) gives two snippets to copy, so the person's agents and CI keep the map true: the line "When you change files, update system-map.json and run npx -y plotkeeper map check until it passes." for AGENTS.md or CLAUDE.md, and a GitHub Actions workflow (actions/checkout, actions/setup-node, npx -y plotkeeper map check), each with the page's copy icon, and a note that .git/info/exclude keeps system-map.json out of git. plotkeeper edits neither file. The card opens after Accept's Write or Open a draft PR, and after a closed PR's Write or new draft PR, in the map's head under the line; a quiet Keep it current button beside Fit opens and shuts it later, and is there only while a map is drawn. It is not in the session list's ⋯ menu, which is drawn only for a project with no live session.

plotkeeper's map

Ten parts: the agent plugins, the hook, the core, the server (server/), install, map, briefs and runs, the map engine (system-map/), understanding, the window (ui/) and workbench; three actors: the agents, the writer and GitHub; one flow, Turn writing. The server/ crate is three parts, cut where its imports cut (spec #473, "Server in three"; the two cuts' system-map imports counts are in the PR body of ticket #487): Install (install.rs, hook_copies.rs and their tests) and Map, briefs and runs (the map, fog, history, staleness, CI laws, ratify, the Map diff, stop rules, pre-flight, PR briefs, part catch-ups, PRs, story bar, runner, back a law, micro-worlds and the map text review, with their tests and fixtures) name their files and come after Server in the file, so their patterns win over Server's server/; a new file in server/src/ is Server's until a pattern names it. Twenty-two links are import links, the code's real dependencies, all proven; Server and Map, briefs and runs import each other, a knot accepted for now. The rest are run-time links, among them the hook's file link to the server beside the server's import link to the hook. Turn writing's first hop runs from core to the server, against the server-core import link, and says so. ignored holds what is not the running system: the docs, archive/ (retired code: the spikes and the desktop app and its terminal daemon, #332, #415), scripts/ (the release script scripts/npm/release.mjs among them, #512), the tooling crates (wayfinder/, test-support/), the npm package's manifest (npm/, #368), the release notes (CHANGELOG.md, #512) and the repository's own configuration at the root, .github/ among it (the npm package workflow's release commit guard and release job, #512), and the agent skills in .claude/skills/ and .agents/skills/ (/release among them, #512). The map engine was ignored as tooling until it shipped inside the server and understanding (placement, fog, history); while ignored, a session editing only its files landed in "not placed". A change that adds, moves or removes files, changes what a part does or how parts connect, or changes a law changes the map in the same PR (AGENTS.md).

The Map view

The window's Map view (ui/map.ts, server/src/map.rs) draws a project's map on a quiet chart: parts as plates (name, caption, a mark per law: filled when a check backs it, hollow when it rests on trust; a plate's open button has a hint of its name, caption and purpose, never its held items), actors as labels, links from rim to rim. Links that join the same two ends, in either direction, are one line (spec #473), drawn from the first one's from and carrying every link's id, so a PR brief's light along either runs that line, the right way, and a law on either marks its middle; there is no other colour or style for a pair. It is the page's base (#386): the page is Treatment C's frame, a 34 px top bar over the map, with the 252 px session list at the right on the darkest tone (--chrome), told apart from the map (on --bg, with a rounded top-left corner) by tone, never a border line. There is no centre column, and Home is retired (ADR 0001). The page opens on the last viewed project's map (kept in the browser), even a gone one's "gone, Remove project", else the first saved project's that the session list shows, never a gone or temporary one without a live session (spec #659), and when it shows none (or the sessions are not read yet) the first saved project's. A shown project gives way the same way only when Remove project takes it out of the saved list: a shown project never saved (a temporary one, or a live session's) stays through another project's change. The top bar holds the shown project's name, the Needs you chip and the gear; the map draws no title of its own. The session list's project headers switch the map: a click on another project's header shows its map (a session's panel of another project closes with the switch; History and Settings stay), and a click on the shown project's header folds or unfolds its sessions. Selecting a session, from its row (the session list's or a session badge's list) or a key, shows its project's map with its story in the left panel. Each header carries the quiet dot Home's project row once had, unchanged in meaning (fog on a Core part, a broken law, or a PR brief waiting; map_marks), drawn as the map's mist; its hover names which of the three lit it. With no saved project (a fresh install) the map's place says "Run your agent in a repository; it appears here", then "plotkeeper follows each agent session and maps what it changes.", with a link to the install docs; a git repository with no map opens on the scan screen ("The scan screen" above), which says it has none, then "A map names your parts and their rules; changes light them up."; when its scan fails, it says the same and shows the draft prompt, which asks for each part's purpose and held items, and to add the extractors check's note: lines suggest, with the PR brief's copy icon beside it ("Copy the prompt", #669). These teaching sentences (#526) show whatever the Explanations switch says. Below 1007 px the list is its strip; in a wider window [ (studio::ToggleList) folds the full list to the same strip and back, and the map takes the width (spec #658). studio::ShowMap (shift-cmd-m and shift-cmd-h by default), "back to the map", closes the left panel; a keymap.json that still names studio::GoHome gets the same action.

  • Source (the read order, #753). read_map reads the map from the first of three sources that has one, and MapState.from says which:

    1. default-branch: system-map.json with git show from origin's default branch as last fetched. When the file is there it wins, readable or not, whatever the working tree holds (spec #306, "Single commit of truth"). With origin/HEAD unset it reads the local main or master and says so quietly.
    2. checkout: else the file in the main checkout's working tree, uncommitted, as the user's own agent wrote it. The head shows "Map not committed yet" in the ref's place.
    3. pending-pr: else the accepted map waiting on its draft PR, kept in the data folder as first-map/<project>.pending.json with the PR's number and branch, whether it was closed unmerged, and the map's text (written by First map's Open a draft PR). The head shows "Map waiting on PR #N", or "Map not in the repo" once the PR closed.

    Every source has the same boundary: a file that system_map::convert and the lenient parse accept is drawn, whatever check says; one they refuse is Unreadable and shows the empty screen with its reason. For a checkout map that reads, the Map view's payload also runs system_map::check on the working tree, and its problems (MapState.problems) show as a banner under the head: the count, the first three and a copy of them all. The default branch's map gets no banner, since CI owns that, and the other readers of read_map (placement, pre-flight, the header dot and the rest) take the map without running the check. A project whose folder is in no git repository is not-git: the view says "Not a git repository: no map" and offers no prompt, no button and no Pre-flight. The default branch's ref and commit stay in the payload whichever source the map came from.

    Only the default branch is fetched: the server fetches origin when the view opens and when the window gains focus while it is open, and when a task is first seen merged; never on a timer. A repository is fetched at most once a minute, and never twice at once. The other two sources are read as they are.

  • Daniel's own state (map-state.json in the data folder, never the repository): a saved (x, y) per part or actor id, a tier per part id, which beats the map's, and the project's view (the camera's pan and zoom).

  • Placement. A part with no saved position is placed once, near the parts it links to (else the parts of its zone), clear of every plate, then saved; a placed part never moves on its own. A plate drags past 6 px of pointer movement, so a click never nudges it, and its place is saved when it is let go.

  • The camera (#383). The map area never scrolls: it pans and zooms the world. Panning: dragging the empty background pans the view, under an open hand that closes while dragging; dragging a part still moves and saves the part. Zoom: a wheel, a two-finger scroll or a trackpad pinch (which the browser reports as a wheel with Ctrl held) over the map zooms around the pointer and never scrolls the page, held between 40 % and 200 %. A wheel's delta is read in pixels whatever its deltaMode (a line is 16 px, a page the map area's height); a plain wheel zooms about ×1.16 per 100 px tick (rate 0.0015 a pixel), each event held between ×0.8 and ×1.25, and a pinch keeps its faster rate (0.012 a pixel) (#669). Fit: 0, studio::FitMap in the palette, or the quiet Fit button after Pre-flight in the map head, whose hover names its keys from the keymap, puts the whole map in view, centred with a gutter, at no more than 125 %. Each project's view is saved in map-state.json beside its positions a moment after it moves, so it survives a restart; a project never moved opens at 100 % with the world's corner at the area's. When a part's sheet opens, the camera pans just enough to show that part whole beside it, once per opening; positions are never written by revealing. A PR brief takes the camera while it plays and gives Daniel's view back, as it found it, when it closes; while it plays, a drag of the background or a zoom does nothing.

  • The left panel (ui/panel.ts, #385). While the view shows, everything Daniel reads beside the map opens in one panel floating over the map's left side, so he never leaves the map to read: a session's story (the story rail itself, moved in; see The story rail), History, a turn's whole diff, or Settings. Pressing a session's row in the list, or in a session badge's list on the map, opens its story there, and that session is the spotlit session while it is open; a second press on the same row, or Esc, closes it and selects no session. A Worker's row in a badge's list, or a subagent's line, opens that subagent's log in the panel (#386); closing it selects no session. History opens there from the list's "History · N" and studio::ShowHistory; a turn's diff (the evidence line's "more lines" and "Open full diff", or studio::OpenFullDiff) opens there widened to at most 780 px and closes the part's sheet, and its Back shows the story again. Settings opens there from a quiet gear at the top bar's end, or studio::ShowSettings. Its width is the rail's. The panel and the part's sheet (and the drawer) share one glass, Treatment C's part sheet, in one class, glass: a near-opaque surface, an 18 px backdrop blur, a top highlight, a faint 1 px edge, a deep shadow and a 14 px corner, inset 22 px from the map's edges. Neither darkens the map, which stays lit and clickable; a PR brief alone dims the map, and dims both with it. Each slides in 12 px with a fade on Treatment C's ease, at once under reduced motion. Opening or closing one never moves a part: the map keeps the whole stage and the cards float over it, and when the panel or the sheet would cover the part in focus (the sheet's part, the parts of the spotlit session's latest turn) the camera pans just enough, never past what the band between them holds. Below 1007 px only one is open: opening the sheet closes the panel, and the other way round. The Ready for review tray sits at the map's foot on the left, in the same glass, since the map pans under it (#571); while the panel is open it is hidden, at every width, so it never lands in the middle of the map, and it is back when the panel closes (#666). The panel's × (named "Close") sits on its views' header line, beside the story's "⋯" and level with the History, Settings and diff titles (#571).

  • Esc peels the layers, in order: an overlay (the pre-flight), a session badge's list, a drawer, a PR brief's not-confirmed popover, a PR brief (closing it keeps its step), a scrubbed commit (back to now), a part's sheet, the left panel. On the bare map it does nothing: the map is never left. While a hint is open, Esc closes the hint alone and peels nothing (spec #582).

  • Pre-flight (server/src/pre_flight.rs, understanding/src/pre_flight.rs, ui/map-pre-flight.ts; #394 of spec #378). Before starting work, Daniel sees which parts it will likely cross. The map's head has a quiet Pre-flight button, and the palette has studio::PreFlight; either opens an overlay over the map in the glass, and pressing it again closes it. A pointer press outside the overlay and its button (on the map, a plate, the tray or the list) closes it too while it shows its inputs or a framed pre-flight; while Daniel picks parts by hand, or waits on the writer, such a press leaves it open, so a stray press loses neither his picks nor the prediction (#666). Its inputs are an open issue (the project's open issues as gh issue list gives them), one or two lines of free text, or parts picked by hand. For an issue or text, the server asks the PR briefs' writer, which has no tools (claude -p, model prBriefs.model), which part ids the work will cross; the issue's title and body go only to that writer, fenced as text to read, never to a background run. Ids not on the map are dropped; a failed call, a reply that does not read or one that names no part on the map shows the hand picker with why. The parts are framed on the map with a dashed outline and the word predicted (picked for parts picked by hand), and the overlay lists each with its laws on trust, its fog and its staleness band (the map's own, below). Clear takes the pre-flight off the map. One pre-flight is kept per project, in the data folder's pre-flight-by-project/, and the Map view's payload carries it (pre_flight). When a PR's brief is written and the project's pre-flight is of an issue, the server notes every issue the PR closes (not only the lowest, which the facts still read as the spec) with each one's parent (gh issue view --json parent); a brief whose PR closes the pre-flighted issue, or a sub-issue of it, opens with "You expected X, Y; it touched X, Z", where touched is the parts the brief's shape found (those that fog and the ones only mentioned). A pre-flight from free text or hand-picked parts has no issue, so no brief carries its line. The overlay closes with Esc before every other layer, and its field is a text field, so single-key shortcuts do not fire while Daniel types in it. A past commit's map shows no pre-flight.

  • PR briefs (server/src/pr_briefs.rs, ui/map-brief.ts; the one doc for them is PR briefs). When a lookup finds a PR ready the server writes its brief through write_pr_brief (always with claude -p, whatever summaries.writer says; model: prBriefs.model in settings.json, Opus by default, read on each write, the writer's and the claim check's alike) and stores it per PR and head under the data folder's pr-briefs-by-project/. A new head marks the stored brief stale; it is written again when Daniel opens it, or when two lookups in a row see the same head. Opening a tray row plays the brief as a single story or one chapter. A PR that would fog more than two parts has one tray row per chapter; each chapter opens on its own and resumes at the step left, its frame holds every part its behaviour crosses, the overview (when there is one) plays before the first chapter opened and once per brief, and Also touched shows on the last step of the last chapter (the PR's other changed files in groups by kind, each with a See the code of its files; an older brief's writer lines instead): the light runs the step's links at one speed and parts light as it arrives, the camera frames the parts the brief lights, the panel keeps its tallest step's height and crossfades, a figure (states, sequence, compare) is drawn by code from the writer's labels, citations sit in quiet type, a brief written from less than its full facts shows a "Partial facts · N" chip listing what it lacked, and an item the checks left flagged says "not confirmed from the facts", a mark whose popover lists why. A step's "See the code" opens the changed files of the parts it lights, with their diffs, in the drawer above the brief (pr_diff; every file on the Ratify or last step; what the step quoted when git cannot give them). Opening a brief returns a scrubbed map to now; closing it with Esc or Leave keeps the step it was at, and finishing it starts it over. Motion respects reduced motion, where the whole step lights at once. A check of kind pick is answered in the panel (pick, take it back, Check); an order check shows its question until its map answer is built.

  • Ready for review (server/src/prs.rs, ui/map-tray.ts). The server asks gh pr view <branch> --json number,title,isDraft,state,headRefOid,body,closingIssuesReferences for each listed session's branch: at once when a turn ends, and when the page gains focus or the Map view opens through one cooldown of a minute per repository with an in-flight guard; never on a timer. A PR is ready when it is open and not a draft; its head is kept in memory and replaced by a later lookup. The tray at the map's foot lists the project's ready PRs: a PR whose brief is stored is one row, or one row per chapter of a chaptered brief, that opens it; one being written says "writing the brief…" and waits (the map stays usable); one without a brief opens, and opening writes it in the background, the panel saying "Writing the brief…" until it lands and opens; one whose write failed says so and opens to try again; after a push, a stored brief's row says why it is what it is: its read carried over, or it was rewritten (Since you read). At start only the ready PRs whose head moved within briefBackfill.hours (2 by default; the older catchUp.hours is still read) get their brief written or a stale one rewritten, the newest head first and at most 3; a PR that becomes ready while plotkeeper runs is written at once; any other is written when opened. Any PR number found still names its session ("PR #N"). A ready PR whose touched parts would not fog at Daniel's effective tiers (Core always, Interface-only when the map's diff names the part, Black box never) gets no brief: the lookup builds its facts, finds no required part, writes nothing, does not gather it again at the same head, and its tray row says "no brief: nothing you track changed".

  • Ratifying (server/src/ratify.rs, ui/ratify.ts, ui/map-ratify.ts). Daniel accepts or overturns what a PR changed on the map and what its agent decided; it never blocks anything, and the merged map is in effect at once. An item is a map change (a part, outside actor, link, law or flow added, changed or removed, read by code from the map's diff; a part's tier and zone never count) keyed by (PR, kind, map id), or a decision the agent declared, from the brief's decisions, keyed by (PR, decision id). Decision ids come from the writer entry and survive a reworded rewrite; a decided item a rewrite no longer holds keeps its record and is still listed. The state is ratify.json in the data folder, per project: when the project's first run was (since) and a record per decided item (accepted, overturned, or pending, with the time and what the item said). A reader ignores what it does not know. No record means ratified for anything that landed on or before since, and "not yet ratified" for anything after; a pending record marks an item not yet ratified whenever it landed, which is how Daniel's own file keeps the laws #295 left open, edited once by hand (no product logic names them). The brief ends with a Ratify step listing its items (nothing is added when all are ratified), each with Accept and Overturn. A part's or a link's row carries a detail, old beside new, which the step shows under the row as "Was" and "Now" lines (no colour), only for what changed: for a part, its name, caption ("Caption", #643, so an Edited part on the Map diff always has a line saying what changed), purpose and held items, matched by name (a name held twice, by its first, second… time), each with its paths change, and the patterns its own paths gained and lost; for a link, its kind and reason, and "Direction" (from to to) when its ends swapped. An added item shows its every line with nothing before, a removed one with nothing after. Both maps are converted first (system_map::convert), so a version 1 side's description shows as the old purpose. An import link the PR adds carries its evidence (#499): the import sites behind it, read from the PR's head in commit mode when the brief was written and stored on the brief (link_evidence), never extracted live, and shown only while the open PR's head is the brief's; its second line shows one site and "(+N imports across M files)", the site opening its code from the head in the drawer, numbered with its line marked (ratify_site, not the diff), the count listing every site there, each opening its code. A removed link shows none. The part sheet marks a law row, and a link's row in "Talks to", "Not yet ratified" with the same two buttons, for a map item that landed after the first run with no record. Overturn records the decision and copies a self-contained prompt to the clipboard (the PR number, its branch while the PR is open, the item's id and its wording, and for a part its new purpose and the names of its held items, for a link its ends, kind and reason, and for an added link its import sites; navigator.clipboard.writeText()), saying "Prompt copied, paste it into your agent"; when the clipboard refuses, the prompt shows in a small box with a Copy button. The note shows only on the sheet or the brief that holds the overturned item. Nothing is typed into a session.

  • Background runs (server/src/runner.rs, ui/map-runs.ts; the one doc for them is Background runs). The side area lists the project's runs under the line for the sessions that need Daniel and no part holds: a running run, the queue behind it, each ended run with how it ended, Cancel or Dismiss, and one indicator with Resume while a login or limit failure pauses the queues.

  • No map. A project without the file shows a calm empty state, and shows the drafting prompt to give to a session in the project, with a copy icon beside it (ui/copy-button.ts, the PR brief's): a press puts the prompt on the clipboard and the copy toast says "Prompt copied", or holds the prompt to copy by hand when the clipboard refuses. The page starts no session.

  • Fog (server/src/fog.rs). The first time the view opens a project, the server records the default branch's tip, so every part starts clear. After that it walks the new first-parent commits and files each part's changes in map-state.json: thick when a law on the part, a link at it (its id or ends), a flow through it or its paths changed, or the part was added; thin when files it owns changed (placed by the union of the commit's map and its parent's, so a moved file touches both parts) or only its name, caption, purpose or held items (their paths included) did, or the kind or reason of a link at it; nothing for zone, ignored or tier. A removed part leaves the live map. Each entry keeps its commit, its strength, the PR its subject names (Title (#N), else none) and why it fogs the part (#495, fog::Change): "added", "paths", law <id>, link <id> and flow <id> for each law, link or flow whose say on the part changed (a link's kind or reason too), each of the part's own words that changed (name, caption, purpose, holds), and the count of its files changed (3 files). An entry filed before #495 has neither PR nor why. What shows is by Daniel's effective tier: a Black box part never, an Interface-only part only thick. Strength is never a count. Reading a brief clears it (#342): a chapter is complete when its last step was seen (watchSeen) and its check was answered, right or wrong, when it holds one; a single story is one chapter over all its lit parts. Once every chapter of a PR's brief that lights a part is complete, that PR's entries leave that part at once and the mist lifts; a part no chapter lights keeps its fog, and leaving mid-chapter clears nothing. Completion is kept as "read at head X" per chapter in map-state.json (fog.reads). A PR read before it merges files fog at merge only for the parts touched by the diff from X to the squash commit, limited to the paths the squash commit itself changes (so main merged into the branch fogs nothing), at the strength that diff earns; none when nothing was pushed after the read. A read carried over to a new head (a pure rebase, or a push that fogs nothing; Since you read) counts as read at that head, so fog at merge runs from it and a rebase does not pull main's edits into the PR's fog. "I know this" still clears a whole part, and so does reading its part catch-up to the end, for the entries it covered.

  • Mist. A fogged plate has a cool-grey mist around it (#455): dense beyond the plate's edges and at its rim, thinning to nothing over its name, caption and marks, so they read at full contrast (4.5:1, measured by snap's contrast pass); the caption is not dimmed. Thin and thick still read apart: thick is denser, with a rim and a slow drift. "I know this" on the part's sheet clears that part's fog and lifts the mist (no motion under reduced motion), and is logged as its own event (Stop rules).

  • The part sheet (ui/map-sheet.ts) opens over the map's top right, in the left panel's glass, on a click that was not a drag (a press on a session badge opens its list instead, and a press in that list never reaches the plate). First, under its name and caption, why its plate carries its marks (#495, sheetMarks in ui/map-model.ts), from this case's facts and only for the marks it carries: its fog as the newest thick entry (else the newest) with its PR (else its commit) and why, then "+N more" for the other entries, or an older entry's strength and commit alone; its staleness band's line (below); and a broken law's line (below). A past commit's sheet shows none. Then the catch-up card: for a fogged part, how many changes landed, the waiting part catch-up's outline and its main button (or the one PR brief chapter that lights it) with "I know this" as the quiet second; on a part with no fog, "Caught up" and the refresher (below). Then the purpose, which draws a backtick span as code (a plate's hover text shows no backtick), clamped to two lines with "More" (shown only when it runs longer; "Less" clamps it again), and a row of chips (the tier, the laws, the links, and CI when the sheet shows CI), each opening its section and bringing it into view (#637). Then the sections, each a fold that opens on its own and shows a short value beside its title (none for History, whose rows load later), in this order: Laws (backed by a check or on trust), Talks to (every link at either end of the part, in the map's order: an arrow, → when the link runs from this part and ← when it runs to it, the other end, the link's kind and its reason when it has one; the sheet has no other list of links; "No link at this part" when there is none), This session here (below), Holds (the held items, each its name, its sentence and its key files, its paths as written; an item without paths is a note, its name in italics followed by "· note", then its sentence, so it never reads as a heading, #525; none when the part holds nothing), Tier (Core, Interface-only, Black box; changed in place and kept in map-state.json), CI on main (below, whenever the sheet shows CI) and History (the history strip, below). When a run on main breaks one of the part's laws, CI on main comes first, open. The folds Daniel opened stay open in this browser (map-sheet-folds, beside the sheet's width); a browser that keeps nothing starts with all folded. The first Esc closes it; the next closes the left panel, if open. × (named "Close") closes it too, and so does a click on the empty map (#445): a press on the background that moves 4 px or less between down and up closes the sheet and its drawer, while one that moves further pans and keeps them. A click on another part switches the sheet to that part. The not placed line, the sheet, the drawer under it and the background runs are one column at most the map's height less its insets, the line first, so it keeps the map's top right and an open sheet never pushes it down over a part (#466). The not placed line is one line of fixed height, and while a sheet is open its slot keeps that height even with no line in it, so sessions starting and stopping to need Daniel never move the sheet (#472, #694; in the event log the list changed about every 30 s while agents ran). The column scrolls as one: the sheet and the drawer never scroll on their own, except the two that keep a short scroll of their own: a drawer's code block and the History strip (which can hold thousands of pixels of commits); no drawer text gives the column a sideways scroll, and a scroll past its end never moves the map. The sheet is 360 px wide at first; dragging its left edge resizes it between 300 px and half the map, and so do the left and right arrow keys while that edge has the focus. The width is kept in this browser, and a double-click on the edge puts it back to 360 px. The sheet explains itself (spec #520, #522): while the page-wide explanations setting is on (the default), each fold (Laws, Talks to, This session here, Holds, Tier, CI on main, History) has one muted line first in its body, shown when it is open, and the catch-up card one under its eyebrow; the selected tier's meaning sits under the tier buttons, and every tier button's hint is its meaning; in Talks to, a link kind's line follows only the first link of that kind, and "Not yet ratified"'s only the first unratified link; a fogged part has one line under its fog buttons saying what the buttons shown do: Part catch-up and I know this, the PR brief chapter's button and I know this, or I know this alone, each button described by it. Each fold's summary and the selected tier carry aria-describedby to their line; while off, no line is drawn and no attribute points at one. A ? toggle beside the × (named "Explanations", with aria-pressed; hint "Hide explanations" or "Show explanations"; filled when on, a muted ring when off) flips the setting through the server's settings write (set_explanations), and so does the palette's studio::ToggleExplanations; the open sheet draws again at once, and a ? that had the focus keeps it. A flip while a write is in flight waits for its reply, so a double click ends where it started and no write is refused as stale. Every text is in ui/explanations.ts, worded to "you", at most 12 words each. This session here (spec #549, #561): while a session's story is open in the left panel beside the sheet, a fold, third after Laws and Talks to, lists the open session's turns of the last 7 days (the page's cut: a turn's end, or its start if it never ended) that changed the part, Workers' files included, newest first, each its number in the story (from 1), its Headline (else its prompt's first line) and its age (minutes, hours, then days). With none it says "No turn of this session changed this part in the last 7 days", but nothing while map_place has yet to answer for a file of those turns; the section, and the newest turn's "Show on map", follow a new answer when it lands, and "Turns older than 7 days aren't listed" shows under it only when the session has older turns. Pressing a row scrolls the story to the turn, unfolds it, moves the focus to its line and flashes its outline once in the warm ring (held still for that second under reduced motion), then pans the turn's parts clear of the panel and the sheet (revealParts). The section follows the story as it changes, keeps a focused row's focus, and is not drawn for a subagent's view or on a past commit's sheet. Below 1007 px the sheet takes the panel's place, so the section never shows there, and no session is remembered for it.

  • Keyboard (#460). Each plate holds an open button over its name and caption, named by them, beside its session badge rather than around it. Tab reaches a part's button and then its badge (Enter or Space opens the badge's list and moves the focus into it; Esc closes it and puts the focus back on the badge), the parts in the map's reading order (top to bottom, then left to right; a plate within half a plate's height of a row's highest plate reads on that row; readingOrder in ui/map-model.ts), set when the map draws; a redraw keeps the focus on the same part's button, or on its new badge, also when the badges come after the map (a new commit asks map_place again); a focused badge that a spotlit chip replaces (its list's row opened that session's story) leaves the focus on its part's button. Enter or Space opens the part's sheet, as a click does, and the page's focus ring marks the part; in a brief's order question the same press counts as a tap. Actors take no focus, since a click on them does nothing. Plates cannot be moved from the keyboard, nor the camera panned or zoomed: placement is Daniel's own arrangement, and every action the map offers stays reachable without it (#452).

  • Staleness bands (server/src/staleness.rs, ui/map-stale.ts, #392). A part whose effective tier is Core carries a mild band along its plate's foot, in the muted text tone and firmer with each band, once Daniel has not engaged with it for 3 weeks (band 1), 6 (band 2) or 12 (band 3); its plate's hint adds "You last engaged with this part 3 weeks or more ago" (6, 12), and the top of its sheet gives the band with the UTC date of the last engagement, "6 weeks or more since you last engaged with this part, on ", or, with no engagement since tracking began (the baseline, or the part's first commit when later), "6 weeks or more: not engaged since tracking began on ". The server words that line (staleness::lines, MapState.stale_why). Interface-only and Black box parts never band; a past commit's map shows none. Staleness is the time since his last entered activity on the part, never since its last commit: a brief chapter read to its end that lights it (read from fog.reads, so a chapter read before staleness shipped counts, and kept in staleness.parts too as it is read, since a brief rewritten to light its parts differently clears its fog.reads), a part catch-up, the refresher, or "I know this". Any of them clears the band at once. A part's baseline is the first time this build showed the project's map (staleness.since in map-state.json) or, when later, the committer time of the first first-parent commit on the default branch whose system-map.json lists the part's id, so nothing is stale on day one and a part added to the map, a split's new parts included, starts with no band; a newer activity beats either. That time is read from git's history of the map file once per project and part while the server runs and is never stored (staleness::births, history::part_births); the other activities are kept there per part (staleness.parts, the last one's time and kind). The bands show on the map, on the part's sheet and at pre-flight only (MapState.stale, the band of each stale part), never anywhere else.

  • The refresher (#392). A part's sheet with no fog offers Refresher in its catch-up card: the part as the map has it now, drawn by code from the map file at once, never a writer call. The sheet already shows its caption, purpose, held items, laws with their backing and links; the refresher opens inside the catch-up card, under "Caught up", and adds the flows through the part (each flow's hops on a link at the part, in order), or "No flow of the map crosses this part". Entering it is an activity on the part (map_refresher), so its band clears, and is logged (Stop rules).

  • The header's dot. A project's header in the session list carries one quiet dot, with no count, while a part whose effective tier is Core is fogged, a law is broken (below) or a PR brief is waiting (a ready PR of the project has a stored brief, as pr_briefs.rs keeps them; it counts as waiting until the PR is no longer ready); its hover names which. The page asks the server (map_marks) when the saved project list changes and when the page gains focus, never on a timer.

  • Session badges (spec #549, #562; sessionBadges, homePart and spotlightView in ui/map-live.ts, drawn by ui/map-agents.ts). Each part touched by a marked session's latest turn shows one count badge at its plate's foot: the number of distinct marked sessions on it. A session is marked while Running or Needs you, or in Your turn or Idle while unseen; an Ended session and another project's never are. A session counts on a part when its latest turn's changed files (its own and its running Workers'; a finished Worker's no longer count, though the footprint keeps them) or, while Running, its Edit, Write, MultiEdit or NotebookEdit in flight are there, and never for earlier turns; it counts once however many of its Workers are there, and a part only a Worker changed counts the Worker's session. A badge carries Needs you's colours when any of its sessions needs Daniel, a Worker's ask included; it has no shape per state. Its hint names its sessions and spotlights nothing. The badge is a button after the part's open button (see Keyboard); its press stops there, so the plate's sheet does not open, and opens its list, a badge of one session too, never the story directly. The list is one popover kept outside the map's world and placed under the badge (over it when there is no room below) by the badge's on-screen box when it opens: the sessions, Needs you first and then in the session list's order, each with its agent's logo, full name, state and the session list's own second line (secondLine), whose press opens its story; under a session, its running Workers on the part, each with its name and Needs you when it is the one asking, whose press opens its log. Hovering a row spotlights its session. One list is open at a time; Esc (a layer of its own, before the drawer and the sheet), a click outside, a second press on the badge, any pan, zoom or drag of the map, a PR brief opening, a past commit shown, a project switch and a redraw whose part no longer has a badge close it. Pressing a badge or a row of its list logs map-action. The spotlight's view: while a session is spotlit (below), each part of its latest turn shows its chip instead of the badge (its logo, full name and the Needs-you pill when it needs Daniel), its line only on its home part, and every other badge is dimmed to a third, except a Needs-you one. The home part is, while it is Running, the part that owns the in-flight edit's file; else the part with most of its latest turn's counted files (the same files as the badge, so the home is always one of its chip's parts); a tie goes to the map's reading order; an in-flight file no part owns, and any last edit of a session that is not Running, fall through. A session the session list shows with no second line (a seen Idle or Ended one) shows its chip with no line, and hovering it never asks for a summary. The marked sessions whose latest turn places no part (no changed files yet, an agent that reports no turn trees, or edits all ignored or owned by no part) are sessionBadges' notPlaced, of which the map shows only those that need Daniel (#694): one not placed line beside the map, "1 needs you · not on the map" or "N need you · not on the map" (notPlacedLine), in Needs you's colour, bare on the map with no glass. Running, Your turn and Idle sessions that place no part, Unseen ones included, get nothing on the map, since the session list already marks them; with no such session that needs Daniel there is no line at all. A Needs you session whose latest turn places a part is counted on its badge, never on the line. The line is a button that cannot open into a list, with no rows and no spotlight: its hint names the sessions it counts and says that a press opens the next one, and its press opens the story of the next such session after the one open in the left panel, in the session list's order, wrapping, or the first with none open (notPlacedTarget, which is nextNeedsYou's rule over these sessions), and logs map-action. Its slot keeps its height while a sheet is open even with no line, so the sheet under it never moves (#472). hideAgents(true) clears every badge, chip and the list, for a view of a past commit. Placement is per path (#559): map_place is asked one group per distinct path (every file of every turn within the 7-day cut of the shown project's sessions, and each Running session's edit in flight), and the page folds the answers back per session, Worker and turn (ui/map-live.ts); the call and its "ask only when the paths changed" cache are unchanged.

  • The footprint and the spotlight (spec #549, #559; ui/map-live.ts). The spotlit session is the one whose session list, History or badge list row the pointer is on, else the one open in the left panel; none while a PR brief plays or a past commit shows. A hover ends when the pointer leaves the row, and also when the row leaves the page (a session moving to History, a redraw, the left panel closing), its list closes (a badge's list) or its session leaves the shown project, so a stale hover never hides the open session's footprint. Its footprint is every part its turns of the last 7 days changed, its Workers' files included: corner brackets just outside each plate, in the neutral text tone (no hue and no warm, so they read apart from fog, the warm ring of a brief or the sheet's part, a predicted part's dashed outline and a broken law's red edge), firm on its latest turn's parts (with a Running session's edit in flight) and faint on its earlier turns'. One footprint shows at a time: a hovered row's replaces the open session's, which comes back when the hover ends. A turn counts when its end, or its start if it never ended, is within 7 days of now (CUT_MS, mirroring core's SINCE_MS), whatever files core still holds for it; files owned by no part and ignored files mark nothing. A hovered row whose session touched no part in the last 7 days says "Touched no part in the last 7 days" in its hover text. The map turns to it (see Session badges).

  • A story's turn on the map (spec #549, #560; turnLight in ui/map-live.ts, drawn by ui/map-agents.ts). Hovering or focusing a turn in the open story lights the parts it changed, its Workers' files included, with a class of its own (turn-lit) drawn in a brief's lit ring; it dims nothing and moves no camera, and leaving the turn or a redraw of the feed clears it. Unfolding an earlier turn, or the newest turn's "Show on map", calls revealParts with its parts, within its limits: it pans on x only, leaves a span wider than the clear band where it is, and a pan saves Daniel's view. A turn past the 7-day cut, or with no files, lights and reveals nothing; one past the cut of an agent that records turn files says so in the story (The story rail). While a PR brief plays none of this acts.

  • Broken laws (server/src/ci_laws.rs). The server asks gh for the latest finished run of studio.yml on the default branch when the view opens, when the window gains focus while it is open and when a task is first seen merged, never on a timer, and keeps the answer in memory. While a newer run is going it keeps the last finished one and says so ("for an earlier commit"). When that run failed it fetches the failed log and reads the failing tests of cargo nextest (FAIL [..] binary name) and of Node's test runner (TAP not ok, or the spec reporter's ✖). A law's test is the function right after its @law: <id> tag, read from the run's commit; only a failure of that test marks the owning part: a red dot and rim on its plate, and one line, "A test that backs laws here failed on main", in its sheet's CI section and in the header's dot; the top of its sheet says "A check behind a law of this part failed in main's latest CI, ", the UTC date the run finished (Ci.at, GitHub's updatedAt; no date in an answer kept before #495). The law is never named, nor its test. Another test failing in the same file marks nothing. A missing mark means only "no known failure": a run that failed before the tests ran (fmt, clippy, build) or in untagged tests says "the law tests did not run", one whose log cannot be fetched or holds nothing says so, and a passing run says "passed"; none of these marks a part. The header's dot reads the answer in memory, so a project shows it once its Map view has been opened since Studio started.

  • The drawer (ui/map-drawer.ts) opens read-only under the part sheet and shows blocks of code or text with jumps out of it. "See the proof" on a law a check backs shows the tagged test from its @law: line to its closing line, read from the default branch; "See the CI log" on a part that holds a check-backed law or a broken one shows the run's status and the end of its failed log, with "Open on GitHub". Esc closes the drawer before the sheet. openDrawer(drawer) takes any Drawer (ui/map-model.ts), which is how the history strip shows a commit's files.

  • The Map diff (#640, ui/map.ts's diff mode, setDiff): while a PR brief plays on its PR's Map diff (PR briefs), the view draws the live map (fog, laws, badges, staleness) from the document's copy of today's map, with the PR's new parts, actors, lines and laws and its removed ones in it, in treatment B of spec #634's prototype. There is no new colour, and the marks are outlines and words, never a box-shadow, so they hold in forced colours: a new part has a lighter fill, a 2 px solid edge in the text tone and "New" over its top edge; a removed part is a ghost, with no fill, a hair dashed edge in the muted tone, its name and caption struck and "Gone"; an edited part says "Edited". The word is the first of the part's button, so it is read before the name. A new line is 2.5 px in a bright link tone, a removed one dashed; an added law has a ring around its diamond, on a plate or a line, and a removed one is a faint hollow diamond. A new actor's label is in the text tone, a removed one's struck. The tokens are --diff-* in ui/tokens.css. Under the brief a ghost dims with the rest; a ghost the step lights keeps its dashed outline outside the warm ring. A new part with no saved spot is placed and saved at once, as any new part, so it stays where it was once the PR lands; a ghost uses the spot it had (positions are never pruned), else one placed and not saved. A scrubbed past commit draws without the diff. Every plate, actor, line and law diamond carries the id of its mark (data-mark: part:<id>, actor:<id>, line:<end>|<end> with the ends sorted, law:<id>), which Ratify's rows light (#643, PR briefs) with ratify-lit, drawn in the brief's warm ring tokens: the ring on a plate or a law's diamond on a plate, a warm stroke on a line or a line's diamond, a warm outline on an actor; a mark the brief dims shows in full while lit, a lit ghost keeps its dashed outline outside the ring, and under forced colours the ring is an outline in the system's highlight colour.

  • The history strip (server/src/history.rs, ui/map-history.ts) is the body of a part's sheet's History fold, its last: the first-parent commits on the default branch, from the commit that introduced system-map.json, that touched the part (placed by the union of the commit's map and its parent's, or that added or removed it), oldest first, each as #PR title when the subject ends (#N), else the subject. A commit Daniel has not caught up on (its fog entries) has a filled dot, an older one a hollow dot. Clicking a commit shows the map as of it, read leniently so a field of another time never breaks it and a deleted part still shows: read-only, with no fog, no broken-law mark, no live agents, no not placed line, and the sheet without tier change, proof, fog or CI. A quiet banner says "Viewing · Back to now". A commit's "Files" opens its changed files and diffs in the drawer, with "Open on GitHub" when origin is on GitHub. A scrub is one call, scrubTo (ui/map-history.ts), which asks the server's map_at.

Seen

One helper, watchSeen (ui/seen.ts), decides when something counts as seen: it covers at least half of itself or at least half of the viewport (so a card taller than twice the viewport can be seen) for 500 ms without a break, in a visible and focused window, with the view that holds it open (the Map view). It fires once. The story rail's cards use it, so a card is told as shown when seen and not when it is built; stored shown times are not rewritten.

Stop rules

Studio always keeps a quiet count of what Daniel uses of the map, with no setting and nothing shown (server/src/stop_rules.rs, ui/stop-rules.ts). The window tells the server, which appends one line per event to stop-rules.jsonl in the data folder; a line this build cannot read is skipped, so an older or newer log never breaks it. Events, each with its local calendar day and, bar the first, its project:

  • session: the session list had a session that day (once a day).
  • map-open: the Map view opened on the project (once a day).
  • map-action: an entered action on the map with no event of its own, a part's sheet opened or a session badge or a row of its list pressed (once a day).
  • scrub: a commit of a part's history strip was shown (scrubTo).
  • proof: the drawer opened, from "See the proof", the CI log or a commit's files.
  • know: "I know this" cleared a part's fog. Kept on its own, with no threshold in project 2.
  • refresher-entered: a part's refresher was entered. stale-entered, beside it, when the part had a staleness band; a part catch-up entered from a stale part logs it too.
  • dismissed: the review of one module was dismissed for the project; the line names the module. An older line with no module, from when dismissal was one flag per project, counts as dismissing the modules of its time (Map view, history strip, See the proof, PR briefs and the skipping note).
  • pre-flight-run: a pre-flight framed its parts on the map, predicted or picked by hand. An entered action.
  • back-law-started: a back a law run was started from a law on trust in a part's sheet (Background runs). An entered action.
  • The PR brief's events (brief-offered, brief-opened, chapter-done, check-answered, ratify, unconfirmed-seen), each with its PR, and the part catch-up's (catch-up-offered, catch-up-opened, catch-up-done) are in PR briefs.

An active day is a local calendar day with a session or map-open event. An engaged day is an active day with at least one entered action on the project's map: map-action, scrub, proof, know, brief-opened, chapter-done, check-answered, ratify, refresher-entered, stale-entered, catch-up-opened, catch-up-done, pre-flight-run or back-law-started. A day the map was only open on is not one, and an older log's mark-seen lines count for nothing. A project's merged PRs are the first-parent commits on its default branch whose subject ends (#N) or starts Merge pull request #N, counted since the first event was logged, so the count starts when tracking does. The server hands the window these counts (stop_facts) and the window evaluates them (unused), only when the Map view opens, never on a timer.

The review is due once a project has 14 active days and 20 merged PRs, whichever comes last. It lists only the modules below their threshold: the Map view (4 engaged days), the history strip (scrubbed twice), See the proof (the drawer opened twice) and PR briefs (opened for a quarter of the merged PRs that had one offered; with a note when "I know this" cleared more fog than finished chapters did), part catch-ups (3 read to their end), Pre-flight (run twice), the refresher (entered twice), staleness bands (one refresher or part catch-up entered from a stale part), explain-back (3 lines written in the end-of-story bar) and Back a law (one run started). A part turns stale 3 weeks after its staleness baseline at the earliest, so the refresher and staleness bands are judged no earlier than 5 calendar weeks after the project's staleness baseline (its first map shown with that build; the facts carry it as stale_since) or its first logged day, whichever is later, and not at all before it has a baseline. It is one quiet sentence with a Dismiss button, never a score, a streak or a count. It shows in the Map view's head only. Dismiss dismisses the modules the sentence named, per project and for good, while the log goes on; a module it did not name, or one whose exception ends later, still shows in a later review.

How a module joins the review. Each module is one row of table in ui/stop-rules.ts: its module id, its name in the sentence (or a note, its own sentence, for a note such as skipping), its kept bar over the facts the server hands over, and at most one exception before which it is not judged at all: wait (a calendar wait of some weeks from from, the module's rollout day or a day read from the facts, such as the staleness baseline, or from the project's first logged day when that is later) or offers (at least least events of one kind logged for the project). A module adds its event kinds to Kind in server/src/stop_rules.rs and StopKind in ui/types.ts; the facts carry every kind's count for the project (counts), so a bar or an offer count over plain counts needs no new field, and entered says whether a kind makes an engaged day. A dismissal is stored with the row's module id, so the id never changes once shipped.