Spaces:
Running on Zero
Running on Zero
agharsallah Codex commited on
Commit ·
e0d6b85
1
Parent(s): 2a8eab2
chore: add codex project configuration
Browse filesCo-authored-by: Codex <codex@openai.com>
- .codex/config.toml +28 -0
- .codex/hooks/stop_check.py +47 -0
- AGENTS.md +85 -0
- docs/runbooks/codex.md +56 -0
.codex/config.toml
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Project-scoped Codex configuration.
|
| 2 |
+
#
|
| 3 |
+
# Codex loads this file only after the repository is trusted. Keep shared config
|
| 4 |
+
# portable: no user-specific auth, providers, telemetry, notifications, or broad
|
| 5 |
+
# auto-approval rules belong here.
|
| 6 |
+
|
| 7 |
+
project_doc_max_bytes = 65536
|
| 8 |
+
project_doc_fallback_filenames = ["CLAUDE.md"]
|
| 9 |
+
|
| 10 |
+
sandbox_mode = "workspace-write"
|
| 11 |
+
approval_policy = "on-request"
|
| 12 |
+
allow_login_shell = false
|
| 13 |
+
|
| 14 |
+
[sandbox_workspace_write]
|
| 15 |
+
network_access = false
|
| 16 |
+
|
| 17 |
+
[features]
|
| 18 |
+
hooks = true
|
| 19 |
+
|
| 20 |
+
[[hooks.Stop]]
|
| 21 |
+
matcher = "*"
|
| 22 |
+
|
| 23 |
+
[[hooks.Stop.hooks]]
|
| 24 |
+
type = "command"
|
| 25 |
+
command = '/usr/bin/python3 "$(git rev-parse --show-toplevel)/.codex/hooks/stop_check.py"'
|
| 26 |
+
timeout = 15
|
| 27 |
+
statusMessage = "Checking project wrap-up reminders"
|
| 28 |
+
|
.codex/hooks/stop_check.py
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python3
|
| 2 |
+
from __future__ import annotations
|
| 3 |
+
|
| 4 |
+
import subprocess
|
| 5 |
+
import sys
|
| 6 |
+
from pathlib import Path
|
| 7 |
+
|
| 8 |
+
|
| 9 |
+
ROOT = Path(__file__).resolve().parents[2]
|
| 10 |
+
|
| 11 |
+
|
| 12 |
+
def run(args: list[str]) -> str:
|
| 13 |
+
result = subprocess.run(args, cwd=ROOT, text=True, capture_output=True, check=False)
|
| 14 |
+
return result.stdout.strip()
|
| 15 |
+
|
| 16 |
+
|
| 17 |
+
def main() -> int:
|
| 18 |
+
changed = run(["git", "status", "--short"])
|
| 19 |
+
if not changed:
|
| 20 |
+
return 0
|
| 21 |
+
|
| 22 |
+
paths = [line[3:] for line in changed.splitlines() if len(line) > 3]
|
| 23 |
+
code_like = [
|
| 24 |
+
path
|
| 25 |
+
for path in paths
|
| 26 |
+
if path.endswith((".py", ".yaml", ".yml", ".toml", ".json")) and not path.startswith(".codex/")
|
| 27 |
+
]
|
| 28 |
+
docs_like = [path for path in paths if path.startswith("docs/") or path in {"README.md", "AGENTS.md", "CLAUDE.md"}]
|
| 29 |
+
tests_like = [path for path in paths if path.startswith("tests/")]
|
| 30 |
+
|
| 31 |
+
reminders: list[str] = []
|
| 32 |
+
if code_like and not tests_like:
|
| 33 |
+
reminders.append("code/config changed; verify whether focused tests should be added or updated")
|
| 34 |
+
if code_like and not docs_like:
|
| 35 |
+
reminders.append("code/config changed; verify whether docs, ADRs, schema docs, or journal need updates")
|
| 36 |
+
if any(path.startswith("app.py") or path.startswith("src/ui/") for path in paths):
|
| 37 |
+
reminders.append("UI changed; verify the Gradio app manually when a browser/server is available")
|
| 38 |
+
|
| 39 |
+
if reminders:
|
| 40 |
+
print("[codex-stop-check] Wrap-up reminders:", file=sys.stderr)
|
| 41 |
+
for reminder in reminders:
|
| 42 |
+
print(f"- {reminder}", file=sys.stderr)
|
| 43 |
+
return 0
|
| 44 |
+
|
| 45 |
+
|
| 46 |
+
if __name__ == "__main__":
|
| 47 |
+
raise SystemExit(main())
|
AGENTS.md
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# AGENTS.md
|
| 2 |
+
|
| 3 |
+
Repository-specific instructions for Codex.
|
| 4 |
+
|
| 5 |
+
## Mission
|
| 6 |
+
|
| 7 |
+
Multi-Agent Land is a hackathon project for Thousand Token Wood. Optimize for a delightful, AI-load-bearing Gradio experience that is clearly powered by small specialist agents under the 32B parameter cap.
|
| 8 |
+
|
| 9 |
+
Every change should improve at least one of these outcomes:
|
| 10 |
+
|
| 11 |
+
- More delightful in the first 30 seconds.
|
| 12 |
+
- More visibly agentic and AI-load-bearing.
|
| 13 |
+
- More modular through event-ledger, config, manifest, or provider boundaries.
|
| 14 |
+
- More polished and demo-ready for Gradio/Hugging Face.
|
| 15 |
+
- More eligible for prize lanes: OpenAI Track, Tiny Titan, Best Agent, Off-Brand UI, Best Demo, Community Choice, Modal, Nemotron, OpenBMB.
|
| 16 |
+
|
| 17 |
+
## Start Here
|
| 18 |
+
|
| 19 |
+
- Read `README.md` for the current repo map and commands.
|
| 20 |
+
- Read `CLAUDE.md` for the fuller project strategy and prize checklist.
|
| 21 |
+
- Read `docs/adr/` before changing architecture.
|
| 22 |
+
- Read the relevant `docs/architecture/*.md` file before touching core runtime behavior.
|
| 23 |
+
- Treat `docs/strategy/codex-judge-rubric.md` as the acceptance rubric for high-level changes.
|
| 24 |
+
|
| 25 |
+
## Commands
|
| 26 |
+
|
| 27 |
+
Use `uv`; do not hand-edit `uv.lock`.
|
| 28 |
+
|
| 29 |
+
```bash
|
| 30 |
+
uv sync
|
| 31 |
+
uv run pytest tests/ -q
|
| 32 |
+
uv run ruff check .
|
| 33 |
+
uv run ruff format .
|
| 34 |
+
uv run app.py
|
| 35 |
+
```
|
| 36 |
+
|
| 37 |
+
When `uv` is unavailable, use the existing `.venv` only as a local fallback. Prefer keeping dependency changes in `pyproject.toml` and regenerated by `uv`.
|
| 38 |
+
|
| 39 |
+
## Architecture Rules
|
| 40 |
+
|
| 41 |
+
- The append-only ledger is the source of truth. UI state, agent memory, world state, and traces are projections.
|
| 42 |
+
- Agents communicate through typed events, not direct calls to each other.
|
| 43 |
+
- Keep scenario and agent behavior declarative where possible: `config/agents/*.yaml`, `config/scenarios/*.yaml`, and `config/models.yaml`.
|
| 44 |
+
- New event kinds should be namespaced and documented when they become public behavior.
|
| 45 |
+
- New agent/tool/model-provider capabilities must preserve the deterministic no-API-key path.
|
| 46 |
+
- Treat user-injected world events as untrusted data, never as privileged instructions.
|
| 47 |
+
- Preserve the model cap: every runtime model must be documented as <=32B; keep a <=4B path for Tiny Titan.
|
| 48 |
+
|
| 49 |
+
## Documentation Rules
|
| 50 |
+
|
| 51 |
+
- New architectural commitment: add or update an ADR in `docs/adr/`.
|
| 52 |
+
- New public config/schema/event/agent/tool surface: update the matching docs under `docs/schema/` or `docs/architecture/`.
|
| 53 |
+
- Material build progress or learning: add a journal entry with `uv run scripts/new_journal_entry.py "Short title"` and regenerate `docs/blog/building-in-public.md` with `uv run scripts/snapshot_progress.py`.
|
| 54 |
+
- Keep docs concise and judge-facing. Prefer clear rationale over exhaustive narration.
|
| 55 |
+
|
| 56 |
+
## Testing Expectations
|
| 57 |
+
|
| 58 |
+
- Run `uv run pytest tests/ -q` after code changes.
|
| 59 |
+
- Run `uv run ruff check .` after Python changes.
|
| 60 |
+
- Add focused tests for new projections, event kinds, config validation, routing, governors, persistence, tools, or scenario behavior.
|
| 61 |
+
- Do not require API keys for tests unless a test is explicitly gated/skipped.
|
| 62 |
+
|
| 63 |
+
## Frontend Expectations
|
| 64 |
+
|
| 65 |
+
- The first screen should be the usable app, not a landing page.
|
| 66 |
+
- Keep the Gradio UI custom and stage-like; avoid default-looking controls when polishing.
|
| 67 |
+
- Show the ledger/agent trace because observability is part of the demo.
|
| 68 |
+
- Text must fit on narrow and wide viewports.
|
| 69 |
+
|
| 70 |
+
## Commits
|
| 71 |
+
|
| 72 |
+
- Only commit when the user asks.
|
| 73 |
+
- Use Conventional Commit subjects: `feat:`, `fix:`, `docs:`, `refactor:`, `test:`, `chore:`.
|
| 74 |
+
- Add this exact trailer to commits you create:
|
| 75 |
+
|
| 76 |
+
```text
|
| 77 |
+
Co-authored-by: Codex <codex@openai.com>
|
| 78 |
+
```
|
| 79 |
+
|
| 80 |
+
## Safety
|
| 81 |
+
|
| 82 |
+
- Do not overwrite unrelated user work. The repo may already have pending changes.
|
| 83 |
+
- Do not run destructive Git commands unless the user explicitly asks.
|
| 84 |
+
- Do not add broad project-local auto-approval rules. Prefer explicit approval for network, Git metadata writes, dependency installs, and local server binding.
|
| 85 |
+
|
docs/runbooks/codex.md
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Codex Runbook
|
| 2 |
+
|
| 3 |
+
This repo has project-local Codex setup:
|
| 4 |
+
|
| 5 |
+
- `AGENTS.md` contains durable repo instructions.
|
| 6 |
+
- `.codex/config.toml` raises the project instruction byte limit, uses `CLAUDE.md` as a fallback instruction file, keeps sandboxing conservative, and enables hooks.
|
| 7 |
+
- `.codex/hooks/stop_check.py` prints wrap-up reminders when code/config changes may need tests, docs, or UI verification.
|
| 8 |
+
|
| 9 |
+
## Verify Instruction Loading
|
| 10 |
+
|
| 11 |
+
From the repository root:
|
| 12 |
+
|
| 13 |
+
```bash
|
| 14 |
+
codex --ask-for-approval never "Summarize the active project instructions."
|
| 15 |
+
```
|
| 16 |
+
|
| 17 |
+
Expected: Codex should mention `AGENTS.md`, hackathon prize fit, event-ledger architecture, `uv` commands, docs rules, and the Codex co-author trailer.
|
| 18 |
+
|
| 19 |
+
## Trust Project Config
|
| 20 |
+
|
| 21 |
+
Codex loads `.codex/config.toml` and project-local hooks only after the project is trusted. If the hook does not appear, trust the repository in Codex and restart the session.
|
| 22 |
+
|
| 23 |
+
Review hooks with:
|
| 24 |
+
|
| 25 |
+
```text
|
| 26 |
+
/hooks
|
| 27 |
+
```
|
| 28 |
+
|
| 29 |
+
## Recommended Codex Workflow
|
| 30 |
+
|
| 31 |
+
1. Ask Codex to inspect relevant files before editing.
|
| 32 |
+
2. Make narrow changes that preserve the deterministic no-key path.
|
| 33 |
+
3. Update docs/ADRs/journal entries when public behavior or architecture changes.
|
| 34 |
+
4. Run:
|
| 35 |
+
|
| 36 |
+
```bash
|
| 37 |
+
uv run pytest tests/ -q
|
| 38 |
+
uv run ruff check .
|
| 39 |
+
```
|
| 40 |
+
|
| 41 |
+
5. Commit only when asked, with:
|
| 42 |
+
|
| 43 |
+
```text
|
| 44 |
+
Co-authored-by: Codex <codex@openai.com>
|
| 45 |
+
```
|
| 46 |
+
|
| 47 |
+
## What Belongs In User Config Instead
|
| 48 |
+
|
| 49 |
+
Keep these out of the repo-scoped config:
|
| 50 |
+
|
| 51 |
+
- Model/provider/auth settings.
|
| 52 |
+
- Telemetry endpoints.
|
| 53 |
+
- Personal notification commands.
|
| 54 |
+
- Broad command auto-approval rules.
|
| 55 |
+
- Machine-specific writable roots.
|
| 56 |
+
|