anosys-codex
Python integration for Codex CLI turn-completion telemetry. It reads local rollout transcripts, maps messages and tool calls to AnoSys fields, and reports available token counters and estimated cost.
Requires Python 3.10 or later. This package uses the Codex notify callback; it does not register lifecycle hooks under /hooks.
Install and configure
pip install anosys-codex
anosys-codex install
The installer asks for an ingestion key from an AnoSys Claude Code & Codex CLI (CC) endpoint and permission to update the user-level Codex configuration. It backs up the configuration and writes the ingestion key to $CODEX_HOME/anosys-env.sh (readable only by you). CODEX_HOME defaults to ~/.codex.
For non-interactive setup:
anosys-codex install --api-key "your-cc-endpoint-key" --auto-update --yes
API-key validation produces a warning on failure; it does not prevent installation. Verify the endpoint key and delivery independently.
Notification command
The installer registers this Python interpreter by absolute path, so Codex can run the hook without activating a virtual environment:
notify = ["/path/to/python", "-m", "anosys_sdk_codex.hook_runner"]
If another notifier was already configured, it is kept and called after AnoSys (--previous-notify); uninstall restores it.
Restart Codex and complete a CLI turn. Check $CODEX_HOME/state/anosys_hook.log for callback execution and delivery errors. The status command checks registration, not network delivery.
The notify callback is separate from lifecycle hooks displayed by /hooks. See the official Codex notification documentation.
Privacy
By default the hook sends metadata only: ids, timestamps, models, token and cost numbers, durations, tool names, and the project, branch and OS username. Prompts, answers, tool output, commands and file contents are sent only after you accept the data-collection policy:
anosys-codex privacy # show the current level and where it comes from
anosys-codex privacy full # read and accept the policy, then send full content
anosys-codex privacy off # keep the hook installed but send nothing
anosys-codex doctor # installed copies, the active hook and local files
anosys-codex purge # delete the local queue and logs
The hook reads only the session that just ended, never earlier history, and its log holds ids and sizes only. The old --redaction flag and REDACTION=true still work and mean metadata. See content controls for the 10 MB request limit, retries and encryption.
Runtime behavior
The runner finds a rollout file under $CODEX_HOME/sessions, maps the completed turn, and posts it to https://api.anosys.ai/ingestion in requests under 10 MB. Transient failures wait in $CODEX_HOME/state/pending_records.jsonl (at most 24 hours, 5 attempts, 50 MB); rejected requests are not retried.
Token usage and cost depend on the transcript fields and the package's embedded pricing table. Treat cost as an estimate. This package targets local Codex CLI transcripts; do not assume that a desktop or cloud session invokes the same callback.
Environment variables
| Variable | Purpose |
|---|---|
| ANOSYS_HOOK_APIKEY | Runtime ingestion key; also loaded from anosys-env.sh |
| ANOSYS_API_KEY | Accepted by the installer as a source for the saved ingestion key |
| ANOSYS_HOOK_ENDPOINT_URL | Ingestion URL override |
| ANOSYS_DISABLE | 1 to send nothing |
| ANOSYS_COLLECTION_LEVEL | off, metadata or full (full still needs accepted consent) |
| ANOSYS_ENCRYPTION_KEY | Enable selected-field encryption |
| ANOSYS_ENCRYPTION_SALT | Workspace salt shown in the AnoSys console |
| ANOSYS_ENCRYPTED_COLUMNS | Override the default encrypted columns |
| ANOSYS_MAX_BATCH_BYTES | Request size limit (default 10000000) |
| ANOSYS_HOOK_DRY_RUN | true to skip network submission |
| CODEX_HOME | Codex configuration, session, and state directory |
See content controls for encryption details. Dry-run mode is a network diagnostic; it does not confirm server ingestion.
Commands
- install: configure the ingestion key and notification entry.
- status: inspect expected registration and the environment file.
- uninstall: remove the installer's recognized notification entry and environment file. Remove a manually configured module entry yourself.
- run: receives the Codex notification JSON and executes the turn-completion handler.
Anosys.ai MCP server and skill
Let Codex read your Anosys.ai workspace (architecture, problems, evals, traces and read-only SQL) through the Anosys.ai MCP server, and install the anosys-platform-intelligence skill. Create an MCP key (ak_mcp_...) in the Console under My Profile → MCP Keys; your ingestion key does not work here.
export ANOSYS_MCP_API_KEY=ak_mcp_...
# Add it when you install the hook
anosys-codex install --api-key YOUR_INGESTION_KEY --with-mcp --auto-update --yes
# Or on its own
anosys-codex mcp install -y
anosys-codex mcp status
anosys-codex mcp uninstall
With --workspace the server goes in the project's .codex/config.toml, which refers to ANOSYS_MCP_API_KEY instead of storing the key, so it is safe to commit. Use --skill-only to install just the skill. All options and other tools: anosys-sdk-mcp.
License
Apache License 2.0.
Metadata
Release files for anosys-codex 0.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| anosys_codex-0.3.0.tar.gz | 23.8 kB | Without provenance | Details for anosys_codex-0.3.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| anosys_codex-0.3.0-py3-none-any.whl | Python 3 | none | any | Details for anosys_codex-0.3.0-py3-none-any.whl |
Total release size: 44.9 kB
Release files / anosys_codex-0.3.0.tar.gz
| Download URL | anosys_codex-0.3.0.tar.gz |
|---|---|
| Size | 23.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2fc819c0c45315c7c9102983aeff15ec1de424337f7e6b00b45cfd8fa974e92e
|
|
BLAKE2b-256 checksum How to use checksums |
b650419f44cada6c70e2872c4ae8e2b099a8ebb2dbbaf40ff93d3d377125fd9a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Release files / anosys_codex-0.3.0-py3-none-any.whl
| Download URL | anosys_codex-0.3.0-py3-none-any.whl |
|---|---|
| Size | 21.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0af1d1b8d4d3a7753f72521cb2c36c980bf9edfd9fedce8f991f62027254e144
|
|
BLAKE2b-256 checksum How to use checksums |
8e2c979b185c03fbbc28c9bc5691547624e1b7f13b243a34b5301b7c1e2fdc32
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Security for anosys-codex 0.3.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.