Repository navigation
v5.3.0
Added
-
scripts/lib/tail-window.mjs(readTailWindow(file, maxBytes)→{ text, cut, size }) — the ONE bounded tail-window reader for append-only JSONL ledgers and transcripts, replacing five private copies of the same byte-window primitive:hooks/on-stop.mjs,hooks/subagent-telemetry.mjs,scripts/lib/agent-status.mjs,scripts/lib/session-id.mjsandscripts/lib/telemetry-flush-health-banner.mjs(#1272). Each caller keeps its own error mapping (null/[]/ discriminated result / throw); the module owns only the window, loops until it is filled, and reportscutso a caller can drop the partial first line. Named ceiling (BV-004): the window is held in memory in one piece — fine for the 64 KiB..1 MiB windows in use, revisit above ~16 MiB. New suitetests/lib/tail-window.test.mjs;hooks/_lib/hook-import-set.jsonregenerated (the module is reachable from four hook entry files). -
consumeDialecticPending({ repoRoot })inscripts/lib/auto-dialectic.mjs, plus the Step 6.4 loop-closing block inskills/evolve/references/evolve-dialectic-mode.md(#1380). After a successful/evolve dialectic --apply— or after the operator explicitly discards a reviewed proposal — the skill now writes the last-run stamp AND deletes.orchestrator/dialectic-pending.md. Nothing else writes the one or removes the other, so without these two calls the session-startmaintenance-dueprobe reporteddialecticandpending-sidecaras due forever. The same step now serialisesresult.diff(an object{ user?, agent? }) into the Markdown stringwriteDialecticPendingexpects — passing the object threwTypeError. -
scripts/lib/reconcile/backlog.mjs— a LEAF module holdingpartitionMaterialized/countReconcileBacklog, re-exported fromscripts/lib/reconcile/engine.mjsso every existing caller is unchanged. The session-start reconcile-nudge probe imports the count from here instead of from the write-capable engine, which dragged the emitter, renderer, unicode validator and candidate-store writer into a read-only banner's static closure: 11 modules / 151,946 B → 19 modules / 322,897 B (+112 %, measured 2026-09-18), inherited unasked byscripts/lib/maintenance-due-banner.mjs. The leaf brings the probe back to 13 modules / 176,331 B (and the maintenance-due banner from 35 / 577,439 B to 29 / 430,873 B); the +2 modules against the pre-session closure are the leaf itself pluseligibility.mjs, the price of the probe counting the same population/reconciledoes. The runtime cost was never the point; a banner must not be able to reach a writer. -
Three runtime-read Session Config surfaces that no document described, now in
docs/session-config-reference.mdfirst anddocs/session-config-template.mdsecond (#1155, #1243, #1365):cross-repo.projects(a block key, NOT the flatcross-reposlist — only the inlineprojects: [a, b]form is read, a-block list yields[]silently),worktree-exclude(with its measured scope limit:createWorktree()has no production caller, so the key changes nothing in a wave today) and the wholegitlab-portfolioblock (enabled/mode/stale-days/critical-labels— the last is block-form only; an inline list is silently ignored). -
scripts/lib/js-mask.mjs(maskSource(src, { keepLiterals })) — ONE JavaScript lexer for every "separate code from data" scanner here, with the regex-literal branch three hand-rolledstripCommentscopies never had (#1388). Five consumers:scripts/lib/validate/check-untracked-test-deps.mjs(where it grew; a one-line re-export keeps the old import path alive, becausepackage.jsoncarries noexportsmap and everyscripts/lib/**path is therefore public),check-entry-guard.mjs, plus the three converted this session —check-validator-registration.mjs,check-test-git-config-target.mjsandscripts/lib/auq/parse.mjs(see Fixed for what each was measurably getting wrong). Named ceiling (BV-004) on the one-token keyword lookback, measured 2026-09-18 overgit ls-files '*.mjs'(1245 files): 0 genuine division chains afterreturn/typeof/case/… — all 18 files whose masking the lookback changes carry a real regex literal; revisit trigger is the first such chain. -
scripts/lib/vault-yaml.mjs(readVaultSlug(repoRoot),VAULT_YAML_FILE) — the reader for themetadata.slugkey in a repo's own.vault.yaml, which nothing read until now (#1131). Every vault writer derived the vault folder from the CHECKOUT DIRECTORY name instead (narrative-mirror.mjsviasubjectToSlug,vault-mirror/namespace.mjsviabasename(process.cwd())), so a repo whose directory name differs from its registered slug had its narrative, sessions and learnings filed under a second, wrong folder — and the #829 loose-slug healer only repairs case and punctuation drift, never a genuinely different name. Precedence is now explicitrepoopt >vault-nameoverride > declared slug > basename (narrative-mirror.mjs) andvaultName> declared slug >deriveRepo()(namespace.mjs, which stays a leaf:node:fs,node:path,node:module,vault-mirror/utils.mjs). A declared slug SKIPSresolveLooseSlug— it IS the canonical folder name, and healing it re-opens the ambiguity that keeps a duplicate pair alive once one exists. The reader never throws: absent file, unreadable file, malformed YAML, missing key, non-string or non-slug value all returnnulland leave the caller on its pre-#1131 chain, andjs-yamlis resolved lazily throughcreateRequireso a checkout withoutnode_modulescannot crash at module load. -
renderPendingBody(diff)/comparePendingBody()inscripts/lib/auto-dialectic.mjsplus the Step 6.4 prose and its AUQ inskills/evolve/references/evolve-dialectic-mode.md(#1386).--applynow compares the FRESHLY derived body against the sidecar the operator actually reviewed before any peer card is written. The serializer moved out of the skill's JS snippet VERBATIM so both paths build the body from one implementation — two hand-copied serializers would report drift that is only formatting. -
.orchestrator/consumed/<ISO-stamp>-<rand>-dialectic-pending.md(DIALECTIC_CONSUMED_DIR,DIALECTIC_CONSUMED_RETENTION= 10, #1388):consumeDialecticPendingMOVES the sidecar instead of unlinking it — it was the only copy of what the operator reviewed. Themaintenance-dueprobe reads an explicit two-path list, so an archived file does not re-raisepending-sidecar(#1380 stays fixed). Ceiling + revisit trigger (BV-004): newest 10; revisit ifcheckStaleArtifactsever reports aconsumed/file, since it counts every untracked.orchestrator/**file older than 30 days. The prune is best-effort — a failure never fails a consume. -
isRuleExpired(rawExpiry, now, onUnparseable), exported fromscripts/lib/rule-loader.mjsand now also the gate inscripts/lib/reconcile/backlog.mjs'sdefaultReadMaterializedProvenance(#1387). An EXPIRED rule file is skipped WHOLE — frontmatter key and body bullets alike — so its learnings stop counting as materialized by a rule that no longer reaches any agent (materialized forever, re-proposable never). ONE predicate, ONEDate.parseand one clock reading per scan, fail-open in both consumers: an absent or unparseableexpires-atis NOT expired, because fail-closed would un-materialize the whole corpus on one typo. Two limits documented indocs/rule-authoring.md§ Consolidated rules andskills/reconcile/SKILL.md, both measured 2026-09-18 and both left unsolved on purpose: it covers only the on-disk half ofpartitionMaterialized(79 of this repo's 92 provenance keys are ALSO sidecar-terminal, so 13 keys actually return — the sidecar half carries operator DECLINES and must not re-ask an answered question), and a file the sweep cannot split (no-1to1-mapping&c.) that then expires legitimately re-proposes on every run with no mechanical exit (--dry-run --jsonreportedskipped: []over 7 generated files, so the live tree is clear). -
header_raisesin thesweep-expired-rulessummary and its human stdout line (scripts/sweep-expired-rules.mjs,summarizenow exported, #1388). A header-raise is anaction: 'rewrite'plan carryingreason: 'header-raise', so it was counted insiderewritesand invisible on stdout although--jsonalways carriedplans[].reason. It is a SUBSET ofrewrites, never a sibling — the two are deliberately not disjoint. -
malformed_scope_fileson theverifyWaveScopereport, thescope_verifiedpayload and the human table (scripts/lib/scope-echo.mjs,docs/events-schema.md; #1379). A per-agent<state-dir>/filescopes/wave-<N>/*.jsonthat cannot be read or parsed was skipped silently, which made a wave with corrupt scope files indistinguishable from one that was never injected — the samedigest-unknown/injection-missingverdicts either way. Always present, including as0, the same honesty guaranteemalformed_linescarries for the ledger side (HR-105). A file that parses but holds an empty or non-array scope is NOT counted: an empty scope is legitimate. -
closeIssues()and the--close [--vcs gitlab|github] [-R <spec>] <id>...CLI inscripts/lib/issue-close-strip-labels.mjs(#308) — one call strips everystatus:*label, closes, then re-reads each issue, printing one JSON line per id ({id, stripped, closed, state}) and exiting 1 when any id did not verify as closed.skills/session-end/references/phase-5-issue-cleanup.mdPhase 5 now runs this single command instead of the old two-stepstripStatusLabels+glab issue closeprose, which had been skipped often enough that 339 closed issues still carriedstatus:in-progress(measured 2026-09-19). -
WAVE_KEY_ALIASES(agents_planned/agents_started/agents_completed→agent_count_*) andnormalizeWaveKeys()inscripts/lib/session-schema/{constants,normalizer}.mjs, applied on read bynormalizeSessionand on write byscripts/emit-session.mjs(#1390 P1) — one recorded session (main-2026-09-18-session-1, 5 waves) had written the de-underscored spelling, so everyagent_count_*reader sawundefinedfor its waves.scripts/emit-session.mjsalso derives the optional fieldsession_start_reffrom STATE.md'ssession-start-reffrontmatter — owner-checked, full sha only — so/evolve analyzegets an attributable commit range instead of a time window that also catches a parallel session's commits (#1339 P8).scripts/lib/session-schema.mjs's barrel now also re-exportsisCoordinatorDirectHousekeepingfrom the existingsession-schema/filters.mjs. -
resolveRepoNamespace({ repoRoot })inscripts/lib/vault-mirror/namespace.mjs(#1389) — reads the declared.vault.yamlslug from a caller-suppliedrepoRootinstead of alwaysprocess.cwd();scripts/lib/vault-mirror/process.mjsandscripts/vault-mirror.mjsthread the CLI's invocation cwd through. Additive: every caller that omitsrepoRootis unaffected. -
neutralizeFingerprintSentinel()andfingerprintSentinelLine(), exported fromscripts/lib/test-runner/issue-reconcile.mjs(#1339 P6) — the one shared sentinel-neutralisation and sentinel-writer pair, now also used byscripts/lib/ux-grill/reconcile.mjs'soneLine()/buildUxGrillIssueBody()instead of a second hand-copiedsanitizeSentinel(). -
scripts/lib/skill-evidence-window.mjs— the skill-applied-judge (instruction-adherence/report-quality) gets an actual evidence window for the first time: excerpts built around the skill's call site in the transcript instead of a tail slice (#1399). Measured: the call site landed inside the old tail window in 6 of 67 cases, inside the new call-site window in 67 of 67.runSkillJudgeno longer dispatches on near-empty evidence — the previous''default was 1387 characters, under the 8000-token gate, and was silently judged as though it were real transcript content. Session-end Phase 3.6.6 now joins over the raw UUID. -
A second PSA-006 claim class,
gate-verdict(hooks/_lib/subagent-transcript.mjs,hooks/post-subagent-discovery-validator.mjs; #1385 S2) — a completion/gate-green assertion (STATUS: done, "tests pass", "alles grün") carrying no run receipt (a pass/fail count, a file count, or an exit code) and no adjacent measurement command. The scanner had been structurally blind to exactly these two line shapes: the #1198 gate-summary exemption skippedSTATUS:/"N passed" lines before any pattern ran. Measured on a 130-case labelled corpus built for this fix: the scanner answered "no violation" on 128 of 130 before the fix (accuracy 30.2%, Cohen's κ 0.007 — indistinguishable from guessing); after, wanted hits went 6/92 → 12/92 with false positives unchanged at 3/34. Records now carrykind; a record with nokindpredates the split and isdistributionalby construction. The hook remains log-and-warn — it blocks nothing. -
scripts/release-session-lock.mjs— a new CLI that releases the session lock, emitslock.releasedwith explicit session/lock IDs, and reads the lock back to confirm absence; exit 0 only when the release is verified (#1395).skills/session-end/SKILL.mdPhase 3.8 is now this single call instead of prose instructions to release the lock. Measured before this change: this repo's own ledger held 5acquiredevents against 0released; fleet-wide 110 of 702 (15.7%). -
orchestrator.wave_dispatch.worktree_base_checked(#1413) — a new event from the dispatch hook, which compares HEAD againstsession-start-refbehind a process-local identity check and warns (never blocks) on drift; the worktree base belongs to the harness, since the Agent tool itself carries no base field. The event always carries astalevalue on BOTH outcomes, on purpose — reporting only the positive case would leave the firing rate unfalsifiable. Measured: per-wave isolation shows in 2 of 455 records, a commit marker in 0 of 455. -
Epic #1425 Stufe 1, Teil A —
scripts/lib/process-group.mjs(spawnInGroup,killProcessGroup,verifyProcessIdentity,installExitHandler,recordGateProcess/readGateProcessLedger/pruneGateProcessLedger,buildCommandSignature).spawn(cmd, { shell: true })makes the SHELL the child, sochild.kill()signalled that shell only and its own children (tsgo --noEmit, vitest workers) were reparented to PID 1 and kept running — the 2026-09-20 incident on this host: four orphanedtsgoprocesses, two at PPID 1, 86–588 % CPU and up to 8.0 GB RSS each, the machine at 13 % free memory.detached: truemakes the shell a process-group LEADER, soprocess.kill(-pgid, sig)reaches every descendant that did notsetsidaway. The kill is a ladder — SIGTERM →DEFAULT_KILL_GRACE_MSgrace (re-exported fromwave-executor/dispatch-common.mjs, never re-defined) → SIGKILL to the GROUP — because a grandchild installingtrap "" TERMsurvives the group SIGTERM (measured on Darwin 25.6.0, 2026-09-21). Three further measured constraints are wired in rather than assumed:closefires only once every group member has closed the shared pipe (hence a hard deadline),maxBufferdoes not exist on asyncspawn(hence a hand-rolled 16 MiB byte cap reproducing the existing spawnSync/ENOBUFS contract), and a detached child survives its parent's exit at PPID 1 (henceinstallExitHandler). A4, the ancestry register: every gate process this repo starts itself is recorded with pid, pgid, start time and command signature in.orchestrator/runtime/gate-processes.jsonl— the identity basis Teil B joins against. -
Epic #1425 Stufe 1, Teil B —
scripts/lib/orphan-reaper.mjs(#1430, #1431, #1433): the net under the process-group kill, for orphans that happen anyway (a crashed session, a harness SIGKILL, a leak from a foreign repo on the same host). Shape is thelock-reaper.mjssplit —parsePsSnapshot→decideReapCandidates(PURE: no I/O, no signal, fully testable frompstext fixtures) → targetedps -pidentity re-check →killProcessGroup→ wait → re-measure. A candidate is a CONJUNCTION (register ∧ PPID 1 ∧ age ∧ read-only command signature ∧ identity still verifying), because PPID 1 alone is a weapon pointed at the operating system: 538 of 784 processes (68.6 %) had PPID 1 on this host, measured 2026-09-21. The identity gate runs before SIGTERM and before SIGKILL, so a recycled pgid aborts the ladder instead of being signalled. Effect is read back afterverify-wait-ms—survived_sigkillis never booked as success (PRD B6: on 2026-09-20 the ad-hoc check falsely reported "still alive" because it measured immediately afterkill -9). Every decision, including a withdrawn one, is appended to.orchestrator/metrics/reaper-audit.jsonl;falseAlarmRate()judges the instrument over a rolling window of decisions and reportsinstrument_suspectabove the 10 % HR-101 ceiling without ever acting on it. The existing detector (countZombieProcesses) would have counted ZERO in the 2026-09-20 incident: itspscarries noppidand norss, and it defines a zombie as IDLE — the exact opposite of a runaway. -
Orphan-scan triggers in two hooks, plus the
reaper:andgate:Session Config blocks (#1432 B4).hooks/post-tool-batch-wave-signal.mjs(PostToolBatch — the only hook with measurably high frequency during a wave) andhooks/on-stop.mjs(Stop + SubagentStop — which lands exactly when gate children have just finished) each do one config read plus onestatof the shared throttle marker.orchestrator/tmp/reaper-last-scan, then hand the work to a DETACHED,unref()-ed child running the new CLI tail oforphan-reaper.mjs. Nothing is scanned inline: onepsround-trip out of Node was measured at ~47 ms, alone over the 50 msreaper.max-hook-latency-msbudget; steady-state hook latency with the trigger in place measured 0.15 ms. New parsersscripts/lib/config/reaper.mjs(_parseReaper) andscripts/lib/config/gate.mjs(_parseGate), both tolerant and independent of the## Session Configsection boundary, with the blocks documented opt-in indocs/session-config-template.mdanddocs/session-config-reference.md. New eventorchestrator.reaper.scan_completed, emitted at most once per scan and only when the scan found something (candidates, reports or kills) or the instrument itself is suspect (false-alarm rate over 10 % of the lastfalse-alarm-windowdecisions) — a per-fire record would be exactly the always-on signal HR-101 calls a broken instrument. -
scripts/lib/validate/check-hook-entry-guards.mjs(#1422) — an AST oracle over the hooks registered in the four hook manifests, flaggingmissing-entry-guardandtoplevel-profile-exit. Registered BLOCKING inscripts/validate-plugin.mjs(232 checks / 0 failures at110f334d). The class it closes is concrete: a hook-reachable module without an entry guard executes its whole program when imported. -
scripts/check-sessions-integrity.mjs(#1417) — CLI front-end forcheckSessionsIntegrity(--session-id,--json; exit 0/1/2, a missing record deliberately exiting 1). Until now the check existed only as anode --input-type=module -eone-liner insideskills/session-end/session-metrics-write.md, because the function had no entry point. The #1408 record parsed fine and was still invalid (ended_atinstead ofcompleted_at, four required fields missing), so vault-mirror dropped it asskipped-invalidand nobody was told until the next session-start banner. -
scanEventsBackwards()/listEventSourcesNewestFirst()inscripts/lib/events.mjs(#1414) — newest-first reading across ledger rotations, so a reader that only needs the recent tail stops at the first hit instead of parsing the whole corpus. PlusparseEtimeToSeconds()inscripts/lib/resource-probe/parsers.mjs, thepsetimeparser the reaper's age criterion needs.
Changed
- Default
dialectic.budget-tokens8000 → 32000 (DEFAULT_BUDGET_TOKENSinscripts/lib/config/dialectic.mjs, now the SSOT thatscripts/dialectic-deriver.mjs'sDEFAULT_BUDGET.inputimports; #1380). The value is an INPUT CEILING the pre-dispatch estimate aborts on, never a spend and never a truncation — so the old default made a real corpus unrunnable rather than smaller: card bodies + steering alone estimate ~12k tokens in this repo, a consumer repo measured 11,158 (2026-09-10) and 30,262 (2026-09-18). Repos that already setbudget-tokensexplicitly are unaffected; repos on the default stop endingbudget-exceeded. Docs, template and the--budget-tokenshelp text in the evolve skill (and its generated.agents//.codex-plugin/copies) say "ceiling", not "budget". - The dialectic deriver's output contract is per-
##-section, not a full-body replacement (agents/dialectic-deriver.md, the prompt inscripts/dialectic-deriver.mjs,skills/evolve/references/evolve-dialectic-mode.md; #1380). The merge has been section-wise since #1310 — but the agent was still told "emit the FULL replacement body … omitted sections are deleted", which invites an LLM to reproduce every hand-written managed section. The prompt now says omitted sections stay unchanged, and the anti-pattern list is corrected: an invented section is NOT rejected downstream (detectEmptyingrefuses only a proposal with zero content lines), so the instruction is to skip the target instead. - The backticked-citation checker now scans the rule corpora, and it blocks.
scripts/lib/validate/check-skill-script-paths.mjsadds.claude/rulesand.cursor/rulestoSCAN_DIRSplus aMD_EXTENSIONScovering Cursor's.mdc(#1384). Both surfaces ship —.cursor/rulesgoes into the npm tarball and is symlinked into consumer repos — and neither had a gate;.cursor/rules/010-session-workflow.mdckept citingcommands/go.mdandcommands/close.mdfor a full release after3ebf0e9dfolded them into skills. Measured 2026-09-18: corpus 295 → 329 files, 4 blocking findings on the first run (all fixed in the same change, see Fixed). Because a rules file legitimately cites paths that only exist at runtime, a missing target is excused only when it is under a harness state root (.orchestrator/,.claude/,.codex/,.cursor/,.pi/) and git ignores it — onegit check-ignore --stdinfor the whole run, failing open toward REPORTING. The git half alone would have silenced a typo in adocs/specs/…orcoverage/…citation forever.check-skill-links.mjsdocuments the resulting division of labour: links there, backticked citations here. - Three consolidated rule files now expire earlier —
.claude/rules/measurement-discipline.md2026-10-04 → 2026-10-02,.claude/rules/review-and-adapter-contracts.md2026-10-04 → 2026-10-02,.claude/rules/test-hygiene.md2026-10-20 → 2026-10-07 (#1382). Each header was outliving its own earliest absorbed learning, which the merge contract forbids (docs/rule-authoring.md§ Consolidated rules); the body sentenceexpires-at <D> = the EARLIEST of the N absorbed dateswas corrected with it. Consumers loading these rules lose them from injection sooner. Five folded provenance pairs acrossguard-design.md,identity-and-locks.md,review-and-adapter-contracts.mdandtest-hygiene.mdare annotatedmarkers onlywith the entry their substance was folded into, so all 7 consolidated files are 1:1 sweepable again rather than 3 of 7. - The expiry sweeper now RAISES a too-low rule header (
scripts/lib/reconcile/rule-expiry-sweep.mjs, #1382): a frontmatterexpires-atsitting EARLIER than the earliest absorbed date is lifted to it, as its own rewrite trigger (action: 'rewrite',reason: 'header-raise', visible in--dry-run --jsonbefore--apply) touching nothing but that line and the counter sentence. Left alone the file passes its header date with nothing expired,rule-loader.mjsstops injecting it, and the surviving provenance markers keep/reconciletreating its learnings as materialized — the substance goes dark and is never re-proposed. Measured 2026-09-18 on the live corpus: 3 of 7 files in that state (identity-and-locks→ 2026-10-02,process-contracts→ 2026-10-27,toolchain-and-build→ 2026-10-16), ≈31.5 kB. The direction is one-way by contract: a header that OUTLIVES its content is still reported as anadvisoryonly, because lowering on every run would cut a healthy entry's TTL short. Documented indocs/rule-authoring.md§ point 2. scripts/release.mjs'sevaluateCiRow()names the CAUSE a CI preflight row went red (#1384): the degraded branch appends the probe'sdetail, the read branch falls back todetails.reasonwhen no failing job can be named. A shortsha, a commit the mirror has never seen and a HEAD with no pipeline all printed the identicalCI status unknown (query-failed)before. With neither field present the text is byte-identical to before.scripts/lib/ci-status-banner.mjsclamps and control-byte-escapes every API-supplied fragment (reason,failingJobName,allowFailureJobs) at generation viasanitizeApiText(), 60 chars (#1384). The degraded branch has escaped since #1031; the READ branch interpolated a raw APIstatus— a value carrying\rplus an ANSI sequence could repaint the release preflight'sci-green-on-headrow green while its verdict stayedok: false.isUserInvocableValue(value, file, key)takes the frontmatter key it is judging and names THAT key in its WARN (scripts/lib/user-invocable-skills.mjs, #1384). It is also the normaliser for the sibling markerdisable-model-invocation, and adisable-model-invocation: yesdemotion reporteduser-invocable: "yes"— sending the operator to a line that does not exist in the file.scripts/generate-cursor-adapter.mjsnow parses each SKILL.md once through a memoisedskillFlags(): the predicate is not side-effect-free, so reading the same key from three call sites emitted the same WARN three times (measured on a two-skill fixture: 3 lines for 2 defects).scripts/lib/validate-vendored-rules.mjsno longer validatesREADME.mdas a vendored rule —rules-sync.mjsvendors only the entries listed in_index.md(#1164). Six library rules underrules/dropped## See Alsoentries naming files the vendored corpus does not contain (development.md,security.md,testing.md,mvp-scope.md,cli-design.md).