OpenAI’s answer to the terminal-agent wave is the Muse CLI: a lightweight, open-source coding agent that runs locally on your machine. The Muse CLI reads your repository, edits files, and runs shell commands inside a sandbox you control, and it signs in with the ChatGPT plan many developers already pay for. In this getting-started guide you will install Codex on Linux, run your first session, and learn the approval and instruction features that make it safe to use on real projects.
What Is the Muse CLI? – OpenAI Codex CLI
Codex CLI is a terminal-based agent, not a code-completion plugin. You describe a task in plain English — “find why the build fails on Node 20”, “add pagination to this API”, “write tests for the parser” — and Codex plans the work, explores the codebase, proposes edits as diffs, and can run commands to verify its own changes. It is written in Rust, released under the Apache 2.0 license, and developed in the open, so you can read exactly what you are giving shell access to.
Codex exists in three forms: the CLI that runs against your local files, a cloud version inside ChatGPT that runs tasks in OpenAI-managed containers, and an IDE extension. This article covers the CLI, which is the most natural fit for Linux users and sysadmins. Access comes with paid ChatGPT plans (from Plus upwards) or through an OpenAI API key with pay-as-you-go billing.
Install the Muse CLI on Linux – OpenAI Codex CLI
The simplest installation uses npm. You need Node.js 18 or later:
npm install -g @openai/codex
codex --version
On macOS, Homebrew works too, and an official install script is available for macOS and Linux if you prefer to avoid npm:
brew install --cask codex
Then move into a repository and launch the agent:
cd ~/projects/my-app
codex
On first launch, choose Sign in with ChatGPT and complete the browser flow, or run codex login. If you prefer an API key, export OPENAI_API_KEY instead. If anything seems off later, codex doctor checks your installation, login, and configuration.

Your First Session: Approvals and the Sandbox
The feature that defines the Muse CLI is control. Codex works inside a sandbox — on Linux it uses OS-level sandboxing (Landlock) — and an approval policy decides what it may do without asking. By default it can work freely inside your project folder but will ask before touching anything outside it or using the network. Inside a session, the /permissions command shows and changes the active policy, and /status shows the current setup.
A sensible first session looks like this:
- Ask a read-only question: “Explain the structure of this repository.”
- Give it a small task with a clear test: “Add a unit test for the date utility and run the test suite.”
- Review the diff it proposes, file by file, before accepting.
- Commit the result with git, so the session has a clean undo point.
As you build trust you can loosen approvals for well-defined batch work, but keep the default for anything touching production configuration.
Teach Codex Your Project with AGENTS.md
Codex reads an AGENTS.md file in your repository: build and test commands, coding conventions, constraints it must respect. Run /init inside a session and Codex will draft one by inspecting your project. A short, accurate AGENTS.md dramatically improves results because the agent stops guessing how your project works.
# AGENTS.md
## Build and test
- Install: npm ci
- Test: npm test
- Lint: npm run lint
## Conventions
- TypeScript strict mode, no implicit any
- Never edit generated files in dist/
This is the same instruction-file pattern used across modern agents; our article on prompt engineering for sysadmins covers how to write instructions an agent will actually follow.
Useful Codex CLI Features Beyond Basic Editing
- Local models with –oss. Codex can run open-source models through a local Ollama server, handy for offline work or sensitive code.
- Model switching. Change models at launch with
codex --model <name>or with/modelinside a session, trading speed for depth per task. - MCP support. Connect Model Context Protocol servers to give Codex access to databases, APIs, and other tools beyond the filesystem.
- Non-interactive runs. Codex can be scripted for CI-style jobs, such as generating changelogs or triaging failing tests, once you are comfortable with its approval model.
- Fast updates. The project ships frequently;
codex updatekeeps the CLI current.
Tips for Getting the Most from Codex
Give tasks a verifiable finish line: “make the tests pass” beats “improve the code”. Keep sessions scoped to one goal, because a focused agent produces diffs you can actually review. Store secrets in environment variables, never in files Codex might read, and exclude sensitive paths in your instructions. Finally, remember that Codex’s diffs are proposals — your review is the quality gate, exactly as with a human contributor.
Conclusion
The Muse CLI is a fast, open-source terminal agent with a thoughtful safety model: sandboxed execution, explicit approvals, and project instructions in AGENTS.md. If you already subscribe to ChatGPT, installing it takes one npm command and five minutes. Explore the source and documentation in the official openai/codex repository on GitHub to go deeper.