Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions packages/coding-agent/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -147,14 +147,15 @@ The interface from top to bottom:

- **Startup header** - Shows shortcuts (`/hotkeys` for 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
- **Editor** - Where you type; border color indicates plan mode or shell mode
- **Footer** - The built-in footer keeps the current model, thinking level, and context usage visible.

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](#extensions) can also replace the editor, add widgets above/below it, a status line, custom footer, or overlays.

### Plan Mode

Run `diffex --plan` to start an interactive session in plan mode, or use `/plan [on|off]` while Diffex is idle.
Run `diffex --plan` to start an interactive session in plan mode, submit `/plan [instructions]`, or press Shift+Tab and type instructions in the editor.
Shift+Tab toggles plan mode while the editor border and prompt pointer turn green to show that planning is active.
Plan mode exposes `submit_plan` and the canonical subset of `read`, `grep`, `find`, and `ls` permitted by caller restrictions.
The agent can inspect the repository, but it cannot run commands, edit files, or call extension and SDK tools.
`submit_plan` is intrinsic to plan mode and remains available even when caller tool filters disable every inspection tool.
Expand Down Expand Up @@ -186,10 +187,10 @@ Type `/` in the editor to trigger commands. [Extensions](#extensions) can regist
|---------|-------------|
| `/login`, `/logout` | Manage provider credentials |
| [`/llama`](docs/llama-cpp.md) | Download, load, and unload llama.cpp router models |
| `/model` | Switch models |
| `/model` | Switch models, then select thinking effort |
| `/scoped-models` | Enable/disable models for Ctrl+P cycling |
| `/plan [on\|off]` | Toggle plan mode, set it explicitly, or reopen a pending plan |
| `/settings` | Thinking level, theme, message delivery, transport |
| `/plan [instructions]` | Activate plan mode and optionally submit planning instructions, or reopen/retry a pending plan |
| `/settings` | Theme, message delivery, transport |
| `/resume` | Pick from previous sessions |
| `/new` | Start a new session |
| `/name <name>` | Set session display name |
Expand Down Expand Up @@ -226,7 +227,7 @@ See `/hotkeys` for the full list. Customize via `~/.diffex/agent/keybindings.jso
| Escape twice | Open `/tree` |
| Ctrl+L | Open model selector |
| Ctrl+P / Shift+Ctrl+P | Cycle scoped models forward/backward |
| Shift+Tab | Cycle thinking level |
| Shift+Tab | Toggle plan mode |
| Ctrl+O | Collapse/expand tool output |
| Ctrl+T | Collapse/expand thinking blocks |
| Ctrl+X | Copy the last assistant message |
Expand Down
4 changes: 2 additions & 2 deletions packages/coding-agent/docs/extensions.md
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ user sends another prompt ◄─────────────────
├─► thinking_level_select (if model change changes/clamps thinking level)
└─► model_select

thinking level changes (settings, keybinding, diffex.setThinkingLevel())
thinking level changes (/model effort selection, diffex.setThinkingLevel())
└─► thinking_level_select

exit (Ctrl+C, Ctrl+D, SIGHUP, SIGTERM)
Expand Down Expand Up @@ -744,7 +744,7 @@ diffex.on("thinking_level_select", async (event, ctx) => {
});
```

Use this to update extension UI when `diffex.setThinkingLevel()`, model changes, or built-in thinking-level controls change the active thinking level.
Use this to update extension UI when `diffex.setThinkingLevel()`, model changes, or `/model` effort selection changes the active thinking level.

### Tool Events

Expand Down
6 changes: 3 additions & 3 deletions packages/coding-agent/docs/keybindings.md
Original file line number Diff line number Diff line change
Expand Up @@ -136,14 +136,14 @@ This routing remains configurable through the ordinary action bindings. For exam
| `app.session.delete` | `ctrl+d` | Delete session |
| `app.session.deleteNoninvasive` | `ctrl+backspace` | Delete session when query is empty |

### Models and Thinking
### Models, Planning, and Thinking

| Keybinding id | Default | Description |
|--------|---------|-------------|
| `app.model.select` | `ctrl+l` | Open model selector |
| `app.model.select` | `ctrl+l` | Open model selector, followed by thinking effort selection |
| `app.model.cycleForward` | `ctrl+p` | Cycle to next model |
| `app.model.cycleBackward` | `shift+ctrl+p` | Cycle to previous model |
| `app.thinking.cycle` | `shift+tab` | Cycle thinking level |
| `app.plan.toggle` | `shift+tab` | Toggle plan mode |
| `app.thinking.toggle` | `ctrl+t` | Collapse or expand thinking blocks |

### Display and Message Queue
Expand Down
2 changes: 1 addition & 1 deletion packages/coding-agent/docs/quickstart.md
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ The command output is sent to the model. Use `!!command` to run a command withou

### Switch models

Use `/model` or Ctrl+L to choose a model. Use Shift+Tab to cycle thinking level. Use Ctrl+P / Shift+Ctrl+P to cycle through scoped models.
Use `/model` or Ctrl+L to choose a model, then select its thinking effort. Use Ctrl+P / Shift+Ctrl+P to cycle through scoped models. Shift+Tab toggles plan mode.

### Continue later

Expand Down
2 changes: 2 additions & 0 deletions packages/coding-agent/docs/settings.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ Use `/trust` in interactive mode to save a project trust decision for future ses

### Model & Thinking

In interactive mode, `/model` selects both the model and its thinking effort.

| Setting | Type | Default | Description |
|---------|------|---------|-------------|
| `defaultProvider` | string | - | Default provider (e.g., `"anthropic"`, `"openai"`) |
Expand Down
19 changes: 11 additions & 8 deletions packages/coding-agent/docs/themes.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ vim ~/.diffex/agent/themes/my-theme.json
"name": "my-theme",
"vars": {
"primary": "#00aaff",
"secondary": 242
"secondary": 242,
"green": "#00ff00"
},
"colors": {
"accent": "primary",
Expand Down Expand Up @@ -114,7 +115,8 @@ vim ~/.diffex/agent/themes/my-theme.json
"thinkingHigh": "#ff00ff",
"thinkingXhigh": "#ff0000",
"thinkingMax": "#ff0088",
"bashMode": "#ffaa00"
"bashMode": "#ffaa00",
"planMode": "green"
}
}
```
Expand Down Expand Up @@ -145,15 +147,15 @@ vim ~/.diffex/agent/themes/my-theme.json
- `name` is required, must be unique, and must not contain `/`.
- `vars` is optional. Define reusable colors here, then reference them in `colors`.
- `colors` must define all 51 required tokens.
`thinkingMax`, `scrollbarThumb`, `startupIntroText`, `startupIntroAccent`, `selectionAccent`, and `autocompleteSelected` are optional compatibility tokens with fallbacks.
`planMode`, `thinkingMax`, `scrollbarThumb`, `startupIntroText`, `startupIntroAccent`, `selectionAccent`, and `autocompleteSelected` are optional compatibility tokens with fallbacks.

The `$schema` field enables editor auto-completion and validation.

## Color Tokens

Every theme must define all 51 required color tokens.
`thinkingMax`, `scrollbarThumb`, `startupIntroText`, `startupIntroAccent`, `selectionAccent`, and `autocompleteSelected` are optional for compatibility with existing themes.
When omitted, they use `thinkingXhigh`, `selectedBg`, `text`, `mdLink`, `autocompleteSelected` or `startupIntroAccent`, and `selectionAccent`, respectively.
`planMode`, `thinkingMax`, `scrollbarThumb`, `startupIntroText`, `startupIntroAccent`, `selectionAccent`, and `autocompleteSelected` are optional for compatibility with existing themes.
When omitted, `planMode` uses `toolDiffAdded`; the remaining tokens use `thinkingXhigh`, `selectedBg`, `text`, `mdLink`, `autocompleteSelected` or `startupIntroAccent`, and `selectionAccent`, respectively.

### Core UI (11 colors)

Expand Down Expand Up @@ -234,9 +236,9 @@ When omitted, they use `thinkingXhigh`, `selectedBg`, `text`, `mdLink`, `autocom
| `syntaxOperator` | Operators |
| `syntaxPunctuation` | Punctuation |

### Thinking Level Borders (6 required, 1 optional)
### Thinking Level Colors (6 required, 1 optional)

Editor border colors indicating thinking level (visual hierarchy from subtle to prominent):
Legacy thinking-level colors exposed through the theme API for extensions. The built-in editor no longer changes its border by thinking effort:

| Token | Purpose |
|-------|---------|
Expand All @@ -248,11 +250,12 @@ Editor border colors indicating thinking level (visual hierarchy from subtle to
| `thinkingXhigh` | Extra high thinking |
| `thinkingMax` | Maximum thinking; optional, falls back to `thinkingXhigh` |

### Bash Mode (1 color)
### Mode Borders (1 required, 1 optional)

| Token | Purpose |
|-------|---------|
| `bashMode` | Editor border in bash mode (`!` prefix) |
| `planMode` | Editor border and prompt pointer in plan mode; optional, falls back to `toolDiffAdded` |

### HTML Export (optional)

Expand Down
2 changes: 1 addition & 1 deletion packages/coding-agent/docs/tui.md
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,7 @@ renderResult(result, options, theme, context) {
| Markdown | `mdHeading`, `mdLink`, `mdLinkUrl`, `mdCode`, `mdCodeBlock`, `mdCodeBlockBorder`, `mdQuote`, `mdQuoteBorder`, `mdHr`, `mdListBullet` |
| Syntax | `syntaxComment`, `syntaxKeyword`, `syntaxFunction`, `syntaxVariable`, `syntaxString`, `syntaxNumber`, `syntaxType`, `syntaxOperator`, `syntaxPunctuation` |
| Thinking | `thinkingOff`, `thinkingMinimal`, `thinkingLow`, `thinkingMedium`, `thinkingHigh`, `thinkingXhigh`, `thinkingMax` |
| Modes | `bashMode` |
| Modes | `bashMode`, `planMode` |

**Background colors** (`theme.bg(color, text)`):

Expand Down
13 changes: 7 additions & 6 deletions packages/coding-agent/docs/usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ The interface has four main areas:

- **Startup header** - shortcuts, loaded context files, prompt templates, skills, and extensions
- **Messages** - user messages, assistant responses, tool calls, tool results, notifications, errors, and extension UI
- **Editor** - where you type; border color indicates the current thinking level
- **Editor** - where you type; border color indicates plan mode or shell mode
- **Footer** - the built-in footer keeps the current model, thinking level, and context usage visible.

The editor can be replaced temporarily by built-in UI such as `/settings` or by custom extension UI.
Expand Down Expand Up @@ -38,10 +38,10 @@ Type `/` in the editor to open command completion. Extensions can register custo
|---------|-------------|
| `/login`, `/logout` | Manage OAuth or API-key credentials |
| [`/llama`](llama-cpp.md) | Download, load, and unload llama.cpp router models |
| `/model` | Switch models |
| `/model` | Switch models, then select thinking effort |
| `/scoped-models` | Enable/disable models for Ctrl+P cycling |
| `/plan [on\|off]` | Toggle plan mode, set it explicitly, or reopen a pending plan |
| `/settings` | Thinking level, theme, message delivery, transport |
| `/plan [instructions]` | Activate plan mode and optionally submit planning instructions, or reopen/retry a pending plan |
| `/settings` | Theme, message delivery, transport |
| `/resume` | Pick from previous sessions |
| `/new` | Start a new session |
| `/name <name>` | Set session display name |
Expand Down Expand Up @@ -88,8 +88,9 @@ JSON and RPC modes emit the same notices as structured session events.

## Plan Mode

Start an interactive planning session with `diffex --plan`, toggle it with `/plan`, or set it explicitly with `/plan on` or `/plan off`.
Plan mode can be changed only while the session is idle.
Start an interactive planning session with `diffex --plan`, submit `/plan [instructions]`, or press Shift+Tab and type instructions in the editor.
A bare `/plan` activates planning without submitting a prompt. Shift+Tab toggles plan mode while the session is idle.
The editor border and prompt pointer change to the theme's plan-mode green while plan mode is active.

Plan mode exposes `submit_plan` and canonical `read`, `grep`, `find`, and `ls` repository inspection tools when caller restrictions permit them.
Extension tools, SDK custom tools, shell execution, and file mutation tools are unavailable until the plan is accepted or discarded.
Expand Down
2 changes: 1 addition & 1 deletion packages/coding-agent/src/core/extensions/runner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ const RESERVED_KEYBINDINGS_FOR_EXTENSION_CONFLICTS = [
"app.clear",
"app.exit",
"app.suspend",
"app.thinking.cycle",
"app.plan.toggle",
"app.model.cycleForward",
"app.model.cycleBackward",
"app.model.select",
Expand Down
7 changes: 3 additions & 4 deletions packages/coding-agent/src/core/keybindings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export interface AppKeybindings {
"app.clear": true;
"app.exit": true;
"app.suspend": true;
"app.thinking.cycle": true;
"app.plan.toggle": true;
"app.model.cycleForward": true;
"app.model.cycleBackward": true;
"app.model.select": true;
Expand Down Expand Up @@ -70,9 +70,9 @@ export const KEYBINDINGS = {
defaultKeys: process.platform === "win32" ? [] : "ctrl+z",
description: "Suspend to background",
},
"app.thinking.cycle": {
"app.plan.toggle": {
defaultKeys: "shift+tab",
description: "Cycle thinking level",
description: "Toggle plan mode",
},
"app.model.cycleForward": {
defaultKeys: "ctrl+p",
Expand Down Expand Up @@ -242,7 +242,6 @@ const KEYBINDING_NAME_MIGRATIONS = {
clear: "app.clear",
exit: "app.exit",
suspend: "app.suspend",
cycleThinkingLevel: "app.thinking.cycle",
cycleModelForward: "app.model.cycleForward",
cycleModelBackward: "app.model.cycleBackward",
selectModel: "app.model.select",
Expand Down
2 changes: 1 addition & 1 deletion packages/coding-agent/src/core/slash-commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export interface BuiltinSlashCommand {
export const BUILTIN_SLASH_COMMANDS: ReadonlyArray<BuiltinSlashCommand> = [
{ name: "settings", description: "Open settings menu" },
{ name: "model", description: "Select model (opens selector UI)", argumentHint: "<provider/model>" },
{ name: "plan", description: "Toggle plan mode", argumentHint: "[on|off]" },
{ name: "plan", description: "Start a planning prompt", argumentHint: "[instructions]" },
{ name: "scoped-models", description: "Enable/disable models for Ctrl+P cycling" },
{ name: "export", description: "Export session (HTML default, or specify path: .html/.jsonl)" },
{ name: "import", description: "Import and resume a session from a JSONL file" },
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import type { ThinkingLevel } from "@earendil-works/diffex-agent-core";
import type { Transport } from "@earendil-works/diffex-ai";
import {
type Component,
Expand Down Expand Up @@ -35,16 +34,6 @@ const SETTINGS_SUBMENU_SELECT_LIST_LAYOUT: SelectListLayoutOptions = {
maxPrimaryColumnWidth: 32,
};

const THINKING_DESCRIPTIONS: Record<ThinkingLevel, string> = {
off: "No reasoning",
minimal: "Very brief reasoning (~1k tokens)",
low: "Light reasoning (~2k tokens)",
medium: "Moderate reasoning (~8k tokens)",
high: "Deep reasoning (~16k tokens)",
xhigh: "Extra-high reasoning (~32k tokens)",
max: "Maximum reasoning",
};

const DEFAULT_PROJECT_TRUST_LABELS: Record<DefaultProjectTrust, string> = {
ask: "Ask",
always: "Always trust",
Expand All @@ -66,8 +55,6 @@ export interface SettingsConfig {
followUpMode: "all" | "one-at-a-time";
transport: Transport;
httpIdleTimeoutMs: number;
thinkingLevel: ThinkingLevel;
availableThinkingLevels: ThinkingLevel[];
currentTheme: string;
terminalTheme: TerminalTheme;
availableThemes: string[];
Expand Down Expand Up @@ -102,7 +89,6 @@ export interface SettingsCallbacks {
onFollowUpModeChange: (mode: "all" | "one-at-a-time") => void;
onTransportChange: (transport: Transport) => void;
onHttpIdleTimeoutMsChange: (timeoutMs: number) => void;
onThinkingLevelChange: (level: ThinkingLevel) => void;
onThemeChange: (theme: string) => void;
onThemePreview?: (theme: string) => void;
onHideThinkingBlockChange: (hidden: boolean) => void;
Expand Down Expand Up @@ -607,28 +593,6 @@ export class SettingsSelectorComponent extends Container {
() => done(),
),
},
{
id: "thinking",
label: "Thinking level",
description: "Reasoning depth for thinking-capable models",
currentValue: config.thinkingLevel,
submenu: (currentValue, done) =>
new SelectSubmenu(
"Thinking Level",
"Select reasoning depth for thinking-capable models",
config.availableThinkingLevels.map((level) => ({
value: level,
label: level,
description: THINKING_DESCRIPTIONS[level],
})),
currentValue,
(value) => {
callbacks.onThinkingLevelChange(value as ThinkingLevel);
done(value);
},
() => done(),
),
},
{
id: "tui-mode",
label: "TUI mode",
Expand Down
Loading