weave-telemetry.js and registers it on Stop, SubagentStop, SessionEnd, PreCompact, and UserPromptSubmit.
The Codex page covers cost, OpenAI-direct API usage, and how Codex shows up in Weave metrics. This page is the install: the command, hook trust prompt, content categories, and fleet rollout.
What’s tracked
- Usage and cost — tokens, models, and credit consumption from Codex’s native OTLP export
- Prompts — prompt submissions and (optionally) prompt text for activity classification
- Tool calls — tool name, commands, and results
- Agent messages — Codex replies and reasoning summaries (hooks; requires hook trust and the
agent_messagescategory) - Git context — branch and repository remote on prompt rows (hooks)
- File changes — the files each turn changed and their diff hunks, including files written by shell commands, which Codex does not report itself (hooks; requires the
tool_ioandfile_pathscategories) - Install health — a per-machine ping so you can confirm each developer is reporting
What it unlocks
- Per-developer, per-session granularity — attribute Codex activity to individual machines and ChatGPT login emails
- AI skills — conversation scoring reads agent message text from the hooks
- Install health monitoring — see which machines have the plugin installed and reporting
- Easy rollout — a single install command per machine, with hourly auto-update of
weave-telemetry.js
Prerequisites
- Codex CLI installed (the installer creates
~/.codexif needed) - Node.js 18 or later on each machine (the hooks run on Node)
- A Weave install token (created in the steps below)
Setup
1
Create an install command in Weave
Go to Data → Codex → Connect (if Weave asks How do you use Codex?, pick your plan and click Install Weave Plugin). If you can’t open that page, open Personal plugin setup on the Data page and choose Codex. The page is titled Install Weave for Codex. Admins click Create install command for a shared token; any signed-in member can click Create my personal command instead. Weave shows the full token once, plus macOS/Linux and Windows one-liners and downloadable scripts.
2
Run the install command on each machine
Copy the command from the modal. Weave fills in your token, ingest endpoint, environment, and org content-category flags. It looks like:macOS / Linux:Windows (PowerShell):The installer writes a managed block into
~/.codex/config.toml (native OTLP export + hook registrations), downloads weave-telemetry.js to ~/.weave/codex-plugin/, and writes ~/.weave/codex-plugin.json (token, endpoint, content policy).3
Restart Codex and trust the hooks
Restart Codex. On first start after install, Codex asks you to review the new hooks. Choose Trust all and continue. See Hook trust prompt.
/api/codex/plugin/version and refresh weave-telemetry.js. A successful install prints ✓ Verified telemetry pipe — install_ping received by Weave. on macOS/Linux, or Verified telemetry pipe - install_ping received by Weave. on Windows PowerShell. An MDM-deployed hook does not auto-update — poll that version endpoint and redeploy when the version or hash changes.
The full install sets log_user_prompt = false on Codex’s native exporter so prompt text is not double-sent; prompts and git context come from the UserPromptSubmit hook instead.
Hook trust prompt
The installer registers five Codex hooks (Stop, SubagentStop, SessionEnd, PreCompact, and UserPromptSubmit). Codex will not run a newly added hook until you have reviewed it once, so the first start after install shows a hook review prompt. Choose Trust all and continue.
This happens once per machine. Codex records approval as a trusted_hash under [hooks.state] in config.toml and derives that hash itself — the installer cannot pre-approve hooks.
Until the hooks are trusted, Codex still reports tokens, cost, prompts, and tool calls through native OTLP; only agent messages (and git context on prompt rows) are missing, so AI skills conversation scores will not appear.
Personal install command
Org-shared commands attribute usage by matching the ChatGPT/OpenAI login email to a Weave account. If those emails differ, click Create my personal command instead. The key is scoped to your Weave account, so telemetry attributes to you without email matching. If some Codex logins still cannot be matched, admins see an unlinked Codex users banner listing unattributed usage from the last 30 days. Link each ChatGPT login email to the right Weave member (historical usage is not backfilled). Admins can also link OpenAI users from the Members page via the OpenAI icon in the connections column. The installer fills in the developer’s email from Git or an explicit--user-email (-UserEmail on Windows). If you configure native telemetry by hand with a shared Weave token and Codex omits the account email, add that developer’s email as "X-Weave-User-Email" alongside "X-Weave-Token" in the exporter headers.
Optional Codex marketplace plugin
The hosted install command is the supported customer path. The Codex plugin is available for employees and local development while marketplace distribution remains private:- Add the marketplace:
- Open the plugin browser with
/pluginsand install Weave Telemetry - Run the
install-weave-telemetryskill to finish setup
Content categories
What Weave stores is governed by five categories, the same set the Claude Code plugin and Cursor plugin use. The install command Weave generates already includes your org floor. Members can opt out further, but not back in past that floor.
Pass
false to deny a category. --privacy-mode true denies all five at once.
agent_messages governs the agent prose the hooks capture. With it denied, Weave still records that Codex responded (timestamps, model, message length) but stores none of the text, so sessions are not scored for AI skills.
Fleet / MDM rollout
Use MDM / fleet deployment (advanced) instead of the regular installer when IT manages hook approval. On the Codex setup page, choose Add connection → Set up for my organization and keep Direct to Weave (default) selected. The advanced section provides four downloads.requirements.tomlenables the Weave hooks and sets their script paths. Merge the settings into existing policy and keep the file admin-owned.- macOS:
/etc/codex/requirements.toml - Linux:
/etc/codex/requirements.toml - Windows:
%ProgramData%\OpenAI\Codex\requirements.toml
- macOS:
weave-telemetry.jsgoes at the path declared inrequirements.toml. Use the absolute path to your managed Node.js 18+ executable in the hook command and keep the script admin-owned.- macOS:
/opt/weave/codex-hooks/weave-telemetry.jsby default - Linux:
/opt/weave/codex-hooks/weave-telemetry.jsby default - Windows:
C:\ProgramData\Weave\codex-hooks\weave-telemetry.jsby default
- macOS:
managed_config.tomlsets the native OpenTelemetry exporter as a startup default. It contains the organization token. Keep it admin-owned and limit read access to the Codex users who need it.- macOS:
/etc/codex/managed_config.toml - Linux:
/etc/codex/managed_config.toml - Windows:
%USERPROFILE%\.codex\managed_config.tomlon older builds only. Current Windows Codex ignores this file.
- macOS:
codex-plugin.jsongoes in each developer’s profile. Replaceweave_user_emailwith their work email so Weave can link agent messages to their account. Deploy a private copy owned by that developer.- macOS:
~/.weave/codex-plugin.json, mode600 - Linux:
~/.weave/codex-plugin.json, mode600 - Windows:
%USERPROFILE%\.weave\codex-plugin.json, access restricted to the developer
- macOS:
/api/codex/plugin/version and redeploy it through MDM when it changes.
Running the Windows installer from an MDM
If you’d rather push the regular install command than the managed artifacts, runinstall.ps1 as the signed-in Windows user, not as SYSTEM. It writes to %USERPROFILE%\.codex\config.toml (or %CODEX_HOME% when set) and %USERPROFILE%\.weave\, so a SYSTEM run configures the SYSTEM profile instead of the developer’s. Each developer still sees the hook trust prompt once, and the hook runtime auto-updates as with a manual install.
In JumpCloud, use the Windows - Run As Signed In User template. In Intune, set Run this script using the logged on credentials to Yes. Save install.ps1 to a user-accessible location and invoke it with -File. Under iwr | iex, the script doesn’t exit nonzero on failure, so your MDM would report success even when nothing was installed. With -File, a failed install exits with code 1:
WEAVE_* environment variables that command sets. The token is required on every run.
The installer records the developer’s email for attribution. It uses -Email (or WEAVE_USER_EMAIL) when you pass it and otherwise falls back to git config user.email, and it stops if neither gives an email address. Pass -Email from your MDM’s per-user variables when the developer’s Git email isn’t set or isn’t their Weave email.
Uninstall
macOS / Linux:iwr ... | iex, so save the script and run -Remove:
--remove / -Remove strips the Weave-managed block from ~/.codex/config.toml and deletes ~/.weave/codex-plugin/ plus ~/.weave/codex-plugin.json. User-authored [features] keys and hooks are left in place. Uninstall does not revoke the API key.
Metrics enabled
Once reporting, the plugin feeds:- AI code LOC — lines generated by Codex
- AI output percentage — portion of output from Codex
- AI efficiency index — impact on productivity
- AI tool costs — Codex spend per engineer (credit volume from telemetry, priced at the rate you configure)
- PR AI cost — estimated Codex cost behind each pull request
- AI skills — per-conversation scoring of how well engineers work with Codex
Cost tracking
Plugin telemetry supplies credit/token volume. Dollar cost uses the credit rate in Settings → Financial → Tool subscription costs. See Codex. For OpenAI API calls made outside Codex, connect an OpenAI admin API key on the Codex page.Sync frequency
Native OTLP and hook events are sent as Codex emits them during a session.Troubleshooting
Installer can't find Node
Installer can't find Node
The hooks require Node.js 18+. Install it (
brew install node, nvm, or your platform’s package manager) and re-run the command. The installer searches PATH and common version-manager locations (mise, asdf, nvm, Volta, fnm, Homebrew); pass NODE_BIN to pin a binary.Install finished but Weave shows nothing
Install finished but Weave shows nothing
Confirm the installer printed
✓ Verified telemetry pipe — install_ping received by Weave. (macOS/Linux) or Verified telemetry pipe - install_ping received by Weave. (Windows). Then restart Codex and choose Trust all and continue. Tokens and cost can still flow before hooks are trusted; agent messages (and AI skills) wait on trust.No AI skills scores after install
No AI skills scores after install
- Confirm you chose Trust all and continue at the hook review prompt
- Check
[hooks.state]in~/.codex/config.tomlfor atrusted_hash - Restart Codex after trusting
- Until hooks are trusted, tokens and prompts still flow; only agent messages are missing
Usage is not attributed to a Weave member
Usage is not attributed to a Weave member
Use Create my personal command, or add
"X-Weave-User-Email" to the OTLP headers, or link the ChatGPT login email from the unlinked-users banner / Members page.Data privacy
The plugin sends session metadata, token and credit usage, tool usage, and — unless the matching content category is denied — prompt text, agent messages, tool I/O, file paths, and git context. To record what each turn changed, the hooks snapshot the repository’s working tree when a turn starts and when it ends, and send the diff between the two. A snapshot covers files git tracks or would track; ignored files are never read. It runsgit ls-files, then git add and git write-tree against a private index and object store in an owner-only folder in the system temp directory, so your repository’s index, HEAD, refs, objects and stash are never written. Clean filters set in .gitattributes, such as Git LFS, run on changed files as they do on git add. The snapshot is deleted when the turn ends. The plugin also records the files of each commit the turn made, in this repository and in any other worktree the agent ran commands or edited files in during the turn, using read-only git log -g (HEAD’s reflog) and git diff-tree. Those folders come only from the session transcript’s records of the agent’s own tool calls (the folder each command ran in, edited file paths, and cd/git -C targets in its commands), never from tool output or file contents. A session started outside any git repository still gets those commits. That covers changes only a commit shows, such as git rm --cached on a file that stays on disk. Commits that a pull, checkout or reset brings in are not the turn’s and are left out. A turn is skipped when its uncommitted files exceed 2,000 files or 50 MB, when the snapshot takes longer than three seconds, or when tool_io or file_paths is denied or privacy mode is on. Edits made in the same checkout during a turn (by you or another session) are included in that turn’s diff.
Related integrations
- Codex — cost configuration and OpenAI-direct API usage
- Claude Code plugin — the equivalent per-machine plugin for Claude Code
- Cursor plugin — the equivalent per-machine plugin for Cursor
- Copilot plugin — Copilot Chat OTEL export to Weave
