Command-Line Interface (CLI)
BioCortex provides a full-featured CLI for running analyses, interactive REPL sessions, knowledge-graph operations, MCP server management, and launching the web interface—all from the terminal.Invoking the CLI
After installation, install the package in editable mode so thebiocortex command is available:
Commands Overview
| Command | Description |
|---|---|
biocortex cli | Start the full-featured BioCortex REPL (recommended). |
biocortex run | Execute a single task (one-shot, non-interactive). |
biocortex interactive | Start a basic interactive session. |
biocortex status | Show system status (models, KG, tools). |
biocortex web | Launch the Gradio or Next.js web interface. |
biocortex import-biomni | Import tools from a Biomni installation. |
biocortex kg | Knowledge graph: search, stats, context, add, load-go, mermaid. |
biocortex encode | Encode biological data into embeddings. |
biocortex bench | Run BixBench evaluation. |
biocortex cli
The primary entry point for interactive use. Launches the full REPL with:- ASCII art banner and system info panel
- Ghost-text placeholder suggestions (Tab to fill)
- Slash command autocompletion with descriptions
- Persistent bottom status bar (model · strategy · cost · context %)
- Session management (save / resume)
- Plan review — inspect and approve the analysis plan before execution
- Clarification dialog — prompts for missing context (e.g. species for scRNA-seq)
- MCP server management — start/stop external tool servers on demand
| Option | Short | Description |
|---|---|---|
--model | -m | Reasoning model name override. |
--strategy | -s | Default strategy: auto, react, dag_parallel, mcts, hypothesis. |
--data | -d | Data directory path made available to the agent. |
--biomni | — | Path to a Biomni installation (tool bridge). |
--output | -o | Output directory for reports and artifacts. |
--docker | — | Use Docker sandbox for code execution. |
Slash Commands
All slash commands support Tab autocompletion with inline descriptions. Partial commands are auto-resolved (e.g./mod → /model).
Core
| Command | Description |
|---|---|
/help | Show full command reference with shortcuts and examples. |
/exit | Exit BioCortex CLI. |
/clear | Clear the screen (asks for confirmation). |
/new | Start a new session while keeping history. |
Agent & Model
| Command | Description |
|---|---|
/model | Switch reasoning model (numbered interactive picker). |
/strategy | Switch strategy: react / dag_parallel / mcts / hypothesis / auto. Tab-completes choices. |
/plan | Toggle plan-review mode on/off (pause before execution to inspect and approve the plan). |
/verbose | Set verbose display mode (show all tool calls and intermediate output). |
/compact | Set compact display mode (summaries only). |
/keys | Configure API keys at runtime without restarting. |
Data & Files
| Command | Description |
|---|---|
/data [path] | Set or display the data directory for this session. |
/qc [file] | Quick QC summary of a data file (.h5ad, .csv, .vcf, etc.). |
/browse [dir] | Browse output or data directory as a file tree. |
/formats | Show all supported input/output file formats. |
Analysis Shortcuts
| Command | Description |
|---|---|
/case-study list | List curated analysis templates (PBMC, mouse brain, spatial, etc.). |
/case-study <name> | Preview and launch a curated template. |
/agents <n> | Run the current task across N agent instances in parallel and compare results. |
Session Management
| Command | Description |
|---|---|
/sessions | List saved sessions with IDs, dates, and task counts. |
/resume [id] | Resume a saved session by ID, short prefix, or index (last). |
/compress | Compress session context and display token savings. |
/diff [id1] [id2] | Compare two session reports side-by-side. |
Information & Diagnostics
| Command | Description |
|---|---|
/tools [domain] | List available tools by domain. |
/skills | List available workflow skill templates. |
/config | Show active runtime configuration. |
/status | Detailed agent and system status. |
/doctor | Run readiness diagnostics (API keys, databases, tool health). |
/usage | Show session token count and cost summary. |
/tokens | Detailed per-task token breakdown. |
/kg [search term] | Knowledge graph stats; optionally search entities. |
MCP Servers
| Command | Description |
|---|---|
/mcp | List all configured MCP servers and their status. |
/mcp start <name> | Start a configured MCP server. |
/mcp stop <name> | Stop a running MCP server. |
/mcp restart <name> | Restart an MCP server. |
/mcp add <name> <cmd> | Register a new STDIO MCP server (persisted to .biocortex/mcp.json). |
/mcp add <name> --uri <url> | Register an HTTP MCP server. |
/mcp remove <name> | Remove an MCP server configuration. |
/mcp tools | List all tools currently exposed by running MCP servers. |
--autostart (start on every launch), --desc 'description', --env KEY=VALUE
Export
| Command | Description |
|---|---|
/export [path] | Export last report to a Markdown file. |
/notebook [path] | Export session as a Jupyter notebook (.ipynb). |
/cite | Generate a Methods-section citation for tools used in this session. |
Shell Passthrough
Prefix any shell command with! to run it directly:
Multi-line Input
Press Ctrl+J or Alt+Enter to add a new line in the prompt (useful for multi-step instructions). Press Enter on an empty line to submit.Keyboard Shortcuts
| Key | Action |
|---|---|
Tab | Fill ghost-text suggestion / complete slash command. |
Ctrl+J / Alt+Enter | Insert newline (multi-line mode). |
Ctrl+O | Toggle verbose/compact display mode. |
Ctrl+C | Cancel current input line. |
Escape | Cancel a running analysis task. |
↑ / ↓ | Navigate command history. |
Analysis Display
When a task is running, the CLI shows a live panel:/plan or config):
Clarification Dialog
When you provide a data file without specifying key parameters (e.g. species for scRNA-seq), the CLI asks clarifying questions before starting analysis:biocortex run
Execute a single task described in natural language. Output is written to a report file in the given output directory. Usage:| Option | Short | Description |
|---|---|---|
--model | -m | Reasoning model name (overrides config). |
--coder | — | Code-generation model name. |
--strategy | -s | Strategy: react, dag_parallel, mcts, or hypothesis. |
--biomni | — | Path to Biomni installation (tool bridge). |
--data | -d | Data directory path. |
--output | -o | Output directory (default: ./output). |
--docker | — | Use Docker sandbox for execution. |
--timeout | — | Execution timeout in seconds (default: 600). |
biocortex interactive
Start a simplified interactive session. For the full-featured REPL (slash commands, session management, MCP, etc.), usebiocortex cli instead.
Usage:
| Command | Description |
|---|---|
<task> | Run a biological analysis task. |
status | Show agent status (models, tools, memory, KG). |
clear | Clear working memory. |
kg <query> | Search the knowledge graph. |
help | List available commands. |
exit / quit / q | Quit the session. |
biocortex status
Print system status without loading heavy models. Shows configured reasoning/coder/fast models, strategy, Docker setting, timeouts, data/output paths, knowledge-graph stats, and multimodal/embedding status. Usage:biocortex web
Launch the web interface (Gradio or Next.js). Usage:| Option | Short | Description |
|---|---|---|
--port | -p | Server port (default: 7860). |
--frontend | — | gradio (legacy) or next (React). |
--model | -m | Reasoning model override. |
--biomni | — | Path to Biomni. |
--use-auth | — | Enable login authentication. |
--auth-users | — | Comma-separated username:password pairs. |
--allow-register | — | Allow new user registration. |
--admin-user | — | Username treated as admin (default: admin). |
--share | — | Create a public Gradio link (Gradio frontend only). |
biocortex import-biomni
Import tool descriptions and functions from a local Biomni installation into BioCortex’s registry. Usage:biocortex kg
Knowledge-graph operations. Use a subcommand afterkg.
kg search
kg stats
kg context
kg add
kg load-go
kg mermaid
biocortex encode
Encode biological data (protein/DNA/RNA sequence, structure, or image) into vector embeddings. Usage:protein, dna, rna, structure, image
Examples:
biocortex bench
Run evaluation using a BixBench-style manifest. Usage:| Option | Short | Description |
|---|---|---|
--manifest | -m | Path to manifest JSON (default: ./bixbench/manifest.json). |
--output | -o | Output directory (default: ./bench_results). |
--parallel | -p | Parallel question threads (default: 4). |
--timeout | — | Per-question timeout in seconds (default: 300). |
--max-steps | — | Max agent steps per question (default: 15). |
--model | — | Override reasoning model. |
--strategy | -s | auto, react, dag_parallel, mcts, or hypothesis. |
--question | — | Run a single question by ID. |
--max-questions | -n | Limit to first N questions. |
--dry-run | — | Preview questions without running. |
--no-eval | — | Skip LLM-as-judge scoring. |
--only-failed | — | Re-run only previously failed questions. |
MCP — Model Context Protocol
BioCortex supports the Model Context Protocol (MCP) for extending the agent’s tool set with external services. All MCP servers are aggregated behind a single HTTP gateway (http://127.0.0.1:3100/mcp) and their tools are automatically injected into the agent’s context.
How It Works
Configuration File
Create.biocortex/mcp.json in your project directory (or ~/.biocortex/mcp.json for global config):
~/.biocortex/mcp.json → .biocortex/mcp.json → package defaults.
Server Types
| Type | Description |
|---|---|
stdio | Local subprocess managed by BioCortex. BioCortex starts, monitors, and stops the process. Per-server logs written to ~/.biocortex/logs/mcp/. |
http | Remote HTTP MCP endpoint already running. BioCortex connects and proxies tools. |
Pre-configured Servers
| Name | Command | Tools Available |
|---|---|---|
biomcp | uv run --with biomcp-python biomcp run | Gene search, variant lookup, clinical trial search via NCBI/ClinVar |
context7 | npx -y @upstash/context7-mcp | Library documentation, API reference lookup |
filesystem | npx -y @modelcontextprotocol/server-filesystem . | Local file read/write |
pubmed | uvx mcp-server-pubmed | PubMed literature search |
auto_start or use /mcp start <name> to enable.
Installing MCP dependency
Configuration and Environment
CLI commands use the same configuration as the rest of BioCortex. Set environment variables in the project root.env or in ~/.biocortex/.env:
Next Steps
- Getting Started — Install and run your first analysis.
- Strategy Routing — How tasks are classified and routed.
- Web UI — Use the browser instead of the CLI.
- Configuration — Full list of options and environment variables.
- MCP Integration — Detailed MCP server setup and authoring.