Skip to content

feat(kernel): port grounding-layer from daemon (aegis#446 epic shipped 2026-04-14) #34

@stackbilt-admin

Description

@stackbilt-admin

Summary

Daemon shipped the grounding epic (aegis#446/#447/#450/#500) 2026-04-14, landing in daemon v1.98.1→v1.99.5. The core work is captured in `web/src/kernel/grounding-layer.ts` (277 LOC) plus companion changes to the executor registry. Zero of this is upstream in core.

Why it belongs in core

The Chimera class of bugs the grounding epic resolved — models inventing schemas, guessing API shapes, fabricating file paths — is not specific to the daemon. Any aegis variant consuming the core router + dispatch loop will hit the same failure modes. Grounding is an architectural property of the dispatch substrate, not a Stackbilt feature.

Referenced by `executor-registry.ts:127-139` (gap-signal count gate for tier escalation, aegis#497) — so the gap-signal writer lives in `kernel/procedural.ts` and the reader lives in `kernel/executor-registry.ts`. Both substrates are already in core; the grounding layer that writes the signals is the missing middle.

Acceptance criteria

  • `web/src/kernel/grounding-layer.ts` ported to core with full public API
  • Companion changes to `kernel/executor-registry.ts` reviewed for core vs daemon split (gap-signal reading is generic; Stackbilt-specific thresholds stay daemon-side if any)
  • Subpath export added: `"./kernel/grounding-layer"`
  • Core schema additions for grounding-gap tracking migrated (pairs with core: route procedural reads through a derived-stats compat helper (supports daemon aegis#564 Phase 2) #30 Phase 3 — the `grounding_gap` column on `episodic_memory`)
  • Router integration point: core's `kernel/router.ts` calls into the layer at the dispatch boundary
  • Unit tests ported

Dependencies

Out of scope

  • Tool-call log cross-check + auto-strip + classifier split — deferred in daemon memory per `project_grounding_epic.md` pending production signal
  • Daemon-specific grounding rules that reference Stackbilt substrates — stay daemon-side

References

  • Daemon: `web/src/kernel/grounding-layer.ts` (277 LOC)
  • Epic trail: aegis#446, #447, #450, #500 (all closed)
  • Memory: `project_grounding_epic.md`
  • Related: aegis#497 (tier escalation gate — consumes gap signals)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions