← XeFM English | 日本語 · crftwr/xefm on GitHub · craftware

AI agent sessions

English | 日本語

XeFM can open an AI coding agent beside the file manager, on a screen of its own: for Claude Code, Codex, Copilot and Antigravity, a conversation XeFM draws; for the other agents, or where you prefer it, a terminal session running the agent’s own screen. The agent knows it runs inside XeFM: it can see what you are looking at, search anywhere XeFM can go, show you what it found, and ask you before it changes a file.

Action Menu
agent Tools → AI Agent Here
ask_agent Tools → Ask AI Agent…

agent is > in every keymap preset, the prompt an agent’s command line shows; ask_agent ships unbound. To change them, see Key Bindings and Keymap Presets.

What you need

An agent’s command-line program, installed and signed in to on its own: XeFM starts it the way it starts an editor, and never sees its account, credentials or model. Claude Code (claude), Codex (codex), GitHub Copilot CLI (copilot) and Antigravity CLI (agy, which replaced Gemini CLI) are set up out of the box; other agents are on the wiki (see Other agents).

Opening a session

Both are off in the menu while no agent in AGENTS is installed (its program is not on PATH); from a key or the command palette, the log pane says which program is missing. They come on once it is installed, with no restart.

To turn agent sessions off, set AGENTS = [] in config.py: the two items leave the menu, no agent can start, and agent and ask_agent only say in the log pane that agents are off. To free the > key as well, unbind agent (see Key Bindings).

With more than one agent set up, XeFM asks which one. The Screens… switcher also has a row for each, New Claude Code in ~/…, beside New shell in ~/…. The session gets a screen of its own, like any terminal session: Screens… switches between it and the file manager, and it keeps running while you are away. In the screen switcher, its row shows what the agent calls itself in its title (✳ Claude Code).

For an agent in a terminal session, terminal mode hands it XeFM’s terminal and waits, as it does for the subshell. While the agent runs there, XeFM answers what it asks about the panes and its searches, but cannot show it anything or ask you anything: those need the desktop app, or a conversation drawn by XeFM, which keeps XeFM’s screen in terminal mode too.

Conversations drawn by XeFM

For Claude Code, Codex, Copilot and Antigravity (the agents with a preset), XeFM draws the conversation itself, on a screen of its own, rather than running the agent’s own screen in a terminal. It looks and works the same in the desktop app and in terminal mode, whichever the agent. In terminal mode the agent does not take the terminal over, so it can show you things and XeFM can ask you things there too. An agent without a preset runs in a terminal session. Where the agents differ is listed below.

To have the agent’s own screen in a terminal session instead, set 'terminal': True on its entry:

AGENTS = [
    {'name': 'Claude Code', 'command': ['claude'], 'preset': 'claude-code', 'terminal': True},
]

The screen has the agent, its folder and what it is doing at the top, the conversation in the middle, and the field you type in at the bottom. What you wrote is on a panel; each step the agent takes follows with a dot - green for a tool that worked, red for one that failed or that you declined. A tool shows as one line - the file, the pattern - with the first lines of what it returned, and … more lines under it shows the rest (show less folds it again). A shell command and its output read as in a terminal, in one block. An edit shows its first changed lines, and open diff opens the whole file, before the edit and now, in the diff viewer. A thin line joins the dots of steps that follow one another.

Key What it does
Enter Send the message. One sent while the agent works waits for its turn to end
Alt+Enter, Shift+Enter, Ctrl+J A new line in the message (a terminal cannot send Shift+Enter; the other two work everywhere)
Esc Stop the agent while it works; otherwise go back to the file manager, the session kept
↑ / ↓ On the first (last) line of the field: an earlier (later) message you sent
PageUp / PageDown Scroll the conversation (so does the wheel)
Shift+Tab The next permission mode: ask before tools, accept edits (file changes go ahead without asking), plan (the agent looks and plans but changes nothing). The header shows the mode

Commands and files. Type / at the start of the message to list the session’s commands - XeFM’s own and the agent’s (/compact, your skills) - narrowing as you type. Type @ to mention a file: the files selected in the panes come first (or the ones under the cursors), then the folder’s files and folders, then files further down by name. ↑ / ↓ pick, Tab takes the one picked, and Enter takes it too - and runs a command that needs no argument. Esc closes the list. /clear starts a new conversation, /model switches the model, and /exit ends the session. Claude Code’s own commands run as in Claude Code: /usage shows what you have used, /effort and /fast set the effort and fast mode. Their replies keep their lines as written, what Claude Code tells you beside them (fast mode turned off, for one) appears in the conversation, and the effort and fast mode you set stay set if the agent is started again.

This is Preview. XeFM runs your own program, signed in as you set it up, in the mode it has for being run by another one: Claude Code’s streaming JSON (claude -p), Codex’s app server (codex app-server), and the Agent Client Protocol for Copilot (copilot --acp) and Antigravity (agy acp). What that use counts against is between you and your plan with the agent’s maker, as it is in a terminal.

Differences between the agents

  Claude Code Codex Copilot Antigravity
Modes of Shift+Tab ask, accept edits, plan ask, accept edits, plan ask, plan ask, accept edits, plan
A plan to approve in a dialog yes yes no: it writes the plan and stops no: it writes the plan and stops
Always Allow yes where Codex offers it yes no
Questions with options yes yes no: it asks in its reply yes
A subagent’s steps under it yes yes no: they show as steps of their own no
/model pick from a list pick from a list Copilot’s own command pick from a list
/effort Claude Code’s own command yes no yes
Other / commands Claude Code’s, your skills /compact, your skills Copilot’s Antigravity’s, your skills

What the agent gets

What the agent may not do

Rules can be ignored, so two things hold whatever the agent decides:

To lift both, for an agent you trust with your files, set 'restrict': False on its entry.

Setting up agents: AGENTS

AGENTS = [
    {'name': 'Claude Code', 'command': ['claude'], 'preset': 'claude-code'},
    {'name': 'Codex', 'command': ['codex'], 'preset': 'codex'},
    {'name': 'Copilot', 'command': ['copilot'], 'preset': 'copilot'},
    {'name': 'Antigravity', 'command': ['agy'], 'preset': 'antigravity'},
]

# Your own rules, added after XeFM's in every session.
AGENT_RULES = "Never touch ~/Documents/Taxes. Answer in Japanese."
Key What it is
name Its name in the menu and the screen switcher
command The program and its arguments, a list (or a string, split like a shell would)
preset 'claude-code': XeFM adds the arguments that hand Claude Code the skill, the rules and its permission settings. 'codex': XeFM hands Codex the rules, which tell it where the skill is. 'copilot': XeFM hands GitHub Copilot CLI the skill, the rules and the commands it may not run. 'antigravity': XeFM hands Antigravity CLI the skill, the rules and its permission settings
restrict True (the default): the limits above. False: none
settings Claude Code and Antigravity: the settings to pass instead of XeFM’s, in that agent’s own form, e.g. {'permissions': {'deny': ['Bash(rm:*)']}} for Claude Code, {'permissions': {'deny': ['command(rm)']}} for Antigravity. In a conversation XeFM draws, only the denied commands of Antigravity’s are used
env Extra environment variables
prompt_args Without a preset: what ask_agent adds for the request (default ['{prompt}'])
terminal True: the agent’s own screen in a terminal session. False: the conversation drawn by XeFM. The default is False with a preset and True without one, which XeFM cannot draw

To pass the agent more options, add them to command: ['claude', '--model', 'opus']. In a conversation XeFM draws, Codex’s --model, --sandbox, --ask-for-approval, --profile and -c, and Antigravity’s --model, --mode and --effort are passed on; their options for their own screen have no effect there.

The codex preset sets Codex’s developer_instructions for the session, so one in your ~/.codex/config.toml is not used there; put what you want every session to know in AGENT_RULES (or Codex’s own AGENTS.md).

In a terminal session, Copilot and Antigravity ask whether you trust a folder the first time they start there; answer it in the session.

A config.py that has its own AGENTS keeps it: add the Codex, Copilot or Antigravity line to it to get that agent.

Saved requests: AGENT_PROMPTS

Requests you make often, listed in Ask AI Agent…: pick one, or type your own. The agent gets the directory and the selection with it, so “these files” means what you selected.

AGENT_PROMPTS = {
    'Summarize': 'Summarize these files, a few lines each.',
    'Sort photos by month': 'Move these photos into folders named YYYY-MM by the date taken.',
    'Review': {'prompt': 'Review the uncommitted changes here.', 'agent': 'Claude Code'},
}

A request is a string, or a table with prompt and agent (the name of an AGENTS entry, to send it there without asking). The config template has more examples, commented out. Extension packages can add their own ([contributes.agent_prompts]). AGENT_PROMPTS is Preview.

Other agents

An agent without a preset is given what it needs through placeholders in command (and prompt_args), which XeFM fills in when it starts the session:

Placeholder Becomes
{skills_dir} A skills folder holding the xefm skill (xefm/SKILL.md)
{skill_dir} The xefm skill’s own folder
{plugin_dir} The same skill as a Claude Code plugin folder
{rules} / {rules_file} The rules, as text / in a Markdown file
{settings_file} A JSON file of the settings given (empty without them)
{prompt} The request, for ask_agent

Each agent takes these in its own way. The wiki page AI agents collects entries for other agents, written and kept up by the people who use them. XeFM’s own limits on xefmctl apply to every agent.

See also