Skip to content

FE-844: Wire affordance legality to capability readiness#201

Merged
lunelson merged 1 commit into
nextfrom
ln/fe-844-elicitation-gaps-ii
Jun 11, 2026
Merged

FE-844: Wire affordance legality to capability readiness#201
lunelson merged 1 commit into
nextfrom
ln/fe-844-elicitation-gaps-ii

Conversation

@lunelson

@lunelson lunelson commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

Stack Context

This PR continues the FE-844 elicitation-gaps stack by connecting graph/runtime affordances to the readiness signals that decide what the assistant may safely do next.

What?

  • Adds fixture coverage for graph shapes with missing or uneven elicitation evidence.
  • Wires affordance legality through capability readiness and workspace/session projections.
  • Updates schema, seeds, and tests around gap-aware graph review flows.

lunelson commented Jun 11, 2026

Copy link
Copy Markdown
Contributor Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

@lunelson lunelson marked this pull request as ready for review June 11, 2026 10:13
Copilot AI review requested due to automatic review settings June 11, 2026 10:13
@cursor

cursor Bot commented Jun 11, 2026

Copy link
Copy Markdown

PR Summary

Medium Risk
Schema migration drops a column and rewrites elicitation_gaps; many consumers (prompts, chrome, seeds, affordances) change together, so regressions in legality or display are possible until verify passes.

Overview
Completes the capability-readiness sweep by retiring the persisted readiness_grade model and wiring remaining surfaces to elicitation gaps and a soft per-band readiness estimate.

Persistence & seeds: Drops specs.readiness_grade (migration 0005) and finishes the elicitation_gaps reshape in 0004 (refers_to + question, legacy name mapped on copy). Seed contracts, port/variant scripts, and JSON fixtures no longer emit or document readiness_grade.

Runtime & UI: Removes vestigial chrome.phase / chrome.chatMode from workspace/chrome projections (RPC, print, web, TUI tests). Spec identity in APIs and prompts is id / name / slug only.

Agent prompt layer: composeAgentPrompt takes gaps instead of a stored grade; manifests and tool legality filter via capability-readiness over gaps; the runtime header shows readiness estimate (soft; gates nothing) rather than readiness_grade=….

Planning docs mark capability-readiness done and update D40/D73/D74 traceability accordingly.

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

@lunelson lunelson changed the title Wire affordance legality to capability readiness FE-844: Wire affordance legality to capability readiness Jun 11, 2026
Comment thread src/.pi/extensions/system-prompts/index.ts
Comment thread drizzle/0004_gaps_node_kind_reference.sql

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 removes the stored readiness-grade/chrome-phase model and rewires legality and prompt/tool readiness to derive from selected-spec elicitation gaps via capability-readiness. It also introduces a UI-only “soft” readiness estimate (per-band coverage rollup) and updates fixtures/migrations to drop specs.readiness_grade.

Changes:

  • Replace grade-gated affordance legality and method/tool gating with capability-readiness evaluation over ElicitationGap[].
  • Add readinessEstimate() projection (UI-only) and thread gap-driven readiness display into agent prompt/cwd context.
  • Remove stored readiness grade and chrome phase/chatMode fields across DB schema, coordinator/RPC/web/TUI, probes, fixtures, and docs.

Reviewed changes

Copilot reviewed 86 out of 86 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/web/app.test.tsx Updates workspace-state test fixtures for chrome phase/chatMode removal.
src/session/workspace-session-coordinator.ts Removes phase/chatMode from workspace chrome state shape.
src/session/workspace-session-coordinator.test.ts Adjusts assertions to ensure phase/chatMode are not present.
src/session/workspace-context.ts Removes readinessGrade from workspace inventory/overview shapes.
src/session/workspace-context.test.ts Updates expected workspace session inventory without readinessGrade.
src/session/runtime-affordances-coverage.test.ts Switches affordances derivation tests from grade input to gaps input.
src/session/README.md Documents chrome state as selection snapshot; updates affordance ledger wording to capability-readiness over gaps.
src/rpc/methods/workspace.ts Drops cancelled-state chrome phase/chatMode from RPC results.
src/rpc/handlers.test.ts Updates handler fixtures to remove phase/chatMode.
src/renderers/workspace/workspace-state.ts Stops rendering chrome phase/chatMode in workspace state output.
src/renderers/workspace/workspace-state.test.ts Ensures workspace-state renderer output omits phase/chatMode lines.
src/renderers/workspace/workspace-context.ts Removes readiness_grade text from rendered workspace session inventory.
src/projections/workspace/workspace-state.ts Narrows WorkspaceState.chrome to {} and stops projecting phase/chatMode.
src/projections/session/runtime-policy.ts Replaces min-grade legality with capability-readiness legality over gaps.
src/projections/session/readiness-estimate.ts Adds soft per-band readiness estimate projection over gaps (UI-only).
src/projections/session/readiness-estimate.test.ts Locks readiness-estimate behavior and guards it from legality paths.
src/projections/session/affordances.ts Updates runtime affordances derivation signature to accept gaps.
src/projections/session/affordances.test.ts Adds gap-driven legality coverage (including loud failure when required kinds missing).
src/projections/README.md Updates projection ledger to reflect new readiness-estimate and gap-driven affordances.
src/probes/propose-graph-commit-proof.ts Removes probe-side readiness-grade advancement.
src/probes/project-graph-review-cycle-proof.ts Removes probe-side readiness-grade advancement.
src/graph/workspace-store.ts Adds getElicitationGaps reader bound at the selected-spec seam.
src/graph/seed-fixtures.ts Removes readiness_grade from seed fixture spec contract and createSpec calls.
src/graph/seed-fixtures.test.ts Updates seed-fixture tests after readiness_grade removal.
src/graph/schema/kinds.ts Removes READINESS_GRADES constant array from taxonomy leaf.
src/graph/README.md Documents readiness-grade retirement and exposes elicitation gaps via selected-spec read seam.
src/graph/read-api.test.ts Updates DB insert fixtures after readiness_grade removal.
src/graph/queries.test.ts Updates DB insert fixtures after readiness_grade removal.
src/graph/index.ts Stops exporting readiness-grade symbols.
src/graph/export-fixtures.ts Removes readiness_grade from exported fixture spec.
src/graph/export-fixtures.test.ts Updates fixture export tests after readiness_grade removal.
src/graph/command-executor/commit-graph-batch.test.ts Updates DB insert fixtures after readiness_grade removal.
src/graph/command-executor/accept-review-set.test.ts Updates DB insert fixtures after readiness_grade removal.
src/graph/command-executor.ts Removes ReadinessGrade types, stored grade persistence, and updateReadinessGrade command.
src/graph/command-executor.test.ts Deletes updateReadinessGrade tests; updates createSpec expectations.
src/graph/architecture.test.ts Updates enum-ownership grep assertion to remove READINESS_GRADES.
src/db/schema.ts Drops specs.readiness_grade column definition.
src/db/README.md Updates schema posture docs: specs are identity-only.
src/db/connection.test.ts Adds legacy migration coverage and removes readiness_grade usage from new inserts.
src/app/brunch.test.ts Updates CLI dispatch and state fixtures to omit phase/chatMode and readiness grade.
src/app/brunch-tui.ts Stops threading readinessGrade through prompt context.
src/app/brunch-tui.test.ts Updates TUI boot fixtures to omit readinessGrade and chrome phase/chatMode.
src/.pi/README.md Updates prompting description to include gap-driven contribution.
src/.pi/extensions/system-prompts/index.ts Threads selected-spec gaps into prompting and active tool selection.
src/.pi/extensions/runtime/index.ts Switches tool selection input from grade to gaps; adds conservative fallback gaps.
src/.pi/extensions/runtime/authority-matrix.test.ts Updates authority matrix test to pass gaps into tool gating.
src/.pi/extensions/README.md Updates extension topology to mention selected-spec graph/gap seam and gap-driven prompting.
src/.pi/extensions/graph/index.ts Extends GraphReaders with optional getElicitationGaps for prompt/tool readiness.
src/.pi/extensions/chrome/index.ts Removes chrome phase/chatMode from default direct-Pi chrome state.
src/.pi/agents/state.ts Replaces grade-based manifests/method gating with gap-driven capability readiness; reuses runtime-policy axis legality.
src/.pi/agents/state.test.ts Updates posture-policy tests for gap-driven legality and tool selection.
src/.pi/agents/README.md Updates agent docs to describe gap-driven legality and soft readiness estimate display.
src/.pi/agents/contexts/cwd.ts Renders soft readiness estimate instead of readiness_grade.
src/.pi/agents/contexts/cwd.test.ts Updates expectations to verify readiness estimate formatting and no readiness_grade.
src/.pi/agents/compose.ts Threads gaps into prompt composition; adds renderSoftReadinessEstimate().
src/.pi/agents/compose.test.ts Updates prompt composition tests to assert readiness estimate display and gap-gated legality.
src/.pi/tests/tui-lab-style.test.ts Updates extension registration fixtures to omit phase/chatMode.
src/.pi/tests/prompting.test.ts Updates before_agent_start prompting tests to use gaps for tool activation and display.
src/.pi/tests/context-tools.test.ts Ensures workspace overview rendering omits readiness_grade.
src/.pi/tests/chrome.test.ts Updates chrome projection tests to ensure phase/chatMode are absent.
memory/SPEC.md Updates decision/invariant register to reflect capability-readiness and stored-grade retirement.
memory/PLAN.md Marks capability-readiness frontier done and updates follow-on pointers.
drizzle/meta/0005_snapshot.json Updates Drizzle schema snapshot after readiness_grade removal.
drizzle/meta/_journal.json Records new migration journal entry for readiness_grade drop.
drizzle/0005_bumpy_vampiro.sql Drops specs.readiness_grade column.
drizzle/0004_gaps_node_kind_reference.sql Migrates elicitation gaps from legacy name to refers_to + question.
.fixtures/seeds/yamlbase/spec-graph.json Removes readiness_grade from seed spec contract.
.fixtures/seeds/workspace-spread/beta-commitments.json Removes readiness_grade from seed spec contract.
.fixtures/seeds/workspace-spread/alpha-grounding.json Removes readiness_grade from seed spec contract.
.fixtures/seeds/rd-loop/spec-graph.json Removes readiness_grade from seed spec contract.
.fixtures/seeds/kind-band-spread/coverage-matrix.json Removes readiness_grade from seed spec contract.
.fixtures/seeds/fable/spec-graph.json Removes readiness_grade from seed spec contract.
.fixtures/seeds/fable/README.md Removes readiness_grade narrative from seed documentation.
.fixtures/seeds/edge-spread/hub-neighborhood.json Removes readiness_grade from seed spec contract.
.fixtures/seeds/edge-spread/category-directions.json Removes readiness_grade from seed spec contract.
.fixtures/seeds/dumpchat/spec-graph.json Removes readiness_grade from seed spec contract.
.fixtures/seeds/dumpchat/README.md Removes readiness_grade narrative from seed documentation.
.fixtures/seeds/brunch-self/spec-graph.json Removes readiness_grade from seed spec contract.
.fixtures/seeds/bilal-port/README.md Updates port seed contract docs to remove readiness_grade.
.fixtures/seeds/bilal-port/macro-view.json Removes readiness_grade from seed spec contract.
.fixtures/seeds/bilal-port/explorer-ui.json Removes readiness_grade from seed spec contract.
.fixtures/seeds/bilal-port/code-health.json Removes readiness_grade from seed spec contract.
.fixtures/seeds/bilal-port/_port-script.ts Updates port script output and docs to remove readiness_grade.
.fixtures/seeds/bilal-port-variants/README.md Updates variant docs to remove readiness_grade.
.fixtures/seeds/bilal-port-variants/macro-view-grounded-intent.json Removes readiness_grade from seed spec contract.
.fixtures/seeds/bilal-port-variants/_variant-script.ts Updates variant script contract to remove readiness_grade.

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

Comment on lines +71 to +76
`readiness_band`,
`predicate_kind`,
`predicate`,
`importance`,
`plane_affinity`,
`lens_affinity`,
@lunelson lunelson force-pushed the ln/fe-844-elicitation-gaps branch from fc7d5d6 to 708c25d Compare June 11, 2026 14:30
@lunelson lunelson force-pushed the ln/fe-844-elicitation-gaps-ii branch from afbf0a6 to 6efa769 Compare June 11, 2026 14:30
@lunelson lunelson force-pushed the ln/fe-844-elicitation-gaps-ii branch from 6efa769 to c2ddcdb Compare June 11, 2026 14:33
@lunelson lunelson force-pushed the ln/fe-844-elicitation-gaps branch from 708c25d to 74aa041 Compare June 11, 2026 14:33
Base automatically changed from ln/fe-844-elicitation-gaps to next June 11, 2026 14:34
Copilot AI review requested due to automatic review settings June 11, 2026 14:36
@lunelson lunelson force-pushed the ln/fe-844-elicitation-gaps-ii branch from c2ddcdb to f8a3245 Compare June 11, 2026 14:36
@lunelson lunelson merged commit 39b50c2 into next Jun 11, 2026
5 of 7 checks passed
@lunelson lunelson deleted the ln/fe-844-elicitation-gaps-ii branch June 11, 2026 14:38

@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 f8a3245. Configure here.

Comment thread src/app/brunch-tui.ts
spec: {
id: selectedSpec.id,
name: selectedSpec.name,
readinessGrade: selectedSpec.readinessGrade,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Missing gaps on prompt reads

High Severity

The TUI passes graphDeps.reads into prompt context without getElicitationGaps. gapsForPrompt then always falls back to synthetic gaps at zero coverage, so capability-readiness stays in negotiate and gated tools like mutate_graph and review-set tools stay disabled even when the selected spec is grounded.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit f8a3245. 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

Copilot reviewed 86 out of 86 changed files in this pull request and generated 1 comment.

Comments suppressed due to low confidence (2)

src/.pi/extensions/runtime/index.ts:1

  • This conservative fallback hard-codes a short NodeKind list, but the legality pipeline intentionally throws when a capability requires a kind missing from the provided gap register. If the capability→required-kinds map expands (or already includes a kind outside this list), initializing tool policy via this fallback can throw during extension startup/turn prep. Consider centralizing the fallback construction so it always includes every NodeKind referenced by capability gating (or changing the fallback path to treat missing kinds as negotiate without throwing), to avoid runtime crashes from drift.
    src/.pi/agents/state.ts:1
  • This new error message is less actionable than it could be because it doesn't indicate which capability gate caused the negotiate outcome (or which required kind(s)/gap(s) were missing/insufficient). If possible, include the derived capability id (or at least the axis + selected id) and a short readiness summary (e.g., missing required kinds or the relevant gaps' coverage) so pinned-illegal failures are easier to diagnose from logs alone.

@@ -0,0 +1 @@
ALTER TABLE `specs` DROP COLUMN `readiness_grade`; No newline at end of file
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