P1 — capability/provider reasoning and typed ExecutionPlan #279

Closed
nsaspy wants to merge 0 commits from rage/157-execution-plans into master
Owner

Closes #157

Summary

  • kb/capabilities.pl: declarative capability KB (frame-keyed providers, properties, declared argument schema). No shell strings, no executable names, no package ids.
  • modules/capability_plans.pl: pure selection layer — plan_for_frame/3, plan_candidates/3, plan_explanation/3, plan_stale/4, flat pyswip projections (plan_head_row/13, plan_arg_row/7). Typed outcomes only: ready / unavailable(no_provider | provider_unavailable | alias_unsupported | provider_missing) / ambiguous(sorted alternatives, cap 8) / denied(insufficient_authorization).
  • zara/runtime/plans.py: validated frozen ExecutionPlan mirror, typed closed PlanEnvironment (dataclass-encoded, no raw term strings at call sites), PlanExecutor with registered provider adapters, at-most-once side effects per envelope request_id (bounded replay window), typed refusals.
  • zara/prolog_engine.py: plan_for_frame(frame, environment) boundary decoding through flat rows; encode_environment_term. Fixes encode_frame_term to emit the contract's value(...) slot wrapper (pre-existing drift; existing suites unaffected).
  • Tests first throughout: 34 plunit (t/capability_plans.pl incl. KB-wide property loops) + 40 pytest (boundary/mirror/executor); new scripts/test-capability-plans.sh phase (2b) in test-all.sh; full local gate 11/11.
  • PR #119 reconciliation: reusable shape kept (candidates, constraints-as-environment, priority ordering, explain evidence); verb keys, kb_config coupling, shell-string evidence, speculative executable fallback rejected. No Prolog-RLM dependency/path — the module is pure and RLM was removed in #136.

Design / evidence

  • rage/157-execution-plans.org (research, design decisions D1–D10, adversarial review with recorded attacks, red/green evidence, merge record to follow)
  • wiki/capability-plans.org

Scope notes

  • Wake/daemon do not consume plans yet (deliberate; wake cutover rides #160/#173/#196+); A7 verb-list/query_prolog retirement stays coordinated in #160; events.IntentResolved emission stays #173.
Closes #157 ## Summary - `kb/capabilities.pl`: declarative capability KB (frame-keyed providers, properties, declared argument schema). No shell strings, no executable names, no package ids. - `modules/capability_plans.pl`: pure selection layer — `plan_for_frame/3`, `plan_candidates/3`, `plan_explanation/3`, `plan_stale/4`, flat pyswip projections (`plan_head_row/13`, `plan_arg_row/7`). Typed outcomes only: ready / unavailable(no_provider | provider_unavailable | alias_unsupported | provider_missing) / ambiguous(sorted alternatives, cap 8) / denied(insufficient_authorization). - `zara/runtime/plans.py`: validated frozen ExecutionPlan mirror, typed closed `PlanEnvironment` (dataclass-encoded, no raw term strings at call sites), `PlanExecutor` with registered provider adapters, at-most-once side effects per envelope request_id (bounded replay window), typed refusals. - `zara/prolog_engine.py`: `plan_for_frame(frame, environment)` boundary decoding through flat rows; `encode_environment_term`. Fixes `encode_frame_term` to emit the contract's `value(...)` slot wrapper (pre-existing drift; existing suites unaffected). - Tests first throughout: 34 plunit (t/capability_plans.pl incl. KB-wide property loops) + 40 pytest (boundary/mirror/executor); new `scripts/test-capability-plans.sh` phase (2b) in test-all.sh; full local gate 11/11. - PR #119 reconciliation: reusable shape kept (candidates, constraints-as-environment, priority ordering, explain evidence); verb keys, kb_config coupling, shell-string evidence, speculative executable fallback rejected. No Prolog-RLM dependency/path — the module is pure and RLM was removed in #136. ## Design / evidence - rage/157-execution-plans.org (research, design decisions D1–D10, adversarial review with recorded attacks, red/green evidence, merge record to follow) - wiki/capability-plans.org ## Scope notes - Wake/daemon do not consume plans yet (deliberate; wake cutover rides #160/#173/#196+); A7 verb-list/query_prolog retirement stays coordinated in #160; events.IntentResolved emission stays #173.
nsaspy closed this pull request 2026-09-04 23:09:10 +00:00
Some checks failed
CI / test (pull_request) Failing after 12s
CI / android skeleton gate (pull_request) Failing after 4s
CI / shared mic / Arch Linux (pull_request) Failing after 11m22s
CI / shared mic / Ubuntu 24.04 (pull_request) Failing after 11m54s

Pull request closed

Sign in to join this conversation.
No description provided.