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.

Listen

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, codex or gemini in 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

  1. Install the CLI and sign in to it once in a terminal, the way its own instructions say.
  2. Select a project. The CLI runs in the project's folder, and it won't start without one.
  3. In the Agent tab, open the model menu in the header.
  4. 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.
  5. 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_KEY or OPENAI_API_KEY is 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.

  1. Open the agent's gear menu and find the CLI agent section.
  2. 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.
  3. 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.

  1. Open Settings → AI Agent and find Claude Code sessions.
  2. Press Install hook. It adds a hook to ~/.claude/settings.json that tells TRMNLY which conversation each pane holds. It merges with what's already in the file.
  3. 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
  4. Run claude in 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.

  1. Open Settings → AI Agent and find External MCP clients.
  2. Turn on Expose TRMNLY's tools to other apps.
  3. In the list of apps found on your Mac, press Connect beside Claude Code. The row then reads Connected · all projects.
  4. Start a new claude session 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 claude came back after a restart.

Go further