Skip to content

UX v2: agent-first entry paradigm, shared-visibility surface, and model migration#43

Closed
pskeshu wants to merge 34 commits into
gently-project:developmentfrom
pskeshu:feature/ux-v2
Closed

UX v2: agent-first entry paradigm, shared-visibility surface, and model migration#43
pskeshu wants to merge 34 commits into
gently-project:developmentfrom
pskeshu:feature/ux-v2

Conversation

@pskeshu

@pskeshu pskeshu commented Jun 12, 2026

Copy link
Copy Markdown
Collaborator

Screenshot

The new agent-first landing page (UX v2 frontpage):

UX v2 landing page

Summary

Note: the temperature-controller and SPIM F-drive work was split out and already merged as #44 and #45; this PR is the UX v2 work only.

This branch delivers the UX v2 redesign end-to-end, flag-gated behind GENTLY_UX_V2 (now defaulting ON, with v1 fallback intact), plus the model migration to the Claude 5 family.

UX v2 (Phases 0–6)

  • Phase 0–1: unified connection status across the three indicators; dual-render agent asks (chat transcript + main stage); GENTLY_UX_V2 feature flag scaffold
  • Phase 2: grouped rail navigation + session-context strip
  • Phase 3: inference-first plan mode (model-driven) with per-field provenance surfaced in the UI
  • Phase 4: co-editable shared-visibility surface — the agent's mind, live — with empty-state handling
  • Phase 5: Experiment view shows real tactics only (stubbed data dropped)
  • Phase 6: flag default flipped ON; agent-first landing → in-page plan wizard
  • Landing flow fixes (welcome→plan jump, dark mode), agent-activity events, GFM markdown rendering
  • Entry-paradigm prototype + migration plan kept in ux-prototype/ as design reference

Models

  • Migrated to Fable 5 / Opus 4.8 / Sonnet 4.6 with refusal+400 fallback

Misc

  • Detectors: forced-tool structured output for hatching detector + verifier
  • Port-8080 false positive fixed via SO_REUSEADDR on the viz preflight bind; "port in use" error now includes the free-the-port command
  • Gitignore the stray D:/ storage dir

Test plan

  • Launch web UI with GENTLY_UX_V2 unset (default ON) and walk the landing → plan wizard → session flow
  • Set GENTLY_UX_V2=0 and confirm the v1 UI still works as fallback
  • Verify agent asks render in both the chat transcript and the main stage
  • Confirm plan-mode field provenance displays and the shared-visibility panel updates live
  • Smoke-test a perception call on the new model IDs, including the refusal/400 fallback path

🤖 Generated with Claude Code

pskeshu and others added 22 commits June 16, 2026 04:18
The header pill, the home landing line, and the agent dock each computed
connection state from their own signal at their own time. home.js read
state.connected exactly once at tab init — before the /ws handshake — and
never corrected, so the landing showed "Offline — start the agent to
connect" while the header pill showed "Online" and state.connected was true.

Add a single sticky ConnectionStatus store (status-store.js) holding three
distinct signals — gentlyConnected (/ws), microscopeConnected
(/api/device-status poll), agentConnected (/ws/agent) — which replays its
current snapshot to every new subscriber, so a late subscriber can never
miss the initial state (the root of the bug). All three surfaces now read
from / write to this store:
- websocket.js onopen/onclose -> setGently (via updateGentlyStatus)
- app.js fetchDeviceStatus -> setMicroscope; header renders via subscriber
- home.js updateStatus reads the store and re-renders on every change
- agent-chat.js setConn -> setAgent

Verified live: after reload the home line and header pill agree (no more
"Offline while Online"); no console errors.

Bug gently-project#3 (idle event-count inflation) needs no code change: the high-frequency
telemetry (DEVICE_STATE_UPDATE/BOTTOM_CAMERA_FRAME) is already excluded from
the events table + count at websocket.js, and idle measurement showed the
count is calm and dominated by LOG_RECORD.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Adds UISettings.ux_v2 (env GENTLY_UX_V2, default off) and threads it into
the index.html template context from pages.py. This is the coexistence
switch for the agent-first UX: the v2 markup/JS will mount only under this
flag, so the v1 dashboard stays the default and prod is unaffected while
the migration soaks behind the flag.

No behaviour change yet (flag off by default; nothing reads it client-side
until the Phase 1 dual-render lands).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The agent's structured asks (choice_request / choice_response over /ws/agent)
already ARE the one-payload protocol. This makes the SAME ask render both in
the chat transcript and prominently on a new main-stage surface (#ask-stage),
behind GENTLY_UX_V2 — the foundation for the agent-first paradigm.

Frontend only; no wire-protocol or backend change. The double-answer and
turn-wedge concerns are handled without touching the server:
- agent-chat.js renderChoice is factored into a pure buildAskCard(data, {reqId,
  isWake, hasControl, onPick}) reused by both surfaces; exported alongside
  answerChoice + a hasControl getter.
- A module-level answeredAsks Set keyed by request_id makes answering idempotent
  across both surfaces (only ONE choice_response is ever sent), so the existing
  holder-gate + _choice_futures.pop on the server stay correct and never see a
  duplicate.
- The CLEAR signal fires off the CHOICE lifecycle: answerChoice emits
  ASK_CLEARED{request_id} the instant a response is sent (NOT stream_end, which
  lands after the answer for in-turn asks and never for a cancelled turn). Both
  surfaces clear on it; '*' clears all on cancel/error/socket-drop.
- Read-only when !hasControl on both surfaces (observers can't answer), matching
  the server's holder gate — no dismiss-without-answer path, so asend can't wedge.
- Adds the free-text "Something else…" escape the web cards lacked (the bridge
  routes unknown selections to LLM resolution).

ask-stage.js (new) renders the current ask into #ask-stage via AgentChat.buildAskCard
and clears on ASK_CLEARED; no-ops unless #ask-stage is present (flag off → v1
untouched). Verified: node --check on all touched JS, Jinja parse on index.html.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Replaces the flat 8-tab bar with a calm grouped left rail (Now / Library /
System) and adds a session-context strip at the top of the main area — the
structural transformation toward the prototype's shell. All scoped under
body.ux-v2; v1 markup/CSS untouched (no consolidation of the known duplicate
.tab rulesets — deferred to the final cleanup phase).

- shell.js (new): wires each rail item to switchTab(tabId) — it ROUTES through
  the single init chokepoint, never reimplements tab activation, so every tab's
  lazy-init side-effect still fires. Keeps the rail's active state in sync via a
  new TAB_CHANGED event; populates the strip's status/embryo count from the
  Phase 0 ConnectionStatus store. Wires the rail's "Talk to Gently" to the
  existing AgentChat dock. No-ops unless body.ux-v2 is present.
- app.js: switchTab now emits TAB_CHANGED(tabName) — additive; v1 has no
  listener, so no behaviour change.
- index.html: the rail (first child of the flex-row .app-shell) + the strip
  (top of .app-main) + shell.css/shell.js includes, all under {% if ux_v2 %}.
- shell.css (new): rail + strip styling and a subtle unfold animation, every
  rule scoped under body.ux-v2.

Deferred to keep this phase low-risk: History-API routing and the
session_changed in-place re-hydration (current hash routing + reload still
work). Verified: node --check on all touched JS, Jinja parse on index.html.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…nce)

Flips plan mode from ASK-FIRST to INFERENCE-FIRST: the agent arrives with a
draft instead of interrogating the researcher. Per Keshu's call, the genotype
-> imaging-channel inference is done by the MODEL (it reads the reporters and
knows fluorophore spectra) — NOT a hardcoded heuristic table, which would only
cover a fraction of real fluorophores/dyes and force needless "asks".

- prompt.py: the stance now says infer what you can (channels from the strain
  genotype via your own fluorophore knowledge, organism defaults, lab/campaign
  context), record each inferred value's source + confidence in the spec's
  provenance, state a wavelength only when confident (else mark low-confidence
  and confirm via ask_user_choice — never guess a number), and ask ONLY for
  genuine gaps / low-confidence / consequential choices.
- model.py: ImagingSpec gains a `provenance` map (field -> {source, confidence}).
  It's a valid dataclass field, so it flows end-to-end with no extra plumbing:
  the model passes it in create_plan_item(spec=...), the store rebuilds it via
  ImagingSpec(**valid-fields), and it round-trips through serialization.

Backend only; needs a server restart to load the new prompt. The actual
inference behaviour is validated live in plan mode (see handoff).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…in the UI

Makes Phase 3a's inference visible. renderSpec now shows the channel
(laser_wavelength_nm) and reporter/genotype rows — which it omitted before —
and tags each value with its provenance ("561 nm · inferred · medium") read
from spec.provenance, so the researcher can see what was inferred vs. cited and
what to confirm.

- agent-chat.js renderSpec: keyed rows (label, value, fieldKey) with a small
  source/confidence tag per row when spec.provenance carries that field; adds
  Genotype/Reporter/Channel rows.
- bridge.py: the spec payload builder now includes genotype/reporter/
  laser_wavelength_nm and the provenance map (was a curated subset that dropped
  the channel), so the UI has the data to render.
- ask-stage.css: styling for the .ac-spec-src provenance tag.

Frontend + a contained backend payload enrichment; node --check + bridge import
verified. Note: this surfaces provenance wherever the spec panel is shown and in
the plan document (which already serializes provenance); threading it through
every spec-emission path (e.g. the apply_plan_acquisition_spec stash) and a full
plan_confirm ask with inline edit/confirm is the remaining 3b polish.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…d, live)

Renders the agent's expectations (beliefs), watchpoints (attention), and open
questions (uncertainty) as a calm panel on the landing, updating live and
resolvable by the control holder.

The "store has no event bus" blocker is solved via the EXISTING global bus
rather than dependency injection (matches agent.py's `emit` usage, so no
__init__/launch_gently changes):
- core/event_bus.py: new EventType.CONTEXT_UPDATED.
- file_store.py: FileContextStore._notify_context_change() emits it (lazy import,
  best-effort) from add/resolve of expectations, watchpoints, and questions. The
  server already broadcasts ALL bus events to /ws (subscribe_async("*")), and
  websocket.js re-emits them on ClientEventBus — so the surface refreshes live
  with zero new transport. Verified: the emit fires on the bus (unit check).
- routes/context.py (new, registered): GET /api/context (read the 3 lenses,
  defensive on cold start) + POST .../{id}/resolve for questions/watchpoints/
  expectations, each gated by Depends(require_control) (data.py pattern, NOT the
  mesh-scoped campaigns auth) so viewers can't mutate the agent's mind. Read side
  reuses campaigns._serialize.
- context-surface.js (new, ux_v2 only): fetches /api/context, renders the three
  lenses, re-fetches on CONTEXT_UPDATED + AGENT_CONTROL, and lets the holder
  answer a question (inline input — no native prompt), resolve a watchpoint, or
  confirm an expectation. shell.css: scoped styling. index.html: panel mounted at
  the top of the home landing under {% if ux_v2 %}.

Backend needs a server restart to load; live push + render is validated in-app.
Proactive #ask-stage cards from watchpoint creation are the remaining Phase-4
polish (noted).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The context surface hid itself entirely when the agent had no expectations/
watchpoints/questions — so on a fresh session it was invisible and read as
"missing". Render a calm "nothing yet" empty-state instead, so the surface is
discoverable before the agent has formed any beliefs. Static JS/CSS only —
hard-reload to pick it up, no restart.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
When the viz server can't bind its port, the error now tells you how to free
it (fuser -k <port>/tcp, or lsof -ti | xargs kill) instead of just "close it
first" — uses self.port so it's always the right port. (Standalone DX fix.)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
… data

The Experiment view's job is to show the live experimental TACTIC patterns
(cadence: base/fast/burst/cooldown + reactive-monitoring rules). It was
falling back to a ~130-line STUB_STRATEGY (and a "mockup · stubbed data" badge)
whenever there was no active experiment or the fetch wasn't ready — i.e.
production could render fake tactics.

- Removed the STUB_STRATEGY const entirely.
- loadStrategy() now returns null on non-OK / error (no stub fallback).
- render(null) shows a calm empty state ("No active experiment — the imaging
  tactics will appear here once a run is live"), never fabricated data.
- Removed both "mockup · stubbed data" badges; the header just shows "live".

Affects v1 and v2 (the Experiment tab isn't flag-gated) — removing fake data
is correct for both; it only changes the no-active-experiment case (stub →
empty state), real live runs render as before. node --check clean.

NOT done (deliberately): the large carve of a new per-embryo renderer out of
the 4,556-line embryos.js — the existing ExperimentOverview already renders the
tactic patterns from /api/experiments/current/strategy, and the detailed
contents are yours to define. The reconcileWithServerState/clearAllState
contract in embryos.js is left untouched.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
v2 is now the default UI — no env var needed. The v1 dashboard stays reachable
as a fallback via GENTLY_UX_V2=0 (and its markup is NOT deleted yet). This is
the reversible "flip → soak" step; the irreversible v1 markup/CSS deletion is
deferred until v2 has run as the default and is confirmed good.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Add the entry landing the prototype sketched — agent orb, time-aware greeting, and choice cards (Plan / quick look / free-text escape), behind GENTLY_UX_V2 and receding into the workspace.

Crucially, the plan dialogue renders IN the landing, not the chat REPL: 'Plan an experiment' switches to an in-place plan-wizard screen, enters /plan, and renders the agent's ask_user_choice questions as button cards there (reusing AgentChat.buildAskCard), with the plan assembling from each pick. agent-chat.js: runCommand is now connection-aware (connect + queue/flush on open) so the page drives the agent without opening the chat panel.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Self-contained landing prototype (ux-prototype/landing.html) and the 8-phase migration plan it was built from. A sketch space, kept separate from the live frontend.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Convert hatching.py and the verifier's four challenger strategies from JSON-in-prose / startswith-scraping with silent defaults to forced tool_choice — the verdict arrives as a validated dict on the tool_use block. Deletes the regex/parse layer; downstream vote-tally/consensus is untouched.

Also drop self-rated confidence from these schemas (a heuristics-era artifact — the boolean/categorical judgment is the signal); the ensemble's derived agreement ratio stays. docs/HEURISTICS-AUDIT.md ranks the remaining candidates and the keep-deterministic boundary.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…ight bind

uvicorn binds with SO_REUSEADDR; the preflight check did not, making it stricter than the server it guards — a just-exited instance leaves client sockets in TIME_WAIT that fail a bare bind() even though uvicorn would bind fine, so quick restarts hit 'port in use' repeatedly. Set SO_REUSEADDR on the preflight so it fails only on a genuine live listener.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
On Linux the Windows default GENTLY_STORAGE_PATH (D:\Gently3) gets created literally as ./D:/ under the repo, full of logs/sessions. Ignore it so it stops cluttering status and can't be committed by accident.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Polish + flow fixes for the agent-first landing and in-page plan wizard.

- Kill the welcome→plan "lift-up" lurch: top-anchor both screens to one
  shared offset so the orb no longer teleports ~140px on swap (now ~1px),
  with a single coordinated cross-fade keyframe.
- Fix broken dark mode: define the tokens landing.css relied on but the
  theme never set (--bg, --text-secondary, --accent-soft, --accent-green-soft),
  scoped to body.ux-v2 with a light override; route the page background, drift
  glow, and accent-keyed shadows through real per-theme tokens.
- A11y + polish: visible :focus-visible rings, animated tool-card reveal
  (grid-rows), feed scrolls internally with anchored header/footer, single-
  column mobile without a nested-scroll trap, consistent type scale + 4px
  spacing, ~40px touch targets, aria-expanded on disclosures, expanded
  prefers-reduced-motion coverage.
- Entry flow: under ux_v2 the landing owns session entry, so suppress the
  legacy connect-time resolution picker server-side (it duplicated and
  contradicted the landing's Plan/Standalone choice). Guard the design
  kickoff so it fires once per session (no Back/forward pile-up).
- "Plan an experiment" now offers continue-vs-fresh when an active campaign
  exists: continue it (default) or start a brand-new campaign from scratch.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
agent-chat.js mirrors the agent stream onto a new AGENT_ACTIVITY event (turn/thinking/text/tool_start/tool_result/turn_end/error) so the plan wizard can render the agent's work as collapsible tool cards instead of leaving it in the chat. Replaces the inline-only mdToHtml with a block-aware, escape-first GFM renderer (headings, pipe tables, lists, fenced code, links — XSS-safe and streaming-safe) and exports it; agent-chat.css styles the ac-md-* output for both the chat and the wizard feed.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…allback

settings.py tiers: main→claude-fable-5, perception+medium→claude-opus-4-8, fast→claude-sonnet-4-6, plus a refusal_fallback (claude-opus-4-8).

Strip the params the new models reject: thinking budget_tokens → output_config.effort (conversation.py, sam_detection.py); drop the obsolete interleaved-thinking beta header (agent.py). conversation.py: a main-tier 400 (e.g. Fable 5 under <30-day org data retention) OR a stop_reason='refusal' transparently retries the turn on Opus 4.8 in both the streaming and non-streaming paths; get_tool_call guards empty refusal content; dopaminergic detector guarded. chat.py model centralized to settings.

Quiet log noise: the per-response diagnostic WARNING→DEBUG (it fired on every tool-use turn), and the benign send-after-close websocket WARNING→DEBUG.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…tooling

Rebasing feature/ux-v2 onto development (now carrying gently-project#47's ruff/format
gate) left the model-migration and detector-rewrite files in their
pre-gently-project#47 formatting. Run ruff --fix + ruff format and fix the violations
that aren't auto-fixable:

- model.py: provenance annotation used unimported `Dict` (F821, would
  NameError at import) -> `dict[str, dict[str, str]]` (PEP 585).
- sam_detection._detect_with_sam: returned undefined `image_8bit`
  (F821) -> `image_rgb`, the 8-bit RGB image computed at the top.
- agent.py / sam_detection.py: moved the `logger = ...` assignment below
  the import block to clear E402 (import execution order unchanged).
- verifier.py / conversation.py: wrapped long log/summary f-strings and
  tool-schema descriptions; reflowed prompt prose (content preserved) to
  satisfy E501.

ruff check . and ruff format --check . both pass (lint.yml CI gate).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Fable 5 was declining benign planning turns (stop_reason="refusal"),
which tripped the refusal fallback on essentially every turn — adding a
full extra round-trip of latency per message. Point MODEL_MAIN at Opus
4.8 so the common path is a single call; refusal_fallback is now inert
(the guard skips it when fallback == main). Set MODEL_MAIN=claude-fable-5
to switch back once Fable 5 stops refusing. Prune the now-stale Fable-5
notes from the tier docstring.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
pskeshu and others added 4 commits June 16, 2026 04:28
Stream a bounded result_full alongside the 140-char result_summary so the
web UI's expandable tool card can show what a tool actually returned, not
just the one-line preview. Frontend (landing.js/css) renders the expandable
card; the thinking indicator's label is wrapped in a span so it can be
updated live.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Live digital-twin of the addressable imaging volume: the acquisition cuboid
+ light-sheet plane, driven by a new SCAN_GEOMETRY_UPDATE backend signal
(emitted from acquire_volume, bootstrapped via /api/devices/scan_geometry)
and live DEVICE_STATE_UPDATE positions. Sits as the Map / Details / 3D view
switcher inside the Devices tab (not a top-level nav tab). Includes a demo
driver for offline development.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Flow/IA audit (not visual) from a live click-audit with the agent on, plus
code cross-check. Prioritized findings + fixes: P0 loading-state legibility
(stream thinking summary — set thinking display:summarized + handle
thinking_delta), first-character truncation in the plan feed, control/auth
wall hidden in chat, double ask-mount, ASK_CLEARED never emitted, no path
back to welcome, non-stateful routing, resume hard-reload, and the
workspace-IA placement of the 3D optical-space view.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The streaming path collected the entire turn before yielding anything, so the
plan wizard sat on a static "working…" spinner for the whole turn (~90s). And
the streamed call requested no thinking, so there was no reasoning to show even
if it had streamed.

- conversation.py: rewrite call_claude_stream to stream live — a worker thread
  drains the SDK stream and pushes events onto an asyncio queue as they arrive;
  the coroutine yields text/thinking deltas in real time. Enable adaptive
  thinking with display="summarized" (+ effort=medium) and emit thinking_delta
  as {"type":"thinking"} chunks. Full assistant content (incl. thinking blocks)
  is still replayed from final_message, so the tool loop stays valid. Retry /
  400-fallback / refusal-fallback preserved (clean while nothing's been yielded).
- agent-chat.js: forward the thinking text on the 'thinking' activity.
- landing.js: render streamed reasoning as a dim block in the plan feed and add
  an elapsed-time counter to the thinking indicator so a long think reads as
  progress, not a hang.

Verified live (Opus 4.8): reasoning + prose stream into the plan feed during the
turn with a ticking timer; no console errors.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
pskeshu and others added 8 commits June 16, 2026 07:31
… strings

The model often serializes nested tool args (spec, references) as JSON strings
instead of objects. create_plan_item stored the raw string, and read-back via
_dict_to_plan_item did spec_data.items() on a str → AttributeError, leaving a
malformed, unreadable plan item persisted.

- planning.py: _coerce_plan_args() parses string spec/references (and int-casts
  estimated_days) in both create_plan_item and update_plan_item before storing.
- file_store.py: _dict_to_plan_item tolerates spec/references persisted as JSON
  strings (parse on read; fall back cleanly on garbage), so existing bad items
  load instead of crashing.

Verified: string spec/refs hydrate to ImagingSpec/list; malformed spec → None
(no crash).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…rompt

The plan-mode prompt specified what to design in detail but nothing about how to
write to the user, so (with Opus 4.8's stronger narration) the agent produced
dense questions, paragraph-long ask_user_choice options, and over-explained
prose — cognitively heavy for a working biologist. Add an explicit
communication-style section: lead with the ask/finding, short questions + short
options, plain words over process jargon, one-clause rationale (full reasoning
goes to provenance/references), one idea per message.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
A turn's tool calls were always awaited one-by-one, so several independent
lookups (e.g. search_strains for dlg-1 then ajm-1) ran serially even when the
model could issue them together. Add a concurrency fast-path: when EVERY tool in
a turn is non-hardware (requires_microscope=False) and non-interactive (not
ask_user_choice), fire their tool_start events, asyncio.gather the executions,
then emit results. Any microscope action or ask_user_choice in the batch falls
back to the existing serial path, so hardware is never raced and interactive
prompts/stateful ordering are preserved.

Also nudge the plan-mode prompt to batch independent lookups into one turn so the
model actually produces parallelizable tool calls.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
phase_number arrived as "1" (stringified, like spec/references), so
get_nth_subcampaign did `1 <= "1"` → TypeError. Coerce phase_number/phase_order
to int in the create tool, and make get_nth_subcampaign tolerant of a numeric
string.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
… creation

The concurrency fast-path gated only on requires_microscope=False, which would
also have run mutating tools (create_/update_/delete_plan_item) in parallel —
they share a campaign's plan file and are order-dependent, so concurrent runs
could corrupt it. Tighten the gate to genuinely read-only tools (search_/read_/
query_/get_/list_/recall_/find_/fetch_/lookup_ prefixes). Mutating creates stay
serial.

The latency win for plan construction is fewer model turns, not parallel writes:
add a prompt nudge to emit several create_plan_item calls in one turn (executed
serially, safely) instead of one item per turn.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Two flow/IA fixes to the plan wizard, both surfaced in a live click-audit:

1. Plan-ready completion state. When propose_plan lands and the turn
   settles with no pending question, the wizard now flips to a "ready"
   state instead of leaving the user parked on the last feed step: the
   header reads "Your plan is ready — N items across M phases" (counted
   from the real plan tree), the eyebrow/orb turn green, and the footer
   link is promoted to a filled primary "Open the workspace ›" button.
   Resets on the next turn_start so refining drops the banner cleanly.

2. THE PLAN panel readability. Items were a flat gray bullet list with
   phases labeled by machine shorthand ("nrp-p1"). Each item is now a
   structured row — phase-relative number (1.1), a type-colored marker
   (imaging=blue, genetics=purple, analysis=green, bench=amber,
   decision_point=rose gate-square), the title, and an optional duration.
   Phases read by their human name ("Phase 1 — Reporter validation").

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The streamed thinking summary fills the wait, but the trailing "wrap-up"
reasoning ("let me wrap this up concisely and offer to export…") was left
in the feed as a dim block right next to the answer it precedes — reading
as leaked narration. It's a thinking block, not the agent's text output.

When the spoken answer begins, remove the immediately-preceding thinking
block from the DOM instead of only nulling the pointer. Thinking that
precedes a TOOL is kept (it's the rationale for that action); only the
reasoning that precedes the answer text is dropped.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The agent used to close a finished plan by asking "want me to export this
as markdown, or save it as a template?" — a question the plan wizard can't
answer (no text input there). Replace it with a real action.

- Plan-ready footer gains a quiet "↓ Export plan" button. It fetches the
  existing /api/campaigns/{id}/export tree and renders a shareable markdown
  doc client-side (title, goal, phases, numbered items with type, specs,
  references), then downloads it as {shorthand}.md. Revealed in the ready
  state, hidden again if a new turn starts.
- Plan-mode prompt: after propose_plan, close on the summary and do NOT
  offer to export / save-as-template / ask "what next?" — the interface
  owns those now.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@pskeshu

pskeshu commented Jun 16, 2026

Copy link
Copy Markdown
Collaborator Author

Superseded by #58, which now targets development directly and contains all of feature/ux-v2 plus the shared lab notebook (incr 1 & 2), the imaging Run button, the opencv dep, and the production-machine fixes. Consolidating to a single PR — closing this in favor of #58.

@pskeshu pskeshu closed this Jun 16, 2026
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