FE-844: Wire affordance legality to capability readiness#201
Conversation
PR SummaryMedium Risk Overview Persistence & seeds: Drops Runtime & UI: Removes vestigial Agent prompt layer: Planning docs mark Reviewed by Cursor Bugbot for commit f8a3245. Bugbot is set up for automated code reviews on this repo. Configure here. |
There was a problem hiding this comment.
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/chatModefields 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.
| `readiness_band`, | ||
| `predicate_kind`, | ||
| `predicate`, | ||
| `importance`, | ||
| `plane_affinity`, | ||
| `lens_affinity`, |
fc7d5d6 to
708c25d
Compare
afbf0a6 to
6efa769
Compare
6efa769 to
c2ddcdb
Compare
708c25d to
74aa041
Compare
c2ddcdb to
f8a3245
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ 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.
| spec: { | ||
| id: selectedSpec.id, | ||
| name: selectedSpec.name, | ||
| readinessGrade: selectedSpec.readinessGrade, |
There was a problem hiding this comment.
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.
Reviewed by Cursor Bugbot for commit f8a3245. Configure here.
There was a problem hiding this comment.
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
negotiatewithout 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 | |||



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?