{"modulePath":"github.com/intentdriven/abcd","version":"v0.17.1","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package implement\n\nPackage implement is the run machinery an autonomous implementation run calls: the run's shared state in the machine-scoped store, the sessions that join it, the claim that makes a record the unit of exclusion between them, the bounds that keep a second session from becoming a hazard, and the run log the comparison of division modes is derived from (itd-2609221656373558, spc-2609221657588816).\n\nEverything lives under one directory per repository:\n\n\t~/.abcd.noindex/runs/\u003croot-sha\u003e/\u003cYYYY-MM-DD\u003e.jsonl   the run log, one event per line\n\t~/.abcd.noindex/runs/\u003croot-sha\u003e/claims/\u003crecord\u003e.json one claim per record\n\t~/.abcd.noindex/runs/\u003croot-sha\u003e/sessions/\u003cid\u003e.json   one record per joined session\n\nThe key is the repository's root-commit SHA, the same key and the same full form the transcript, history and voyage stores use (internal/core/history's location.go says why: a checkout moves, is renamed and is cloned twice, while its root commit changes under none of that). Two sessions in two worktrees of one repository therefore share one directory and no repository file.\n\nThe package is the seed the implement loop builds on (itd-2609201916151817: \\`implement step\\` and \\`implement receipt\\`) and the pacing verb reads (itd-2609201925079472): a Run is the handle a later state file hangs off, and the log is the measurement both inherit. Core never writes to stdout; the CLI front door formats what these functions return.\n\n## Constants\n\n```go\nconst (\n\tMinLease = lease.Min\n\tMaxLease = lease.Max\n)\n```\nLease bounds, the shared lease package's. A lease shorter than a minute lapses under its own gate run; a lease longer than a day outlives any window the run keeps.\n\n```go\nconst (\n\tSitePreflight   = \"preflight\"\n\tSiteEvalHarness = \"eval-harness\"\n)\n```\nThe sites the check runs at.\n\n```go\nconst (\n\t// LoadOK: nothing to warn about.\n\tLoadOK = \"ok\"\n\t// LoadWarning: at least one trigger fired.\n\tLoadWarning = \"warning\"\n\t// LoadSkipped: a CI runner, where the check does not run.\n\tLoadSkipped = \"skipped\"\n\t// LoadUnchecked: the machine could not be read (an unsupported platform, or\n\t// a read that failed) and nothing fired on what could be read.\n\tLoadUnchecked = \"unchecked\"\n)\n```\nThe four statuses.\n\n```go\nconst (\n\tLimitsDefault               = \"default\"\n\tLimitsFile                  = \"file\"\n\tLimitsDefaultAfterMalformed = \"default-after-malformed\"\n)\n```\nWhere the limits came from.\n\n```go\nconst (\n\tCoresOnline  = \"online\"\n\tCoresRuntime = \"runtime\"\n)\n```\nThe core-count sources.\n\n```go\nconst (\n\tPrivateNameMask  = \"[private name]\"\n\tWithheldNameMask = \"[name withheld: private-names layer unreadable]\"\n)\n```\nPrivateNameMask replaces an own stray's name the private banned-names layer matches; WithheldNameMask replaces every name when that layer cannot be read.\n\n```go\nconst (\n\t// DiskOK: every volume read has at least the floor free; Reason says\n\t// when a volume could not be read beside one that was.\n\tDiskOK = \"ok\"\n\t// DiskLow: at least one volume has less than the floor free.\n\tDiskLow = \"low\"\n\t// DiskUnknown: no volume could be read (an unsupported platform, or reads\n\t// that failed); nothing is refused for it.\n\tDiskUnknown = \"unknown\"\n)\n```\nThe disk statuses.\n\n```go\nconst (\n\tDiskHoldsGoCache       = \"go-build-cache\"\n\tDiskHoldsWorktreeStore = \"worktree-store\"\n)\n```\nWhat a volume holds.\n\n```go\nconst (\n\tMemoryFloorMacOSKey = \"load.memory_floor_macos\"\n\tMemoryFloorLinuxKey = \"load.memory_floor_linux\"\n)\n```\nThe machine configuration keys of the memory floor.\n\n```go\nconst (\n\tDefaultMemoryFloorMacOS = machineload.MemoryWarn\n\tDefaultMemoryFloorLinux = 10\n)\n```\nThe floors that apply when the person sets none: macOS's warning level, and on Linux 10% of the last ten seconds stalled.\n\n```go\nconst (\n\tSlotsDefault = \"default\"\n\tSlotsMachine = \"machine\"\n\tSlotsEnv     = \"env\"\n)\n```\nWhere the count came from.\n\n```go\nconst (\n\t// GateTests is the first gate, before any of a preflight's stages.\n\tGateTests = \"tests\"\n\t// GateRace is the race gate, before the race stage (--race-gate).\n\tGateRace = \"race\"\n\t// GateNarrow is a narrow run's own gate (load_narrow.go).\n\tGateNarrow = \"narrow\"\n)\n```\nThe gates a waiter waits at.\n\n```go\nconst (\n\t// WaitOpen: every condition held open and the hold was taken.\n\tWaitOpen = \"open\"\n\t// WaitTimedOut: the timeout passed with a condition still shut.\n\tWaitTimedOut = \"timeout\"\n\t// WaitSkipped: a CI runner, where there is no one else's work to wait for.\n\tWaitSkipped = \"skipped\"\n\t// WaitUnchecked: a platform whose load and processes abcd cannot read; the\n\t// waiter opens without judging, and says so.\n\tWaitUnchecked = \"unchecked\"\n)\n```\nThe waiter's statuses.\n\n```go\nconst (\n\t// WaitOnLoad: the one-minute load average is not below the wait limit.\n\tWaitOnLoad = \"load\"\n\t// WaitOnRaceRun: another go test -race run is live (at the first gate,\n\t// only while one preflight runs at a time).\n\tWaitOnRaceRun = \"race-run\"\n\t// WaitOnLock: another waiter's hold is in force.\n\tWaitOnLock = \"lock\"\n\t// WaitOnUnreadable: the load or the process table could not be read.\n\tWaitOnUnreadable = \"unreadable\"\n\t// WaitOnPreflight: another make preflight, of any account, is running (with\n\t// more than one slot: every slot is taken, by at least one preflight).\n\tWaitOnPreflight = \"preflight\"\n\t// WaitOnWaiter: another waiter, of any account, is queued ahead of this one\n\t// or running the command it gates.\n\tWaitOnWaiter = \"waiter\"\n)\n```\nThe conditions that hold the gate shut.\n\n```go\nconst (\n\tHoldSettle  = \"settle\"\n\tHoldCommand = \"command\"\n)\n```\nThe two hold forms.\n\n```go\nconst (\n\tWaitHoldFileName     = \"load-wait.json\"\n\tWaitRaceHoldFileName = \"load-wait-race.json\"\n)\n```\nWaitHoldFileName is the first gate's hold record under ~/.abcd.noindex/, and WaitRaceHoldFileName the race gate's. Each gate judges and takes only its own (holdFileName); the first gate's keeps the name it had before the race gate existed, so an abcd released before it reads the same record.\n\n```go\nconst (\n\tEventSessionOpen   = \"session_open\"\n\tEventSessionClose  = \"session_close\"\n\tEventWindowMode    = \"window_mode\"\n\tEventClaim         = \"claim\"\n\tEventClaimDenied   = \"claim_denied\"\n\tEventClaimLapsed   = \"claim_lapsed\"\n\tEventClaimReleased = \"claim_released\"\n\n\tEventBackoff     = \"backoff\"\n\tEventLaneOpen    = \"lane_open\"\n\tEventLaneClose   = \"lane_close\"\n\tEventAgentStart  = \"agent_start\"\n\tEventAgentEnd    = \"agent_end\"\n\tEventCeilingWait = \"ceiling_wait\"\n\tEventGateRun     = \"gate_run\"\n\tEventReview      = \"review\"\n\tEventFallback    = \"fallback\"\n\tEventStop        = \"stop\"\n\tEventRefusal     = \"refusal\"\n\tEventPR          = \"pr\"\n\tEventCapture     = \"capture\"\n\t// EventContext is an orchestrator's context measurement: used_pct (the share\n\t// of its context window in use), role and note. The run measures it because\n\t// it is also an experiment in keeping a session alive for days.\n\tEventContext = \"context\"\n\t// EventCeilingOverrun is a session going over its agent ceiling: alive (the\n\t// agents alive), ceiling, lane and minutes (how long it was over). The verb\n\t// refuses an agent_start past the ceiling, so an overrun is what the host\n\t// did anyway — a fork, an agent started outside the log — and says so.\n\tEventCeilingOverrun = \"ceiling_overrun\"\n\n\t// The evidence events: what an autonomous run records so a later run can be\n\t// built to need no person. An intervention is a person acting on the run\n\t// (kind, by, what, why, autonomy_gap — what abcd or the host would need so\n\t// no person is needed — and optionally at and detected_after_min); a stop is\n\t// a stall (cause, and optionally last_productive, noticed_after_min and\n\t// recovery); a decision is a judgement call a person would normally make\n\t// (what, alternative, why, and optionally at).\n\tEventIntervention = \"intervention\"\n\tEventDecision     = \"decision\"\n\n\t// EventLoad is the load check's warning (itd-2609231434459890), written by\n\t// `implement load` alone and only when it warns inside a live run. The run's\n\t// hand-kept load samples share the name and carry no `triggers`, which is how\n\t// a reader tells the two apart.\n\tEventLoad = \"load\"\n)\n```\nEvent names. The first group is written only by this package's verbs, so the log cannot claim a join, a window or a claim that the run state does not hold.\n\n```go\nconst (\n\tServiceNetwork = \"network\"\n\tServiceModel   = \"model\"\n)\n```\nThe services an outage can take down.\n\n```go\nconst (\n\t// OutageHost is the host's own model calls stalling.\n\tOutageHost = \"host\"\n\t// OutageAgent is a sub-agent coming back failed mid-task.\n\tOutageAgent = \"agent\"\n\t// OutageTool is a tool's network call failing: git push, gh, a download.\n\tOutageTool = \"tool\"\n)\n```\nThe kinds of report: what noticed the lost connection.\n\n```go\nconst (\n\tOutageOpen   = \"open\"\n\tOutageGaveUp = \"gave_up\"\n)\n```\nAn outage's status. An outage that ends is removed, so the record only ever holds one of these two.\n\n```go\nconst (\n\tEventOutageStart  = \"outage_start\"\n\tEventOutageProbe  = \"outage_probe\"\n\tEventOutageEnd    = \"outage_end\"\n\tEventOutageGiveUp = \"outage_give_up\"\n)\n```\nThe outage events, written by the outage verbs alone.\n\n```go\nconst CoverageGapAfter = 6 * time.Hour\n```\nCoverageGapAfter is how long before the run's last line a measured event's last line may fall before the report names its coverage as stopping.\n\n```go\nconst DefaultLease = lease.Default\n```\nDefaultLease is how long a claim holds when the caller names no lease: the shared lease package's default, long enough for a lane's build-and-gate cycle, short enough that a session that died mid-lane frees its record within the same working window.\n\n```go\nconst DiskFloorMin uint64 = 8 \u003c\u003c 30\n```\nDiskFloorMin is the lowest the floor goes, whatever the slots: one cold preflight's 4 GiB, and as much again for everything else writing to the volume while it runs.\n\n```go\nconst DiskPerPreflight uint64 = 4 \u003c\u003c 30\n```\nDiskPerPreflight is the free space the floor keeps for each preflight the gate admits at once. Measured on 29 Oct 2026, the stages one \\`make preflight\\` of this module builds (go build, go vet, go test and go test -race over internal/), run into an empty build cache, wrote 1.9 GiB of cache entries, and their test binaries took another 1.9 GiB of the temporary directory at the peak: about 4 GiB for one cold preflight.\n\n```go\nconst DiskTrimMinLeft = 5 * time.Minute\n```\nDiskTrimMinLeft is the least of a waiter's --timeout that must be left for it to start the trim at the floor. The trim walks a large cache for minutes and cannot be stopped part way (worktree.TrimForFloor takes no deadline), so a waiter with less left starts none: it says so on stderr and in the report's disk\\_trim, and refuses at the floor at once, as it did before the trim existed. Five minutes keeps a lane's two-minute wait from ever running over its timeout, or its harness's ten-minute command cap, for a trim. A longer wait still has its trim bounded only by this much of its time.\n\n```go\nconst HoldWatchEvery = time.Minute\n```\nHoldWatchEvery is how often the holder's own watch looks while its command runs. Each look is a run of ps, so it looks less often than a waiter polls.\n\n```go\nconst JoinGrace = time.Minute\n```\nJoinGrace is how long before a window\\_mode a session\\_open may be logged and still count in that window.\n\n```go\nconst MaxCeiling = 64\n```\nMaxCeiling bounds a stated agent ceiling.\n\nThe ceiling is a session's own limit on the agents it runs at once — for the second session, on top of the first session's (itd-2609221656373558, criterion 5). The session states it on joining, and the record and the session\\_open line carry it. abcd runs no agent, so what it holds the ceiling against is what the session declares: the agents its own agent\\_start and agent\\_end lines leave alive (Run.AgentsAlive). An agent\\_start past the ceiling is refused and the refusal logged, and every check reports the count beside the ceiling. An agent the session never logs — a fork, one the host started outside the log — is invisible, so the count is a discipline the session keeps with the verb's help, not a census of processes (iss-2609240646542516).\n\n```go\nconst MaxNarrowRuns = 32\n```\nMaxNarrowRuns bounds the limit. The load limit and the memory floor are what bound the machine, so it only catches a slip of the keyboard.\n\n```go\nconst MaxPreflightSlots = 4\n```\nMaxPreflightSlots bounds the count. The product thinker approved a measured trial of two preflights at once (dcn-2610161814279204), and on 2026-10-28 asked for the machine's capacity to be used, so four is the most either place may set: one race run at a time (the race gate) and the load limit stay the bounds, each stage's -p is the cores divided among the slots (machineload.GoTestParallelism), and the count is the person's own setting. A larger value is refused saying so (slotsRangeError).\n\n```go\nconst MaxWholeRunMarkers = 256\n```\nMaxWholeRunMarkers bounds how many folder entries one read or sweep looks at: a machine runs a handful of whole runs at once. It bounds the look, not the folder: past it a marker may go unread, which counts its run as not live, today's rule. Two kinds of file the sweep leaves can take up those entries: a later build's marker (a higher schema version), which this build never removes whatever its pid, and a refused file named for a pid the reading holds, which stays while that pid lives. Both fail safe: the reader counts neither, and a marker crowded out falls back to the two-wake rule.\n\n```go\nconst NarrowRunCores = 2\n```\nNarrowRunCores is what one narrow run is bound to, in cores (NarrowEnv): a ceiling on what they took as measured on a 16-core Mac Studio on 2026-11-04, from about 0.2 for a three-package run mostly waiting on git to under 2 for internal/core/implement, 14.5 seconds on at most 27 seconds of CPU. Almost none of abcd's tests are parallel, so a bound at two costs a test run little.\n\n```go\nconst NarrowRunsKey = \"load.narrow_runs\"\n```\nNarrowRunsKey is the machine configuration key of the narrow runs' limit. It has no environment variable of its own, and no repository file sets it; like load.preflights it follows the process's home.\n\n```go\nconst NetworkProbeTimeout = 20 * time.Second\n```\nNetworkProbeTimeout bounds the network probe's call to the remote.\n\n```go\nconst PreflightSlotsEnv = \"ABCD_LOAD_PREFLIGHTS\"\n```\nPreflightSlotsEnv is the environment variable a trial sets the count with.\n\n```go\nconst PreflightSlotsKey = \"load.preflights\"\n```\nPreflightSlotsKey is the machine configuration key.\n\n```go\nconst ProbeLease = 2 * time.Minute\n```\nProbeLease is how long a probe's holder keeps it: longer than the network probe's own timeout, so a live probe never lapses, and short enough that a holder that died mid-probe holds the other lanes for minutes, not hours.\n\n```go\nconst ProbeResultWait = ProbeLease - NetworkProbeTimeout - 10*time.Second\n```\nProbeResultWait bounds how long a finished probe waits for the run's lock to write its result: well inside the lease the probe holds (ProbeLease less the network probe's own bound), so a result that waited is still the lease holder's to write.\n\n```go\nconst QuietShare = 0.1\n```\nQuietShare is the most CPU, in cores, a tree may average over QuietSpan and still be called quiet: a tenth of one core, sixty seconds of CPU in ten minutes. A go test that is compiling or running CPU-bound tests uses whole cores, so the line falls well below the least such work does; a run that is mostly waiting falls under it, which is what the waiters are told.\n\n```go\nconst QuietSpan = 10 * time.Minute\n```\nQuietSpan is how long a holder's tree must have used little CPU before the waiters are told. A test stage that is compiling or running tests shows CPU within minutes even on a loaded machine, so ten minutes outlasts any pause in that work, and is well short of the 45 minutes the slow run that prompted it held its slot.\n\n```go\nconst UnreadableClaimGrace = time.Minute\n```\nUnreadableClaimGrace is how long a claim file nobody can parse holds its record, counted from the file's modification time. Every claim is written under the run's lock in one create, so an unparseable file is a writer killed between the create and the write; the grace is only long enough that a reader racing that writer backs off rather than taking the record.\n\n```go\nconst UnsetMode = \"unset\"\n```\nUnsetMode labels the events logged before any window opened.\n\n```go\nconst WaitBackoffCap = 3\n```\nWaitBackoffCap bounds how many times one wait stands back from another waiter that opened in the same moment (machineload.StandBackFrom). A waiter that has stood back this many times opens without that last look, as it did before the look was added, so no wait goes round for ever.\n\n```go\nconst (\n\tWaitMemoryAdmitFileName = \"load-memory-admit.json\"\n)\n```\nWaitMemoryAdmitFileName is the memory admission record under ~/.abcd.noindex/, and waitMemoryLockFileName the lock every write of it is taken under.\n\n```go\nconst WaitNarrowCarryFileName = \"load-wait-narrow-carry.json\"\n```\nWaitNarrowCarryFileName is the record of the narrow waits' carried budgets under ~/.abcd.noindex/.\n\n```go\nconst WaitNarrowHoldFileName = \"load-wait-narrow.json\"\n```\nWaitNarrowHoldFileName is the narrow gate's hold record under ~/.abcd.noindex/. No abcd built before the class reads it.\n\n```go\nconst WaitOnMemory = \"memory\"\n```\nWaitOnMemory: the system reports memory pressure at or above the floor, or, after pressure was last seen, another waiter opened within the settle.\n\n```go\nconst WaitOnWholeRun = \"whole-run\"\n```\nWaitOnWholeRun: a whole-run waiter that started earlier is overdue, so this narrow run stands aside for it (machineload.OverdueWhole).\n\n```go\nconst WaitRaceCeilingFactor = 6\n```\nWaitRaceCeilingFactor bounds the race gate's paused clock: a race waiter whose queue keeps progressing gives up once this many times its timeout has passed since it started, so \\`make preflight\\`'s two hours stretch to twelve at most, its first gate's own timeout.\n\n```go\nconst WholeRunKind = \"whole\"\n```\nWholeRunKind is the kind a whole run's marker carries; a reader counts no other.\n\n```go\nconst WholeRunsLeaf = \"whole-runs\"\n```\nWholeRunsLeaf is the markers' folder under abcd's home.\n\n## Variables\n\n```go\nvar (\n\t// WaitMemorySettle is how long, after a waiter opened inside an episode,\n\t// every other waiter stays shut on memory: the same as WaitSettle, long\n\t// enough for the stage admitted to show its own memory use.\n\tWaitMemorySettle = WaitSettle\n\t// WaitMemoryEpisode is how long after any waiter last saw the pressure at\n\t// or above the floor the gate admits one run per settle; past it the gate\n\t// admits as it does with no floor.\n\tWaitMemoryEpisode = 10 * time.Minute\n)\n```\nThe memory admission's intervals. They are variables only so the front door can read them into its help; nothing reassigns them.\n\n```go\nvar (\n\t// WaitNarrowSettle is how long a narrow run's hold lasts: its go test shows in\n\t// the table at once, and thirty seconds is enough for a one-minute load average\n\t// to show a good part of its two cores before the next opens, so four take at\n\t// least a minute and a half to open rather than a burst the load never saw.\n\tWaitNarrowSettle = 30 * time.Second\n\t// WaitNarrowJitterMin and WaitNarrowJitterMax bound the wait between the look\n\t// that finds the gate free and the re-check that opens it.\n\tWaitNarrowJitterMin = time.Second\n\tWaitNarrowJitterMax = 5 * time.Second\n\t// WaitNarrowYieldAfter is how long a whole-run waiter may be queued, with a slot\n\t// free, before narrow runs stand aside for it. It opens within a poll and a jitter of\n\t// a free slot and a load under the limit, about 75 seconds, so this is well past\n\t// a waiter that is simply about to open.\n\tWaitNarrowYieldAfter = 5 * time.Minute\n\t// WaitNarrowYieldCap is the most one narrow wait stands aside: a one-minute load\n\t// average shows most of a fall inside it.\n\tWaitNarrowYieldCap = 5 * time.Minute\n\t// WaitNarrowQueueCap is how long narrow runs queued ahead may alone keep one shut\n\t// with a place free. A waiter of this code takes a free place within a poll, a\n\t// jitter and its account's hold, under a minute even on a slow table, and each\n\t// that leaves starts the count again, so a queue that is moving never reaches\n\t// this; one overtaking another costs the other nothing it can notice.\n\tWaitNarrowQueueCap = 2 * time.Minute\n)\n```\nThe narrow gate's intervals. They are variables only so the front door can read them into its help; nothing reassigns them.\n\n```go\nvar (\n\t// WaitDefaultTimeout is the front door's --timeout default. Thirty minutes\n\t// ended every gated test of 2026-11-04's thirty builders with no test run. A\n\t// whole run may wait behind many others, each an hour on a busy machine, and\n\t// six hours is what those sessions came to pass by hand. A wait costs a poll\n\t// every WaitPollInterval, and a waiter ahead whose own account's limit keeps\n\t// it shut delays the whole-run queue behind it until this passes, which\n\t// WaitCrossedCap's rule bounds only for a crossed one.\n\tWaitDefaultTimeout = 6 * time.Hour\n\t// WaitPollInterval is how often the machine is read while waiting.\n\tWaitPollInterval = 15 * time.Second\n\t// WaitSettle is how long the plain form's hold lasts.\n\tWaitSettle = 2 * time.Minute\n\t// WaitCommandCap is the longest the command form's hold lasts. It only\n\t// bounds a hold nothing else releases: the command starting its own race\n\t// run, the command exiting, or its holder dying or its pid being reused\n\t// each end the hold first. Twenty minutes was too short: a preflight on a\n\t// loaded machine takes longer than that to reach its race step, so the hold\n\t// lapsed while its holder was alive and a second preflight was admitted.\n\tWaitCommandCap = 60 * time.Minute\n\t// WaitJitterMin and WaitJitterMax bound the random wait between a look\n\t// that finds the machine free and the re-check that opens the gate.\n\tWaitJitterMin = 15 * time.Second\n\tWaitJitterMax = 60 * time.Second\n\t// WaitOpenPause is how long the command form waits after it opens, showing\n\t// in the process table as running its command, before it looks once more\n\t// for another waiter that opened in the same moment (WaitLoad).\n\tWaitOpenPause = 2 * time.Second\n)\n```\nThe waiter's intervals. They are variables only so the front door can read them into its help; nothing reassigns them.\n\n```go\nvar CoverageEvents = []string{EventLaneOpen, EventLaneClose, EventAgentStart, EventAgentEnd, EventGateRun}\n```\nCoverageEvents are the hand-kept events the report's figures rest on and a run writes throughout, so their stopping partway is a gap, not a lull.\n\n```go\nvar DefaultSchedule = Schedule{\n\tWaits:     []time.Duration{time.Minute, 5 * time.Minute, 10 * time.Minute},\n\tHourly:    time.Hour,\n\tHourlyFor: 8 * time.Hour,\n}\n```\nDefaultSchedule is the product thinker's (interview of 2026-10-09): one minute, five, ten, then hourly for up to eight hours.\n\n```go\nvar ErrContention = errors.New(\"contention\")\n```\nErrContention is the class of every \"someone else holds it\" outcome: a record another session has claimed, or the run state locked by another session's mutation. It is not a fault: the caller backs off and tries other work. The CLI maps it to exit 3.\n\n```go\nvar ErrRefused = errors.New(\"refused\")\n```\nErrRefused is the class of every refusal: an input the verb does not recognise, a session that has not joined, or a bound the caller's role does not permit. Nothing is written for the refused act (the refusal itself may be logged). The CLI maps it to exit 2.\n\n```go\nvar InterventionKinds = []string{\n\t\"session_open\", \"account\", \"ruling\", \"restart\", \"close_session\", \"file_restore\", \"permission\", \"other\",\n}\n```\nInterventionKinds is the closed vocabulary of an intervention's kind.\n\n```go\nvar LimitsFileDisplay = abcdhome.Display(machineload.LimitsFileName)\n```\nLimitsFileDisplay is the settings file as every report names it.\n\n```go\nvar ReadDisk = func(home string, floor uint64) DiskCheck { return checkDisk(home, realDiskProbe(floor)) }\n```\nReadDisk judges the free space for the account whose home is home (\"\" is this process's) against floor (diskFloorFor). It is a variable only so tests replace it: the core's own tests by default (load\\_disk\\_test.go), so none reads the real disk unless it asks.\n\n```go\nvar ReadMemory = machineload.ReadMemory\n```\nReadMemory reads the machine's memory pressure where a request names no reader of its own (WaitRequest.ReadMemory, LoadRequest.ReadMemory). It is a variable only so tests replace it: the core's and the front door's own tests by default, so none reads the real machine's pressure unless it asks.\n\n```go\nvar TrimAtFloor = worktree.TrimForFloor\n```\nTrimAtFloor runs, as of now, the paced cache trim of each toolchain the checkout whose root is dir uses, for the account whose home is home (worktree.TrimForFloor). It is a variable only so tests stand in for it: the package's own tests replace it by default, so none trims a real cache.\n\n```go\nvar WaitCrossedCap = 5 * time.Minute\n```\nWaitCrossedCap is how long crossed waiters (machineload.Ahead.Crossed), queued ahead by start with a higher pid, may alone hold a wait's gate shut on end before it stops counting them. One of them may be a waiter built before the start order, which waits on every lower pid and so on this one, and each would wait on the other until its timeout. A waiter of this code or v0.15.1's waits on no later start, so another account sees it queued while the machine is free only for what its own account alone sees: its account's settle hold (WaitSettle), the poll after it, its jitter and its open look, which the cap outlasts. Its account's slots (load.preflights) are the person's own as well: at one slot a running preflight or a live race run holds its gate shut, where at two it leaves a slot free. So the cap counts only at looks where nothing but crossed waiters would hold the gate shut at one slot, the strictest setting; counting at this account's own slots let later starters at two pass an earlier crossed waiter at one for hours (iss-2611151649449938). One held shut longer by its own account's stricter wait limit or memory floor is passed, as v0.15.1 passes every crossed waiter.\n\n## Functions\n\n```go\nfunc DiskFloor(home string) uint64\n```\nDiskFloor is the floor the load gate judges the disk by for the account whose home is home (\"\" is the machine home): the heartbeat reports the free space against it (iss-2611220942554289), so both read one floor.\n\n```go\nfunc HoldFileName(gate string) string\n```\nHoldFileName is the hold record of gate, GateTests or GateRace, as the front door names it in a message.\n\n```go\nfunc IsNetworkFailure(stderr string) bool\n```\nIsNetworkFailure reports whether a git or gh command's stderr says the network failed it: a name that did not resolve, a connection refused, timed out, reset or cut off, or a forge or remote answering 5xx. A refusal by the other end — an authentication failure, a hook's refusal, a rejected push — or a merge conflict is not one, even when its text also quotes a network-sounding line, because waiting does not fix it. Nor is what a line the remote printed says: that end was reached.\n\n```go\nfunc LoadSites() []string\n```\nLoadSites returns the closed site vocabulary.\n\n```go\nfunc LoggableEvents() []string\n```\nLoggableEvents returns the events \\`implement log\\` accepts, for help text and shell completion.\n\n```go\nfunc NarrowEnv(env []string) []string\n```\nNarrowEnv is env as a narrow run's command runs under it, bound to what the gate counted it as: one package at a time and NarrowRunCores for the go command, its compiler and the test binaries, and a lower GOMAXPROCS of the person's own stands. The front door has proved the effective GOFLAGS empty, so this overrides nothing. Children a test starts outside go's reach, git among them, are not bound by it.\n\n```go\nfunc OutageKinds() []string\n```\nOutageKinds returns the closed kind vocabulary.\n\n```go\nfunc OutageServices() []string\n```\nOutageServices returns the closed service vocabulary.\n\n```go\nfunc ParseLog(name string, data []byte) ([]Event, []Unparsed)\n```\nParseLog parses one log file's bytes. name labels Unparsed entries.\n\n```go\nfunc PreflightParallelism(getenv func(string) string, read func() (machineload.Snapshot, error), slots int) int\n```\nPreflightParallelism is the -p \\`make preflight\\` gives its test and race stages (cmd/test-parallelism prints it), derived from the online cores and the one-minute load as they are when the stage starts, the cores divided among the preflights the first gate admits at once (machineload.GoTestParallelism, PreflightSlots). On a CI runner the machine is not read and go's own default, GOMAXPROCS, stands, as it does when the machine cannot be read.\n\n```go\nfunc PreflightSlots(getenv func(string) string, home string) (int, string, string, error)\n```\nPreflightSlots resolves how many preflights the first gate admits at once, where that came from, and a note when the machine's config.json was read past (machineConfigNote), for the account whose home is home. It reads getenv and the machine's config.json, and no repository file. It is the one reader of the count: WaitLoad calls it at every look, its race-gate shortcut included, and cmd/test-parallelism calls it before it divides the cores by the count (PreflightParallelism, machineload.GoTestParallelism), so the gate and a stage's -p never judge by different values.\n\n```go\nfunc PreflightTimeout(getenv func(string) string, read func() (machineload.Snapshot, error), base time.Duration) time.Duration\n```\nPreflightTimeout is the -timeout \\`make preflight\\` gives each package of its test and race stages (cmd/test-parallelism -timeout prints it): base scaled with the one-minute load as the stage starts (machineload.GoTestTimeout). On a CI runner the machine is not read and base stands, as it does when the machine cannot be read.\n\n```go\nfunc ReadingCorpus(repoRoot string) ([]string, error)\n```\nReadingCorpus is what \"a lane that touches the reading corpus\" means, derived from the checkout's committed preset file rather than restated here: the union of every position's object.paths, plus the preset file itself, whose recalibration serialises such lanes (iss-2609211105023379). A lane that edits one of those paths moves what a cold reading is handed, and so the measured windows the first session recalibrates. An entry names a file or a directory; a directory covers everything beneath it.\n\nIt is read through reading.LoadPresets, the loader the reading verb itself uses, so the two can never disagree about what the corpus is, and it refuses what that loader refuses: an untracked, symlinked or unparseable preset file. A corpus that cannot be derived is an error, never an empty list — the caller fails closed on it.\n\n```go\nfunc ReleaseWaitHold(home string, h WaitHolder) error\n```\nReleaseWaitHold removes the hold h wherever it is still the record in force: the command form calls it when its command exits. A hold another waiter has since taken is left alone.\n\n```go\nfunc RemoteProbe(repoRoot string) func() (bool, string)\n```\nRemoteProbe is the production network probe: \\`git ls-remote --exit-code origin HEAD\\` in repoRoot through the isolated networked git helper (gitutil.RunLimitedNetContext), bounded by NetworkProbeTimeout. The connection is back when the remote answers — with HEAD (exit 0), without it (exit 2), or with a refusal that is not a network failure, since a remote that refuses has been reached. It is down when git prints a network failure or gives no answer in time. A probe a drive's check did not run (gitutil.NotRunError) asked nothing and is not taken as back. Credentials are never asked for at a terminal: the probe's askpass fails at once.\n\n```go\nfunc RequiredFields(event string) []string\n```\nRequiredFields returns the fields \\`implement log\\` requires on event, each as its accepted names (\"minutes|wall\\_minutes|wall\\_min\"), for help text and the report's missing-field count.\n\n```go\nfunc TouchesReadingCorpus(corpus, paths []string) string\n```\nTouchesReadingCorpus returns the first path that falls in corpus — equal to an entry, or beneath one — or \"\" when none does.\n\n## Types\n\n```go\ntype Claim struct {\n\tRecord    string    `json:\"record\"`\n\tSession   string    `json:\"session\"`\n\tLane      string    `json:\"lane\"`\n\tClaimedAt time.Time `json:\"claimed_at\"`\n\tExpiresAt time.Time `json:\"expires_at\"`\n}\n```\nClaim is one claim file's content.\n\n```go\ntype ClaimRequest struct {\n\tSession string\n\tRecord  string\n\tLane    string\n\t// Lease is the claim's lifetime; zero means DefaultLease.\n\tLease time.Duration\n\t// Paths are the repository-relative files the lane expects to touch, when the\n\t// caller knows them. For the second session a path in the reading corpus —\n\t// or any path, when the corpus cannot be derived — refuses the claim (see\n\t// ReadingCorpus).\n\tPaths []string\n}\n```\nClaimRequest is what a session asks for.\n\n```go\ntype ClaimResult struct {\n\tClaim Claim `json:\"claim\"`\n\t// Renewed is true when the session already held the record and the lease was\n\t// extended instead of a second claim being taken.\n\tRenewed bool `json:\"renewed\"`\n\t// Lapsed is the expired claim this one replaced, when there was one.\n\tLapsed *Claim `json:\"lapsed,omitempty\"`\n}\n```\nClaimResult is what a granted claim reports.\n\n```go\ntype ClaimState struct {\n\tClaim\n\tLive bool `json:\"live\"`\n\t// Unreadable marks a claim file nobody can parse: it carries only its\n\t// record, and its lease is the grace after the file was written.\n\tUnreadable bool `json:\"unreadable,omitempty\"`\n}\n```\nClaimState is a claim as read at a moment: whether its lease still holds.\n\n```go\ntype CoverageGap struct {\n\tEvent string    `json:\"event\"`\n\tLines int       `json:\"lines\"`\n\tLast  time.Time `json:\"last\"`\n\t// RunLast is the run's last line, load samples aside.\n\tRunLast     time.Time `json:\"run_last\"`\n\tHoursBefore float64   `json:\"hours_before\"`\n}\n```\nCoverageGap is a measured event whose lines stop partway through the run.\n\n```go\ntype DiskCheck struct {\n\tStatus     string       `json:\"status\"`\n\tFloorBytes uint64       `json:\"floor_bytes\"`\n\tVolumes    []DiskVolume `json:\"volumes\"`\n\t// GoCache is the Go build cache's directory, home-relative where under the\n\t// home; \"\" when there is none to read (GOCACHE=off, or no cache yet).\n\tGoCache string `json:\"go_cache,omitempty\"`\n\t// GoCacheBytes is the cache's size, measured only when its volume is low;\n\t// GoCacheSampled and GoCacheSubdirs say how (machineload.GoCacheSize).\n\tGoCacheBytes   uint64 `json:\"go_cache_bytes,omitempty\"`\n\tGoCacheSampled int    `json:\"go_cache_sampled,omitempty\"`\n\tGoCacheSubdirs int    `json:\"go_cache_subdirs,omitempty\"`\n\t// Reason says why a volume could not be read, or why the cache was not\n\t// measured.\n\tReason string `json:\"reason,omitempty\"`\n\t// contains filtered or unexported fields\n}\n```\nDiskCheck is the disk half of the gate's judgement.\n\n```go\nfunc (d DiskCheck) Line() string\n```\nLine is the check as one line, for a report that names the disk beside other facts (the heartbeat): each low volume's free space and the floor, the least free space read and the floor when there is room, or why the disk was not checked.\n\n```go\nfunc (d DiskCheck) Note() string\n```\nNote is one line saying what the check could not read, \"\" when it read every volume or found one low (the refusal or warning then says it). An unknown check, or one that read one volume but not the other, refuses nothing; the note is how the person learns the disk went unchecked.\n\n```go\nfunc (d DiskCheck) Refusal() error\n```\nRefusal is the waiter's refusal when a volume is low as it starts, nil otherwise.\n\n```go\nfunc (d DiskCheck) RefusalAtOpen(firstFloor uint64, slots int, setting string) error\n```\nRefusalAtOpen is the waiter's refusal when a volume is low at its last look before it opens, after it has waited. Nil when no volume is low. firstFloor is the floor the first look judged against, and slots, read from setting, the count this look read: when this look's floor is above the first's and every low volume still has the first's floor free, only the floor moved, because the count rose, and the refusal leads with that (dcn-2610300618371321); otherwise other work filled the disk while it waited.\n\n```go\nfunc (d DiskCheck) Report() *DiskCheck\n```\nReport is the load check's copy of the finding: nil when every volume was read and has room, so the check's report is unchanged then.\n\n```go\nfunc (d *DiskCheck) WarningText(site string) string\n```\nWarningText is the load check's warning: \"\" when there is nothing to say. The check never fails for it.\n\n```go\ntype DiskVolume struct {\n\t// Holds is what the gate reads it for: DiskHoldsGoCache,\n\t// DiskHoldsWorktreeStore, or both.\n\tHolds []string `json:\"holds\"`\n\t// Paths are the paths read on it, in the order of Holds, home-relative\n\t// where under the home.\n\tPaths []string `json:\"paths\"`\n\t// Mount is where the volume is mounted, when the platform says.\n\tMount     string `json:\"mount,omitempty\"`\n\tFreeBytes uint64 `json:\"free_bytes\"`\n\tLow       bool   `json:\"low\"`\n}\n```\nDiskVolume is one volume the check read.\n\n```go\ntype Event struct {\n\tTS      time.Time                  `json:\"ts\"`\n\tSession string                     `json:\"session\"`\n\tEvent   string                     `json:\"event\"`\n\tFields  map[string]json.RawMessage `json:\"-\"`\n}\n```\nEvent is one line of the run log as it was read: the three fixed fields parsed, and every field (the fixed three included) kept as raw JSON so a reader can take what it understands and leave the rest.\n\n```go\nfunc (e Event) Number(key string) (float64, bool)\n```\nNumber returns a field as a number, accepting a JSON number or a string that holds one (a hand-written line may quote either), and ok=false otherwise.\n\n```go\nfunc (e Event) String(key string) string\n```\nString returns a field as a string: a JSON string's value, a number's or a boolean's literal text, \"\" when absent or null.\n\n```go\ntype Evidence struct {\n\tInterventions       int            `json:\"interventions\"`\n\tInterventionsByKind map[string]int `json:\"interventions_by_kind\"`\n\t// DetectedAfterMinutes sums the interventions' detected_after_min: how long\n\t// the needs went unnoticed.\n\tDetectedAfterMinutes float64 `json:\"detected_after_minutes\"`\n\tStops                int     `json:\"stops\"`\n\t// StopNoticedAfterMinutes sums the stops' noticed_after_min.\n\tStopNoticedAfterMinutes float64 `json:\"stop_noticed_after_minutes\"`\n\tDecisions               int     `json:\"decisions\"`\n}\n```\nEvidence is the run's evidence events counted over the whole run: what a run that needs no person would have to do without.\n\n```go\ntype FieldGap struct {\n\tEvent string `json:\"event\"`\n\tField string `json:\"field\"`\n\tLines int    `json:\"lines\"`\n\tOf    int    `json:\"of\"`\n}\n```\nFieldGap is a field \\`implement log\\` requires of an event, and how many of the log's lines of that event lack it.\n\n```go\ntype GateHolder struct {\n\tPID int `json:\"pid\"`\n\t// Hold says it is the holder of this account's hold record; its age is\n\t// then how long it has held the slot, and otherwise how long it has run.\n\tHold bool    `json:\"hold,omitempty\"`\n\tAgeS float64 `json:\"age_s\"`\n\t// Measured says this waiter has watched it for QuietSpan, and CPU is\n\t// then its tree's CPU over the last QuietSpan, in cores. Until then it\n\t// is not yet measured, and CPU is zero.\n\tMeasured bool    `json:\"measured\"`\n\tCPU      float64 `json:\"cpu_cores,omitempty\"`\n\t// Quiet says it is measured, its CPU is at most QuietShare, no member\n\t// has left its tree within QuietSpan, and no waiter of its own is\n\t// queued at either gate.\n\tQuiet bool `json:\"quiet,omitempty\"`\n}\n```\nGateHolder is one holder ahead of a waiter, as each waiting line names it: the hold record's holder, or work the process table shows in its slot (a waiter running its command, a make preflight in its test stages, or at the race gate a race run).\n\nQuiet marks a holder this waiter has measured whose tree used no more than QuietShare of a core over the last QuietSpan and has no waiter of its own queued at either gate: the same fact the quiet notice states (judgeHolder), for every holder named, of any account. The notice speaks only of a command hold, which a run that is not a race run takes only at one preflight at a time; above one such a run holds its slot under the settle hold, so a stalled one is told to the waiters behind it by this marker alone (iss-2610241419324875). Like the notice, it is a fact, not a verdict. It is read from the meter (cpuMeter), which judges as the notice's watch (quietWatch) does: a child gone since the last look is work, so a run that keeps starting short git children is never marked quiet.\n\n```go\ntype HeldError struct {\n\tHolder Claim\n}\n```\nHeldError is the contention a refused claim returns: the record and the session that holds it.\n\n```go\nfunc (e *HeldError) Error() string\n```\n\n```go\nfunc (e *HeldError) Is(target error) bool\n```\nIs makes a HeldError an ErrContention.\n\n```go\ntype HoldWatch struct {\n\t// Read and ReadArgs read the machine; Now is the clock.\n\tRead     func() (machineload.Snapshot, error)\n\tReadArgs func([]int) (map[int][]string, error)\n\tNow      func() time.Time\n\t// Self is the holder.\n\tSelf machineload.Self\n\t// Gates are the gates the holder holds (WaitResult.HoldGates): a race\n\t// command above one slot holds both, and a waiter at either waits on it.\n\tGates []string\n\t// contains filtered or unexported fields\n}\n```\nHoldWatch is the holder's own watch while its command runs: the waiter that opened with a command hold looks every HoldWatchEvery, and once its tree has used little CPU for QuietSpan while others queue at its gate it says so on its own standard error, so the command's owner sees it beside the command's output and can judge whether it is still working. It reads only the process table, and signals nothing.\n\n```go\nfunc (hw *HoldWatch) Look() (time.Duration, []int)\n```\nLook takes one look and returns how long the holder's tree has been quiet and the waiters queued at its gate outside the tree, in pid order; the quiet time is zero while the tree is not quiet. A table that cannot be read measured nothing, so the look gives the last readable look's answer again, as a waiter keeps its verdict: read as not quiet, it would end a quiet the tree never left and say it again at the next readable look.\n\n```go\ntype JoinResult struct {\n\tSession Session `json:\"session\"`\n\t// Rejoined is true when the session's record already existed with the same\n\t// role: a resumed session opens again rather than being refused.\n\tRejoined bool `json:\"rejoined\"`\n}\n```\nJoinResult is what Join reports.\n\n```go\ntype LeaveResult struct {\n\tSession  Session `json:\"session\"`\n\tReleased []Claim `json:\"released\"`\n}\n```\nLeaveResult is what Leave reports.\n\n```go\ntype LoadAverages struct {\n\tOne     float64 `json:\"one\"`\n\tFive    float64 `json:\"five\"`\n\tFifteen float64 `json:\"fifteen\"`\n}\n```\nLoadAverages are the three load averages.\n\n```go\ntype LoadLimits struct {\n\tStrayMinutes    int     `json:\"stray_minutes\"`\n\tExtremeLoad     float64 `json:\"extreme_load\"`\n\tSource          string  `json:\"source\"`\n\tStrayFromFile   bool    `json:\"stray_from_file\"`\n\tExtremeFromFile bool    `json:\"extreme_from_file\"`\n\t// Malformed says why the settings file is unusable, when it is: a line\n\t// number and a fault class, never a value.\n\tMalformed string `json:\"malformed,omitempty\"`\n}\n```\nLoadLimits are the limits in force and where they came from.\n\n```go\ntype LoadOtherStrays struct {\n\tCount int     `json:\"count\"`\n\tCores float64 `json:\"cores\"`\n}\n```\nLoadOtherStrays is every other account's strays: a count and a CPU total in cores, rounded to one decimal, and nothing else.\n\n```go\ntype LoadOwnStray struct {\n\tName   string `json:\"name\"`\n\tPID    int    `json:\"pid\"`\n\tPGID   int    `json:\"pgid\"`\n\tAgeS   int64  `json:\"age_s\"`\n\tCPUPct int    `json:\"cpu_pct\"`\n}\n```\nLoadOwnStray is one of the caller's own strays as it is printed and logged.\n\n```go\ntype LoadRemedy struct {\n\t// Form is \"group\" (pgrep -g, then kill -- -PGID) or \"process\" (ps -p, then\n\t// kill PID).\n\tForm string `json:\"form\"`\n\tPGID int    `json:\"pgid,omitempty\"`\n\tPIDs []int  `json:\"pids,omitempty\"`\n\tPID  int    `json:\"pid,omitempty\"`\n\t// Why says why a process form is not the group form.\n\tWhy string `json:\"why,omitempty\"`\n}\n```\nLoadRemedy is one printed way to stop some of the caller's own strays.\n\n```go\ntype LoadRequest struct {\n\t// Site is where the check runs: SitePreflight or SiteEvalHarness.\n\tSite string\n\t// Getenv reads the environment; nil is os.Getenv.\n\tGetenv func(string) string\n\t// Read reads the machine; nil is machineload.Read.\n\tRead func() (machineload.Snapshot, error)\n\t// Home is the caller's home, where ~/.abcd.noindex/load-limits lives; \"\" resolves it.\n\tHome string\n\t// RepoRoot is the checkout the check runs in, whose private banned-names\n\t// layer scrubs the own strays' names; \"\" is outside any checkout.\n\tRepoRoot string\n\t// RootSHA keys the run state; \"\" derives it from RepoRoot.\n\tRootSHA string\n\t// Self is the invocation; the zero value is this process.\n\tSelf machineload.Self\n\t// Now is the clock for the run-log line; nil is time.Now.\n\tNow func() time.Time\n\t// GOOS names the platform in the cannot-check reason; \"\" is runtime.GOOS.\n\tGOOS string\n\t// ReadMemory reads the machine's memory pressure; nil is ReadMemory, the\n\t// package's reader (machineload.ReadMemory in the binary).\n\tReadMemory func() (machineload.Memory, error)\n}\n```\nLoadRequest is one check. Every field but Site has a working zero value; the others exist so a test never depends on the real machine, environment or home.\n\n```go\ntype LoadResult struct {\n\tStatus          string          `json:\"status\"`\n\tSite            string          `json:\"site\"`\n\tLoad            *LoadAverages   `json:\"load\"`\n\tCores           int             `json:\"cores\"`\n\tCoresSource     string          `json:\"cores_source,omitempty\"`\n\tLimits          *LoadLimits     `json:\"limits\"`\n\tTriggers        []string        `json:\"triggers\"`\n\tOwnStrays       []LoadOwnStray  `json:\"own_strays\"`\n\tOwnStraysMore   int             `json:\"own_strays_more\"`\n\tOtherStrays     LoadOtherStrays `json:\"other_strays\"`\n\tRemedy          []LoadRemedy    `json:\"remedy\"`\n\tNamesWithheld   bool            `json:\"names_withheld,omitempty\"`\n\tWithinPreflight bool            `json:\"within_preflight\"`\n\tRunLog          LoadRunLog      `json:\"run_log\"`\n\t// Reason says why the check was skipped or could not read everything.\n\tReason string `json:\"reason,omitempty\"`\n\t// Disk is the low-disk finding (load_disk.go), nil when every volume read\n\t// has room; it is a warning beside the load's status, never a failure.\n\tDisk *DiskCheck `json:\"disk,omitempty\"`\n\t// Memory is the memory reading judged against the floor (load_memory.go),\n\t// nil when none could be taken; at or above the floor it is a warning\n\t// beside the load's status, never a failure.\n\tMemory *MemoryCheck `json:\"memory,omitempty\"`\n\t// MemoryNote says why memory was not checked, that a repository's floor\n\t// key was ignored, or that the machine configuration was read past for\n\t// the floor; \"\" when there is nothing to say.\n\tMemoryNote string `json:\"memory_note,omitempty\"`\n}\n```\nLoadResult is the check's whole report.\n\n```go\nfunc CheckLoad(req LoadRequest) LoadResult\n```\nCheckLoad runs the load check once. It never returns an error: a machine it cannot read is a status with a reason, and a run log it cannot write is reported on the result beside a warning that stands.\n\n```go\nfunc LoadResultFromEvent(ev Event) (LoadResult, error)\n```\nLoadResultFromEvent reads a logged \\`load\\` event back into the warning it records, so a reader renders exactly what was printed. The run-log outcome is not part of the event.\n\nNo production code reads it yet; its readers are tests in two packages, this one and the CLI surface's (TestLoggedEventRendersToThePrintedWarning, which needs the surface's unexported renderer). It stays here, exported, because Go has no test-only export across packages and the decoding needs the unexported loadEvent, so moving it into a test file would duplicate the event's shape.\n\n```go\ntype LoadRunLog struct {\n\tLogged  bool   `json:\"logged\"`\n\tSession string `json:\"session,omitempty\"`\n\tError   string `json:\"error,omitempty\"`\n}\n```\nLoadRunLog is what happened to the run-log event.\n\n```go\ntype MemoryCheck struct {\n\t// Platform is machineload.MemoryDarwin or MemoryLinux.\n\tPlatform string `json:\"platform\"`\n\t// Level and FloorLevel are macOS's reading and floor; StallPct and\n\t// FloorStallPct Linux's.\n\tLevel         string  `json:\"level,omitempty\"`\n\tStallPct      float64 `json:\"stall_pct\"`\n\tRaw           string  `json:\"raw\"`\n\tFloorLevel    string  `json:\"floor_level,omitempty\"`\n\tFloorStallPct int     `json:\"floor_stall_pct,omitempty\"`\n\t// AtFloor is true when the reading is at or above the floor.\n\tAtFloor bool `json:\"at_floor\"`\n\t// Settle is the waiter this one follows, when only the settle held it.\n\tSettle *MemorySettle `json:\"settle,omitempty\"`\n}\n```\nMemoryCheck is one memory reading judged against the floor, as the waiter and the check report it.\n\n```go\nfunc (c MemoryCheck) ReadingText() string\n```\nReadingText is the reading and its floor as a waiting line names them: \"memory pressure warn (floor warn)\", or \"memory stalled 14.2% over 10s (floor 10%)\".\n\n```go\nfunc (c MemoryCheck) WaitText() string\n```\nWaitText is what holds the gate shut on memory: the reading, or, when only the settle holds it, the waiter it follows beside the reading: \"memory settling after pid 4242 opened 30s ago (pressure normal, floor warn)\".\n\n```go\nfunc (c *MemoryCheck) WarningText(site string) string\n```\nWarningText is the load check's warning when the reading is at or above the floor, \"\" otherwise. The check never fails for it.\n\n```go\ntype MemoryFloor struct {\n\t// Level is the macOS floor: machineload.MemoryWarn or MemoryCritical.\n\tLevel       string `json:\"level\"`\n\tLevelSource string `json:\"level_source\"`\n\t// StallPct is the Linux floor, a whole percentage from 1 to 100.\n\tStallPct       int    `json:\"stall_pct\"`\n\tStallPctSource string `json:\"stall_pct_source\"`\n}\n```\nMemoryFloor is the floor the gate judges memory against, and where each half came from (layered.Layer's names: \"bundled\" or \"machine\").\n\n```go\ntype MemorySettle struct {\n\tPID  int     `json:\"pid\"`\n\tAgoS float64 `json:\"ago_s\"`\n}\n```\nMemorySettle is a waiter held only by the settle: the waiter it follows, and how long ago that one opened.\n\n```go\ntype Mode string\n```\nMode is a window's division of work between the sessions. \\`single\\` is a window with one session; the three the intent measures are \\`claim\\` (a session claims a record before opening its lane), \\`batch\\` (the run file assigns whole batches per session) and \\`split-roles\\` (the first builds; the second reviews, audits and lands).\n\n```go\nconst (\n\tModeSingle     Mode = \"single\"\n\tModeClaim      Mode = \"claim\"\n\tModeBatch      Mode = \"batch\"\n\tModeSplitRoles Mode = \"split-roles\"\n)\n```\nThe four modes.\n\n```go\nfunc Modes() []Mode\n```\nModes returns the closed mode vocabulary, in the order the run tries them.\n\n```go\nfunc ParseMode(s string) (Mode, error)\n```\nParseMode accepts exactly one of Modes.\n\n```go\ntype ModeTally struct {\n\tMode               string  `json:\"mode\"`\n\tWindows            int     `json:\"windows\"`\n\tWallMinutes        float64 `json:\"wall_minutes\"`\n\tLanesOpened        int     `json:\"lanes_opened\"`\n\tLanesLanded        int     `json:\"lanes_landed\"`\n\tSecondLanesLanded  int     `json:\"second_session_lanes_landed\"`\n\tCollisions         int     `json:\"collisions\"`\n\tLapses             int     `json:\"claims_lapsed\"`\n\tBackoffs           int     `json:\"backoffs\"`\n\tBackoffMinutes     float64 `json:\"backoff_minutes\"`\n\tAgentMinutes       float64 `json:\"agent_minutes\"`\n\tCeilingWaitMinutes float64 `json:\"ceiling_wait_minutes\"`\n\t// CeilingOverruns are the ceiling_overrun lines, and CeilingOverrunMinutes\n\t// the minutes over they carry.\n\tCeilingOverruns       int            `json:\"ceiling_overruns\"`\n\tCeilingOverrunMinutes float64        `json:\"ceiling_overrun_minutes\"`\n\tRefusals              int            `json:\"refusals\"`\n\tLandedPerHour         float64        `json:\"lanes_landed_per_hour\"`\n\tSessions              []SessionTally `json:\"sessions\"`\n}\n```\nModeTally is one division mode's figures over every window that ran it.\n\n```go\ntype Outage struct {\n\tStartedAt time.Time `json:\"started_at\"`\n\t// Services are every service the outage has taken down; Down are those not\n\t// yet proven back. The outage ends when Down is empty.\n\tServices []string `json:\"services\"`\n\tDown     []string `json:\"down\"`\n\t// Kinds are what noticed it, over every report.\n\tKinds   []string       `json:\"kinds\"`\n\tReports []OutageReport `json:\"reports\"`\n\t// ReportsDropped counts the reports past maxOutageReports, kept as a count.\n\tReportsDropped int           `json:\"reports_dropped,omitempty\"`\n\tProbes         []OutageProbe `json:\"probes\"`\n\tNextProbeAt    time.Time     `json:\"next_probe_at\"`\n\t// HourlySince is the third failed probe, where the hourly stage begins.\n\tHourlySince *time.Time        `json:\"hourly_since,omitempty\"`\n\tLease       *ProbeLeaseHolder `json:\"lease,omitempty\"`\n\tStatus      string            `json:\"status\"`\n\tGaveUpAt    *time.Time        `json:\"gave_up_at,omitempty\"`\n\t// NotifyPending is raised once, at the give-up, and lowered by Ack.\n\tNotifyPending bool `json:\"notify_pending\"`\n}\n```\nOutage is the run's outage record.\n\n```go\nfunc (o Outage) Failures() int\n```\nFailures counts the probes that left a service down.\n\n```go\nfunc (o Outage) Retried() []string\n```\nRetried is what the lanes were trying to do when they lost the connection, each once, in the order first reported.\n\n```go\ntype OutageEnd struct {\n\tStartedAt time.Time `json:\"started_at\"`\n\tEndedAt   time.Time `json:\"ended_at\"`\n\tHow       string    `json:\"how\"`\n\tMinutes   float64   `json:\"minutes\"`\n\tServices  []string  `json:\"services\"`\n\tKinds     []string  `json:\"kinds\"`\n\tRetried   []string  `json:\"retried\"`\n\tProbes    int       `json:\"probes\"`\n}\n```\nOutageEnd is how an outage ended.\n\n```go\ntype OutageProbe struct {\n\tAt      time.Time       `json:\"at\"`\n\tSession string          `json:\"session\"`\n\tOK      bool            `json:\"ok\"`\n\tResults []ServiceResult `json:\"results\"`\n}\n```\nOutageProbe is one run of the shared probe. OK is true when it left no service down.\n\n```go\ntype OutageReport struct {\n\tAt      time.Time `json:\"at\"`\n\tSession string    `json:\"session\"`\n\tService string    `json:\"service\"`\n\tKind    string    `json:\"kind\"`\n\tLane    string    `json:\"lane\"`\n\tWhat    string    `json:\"what\"`\n}\n```\nOutageReport is one lane's report of a lost connection.\n\n```go\ntype OutageSpan struct {\n\tStart time.Time `json:\"start\"`\n\t// End is the outage_end or outage_give_up line; nil while it is open.\n\tEnd *time.Time `json:\"end,omitempty\"`\n\t// Outcome is \"ended\" (a probe proved every service back), \"cleared\" (closed\n\t// by hand), \"gave_up\", or \"open\" at the log's last line.\n\tOutcome string `json:\"outcome\"`\n\t// Minutes is the line's own figure for a closed outage, and for an open one\n\t// the minutes to the log's last line.\n\tMinutes  float64  `json:\"minutes\"`\n\tServices []string `json:\"services\"`\n\tKinds    []string `json:\"kinds\"`\n\tRetried  []string `json:\"retried\"`\n\tProbes   int      `json:\"probes\"`\n}\n```\nOutageSpan is one outage as the log records it.\n\n```go\ntype OutageWaitError struct {\n\tNextProbeAt time.Time `json:\"next_probe_at\"`\n\tDown        []string  `json:\"down\"`\n\tHolder      string    `json:\"holder,omitempty\"`\n\tLeaseUntil  time.Time `json:\"lease_until,omitzero\"`\n}\n```\nOutageWaitError is the contention a caller meets when the probe is not due or another session holds it: it names when the next probe falls due and, for a held probe, the holder and its lease.\n\n```go\nfunc (e *OutageWaitError) Error() string\n```\n\n```go\nfunc (e *OutageWaitError) Is(target error) bool\n```\nIs makes an OutageWaitError an ErrContention.\n\n```go\ntype Outages struct {\n\n\t// Schedule is the probe schedule; the zero value is DefaultSchedule.\n\tSchedule Schedule\n\t// contains filtered or unexported fields\n}\n```\nOutages is the run's outage handle.\n\n```go\nfunc (o *Outages) Ack(session string) (Outage, error)\n```\nAck lowers the give-up's notification: the product thinker has been told. It is refused when nothing is pending, so a notification is never raised again by acknowledging it twice.\n\n```go\nfunc (o *Outages) Clear(session, reason string) (OutageEnd, error)\n```\nClear closes the outage by hand, open or given up, with the reason. It logs outage\\_end (how \"cleared\") and, because a person or a session stepped in where the shared probe should have, an intervention naming the gap.\n\n```go\nfunc (o *Outages) Current() (*Outage, error)\n```\nCurrent returns the outage in force, nil when there is none. It writes nothing and takes no lock: the record is only ever replaced whole.\n\n```go\nfunc (o *Outages) ProbeIfDue(session string, p Prober) (ProbeOutcome, error)\n```\nProbeIfDue runs the shared probe if it is due and nobody else is running it. Under the run's lock it reads the outage: none is nothing to wait on; one that gave up is refused, because the run has stopped; one whose next probe is not due, or whose probe another live lease holds, is an \\*OutageWaitError (contention) carrying next\\_probe\\_at. Otherwise it takes the lease, releases the lock, probes each service down (prober's function for it; none leaves it unproven), then re-locks and writes the result: every service back ends the outage and logs outage\\_end; otherwise the failure is counted, the next probe set by the schedule, and a failure at or past the hourly stage's limit gives up, raising notify\\_pending and logging outage\\_give\\_up. A result whose lease lapsed and was taken by another session meanwhile is discarded.\n\n```go\nfunc (o *Outages) Record(session, service, kind, lane, what string) (Outage, error)\n```\nRecord opens an outage, or extends the one open, with a lane's report: the service it lost, what noticed it, the lane and what it was doing. The first report logs outage\\_start and sets the first probe a schedule's wait away; a later one adds its service to those down (a service proven back and lost again is down again) and its kind to the kinds. A report to an outage that gave up joins it and raises no second notification.\n\n```go\ntype ProbeLeaseHolder struct {\n\tHolder string    `json:\"holder\"`\n\tUntil  time.Time `json:\"until\"`\n}\n```\nProbeLeaseHolder is the session running the probe, and until when it holds it.\n\n```go\ntype ProbeOutcome struct {\n\t// Probed is false when there was no outage to probe.\n\tProbed bool         `json:\"probed\"`\n\tProbe  *OutageProbe `json:\"probe,omitempty\"`\n\t// Ended is true when the probe proved every service back; Minutes is then\n\t// how long the outage lasted.\n\tEnded   bool    `json:\"ended\"`\n\tMinutes float64 `json:\"minutes,omitempty\"`\n\t// GaveUp is true when this probe gave up.\n\tGaveUp bool `json:\"gave_up\"`\n\t// Outage is the record after the probe, nil once it has ended.\n\tOutage *Outage `json:\"outage\"`\n}\n```\nProbeOutcome is what ProbeIfDue did.\n\n```go\ntype Prober struct {\n\tNetwork func() (ok bool, detail string)\n\tModel   func() (ok bool, detail string)\n}\n```\nProber is how each service is proven back. A nil function leaves its service unproven, and still down when it was down. Only the services down are probed. Model is the lead's canary verdict: abcd calls no model, and the lead's own turn running is not proof the service is back.\n\n```go\ntype QuietHolder struct {\n\tPID int `json:\"pid\"`\n\t// Checkout is the directory the holder ran in, as its record names it;\n\t// empty for a record an older abcd wrote.\n\tCheckout string `json:\"checkout,omitempty\"`\n\t// HeldS is how long it has held the slot, since its hold opened.\n\tHeldS float64 `json:\"held_s\"`\n\t// QuietS is how long its tree has used no more than QuietShare of a core.\n\tQuietS float64 `json:\"quiet_s\"`\n}\n```\nQuietHolder is a command hold's holder whose tree has used little CPU for QuietSpan: a fact the waiters are told, not a verdict on the holder.\n\n```go\ntype Report struct {\n\tEvents   int         `json:\"events\"`\n\tUnparsed []Unparsed  `json:\"unparsed\"`\n\tModes    []ModeTally `json:\"modes\"`\n\t// Context is each session's context measurement, by session id.\n\tContext []SessionContext `json:\"context\"`\n\t// Evidence counts the run's interventions, stops and decisions.\n\tEvidence Evidence `json:\"evidence\"`\n\t// MissingFields names, per event and required field, the lines lacking it.\n\tMissingFields []FieldGap `json:\"missing_fields\"`\n\t// Coverage names each measured event whose lines stop partway.\n\tCoverage []CoverageGap `json:\"coverage\"`\n\t// Leader is the mode with the most lanes landed per wall-clock hour, \"\" when\n\t// no mode landed a lane or two modes tie. It is a figure, not a verdict: the\n\t// run's report names which mode it would keep, and says why.\n\tLeader      string `json:\"leader\"`\n\tLeaderBasis string `json:\"leader_basis\"`\n\t// Outages are the run's lost connections, each with how long it lasted and\n\t// what was retried, so a short outage is reported though nobody was told of\n\t// it at the time.\n\tOutages []OutageSpan `json:\"outages\"`\n}\n```\nReport is the derived comparison.\n\n```go\nfunc Compare(events []Event, unparsed []Unparsed) Report\n```\nCompare derives the comparison from a log. It never fails: a line it cannot use was already set aside by the parser, and a field it cannot read counts as absent.\n\n```go\ntype Role string\n```\nRole is a session's standing in the run. The first session is the run: it may cut a release and take any lane, and it never waits on the second. The second is optional and bounded (the intent's decision 3): at most one lane, never the release, never a lane that touches the reading corpus, and it backs off on contention.\n\nThe role lives in the session's record in the run state, written when the session joins. It is deliberately not read from the environment: a variable a shell, a task runner or a repository's configuration can set is not a statement the session made, and the bounds key on it. What the record gives is consistency, not authentication — two sessions of one account can each write anything under that account's home — so the bounds are a discipline two cooperating sessions keep, checked at every verb, not a wall against a hostile one.\n\n```go\nconst (\n\tRoleFirst  Role = \"first\"\n\tRoleSecond Role = \"second\"\n)\n```\nThe two roles.\n\n```go\nfunc ParseRole(s string) (Role, error)\n```\nParseRole accepts exactly one of Roles.\n\n```go\nfunc Roles() []Role\n```\nRoles returns the closed role vocabulary.\n\n```go\ntype Run struct {\n\t// Dir is the run directory, ~/.abcd.noindex/runs/\u003croot-sha\u003e.\n\tDir string\n\t// RootSHA is the repository's root-commit SHA the directory is keyed on.\n\tRootSHA string\n\t// RepoRoot is the checkout the run was opened from. The reading corpus the\n\t// second session's bounds check against is read from its preset file.\n\tRepoRoot string\n\t// Now is the clock. Tests set it; nil means time.Now.\n\tNow func() time.Time\n\t// contains filtered or unexported fields\n}\n```\nRun is one repository's run state. The zero value is not usable; construct it with Open (which creates the directories a mutation needs) or Peek (which creates nothing, for the read-only renders).\n\n```go\nfunc Open(rootSHA string) (*Run, error)\n```\nOpen returns the run for rootSHA, creating its directories when absent. Every level from ~/.abcd.noindex down is created one at a time and proved a real directory, never through a symlink (fsutil.EnsureRealDirAll), so a planted redirect is refused before anything is written beneath it.\n\n```go\nfunc OpenJoined(rootSHA, session string) (*Run, error)\n```\nOpenJoined returns the run for rootSHA on behalf of a session that must already have joined it: every writer but join. A run directory that does not exist holds no session, so the caller is refused before anything is created — no directory, no lock, no log line. An existing run is opened as Open opens it, and the verb itself refuses a session it does not hold.\n\n```go\nfunc Peek(rootSHA string) (*Run, error)\n```\nPeek returns the run for rootSHA without creating anything. A run directory that does not exist reads as an empty run: no sessions, no claims, no log.\n\n```go\nfunc (r *Run) AgentsAlive(s Session) (int, error)\n```\nAgentsAlive counts the agents a session has declared alive: the agents named by its agent\\_start lines since it joined, each with no agent\\_end of the same agent after it. It counts what the session wrote and nothing else — abcd runs no agent, and a line the session never wrote (a fork, an agent the host started outside the log) is invisible here — so it is the declared count the ceiling is held against, not a census of processes. Lines naming no agent cannot be matched and are not counted.\n\n```go\nfunc (r *Run) Check(session string, stage Stage, paths []string) (Verdict, error)\n```\nCheck says whether a session may take a stage, and logs the refusal when it may not. The first session may take every stage. The second is refused:\n\n  - the release stage, always — only the first session cuts a release;\n  - a lane in a split-roles window, where the second only reviews, audits and lands;\n  - a lane whose paths reach the reading corpus.\n\nReview, audit and land are open to both. A refusal is an ErrRefused-classed error and a \\`refusal\\` line in the log; an allowed stage writes nothing.\n\n```go\nfunc (r *Run) Claim(req ClaimRequest) (ClaimResult, error)\n```\nClaim takes req.Record for req.Session. In order, under the run's lock:\n\n 1. the session must have joined; its role decides the bounds;\n 2. a second session is refused when it already holds a live claim on another record (one lane at a time), when the window's mode is split-roles (the second builds nothing), or when req.Paths reach the reading corpus;\n 3. the claim file is created exclusively. If it exists and this session holds it, the lease is renewed. If another session's lease has passed, the lapse is logged, the stale file removed, and the create retried. If another session's lease holds, the denial is logged naming the holder — and for the second session a backoff is logged beside it — and a \\*HeldError (ErrContention) is returned.\n\nA granted claim is logged as \\`claim\\`. When that line cannot be written the claim is removed again, so the claims directory never holds a claim the log does not.\n\n```go\nfunc (r *Run) Claims() ([]ClaimState, error)\n```\nClaims lists every claim file, live or lapsed, by record.\n\n```go\nfunc (r *Run) Compare() (Report, error)\n```\nCompare derives the comparison over the run's whole log.\n\n```go\nfunc (r *Run) CurrentMode() (WindowState, bool, error)\n```\nCurrentMode returns the mode the log last recorded, whoever wrote the line (a hand-written window\\_mode counts the same as one SetMode wrote). ok is false when no window has been opened; an unrecognised mode word is returned as it was written, and the bounds treat it as no split.\n\n```go\nfunc (r *Run) Join(id string, role Role, model, reason string, ceiling int) (JoinResult, error)\n```\nJoin records a session in the run and logs its session\\_open. Nothing signals any other session: joining is a file the joiner writes and a log line, and the first session learns of a second only if it reads the run state. The record is taken by an exclusive create; a session that joins again with the role it holds is a resume, and one that asks for a different role is refused. ceiling is the session's own agent ceiling (see MaxCeiling), zero for none; a resume keeps the ceiling it joined with and refuses a different one.\n\n```go\nfunc (r *Run) Joined(id string) (Session, error)\n```\nJoined returns a joined session's record, or refuses one the run does not hold, writing nothing: for a caller that acts for a session in the run state and must know it has joined before it creates anything of its own.\n\n```go\nfunc (r *Run) Leave(id, reason string) (LeaveResult, error)\n```\nLeave closes a session: it releases every claim the session holds, logs session\\_close with the reason, and removes the session's record. A session that stops without leaving is covered by its claims' leases instead.\n\n```go\nfunc (r *Run) Log(session, event string, fields map[string]string) (Event, error)\n```\nLog appends one event on a joined session's word: the run's hand-kept events (lane\\_open, agent\\_end, backoff, …) through the same single-write append the verbs use. The event must be one of LoggableEvents — the verb-owned events are refused, because a hand-written claim the claims directory does not hold is a log that lies — and fields are key=value pairs under the limits above. A value that parses as an integer, a decimal or a boolean is written as a JSON number or boolean when it round-trips to the same text; anything else as a string.\n\n```go\nfunc (r *Run) Outage() *Outages\n```\nOutage returns the run's outage handle, on DefaultSchedule.\n\n```go\nfunc (r *Run) ReadLog() ([]Event, []Unparsed, error)\n```\nReadLog reads every day's log in the run directory, in date order. A missing directory is an empty log. Lines that are not a JSON object carrying ts, session and event are returned as Unparsed rather than failing the read: the log is hand-written in part, and a comparison that stopped at the first odd line would report nothing.\n\n```go\nfunc (r *Run) Release(session, record string) (Claim, error)\n```\nRelease gives up a session's claim on a record and logs claim\\_released. Only the holder releases: a session cannot free another's claim, which lapses on its own lease instead.\n\n```go\nfunc (r *Run) Sessions() ([]Session, error)\n```\nSessions lists the joined sessions, by join time.\n\n```go\nfunc (r *Run) SetMode(session string, m Mode, window int) (WindowState, error)\n```\nSetMode opens a window: it logs window\\_mode with the mode and, when given, the window's number. Only the first session sets it — the second tells the first nothing, and the window's mode is how the first divides its own run.\n\n```go\ntype Schedule struct {\n\tWaits     []time.Duration `json:\"waits\"`\n\tHourly    time.Duration   `json:\"hourly\"`\n\tHourlyFor time.Duration   `json:\"hourly_for\"`\n}\n```\nSchedule is when the shared probe runs, as data: the waits after the outage opens and after each of the first failed probes, then a probe every Hourly, for HourlyFor after the hourly stage begins.\n\n```go\nfunc (s Schedule) GivesUp(hourlySince, at time.Time) bool\n```\nGivesUp reports whether a probe failing at at gives up, for an hourly stage that began at hourlySince: at or after HourlyFor into it.\n\n```go\nfunc (s Schedule) Next(last time.Time, failures int) time.Time\n```\nNext is when the next probe falls due: the wait for failures failed probes so far, counted from last — the outage's start when nothing has been probed, and otherwise the probe that actually ran, so a late probe moves every one after it rather than bunching them up.\n\n```go\ntype ServiceResult struct {\n\tService string `json:\"service\"`\n\tOK      bool   `json:\"ok\"`\n\tDetail  string `json:\"detail,omitempty\"`\n}\n```\nServiceResult is one service's answer to a probe. A service the probe had no way to prove (no canary verdict for the model) is not OK, and says it is unproven.\n\n```go\ntype Session struct {\n\tSession  string    `json:\"session\"`\n\tRole     Role      `json:\"role\"`\n\tJoinedAt time.Time `json:\"joined_at\"`\n\tModel    string    `json:\"model,omitempty\"`\n\t// Ceiling is the session's own agent ceiling as it stated it on joining,\n\t// zero when it stated none.\n\tCeiling int `json:\"ceiling,omitempty\"`\n}\n```\nSession is a joined session's record.\n\n```go\ntype SessionContext struct {\n\tSession     string    `json:\"session\"`\n\tRole        string    `json:\"role\"`\n\tEvents      int       `json:\"events\"`\n\tLastUsedPct float64   `json:\"last_used_pct\"`\n\tLastAt      time.Time `json:\"last_at\"`\n}\n```\nSessionContext is one session's context measurement across the whole run: how many context lines it logged and the last used\\_pct among them. It is per session rather than per mode because an orchestrator's context is carried across windows, not reset by them.\n\n```go\ntype SessionTally struct {\n\tSession            string  `json:\"session\"`\n\tRole               string  `json:\"role\"`\n\tLanesOpened        int     `json:\"lanes_opened\"`\n\tLanesLanded        int     `json:\"lanes_landed\"`\n\tAgentMinutes       float64 `json:\"agent_minutes\"`\n\tBackoffMinutes     float64 `json:\"backoff_minutes\"`\n\tCeilingWaitMinutes float64 `json:\"ceiling_wait_minutes\"`\n\tCeilingOverruns    int     `json:\"ceiling_overruns\"`\n\tCollisions         int     `json:\"collisions\"`\n}\n```\nSessionTally is one session's share of a mode.\n\n```go\ntype Stage string\n```\nStage is a point in a run where the second session's bounds are checked before the session acts, called a stage like the loop's lane stages (rulings BU1 and CM1: a spec's piece is a step, and nothing else is). A lane is opened by a claim (Claim applies the lane bounds itself); Check is for the stages that are not claims, and for a lane whose files are only known once it has been built.\n\n```go\nconst (\n\tStageLane    Stage = \"lane\"\n\tStageRelease Stage = \"release\"\n\tStageReview  Stage = \"review\"\n\tStageAudit   Stage = \"audit\"\n\tStageLand    Stage = \"land\"\n)\n```\nThe stages.\n\n```go\nfunc ParseStage(s string) (Stage, error)\n```\nParseStage accepts exactly one of Stages.\n\n```go\nfunc Stages() []Stage\n```\nStages returns the closed stage vocabulary.\n\n```go\ntype Unparsed struct {\n\tFile   string `json:\"file\"`\n\tLine   int    `json:\"line\"`\n\tReason string `json:\"reason\"`\n}\n```\nUnparsed is one log line the reader could not use, with why.\n\n```go\ntype UnreadableClaimError struct {\n\tRecord   string\n\tPath     string\n\tLapsesAt time.Time\n\t// contains filtered or unexported fields\n}\n```\nUnreadableClaimError is a claim file nobody can parse — a session killed between the exclusive create and the write leaves an empty one. It names the file's full path and when it lapses, never a guess at who holds it.\n\n```go\nfunc (e *UnreadableClaimError) Error() string\n```\n\n```go\ntype Verdict struct {\n\tSession string `json:\"session\"`\n\tRole    Role   `json:\"role\"`\n\tStage   Stage  `json:\"stage\"`\n\tMode    Mode   `json:\"mode,omitempty\"`\n\tAllowed bool   `json:\"allowed\"`\n\t// Ceiling is the session's own agent ceiling as it joined with it, zero when\n\t// it stated none: reported with every verdict, beside AgentsAlive, so the\n\t// session about to act sees the limit it keeps (see MaxCeiling).\n\tCeiling int `json:\"ceiling,omitempty\"`\n\t// AgentsAlive is the count of the session's agents its own log lines declare\n\t// alive (see Run.AgentsAlive): what an agent_start is held against when the\n\t// session stated a ceiling.\n\tAgentsAlive int `json:\"agents_alive\"`\n}\n```\nVerdict is Check's answer.\n\n```go\ntype WaitHolder struct {\n\tPID int `json:\"pid\"`\n\t// StartUnix is the holder's start time, in Unix seconds; zero when it could\n\t// not be read.\n\tStartUnix int64     `json:\"start_unix\"`\n\tOpened    time.Time `json:\"opened\"`\n\tUntil     time.Time `json:\"until\"`\n\tForm      string    `json:\"form\"`\n\t// Gate is the gate whose record this is, GateTests or GateRace; a\n\t// record without one, as an abcd released before the race gate writes\n\t// it, is the first gate's.\n\tGate string `json:\"gate,omitempty\"`\n\t// Dir is the checkout the holder ran in (WaitRequest.Dir); a record an\n\t// older abcd wrote has none.\n\tDir string `json:\"dir,omitempty\"`\n}\n```\nWaitHolder is a hold: the record under ~/.abcd.noindex/ and what the report carries.\n\n```go\ntype WaitRequest struct {\n\t// Getenv reads the environment; nil is os.Getenv.\n\tGetenv func(string) string\n\t// Read reads the machine; nil is machineload.Read.\n\tRead func() (machineload.Snapshot, error)\n\t// ReadArgs reads the go processes' arguments; nil is machineload.ReadArgs.\n\tReadArgs func([]int) (map[int][]string, error)\n\t// Home is the caller's home; \"\" resolves it.\n\tHome string\n\t// Self is the waiter; the zero value is this process.\n\tSelf machineload.Self\n\t// Now and Sleep are the clock; nil is the real one.\n\tNow   func() time.Time\n\tSleep func(time.Duration)\n\t// Timeout is how long to wait; zero looks once.\n\tTimeout time.Duration\n\t// Poll is the interval between looks; zero is WaitPollInterval.\n\tPoll time.Duration\n\t// Command asks for the command form's hold.\n\tCommand bool\n\t// Race waits at the race gate (`--race-gate`), before a race stage,\n\t// instead of the first gate. With one slot (PreflightSlots) it opens at\n\t// once, without a look, a hold or a jitter; above one it is shut only by\n\t// another go test -race run, a race waiter ahead of it, the load and the\n\t// race gate's own hold.\n\tRace bool\n\t// RaceCommand says the command form's command is a race run\n\t// (machineload.IsRaceCommand).\n\tRaceCommand bool\n\t// Narrow says the command form's command is a narrow run\n\t// (machineload.IsNarrowCommand), which waits at its own gate (load_narrow.go).\n\tNarrow bool\n\t// Words are the command form's command, as it runs: a narrow wait keys the\n\t// budget it carries to its next try on them (load_narrow_carry.go).\n\tWords []string\n\t// OnWait is called once, at the first look that finds the gate shut.\n\tOnWait func(WaitResult)\n\t// OnSettle is called once, at the first look that finds the machine free,\n\t// with the jitter the waiter waits before it checks again.\n\tOnSettle func(time.Duration)\n\t// Jitter is the wait between a look that finds the machine free and the\n\t// re-check that opens the gate; nil is a random WaitJitterMin to\n\t// WaitJitterMax.\n\tJitter func() time.Duration\n\t// Mark shows the command form's waiter in the process table as running its\n\t// command from the moment it opens until its command starts: it starts a\n\t// child of the waiter and returns the function that stops it. nil is a\n\t// short-lived /bin/sleep.\n\tMark func() (stop func(), err error)\n\t// OnBackoff is called at each back-off, with the waiters that opened in the\n\t// same moment that this one stood back from (machineload.StandBackFrom) and\n\t// the jitter waited before looking again.\n\tOnBackoff func(first []int, jitter time.Duration)\n\t// OnQuiet is called at the first look that finds the holder of the command\n\t// hold in force quiet (QuietHolder, load_quiet.go), and again each time it\n\t// goes quiet after it picked up.\n\tOnQuiet func(WaitResult)\n\t// Dir is the checkout the waiter runs in, recorded in its hold so a waiter\n\t// behind it can name it; \"\" is the working directory. Its\n\t// .abcd/config.json is read only to name a memory floor key there as\n\t// ignored (memoryFloorAt).\n\tDir string\n\t// ReadHead reads the commit a checkout's HEAD is at, for a whole run's\n\t// marker (WholeRunMarker.Head); nil reads it with git under its own\n\t// bound.\n\tReadHead func(dir string) (string, error)\n\t// OnMarkNote, when set, is called with WaitResult.MarkNote at the look\n\t// that failed to write the whole run's marker, so the note is said then,\n\t// not when the wait returns.\n\tOnMarkNote func(note string)\n\t// ReadMemory reads the machine's memory pressure; nil is ReadMemory, the\n\t// package's reader (machineload.ReadMemory in the binary).\n\tReadMemory func() (machineload.Memory, error)\n\t// OnDiskTrim, when set, is called with each line the trim at the disk\n\t// floor says (load_disk_trim.go) as it says it: that it is trimming, what\n\t// each cache's trim did or why it did not run, and the free space after.\n\t// The trim walks a large cache for minutes, so the lines come as it goes.\n\tOnDiskTrim func(line string)\n}\n```\nWaitRequest is one wait. Every field has a working zero value but Timeout, whose zero is a single look; the seams exist so a test never depends on the real machine, clock, environment or home.\n\n```go\ntype WaitResult struct {\n\tStatus  string  `json:\"status\"`\n\tWaitedS float64 `json:\"waited_s\"`\n\t// WaitedOn is every condition that held the gate shut at some look, in the\n\t// order first seen; empty is opened at the first look.\n\tWaitedOn []string `json:\"waited_on\"`\n\t// Still is what held the gate shut at the last look, when it is shut.\n\tStill []string `json:\"still,omitempty\"`\n\tPolls int      `json:\"polls\"`\n\t// Load, WaitLoad and Cores are the last reading and the limit it was judged\n\t// against; LimitSource says where the limit came from.\n\tLoad        float64 `json:\"load\"`\n\tWaitLoad    float64 `json:\"wait_load\"`\n\tLimitSource string  `json:\"limit_source\"`\n\tMalformed   string  `json:\"malformed,omitempty\"`\n\tCores       int     `json:\"cores\"`\n\t// RaceRuns is the race runs live at the last look, by pid.\n\tRaceRuns []int `json:\"race_runs\"`\n\t// Holder is the hold in force at the last look, when one was.\n\tHolder *WaitHolder `json:\"holder,omitempty\"`\n\t// Hold is the hold this wait took, when it opened.\n\tHold   *WaitHolder `json:\"hold,omitempty\"`\n\tReason string      `json:\"reason,omitempty\"`\n\t// Preflights and Waiters are what the process table held ahead of the\n\t// waiter at the last look: make preflights running and waiters queued\n\t// ahead or running their command, by pid (machineload.QueueAhead). They\n\t// name the pids in the text report; the JSON report carries the condition.\n\tPreflights []int `json:\"-\"`\n\tWaiters    []int `json:\"-\"`\n\t// UngatedTests are the go test runs no gate admitted\n\t// (machineload.UngatedTests), named beside the load they add to; they\n\t// shut nothing (iss-2610241130157455).\n\tUngatedTests []int `json:\"ungated_tests,omitempty\"`\n\t// Gate is the gate waited at, GateTests, GateRace or GateNarrow.\n\tGate string `json:\"gate\"`\n\t// Slots is how many preflights the first gate admits at once, and\n\t// SlotsSource where that came from (PreflightSlots). With one, the race\n\t// gate opens at once.\n\tSlots       int    `json:\"slots,omitempty\"`\n\tSlotsSource string `json:\"slots_source,omitempty\"`\n\t// SlotsNote says why the machine configuration was read past for the\n\t// count, when it was (PreflightSlots); the front door prints it once per\n\t// waiter, so a preflight, which waits at both gates, shows it twice.\n\tSlotsNote string `json:\"slots_note,omitempty\"`\n\t// NarrowRuns is how many narrow runs may run at once, at the narrow gate\n\t// (load_narrow.go), and NarrowSource where that came from.\n\tNarrowRuns   int    `json:\"narrow_runs,omitempty\"`\n\tNarrowSource string `json:\"narrow_source,omitempty\"`\n\t// Overdue is the whole-run waiters a narrow run stands aside for at the last\n\t// look, by pid (machineload.OverdueWhole).\n\tOverdue []int `json:\"-\"`\n\t// DiskNote says the disk went unchecked, in whole or in part, and why\n\t// (DiskCheck.Note); \"\" when every volume was read. The front door prints\n\t// it on stderr.\n\tDiskNote string `json:\"disk_note,omitempty\"`\n\t// DiskTrim is what the trim the waiter ran at the disk floor did, its\n\t// lines joined (WaitRequest.OnDiskTrim), or why it started none with\n\t// less than DiskTrimMinLeft of its timeout left; \"\" when it reached no\n\t// trim.\n\tDiskTrim string `json:\"disk_trim,omitempty\"`\n\t// Memory is the last memory reading, judged against the floor\n\t// (load_memory.go); nil when no reading could be taken.\n\tMemory *MemoryCheck `json:\"memory,omitempty\"`\n\t// MemoryNote says, once each, that the memory floor was not checked and\n\t// why, that a repository's floor key was ignored, or that the admission\n\t// record could not be read or written; \"\" when there is nothing to say.\n\t// The front door prints it on stderr.\n\tMemoryNote string `json:\"memory_note,omitempty\"`\n\t// Backoffs is how many times the waiter stood back from another that opened\n\t// in the same moment (machineload.StandBackFrom).\n\tBackoffs int `json:\"backoffs,omitempty\"`\n\t// Quiet is the holder of the command hold in force at the last look when\n\t// its tree has used little CPU for QuietSpan (load_quiet.go). It is said,\n\t// never acted on.\n\tQuiet *QuietHolder `json:\"quiet_holder,omitempty\"`\n\t// Progress says the last look found the race queue ahead progressing and\n\t// paused the race gate's clock (raceQueueProgress), and PausedS is how\n\t// long the clock has been paused in all. AtCeiling says the last look found\n\t// the queue progressing but the deadline already at the ceiling\n\t// (WaitRaceCeilingFactor), so the clock ran: Progress is then false. All\n\t// three stay zero at every other gate and at a race gate given no timeout.\n\tProgress  bool    `json:\"progress,omitempty\"`\n\tAtCeiling bool    `json:\"at_ceiling,omitempty\"`\n\tPausedS   float64 `json:\"paused_s,omitempty\"`\n\t// Holders is each holder ahead at the last look, in pid order, the hold\n\t// record's first (GateHolder, load_quiet.go).\n\tHolders []GateHolder `json:\"holders,omitempty\"`\n\n\t// HoldGates are the gates whose hold this wait took, when it opened: its\n\t// own, and the race gate's too for a race command above one slot.\n\tHoldGates []string `json:\"-\"`\n\t// Unmark stops the command form's mark (WaitRequest.Mark). The caller calls\n\t// it once its command has started, or could not be started; nil when there\n\t// is no mark.\n\tUnmark func() `json:\"-\"`\n\t// MarkNote says the whole run's marker (WholeRunMarker) could not be\n\t// written, and why; \"\" when it was, or when this wait writes none. The\n\t// wait goes on either way.\n\tMarkNote string `json:\"mark_note,omitempty\"`\n\t// EndMark removes the whole run's marker: the command form calls it once\n\t// its command has exited, whatever the hold's form (a settle hold's\n\t// release is not the command's end). It may be called more than once;\n\t// nil when this wait writes no marker.\n\tEndMark func() `json:\"-\"`\n\t// contains filtered or unexported fields\n}\n```\nWaitResult is the waiter's report.\n\n```go\nfunc WaitLoad(req WaitRequest) (WaitResult, error)\n```\nWaitLoad waits until the gate opens or the timeout passes. Its error is a refusal before any wait (a home it cannot resolve, a home inside a git working tree that is not the account's own, a symlinked ~/.abcd.noindex, a load.preflights or a memory floor it cannot use, a volume holding the Go build cache or the worktree store below the disk floor (diskFloorFor) and still below it after the trim it runs once first (load\\_disk\\_trim.go), or a hold lock that is not a regular file), a refusal at the last look before it opens when such a volume has fallen below the floor while it waited, or a hold it could not give up when standing back after a wait. A disk it cannot read, in whole or in part, is never refused; WaitResult.DiskNote says so. Memory pressure at or above the floor is waited on, never refused, and a memory reading it cannot take shuts nothing; WaitResult.MemoryNote says so (load\\_memory.go). A timeout is a status, not an error.\n\n```go\ntype WholeRunMarker struct {\n\tSchemaVersion int `json:\"schema_version\"`\n\t// PID is the waiter's process id, and the file's name.\n\tPID int `json:\"pid\"`\n\t// StartUnix is its start time in Unix seconds, measured back from the\n\t// moment the table read that held it began.\n\tStartUnix int64 `json:\"start_unix\"`\n\t// StartSlack is how far StartUnix may be early: that read's length\n\t// (sessionname.Host.Slack).\n\tStartSlack time.Duration `json:\"start_slack\"`\n\t// Dir is the checkout it runs in (WaitRequest.Dir), absolute and clean.\n\tDir string `json:\"dir\"`\n\t// Head is the commit Dir's HEAD was at when the marker was written, a\n\t// full object name.\n\tHead string `json:\"head\"`\n\t// Preflight says the waiter's command is the preflight's stages\n\t// (machineload.IsPreflightStagesCommand), the only command that writes a\n\t// marker; a reader counts only a marker that says so, and refuses one\n\t// without the field.\n\tPreflight *bool `json:\"preflight\"`\n\t// Kind is WholeRunKind.\n\tKind string `json:\"kind\"`\n\t// Began is when the marker was written.\n\tBegan time.Time `json:\"began\"`\n}\n```\nWholeRunMarker is one whole run's record of itself.\n\n```go\nfunc ReadWholeRunMarkers(home string) ([]WholeRunMarker, error)\n```\nReadWholeRunMarkers reads the whole runs' markers under home, untrusted: the folder is walked as a declaration's is (a symlinked level, or one another account owns or every account can write, is refused with an error), each file must be a regular file this account alone owns and can write, at most maxWholeRunMarkerBytes, exactly one JSON document of the marker's shape with no unknown or repeated field, named for its own pid, of the whole kind, with an absolute clean checkout, a full commit, whether its command is the preflight, and a slack within its bound; one that is not counts for nothing. An absent folder is none. It reads no process: whether a marker's process is live, and this account's, is the caller's to judge. It looks at MaxWholeRunMarkers entries, which two kinds of file the sweep leaves can fill: a later build's marker and a refused file named for a pid the reading holds. A marker past the look counts its run as not live.\n\n```go\ntype WindowState struct {\n\tMode   Mode      `json:\"mode\"`\n\tWindow int       `json:\"window,omitempty\"`\n\tSince  time.Time `json:\"since\"`\n\tSetBy  string    `json:\"set_by\"`\n}\n```\nWindowState is the division mode in force, as the log last recorded it.\n\n","path":"github.com/intentdriven/abcd/internal/core/implement","name":"implement","synopsis":"Package implement is the run machinery an autonomous implementation run calls: the run's shared state in the machine-scoped store, the sessions that join it, the claim that makes a record the unit of exclusion between them, the bounds that keep a second session from becoming a hazard, and the run log the comparison of division modes is derived from (itd-2609221656373558, spc-2609221657588816).","isRedistributable":true}
