Skip to content

Commit 04bc6a1

Browse files
committed
Restructure into publish-ready codex-self-iter plugin repository
1 parent 225a213 commit 04bc6a1

17 files changed

Lines changed: 715 additions & 1 deletion

File tree

.codex-plugin/plugin.json

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"name": "codex-self-iter",
3+
"version": "0.1.0",
4+
"description": "Autonomous small-step self-iteration loop for Codex-driven task execution.",
5+
"author": {
6+
"name": "Dremig"
7+
},
8+
"license": "WTFPL",
9+
"interface": {
10+
"displayName": "Codex Self Iter",
11+
"summary": "Read a plan file, auto-generate next steps, execute, review, and iterate until stop.",
12+
"tags": [
13+
"automation",
14+
"agent",
15+
"iteration"
16+
]
17+
}
18+
}

.github/workflows/ci.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: ci
2+
3+
on:
4+
push:
5+
branches: ["main"]
6+
pull_request:
7+
8+
jobs:
9+
test:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v4
13+
- uses: actions/setup-python@v5
14+
with:
15+
python-version: "3.11"
16+
- name: Install package and test deps
17+
run: |
18+
python -m pip install --upgrade pip
19+
pip install -e .[dev]
20+
- name: Run tests
21+
run: pytest -q

.gitignore

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
__pycache__/
2+
*.pyc
3+
.pytest_cache/
4+
.venv/
5+
dist/
6+
build/
7+
*.egg-info/
8+
9+
.codex-self-iter/
10+
.codex-stop
11+
12+
.DS_Store

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Changelog
2+
3+
## 0.1.0 - 2026-04-21
4+
5+
- Initial public repository structure for `codex-self-iter`.
6+
- Added Python package layout (`src/`), CLI entrypoint, and tests.
7+
- Added plugin manifest at `.codex-plugin/plugin.json`.
8+
- Added GitHub Actions CI for lint-free test run.

LICENSE

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
2+
Version 2, December 2004
3+
4+
Copyright (C) 2026 Dremig
5+
6+
Everyone is permitted to copy and distribute verbatim or modified
7+
copies of this license document, and changing it is allowed as long
8+
as the name is changed.
9+
10+
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
11+
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
12+
13+
0. You just DO WHAT THE FUCK YOU WANT TO.

README.md

Lines changed: 86 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,86 @@
1-
# iter-codex
1+
# codex-self-iter
2+
3+
`codex-self-iter` is a plugin-style repository that runs a continuous autonomous loop for coding tasks:
4+
5+
1. Read `TASK.md` + `plan.md`
6+
2. Generate one small next step
7+
3. Execute the step via agent command
8+
4. Review result and decide whether to continue
9+
5. Repeat until no meaningful next action exists or user stops it
10+
11+
## Repository Layout
12+
13+
```text
14+
.
15+
├── .codex-plugin/plugin.json
16+
├── src/codex_self_iter/
17+
├── tests/
18+
├── examples/
19+
├── scripts/
20+
├── pyproject.toml
21+
└── .github/workflows/ci.yml
22+
```
23+
24+
## Quick Start
25+
26+
1. Install locally:
27+
28+
```bash
29+
pip install -e .[dev]
30+
```
31+
32+
2. Prepare task files in your workspace:
33+
34+
- `TASK.md` (optional)
35+
- `plan.md` (required)
36+
37+
3. Run:
38+
39+
```bash
40+
python3 -m codex_self_iter \
41+
--workspace . \
42+
--task-file TASK.md \
43+
--plan-file plan.md \
44+
--state-dir .codex-self-iter \
45+
--agent-command-template "codex exec --auto --prompt-file {prompt_file}"
46+
```
47+
48+
Or use:
49+
50+
```bash
51+
./scripts/run-local.sh .
52+
```
53+
54+
## Stop Conditions
55+
56+
- Create `.codex-self-iter/STOP`
57+
- Or create workspace-level `.codex-stop`
58+
- Or interrupt process manually
59+
60+
## Output Artifacts
61+
62+
- `.codex-self-iter/prompts/`: planner/executor/reviewer prompts
63+
- `.codex-self-iter/logs/iterations.jsonl`: loop records
64+
- `.codex-self-iter/status.json`: last iteration state
65+
66+
## Configuration
67+
68+
See `config.example.toml`.
69+
70+
Important fields:
71+
72+
- `agent_command_template` must include `{prompt_file}`
73+
- `max_iterations = 0` means unbounded loop
74+
- `max_stagnation` prevents infinite cycling on identical `next_focus`
75+
76+
## Development
77+
78+
Run tests:
79+
80+
```bash
81+
pytest -q
82+
```
83+
84+
## Security and Automation Boundary
85+
86+
The loop is autonomous at application logic level but still bounded by host permissions, sandbox policy, and tool confirmations.

config.example.toml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Required:
2+
# Must include {prompt_file}; may include {workspace}.
3+
agent_command_template = "codex exec --auto --prompt-file {prompt_file}"
4+
5+
# 0 means unbounded loop until stop condition.
6+
max_iterations = 0
7+
8+
# Stop when reviewer keeps giving same next_focus for this many rounds.
9+
max_stagnation = 4
10+
11+
# Per command timeout.
12+
command_timeout_sec = 1200
13+
14+
# Create this file under state-dir to stop loop.
15+
stop_file_name = "STOP"
16+
17+
# Create this file under workspace to stop loop.
18+
global_stop_file_name = ".codex-stop"
19+
20+
# Prompt hint only.
21+
planner_model_hint = "balanced"
22+
reviewer_model_hint = "strict"
23+
24+
# Number of history rows fed back to planner each round.
25+
history_tail = 8

examples/TASK.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Task
2+
3+
Implement and continuously optimize feature X until acceptance criteria are met.

examples/plan.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Project Plan
2+
3+
## Goal
4+
5+
Build and refine feature X until acceptance criteria are satisfied.
6+
7+
## Acceptance Criteria
8+
9+
1. Core workflow passes integration tests.
10+
2. Error handling covers key edge cases.
11+
3. Performance meets target baseline.
12+
13+
## Constraints
14+
15+
1. Keep API backward compatible.
16+
2. Do not modify files outside `src/` and `tests/`.
17+
3. Add or update tests for every behavior change.
18+
19+
## Priorities
20+
21+
1. Correctness
22+
2. Test coverage
23+
3. Performance optimization
24+
25+
## Iteration Strategy
26+
27+
Use small, atomic steps and verify each step with focused checks.

pyproject.toml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
[build-system]
2+
requires = ["setuptools>=68", "wheel"]
3+
build-backend = "setuptools.build_meta"
4+
5+
[project]
6+
name = "codex-self-iter"
7+
version = "0.1.0"
8+
description = "Self-iterating autonomous coding loop for Codex-style agents."
9+
readme = "README.md"
10+
requires-python = ">=3.11"
11+
license = {text = "WTFPL"}
12+
authors = [
13+
{name = "Dremig"}
14+
]
15+
dependencies = []
16+
17+
[project.optional-dependencies]
18+
dev = ["pytest>=8.2"]
19+
20+
[project.scripts]
21+
codex-self-iter = "codex_self_iter.__main__:main"
22+
23+
[tool.setuptools]
24+
package-dir = {"" = "src"}
25+
26+
[tool.setuptools.packages.find]
27+
where = ["src"]

0 commit comments

Comments
 (0)