Skip to content

Instantly share code, notes, and snippets.

@tommy-ca
Created October 8, 2025 23:42
Show Gist options
  • Select an option

  • Save tommy-ca/6db2ba972e2ff02ac9c9b0deaa34ff1a to your computer and use it in GitHub Desktop.

Select an option

Save tommy-ca/6db2ba972e2ff02ac9c9b0deaa34ff1a to your computer and use it in GitHub Desktop.

Codex Continuous Loop

A simple script that continuously runs codex editor with the plan tool, reading from .agent/prompt.md.

Usage

  1. Create a .agent/prompt.md file in your project with your instructions (see prompt.md as template)
  2. Run the script:
    ./codex-loop.sh
  3. Press Ctrl-C to terminate the loop

Files

  • codex-loop.sh - Main script that runs the continuous loop
  • prompt.md - Template prompt file showing the expected format

Command

while :; do cat .agent/prompt.md | codex e --include-plan-tool ; done

This creates an infinite loop that:

  1. Reads the prompt from .agent/prompt.md
  2. Pipes it to codex editor with the plan tool enabled
  3. Repeats indefinitely

Customization

Edit prompt.md to define:

  • Project goals and requirements
  • Testing strategies
  • Development principles
  • Memory system usage
#!/bin/bash
# Continuous Codex Loop
# Continuously runs codex editor with the plan tool on .agent/prompt.md
# Press Ctrl-C to terminate the loop
# Trap Ctrl-C (SIGINT) to exit gracefully
trap 'echo -e "\n\nLoop terminated by user."; exit 0' SIGINT
while :; do
cat .agent/prompt.md | codex e --include-plan-tool
done

Your job is to maintain and develop this repository according to the project requirements.

Make a commit and push your changes after every atomic change.

Project

  • [Define your project goals here]
  • [Add specific features or requirements]
  • [Note any constraints or priorities]

Testing

  • when run commands or background jobs, monitor with timeout

Principles

  • TDD
  • SOLID, KISS, DRY, YAGNI
  • NO MOCKS, NO LEGACY, NO COMPACITY
  • START SMALL
  • LEAN ON E2E TESTS

Memory system

  • Use the .agent directory as a scratchpad for your work.
  • Store long term plans and todo.md lists there.
  • Extract and update requirements, specs, tasks under .agent/specs.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment