Foresight for Codex · local-first
Install once. Use Codex normally.
Foresight adds local execution contracts, protected-path rules, audit history, and an optional local dashboard to a Codex repository. It does not send session data to a hosted Foresight service.
1. Install
python -m pip install --upgrade foresight-agent-guard==0.1.23
2. Set up a repository
foresight setup --codex --preview foresight setup --codex codex
Review Foresight's project-local Codex hooks through Codex's normal hook-review flow. After setup, open codex as usual.
3. Try it without an API key
foresight demo --replay
The committed replay is zero-cost and shows allowed work, scope monitoring, protected-path enforcement, and a local audit export.
4. Enable GPT-backed contracts (optional)
OPENAI_API_KEY=your-key-here
Put that line in a private .env file at the repository root. Foresight uses one structured GPT-5.6 Terra compilation call at contract start, then records its own token-derived cost locally. No key is required for baseline protection, replay, or audit history.
5. Review the local audit
foresight status foresight dashboard
The local dashboard reloads persisted contracts from .foresight/history. Foresight API cost is the exact token-derived cost of Foresight's model calls; Codex native quota is shown as unavailable because Codex does not expose machine-readable billing.
Supported for this release
Submission-validated on Windows 10/11, Python 3.11/3.12, and Codex CLI. The package can install on macOS/Linux, but its Codex integration is not submission-validated there.