Skip to content

FE-867: Agent extension host — dual-mode pi-harness contract#213

Open
kostandinang wants to merge 2 commits into
ka/fe-864-orchestrator-enhancementsfrom
ka/fe-867-agent-extension-host
Open

FE-867: Agent extension host — dual-mode pi-harness contract#213
kostandinang wants to merge 2 commits into
ka/fe-864-orchestrator-enhancementsfrom
ka/fe-867-agent-extension-host

Conversation

@kostandinang

@kostandinang kostandinang commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

Stack Context

Stacks on FE-864 (#212). First Arc-1 frontier and the base of the cook stack -- every Arc-1 frontier lands on this contract.

What?

The dual-mode (elicit/execute) agent-extension-host contract -- src/agent-extension-host.ts, transport-safe metadata only: AgentExtensionMode, the capability/plugin/consumer-witness types, and flattenCapabilityIds.

          agent-extension-host (contract)
          +---------------------------------+
          | CORE (mode-agnostic)            |  <- runtime owned by the pi-harness thread
          +---------------------------------+
            ^ loads plugins per mode
     +------+-------+          +---------------+
     | elicit       |          | execute       |
     | -> interview  |          | -> cook        |
     +--------------+          +---------------+

Dependency-free and names no execute-only concept (slice/epic/plan/worktree/toolchain) -- neutrality is a checkable invariant. Two-consumer proof, no runtime migration:

  • cook's execute surface matches createPiActions() ids exactly
  • the interview's elicit surface is witnessed against createExplorationTools() + a keyof InterviewerTools coverage check

Why?

The pi harness is reused for spec elicitation and cook execution; one dual-mode host (not two) keeps dispatch, confinement, and tool-scoping shared. This file is the serialization point with the unpublished pi-harness thread that owns the core runtime -- targeting the contract, not pi, keeps the dispatch-seam frontiers decoupled from that rewrite.

Tests

Two-consumer witnesses, no runtime touched: cook's execute surface set-equals Object.keys(createPiActions()); the interview's elicit surface equals Object.keys(createExplorationTools(...)), with the native interviewer tools covered type-level via keyof InterviewerTools under lint --type-check. Mode-neutrality is the module's zero-import invariant -- mechanically checkable, not asserted.

Deferred

Runtime host/dispatch + a pi adapter wait until a real driver lands. Contract-first, zero behavior change.

Co-authored-by: Amp amp@ampcode.com

@kostandinang kostandinang changed the title FE-867: agent-extension-host mode-neutral contract (slice 1) FE-867: Agent extension host — dual-mode (elicit/execute) pi-harness contract Jun 15, 2026
@cursor

cursor Bot commented Jun 16, 2026

Copy link
Copy Markdown

PR Summary

Low Risk
Contract and test-only changes with zero runtime behavior change; main risk is witness tests breaking when cook actions or interviewer tools are added without updating the witness.

Overview
Slice 1 (FE-867) adds the dual-mode agent-extension-host contract as a serialization point with the parallel pi-harness work: metadata-only types (AgentExtensionMode, capability/plugin/consumer-witness) plus flattenCapabilityIds, with no imports so the core stays mode-neutral.

Tests enforce that invariant and a two-consumer witness: cook execute capability ids must set-equal Object.keys(createPiActions()); interview elicit exploration tools must match createExplorationTools, with keyof InterviewerTools type coverage for native interviewer tools. No interview or cook runtime is migrated.

memory/PLAN.md updates the agent-extension-host frontier to in-progress slice 1 landed and tweaks Linear/stack wording; runtime host/dispatch remains deferred.

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

@kostandinang kostandinang force-pushed the ka/fe-864-orchestrator-enhancements branch from 95ac829 to eb6e902 Compare June 16, 2026 23:45
@kostandinang kostandinang force-pushed the ka/fe-867-agent-extension-host branch 2 times, most recently from 86df4fc to 4cac54a Compare June 16, 2026 23:55
@kostandinang kostandinang force-pushed the ka/fe-864-orchestrator-enhancements branch from eb6e902 to 39d50cb Compare June 16, 2026 23:55
kostandinang and others added 2 commits June 17, 2026 09:36
Define the dual-mode (elicit/execute) agent-extension-host contract as
transport-safe metadata only — src/agent-extension-host.ts: AgentExtensionMode,
capability/plugin/consumer-witness contracts, flattenCapabilityIds. The module
is dependency-free and names no execute-only concept, so it stays neutral across
both consumers (cook via the pi SDK, interview via the Vercel AI SDK) and any
future runtime.

Prove the two-consumer bar without migrating any runtime: cook's execute surface
matches createPiActions() action ids exactly; the interview's elicit surface is
witnessed against the real createExplorationTools() family plus a type-enforced
coverage check over keyof InterviewerTools (gated by lint --type-check).

Contract-first, zero behavior change. Defers the runtime host/dispatch and a pi
adapter until a real driver lands (coordinated with the pi-harness thread that
owns the core implementation).

Amp-Thread-ID: https://ampcode.com/threads/T-019ecb9a-9a08-733b-833d-76885fc8243a
Co-authored-by: Amp <amp@ampcode.com>
Lean on no-imports as the load-bearing neutrality guarantee and drop the
redundant forbidden-substring denylist (a dependency-free module cannot
reference an execute-only or SDK type, so neutrality is structural, not a
name list to maintain).

Make the interview exploration plugin proof bidirectional — its capability
ids must exactly equal Object.keys(createExplorationTools(...)), catching
phantom as well as missing tools. Document that the three native interviewer
tools are covered type-level only (superset) because constructing them needs
a live DB.

Review findings #1 and #2 from ln-review. Zero behavior change.

Amp-Thread-ID: https://ampcode.com/threads/T-019ecb9a-9a08-733b-833d-76885fc8243a
Co-authored-by: Amp <amp@ampcode.com>
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.

1 participant