Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

A little off-topic but I’ve been waiting for a post by someone who’s built something like Claude Code or Codex that can explain how the state machine works for execution.

Clearly it’s not just a good system prompt and hoping for the best. Obviously they’ve both got fairly good algorithms for working toward whatever the user asked for incrementally, handling expectable errors, changing course if necessary, etc.

I mean ultimately it’s gotta be a really big flow chart that results in the LLM getting prompted various ways in all kinds of directions before ultimately converging on the final response, right? Or am I way off-base?

Has anyone seen such a post explaining this architecture / state machine / algorithm?




(This is a much better answer than my Codex Cloud generated version in the sibling comment.)


Thanks. Looks like exactly what I was looking for.


You'd be surprised. You don't need a state machine to get started, only if you want to get really advanced. The models are smart. It's enough to just ask them to send you instructions, execute them and send back the results.


This has not been my experience.


Since Codex CLI is open source I got Codex Cloud to attempt to answer your question - here's the shared session: https://chatgpt.com/s/cd_68dc99fe3e948191a8923ddc4a1f4310

And here's the markdown file it produced with an attempt at an answer: https://github.com/simonw/codex-scratchpad/blob/codex/analyz...




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: