Story
As a person running XMD interactively, I want to run a real Plan and follow all
of its Agent conversations in the REPL, so I can understand live work, answer
permissions and reviews, and reopen the durable result without leaving the
execution that owns it.
Common path
Run xmd repl with the same Agent provider, default-agent and permission options
that xmd run accepts. Submit:
<Evaluate allow={["write"]}>
<Plan>
Create an XMD program that asks me for a project name and a one-sentence
description. Preview the README it will create and ask for confirmation.
If I approve, write README.md and report that it was created. If I
decline, stop without writing anything.
</Plan>
</Evaluate>
The Sessions surface shows the Plan conversation while it is queued, streaming
and complete. The returned Plan appears at its invocation and its generated XMD
executes inline. Plan review supports feedback and approval. The generated
program asks for the README inputs, presents the complete preview, and writes
only after approval.
A second deterministic journey opens planner, reviewer and implementer
conversations together. The default Sessions view shows every turn in durable
prompt order. Choosing a session filters the view with
?session=<session-key>; removing that query returns to all messages.
The contract below preserves the behavior accepted from version 5 of the
Product Owner's XMD REPL Terminal Interface. The animation is supplementary
evidence, not an implementation or persistence format.
Current gap
Issue #848 delivered one production REPL entry, deterministic Elicit, History
inspection and cold reconstruction. Its Sessions surface is intentionally
empty. xmd repl accepts no Agent options, installs no provider, observes no
live Prompt stream and cannot present the Plan review or generated README forms.
The ordinary run stack cannot simply be reused unchanged: its interactive
permission policy starts readline on the same terminal the REPL owns, and its
foreground launcher may hand that terminal to a provider-native UI.
Contract
Command and configuration
xmd repl accepts its optional location plus:
--agent-provider <provider>
--default-agent [agent]
--approve-all
--approve-reads
--deny-all
approve-reads is the default and the permission flags are mutually exclusive.
Invalid configuration refuses before the terminal, retained history, adapter or
provider is acquired. A document with no Agent work starts no adapter.
The REPL installs the selected provider and Agent components without the
ordinary readline permission prompt or foreground launcher. <Session.Launch>
remains unavailable.
Sessions and turns
With no session query, every Agent turn appears in one chronological stream
ordered by its durable Prompt sequence. session=<session-key> filters that
stream to the provider conversation the key identifies. An unknown key refuses
the location.
A live Prompt creates one queued turn. Provider start, text deltas and terminal
state update that same turn. These updates never change the filter, route,
selected scope, inspected marker or focus. A live text delta is neither
transcript output nor a durable event.
The ordinary agent_prompt append replaces the live overlay and is the only
source for historical and cold Agent turns. A historical prefix before that
append contains no partial response. A cold reopen shows completed, failed and
cancelled retained turns without contacting the provider or pretending a live
stream survived.
Plan and forms
The completed Plan response appears at its invocation and, when it is XMD, is
admitted through the existing <Evaluate> path and evaluated inline.
This Story supports only the forms exercised by the packaged Plan and generated
README program: object text fields, enum decisions, conditionally required
feedback, validation feedback and read-only Markdown or code preview. An
unsupported schema refuses before showing a partial form and identifies the
unsupported keyword and path.
Plan review shows the complete Plan and available decisions, never a future
execution result. The fixed History footer stays reachable while any review,
ordinary Elicit or permission drawer is open, and focus returns to the invoking
location when it closes.
Permissions
A permission request is visible on its owning Agent turn but does not open a
drawer or steal focus by itself. Activating it opens a focus-trapped drawer above
the fixed History footer with every choice the provider offered. Duration is
explicit, including that an “always” choice is scoped to this Agent session.
Only the owning turn waits. Other sessions continue. Choosing one option returns
one outcome to the exact request. Escape, interruption and session teardown
deny or cancel it once and cannot leave the provider waiting. Historical
permission requests are visible but never actionable.
Responsive behavior
Wide composition presents the coordinated panes. Narrow composition mounts only
the routed outlet, active contextual drawer or band, and fixed History footer.
Hidden panes contribute no focus, input, frame demand or rendering. The
canonical location appears once.
Architecture boundaries
- The existing Journal remains the only durable execution record; no Agent UI
sidecar, snapshot or new record family is added.
agent_prompt records project into frozen ReplModel session and turn values.
Routing, layout, components and rendering never read Journal records.
- An
agent_prompt may retain a closed permission audit containing safe display
fields, offered choices and the outcome. It never retains rawInput, a
callback, waiter or provider object; older records remain valid.
- The REPL observes live turns by wrapping the existing
Agent.prompt() stream
with execution-scoped middleware. <Prompt> remains the sole subscriber and
owner of provider cancellation. No new public Agent API is introduced.
- The REPL answers interactive permissions through middleware around the
existing Agent.requestPermission() operation. The REPL session owns the
pending request; the renderer does not.
- Live observation cannot delay, cancel or alter the provider result. Renderer
absence drops visual wakes, not Agent events or ownership.
- One application commit replaces a terminal live overlay with its matching
durable Prompt. Concurrent or identical turns cannot be matched by response
text, display label or completion order.
Acceptance
- The real packaged Plan streams in the Sessions surface, returns its XMD at the
Plan invocation and completes the generated README review and approved write
through the existing runtime.
- Request changes without feedback remains open with validation; valid feedback
resumes the same conversation. Approve and Decline have distinct observable
outcomes.
- Three concurrent named sessions show queued, active and complete turns in one
unfiltered chronology. Selecting one adds session=<key> and filters only the
messages; background activity changes no route, filter, scope, marker or
focus.
- Keyboard and pointer activation of the same session or permission control
produce the same action and outcome.
- A non-read permission request waits only its turn, exposes every provider
choice with explicit scope, and settles exactly once on choice, Escape,
interruption and teardown. After Prompt publication the safe request and
outcome remain visible but inert; rawInput is absent. No readline reader
exists.
- A marker before durable Prompt publication shows no partial turn. A marker at
or after publication and a cold reopen show the retained prompt, terminal
state and final or partial result while making zero provider calls.
- Invalid Agent configuration refuses before host acquisition. A document with
no Agent work acquires no adapter. <Session.Launch> refuses without taking
the terminal.
- Renderer failure or terminal loss cannot orphan a provider turn or permission
wait; already appended Journal truth remains reconstructible and the terminal
is restored once.
- Wide and narrow terminal journeys preserve the accepted composition, focus
and History behavior. Narrow Sessions views show the canonical location once.
Negative controls fail if deltas become transcript rows or durable events, the
latest activity selects itself, a historical permission can answer, a cold
reopen fabricates a live turn, the ordinary readline policy is installed, a
partial form mounts, or one live completion replaces another turn's durable
row.
Evidence
Use two deterministic product journeys: the exact Plan/README source above and
a separate three-session document. Drive them through the real XMD execution,
Agent stream, durable Journal, canonical location, mounted Freedom tree,
renderer and terminal host. Compare the accumulated live view with a fresh
projection from the same Journal and location.
Keep focused evidence portable across Deno, Node and Bun except for explicitly
named pseudo-terminal cases. The Planner derives exact test files and feedback
slices from the architect handoff.
Relationships
Out of scope
- A second submitted entry, entry catalog or concurrent entry queue.
- Fork from here or inherited Agent-session semantics.
- Renaming, deleting, importing or otherwise managing sessions.
- Native
<Session.Launch> terminal handoff or provider-TUI mirroring.
- Provider session files as REPL truth.
- A general JSON Schema form toolkit, public terminal component package,
snapshots or another REPL journal record family.
- Adding the interactive REPL to Workflow.
Story
As a person running XMD interactively, I want to run a real Plan and follow all
of its Agent conversations in the REPL, so I can understand live work, answer
permissions and reviews, and reopen the durable result without leaving the
execution that owns it.
Common path
Run
xmd replwith the same Agent provider, default-agent and permission optionsthat
xmd runaccepts. Submit:The Sessions surface shows the Plan conversation while it is queued, streaming
and complete. The returned Plan appears at its invocation and its generated XMD
executes inline. Plan review supports feedback and approval. The generated
program asks for the README inputs, presents the complete preview, and writes
only after approval.
A second deterministic journey opens planner, reviewer and implementer
conversations together. The default Sessions view shows every turn in durable
prompt order. Choosing a session filters the view with
?session=<session-key>; removing that query returns to all messages.The contract below preserves the behavior accepted from version 5 of the
Product Owner's
XMD REPL Terminal Interface. The animation is supplementaryevidence, not an implementation or persistence format.
Current gap
Issue #848 delivered one production REPL entry, deterministic Elicit, History
inspection and cold reconstruction. Its Sessions surface is intentionally
empty.
xmd replaccepts no Agent options, installs no provider, observes nolive Prompt stream and cannot present the Plan review or generated README forms.
The ordinary run stack cannot simply be reused unchanged: its interactive
permission policy starts
readlineon the same terminal the REPL owns, and itsforeground launcher may hand that terminal to a provider-native UI.
Contract
Command and configuration
xmd replaccepts its optional location plus:approve-readsis the default and the permission flags are mutually exclusive.Invalid configuration refuses before the terminal, retained history, adapter or
provider is acquired. A document with no Agent work starts no adapter.
The REPL installs the selected provider and Agent components without the
ordinary readline permission prompt or foreground launcher.
<Session.Launch>remains unavailable.
Sessions and turns
With no session query, every Agent turn appears in one chronological stream
ordered by its durable Prompt sequence.
session=<session-key>filters thatstream to the provider conversation the key identifies. An unknown key refuses
the location.
A live Prompt creates one queued turn. Provider start, text deltas and terminal
state update that same turn. These updates never change the filter, route,
selected scope, inspected marker or focus. A live text delta is neither
transcript output nor a durable event.
The ordinary
agent_promptappend replaces the live overlay and is the onlysource for historical and cold Agent turns. A historical prefix before that
append contains no partial response. A cold reopen shows completed, failed and
cancelled retained turns without contacting the provider or pretending a live
stream survived.
Plan and forms
The completed Plan response appears at its invocation and, when it is XMD, is
admitted through the existing
<Evaluate>path and evaluated inline.This Story supports only the forms exercised by the packaged Plan and generated
README program: object text fields, enum decisions, conditionally required
feedback, validation feedback and read-only Markdown or code preview. An
unsupported schema refuses before showing a partial form and identifies the
unsupported keyword and path.
Plan review shows the complete Plan and available decisions, never a future
execution result. The fixed History footer stays reachable while any review,
ordinary Elicit or permission drawer is open, and focus returns to the invoking
location when it closes.
Permissions
A permission request is visible on its owning Agent turn but does not open a
drawer or steal focus by itself. Activating it opens a focus-trapped drawer above
the fixed History footer with every choice the provider offered. Duration is
explicit, including that an “always” choice is scoped to this Agent session.
Only the owning turn waits. Other sessions continue. Choosing one option returns
one outcome to the exact request. Escape, interruption and session teardown
deny or cancel it once and cannot leave the provider waiting. Historical
permission requests are visible but never actionable.
Responsive behavior
Wide composition presents the coordinated panes. Narrow composition mounts only
the routed outlet, active contextual drawer or band, and fixed History footer.
Hidden panes contribute no focus, input, frame demand or rendering. The
canonical location appears once.
Architecture boundaries
sidecar, snapshot or new record family is added.
agent_promptrecords project into frozenReplModelsession and turn values.Routing, layout, components and rendering never read Journal records.
agent_promptmay retain a closed permission audit containing safe displayfields, offered choices and the outcome. It never retains
rawInput, acallback, waiter or provider object; older records remain valid.
Agent.prompt()streamwith execution-scoped middleware.
<Prompt>remains the sole subscriber andowner of provider cancellation. No new public Agent API is introduced.
existing
Agent.requestPermission()operation. The REPL session owns thepending request; the renderer does not.
absence drops visual wakes, not Agent events or ownership.
durable Prompt. Concurrent or identical turns cannot be matched by response
text, display label or completion order.
Acceptance
Plan invocation and completes the generated README review and approved write
through the existing runtime.
resumes the same conversation. Approve and Decline have distinct observable
outcomes.
unfiltered chronology. Selecting one adds
session=<key>and filters only themessages; background activity changes no route, filter, scope, marker or
focus.
produce the same action and outcome.
choice with explicit scope, and settles exactly once on choice, Escape,
interruption and teardown. After Prompt publication the safe request and
outcome remain visible but inert;
rawInputis absent. No readline readerexists.
or after publication and a cold reopen show the retained prompt, terminal
state and final or partial result while making zero provider calls.
no Agent work acquires no adapter.
<Session.Launch>refuses without takingthe terminal.
wait; already appended Journal truth remains reconstructible and the terminal
is restored once.
and History behavior. Narrow Sessions views show the canonical location once.
Negative controls fail if deltas become transcript rows or durable events, the
latest activity selects itself, a historical permission can answer, a cold
reopen fabricates a live turn, the ordinary readline policy is installed, a
partial form mounts, or one live completion replaces another turn's durable
row.
Evidence
Use two deterministic product journeys: the exact Plan/README source above and
a separate three-session document. Drive them through the real XMD execution,
Agent stream, durable Journal, canonical location, mounted Freedom tree,
renderer and terminal host. Compare the accumulated live view with a fresh
projection from the same Journal and location.
Keep focused evidence portable across Deno, Node and Bun except for explicitly
named pseudo-terminal cases. The Planner derives exact test files and feedback
slices from the architect handoff.
Relationships
8adc10429578a14d0c09ba322d77ca3831f87fcdor a latermain.<Plan>,<Session>,<Prompt>,<Evaluate>and<Elicit>behavior and the existing Agent and permission operations.xmd tailremains an independent read-only product and supplies no REPL truth.Out of scope
<Session.Launch>terminal handoff or provider-TUI mirroring.snapshots or another REPL journal record family.