New issues and PRs from new contributors are auto-closed by default. Maintainers review auto-closed issues daily. See CONTRIBUTING.md.
Diffex is a minimal terminal coding harness. Adapt Diffex to your workflows, not the other way around, without having to fork and modify Diffex internals. Extend it with TypeScript Extensions, Skills, Prompt Templates, and Themes. Put your extensions, skills, prompt templates, and themes in Diffex Packages and share them with others via npm or git.
Diffex ships with powerful defaults, including session-scoped sub-agents and an interactive Plan mode. You can adapt or replace workflows with extensions and third-party Diffex packages.
Diffex runs in four modes: interactive, print or JSON, RPC for process integration, and an SDK for embedding in your own apps.
- Quick Start
- Providers & Models
- Interactive Mode
- Sessions
- Settings
- Context Files
- Customization
- Programmatic Usage
- Philosophy
- CLI Reference
npm install -g --ignore-scripts @diffexai/diffex--ignore-scripts disables dependency lifecycle scripts during install. Diffex does not require install scripts for normal npm installs.
Authenticate with an API key:
export ANTHROPIC_API_KEY=sk-ant-...
diffexOr use your existing subscription:
diffex
/login # Then select providerThen just talk to Diffex. By default, Diffex gives the model five tools: read, write, edit, bash, and update_plan. The model uses these to fulfill your requests and keep multi-step work visible. Add capabilities via skills, prompt templates, extensions, or Diffex packages.
Platform notes: Windows | Termux (Android) | tmux | Terminal setup | Shell aliases
For each built-in provider, Diffex maintains a list of tool-capable models. Configured provider catalogs refresh automatically; run diffex update --models to force an immediate refresh. Authenticate via subscription (/login) or API key, then select any model from that provider via /model (or Ctrl+L).
Subscriptions:
- Anthropic Claude Pro/Max
- OpenAI ChatGPT Plus/Pro (Codex)
- GitHub Copilot
API keys:
- Anthropic
- Ant Ling
- OpenAI
- Azure OpenAI
- DeepSeek
- NVIDIA NIM
- Google Gemini
- Google Vertex
- Amazon Bedrock
- Mistral
- Groq
- Cerebras
- Cloudflare AI Gateway
- Cloudflare Workers AI
- xAI
- OpenRouter
- Vercel AI Gateway
- ZAI Coding Plan (Global)
- ZAI Coding Plan (China)
- OpenCode Zen
- OpenCode Go
- Hugging Face
- Fireworks
- Together AI
- Baseten
- Kimi For Coding
- MiniMax
- Xiaomi MiMo
- Xiaomi MiMo Token Plan (China)
- Xiaomi MiMo Token Plan (Amsterdam)
- Xiaomi MiMo Token Plan (Singapore)
Diffex also supports the llama.cpp router server. Configure it with /login llama.cpp, manage downloads and loaded models with /llama, then select a loaded model with /model. See docs/llama-cpp.md for setup and usage.
See docs/providers.md for other provider setup instructions.
Custom providers & models: Add providers via ~/.diffex/agent/models.json if they speak a supported API (OpenAI, Anthropic, Google). For custom APIs or OAuth, use extensions. See docs/models.md and docs/custom-provider.md.
The interface from top to bottom:
- Startup header - Shows shortcuts (
/hotkeysfor all), loaded AGENTS.md files, prompt templates, skills, and extensions - Messages - Your messages, assistant responses, tool calls and results, notifications, errors, and extension UI
- Editor - Where you type; border color indicates thinking level
- Footer - Working directory, session name, total token/cache usage (
↑input,↓output,Rcache read,Wcache write,CHlatest cache hit rate), cost, context usage, current model. Totals include assistant responses, usage reported by tools, and summary generation.
The editor can be temporarily replaced by other UI, like built-in /settings or custom UI from extensions (e.g., a Q&A tool that lets the user answer model questions in a structured format). Extensions can also replace the editor, add widgets above/below it, a status line, custom footer, or overlays.
| Feature | How |
|---|---|
| File reference | Type @ to fuzzy-search project files |
| Path completion | Tab to complete paths |
| Multi-line | Shift+Enter (or Ctrl+Enter on Windows Terminal) |
| External editor | Ctrl+G opens externalEditor, $VISUAL, $EDITOR, Notepad on Windows, or nano elsewhere |
| Clipboard | Ctrl+V to paste an image or text (Alt+V on Windows), or drag images onto terminal |
| Bash commands | !command runs and sends output to LLM, !!command runs without sending |
Standard editing keybindings for delete word, undo, etc. See docs/keybindings.md.
Type / in the editor to trigger commands. Extensions can register custom commands, skills are referenced through /skills, and prompt templates expand via /templatename.
| Command | Description |
|---|---|
/login, /logout |
Manage provider credentials |
/llama |
Download, load, and unload llama.cpp router models |
/model |
Select a model, then its thinking level |
/scoped-models |
Enable/disable models for Ctrl+P cycling |
/settings |
Theme, installed skills, message delivery, transport |
/plan [request] |
Enter Plan mode, optionally submitting a planning request |
/skills |
Search and reference one or more skills in the editor |
/evolve |
Inspect and control harness evolution and generated skills |
/version |
Select the active harness revision |
/resume |
Pick from previous sessions |
/new |
Start a new session |
/name <name> |
Set session display name |
/session |
Show session info (file, ID, messages, tokens, cost) |
/subagents |
Show all sub-agents in the current session |
/tree |
Jump to any point in the session and continue from there |
/trust |
Save project trust decision for future sessions (restart required) |
/fork |
Create a new session from a previous user message |
/clone |
Duplicate the current active branch into a new session |
/compact [prompt] |
Manually compact context, optional custom instructions |
/copy |
Copy last assistant message to clipboard |
/export [file] |
Export session to HTML or JSONL file |
/import <file> |
Import and resume a session from a JSONL file |
/share |
Upload as a secret GitHub Gist and return its direct URL |
/reload |
Reload keybindings, extensions, skills, prompts, themes, and context files |
/hotkeys |
Show all keyboard shortcuts |
/changelog |
Display version history |
/quit |
Quit Diffex |
/subagents runs immediately, including while the parent agent is working or compacting.
It displays the current in-memory roster without adding the command or roster to model context.
See /hotkeys for the full list. Customize via ~/.diffex/agent/keybindings.json. See docs/keybindings.md.
Commonly used:
| Key | Action |
|---|---|
| Ctrl+C | Clear editor |
| Ctrl+C twice | Quit |
| Escape | Cancel/abort |
| Escape twice | Open /tree |
| Ctrl+L | Open model selector |
| Ctrl+P / Shift+Ctrl+P | Cycle scoped models forward/backward |
| Shift+Tab | Toggle Default and Plan collaboration modes |
| Ctrl+O | Collapse/expand tool output |
| Ctrl+T | Collapse/expand thinking blocks |
| Ctrl+X | Copy the last assistant message |
Use /model or Ctrl+L to select a model, then choose its thinking level when multiple levels are supported. Selecting the current model also opens the thinking selector. Escape keeps the selected model and its current supported level. Thinking-level cycling has no default shortcut; bind app.thinking.cycle in keybindings.json to enable one.
Plan mode is an interactive, evidence-first workflow for producing a decision-complete implementation plan without carrying it out. Press Shift+Tab or run /plan; /plan <request> enters Plan mode and submits the request. The footer identifies the active mode.
The model first inspects available evidence and distinguishes discoverable facts from preferences only you can decide. Its model-visible tools are restricted to the invocation's allowed, trusted pre-extension implementations of read, grep, find, and ls, plus request_user_input when permitted. Mutating, extension, custom, and execution-time tools such as bash, edit, write, and update_plan are unavailable. This is a model-tool boundary, not a filesystem sandbox: direct ! commands and extension side effects remain outside it.
For material choices, request_user_input can show one to three questions. Each has two or three choices plus Other for a free-form answer. Answer every question to submit, or cancel to return a non-fatal cancellation result while staying in Plan mode. If the tool is filtered out or a choice list is unsuitable, the model asks an ordinary conversational question instead.
The official response must contain exactly one non-empty plan between standalone <proposed_plan> and </proposed_plan> lines outside fenced code. On a valid completed response, Diffex removes only those tag lines and stores and displays the remaining Markdown normally. After the run settles, choose Implement the plan to switch to Default and submit Implement the plan. in the same session, or Stay in Plan mode to dismiss the offer. Queued input suppresses the offer; an unrelated modal defers it. If implementation submission fails, Diffex remains in Default and restores the exact submission text to the editor.
Plan mode is an interactive branch preference. Resume, fork, and /tree navigation restore the newest matching mode entry on the selected branch when it is valid; new sessions, malformed newest matching entries, and non-interactive print, JSON, RPC, and SDK use remain in Default. Historical plans never replay the implementation offer. update_plan is a separate execution-time progress checklist and does not enter or leave Plan mode.
Mode changes use normal lazy session saving: toggling in a new disk-backed session remains in memory until its first assistant message is saved or the session is explicitly persisted. Starting a new run discards an older implementation offer, including when an extension starts the run. Temporary busy activity defers the offer and blocks acceptance until idle, including awaited direct-Bash extension hooks. See Plan mode details.
Submit messages while the agent is working:
- Enter queues a steering message, delivered after the current assistant turn finishes executing its tool calls
- Alt+Enter queues a follow-up message, delivered only after the agent finishes all work
- Escape aborts and restores queued messages to editor
- Alt+Up retrieves queued messages back to editor
On Windows Terminal, Alt+Enter is fullscreen by default. Remap it in docs/terminal-setup.md so Diffex can receive the follow-up shortcut.
Configure delivery in settings: steeringMode and followUpMode can be "one-at-a-time" (default, waits for response) or "all" (delivers all queued at once). transport selects provider transport preference ("sse", "websocket", or "auto") for providers that support multiple transports.
/evolve shows evidence eligibility, jobs, memory proposals, generated skill candidates, readable supporting and contradicting evidence, draft diffs, validation, evaluation, target revisions, activation, and rollback. /version selects a complete immutable harness revision. Memory and evolved skills change together at the next prompt boundary; in-flight and admitted queued requests remain pinned. The footer shows the active harness and background activity. See Harness Evolution.
Sessions are stored as JSONL files with a tree structure. Each entry has an id and parentId, enabling in-place branching without creating new files. See docs/session-format.md for file format.
The built-in update_plan tool stores an ordered plan with stable step IDs and optional success_criteria in the session.
It can replace the plan, update one step by ID, or clear the plan.
Every model request ends with hidden current-task context containing the latest plan, including after resume and compaction.
The plan records progress; it does not execute, gate, verify, or prove work.
The selected collaboration mode is stored separately as an interactive branch preference. Resume, fork, and /tree navigation restore it from the selected branch; non-interactive modes always use Default and do not overwrite that preference.
Sessions auto-save to ~/.diffex/agent/sessions/ organized by working directory.
diffex -c # Continue most recent session
diffex -r # Browse and select from past sessions
diffex --no-session # Ephemeral mode (don't save)
diffex --name "my task" # Set session display name at startup
diffex --session <path|id> # Use specific session file or ID
diffex --fork <path|id> # Fork specific session file or ID into a new sessionUse /session in interactive mode to see the current session ID before reusing it with --session <id> or --fork <id>.
/tree - Navigate the session tree in-place. Select any previous point, continue from there, and switch between branches. All history preserved in a single file.
- Search by typing, fold/unfold and jump between branches with Ctrl+←/Ctrl+→ or Alt+←/Alt+→, page with ←/→
- Filter modes (Ctrl+O): default → no-tools → user-only → labeled-only → all
- Press Ctrl+X to copy the selected message
- Press Shift+L to label entries as bookmarks and Shift+T to toggle label timestamps
/fork - Create a new session file from a previous user message on the active branch. Opens a selector, copies the active path up to that point, and places the selected prompt in the editor for modification.
/clone - Duplicate the current active branch into a new session file at the current position. The new session keeps the full active-path history and opens with an empty editor.
--fork <path|id> - Fork an existing session file or partial session UUID directly from the CLI. This copies the full source session into a new session file in the current project.
Long sessions can exhaust context windows. Compaction summarizes older messages while keeping recent ones.
Manual: /compact or /compact <custom instructions>
Automatic: Enabled by default. Triggers on context overflow (recovers and retries) or when approaching the limit (proactive). Configure via /settings or settings.json.
Compaction is lossy. The full history remains in the JSONL file; use /tree to revisit. Customize compaction behavior via extensions. See docs/compaction.md for internals.
Use /settings to modify common options, or edit JSON files directly:
| Location | Scope |
|---|---|
~/.diffex/agent/settings.json |
Global (all projects) |
.diffex/settings.json |
Project (overrides global) |
See docs/settings.md for all options.
On interactive startup, Diffex asks before trusting a project folder that contains project-local settings, resources, or project .agents/skills and has no saved decision for the folder or a parent folder in ~/.diffex/agent/trust.json. Trusting a project allows Diffex to load .diffex/settings.json and .diffex resources, install missing project packages, and execute project extensions.
Before the trust decision, Diffex loads only context files, user/global extensions, and CLI -e extensions so they can handle the project_trust event. Project-local extensions, project package-managed extensions, and project settings are loaded only after the project is trusted. This split also applies when switching to a session from a different cwd whose trust has not been resolved in the current process.
Non-interactive modes (-p, --mode json, and --mode rpc) do not show a trust prompt. Without an applicable saved trust decision, they use defaultProjectTrust from global settings: ask (default) and never ignore those project resources, while always trusts them. Pass --approve/-a or --no-approve/-na to override project trust for one run.
If no extension or saved decision applies, defaultProjectTrust controls the fallback behavior. Set it to "ask", "always", or "never" in ~/.diffex/agent/settings.json, or change it with /settings.
diffex config and package commands use the same project trust flow, except diffex update never prompts. Pass --approve to trust project-local settings for one command or --no-approve to ignore them.
Use /trust in interactive mode to save a project trust decision for future sessions, including trust for the immediate parent folder. It writes ~/.diffex/agent/trust.json only; the current session is not reloaded, so restart Diffex for changes to take effect.
Diffex does not send install or update telemetry reports.
The former enableInstallTelemetry setting and DIFFEX_TELEMETRY variable are no longer used.
Optional attribution headers for OpenRouter, Cloudflare, and direct NVIDIA NIM requests have a separate enableProviderAttribution setting, which defaults to false.
Enable it through Provider attribution in /settings, or override it with DIFFEX_PROVIDER_ATTRIBUTION=1 (0 disables it).
This control does not affect update checks, OpenCode session headers, or explicitly configured request headers.
Startup update checks query https://api.diffex.ai/api/latest-version.
Disable automatic checks with DIFFEX_SKIP_VERSION_CHECK=1.
Use --offline or DIFFEX_OFFLINE=1 to disable startup network operations, including update checks and package update checks.
Diffex loads AGENTS.md (or CLAUDE.md) at startup from:
~/.diffex/agent/AGENTS.md(global)- Parent directories (walking up from cwd)
- Current directory
If a directory contains AGENTS.override.md, Diffex loads it instead of AGENTS.md or CLAUDE.md from that directory. Context files from other directories are still concatenated.
Use for project instructions (AGENTS.md/CLAUDE.md), conventions, common commands. All matching files are concatenated.
Disable context file loading with --no-context-files (or -nc).
Replace the default system prompt with .diffex/SYSTEM.md (project) or ~/.diffex/agent/SYSTEM.md (global). Append without replacing via APPEND_SYSTEM.md.
Reusable prompts as Markdown files. Type /name to expand.
<!-- ~/.diffex/agent/prompts/review.md -->
Review this code for bugs, security issues, and performance problems.
Focus on: {{focus}}Place in ~/.diffex/agent/prompts/, .diffex/prompts/, or a Diffex package to share with others. See docs/prompt-templates.md.
On-demand capability packages following the Agent Skills standard. Use /skills to choose installed workspace, installed global, or evolved skills and insert one or more versioned references into a task, or let the agent load skills automatically.
<!-- ~/.diffex/agent/skills/my-skill/SKILL.md -->
# My Skill
Use this skill when the user asks about X.
## Steps
1. Do this
2. Then thatPlace in ~/.diffex/agent/skills/, ~/.agents/skills/, .diffex/skills/, or .agents/skills/ (from cwd up through parent directories) or a Diffex package to share with others. See docs/skills.md.
TypeScript modules that extend Diffex with custom tools, commands, keyboard shortcuts, event handlers, and UI components.
export default function (diffex: ExtensionAPI) {
diffex.registerTool({ name: "deploy", ... });
diffex.registerCommand("stats", { ... });
diffex.on("tool_call", async (event, ctx) => { ... });
}The default export can also be async. Diffex waits for async extension factories before startup continues, which is useful for one-time initialization such as fetching remote model lists before calling diffex.registerProvider().
What's possible:
- Custom tools (or replace built-in tools entirely)
- Alternative sub-agent and planning workflows
- Custom compaction and summarization
- Permission gates and path protection
- Custom editors and UI components
- Status lines, headers, footers
- Git checkpointing and auto-commit
- SSH and sandbox execution
- MCP server integration
- Make Diffex look like Claude Code
- Games while waiting (yes, Doom runs)
- ...anything you can dream up
Place in ~/.diffex/agent/extensions/, .diffex/extensions/, or a Diffex package to share with others. See docs/extensions.md and examples/extensions/.
Built-in: dark, light. Themes hot-reload: modify the active theme file and Diffex immediately applies changes.
Place in ~/.diffex/agent/themes/, .diffex/themes/, or a Diffex package to share with others. See docs/themes.md.
Bundle and share extensions, skills, prompts, and themes via npm or git. Find packages on npmjs.com or the upstream Discord.
Security: Diffex packages run with full system access. Extensions execute arbitrary code, and skills can instruct the model to perform any action including running executables. Review source code before installing third-party packages.
diffex install npm:@foo/diffex-tools
diffex install npm:@foo/diffex-tools@1.2.3 # pinned version
diffex install git:github.com/user/repo
diffex install git:github.com/user/repo@v1 # tag or commit
diffex install git:git@github.com:user/repo
diffex install git:git@github.com:user/repo@v1 # tag or commit
diffex install https://github.com/user/repo
diffex install https://github.com/user/repo@v1 # tag or commit
diffex install ssh://git@github.com/user/repo
diffex install ssh://git@github.com/user/repo@v1 # tag or commit
diffex remove npm:@foo/diffex-tools
diffex uninstall npm:@foo/diffex-tools # alias for remove
diffex list
diffex update # update Diffex only
diffex update --all # update Diffex and packages
diffex update --extensions # update packages only
diffex update --models # refresh model catalogs only
diffex update --self # update Diffex only
diffex update --self --force # reinstall Diffex even if current
diffex update npm:@foo/diffex-tools # update one package
diffex config # enable/disable extensions, skills, prompts, themesInteractive package installs ask whether to use global storage (~/.diffex/agent/git/, ~/.diffex/agent/npm/) or workspace storage (.diffex/git/, .diffex/npm/) and show the trust implications. Non-interactive installs default to global; use -l to select workspace scope explicitly. Git @ref values are pinned tags or commits; pinned packages are skipped by diffex update --extensions and diffex update --all, so use diffex install git:host/user/repo@new-ref to move an existing package to a new ref. Git packages install dependencies with npm install --omit=dev by default, so runtime deps must be listed under dependencies; when npmCommand is configured, git packages use plain install for compatibility with wrappers. If you use a Node version manager and want package installs to reuse a stable npm context, set npmCommand in settings.json, for example ["mise", "exec", "node@20", "--", "npm"].
Create a package by adding the compatibility diffex key to package.json:
{
"name": "my-diffex-package",
"keywords": ["diffex-package"],
"diffex": {
"extensions": ["./extensions"],
"skills": ["./skills"],
"prompts": ["./prompts"],
"themes": ["./themes"]
}
}Without a diffex manifest, Diffex auto-discovers from conventional directories (extensions/, skills/, prompts/, themes/).
See docs/packages.md.
import { createAgentSession, ModelRuntime, SessionManager } from "@diffexai/diffex";
const modelRuntime = await ModelRuntime.create();
const { session } = await createAgentSession({
sessionManager: SessionManager.inMemory(),
modelRuntime,
});
await session.prompt("What files are in the current directory?");For advanced multi-session runtime replacement, use createAgentSessionRuntime() and AgentSessionRuntime.
See docs/sdk.md and examples/sdk/.
For non-Node.js integrations, use RPC mode over stdin/stdout:
diffex --mode rpcRPC mode uses strict LF-delimited JSONL framing. Clients must split records on \n only. Do not use generic line readers like Node readline, which also split on Unicode separators inside JSON payloads.
See docs/rpc.md for the protocol.
Diffex is aggressively extensible so it doesn't have to dictate your workflow. Features that other tools bake in can be built with extensions, skills, or installed from third-party Diffex packages. This keeps the core minimal while letting you shape Diffex to fit how you work.
No MCP. Build CLI tools with READMEs (see Skills), or build an extension that adds MCP support. Why?
Session-scoped sub-agents. The model can delegate work to child agents, and /subagents shows their current status and original tasks without sending that roster to the model.
No permission popups. Run in a container, or build your own confirmation flow with extensions inline with your environment and security requirements.
Focused Plan mode. Interactive Plan mode provides read-only planning, structured clarification, and an explicit same-session implementation handoff. The separate update_plan tool remains a lightweight execution progress checklist. Build an extension or install a package for different approval or planning workflows.
No persistent built-in to-dos. Use a TODO.md file, or build your own with extensions.
No background bash. Use tmux. Full observability, direct interaction.
diffex [options] [@files...] [messages...]diffex install <source> [-l] # Install package, -l for project-local
diffex remove <source> [-l] # Remove package
diffex uninstall <source> [-l] # Alias for remove
diffex update [source|self|diffex] # Update Diffex only, or one package source
diffex update --all # Update Diffex and packages
diffex update --extensions # Update packages only
diffex update --models # Refresh model catalogs only
diffex update --self # Update Diffex only
diffex update --self --force # Reinstall Diffex even if current
diffex update --extension <src> # Update one package
diffex list # List installed packages
diffex config # Enable/disable package resourcesdiffex config and project package commands accept --approve/--no-approve to trust or ignore project-local settings for one command. diffex update never prompts for project trust.
| Flag | Description |
|---|---|
| (default) | Interactive mode |
-p, --print |
Print response and exit |
--mode json |
Output all events as JSON lines (see docs/json.md) |
--mode rpc |
RPC mode for process integration (see docs/rpc.md) |
--export <in> [out] |
Export session to HTML |
In print mode, Diffex also reads piped stdin and merges it into the initial prompt:
cat README.md | diffex -p "Summarize this text"| Option | Description |
|---|---|
--provider <name> |
Provider (anthropic, openai, google, etc.) |
--model <pattern> |
Model pattern or ID (supports provider/id and optional :<thinking>) |
--api-key <key> |
API key (overrides env vars) |
--thinking <level> |
off, minimal, low, medium, high, xhigh, max |
--models <patterns> |
Comma-separated patterns for Ctrl+P cycling |
--list-models [search] |
List available models |
| Option | Description |
|---|---|
-c, --continue |
Continue most recent session |
-r, --resume |
Browse and select session |
--session <path|id> |
Use specific session file or partial UUID |
--fork <path|id> |
Fork specific session file or partial UUID into a new session |
--session-dir <dir> |
Custom session storage directory |
--no-session |
Ephemeral mode (don't save) |
--name <name>, -n <name> |
Set session display name at startup |
| Option | Description |
|---|---|
--tools <list>, -t <list> |
Allowlist specific tool names across built-in, extension, and custom tools |
--exclude-tools <list>, -xt <list> |
Disable specific tool names across built-in, extension, and custom tools |
--no-builtin-tools, -nbt |
Disable built-in tools by default but keep extension/custom tools enabled |
--no-tools, -nt |
Disable all tools by default |
Available built-in tools: read, bash, edit, write, update_plan, grep, find, ls
| Option | Description |
|---|---|
-e, --extension <source> |
Load extension from path, npm, or git (repeatable) |
--no-extensions |
Disable extension discovery |
--skill <path> |
Load skill (repeatable) |
--no-skills |
Disable skill discovery |
--prompt-template <path> |
Load prompt template (repeatable) |
--no-prompt-templates |
Disable prompt template discovery |
--theme <path> |
Load theme (repeatable) |
--no-themes |
Disable theme discovery |
--no-context-files, -nc |
Disable AGENTS.md and CLAUDE.md context file discovery |
Combine --no-* with explicit flags to load exactly what you need, ignoring settings.json (e.g., --no-extensions -e ./my-ext.ts).
| Option | Description |
|---|---|
--system-prompt <text> |
Replace default prompt (context files and skills still appended) |
--append-system-prompt <text> |
Append to system prompt |
--tui-mode <mode> |
TUI mode: regular (default) or experimental fullscreen |
--verbose |
Force verbose startup |
-a, --approve |
Trust project-local files for this run |
-na, --no-approve |
Ignore project-local files for this run |
-h, --help |
Show help |
-v, --version |
Show version |
Prefix files with @ to include in the message:
diffex @prompt.md "Answer this"
diffex -p @screenshot.png "What's in this image?"
diffex @code.ts @test.ts "Review these files"# Interactive with initial prompt
diffex "List all .ts files in src/"
# Non-interactive
diffex -p "Summarize this codebase"
# Non-interactive with piped stdin
cat README.md | diffex -p "Summarize this text"
# Named one-shot session
diffex --name "release audit" -p "Audit this repository"
# Different model
diffex --provider openai --model gpt-4o "Help me refactor"
# Model with provider prefix (no --provider needed)
diffex --model openai/gpt-4o "Help me refactor"
# Model with thinking level shorthand
diffex --model sonnet:high "Solve this complex problem"
# Limit model cycling
diffex --models "claude-*,gpt-4o"
# Read-only mode
diffex --tools read,grep,find,ls -p "Review the code"
# Disable one extension or built-in tool while keeping the rest available
diffex --exclude-tools ask_question
# High thinking level
diffex --thinking high "Solve this complex problem"| Variable | Description |
|---|---|
AI_AGENT |
Set to the compatibility identifier diffex by the CLI and RPC entry points so generic tooling can attribute child processes to Diffex |
DIFFEX_CODING_AGENT |
Set to true by the CLI and RPC entry points so child processes can detect that they run inside Diffex |
DIFFEX_CODING_AGENT_DIR |
Override config directory (default: ~/.diffex/agent) |
DIFFEX_CODING_AGENT_SESSION_DIR |
Override session storage directory (overridden by --session-dir) |
DIFFEX_PACKAGE_DIR |
Override package directory (useful for Nix/Guix where store paths tokenize poorly) |
DIFFEX_OFFLINE |
Disable startup network operations, including update checks and package update checks |
DIFFEX_SKIP_VERSION_CHECK |
Skip the Diffex release check at startup |
DIFFEX_PROVIDER_ATTRIBUTION |
Override optional provider attribution headers: 1/true/yes enables them; 0/false/no disables them. Does not control update checks |
DIFFEX_CACHE_RETENTION |
Set to long for extended prompt cache (Anthropic: 1h, OpenAI: 24h) |
VISUAL, EDITOR |
Fallback external editor for Ctrl+G when externalEditor is unset; defaults to Notepad on Windows and nano elsewhere |
Commands run by the LLM-callable bash tool also receive current session metadata:
| Variable | Description |
|---|---|
DIFFEX_SESSION_ID |
Current session ID |
DIFFEX_SESSION_FILE |
Absolute session JSONL path; unset for ephemeral sessions |
DIFFEX_PROVIDER |
Currently selected model provider |
DIFFEX_MODEL |
Currently selected model ID |
DIFFEX_REASONING_LEVEL |
Current effective reasoning level |
These values are resolved when each command starts. See Environment Variables for semantics, examples, and custom-tool opt-out.
See CONTRIBUTING.md for guidelines and docs/development.md for setup, forking, and debugging.
Apache-2.0 for Diffex, copyright 2026 Luntraa, Inc. Pi-derived portions retain their MIT terms and upstream copyright notice. See LICENSE, NOTICE, and THIRD-PARTY-NOTICES.txt in the distribution.
The CLI package includes the Diffex AI toolkit, agent framework, terminal UI, and other required internal runtime modules.
Install only @diffexai/diffex; separate Diffex module packages are not required or published.
The upstream project's domain was graciously donated by
![]()
exe.dev


