Discussions about automated QA usually jump straight to test execution while overlooking the feature inventory. In any mature codebase, “what should we actually test” is the first real bottleneck. That is what makes the Codex Loop prompt shared by Greg Brockman worth studying: instead of merely asking an agent to hunt bugs, it ties feature discovery, user stories, expected behavior, and defect tracking into one continuous loop.

The Original Loop Prompt

Below is the exact prompt from the shared screenshot, formatted only for line breaks:

/goal go over every single feature in this app create a user story with expected behaviour based on the code keep a single canonical spreadsheet tracking the features status - when done switch loop to testing every user story and documenting all errors - when done fix every logistical error or ux error - test every user behaviour again post fix

Although the screenshot says logistical error, in context it clearly means fixing logical and UX errors together. Broken down into sequential phases, that single sentence runs six steps:

  1. Scan every feature in the application.
  2. Derive user stories and expected behavior from the current code.
  3. Maintain a single canonical spreadsheet tracking feature status.
  4. Test every user story and document all observed errors.
  5. Fix logical errors and UX issues.
  6. Re-test the same user behaviors after applying fixes.

Expanding that one-liner into explicit stages and stop conditions produces a cleaner operational prompt:

/goal
Analyze every feature in this application without omission.
For each feature, complete the following:
1. Write a User Story based on the code and current implementation.
2. Define the Expected Behavior for that feature.
3. Create and maintain a single master spreadsheet (or tracking doc) recording the status of all features.
Once all feature analysis is complete, proceed to the next phase:
4. Test all valid usage scenarios against each user story.
5. Log every discovered error, edge case, UX issue, and logical defect in detail.
Once all testing is complete, proceed to the next phase:
6. Fix all discovered Logical Errors.
7. Fix all discovered Bugs.
8. Improve all discovered UX issues.
Once fixes are complete, proceed to the next phase:
9. Re-test all user scenarios from scratch.
10. Verify that no new errors or Regressions were introduced.
11. If any issues remain, repeat fixing and re-verifying.
Repeat Analyze -> Test -> Fix -> Re-test until every core feature runs reliably and the user experience is solid.

Here /goal defines the loop’s termination condition: the agent keeps iterating until every feature is cataloged, tested, fixed, and verified again.

Why the Loop Builds a Feature Inventory First

Crucially, the prompt does not tell the agent to write test scripts right away. It forces the agent to enumerate features and translate them into user stories first.

In growing codebases, missed bugs rarely come from lazy testing - they come from missing inventory. A team tests the login screen thoroughly while forgetting expired password-reset links, verifies successful checkouts while skipping retry flows after declined cards, or checks that an admin page loads without recording how action buttons hide for low-privilege roles. Telling an agent to “test everything” without an explicit ledger guarantees blind spots. The canonical spreadsheet closes that gap.

A single tracking table also acts as external working memory across iterations. Recording Feature IDs, user stories, expected behavior, current status, logged defects, and last-checked timestamps in one place keeps the loop grounded, much like a human QA lead working down a release checklist.

Recording Comes Before Automated Fixing

Watching an agent patch bugs autonomously looks impressive in demos, yet structured logging matters far more. If the agent never records why a scenario failed, post-fix verification has nothing solid to check against.

A reliable QA loop leaves concrete artifacts at every stage:

StageWhat the Agent Must Record
Feature DiscoveryFeature ID, screen or API route, user story
Expected BehaviorExpected behaviour grounded in current code
Test ExecutionTest scenario, observed result, reproduction steps
Defect FixModified files, root-cause hypothesis, verification method
Regression CheckRe-run results on the same scenario, remaining risks

Without this table, coding agents drift toward cosmetic patches that merely look plausible. With the table in place, engineers can pause the loop mid-run, audit decisions, and override bad assumptions.

Where Running the Raw Prompt Gets Risky

Dropping “every single feature” onto a large production codebase without guardrails quickly blows up scope. Test environments, role-based test accounts, external API mocks, payment sandboxes, and seed data all have to exist beforehand; otherwise the agent skims surface UI routes or invents faulty assumptions.

Unbounded fix scope is equally risky. Fixing logical bugs and UX issues in one sweep touches too many files at once and obscures regression root causes. UX changes also involve product judgment - moving buttons, rewriting copy, or collapsing user flows should never happen purely on an agent’s whim.

In practice, separating discovery from code modification works much better: let the first loop build only the feature inventory and test scenarios, have a human review and prioritize the table, and then run narrowly scoped fix loops per feature group.

Splitting the Loop for Production Use

While the original one-liner is great for sharing the concept, production teams are safer starting with a read-only audit pass:

/goal audit the app feature by feature.
Create a canonical QA table with:
Feature ID, route/screen/API, user story, expected behavior, test scenarios, current status, defects, severity, last checked.

Do not modify code in the first pass.
Stop after the inventory and test scenarios are complete.

Locking the first pass to documentation lets engineers inspect scope before a single source file changes. Follow-up fix loops can then apply tight constraints such as “P0/P1 defects only,” “authentication flows only,” or “exclude mobile layout changes.” The longer an autonomous loop runs, the more tight constraints protect code quality.

The real lesson of Codex Loop is not “let AI fix everything automatically.” Its value lies in handing off repetitive checklist maintenance and regression re-runs while keeping explicit tracking tables, stop conditions, and scoped boundaries in control.

Summary

  • The Codex QA loop translates every application feature into user stories and expected behavior tracked inside a single canonical spreadsheet.
  • Tying feature discovery, defect logging, and post-fix regression checks into one recorded loop matters more than autonomous patching alone.
  • On production codebases, running a read-only inventory and scenario pass before tightly scoped fix loops prevents runaway edits.