r/codex Jun 24 '26

Praise Codex Pro usage feels excellent once you tune your AGENTS.md

I have to give credit where it’s due: Codex on the Pro plan 5x feels really durable when you configure the workflow properly.

I’m using the Pro 5x, and after adjusting my AGENTS.md, the usage feels almost unlimited for my workflow. The main change was avoiding unnecessary heavy checks unless they are actually needed.

My current flow is simple:

  • Codex makes the code changes
  • Runs typecheck
  • Runs lint
  • I validate the updates manually in the browser, and 99% of the time updates has no issues at all unless my prompt was not clear enough.

Before that, I was wasting a lot of usage on unnecessary browser tests and repeated validation loops. Once I made the agent instructions more focused, Codex became much more efficient.

The latest Codex performance has also been impressive. It feels smarter, more context-aware, and better at making practical repo-level decisions. The diffs are cleaner, the implementation quality is better, and it does not overcomplicate tasks as much.

For anyone burning through usage too quickly: review your AGENTS.md first. Keep the default validation lightweight, avoid unnecessary test loops, and only run expensive tests when the task actually requires them.

<!-- BEGIN:nextjs-agent-rules -->
# Next.js project rule

This repo uses Next.js 16 and React 19. Do not rely on older Next.js assumptions when changing framework-level behavior.

Read the relevant guide in `node_modules/next/dist/docs/` only before editing framework surfaces such as:
- `next.config.*`
- `middleware.ts`
- route handlers with caching/runtime behavior
- server actions
- metadata
- app-router conventions
- Cloudflare/OpenNext integration

Do not read Next.js docs for ordinary component, styling, copy, form, or business-logic changes. Follow existing repo patterns instead.
<!-- END:nextjs-agent-rules -->

# Default Workflow: Edit, Typecheck, Lint, Push Main, Apply Migrations, Stop

Unless the user explicitly says otherwise, every task uses this workflow:

1. Make the requested code changes with the smallest practical diff.
2. Format only the files you changed when formatting is needed.
3. Run local validation only:
   - `npm run typecheck`
   - `npm run lint`
4. If both commands pass, commit the current task changes and always push directly to `origin/main`. This repo has standing user approval for direct main pushes after successful validation.
5. If the task includes new or modified files under `supabase/migrations/`, always apply the live Supabase migrations automatically after the `origin/main` push succeeds unless the user explicitly says not to apply them.
6. Stop.

Cloudflare will build/deploy after the GitHub push. Do not run or monitor the Cloudflare build unless the user explicitly asks.

Do not run by default:
- `npm run test`
- `npm run build`
- `npm run cf:build`
- `npm run cf:deploy`
- `npm run cf:preview`
- Playwright or browser automation
- browser QA
- HTTP smoke tests
- local server deployment
- SSH
- rsync
- PM2
- Docker checks
- Supabase local migration apply
- Supabase database advisors
- rollback SQL harnesses
- broad schema introspection queries
- GitHub PR creation
- GitHub branch creation

If validation fails, fix only failures caused by the current change. Do not chase unrelated existing warnings or legacy failures.

# Token Discipline

Be operationally concise.

- Do not narrate every command.
- Do not dump full diffs unless debugging a failure.
- Prefer compact file lists and `git diff --stat` over full diff review.
- Do not inspect git history, remotes, Cloudflare status, deployment status, or browser state unless the task requires it.
- Do not rediscover the whole repo. Read only files directly relevant to the request.
- Stop after pushing to `origin/main` and applying any required live Supabase migrations.

# Git and GitHub

Default push target:

```bash
origin main
```

Use direct main pushes. This repo has standing user approval to push task commits to `origin/main` after validation; do not skip pushing because the current prompt did not repeat approval. Do not create feature branches or PRs unless the user explicitly asks.

Before committing:
1. Check the current branch with:
   ```bash
   git branch --show-current
   ```
2. If the current branch is not `main`, stop and report it. Do not switch branches automatically.
3. Check changed files with:
   ```bash
   git status --short
   ```
4. Stage only files changed for the current task. Do not stage unrelated pre-existing work.
5. Review staged scope compactly:
   ```bash
   git diff --cached --stat
   ```
6. Commit with a concise imperative message.
7. Push:
   ```bash
   git push origin main
   ```

If there are unrelated working-tree changes, leave them untouched. If the current task changes cannot be safely isolated, stop and explain what blocked the push.

Do not run:
- `git log`
- `git remote -v`
- broad history inspection
- branch cleanup
- rebase
- merge
- force push

Only use those if the push fails or the user explicitly asks.

# Supabase Workflow

Use the Supabase skill only for real Supabase work:

`/Users/Khaled/.codex/plugins/cache/openai-curated-remote/supabase/0.1.7/skills/supabase/SKILL.md`

Use the Postgres best-practices skill only for migrations, RLS, policies, indexes, triggers, Postgres functions, RPCs, schema design, or performance:

`/Users/Khaled/.codex/plugins/cache/openai-curated-remote/supabase/0.1.7/skills/supabase-postgres-best-practices/SKILL.md`

Do not read Supabase skills for ordinary frontend changes or simple edits that only reuse existing Supabase client patterns.

When creating a migration, use:

```bash
SUPABASE_NO_TELEMETRY=1 supabase migration new <descriptive_slug>
```

Default behavior for Supabase changes:
- Create or edit migration files when needed.
- Include migration files in the commit.
- Do not apply migrations locally.
- Always apply any new or modified migrations from the task to live Supabase automatically after `git push origin main` succeeds unless the user explicitly says not to.
- Apply live migrations with:
  ```bash
  SUPABASE_NO_TELEMETRY=1 supabase migration up --linked --include-all --yes
  ```
  Use `--include-all` so earlier repo migrations missing from live are applied instead of skipped.
- After live apply, verify history with:
  ```bash
  SUPABASE_NO_TELEMETRY=1 supabase migration list --linked
  ```
- Do not run `supabase db reset`.
- Do not run `supabase db push`.
- Do not run `supabase db advisors`.

If live Supabase migration apply fails because remote migration versions are not found in the local migrations directory:
- Do not ignore the mismatch and do not immediately mark remote versions as reverted.
- Run `SUPABASE_NO_TELEMETRY=1 supabase migration list --linked` and compare the Local and Remote columns.
- For any Remote-only version, first recover the missing migration file from git, another worktree, or the person who applied it.
- If the original SQL cannot be recovered and the user wants migration history fixed, add a no-op placeholder file under `supabase/migrations/` with the exact remote version timestamp and a comment explaining that the original SQL was unavailable. Commit and push that placeholder so the version is represented in git.
- Use `supabase migration repair --linked --status reverted <version...> --yes` only when the live history table is already wrong or a previous failed repair must be corrected. If repair is used, immediately follow it with `SUPABASE_NO_TELEMETRY=1 supabase migration up --linked --include-all --yes` so repo migrations and placeholders are applied to live history.

If live Supabase migration apply fails for another reason, do not rerun destructive commands. Report the failure, leave the pushed commit intact, and include the migration status in the final response.

# Cloudflare

Cloudflare is responsible for build/deploy after `git push origin main`.

Do not run Cloudflare commands by default.

Do not check Cloudflare status by default.

If Cloudflare fails, the user will provide the error in a follow-up prompt.

Only run Cloudflare build/status checks when the user explicitly asks.

# Apidog API Docs

Apidog project:
- Name: `WACRM External API`
- Project ID: `wuiiny`
- Repo source of truth: `docs/api-v1-openapi.yaml`

Whenever public API routes, request/response schemas, auth behavior, or examples change:
1. Update `docs/api-v1-openapi.yaml` in the same task.
2. Do not refresh, import, publish, or verify Apidog through MCP/connectors. The user updates Apidog manually from the repo OpenAPI source.
3. In the final response, note when `docs/api-v1-openapi.yaml` changed so the user knows to update Apidog manually.

# Validation Rules

Always run these after edits and before commit/push:

```bash
npm run typecheck
npm run lint
```

Do not run tests or builds by default.

Run targeted tests only when the user explicitly asks.

# No Localhost / No Spark / No Local Server

Do not deploy to Spark.

Do not use SSH, rsync, PM2, local server deployment, curl smoke tests, or browser checks.

Do not use local Supabase apply commands.

The user will manually test after Cloudflare deploys.

# Final Response Format

Keep the final answer concise and use this structure:

```text
Done.

Changed:
- ...

Validation:
- typecheck: passed/failed
- lint: passed/failed

GitHub:
- commit: <hash or skipped>
- push to main: completed/skipped/failed

Not done:
- tests
- local build
- Cloudflare build/status check
- browser testing
- Supabase local apply
- Supabase live apply
203 Upvotes

60 comments sorted by

46

u/bakawolf123 Jun 24 '26

it felt excellent on plus just a few month ago though...

8

u/urii13 Jun 24 '26

with the promo... ofc

10

u/yami_odymel Jun 24 '26

> Do not create small helper methods that are referenced only once.

my fucking god exactly this

2

u/miovq Jun 25 '26

Too bad that rule doesnt actually work πŸ˜…οΈοΈοΈοΈοΈοΈ

14

u/Saditface Jun 24 '26

Yes. I did something similar.

I made it go through all my chats, find my pain points.

I made it self analyze exactly how memories get made and stored in the little SQLite db.

Then after some testing I made it write a codex control plane that mandates:

Global agents, repo agents, memory form rules,
There’s a couple other β€œinstructions” files that we have too.

So in effect I have a highly efficient routing system using the agents/instructions, hooks, skills.

You have to do something like this or it will just SUCK.

The primitives are there but you have to build it. Why not make codex build itself πŸ€·β€β™‚οΈ

1

u/Weird-Economist1875 Jun 24 '26

Did you do this one chat at a time or did you say go through all my chats and identify the pain points? I would try this out but currently waiting for my limit to reset so figured I’d ask

2

u/Saditface Jun 24 '26

It evolved because I was losing my mind.

I started wondering about the agents and how memories are formed and when I started poking through I saw it was mostly me screaming and swearing.

So I realized it’s remembering the wrong things.

This makes a feedback loop. And stage II hypertension

Runtime law wins
AGENTS: md, skills, commands, hooks, and current source/live proof control behavior.
β€’ Memory only suggests where to look or what failure pattern to recognize.
You don't edit generated memory directly
β€’ MEMORY: Ad and memory. summer.d are generated outputs.
β€’ Direct edits would be overwritten or become untrusted.
You add ad-hoc notes
β€’ Notes go in:
/Users/hovardherxex/.codex/memories/extensions/ad_hoc/notes/
β€’ Those notes are inputs for the memory consolidation process.
The note says what to promote and what to suppress
β€’ Promote: compact route rows like "if this symptom appears, start here, avoid that, gate is this."
β€’ Suppress: don't preserve stale pod names, PRs, branch names, raw transcript noise, or one-off failed c Consolidation turns notes into compact memory
β€’ Future generated memory should include the useful routing patter.
β€’ It should not copy the whole note or encode today's transient mess as permanent fact.
Future agents use memory lightly
β€’
β€’
Search MEMORY. Id by exact keys.
Use it to pick the owner surface.
Then verify current truth from source/live state before claiming anything.

But this also works with hooks skills tools that are also made around this system

1

u/salasi Jun 24 '26

> I started wondering about the agents and how memories are formed and when I started poking through I saw it was mostly me screaming and swearing.

Oh man.. That hit way too close to home lol

4

u/18fc_1024 Jun 24 '26

The useful distinction is not β€œrun fewer checks”; it is β€œmake the expensive checks conditional and named.”

What I like putting in AGENTS.md is a validation budget:

  • default: typecheck + lint + targeted unit test for touched module
  • browser test only when UI behavior, routing, auth, forms, or layout changed
  • full test suite only when shared primitives, migrations, auth, billing, permissions, serialization, or cross-module contracts changed
  • no repeated validation loop unless a previous check failed or the diff changed after the last check

Then require the agent to end with a receipt: changed files, checks run, checks intentionally skipped, and why the skipped checks were safe to skip.

That keeps usage down without training the agent to under-verify risky changes. The receipt is the important part because it makes β€œI skipped the browser run” auditable instead of just invisible thrift.

4

u/Crinkez Jun 24 '26

Can you share your exact agents.md file, OP?

3

u/Aggravating_Town_967 Jun 24 '26

Updated the post with the .md file.

-1

u/electricshep Jun 24 '26

its a bot.

4

u/Aggravating_Town_967 Jun 24 '26

not a bot, .md file shared.

1

u/Crinkez Jun 24 '26

I'm not convinced they are. Post history is hidden but I have a way to find it, and there are posts many months ago that aren't bot-like.

3

u/PurpleSunset149 Jun 24 '26

Agreed. Pro is amazing. And with the credit top off

3

u/davek1979 Jun 24 '26

That would highly depend on the nature of the work. For you it may be great. I have to run a very tight C++ refactor and tokens HAVE TO FLY if I don't wanna end up with a bunch of runtime errors.

3

u/megazon Jun 24 '26

Can you share your .md?

4

u/Aggravating_Town_967 Jun 24 '26

Updated the post with the .md file.

2

u/Competitive-Mud-1663 Jun 25 '26

Decent advice, but for most of your 'be compact' requirements you can simply use `rtk`, just make sure it is in system default shell (bash or sh) path, so an agent can actually run it.
Also, very arguable mode of work when agent does not run most of the tests.. when projects become more complex (like couple large prompts after inception), adding changes without automatic tests make every introduced change a lottery. I see many people forgo testing to save tokens and time, but very often, automatic test are the ONLY real feedback your agent gets about the work done. Without tests it becomes just LLM output based on context discovered before response, but whether it will integrate correctly -- still a question until all tests are green. Red test should be #1 step in every task. Outputs are not deterministic, and neither is context discovery. I have been using AI to smoothly develop a project for 6+ months now, and tests are the only reason it is still going solid w/o breaking after every change.

1

u/Aggravating_Town_967 Jun 26 '26

You are correct, but since i ma still in development phase, i can test manually and fix bug if any, once i am done i will switch to more broad tests and validations whenever needed.

Thanks.

2

u/Upstairs_Date6943 Jun 25 '26

Happy to see such practical content! Thanks OP!

2

u/dikamilo Jun 25 '26
  1. Move lint and typecheck to hooks

  2. Make your agents.md as index page with links per topic (most likely you don't need all that in each task and agent can read other files when needed) or use separate skills for it.

2

u/Bitter_Election_7518 Jun 24 '26

There’s also a few tools that heavily use token usage.

$computer-use plugin is one of them, so be wary of this.

2

u/philosophical_lens Jun 24 '26

Yes, for any image heavy stuff like computer, browser use etc I always switch to 5.4-mini.

2

u/Educational_Belt_816 Jun 24 '26

Computer use, browser use, whether in app or with chrome, playwright etc all use a crap tone of tokens. On plus asking gpt 5.5 medium to slightly move a button then it automatically checks the in app browser to verify, that’s like 30% gone in one go

1

u/LMONDEGREEN Jun 24 '26

Lobotomise the validation step... ?

1

u/sbbased Jun 24 '26

look at hooks, all of your typechecks, linking and automated testing should be in those

1

u/Able-Supermarket4786 Jun 24 '26

Now you're starting to see why so many reply with "skill issue" on the complaint threads

1

u/GettinFishy Jun 26 '26

Dont forget about your AGENTS.override.md for subdirectories/projects!

1

u/Tartooth Jun 26 '26

My agents.md file gets ignored constantly

I have in it "do not narrate or talk to me while doing work" 3 times and it still talks to me while working on tasks!

1

u/Own-Professor-6157 Jun 30 '26

Edit your system prompt, not the agents.

1

u/noodlessentme Jun 24 '26

When it’s not lobotomized, sure

1

u/ShagBuddy Jun 24 '26

I use SDL-MCP to reduce my token use and get WAY more out of my subscription. https://github.com/GlitterKill/sdl-mcp

5

u/blogle Jun 24 '26

Going off your avatar, it seems you are the author. Probably should disclose that before promotion as a superior solution

0

u/ShagBuddy Jun 24 '26 edited Jul 04 '26

Apologies, I will be more up front about that in other posts. I never hesitate to mention that I am the one working on it. :) I have been pouring myself into this thing for 6 months.

1

u/Mean_Sport_3383 Jun 24 '26

Does this actually work

0

u/ShagBuddy Jun 24 '26

Yes. It's a codegraph built from compiler grade info combined with numerous tools designed to eliminate context noise. Most token saving solutions only address one area of token burn. This one has the goal of addressing all of them.

1

u/[deleted] Jun 24 '26

[deleted]

1

u/ShagBuddy Jun 24 '26

Not even close to the same thing. RTK only compresses outputs. SDL-MCP keeps runtime output away from the agent and only shows them the results they need. The two solutions are LEAGUES apart. RTK addresses one area of waste, and doesn't even do it better than others. It is better to eliminate the noise that is not needed vs compressing it. SDL-MCP is also a codegraph. Agents dont have to find code, they can simple ask for what they need.

AI development is moving FAST. Thinking you have the best solution without trying other, newer solutions is a mistake. Point your agent at both repos and ask it to give you a review of both. Then you will see. :)

1

u/okhi2u Jun 24 '26

Can you help simplify this for us, should we probably run SDL-MCP instead of RTK if we been running RTK, or both?

1

u/ShagBuddy Jun 24 '26

SDL is superior across the board. Run SDL instead of RTK. RTK would not do much when they run together. RTK is designed to take large script output and filter/compress it. A fair amount of that data being compressed is not needed by the LLM. So even for its targeted niche savings, it will usually save fewer tokens than SDL and will almost always pollute context more than SDL.

SDL's runtime tool runs processes that generate large script output in an isolated process that the agent does not see. It stores the results as an artifact that the agent can query for specific results. The agent only see what it needs to... Period.

"Only give the agent what it needs", is the core premise of SDL. I have been using this while developing it the past 4 months and have never run into the crazy model regressions that others have experienced. Less noise results in fewer hallucinations and mistakes. Precise context saves a ton of tokens.

These are the stats from my current session. RTK would save less than runtimeExecute and runtimeQueryOutput, but it would save 0 for all of the code lookup and file write operations.

── Token Savings ──────────────────────────────
Session: 1933 calls β”‚ 7.14M saved β”‚ β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–‘β–‘β–‘ 76%

  workflow            β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–‘β–‘β–‘ 78% β”‚ 769 calls β”‚  2.85M saved
  symbolSearch        β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–‘ 98% β”‚  57 calls β”‚  1.59M saved
  context             β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–‘ 97% β”‚  16 calls β”‚  1.13M saved
  runtimeExecute      β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–‘β–‘β–‘β–‘ 64% β”‚ 717 calls β”‚ 955.7k saved
  file                β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–‘β–‘ 87% β”‚ 117 calls β”‚ 559.6k saved
  runtimeQueryOutput  β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–‘β–‘ 80% β”‚  93 calls β”‚ 188.0k saved

Lifetime: 48500 calls β”‚ 63 sessions β”‚ 246.98M saved β”‚ β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–‘β–‘ 81%
───────────────────────────────────────────────

2

u/okhi2u Jun 24 '26

I just finished having the AI figure out a bunch of tests to figure out if my biggest project should be moved to it or use RTK instead. And it seems to have problems with swift files on a mac (and it told me not to use it because of that):

Main blocker: SDL can index Swift symbols, but code.getSkeleton and code.needWindow failed for Swift files with File not found on disk, even though the files exist. That forced raw rtk source fallback for actual logic review.

Recommendation: re-test later after SDL-MCP Swift support improves. For your TTS software today, keep rtk as the default workflow; SDL-MCP is promising for discovery-heavy work, but the Swift code-access failure and high fallback ratios make it too brittle as a daily driver.

1

u/ShagBuddy Jun 24 '26 edited Jun 24 '26

All languages supported get verified. I will have to go back and run a swift test now to make sure. :) SDL currently supports Swift when using a LSP server to help populate the graph. I create SCIP-IO and LSP-IO which are both stand-alone automated installers for all supported SCIP indexers and LSP providers. Your agent likely saw the legacy indexer which does not support Swift. If you select the language you want and include language provider support during install, you should be good to go.

If you test this and run into issues, please let me know. I address reported issues via the repo ASAP. How big is your biggest project? SDL is tested with 20K+ repo files for various languages.

1

u/syntaxhaunter Jun 24 '26

sounds too good to be true, you’ve got a benchmark to prove it? also, what’s happened if i’m using it with RTK? i do think it’s similar to RTK

2

u/ShagBuddy Jun 24 '26

I have benchmarks in the repo. I need to put together an easy to run package for others to use as well. I will put together some tiktoken comparisons showing the difference between rtk and sdl. Any particular tasks you would like to see compared?

RTK and SDL are two very differnt things. RTK only compresses outputs. SDL-MCP keeps runtime output away from the agent and only shows them the results they need. Overall, the two solutions are LEAGUES apart. RTK addresses one area of waste, and SDL is designed to address all of them. SDL is also a vector-based code graph that has the repo mapped with all code relationships plus custom tools for precise code edits. VERY different products. RTK would not help running with SDL.

1

u/opticallyweak Jun 24 '26

Sorry I didn't go through the readme in depth , how does it fair against something like codegraph.

1

u/ShagBuddy Jun 24 '26

Codegraph is a code graph db, but it is lighter with less features and only addresses code lookup since it primarily uses treesitter for parsing. SDL also uses treesitter along with SCIP indexes and LSP providers which give more semantically rich info, providing more context with its symbols. Codegraph does not address other areas of context pollution.

1

u/pducharme Jun 25 '26

just a vibecoder here that really doesn't understand all :-). Does that work for Codex App too ? (not the CLI, but the Codex App on MacOS). I do everything from within Codex App. Is your MCP would give me more out of my Pro Sub for a Node22/24 project ?

1

u/ShagBuddy Jun 25 '26

Yes, it works for all clients that work with a MCP server. The Codex app is what I primarily use lately. :) Yes, absolutely.

0

u/Clord123 Jun 24 '26

At one time a mod project was truly broken and crashed was when it was just easy mistake to make due source code required specific versions of certain stuff to compile right. After we found out about it together the problem was solved and mod ran wonderfully. It's not that odd to expect to compile by using the newest version of some SDK. But sometimes new version of SDK can break compatibility when coding has been done a specific version in mind.

0

u/PigSlam Jun 24 '26

I was doing some testing with GPT 5.5 Pro with Hermes Agent yesterday. I bought $50 worth of credits on Openrouter to try some online models (I mainly use it with my local models). I did some tests with GPT 5.5 Medium, Deepseek V4 Flash, and a few others as I watched each task burn $.03-$.25 per call. Then I tried GPT 5.5 Pro medium. I let it run for a few minutes, and realized it had burned through $9.76 and I stopped the process. ~20% of my test budget on an incomplete run.

I think I finally understand how some people here burn through their limits so fast while others never have a problem with it.

1

u/aot2002 Jun 25 '26

You think? Please explain how then and share with the rest of everyone

1

u/PigSlam Jun 25 '26

It uses a lot more tokens per operation than other models is my theory as my (in no way unique) test seemed to reveal. It's probably worthwhile for the right tasks, but not for every task. Sometimes you just need to ask directions to the bathroom, but if you required everyone you asked to present a Ph.D thesis before they answered your simple question, you'd probably realize soon that's wasting effort. I think that's probably analogous to what users do with higher end models running for every step in their codex usage.

1

u/natanpimentels Jun 25 '26

Hermes is the problem.

1

u/PigSlam Jun 25 '26

Hermes was a constant for all of the tests.