Agent TUI¶
OpenMed's TUI is the main operator interface: a terminal chat surface with visible plans, tool calls, structured workflow cards, local session persistence, and model/skill switching.
Launch¶
openmed
openmed --model gpt-6.1-sol
openmed --models
openmed agent --model gpt-6.1-sol --reasoning-effort medium
What the interface shows¶
A normal run can include:
- your prompt and attached files
- a visible plan
- inline tool calls and results
- model text and optional reasoning summary
- workflow cards and artifact references
The key idea is that work stays inspectable in the conversation instead of disappearing behind a background job.
Input model¶
The input box reacts to these prefixes:
| Prefix or action | What it does |
|---|---|
| plain text | Normal chat request |
@ |
Attach file paths inline |
# |
MCP autocomplete |
$ |
Skill autocomplete |
/ |
Slash-command autocomplete |
Useful behaviors:
Entersends a messageShift+EnterorCtrl+Jinserts a newlineUpandDownbrowse input historyEnterwhile a run is active steers the current runTabwhile a run is active queues a follow-up to send after the current run finishesTaborEnteraccepts the highlighted autocomplete entry- drag/drop files or folders pastes absolute paths
Keyboard shortcuts¶
| Key | Action |
|---|---|
Ctrl+Q |
Quit |
Ctrl+C or Esc |
Interrupt the current run. When idle, these close an open dialog or autocomplete list, then clear the input |
Ctrl+L |
Clear the conversation and its context |
Ctrl+P |
Open the command palette |
Ctrl+O |
Switch or create a session |
Ctrl+M |
Open the model picker |
Shift+Tab |
Cycle agent mode |
F1 |
Open help |
Many terminals send Ctrl+M as Enter, so it can submit the input instead of opening the picker. /model works in every terminal. Likewise, Ctrl+J inserts a newline where Shift+Enter is not reported.
Model picker¶
The model picker is a three-step flow:
- Choose a model
- Choose a model-specific reasoning effort
- On supported models, choose whether to show reasoning summaries
You can open it with /model or Ctrl+M.
Doubleword is available once its key is configured. Select
Doubleword → DeepSeek V4.1 Flash for real-time streaming and the usual agent
tools, or launch with openmed agent --provider doubleword. Provider headings
stay visible in search results. Async Responses and 24-hour batches are managed
in another terminal using openmed responses and openmed batch; they do not
have TUI job screens. See Doubleword for mode selection.
The Doubleword group offers 11 built-in models. Set models in its provider
options, or use openmed config provider-set doubleword --models "id1,id2",
to replace the list; the first entry is its launch default. Reopening /model
reloads the configuration. Use exact IDs from the
Doubleword model table.
The first step opens with a search box focused, so you can just start typing:
the list filters live on model id, display name, or provider, keeping provider
headings visible while you search. For example, MiMo token-plan models stay
under MiMo, separate from MiMo models served through OpenRouter.
Without a query, models are grouped into
sections — Favorites, Recent, then one section per configured provider
(Anthropic, OpenAI, MiMo, Doubleword, OpenRouter, Custom endpoint). Each row shows the model on
the left and its source or capabilities dimmed on the right; the current model
carries a ● marker and favorites a ★.
| Key | Action |
|---|---|
| type | Filter the list as you type |
↑ / ↓ |
Move the highlight, even while the search box has focus |
Enter |
Select the highlighted model |
Ctrl+F |
Star or unstar the highlighted model (persisted in ~/.openmed/settings.json) |
Esc |
Close without changing the model |
Selecting a model records it under Recent. A favorited or recent model is listed once, in that section, rather than repeated in its provider section. If the same model id is configured under two providers (a model served on a local endpoint that also exists on OpenRouter), each appears under its own provider and selecting one routes to exactly that provider.
GPT-6.1 Sol and GPT-6 Astra expose low, medium, high, xhigh, and max.
GPT-6 Sol and Luna also expose none, which skips the reasoning-summary step.
The default GPT-6.1 Sol session applies medium reasoning with thinking display
off. An existing none setting maps to low on models that require reasoning.
With a MiMo token-plan key configured, the MiMo section includes
mimo-v2.5-pro (default, text), mimo-v2.5 (text and images),
mimo-v2.6-pro (text and images), and mimo-v2.6-flash (text). The reasoning
picker offers Thinking on and Thinking off. Choosing off sends
thinking.type=disabled; other effort values enable thinking. No model-list
configuration is required. See MiMo setup
for the key-only setup and provider_secrets.json examples.
During a turn, the activity label identifies where startup time is being spent:
| Status | Meaning |
|---|---|
| Preparing request… | Request/privacy routing is running; a same-provider helper call may also run before the primary model request. |
| Waiting for model response… | The primary request has been sent, but no reasoning or answer delta has arrived. |
| Model is reasoning… | Provider-returned reasoning is streaming into the visible reasoning block. |
This distinction is especially useful with MiMo token plans: the direct Xiaomi
route and a namespaced xiaomi/... model on OpenRouter are different serving
paths and can have very different time to first output. See
MiMo startup latency and TUI status.
Agent modes¶
The TUI can switch among three agent modes:
| Mode | Behavior |
|---|---|
clinical |
Full registered tool access |
consumer |
Restricted safety-first allowlist for personal health workflows |
coordination |
Restricted care-coordination lane for inbox triage, discharge handoff, and reviewer-safe patient drafts |
You can switch modes with Shift+Tab or /agent.
The same three modes are available from the CLI with openmed agent --agent ....
Access modes¶
Access modes set how tools are gated, separately from the agent mode. Switch with /access. The choice is saved with the session, and new sessions start in Ask.
| Mode | Permission mode | Behavior |
|---|---|---|
| Ask | auto |
Approval-gated tools prompt; see Permission policy |
| Read-only | plan |
Only read-only tools run, for exploring and planning |
| Full access | acceptall |
Tools run without per-call approval unless denied |
Sessions¶
Sessions persist locally and keep:
- conversation history
- model and reasoning settings
- active skill
- agent mode and access mode
- PHI mode
- plan history
- durable global plan paths for long runs
- tool and card output
Use Ctrl+O or /session to switch sessions or create a new one. To resume one at launch, pass openmed --session <id>.
Long sessions¶
The TUI is built to keep a single session running for hours without getting heavy:
- Scroll-up history. Opening a session mounts only the newest messages; older ones stream in automatically as you scroll toward the top — there is no "load more" button to click. During a live run the oldest rows are likewise pruned back into that scroll-up history so the widget count stays bounded no matter how many tool calls a turn makes.
- Delta-journal saves. Checkpoints append only what changed to a sidecar
<session>.delta.jsonljournal instead of rewriting the whole session JSON, so saving stays fast at any transcript length. The journal folds back into the canonical file when the session closes. - Auto-compaction. When the model context approaches its window, the TUI
warns once and then compacts automatically before the next request; a
mid-turn overflow is self-healed by the provider SDKs.
/compactremains available for manual runs. - Persistent input history. Submitted prompts are kept in
~/.openmed/history.jsonl(capped, local-only, skipped in DEID mode) soUp/Downrecall works across restarts.
Plans, tools, and workflow cards¶
When the agent decides on a multi-step path, it records a plan in the chat and advances it as tools complete.
OpenMed has two planning layers:
- The visible phase plan is the compact checklist shown in the TUI. It is optimized for the current few steps.
- The durable global plan is a Markdown/JSON ledger for long tasks with many requirements or deliverables. It is stored in the workspace or workflow output directory and is checked before the agent claims the full task is complete.
By default, repository-scoped ledgers are written to ./.openmed/OPENMED_PLAN.md and ./.openmed/OPENMED_PLAN.json. Workflow/output-scoped ledgers are written beside the generated artifacts as OPENMED_PLAN.md and OPENMED_PLAN.json.
Tool execution shows up inline with start/end states. Deterministic workflows can also emit cards of these types:
infoevidencesuggestionuncertainty
Cards are part of the persisted session history and replay when you reopen the session.
Workflow tool receipts can also include recommended_skills and skill_hint.
These fields are operator-facing guidance for loading companion overlays such
as citing-evidence, handling-phi-disclosure, escalating-to-reviewer, or
preparing-clinical-artifacts before summarizing, packaging, or finalizing a
workflow result.
Review surfaces¶
There are three different review surfaces to understand:
- The inline conversation itself: plans, tool calls, results, and cards stay visible
- Deterministic workflows: draft previews can be inspected before finalization. The returned
approval_tokenvalidates the workflow request parameters but is not authorization. The reviewed cards, evidence, and full artifact bytes are stored in a private, session-owned immutable snapshot identified by the draft run ID and SHA-256 digest. Snapshots expire after 24 hours by default and are removed after successful finalization, session clear/rollback, or session deletion;/draftshides expired or missing snapshots and shows the expiry time for active ones. Missing, altered, expired, mismatched, or ambiguously selected snapshots fail closed. Reviewer-gated workflows also requirereview_metadatacaptured by the UI.
Finalized bundles are staged and committed atomically. The destination must be new, empty, or an existing OpenMed-owned bundle for the same workflow; filesystem roots, mount points, the live working directory, session state, and arbitrary nonempty directories are rejected before a draft becomes finalizable.
Delivery intent is request-scoped. If the user asks for finalized output, the app creates the immutable draft first and then finalizes that exact snapshot at turn settle. If the user asks for a draft, or does not name a delivery state, the draft is the completed result and the plan ends normally. A later message such as “looks good, send it” is interpreted by a small auxiliary model on your configured provider and mapped to the active draft without asking for a run ID. Questions, edits, negations, classifier failures, and ambiguous targets never finalize. Reviewer-gated workflows open the reviewer-metadata form only when the final write is actually due.
- Approval-gated tools: in Ask mode,
edit_fileand any tool matchingask_toolspause for an approval dialog on every provider. The dialog offers Allow Once, Always This Session, and Deny
Do not assume every tool pauses for approval. write_file and the export tools run without a prompt unless you list them in ask_tools. Workflow delivery does not pause the plan: the host interprets delivery intent, while every draft_only=false call still requires the ephemeral one-use grant plus the verified immutable snapshot selected outside the agent model.
Slash commands¶
| Command | Behavior |
|---|---|
/clear |
Clear the conversation and its context |
/help |
Open help |
/model |
Open the model picker |
/skill |
Open the skill switcher |
/agent |
Open the agent-mode switcher |
/access |
Open the access-mode switcher |
/session |
Open the session switcher |
/theme |
Open the theme picker |
/phi |
Cycle the PHI mode: full, deid, strict. Changing it resets the provider session and drops queued messages |
/privacy |
Review clinical file redaction and save output; see Clinical NLP |
/privacy-batch |
Run or resume clinical privacy across a file |
/privacy-chat [off\|on\|auto] |
Set file privacy; with no argument, turn it on |
/autoapprove [on\|off] |
Toggle unattended auto-approval of tool prompts (each bypass is logged; workflow snapshot and reviewer safeguards are never bypassed; also openmed --auto-approve or OPENMED_AUTO_APPROVE=1 for scripted demos/tests) |
/copy [n] |
Copy the newest message's last fenced code block to the clipboard (/copy n picks the nth); copies the original text, not the wrapped rendering. Selecting any text with the mouse also auto-copies it. |
/plan |
Show the visible phase plan and global plan summary |
/plan global |
Show the durable global plan summary |
/plan pending |
Show pending or invalid global plan tasks |
/plan open |
Print the Markdown and JSON global plan paths |
/compact |
Compact older context |
/compact thinking |
Remove thinking blocks only |
/fork [n] |
Fork the current session, optionally at message n |
/rollback N |
Undo the last N user turns |
/undo |
Undo the last user turn |
/retry |
Re-send the last user prompt |
/mcp |
Show MCP server status |
/workflows |
List deterministic workflows and required inputs |
/drafts |
List active workflow drafts and human-readable destinations; ask naturally to finalize one |
/finalize [draft] |
Finalize a reviewed draft. If a turn is running, the finalize is queued until it ends |
/config |
Show effective runtime configuration — permission mode, allow/deny/ask rules, project root, loaded settings sources, and persistence threshold |
/audit |
Show audit status, destination, PHI payload mode, fallback path, and audit CLI commands |
/reset |
Reset agent state |
Skills in the TUI¶
Type $ or use /skill to browse built-in and user-provided skills.
The built-in library has 21 skills:
analyzing-clinical-textanalyzing-experimental-dataanalyzing-health-dataauthoring-openmed-skillsauditing-medical-codescare-coordinationciting-evidencedeveloping-fhirdocumenting-clinical-visitsdrafting-trial-protocolsescalating-to-reviewerexplaining-eob-claimshandling-phi-disclosuremanaging-case-contextpreparing-clinical-artifactsprocessing-piiresearching-literaturereviewing-appealsreviewing-prior-authrunning-clinical-workflowsspecial-pathogen-triage
See Skills for how they work and where custom skills live.
Native tools, web search, and MCP¶
The default registry includes more than 90 native tools. On OpenAI and ChatGPT sign-in, setting OPENMED_BUILTIN_WEB_SEARCH=1 also exposes the provider's built-in web_search, which is separate from the registered native tools.
Those native tools cover:
- file and artifact operations
- extraction and PII tooling
- consumer health imports and analysis
- PubMed
- ICD-10, CPT, SNOMED, LOINC, RxNorm, MedlinePlus, HCC, RAF, and crosswalks
- workflow orchestration
- planning and skill loading
Many of the medical tools use OpenMed's native medical service plane. They are still native OpenMed tools from the model's perspective, not MCP tools.
MCP remains optional. Use # or /mcp when you want to bring in external systems that are not already part of the native tool surface.
The consumer-import and care-coordination adapter paths are local-only review flows. OpenMed does not auto-send patient messages or write back into external systems from those lanes.
Runtime settings and project instructions¶
OPENMED.md¶
Drop an OPENMED.md file at your git root (or in the working directory, outside a git repository) to inject per-project instructions into the system prompt. The file is loaded at SDK initialization and appended as a ## Project Instructions (OPENMED.md) section. This is useful for customizing agent behavior per workspace without modifying the built-in prompts.
Permission policy¶
OpenMed supports rule-based permission modes that control how tools are gated before execution:
| Mode | Behavior |
|---|---|
auto |
Tools with requires_approval or is_destructive prompt for approval; others run freely |
acceptall |
All tools run without approval unless blocked by a deny rule |
denyall |
Tools are blocked unless they match allow_tools or ask_tools |
plan |
Only read-only, concurrent-safe tools run, plus any that match allow_tools or ask_tools |
Set the mode in .openmed/settings.json at the project root or in ~/.openmed/settings.json for user-level defaults:
deny_tools removes matching tools entirely, and ask_tools makes matching tools prompt. allow_tools is a strict allowlist: when it is set, the model sees only the matching tools, and they run without a prompt. See Runtime Settings.
The access mode you select in the TUI takes priority over a stored permission_mode, except for Ask, which uses the stored mode. Settings cascade: CLI arguments take highest priority, then project settings, then user settings.
Use /config in the TUI to see the effective runtime configuration at any time.
Tool safety classification¶
Every registered tool carries safety metadata:
is_read_only— tool does not modify stateis_concurrent_safe— tool can run in parallel with othersis_destructive— tool may cause data loss
The permission policy reads these flags, and OpenMed runs a turn's read-only, concurrent-safe tool calls in parallel.
Oversized tool result persistence¶
When a tool produces output exceeding the configured threshold (default 50,000 characters), the result is automatically written to disk. The model receives a compact stub with the file path, size, content type, and a 500-character preview, plus a hint to use read_file for the full content. Configure the threshold in project or user settings: