Garry's Opinionated OpenClaw/Hermes Agent Brain
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 withindream.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 (importsloadAllowedSlugPrefixes+loadOutputRootfrom synthesize.ts — the reflections lookup, prompt slug templates, and allow-list all honordream.synthesize.output_root, default 'wiki'). Subagent job/wait timeouts are config keysdream.patterns.subagent_timeout_ms/dream.patterns.subagent_wait_timeout_ms(defaults 30/35 min, mirroring thedream.synthesize.*pair). The phase status reflects the child outcome: non-completedoutcome with zero writes →fail(error codePATTERNS_CHILD_<OUTCOME>); non-completedwith partial writes →warn. Runs AFTERextractso the graph is fresh. The fan-out setsrequire_writes: trueso an all-writes-failed child dead-letters instead of reporting completed. Budget clamping: clamped to the remaining parent-job budget viaclampSubagentBudgetswhen the cycle threadsdeadlineAtMs— the clamp template synthesize.ts reuses;MIN_PATTERNS_SUBAGENT_BUDGET_MSgates an honest skip, andCYCLE_DEADLINE_RESERVE_MSis re-exported here from its base-phase.ts home. Evidence watermark: acompletedchild stamps the newest consumed reflectionupdated_atinto the state rowdream.patterns.last_evidence_ts(nevernow(); fail/warn/timeout paths don't stamp, so a dead child retries next tick), and a later run skipsno_new_evidencewhile 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;--oncebypasses 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'spublicBody, 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.tsreport publication (#6052): a managed drift report whose publish is held (publishOrHold) is not linked in the detail,reports_writtenis 0 andpublish_deferred1, the detail names the hold (accepted and still publishing, or not admitted under database contention), and the phase ispartial; every other publish error still throws. Both publish paths carry the report's derivation (#9208): channelderive:driftover the judged pages, whose timeline entries are the judge's evidence, so the report takes their least trusted tier capped atagent_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 returnsskipped, #6667) is read inside the phase;dream --phase consolidate --oncebypasses it. Take identity for the upsert lookup is(page_id, claim)restricted to rows this phase authors (kind='fact' AND holder='self') —since_dateis 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 onactive(a superseded take still owns its claim — skipping it would resurrect a retired claim via the INSERT path);ORDER BY idkeeps 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## Factsfence row in the same page publication and itsvalid_untilderives from that cell, an unfenced member is closed in the database, and a member fenced on another page stays open (testtest/consolidate-fenced-close-reimport.test.ts). A member ends at the next member that says something else by claim text and typed value (consolidationClosesinpersistence/prepared-maintenance.ts, both paths), so a restated value stays open from its first statement and every copy ends together when the value changes (testtest/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 atderive:consolidate= min(cluster fact tiers, agent_written): unmanaged, the take insert or re-promotion, consolidation marks and valid_until writeback are onederivedMaintenanceTransaction(a re-promotion lowers the existing take to min(existing, cluster), even a resolved one); managed, the request carriesdeclareDerivation. Edges: take -> every cluster fact. The unmanaged path runs the write gate (decideTakeWrite, config read once per run vialoadImportSanityConfig) 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 primitivenormalizeForGrounding(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 bybuildTriageMapBlockand triage-rescue). A source built withgroundSource(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]andNamematch; 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 aName:label inside one turn never carries into the next) always, plainLabel: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.groundQuoteruns 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).runTriagePasscallsrecordUnreliableTriagefor a truncated, refused or unparseable judge response: it upserts adream_verdictsmarker throughputDreamVerdict(scoreNULL,content_typetriage_unreliable, reasonsunreliable:<kind>+attempt:<n>, the triage model andTRIAGE_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.backoffUntildefers 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_FIXfeeddetails.triage.unreliable_backoff. Pinned bytest/synthesize-triage-backoff.test.ts. GBRA-130 B-6:VerdictCacheWritesisolates each verdict write (synthesize.triage_verdict_cache): a refused write is listed indetails.triage.verdict_cache_failuresand its verdict still decides the pass; a 22P02/22P05 refusal backs off asuncacheable. Both engines'putDreamVerdictapplywellFormedJson. Pinned bytest/pathological/b6-triage-verdict-surrogate.test.ts.src/core/cycle/attribution-checks.ts— #5425 [UC4]:dream.attribution_checks(ATTRIBUTION_CHECKS_KEY, registered inKNOWN_CONFIG_KEYS;config settakes a boolean word throughCYCLE_GUARDED_KEYSincycle/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 synthesissuperseded_in_sourcequarantine (synthesize-verify.ts).attributionChecksEnabled(engine)isisConfigTruthyover 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 rulesdream.synthesize.attribution_rules/dream.propose_takes.attribution_rules.src/core/cycle/propose-takes-attribution.ts— #5425 [UC4]:downgradeAssistantOnlyHolders(proposals, pageBody), called once frompropose-takes.tsright after the extractor returns whendream.attribution_checksis on.claimContentTokenstakes a claim's numeric keys (numericClaims: currency, scaled amounts, percents, dates, 4+ digit numbers; bare years dropped) and its quoted phrases (extractQuoteSpans, normalized);statedBySpeakercredits each token to the speakers whose turns state it, plus a speaker who explicitly accepted the previous turn. Apeople/<slug>proposal every one of whose stated tokens was stated only byassistantis returned with holderbrain; 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 bytest/propose-takes-attribution.test.ts(standalone) andtest/propose-takes-attribution-callsite.test.ts(the call,test.todountil the wave 13 hunk lands).src/core/cycle/synthesize-verify-epochs.ts— the scope side of dream-page verification, peeled move-only fromsynthesize-verify.ts(module-size ratchet) and re-exported from it:readVerifyEpoch,loadChildWriteEpochs,loadPreRunRevision,isDreamOwnedPage,resolveVerifyPrior, exactly as described undersynthesize-verify.tsabove. Pure database reads; no claim check lives here.src/core/cycle/synthesize.ts— Synthesize phase (a transcript whose estimate alone exceedsdream.synthesize.budget_usdis skipped asover_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. Readsdream.synthesize.session_corpus_dir(session routing read-only in a dry run; each kept corpus file is pinned on its child job ascorpus_source, file, corpus dir and source incarnation, which the child re-resolves before any model call, #7850), runsrunTriagePass(exported; bounded pooldream.triage.concurrencydefault 4, wall-clock cache-MISS budgetdream.triage.max_msdefault 5 min — cache hits are free and deferred files reportdeferred: true, never cached, so the next pass continues) whose judgejudgeSignificanceemits{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 withindream.triage.max_charsdefault 24K viasafeSplitIndex; out-of-[0,1] scores areunparseable, never clamped) cached indream_verdictswith the judgingmodel+TRIAGE_VERSION— cache validity requires BOTH to match (switchingmodels.dream.triagere-judges;max_chars/max_tokensdeliberately excluded from validity —dream retriage --forcere-judges under new sampling knobs). Degenerate verdicts (truncated/refusal/unparseable) are never cached as verdicts:triage-backoff.tsupserts a score-NULL backoff marker instead and the next passes report the filedeferredwithcode: 'triage_unreliable_backoff'(counted indetails.triage.unreliable_backoff, not indeferred, so the cooldown and autopilot's maintenance stamp are not held) without a judge call until the backoff ends; nor is a verdict achat_fallback_chainmodel gave (TriageResult.answeredBy, from the judge client'sanswered_bymarker): it decides the run and the next cycle re-judges on the configured model. THE gate ispassesTriageGate(triage-rescue.ts):score >= dream.triage.threshold(default 0.5) OR the verified-segment rescue, applied at report construction insiderunTriagePassat 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 skippedsubmit_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.txtfiles by date range, min_chars, and word-boundary regexexcludePatterns(medicalmatches "medical advice" but NOT "comedical"; power users may pass full regex).readSingleTranscript(path)is thegbrain dream --input <file>ad-hoc path. Both carry a.txtsession's agentspeaker(its.speaker.jsonsidecar,corpusFileSpeaker, #8080), andbuildSynthesisPromptthen 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 fordream_generated: truewith case-insensitive value and word boundary ontrue) drivesisDreamOutput(content, bypass=false). Both functions skip matching files and emit a[dream] skipped <basename>: dream_generated markerstderr log (no silent skips). AnexcludePatternshit 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_PATTERNSis unchanged (medical,therapy).bypassGuard?: booleanonDiscoverOptsandreadSingleTranscript's opts disables the guard for the explicit--unsafe-bypass-dream-guardescape hatch only — never auto-applied for--input. Two path-level guards run before the content read:selfCaptureSessionIds(fromclaudeCliSelfSessionIds) skips a.txtcorpus file (session-end, checkpoint segment or writeback form, viacorpusFileSessionId) captured from gbrain's own claude-cli call, andexcludeDirs(synthesize passes the reflections, originals, patterns-output and cycle-summary directories underbrainDir, 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: 0is the kill switch (gate degenerates to the plain threshold). ONE-GATE RULE:runTriagePass(report construction —worth/rescued/telemetry/dry-run), the synthesize fan-out, anddream retriage(reconcile-queue cancels +--audit-rejectssampling) all read this predicate — a second hand-rolledscore >= thresholdcheck is how an operator sweep cancels exactly the jobs the rescue admitted. Config:dream.triage.rescue_floor/rescue_min_segments/rescue_content_types. Pinned bytest/cycle-triage-rescue.test.ts+ the rescue suites intest/cycle-synthesize-triage.test.ts/test/dream-retriage.test.ts. System One S7: a decide verdict (modelstarting withDECIDE_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) makederivedWriteThroughreturn a hook (null when off, managed or dry run):extract_atomswrites each item's atoms after the completion flip and removes the files of atoms it retired;synthesize_conceptswrites throughpublishClassicConcept, 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_pathNULL; pending atoms excluded), so enabling the key backfills.writeDerivedPageThroughkeeps a page database-only when its target is ignored by git or sits in a declaredstorage.db_onlydirectory (derivedFileTarget), replaces an existing file only whenreplaceableFile(facts/file-body-guard.ts) finds it equal to the page or one of its recent page_versions rows, then callswritePageThroughbound to the bytes compared withinlineOnly(a generated page stored in segments is skippedsegmented_page, since the batch rollback compares file strings) and returns its result (written,skipped,error) sopublishClassicConceptcan 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 doorcommitPathsLocked(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 (classifyGitCheckoutunknown), 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 thesource_paththe write bound, settles the restored paths out of the ledger (settlePending), and returns a typedDerivedCommitFailure({code, message, paths, kept}); the hook then writes nothing more that run and the phases reportdetails.write_through_failedwithwarn(reportDerivedWriteThrough), whilewriteDerivedPageThroughreturns it aserrorso the concept is held. Each page whose change was rolled back or left unwritten is marked inop_checkpoints(opderived-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 nextcommitPathsLockedin 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 perreverseWriteDreamRefscall (committed in afinally, 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 awrite_through_failedhold, which the phases report through their existingfile_holds. A checkout carrying a canonical owner marker commits throughcommitAndPush's named-paths-only path (commitManagedPaths), and paths git ignores are left uncommitted. Tests:test/cycle/derived-write-through-commit.test.ts(with thederivedWriteSeams.beforeCommitcrash fault point) andtest/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'sheld, which both phases report asdetails.file_holds(file_database_drift) with awarnstatus. 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:writeDreamPageFileis the dream reverse-write (synthesize, patterns, the cycle summary): nothing withsync.write_throughoff, 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;removeDreamPageFilekeeps the file) or astorage.db_onlyslug; the path isresolvePageWriteTarget'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 whenreplaceableFile(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 thefile_database_drifthold. It writes directly (notwritePageThrough/atomicWriteFileSync) because a checkout a subagent tool write claimed through the coordinator refuses those withwriter_coordinator_required.reportFileHoldslists every phase's holds indetails.file_holdsand turns ok into warn.src/core/cycle/concept-publication.ts— managedsynthesize_conceptspublication:publishManagedConceptpublishes throughpublishMaintenancePage(a concept with a recordedsource_pathrepublishes to its file unless adb_onlytier covers it; new concepts are database-only), andcomposeConceptRepublicationkeeps 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.replaceConceptProvenanceLinksbanks 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 brainpublishClassicConceptwrites 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 withfile_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 afterimportPagepasses the bytes read under the lock asexpectedFileBytes, 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).stripFenceSectionsis the shared narrative view. A publication the writer holds (accepted and still pending after its wait, or not admitted on contention) is reported indetails.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;connectorAtomPagesEnabledtreats only false/0/off/no as opted out) gatesCONNECTOR_ATOM_PAGE_TYPES(email,meeting) of sources whoseconfig.kindis a connector kind (CONNECTOR_SOURCE_KINDS).connectorAtomExclusionSqlreturns thepages ppredicate atom discovery and the backlog count append (empty unless opted out), so the routine cycle,dream --drainand 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 theatom_drain_default_on/atom_drain_opted_outcases oftest/helpers/managed-connector-job-contract.ts, run bytest/managed-connector-job-contract.test.tsand its Postgres twintest/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 throughengineSchemaInput(DB config and per-source DB config, the tiersgbrain schema activeuses) with the cycle's source; a phase that only a DB-config tier declares and the file-plane resolution did not isconsent_required(plusresolved_pack,source_tier) untilcycle.<phase>.enabledistrue; a resolution error ispack_resolution_failed.packGateSkipreturns the skippedPhaseResult(pack_gated: true, thegbrain config set cycle.<phase>.enabled truesummary) or null when the phase runs;cycle.tsre-exportsresolvePackPhaseGateandpackDeclaresPhasedelegates to it. Pinned bytest/cycle-pack-gate-db-config.test.ts.