Retrieved article excerpt
Open article · Retrieved 2026-11-20T16:23:23.178292+00:00
# codex-local-audit
**Cross-platform (Windows, macOS, Linux), 100% read-only, offline forensic audit tool for local OpenAI Codex Desktop / CLI (`~/.codex/`) logs, SQLite databases, and installed client binaries.**
Both implementations — zero-dependency **Node.js** (`audit_codex.mjs`) and **Python 3** (`audit_codex.py`) — have full feature parity and inspect only your own local data to verify:
1. **Quota Compliance:** Actual 5-hour (`primary`) and 7-day (`secondary`) subscription usage vs. reasoning anomalies;
2. **Zero-Reasoning Suppression:** Frequency of `reasoning_output_tokens = 0` (with `0` reasoning blocks and `0` encrypted bytes) on flagship `high`/`ultra` requests — including the very first model call immediately after a user prompt;
3. **Quantized `516`-Token Cliff (`518k - 2` Harmonics):** Exact discontinuity check around `514..518` and multi-block harmonics (`1034`, `1552`, `2070`), cryptographically cross-checked against `encrypted_content` ciphertext byte lengths;
4. **Silent Default & Summary Flips:** Exact version/date timeline of `turn_context.summary` (`detailed` → `none`), server-pushed `configuration_update` effort downgrades, and bundled `models.json` defaults inside your installed `codex` binary;
5. **Local Storage & GDPR Hygiene (Arts. 5, 6, 15, 17, 32):** SQLite foreign keys and cleanup trigger inspection (`thread_history_1.sqlite`), unzeroed deleted SQLite freelist measurement (`logs_2.sqlite`), unencrypted local microphone retention (`dictation-history/`), and compiled telemetry flags (`codex_accepted_line_fingerprints`, `disable_analytics`).
---
## Safety & Privacy Guarantees
- **100% Read-Only:** Opens every SQLite database strictly in read-only mode (`{ readOnly: true }` / `?mode=ro`). Never writes to, modifies, or deletes anything inside `~/.codex/`.
- **100% Offline:** Zero network imports, zero HTTP/DNS/WebSocket calls.
- **Zero Credential Access:** Never reads `auth.json` or any token/key files.
- **Zero PII Output:** Never prints user prompts, assistant replies, source code, project names, local file paths, or account emails. Server `response_id` (`resp_...`) samples are omitted by default and only included if you explicitly pass `--include-ids`.
---
## Quick Start Guide (Windows, macOS, Linux)
Clone the repository (or download `audit_codex.mjs` / `audit_codex.py` directly):
```
git clone https://github.com/NeHumorist/codex-local-audit.git
cd codex-local-audit
```
### Option A: Node.js 22.15+ / 24+ (Recommended — Zero External Dependencies)
Uses built-in `node:zlib` (`zstdDecompressSync`) and `node:sqlite` (`DatabaseSync`). No `npm install` required.
**macOS / Linux:**
```
node audit_codex.mjs
```
**Windows (PowerShell):**
```
node .\audit_codex.mjs
```
> **Windows tip (no Node 24 installed globally?):** Codex Desktop already ships a local Node 24 runtime on Windows. You can invoke it directly without installing anything:
>
> ```
> $node24 = Get-ChildItem "$env:LOCALAPPDATA\OpenAI\Codex\runtimes\cua_node\*\bin\node.exe" | Select-Object -First 1 -ExpandProperty FullName
> & $node24 .\audit_codex.mjs
> ```
### Option B: Python 3.10+ (macOS / Linux / Windows)
Python 3.14+ includes `compression.zstd` in the standard library. On Python 3.10–3.13, run via [`uv`](https://docs.astral.sh/uv/) (or install `zstandard` / system `zstd`) to decompress `.jsonl.zst` session files:
```
# Recommended on Python 3.10–3.13 (auto-provides zstandard in an isolated ephemeral env)
uv run --with zstandard python audit_codex.py
# Or with Python 3.14+ / if zstandard or the `zstd` CLI is already installed
python3 audit_codex.py
```
### CLI Options (Identical in Both `.mjs` and `.py`)
| Flag | Description |
| --- | --- |
| `--codex-dir <dir>` | Custom path to `.codex` directory (default: `~/.codex`) |
| `--binary <path>` | Explicitly point to an installed `codex` / `codex.exe` binary (auto-detected on Windows, macOS, and Linux when omitted) |
| `--skip-binary` | Skip inspecting the installed client binary |
| `--json <file>` | Save an anonymized machine-readable JSON summary |
| `--markdown <file>` | Save an anonymized shareable Markdown table report |
| `--include-ids` | *(Off by default)* Include up to 10 sample server `response_id` (`resp_...`) values for `<80%`-quota zero-reasoning & `516`-cutoff events in `--json` / `--markdown` outputs (intended for private DSAR / regulator filings) |
### Examples
```
# Export a clean anonymized Markdown table to share or compare across platforms
node audit_codex.mjs --markdown my_audit_summary.md
# Export full anonymized JSON + sample server resp_... IDs for a private GDPR/consumer filing
node audit_codex.mjs --json my_evidence.json --include-ids
```
---
## How to Read the Output
1. **`[1] QUOTA COMPLIANCE`:** Checks whether your 5h (`primary`) and 7d (`secondary`) windows were actually exhausted. If most zero-reasoning or `516`-cutoff calls occurred while **both** windows were `<80%`, rate-limit exhaustion is ruled out.
2. **`[2] REASONING BREAKDOWN`:** Compare `Zero%`, `1stStepZero%` (the very first call after a user prompt), and `MedR` across months and models. Also reports any server-pushed `configuration_update` downgrades (e.g. `ultra` → `xhigh`) and `model_reroute` events.
3. **`[3] QUANTIZED 516-TOKEN CLIFF`:** Look at `515` vs `[516]` vs `517` and harmonics `1034`, `1552`, `2070` (`518k - 2`). If `MedEncryptedB` clamps around `~8,000 B` at `516` and `MedBlocks` jumps from `1.0` → `2.0` immediately at `517..700`, truncation is physically occurring at the 516-token block boundary.
4. **`[4] REASONING SUMMARY TIMELINE`:** Shows when `turn_context.summary` switched from `auto`/`detailed` to `none` and whether that flip happened across identical CLI versions.
5. **`[5] SQLITE, DICTATION & TELEMETRY HYGIENE`:**
- `foreign_keys=0` + `broken_projection_trigger=true` indicates `thread_realtime_items_projection_cleanup` only cleans `thread_realtime_items`, leaving `thread_turns`/`thread_items` without cascading deletes.
- `unzeroed_freelist` shows how much of `logs_2.sqlite` consists of deleted but unzeroed plaintext SQLite pages.
- `dictation-history/` reports count and age of unencrypted local microphone recordings (without reading transcripts).
- `cf_ray_pops` reports only 3-letter Cloudflare airport codes (e.g. `PRG`, `FRA`, `AMS`) for regional jurisdiction verification.
6. **`[6] INSTALLED CLIENT BINARY CHECK`:** Reads the official bundled `models.json` inside your installed `codex` binary (`default_reasoning_level`, `default_reasoning_summary`, `supports_ultra`) and checks whether `codex_accepted_line_fingerprints` is compiled in and whether any `disable_analytics` flag exists.
---
## Cross-Platform Reference Findings (macOS arm64 & Windows 11 x64)
Independently reproduced across multiple EU user installations (both macOS and Windows 11 x64, including signed Windows package `OpenAI.Codex_26.1111.2228.0_x64__2p2nqsd0c76g0`) well within subscription quotas:
### 1. Zero-Reasoning Suppression Under `<80%` Quota
- In an audited Windows dataset (**215 session rollouts, `34,523` deduplicated server calls, Jul–Nov 2026**, `plus` tier), median usage was **34%** (5h) and **39%** (7d), reaching 100% in only `0.37%` (5h) and `0.09%` (7d) of calls.
- **73.4%** (`2,848 / 3,878`) of zero-reasoning calls on `high`/`ultra` occurred while **both** quota windows were `<80%`.
- On `gpt-6.1-sol::ultra` (which officially lists `"ultra"` in `supported_reasoning_levels` inside signed `codex.exe`), zero-reasoning on the **first step after a user prompt** jumped from **0.0%** in Aug–Sep (`0 / 238`) to **40.0%–80.0%** (`47.6%` / `151 / 317` in October 2026), including 3,000–8,000-token code outputs emitted with `reasoning_output_tokens = 0` and `0` reasoning blocks.
- On `gpt-6.1-terra::ultra` in November 2026 (`2,002` calls), zero-reasoning reached **24.2%** with a median of **21 reasoning tokens**, alongside 4 server-emitted `configuration_update` downgrades (`ultra` → `xhigh`).
### 2. Quantized `516`-Token Cliff (`518k - 2` Harmonics) Proven via Ciphertext Length
Across `34,523` calls: `514` (`16×`), `515` (`15×`), **`516` (`1,498×` — 100× cliff)**, `517` (`2×`), `518` (`2×`), plus exact multi-block harmonics at `1034` (`364×`), `1552` (`98×`), and `2070` (`41×`).
| Bucket (`gpt-6.1-sol::ultra`) | Calls (`N`) | Median Reasoning Blocks | Median `encrypted_content` | P90 `encrypted_content` |
| --- | --- | --- | --- | --- |
| `rTok == 0` | 3,018 | 0.0 | 0 B | 0 B |
| `rTok 501..515` | 151 | 1.0 | 7,948 B | 8,688 B |
| **`rTok == 516`** | **1,467** (`1,410` single-block) | **1.0** | **8,036 B** | **8,504 B** |
| `rTok 517..700` | 653 | **2.0** (block jump) | 10,584 B | 11,736 B |
| **`rTok == 1034`** | **352** (`336` two-block) | **2.0** | **15,748 B** | **16,900 B** |
| **`rTok == 1552`** | **92** (`85` three-block) | **3.0** | **23,238 B** | **25,168 B** |
| **`rTok == 2070`** | **38** (`33` four-block) | **4.0** | **32,012 B** | **42,876 B** |
### 3. Signed Binary Defaults (`low` / `none`) & Synchronized Summary Flip
- Bundled `models.json` inside signed `codex.exe` (offset `0x120ae528`) ships `"default_reasoning_level": "low"` and `"default_reasoning_summary": "none"` for `gpt-6-astra`, `gpt-6.1-sol`, and `gpt-6.1-terra`, despite `"supports_reasoning_summaries": true`.
- `turn_context.summary` flipped globally from `detailed` (`924` turns) to `none` (`466` turns) on **2026-10-22** across identical CLI builds (`0.159.0` and `0.162.0-alpha.17.2`) without a client update.
### 4. Local Storage, Erasure & Telemetry Defects (GDPR Arts. 5, 6, 15, 17, 32)
- **Incomplete SQLite Deletion Trigger (`thread_history_1.sqlite`):** `thread_realtime_items_projection_cleanup` deletes only from `thread_realtime_items`; all four tables have **0** `FOREIGN KEY ... ON DELETE CASCADE` constraints.
- **Unzeroed SQLite Freelist (`logs_2.sqlite`):** Up to **91.8%** (`66.9 MB` of `72.9 MB`) consists of unzeroed deleted freelist pages (no `PRAGMA secure_delete = ON` / `VACUUM`).
- **Unencrypted Microphone Recordings (`dictation-history/`):** Raw `audio/webm;codecs=opus` voice chunks and JSON transcripts remain unencrypted on disk without automatic TTL purge (observed retained 54+ days).
- **Telemetry Without `disable_analytics`:** `POST /backend-api/codex/analytics-events/events` (`codex_accepted_line_fingerprints` compiled into `codex.exe`), OTLP to `ab.chatgpt.com/otlp/v1/metrics`, and local `shadow_selection_experiment` execute with `disable_analytics` absent from the binary.
---
## Non-Findings & Explicitly Ruled-Out Claims
To maintain strict engineering rigor, this repository **explicitly excludes** several commonly misinterpreted artifacts observed during community reverse-engineering:
| Artifact / Header | Why It Is Excluded from Degradation / Security Claims |
| --- | --- |
| `codex.response.receive_wait_ms` | Emitted on every `handle_output_item_done` (`reasoning`, `message`, `function_call`); measures per-item stream channel wait (down to `0.0046 ms` when buffered), **not** prompt Time-to-First-Token (TTFT). |
| `x-codex-safety-buffering-faster-model` | Verified in `codex.exe` (`safety_buffering.rs`) and `app.asar`: supplies the model slug for the optional UI button *"Retry with a faster model"* during safety buffering — it does **not** silently auto-swap the model mid-turn. |
| `wham/remote/control` | Verified in `codex.exe` (`remote_control_cmd.rs`) and `app.asar`: standard Remote Control / device-pairing feature gated by MFA and TPM/device-key challenge — **not** a "backdoor". (Any GDPR concern is strictly limited to whether enrollment occurred without opt-in consent.) |
| `shadow_selection_experiment` | Verified in `ext/skills/src/shadow_selection_experiment/mod.rs`: local benchmark comparing 5 lexical/BM25/ngram rankers over installed `SKILL.md` files — unrelated to model throttling. |
| Silent `gpt-6-astra -> gpt-6-luna` reroutes in Codex | Audited datasets showed `0` `model_reroute` events. Backgrou