Skip to content

🪢 Open source agent evals & observability: Trace, evaluate, and improve LLM applications with one open platform.

chore: document Codex environment setup and add bootstrap scripts (#12471)

Max Deichmann22ee870d29bc
diff --git a/AGENTS.md b/AGENTS.md
index da31bb0480..44eb618b69 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -89,6 +89,7 @@ Minimum verification matrix:
- Root `AGENTS.md` is monorepo-level only.
- Package-local runbooks, commands, and entry points belong in package `AGENTS.md` files.
- Keep guidance DRY: canonicalize to the most specific file.
+- Repo-owned Codex cloud bootstrap lives in `scripts/codex/setup.sh` and `scripts/codex/maintenance.sh`; contributors still configure the actual environment in the Codex UI.
## Release Channel
- Release workflow is managed at root (`pnpm run release`).
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index dcdf9cc452..2377c24ca8 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -115,9 +115,49 @@ Requirements
- Docker to run the database locally
- Clickhouse client
-**Note:** You can also simply run Langfuse in a **GitHub Codespace** via the provided devcontainer. To do this, click on the green "Code" button in the top right corner of the repository and select "Open with Codespaces".
-
-**Steps**
+**Note:** You can also simply run Langfuse in a **GitHub Codespace** via the provided devcontainer. To do this, click on the green "Code" button in the top right corner of the repository and select "Open with Codespaces".
+
+### Codex Cloud Setup
+
+You can also attach this repository to an OpenAI Codex cloud environment. The
+cloud environment itself is configured in the Codex UI, while the repo-owned
+bootstrap is versioned in:
+
+- `scripts/codex/setup.sh`
+- `scripts/codex/maintenance.sh`
+
+Recommended Codex UI configuration:
+
+1. Create a new cloud environment for this repository in the Codex UI.
+2. Choose a base environment with Node.js 24 support.
+3. Set the setup script to:
+
+ ```bash
+ bash scripts/codex/setup.sh
+ ```
+
+4. Set the maintenance script to:
+
+ ```bash
+ bash scripts/codex/maintenance.sh
+ ```
+
+5. Keep internet access disabled by default, or only allow the minimum domains
+ needed for your task.
+6. Add secrets and environment variables in the Codex UI instead of committing
+ them to the repository.
+
+Notes:
+
+- This Codex setup is intended for repository tasks such as code changes,
+ linting, typechecking, and targeted tests.
+- It does **not** start the full Langfuse stack. Local development still uses
+ Docker and `pnpm run dx` / `pnpm run dev`.
+- Running the full application inside Codex requires external services for
+ PostgreSQL, Redis, ClickHouse, and object storage, plus matching environment
+ variables in the Codex UI.
+
+**Steps**
1. Install development dependencies:
- [golang-migrate](https://github.com/golang-migrate/migrate/tree/master/cmd/migrate#migrate-cli) as CLI
diff --git a/scripts/codex/maintenance.sh b/scripts/codex/maintenance.sh
new file mode 100755
index 0000000000..6ed6b348fd
--- /dev/null
+++ b/scripts/codex/maintenance.sh
@@ -0,0 +1,16 @@
+#!/usr/bin/env bash
+
+set -euo pipefail
+
+if ! command -v corepack >/dev/null 2>&1; then
+ echo "corepack is required. Use a Codex base environment with Node.js 24 support."
+ exit 1
+fi
+
+corepack enable
+corepack prepare [email protected] --activate
+
+pnpm install --frozen-lockfile
+
+# Keep generated Prisma artifacts aligned after dependency or schema updates.
+pnpm run db:generate
diff --git a/scripts/codex/setup.sh b/scripts/codex/setup.sh
new file mode 100755
index 0000000000..4eeae9d8ef
--- /dev/null
+++ b/scripts/codex/setup.sh
@@ -0,0 +1,24 @@
+#!/usr/bin/env bash
+
+set -euo pipefail
+
+if ! command -v corepack >/dev/null 2>&1; then
+ echo "corepack is required. Use a Codex base environment with Node.js 24 support."
+ exit 1
+fi
+
+corepack enable
+corepack prepare [email protected] --activate
+
+if [ ! -f .env ]; then
+ cp .env.dev.example .env
+fi
+
+if [ ! -f .env.test ]; then
+ cp .env.test.example .env.test
+fi
+
+pnpm install --frozen-lockfile
+
+# Prisma client generation is needed for typecheck/build tasks in Codex.
+pnpm run db:generate