Skip to content

Garry's Opinionated OpenClaw/Hermes Agent Brain

TypeScript
28.3 KB
Raw Blame

Key files: Core Cycle (patterns)

Subsystem index · Previous entries. Read only the entries relevant to your change. Current behavior and load-bearing invariants; history belongs in Git and CHANGELOG. Patterns, drift reports and the cycle modules listed after them.

  • src/core/cycle/patterns.ts — Patterns phase: cross-session theme detection over reflections within dream.patterns.lookback_days (default 30). Names a pattern only when ≥dream.patterns.min_evidence (default 3) reflections support it. Reflection excerpts use the shared UTF-16-safe truncator; a raw .slice(0, 600) can split an emoji pair and make Postgres reject the subagent job's JSONB payload. Single Sonnet subagent; same allow-list path as synthesize (imports loadAllowedSlugPrefixes + loadOutputRoot from synthesize.ts — the reflections lookup, prompt slug templates, and allow-list all honor dream.synthesize.output_root, default 'wiki'). Subagent job/wait timeouts are config keys dream.patterns.subagent_timeout_ms / dream.patterns.subagent_wait_timeout_ms (defaults 30/35 min, mirroring the dream.synthesize.* pair). The phase status reflects the child outcome: non-completed outcome with zero writes → fail (error code PATTERNS_CHILD_<OUTCOME>); non-completed with partial writes → warn. Runs AFTER extract so the graph is fresh. The fan-out sets require_writes: true so an all-writes-failed child dead-letters instead of reporting completed. Budget clamping: clamped to the remaining parent-job budget via clampSubagentBudgets when the cycle threads deadlineAtMs — the clamp template synthesize.ts reuses; MIN_PATTERNS_SUBAGENT_BUDGET_MS gates an honest skip, and CYCLE_DEADLINE_RESERVE_MS is re-exported here from its base-phase.ts home. Evidence watermark: a completed child stamps the newest consumed reflection updated_at into the state row dream.patterns.last_evidence_ts (never now(); fail/warn/timeout paths don't stamp, so a dead child retries next tick), and a later run skips no_new_evidence while no reflection in the window is newer — autopilot's hourly global tick becomes a free skip until a reflection actually changes; an absent/unparseable stamp fails open; --once bypasses the gate but a completed forced run still s... (line truncated to 2000 chars) Reflection excerpts in the subagent prompt and the quote-grounding sources are the reflection's publicBody, so neither carries a facts row other than world or a takes row (test: test/cycle-world-fence-rows.test.ts).

  • src/core/cycle/drift.ts report publication (#6052): a managed drift report whose publish is held (publishOrHold) is not linked in the detail, reports_written is 0 and publish_deferred 1, the detail names the hold (accepted and still publishing, or not admitted under database contention), and the phase is partial; every other publish error still throws. Both publish paths carry the report's derivation (#9208): channel derive:drift over the judged pages, whose timeline entries are the judge's evidence, so the report takes their least trusted tier capped at agent_written.

  • src/core/cycle/phases/consolidate.ts — the consolidate phase: clusters facts per page and promotes the best claim into a take. Its bucket scan lists only entities with a live page in the source (GBRA-574 E1), so a conversation-only brain's name keys cost no per-bucket read (test/conversation-unbacked-keys-gbra574.test.ts). cycle.consolidate.enabled (default on; an explicit falsy value returns skipped, #6667) is read inside the phase; dream --phase consolidate --once bypasses it. Take identity for the upsert lookup is (page_id, claim) restricted to rows this phase authors (kind='fact' AND holder='self') — since_date is NOT identity (it derives from MIN(valid_from) of the cluster and moves whenever extract_facts re-inserts, which degraded the lookup into duplicate INSERTs); deliberately NOT filtered on active (a superseded take still owns its claim — skipping it would resurrect a retired claim via the INSERT path); ORDER BY id keeps the pick deterministic across pre-existing duplicate rows. A resolved take is immutable — its id is reused for consolidation but the row is left untouched. Managed local consolidation passes the cycle source ID, publishes take, contributing facts and validity changes atomically: a fenced member on the entity page is closed in its ## Facts fence row in the same page publication and its valid_until derives from that cell, an unfenced member is closed in the database, and a member fenced on another page stays open (test test/consolidate-fenced-close-reimport.test.ts). A member ends at the next member that says something else by claim text and typed value (consolidationCloses in persistence/prepared-maintenance.ts, both paths), so a restated value stays open from its first statement and every copy ends together when the value changes (test test/consolidate-restatement.test.ts). Retired/resolved matching takes produce a durable skipped receipt; semantic intent excludes vectors/timestamps/cache metadata, while a genuine newer fact/page snapshot changes request identity. Only live world-visible evidence is promoted; private facts remain private. #5575 ENG-3: fact tiers are read per bucket and external_untrusted facts cluster in a separate pass, so an external claim never shares a take with owner facts. Each cluster's take is written at derive:consolidate = min(cluster fact tiers, agent_written): unmanaged, the take insert or re-promotion, consolidation marks and valid_until writeback are one derivedMaintenanceTransaction (a re-promotion lowers the existing take to min(existing, cluster), even a resolved one); managed, the request carries declareDerivation. Edges: take -> every cluster fact. The unmanaged path runs the write gate (decideTakeWrite, config read once per run via loadImportSanityConfig) on each... (line truncated to 2000 chars)

  • src/core/cycle/synthesize-verify.ts — Mechanical claim verification on every page a synthesis child wrote (zero LLM). Exports the shared grounding primitive normalizeForGrounding (whitespace/curly-quote/dash/ellipsis/case folding, skipping markdown inline markup (*, backticks, ~~; not _), WITH an offset map back to the original string, so every replacement is a verbatim transcript slice; a slice that differs from the quote only by that markup counts exact and is not spliced in) + normForGrounding (plain form, also used by buildTriageMapBlock and triage-rescue). A source built with groundSource(path, content, { tolerant: true }) (think, concepts and patterns; never dream synthesis) also reads markdown link syntax and any other square bracket as plain text ([Name](target), [Name] and Name match; repairs drop link targets and never carry a "), folds " to ', and counts a quote exact when its words match once the writer's edge punctuation and elision, brackets (including a bracketed letter's case, [T]he), editorial insertions in a word (decide[s], want[ed]) and inner quote style are set aside. Think also grounds against the user's question. groundSource(path, content) prepares a transcript: offset map, speaker turns (parseSpeakerTurns: bold **Name** (ts): anchors and standalone [user] / [assistant] / [system] role lines (the session-corpus renderer's turn boundaries, so a Name: label inside one turn never carries into the next) always, plain Label: anchors when the label is a role word or opens two or more lines), canonical numbers and dates (numericFacts: $250K = $250,000 = 250 thousand, 2026-03-14 = March 14th; the file basename counts), and speaker-mention patterns. In strict mode (dream synthesis) a quote that misses whole is retried on its core (quoteCore: edge elision and closing punctuation set aside) at the exact and normalized rungs; an exact core keeps the writer's quote, a normalized core is replaced by the verbatim source slice. groundQuote runs the ladder exact → normalized → near (word-trigram anchors, window clipped to the anchor's speaker turn, ≥0.8 token overlap, ambiguity within 0.05 falls through, trimmed to the first/last shared token, refused above 1.3x the... (line truncated to 2000 chars)

  • src/core/cycle/triage-backoff.ts — Backoff for unreliable dream-triage verdicts (#6069). runTriagePass calls recordUnreliableTriage for a truncated, refused or unparseable judge response: it upserts a dream_verdicts marker through putDreamVerdict (score NULL, content_type triage_unreliable, reasons unreliable:<kind> + attempt:<n>, the triage model and TRIAGE_VERSION) and writes one stderr line with the stop reason, response length and a 12-hex sha256 prefix, never the response text. A row that is a valid verdict for the current model is kept, and a cancelled run writes nothing. backoffUntil defers judging while the marker for the same model and version is younger than 24h × 2^(attempt−1), capped at 7 days; force (dream retriage --force), a model change or a content-hash change re-judges at once. Every score reader (isTriageCacheValid, retriage, triage-decide, the rescue gate) treats the NULL score as a miss; the 30-day TTL sweep removes old markers. TRIAGE_BACKOFF_WHY / TRIAGE_BACKOFF_FIX feed details.triage.unreliable_backoff. Pinned by test/synthesize-triage-backoff.test.ts. GBRA-130 B-6: VerdictCacheWrites isolates each verdict write (synthesize.triage_verdict_cache): a refused write is listed in details.triage.verdict_cache_failures and its verdict still decides the pass; a 22P02/22P05 refusal backs off as uncacheable. Both engines' putDreamVerdict apply wellFormedJson. Pinned by test/pathological/b6-triage-verdict-surrogate.test.ts.

  • src/core/cycle/attribution-checks.ts — #5425 [UC4]: dream.attribution_checks (ATTRIBUTION_CHECKS_KEY, registered in KNOWN_CONFIG_KEYS; config set takes a boolean word through CYCLE_GUARDED_KEYS in cycle/config-guards.ts), the one default-off switch for the two mechanical attribution checks: the propose_takes holder downgrade (propose-takes-attribution.ts) and the synthesis superseded_in_source quarantine (synthesize-verify.ts). attributionChecksEnabled(engine) is isConfigTruthy over the stored value and false on any read error. The default flips only on a held-out gbrain-evals receipt, the same bar as the prompt rules dream.synthesize.attribution_rules / dream.propose_takes.attribution_rules.

  • src/core/cycle/propose-takes-attribution.ts — #5425 [UC4]: downgradeAssistantOnlyHolders(proposals, pageBody), called once from propose-takes.ts right after the extractor returns when dream.attribution_checks is on. claimContentTokens takes a claim's numeric keys (numericClaims: currency, scaled amounts, percents, dates, 4+ digit numbers; bare years dropped) and its quoted phrases (extractQuoteSpans, normalized); statedBySpeaker credits each token to the speakers whose turns state it, plus a speaker who explicitly accepted the previous turn. A people/<slug> proposal every one of whose stated tokens was stated only by assistant is returned with holder brain; a token the user stated or accepted, a claim with no tokens, tokens no turn states, a page without speaker turns, and non-person holders leave the proposal untouched. Pure: returns the input array when nothing changes. Pinned by test/propose-takes-attribution.test.ts (standalone) and test/propose-takes-attribution-callsite.test.ts (the call, test.todo until the wave 13 hunk lands).

  • src/core/cycle/synthesize-verify-epochs.ts — the scope side of dream-page verification, peeled move-only from synthesize-verify.ts (module-size ratchet) and re-exported from it: readVerifyEpoch, loadChildWriteEpochs, loadPreRunRevision, isDreamOwnedPage, resolveVerifyPrior, exactly as described under synthesize-verify.ts above. Pure database reads; no claim check lives here.

  • src/core/cycle/synthesize.ts — Synthesize phase (a transcript whose estimate alone exceeds dream.synthesize.budget_usd is skipped as over_budget_alone, never a budget deferral of the rest): conversation-transcript-to-brain pipeline, a two-stage cascade where cheap scored triage gates frontier synthesis. Reads dream.synthesize.session_corpus_dir (session routing read-only in a dry run; each kept corpus file is pinned on its child job as corpus_source, file, corpus dir and source incarnation, which the child re-resolves before any model call, #7850), runs runTriagePass (exported; bounded pool dream.triage.concurrency default 4, wall-clock cache-MISS budget dream.triage.max_ms default 5 min — cache hits are free and deferred files report deferred: true, never cached, so the next pass continues) whose judge judgeSignificance emits {score 0-1 ordinal salience, content_type, segments ≤8 verbatim quotes, entities ≤12, reasons} (non-overlapping bands LOW 0-0.29 / MEDIUM 0.30-0.69 / HIGH 0.70-1.0; head 50%/middle 20%/tail 30% sample within dream.triage.max_chars default 24K via safeSplitIndex; out-of-[0,1] scores are unparseable, never clamped) cached in dream_verdicts with the judging model + TRIAGE_VERSION — cache validity requires BOTH to match (switching models.dream.triage re-judges; max_chars/max_tokens deliberately excluded from validity — dream retriage --force re-judges under new sampling knobs). Degenerate verdicts (truncated/refusal/unparseable) are never cached as verdicts: triage-backoff.ts upserts a score-NULL backoff marker instead and the next passes report the file deferred with code: 'triage_unreliable_backoff' (counted in details.triage.unreliable_backoff, not in deferred, so the cooldown and autopilot's maintenance stamp are not held) without a judge call until the backoff ends; nor is a verdict a chat_fallback_chain model gave (TriageResult.answeredBy, from the judge client's answered_by marker): it decides the run and the next cycle re-judges on the configured model. THE gate is passesTriageGate (triage-rescue.ts): score >= dream.triage.threshold (default 0.5) OR the verified-segment rescue, applied at report construction inside runTriagePass at READ time — retuning the threshold or rescue knobs re-gates with zero re-judging; the... (line truncated to 2000 chars) #7240: a transcript whose child cannot be queued (any error but a lost connection or cancellation) is skipped submit_failed (<code>) with its own fresh chunks rolled back, and the fan-out continues instead of failing the phase, whose private-queue cleanup would cancel every child already queued (test/dream-synthesize-submit-failure-7240.test.ts).

  • src/core/cycle/transcript-discovery.ts — Pure filesystem walk for synthesize. discoverTranscripts(opts) filters .txt files by date range, min_chars, and word-boundary regex excludePatterns (medical matches "medical advice" but NOT "comedical"; power users may pass full regex). readSingleTranscript(path) is the gbrain dream --input <file> ad-hoc path. Both carry a .txt session's agent speaker (its .speaker.json sidecar, corpusFileSpeaker, #8080), and buildSynthesisPrompt then tells the model the user turns are that agent's brief. Self-consumption guard: DREAM_OUTPUT_MARKER_RE (anchored at frontmatter open ---\n, optional BOM + CRLF tolerance, scans first 2000 chars for dream_generated: true with case-insensitive value and word boundary on true) drives isDreamOutput(content, bypass=false). Both functions skip matching files and emit a [dream] skipped <basename>: dream_generated marker stderr log (no silent skips). An excludePatterns hit is never logged per file (the matching files are sensitive by definition); instead both functions emit ONE [dream] excluded N transcript(s) matching exclude_patterns (<label>: n, ...) stderr line at the end of discovery, naming only the count and the configured pattern labels that fired, never a path, basename, or content. DEFAULT_EXCLUDE_PATTERNS is unchanged (medical, therapy). bypassGuard?: boolean on DiscoverOpts and readSingleTranscript's opts disables the guard for the explicit --unsafe-bypass-dream-guard escape hatch only — never auto-applied for --input. Two path-level guards run before the content read: selfCaptureSessionIds (from claudeCliSelfSessionIds) skips a .txt corpus file (session-end, checkpoint segment or writeback form, via corpusFileSessionId) captured from gbrain's own claude-cli call, and excludeDirs (synthesize passes the reflections, originals, patterns-output and cycle-summary directories under brainDir, empty under --unsafe-bypass-dream-guard) skips any file whose resolved path sits inside one, so an output a failed postprocess left unmarked is never re-synthesized while a transcript that merely names such a path is still disc... (line truncated to 2000 chars)

  • src/core/cycle/triage-rescue.ts — THE dream triage gate (passesTriageGate) + the verified-segment rescue (applyTriageRescue). Rescue fires only for scores in [floor, threshold) (floor inclusive; at/above threshold is the plain gate's job) with content_type in the buried-signal allowlist (default mixed/reflection/idea/strategy/people — never routine/technical) and ≥ minSegments of the judge's own segments verifying as normalized transcript substrings (normForGrounding, ≥40 chars, deduped by normalized quote — repetition is not more evidence). $0 — no LLM calls; fabricated segments cannot fire it; works on cached verdicts (gate-time only). Fail-closed on every malformed shape (null score, missing/short/non-string segments), never throws. minSegments: 0 is the kill switch (gate degenerates to the plain threshold). ONE-GATE RULE: runTriagePass (report construction — worth/rescued/telemetry/dry-run), the synthesize fan-out, and dream retriage (reconcile-queue cancels + --audit-rejects sampling) all read this predicate — a second hand-rolled score >= threshold check is how an operator sweep cancels exactly the jobs the rescue admitted. Config: dream.triage.rescue_floor / rescue_min_segments / rescue_content_types. Pinned by test/cycle-triage-rescue.test.ts + the rescue suites in test/cycle-synthesize-triage.test.ts / test/dream-retriage.test.ts. System One S7: a decide verdict (model starting with DECIDE_VERDICT_PREFIX) is gated against the S7 slot threshold (the optional fifth argument) and never enters the rescue band.

  • src/core/cycle/derived-write-through.ts — opt-in markdown write-through for generated pages on an unmanaged brain (#5041). cycle.extract_atoms.write_through / cycle.synthesize_concepts.write_through (off by default; true/1/yes/on) make derivedWriteThrough return a hook (null when off, managed or dry run): extract_atoms writes each item's atoms after the completion flip and removes the files of atoms it retired; synthesize_concepts writes through publishClassicConcept, which also rewrites a concept that already has a file whatever the key says. Creating the hook writes up to 200 generated pages per run that have no file yet (source_path NULL; pending atoms excluded), so enabling the key backfills. writeDerivedPageThrough keeps a page database-only when its target is ignored by git or sits in a declared storage.db_only directory (derivedFileTarget), replaces an existing file only when replaceableFile (facts/file-body-guard.ts) finds it equal to the page or one of its recent page_versions rows, then calls writePageThrough bound to the bytes compared with inlineOnly (a generated page stored in segments is skipped segmented_page, since the batch rollback compares file strings) and returns its result (written, skipped, error) so publishClassicConcept can surface a failed write. #8073: every file write and retired-file unlink is uncommitted (deferCommit) and the batch (an item's atoms plus its retired atoms' files, the backfill, or one concept) commits once through the shared-checkout door commitPathsLocked (git/commit-push.ts) under the source filesystem lock, naming only the batch's paths that exist or are tracked; a directory that is not a Git checkout, or whose checkout lookup fails (classifyGitCheckout unknown), has nothing to commit. A batch waits for a busy commit lock without blocking the event loop (acquireCommitLockAsync, up to 30 s), then takes it synchronously with a 2 s cap. A refused commit is rolled back under the commit lock (2 s wait; still busy, nothing is restored and every file stays in the pending ledger for that writer's commit): it leaves a file whose change HEAD already holds (another writer's locked commit swept it from the ledger) as committed, restores each other file still holding the bytes the batch wrote (WriteThroughResult.content; prior bytes, or removed), clears the source_path the write bound, settles the restored paths out of the ledger (settlePending), and returns a typed DerivedCommitFailure ({code, message, paths, kept}); the hook then writes nothing more that run and the phases report details.write_through_failed with warn (reportDerivedWriteThrough), while writeDerivedPageThrough returns it as error so the concept is held. Each page whose change was rolled back or left unwritten is marked in op_checkpoints (op derived-write-retry, fingerprint <source>:<slug>, pruned after the usual 7 days), and the next hook's backfill selects marked pages, live (rewritten, an update of an existing file included) and retired (file removed), clearing each mark once its change commits. Each file written or removed is also recorded in the door's pending ledger (notePending) right after the write, so a crash before the commit leaves it for the next commitPathsLocked in that checkout to sweep (ledger paths inside the source root that still differ from HEAD; only paths gbrain wrote are recorded). The dream reverse-write (writeDreamPageFile, removeDreamPageFile, reverseWriteDreamRefs) commits the same way: one batch per reverseWriteDreamRefs call (committed in a finally, so an abort still commits what it wrote) and one per summary write or retired-file removal; a refused commit rolls the files back and returns or pushes a write_through_failed hold, which the phases report through their existing file_holds. A checkout carrying a canonical owner marker commits through commitAndPush's named-paths-only path (commitManagedPaths), and paths git ignores are left uncommitted. Tests: test/cycle/derived-write-through-commit.test.ts (with the derivedWriteSeams.beforeCommit crash fault point) and test/cycle/dream-reverse-write-commit.test.ts (PGLite and Postgres). A retired atom's file is removed under the same filter and comparison, the unlink rechecking the bytes under the source filesystem lock. A file holding an edit the database lacks (or an unindexed file at a backfilled page's path) is left as it is and listed in the hook's held, which both phases report as details.file_holds (file_database_drift) with a warn status. Tests: test/cycle/derived-write-through.test.ts, test/pathological/d10-derived-atom-file-overwrite.test.ts, test/pathological/d11-derived-retired-atom-unlink.test.ts. #6982: writeDreamPageFile is the dream reverse-write (synthesize, patterns, the cycle summary): nothing with sync.write_through off, for a read-only mirror or an owned url clone (#8935: sourceMirrorReadOnly, before any path, so no brainDir fallback either, and no .sources/<id> fallback inside a read-only native checkout; removeDreamPageFile keeps the file) or a storage.db_only slug; the path is resolvePageWriteTarget's (recorded source_path), falling back to the caller's brainDir layout when the source has no root or its root is missing; the file is replaced only when replaceableFile (facts/file-body-guard.ts) finds nothing in it the database lacks and, once the replacement is staged, still holds the compared bytes right before the rename, else the result carries the file_database_drift hold. It writes directly (not writePageThrough/atomicWriteFileSync) because a checkout a subagent tool write claimed through the coordinator refuses those with writer_coordinator_required. reportFileHolds lists every phase's holds in details.file_holds and turns ok into warn.

  • src/core/cycle/concept-publication.ts — managed synthesize_concepts publication: publishManagedConcept publishes through publishMaintenancePage (a concept with a recorded source_path republishes to its file unless a db_only tier covers it; new concepts are database-only), and composeConceptRepublication keeps an existing concept's facts/takes fences, timeline, tags and other frontmatter, holding the concept (concept_preservation_hold) when a fence is duplicated, unbalanced, unparseable or below the timeline sentinel. replaceConceptProvenanceLinks banks the concept-provenance edges and retires the edges of atoms that left the group in one transaction (coordinated on a managed brain), only while the concept is at the revision its publication produced (GBRA-161 PR 5, C-4). On an unmanaged brain publishClassicConcept writes under the page lock the fence writers take: it re-reads the page, defers (revision_conflict) when the narrative changed since synthesis started, another writer owns it, or the page's canonical file holds anything the database lacks (replaceableFile: body, fences, timeline, frontmatter, tags, type or title equal to neither the page nor a recent page_versions row; formatting is ignored; this also covers an unindexed file at a new concept's path, and the message names the page with file_database_drift), and otherwise composes the new narrative with the database's latest fences, timeline, tags and frontmatter, so a take added during synthesis survives (test/pathological/d12-concept-stale-fences.test.ts, d13-concept-occupied-path.test.ts). The file write after importPage passes the bytes read under the lock as expectedFileBytes, so an edit landing during the import is kept and the concept deferred; a failed file write holds the concept (concept_write_through_failed) instead of reporting success (W9F item 3, test/cycle/concept-publication-file-recheck.test.ts). stripFenceSections is the shared narrative view. A publication the writer holds (accepted and still pending after its wait, or not admitted on contention) is reported in details.publication_pending (status warn, no completed round) instead of failing the phase (test/cycle/synthesize-concepts-accepted-pending.test.ts). Tests: test/cycle/synthesize-concepts-fences.test.ts. The phase keeps the private-first, provenance, then promotion order; revision races are deferred and holds rep... (line truncated to 2000 chars)

  • src/core/cycle/connector-atoms.ts — the connector atom setting (#5856). CONNECTOR_ATOM_PAGES_KEY (cycle.extract_atoms.connector_pages, on when unset; connectorAtomPagesEnabled treats only false/0/off/no as opted out) gates CONNECTOR_ATOM_PAGE_TYPES (email, meeting) of sources whose config.kind is a connector kind (CONNECTOR_SOURCE_KINDS). connectorAtomExclusionSql returns the pages p predicate atom discovery and the backlog count append (empty unless opted out), so the routine cycle, dream --drain and autopilot auto-drain extract connector mail and calendar pages under the auto-drain budget until the user opts out. Other page types of a connector source and every checkout-backed page are unaffected. Tests: test/connector-atom-pages.test.ts, test/autopilot-auto-drain-dispatch.test.ts, and the atom_drain_default_on / atom_drain_opted_out cases of test/helpers/managed-connector-job-contract.ts, run by test/managed-connector-job-contract.test.ts and its Postgres twin test/e2e/managed-connector-job-contract.test.ts.

  • src/core/cycle/pack-phase-gate.ts — the extract_atoms / synthesize_concepts pack gate (#6393). resolvePackPhaseGate(engine, phase, sourceId?) resolves through engineSchemaInput (DB config and per-source DB config, the tiers gbrain schema active uses) with the cycle's source; a phase that only a DB-config tier declares and the file-plane resolution did not is consent_required (plus resolved_pack, source_tier) until cycle.<phase>.enabled is true; a resolution error is pack_resolution_failed. packGateSkip returns the skipped PhaseResult (pack_gated: true, the gbrain config set cycle.<phase>.enabled true summary) or null when the phase runs; cycle.ts re-exports resolvePackPhaseGate and packDeclaresPhase delegates to it. Pinned by test/cycle-pack-gate-db-config.test.ts.