Codex Beginner's 5 Must-Know Slash Commands: 90% Don't Realize /plan Cuts Rework Time in Half

Published on: 2026-08-02

Codex Beginner's 5 Must-Know Slash Commands: 90% Don't Realize /plan Cuts Rework Time in Half

📖 Glossary

AI Box (also known as Agent Computer / Agent PC), is a dedicated local hardware device that runs AI Agents. Pre-installed with an AI agent management system, plug-and-play, running 24/7. Users can remotely command AI to work via Discord, Slack, Telegram, WhatsApp, and more.

Abstract: Most people install Codex and use it as a chatbox -- paste code, ask it to fix something, end up with wrong files modified, missing dependencies, and three rounds of rework. The root cause isn't Codex -- it's that you haven't learned these 5 slash commands. Once you internalize them, Codex transforms from an AI that occasionally writes code for you into a reliable development teammate that pushes tasks forward without going off the rails.


Pressing / after launching Codex is the first thing you should do -- not typing a prompt. That little slash key reveals the command set that separates Codex from every other AI tool. The same task, with commands versus without, can differ by an order of magnitude in both output quality and rework frequency.

Most beginners install Codex, start typing requirements, pasting code, and waiting for results. The outcome is predictable: modifications drift off course, a critical config line gets deleted from an untouched file, or you end up doing three rounds of revisions without hitting the target. It's not that Codex is bad -- it's that you didn't tell it how to work.

Here are the five commands that 90% of Codex users still haven't built into muscle memory. Once you do, you'll cut rework time by at least half on every task.

1. /plan -- The Single Biggest Rework Killer

If you only learn one command, make it this one.

/plan makes Codex produce a complete execution plan before it touches a single line of code. Not a vague "let me think about it" -- a structured document listing each step, which files each step touches, expected risks, and decision points that need your confirmation.

Example: you ask Codex to "refactor the entire auth module from JWT to OAuth2.0." Without /plan, Codex dives straight in, modifies eight files, misses the middleware adapter, forgets to update tests, and botches the refresh token logic. You have to open every file, manually spot what's missing, and re-prompt. Two hours later, what should have taken 30 minutes.

Same task with /plan: Codex outputs a seven-step plan -- 1) audit existing auth flow and dependencies, 2) create OAuth2.0 config module, 3) refactor login routes, 4) replace middleware, 5) migrate tests, 6) update documentation, 7) clean up old JWT code. Each step lists affected files and risk flags. You scan it, spot that step 4's middleware change might impact the payment module, flag it, confirm the plan, and let it execute. Zero rework.

The core insight: Codex, as smart as it is, is your tool, not your boss. You steer, it executes. /plan standardizes the steering.

2. /init -- Don't Make Codex Guess in the Dark

Every time you enter a new project, /init is step one.

This command scans the entire project directory and auto-detects: the tech stack (Node.js, Python, Go), the package manager (npm, yarn, pnpm), coding conventions (ESLint configs), and directory structure conventions (where frontend lives, where backend lives, where tests go).

Skip /init and Codex sees a package.json but doesn't know you use pnpm, so it generates install commands with npm. It sees a src directory but doesn't know your component naming convention is PascalCase, so new components come out in kebab-case. These tiny mismatches pile up until you're manually adjusting every AI-generated output -- defeating the purpose.

After /init, Codex can auto-generate an AGENTS.md file -- essentially an AI-readable manual for your project. Tech stack, naming rules, forbidden directories, common startup and test commands, all documented in one place. Codex reads it at the start of every session before doing anything. Write it once, benefit forever.

3. @filename -- 10x Context Precision

This might be the most underrated command.

Typing "help me optimize the auth logic" into the chat box forces Codex to blind-search your entire project for keywords like "auth", "jwt", "login" -- often pulling in unrelated code that muddies the water.

Using @ changes everything: @src/utils/auth.js @src/middleware/guard.js refactor token validation from in-memory storage to Redis caching. Codex precisely reads those two files plus their import dependency chains, aligns all context in one shot. No need to explain "you know, that function that validates tokens" -- the AI has already seen it.

Pro tip: you can @ entire directories too. @src/api/ refactor all error handling in this directory to use the new ErrorHandler middleware -- Codex traverses every file, understands each endpoint's structure, and transforms them one by one.

4. /approvals -- Prevent Codex From Accidentally Nuking Your Project

The default mode is workspace-write: Codex can freely modify files within your project directory, while files outside require manual confirmation. For beginners, I strongly recommend switching to read-only first.

/approvals read-only means every single modification requires your explicit approval before execution. You see every diff -- what changed, what was deleted, what was added -- at a glance. The downside is it gets tedious when every line requires confirmation.

The sweet spot is /approvals workspace-write (default) combined with /plan: first run /plan to review all changes, confirm the direction is correct, then let it execute without per-line interruption. Add your most critical files (.env, database configs) to .codexignore to exclude them entirely.

Veterans can use full-access mode, but only if the project has solid Git history -- one git reset --hard and you're back to safety.

5. /compact -- Don't Let a Bloated Context Make Codex Dumber

Codex doesn't get smarter the longer you chat -- its context window bloats, token usage climbs, and the model starts "forgetting" things you said earlier.

/compact compresses the current conversation history into a lean summary, freeing up token space. It's like resetting Codex's brain while preserving the critical memory.

When to use: after finishing one feature and before starting the next; when Codex starts giving nonsensical answers or forgetting requirements you stated earlier; after about 30 minutes of continuous work without a topic change.

Pro tip: before running /compact, manually summarize the current state in one line -- "completed user auth API development, all tests passing, code committed." This line gets preserved in the summary, and Codex won't repeat previous work in the next task.


Further Reading

KaiheAIBOX #AIAgent #Codex #DeveloperProductivity


Kaihe AIBOX · Your Private AI Assistant Working 7×24 · AI Frontier

Recommended Products

A1 Home Entry A1 Pro Enhanced A2 Professional A2 Pro Advanced X1 Enterprise G1 Flagship
© KAIHE AI - Agent Computer Specialist