Skip to content

FE-1116: Session-local elicitation gaps from a graph-derived seed#280

Merged
lunelson merged 12 commits into
nextfrom
ln/fe-1116-elicitation-gap-guidance
Jul 3, 2026
Merged

FE-1116: Session-local elicitation gaps from a graph-derived seed#280
lunelson merged 12 commits into
nextfrom
ln/fe-1116-elicitation-gap-guidance

Conversation

@lunelson

@lunelson lunelson commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

Stack Context

This stack advances Brunch's post-release workflow model: first retiring the persisted elicitation-gap register, then layering component tooling, walkthrough fixes, exchange rendering, and follow-up walkthrough prep.

What changed

  • Replaced persisted/spec-global elicitation gaps with session-local scratchpad state seeded from graph facts.
  • Swapped readiness-band array checks for latestExpectedBand(kind).
  • Materialized graph settlement (advisory / settled) and enforced settled-only reads where needed.
  • Removed legacy gap-register tools, seeds, and stale topology/docs language.

Why

The old persisted gap model made elicitation feel like global bookkeeping. This branch moves gap guidance to the current session, where it can remain advisory and graph-derived without becoming durable product truth.

Verification

  • npm run verify

lunelson and others added 7 commits July 1, 2026 14:50
…ard 1)

D94-L rejects earliest-band array reads; readiness-band consumers now read
one code-owned per-kind scalar (requirement moves commitment->projection,
story moves elicitation->band-less). Reconciles readiness-bands.md,
data-model.md, and question-kinds-per-intent-kind.md ownership split.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Adds the brunch.elicitation_scratchpad custom entry (parse/fold/append,
mirroring the runtime-state fold pattern) plus read/write Pi tools that
reconstruct current scratchpad state from the session branch. Old
persisted-gap tools are untouched pending Card 3 (repoint consumers) and
Card 4 (delete).
update_elicitation_scratchpad requires id for resolve/update, but the
rendered text omitted it — an agent reading tool content (not details)
had no way to reference an item. Render id=<id> on every line.
…s (Card 4)

Retires elicitation_gaps (table, schema types, seeded floor, driver,
command-layer CRUD, old read/update tools) and readiness-estimate
count-based scoring, with no compatibility bridge. Repoints the two live
prompt docs that still named the deleted register/tool (elicit and ingest
SKILL.md) to the session scratchpad; renames the capture-quality probe's
spawn_gap outcome to scratchpad_note to match. Topology-doc reconciliation
is deliberately deferred to Card 6 per the frontier's own sequencing.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…p register (Card 4 fixup)

Card 4 deleted the elicitation_gaps register and its tools, but a scope
review found live model-facing prompt/skill/reference docs across
elicit/ingest/map/analyze/review/propose/project still named
elicitation_gap, elicitation-gap capture, or "open gaps" as if the
register still existed. Repoints all of them to the session-local
elicitation scratchpad language, including elicitor.md itself.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@lunelson lunelson marked this pull request as ready for review July 1, 2026 12:50
Copilot AI review requested due to automatic review settings July 1, 2026 12:50
@cursor

cursor Bot commented Jul 1, 2026

Copy link
Copy Markdown

PR Summary

High Risk
Large architectural swap across elicitor runtime, session state, graph command paths, and SQLite schema with no migration bridge for dropped elicitation_gaps data; settlement read discipline must hold everywhere advisory items are excluded from settled readers.

Overview
Closes elicitation-gap-guidance by replacing the spec-global persisted elicitation_gaps register and count-based readiness with a session-local asking model and stricter graph truth rules.

Elicitation / readiness: The asking agenda moves to a branch-folded brunch.elicitation_scratchpad (seeded from thin graph facts, updated via new session read/write tools). Foreground world reads, launch/subagent snapshots, and prompts are repointed off getElicitationGaps / read_elicitation_gaps / update_elicitation_gaps (including spawn). Count-based paths (readinessEstimate, derivePresenceCoverage, elicitation driver, seeded gap catalog) are removed. Readiness bands consolidate on latestExpectedBand(kind) instead of earliest-band array reads. Capture probes now expect scratchpad_note instead of spawn_gap for low-confidence noticings.

Persistence: Drizzle 0007 drops elicitation_gaps; 0008 adds settlement (advisory | settled) on nodes and edges, orthogonal to basis, with command-layer enforcement so advisory items are not read as settled.

Docs / plan: Adds landed design ledger SESSION_LOCAL_ELICITATION_GAPS.md, updates elicitation question / ontology docs for scratchpad semantics, and marks the frontier done in memory/PLAN.md (closure oracle referenced in plan text).

Reviewed by Cursor Bugbot for commit 5196d5d. Bugbot is set up for automated code reviews on this repo. Configure here.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR completes the migration away from the persisted, spec-global elicitation_gaps register and count-based readiness scoring, replacing it with a session-local elicitation scratchpad (custom entry fold + read/write tools) and a thin, neutral graph-fact seed. It also reconciles readiness-band classification to a single latestExpectedBand scalar and updates prompts/skills/tests/fixtures accordingly.

Changes:

  • Replace persisted elicitation gaps + readiness scoring with a session-local brunch.elicitation_scratchpad fold projection and Pi tools (read_elicitation_scratchpad / update_elicitation_scratchpad).
  • Introduce a “Graph facts” seed renderer (counts + zero-kinds with latest expected band) and propagate scratchpad/seed into spec/session context composition.
  • Remove bandsForKind/earliest-band reads in favor of latestExpectedBand, delete elicitation-gap schema/driver/register plumbing, and add a DB migration dropping elicitation_gaps.

Reviewed changes

Copilot reviewed 105 out of 105 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
src/session/specification-overview-context.ts Spec overview now returns scratchpad
src/session/originate-assistant-turn.ts Origination seed uses scratchpad fold
src/session/elicitation-scratchpad.ts New scratchpad fold + append helper
src/session/tests/originate-assistant-turn.test.ts Remove gap reads from origination tests
src/session/tests/elicitation-scratchpad.test.ts New scratchpad parsing/fold tests
src/projections/session/transcript-context.ts Tool name allowlist updated
src/projections/session/readiness-estimate.ts Delete readiness scoring projection
src/projections/session/tests/readiness-estimate.test.ts Delete readiness projection tests
src/probes/capture-quality-loop.ts Rename spawn_gap → scratchpad_note
src/probes/tests/capture-quality-loop.test.ts Update probe expectations
src/graph/workspace-store.ts Remove gap readers + repair call
src/graph/TOPOLOGY.md Update band derivation terminology
src/graph/schema/nodes.ts Replace bandsForKind with latestExpectedBand
src/graph/schema/kinds.ts Remove gap-related enums
src/graph/schema/elicitation-gaps.ts Delete elicitation gap types
src/graph/schema/elicitation-gap-fixtures.ts Delete gap fixtures builders
src/graph/queries.ts Filter by latestExpectedBand; delete gap query
src/graph/index.ts Remove gap exports; export latestExpectedBand
src/graph/elicitation-driver.ts Delete gap ranking driver
src/graph/command-executor/command-validation.ts Remove gap validation plumbing
src/graph/command-executor/command-types.ts Remove gap command result/types
src/graph/tests/workspace-store.test.ts Delete gap repair runtime test
src/graph/tests/seed-fixtures.test.ts Remove gap floor assertions; use latestExpectedBand
src/graph/tests/read-api.test.ts Update band filtering expectations
src/graph/tests/queries.test.ts Update band derivation tests; delete gap query tests
src/graph/tests/observed-shapes-coverage.test.ts Remove elicitation_gaps observed shape
src/graph/tests/elicitation-driver.test.ts Delete driver tests
src/graph/tests/capture-commitment-gradient-gate.test.ts Delete gap-based routing gate test
src/dev/tests/tier-2-scaffold.test.ts Seed now includes graph facts + scratchpad
src/dev/tests/tier-2-harness.test.ts Expect scratchpad marker in context
src/dev/tests/faux-harness.test.ts Remove faux gap readers
src/db/schema.ts Drop elicitation_gaps table definition
src/db/row-schemas.ts Remove elicitation gap row schemas
src/db/tests/connection.test.ts Update legacy migration expectations
src/app/pi-subagents.ts Subagent snapshot carries scratchpad fold
src/app/pi-extensions.ts Register scratchpad tool extension; remove gap wiring
src/app/brunch-tui.ts Remove gap reads from graph readers
src/app/tests/brunch-tui.test.ts Expect scratchpad tools; remove gap stubs
src/agents/skills/review/SKILL.md Update lexicon to scratchpad
src/agents/skills/propose/references/present-review-set.md Route low-confidence → scratchpad
src/agents/skills/propose/references/design.md Update guidance wording
src/agents/skills/project/references/intent-to-design.md Update guidance wording
src/agents/skills/map/SKILL.md Replace “gap” outcomes with scratchpad
src/agents/skills/map/references/routing.md Route low-confidence → scratchpad
src/agents/skills/map/references/map-plans.md Update plan routing wording
src/agents/skills/map/references/map-edges.md Update edge routing wording
src/agents/skills/ingest/SKILL.md Update ingest chain to scratchpad
src/agents/skills/elicit/SKILL.md Update elicitation substrate to scratchpad
src/agents/skills/elicit/references/question-kinds-per-intent-kind.md Adjust ownership split + remove band table duplication
src/agents/skills/analyze/SKILL.md Update analysis chain wording
src/agents/skills/analyze/references/neighborhoods.md Update example wording
src/agents/runtime/elicitor/active-tools.ts Swap active tool names to scratchpad tools
src/agents/references/readiness-bands.md Route low-confidence → scratchpad
src/agents/prompts/elicitor.md Add scratchpad-first session orientation directive
src/agents/contexts/seeds/turn-context.ts Render scratchpad + remove readiness estimate
src/agents/contexts/seeds/origination.ts Seed now includes graph facts + scratchpad
src/agents/contexts/seeds/graph-fact-seed.ts New thin graph-fact seed renderer
src/agents/contexts/seeds/tests/turn-context.test.ts Update turn-context expectations
src/agents/contexts/seeds/tests/origination.test.ts Update origination seed expectations
src/agents/contexts/seeds/tests/graph-fact-seed.test.ts New tests for graph-fact seed
src/agents/contexts/seeds/snapshots/turn-context-workspace-seed.md Snapshot updates for scratchpad line
src/agents/contexts/seeds/snapshots/turn-context-graph-oracle.md Snapshot updated for new band buckets
src/agents/contexts/seeds/snapshots/turn-context-graph-intent.md Snapshot updated for new band buckets
src/agents/contexts/seeds/snapshots/turn-context-graph-design.md Snapshot updated for new band buckets
src/agents/contexts/seeds/snapshots/origination-full-overview.md Snapshot updated for graph facts + scratchpad
src/agents/contexts/data-model/spec/spec-context.ts Render graph facts + scratchpad; remove gaps section
src/agents/contexts/data-model/spec/tests/spec-context.test.ts Expect no readiness/coverage language
src/agents/contexts/data-model/spec/snapshots/spec-context.md Snapshot updated for facts + empty scratchpad
src/agents/contexts/data-model/session/readiness-estimate.ts Delete readiness estimate renderer
src/agents/contexts/data-model/graph/graph-slice.ts Use latestExpectedBand for rendering
src/agents/contexts/data-model/graph/tests/graph-slice.test.ts Update band-bucket expectations
src/agents/contexts/data-model/graph/snapshots/graph-overview-kind-coverage-matrix.md Snapshot updated for latestExpectedBand bucketing
src/agents/contexts/data-model/elicitation-scratchpad.ts New scratchpad formatter + update result formatter
src/agents/contexts/data-model/elicitation-gaps.ts Delete old gap agenda formatter
src/agents/contexts/data-model/tests/elicitation-gaps.test.ts Delete old gap formatter tests
src/.pi/extensions/subagents/prompt-assembly.ts Subagent background snapshot uses scratchpad
src/.pi/extensions/commands/index.ts Remove gap-dependent tool posture wiring
src/.pi/extensions/brunch-data/graph/index.ts Remove getElicitationGaps from readers interface
src/.pi/extensions/brunch-data/elicitation/scratchpad-tools.ts New scratchpad read/write tools
src/.pi/extensions/brunch-data/elicitation/index.ts Re-export scratchpad tools registrar
src/.pi/extensions/brunch-data/context/get-specification.ts Pass session entries into spec overview
src/.pi/extensions/agent-runtime/system-prompts/world-reads.ts Cache only queryGraph; remove gaps caching
src/.pi/extensions/agent-runtime/system-prompts/index.ts Update active tool computation signature
src/.pi/extensions/agent-runtime/system-prompts/tests/world-reads.test.ts Update cache tests; assert scratchpad not cached
src/.pi/extensions/agent-runtime/runtime/index.ts Remove conservative gap fallback
src/.pi/extensions/tests/subagents.test.ts Update injected world snapshot shape
src/.pi/extensions/tests/registry.test.ts Expect scratchpad tool registration
src/.pi/extensions/tests/commands-runtime-switch.test.ts Remove gap-derived picker/test dependencies
src/.pi/extensions/tests/brunch-data-reconciliation.test.ts Update tool posture expectations
src/.pi/extensions/tests/brunch-data-graph.test.ts Remove getElicitationGaps from graph reads
src/.pi/extensions/tests/brunch-data-elicitation.test.ts Delete old elicitation register tests
src/.pi/extensions/tests/brunch-data-elicitation-scratchpad.test.ts New scratchpad tool tests
src/.pi/extensions/tests/agent-runtime-system-prompts.test.ts Update tool grants to scratchpad read
src/.pi/extensions/tests/agent-runtime-authority-matrix.test.ts Remove uncovered-gaps fallback test
src/.pi/extensions/snapshots/subagent-explorer-prompt.md Snapshot updated for scratchpad line
memory/PLAN.md Plan updated to reflect new frontier shape
drizzle/meta/_journal.json Add migration journal entry
drizzle/0007_jittery_mongu.sql Migration drops elicitation_gaps table
.fixtures/runs/capture-quality/sample-llm-extractions.json Update expectedOutcome values

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/.pi/extensions/brunch-data/elicitation/scratchpad-tools.ts
Comment thread src/.pi/extensions/brunch-data/elicitation/scratchpad-tools.ts
Comment thread src/session/elicitation-scratchpad.ts
Comment thread src/agents/contexts/seeds/graph-fact-seed.ts
lunelson and others added 4 commits July 1, 2026 15:07
… (Card 5)

Adds `settlement` (advisory | settled) to nodes and edges, orthogonal to
`basis` (D99-L, I52-L): schema + migration, CommandExecutor create/patch
support with monotonic advisory->settled promotion enforcement, a
queryGraph settlement filter, advisory labeling in graph-slice rendering,
and a mutate_graph tool createSettlement param so agents can actually
reach the documented advisory-capture route.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…visory edge labeling, patch_edge regression guard)

Scoping-agent review of 6f660bb found edge settlement half-enforced:
queryGraph's settled-only filter only checked node settlement (an
advisory edge between two settled nodes leaked through), graph-slice
rendering didn't label advisory edges, and patch_edge had no monotonic
transition guard. All three now match the node path's behavior.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…losure oracles)

Reconciles all co-located TOPOLOGY.md files named in the design doc against
the materialized session-scratchpad + settlement model from Cards 1-5,
adds a grep-level closure test guarding against the retired gap-register
attractor reappearing, and flips SPEC/PLAN/design-doc status to landed.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@lunelson lunelson changed the title merged planning changes for elicitation gap guidance FE-1116: Session-local elicitation gaps from a graph-derived seed Jul 1, 2026

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 786a8af. Configure here.

Comment thread src/.pi/extensions/brunch-data/elicitation/scratchpad-tools.ts
@lunelson

lunelson commented Jul 1, 2026

Copy link
Copy Markdown
Contributor Author

Resolved the open review threads in commit 5196d5da (Harden elicitation scratchpad review fixes). Covered: required id diagnostics for resolve/update, empty obligation rejection, array-valued meta rejection, deterministic graph-fact count rendering, and failing loudly when scratchpad persistence is unavailable. Builder reported focused Vitest and npm run verify passing.

Copilot AI review requested due to automatic review settings July 1, 2026 15:09

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 134 out of 134 changed files in this pull request and generated 3 comments.

Comment on lines +35 to +37
Adding more questions never adds ontology; it adds priming for an existing kind. A session
elicitation scratchpad item is therefore a **situated question that refers to a graph node kind**,
not an entry in a persisted parallel "typology" vocabulary.
Comment thread src/session/TOPOLOGY.md
Comment on lines 82 to +83
`agents/contexts/seeds/origination.ts` composes the seed's provider-visible
payload (spec overview + top-ranked open gaps) from spec-scoped reads;
payload (spec overview + session scratchpad projection) from spec-scoped reads;
Comment on lines +41 to +44
const zeroCountKinds = NODE_KINDS.filter((kind) => !nodeCountsByKind[kind]).map((kind) => ({
kind,
band: latestExpectedBand(kind),
}));
@lunelson lunelson merged commit 5846c21 into next Jul 3, 2026
7 checks passed
@lunelson lunelson deleted the ln/fe-1116-elicitation-gap-guidance branch July 3, 2026 12:19
kostandinang added a commit that referenced this pull request Jul 3, 2026
ln-sync at arc close: record the completed D101-L port cutover in SPEC
(D101-L row, I56-L rewrite, requirement 26, ExecutionPorts lexicon row,
worker content-quality blind spot), thin the five D101-L refinement
blockquotes to src/executor/TOPOLOGY.md pointers, archive done frontier
definitions to PLAN_HISTORY, close the orchestrator-cutover arc in PLAN,
acknowledge in-flight FE-1116/FE-1115 (PRs #280/#281), reconcile executor
topology headers, fix the stale I52-L comment to I56-L, and delete 11
exhausted scope cards.
kostandinang added a commit that referenced this pull request Jul 3, 2026
ln-sync at arc close: record the completed D101-L port cutover in SPEC
(D101-L row, I56-L rewrite, requirement 26, ExecutionPorts lexicon row,
worker content-quality blind spot), thin the five D101-L refinement
blockquotes to src/executor/TOPOLOGY.md pointers, archive done frontier
definitions to PLAN_HISTORY, close the orchestrator-cutover arc in PLAN,
acknowledge in-flight FE-1116/FE-1115 (PRs #280/#281), reconcile executor
topology headers, fix the stale I52-L comment to I56-L, and delete 11
exhausted scope cards.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants