All pages
Lesson 2.5 · Work with the agent · 10 min
Claude Code, Codex and Gemini
Run the coding CLIs inside TRMNLY and keep their sessions.
If you already pay for Claude Code, Codex or Gemini CLI, TRMNLY can use them. In this lesson you run one as the agent's model, set how much it may do on its own, keep its sessions across restarts, and give it TRMNLY's tools.
Time: 10 minutes · Works on: macOS app
Two ways to use a coding CLI
- As the agent's model. You pick the CLI in the agent's model menu and chat in the Agent tab as usual. TRMNLY runs the CLI behind the scenes and shows its replies in the transcript.
- In a terminal pane. You run
claude,codexorgeminiin a tab like any other program. TRMNLY remembers which conversation each pane was in and can give the CLI its tools.
Both start from the same place: the CLI installed and signed in on your Mac.
Use a CLI as the agent's model
- Install the CLI and sign in to it once in a terminal, the way its own instructions say.
- Select a project. The CLI runs in the project's folder, and it won't start without one.
- In the Agent tab, open the model menu in the header.
- Under Your CLI subscription (no API credits), pick Claude Code (CLI), Codex (CLI) or Gemini CLI. A CLI that isn't installed is labeled not installed.
- Send a task. The turn is billed to the plan you already pay for, and TRMNLY never holds a key for it.
Each conversation resumes its own CLI session, so follow-up turns keep the context the first turn built.
Tip: If an
ANTHROPIC_API_KEYorOPENAI_API_KEYis in your environment, the CLIs would normally bill to it. TRMNLY removes those variables for the CLI so your subscription is used. To let the key win instead, turn off Bill to my CLI login, not API keys in the gear menu.
Decide how much it may do
The CLI runs its own tools. Its edits and shell commands don't pass through TRMNLY's approval cards, so you set its limits separately.
- Open the agent's gear menu and find the CLI agent section.
- Choose a permission level:
- Read-only: it can read and answer, but every write is refused.
- Accept edits (default): it can edit files. Most of these CLIs refuse to write at all with anything less.
- Full access (no sandbox): no limits from TRMNLY.
- Putting the agent in Observe or dry run forces Read-only, whatever you pick here.
With Claude Code on Accept edits, a command that still needs a yes, such
as a brew install, opens TRMNLY's approval sheet instead of being refused.
Codex and Gemini have no such hook, so they refuse what they can't approve
on their own.
Keep Claude Code sessions across restarts
A pane running Claude Code can come back in the same conversation after you quit or after a crash.
- Open Settings → AI Agent and find Claude Code sessions.
- Press Install hook. It adds a hook to
~/.claude/settings.jsonthat tells TRMNLY which conversation each pane holds. It merges with what's already in the file. - Pick what a restored pane does:
- Don't remember sessions
- Type the resume command: types it at the prompt without pressing Return.
- Type it — but run it after a crash: the default. Types it after a normal quit, runs it after a crash.
- Always run it
- Run
claudein a pane, have a short conversation, then quit and reopen TRMNLY. The pane comes back with its output and the resume command.
Give the CLI TRMNLY's tools
Claude Code and other MCP clients can call the same tools the TRMNLY agent uses: reading panes, running commands in your terminal, driving the browser, reaching saved hosts.
- Open Settings → AI Agent and find External MCP clients.
- Turn on Expose TRMNLY's tools to other apps.
- In the list of apps found on your Mac, press Connect beside Claude Code. The row then reads Connected · all projects.
- Start a new
claudesession and ask it to read your other terminal pane.
TRMNLY's safety rules still apply to tool calls that come in this way. A tool that needs approval is refused, or waits for your approval, rather than running unasked. The MCP server lesson covers this in depth.
Check yourself
- A chat on Claude Code (CLI) answered a question about your project.
- You know which CLI agent permission level you're on.
- A pane running
claudecame back after a restart.
Go further
- Agent — CLI agents as models, in detail
- Claude Code sessions — session restore and what's kept
- MCP server — exposing TRMNLY's tools to other agents
- Platforms — what runs where