r/codex • • 13d ago

Question Any tips to improve multi-agent codex for difficult golang monolyth (4 mil lines)?

Ive migrated to codex just a week ago.

My problems:

  1. Difficult to optimize tokens usage. I switches manually a lot of times between astra, sol, terra. Is there any solutions to do it automatically? I understand that it would be not too efficient, but anyway..
  2. Even with decomposed tasks (SOL 6.1 / Astra), the agent sometimes writes a lot of useless boilerplate that you have to rewrite manually or via another prompt. This confuses the agent and can make it forget the messages we've investigated before
  3. Its really hard to remember all the features you made at sprint in details. Even if i understood em excellent at review point, i am confused to remember what did I do just 3 or more weeks ago. How do you deal with it? "quiz" games every day that some people recommend sounds really funny. I am not stupid but that huge amount of info that comes through me is kinda tough. It makes me feel brain fog
  4. And last one extra: do you use any tools to understand huge bad coded monolith that you just entered as a new employee ? :)

That's what i am using now:

  1. ECC plugin that improves agent's code style, reduces its issues, does good 1st layer review.
  2. Company MCP's
  3. Codegraph
2 Upvotes

9 comments sorted by

3

u/Local-March-7400 13d ago

Senior Software engineer would say: rewrite everything from scratch in Rust.

But jokes asside: try out Repowise and map the whole thing. then use local embedding models as help for your agents

1

u/Jenfi_ 13d ago

hahhaha, thanks mate

4

u/Blige_Tjani 10d ago

for the 3 week brain fog just keep a dumb text file of every ticket and what files you touched, dont do daily quizzes lol. for the token burn i went with DocuSOR on our monolith. agents work way better when they have less to manage in their window

2

u/Discordbothost 13d ago

for the "what did i do 3 weeks ago" part, make the agent remember instead of you. end every task by having it append 3-4 lines to something like docs/agent-log.md: what changed, which packages, why, and anything you tried and ruled out. later you grep that file instead of your memory, and new sessions can read it too.

for the boilerplate, a short rule in AGENTS.md helps more than people expect ("reuse existing helpers, no new abstractions or wrappers without asking"), plus naming the 2-3 packages a task should touch. on 4m lines you don't want it roaming. and on model switching i'd stop doing it per prompt and do it per task type: investigation and planning on the big model, mechanical edits on the cheap one

2

u/m-ritter 13d ago

The boilerplate and the forgetting feel like one problem to me. When nobody wrote down what was settled, the agent fills the gaps with generic code, and three weeks later the diff is the only thing left to remember it by. What helped me was having an approved plan file in the repo before any code, with a short numbered list of what done means, so every feature leaves a readable record behind. I built QualityLayer for this: https://github.com/maxritter/qualitylayer

2

u/Lower_Cupcake_1725 13d ago

I'd suggest trying DevChain CLI. It's an orchestration tool that you can use with just Codex. It handles project documentation, task decomposition, and implementation by assigning tasks to agents of different capability levels to optimize token usage.

It has a lot of other features too. I've been using it on large projects, and it works really well.

1

u/London-Boat 13d ago

for the sprint memory part, i'd have codex write a short note per feature when it's done (what changed, which packages, what you tried and dropped and why) into a docs folder and point AGENTS.md at it. then 3 weeks later you ask it to read that note instead of re-investigating. on the model switching, codex config.toml supports profiles, so you can set up a cheap one and a heavy one and pick with --profile instead of switching by hand

1

u/ksajadi 13d ago

ok, on the "I can't remember what I did a few weeks ago" part, i wouldn't try to fix that with your own memory. have the agent write a short note at the end of each task: what changed, why, and what was ruled out, and keep those in the repo.

then both you and the next session can read back instead of reinvestigating. for a monolith that size, a few handwritten notes on the areas you've already figured out will save more tokens than switching models. do you think that the boilerplate problem gets worse when the agent starts each task cold?