decisionLookupRule function

String decisionLookupRule({
  1. String runner = kDefaultOverlayRunner,
  2. String? gridHome,
})

The register's READ rule — stated to every agent on the spec path.

The omission of a register-directory argument is named as LOAD-BEARING, the sibling register is given equal force, the citation identity is the canonical <repo>#<slug>, an empty union is declared a real result, and a FAILED lookup is explicitly refused as a clean grade (decisions index in roster mode throws on a malformed sibling entry, and a crashed lookup read as "no decision applies" would ship the very blindness this rule removes).

gridHome is the composing station's grid home (rosterDecisionIndexCommand renders the cd). A null or blank one yields _unavailableDecisionLookupRule: the rule REFUSES to name a verb the lane cannot run, and directs the direct register read instead.

Implementation

String decisionLookupRule({
  String runner = kDefaultOverlayRunner,
  String? gridHome,
}) {
  final home = gridHome?.trim() ?? '';
  if (home.isEmpty) return _unavailableDecisionLookupRule;
  final command = rosterDecisionIndexCommand(
    surface: '$kUnknownSubstationPrefix/$kRosterSurfacePlaceholder',
    runner: runner,
    gridHome: home,
  );
  return 'Look decisions up through the composing station\'s ROSTER-MODE '
      'index, '
      'never a local register grep. Read every literal path in the spec\'s '
      '`## Touches` section, prefix each repository-relative path with its '
      'substation repository name, and run '
      '`$command` once per '
      'unique roster-qualified path. Run it FROM the composing station\'s grid '
      'home exactly as shown — that verb resolves only where the station\'s '
      'own package is, and the same command run from this worktree exits '
      'non-zero with `Could not find package`. '
      'Pass NO register-directory argument: that '
      'omission is LOAD-BEARING — the grid adapter resolves the live '
      'mounted-substation roster and the command returns the UNION of every '
      'mounted register rather than only this repo\'s. Read the structured '
      'JSON '
      '`decisions` array and KEEP results from every `originRegister`: a '
      'SIBLING '
      'substation\'s entry has exactly the same force as a local one. Resolve '
      'each returned record by its `slug` under its `originPath`, quote the '
      'load-bearing clause, and cite it by its canonical `<repo>#<slug>` '
      'identity — for example `the_grid#admission-authority-boundary` (a '
      'migrated entry may also carry `register.legacy-id`, whose old citation '
      'still resolves). An EMPTY `decisions` array for every queried '
      'surface means no recorded decision governs these surfaces: say so and '
      'name the roster-qualified paths that verified it — an empty union is a '
      'real result, not an error. A lookup that FAILS or exits non-zero is '
      'NOT '
      '"no decision applies": report the failure verbatim and never grade a '
      'crashed index clean.';
}