{"id":48450194,"url":"https://github.com/getaxonflow/axonflow-codex-plugin","last_synced_at":"2026-05-07T22:04:28.901Z","repository":{"id":349516555,"uuid":"1202664498","full_name":"getaxonflow/axonflow-codex-plugin","owner":"getaxonflow","description":"AxonFlow governance plugin for OpenAI Codex — advisory policy checks, PII scanning, and audit trails via governance skills and MCP tools","archived":false,"fork":false,"pushed_at":"2026-04-16T11:57:21.000Z","size":171,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-04-16T13:27:19.989Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/getaxonflow.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-04-06T09:11:21.000Z","updated_at":"2026-04-16T11:56:23.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/getaxonflow/axonflow-codex-plugin","commit_stats":null,"previous_names":["getaxonflow/axonflow-codex-plugin"],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/getaxonflow/axonflow-codex-plugin","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/getaxonflow%2Faxonflow-codex-plugin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/getaxonflow%2Faxonflow-codex-plugin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/getaxonflow%2Faxonflow-codex-plugin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/getaxonflow%2Faxonflow-codex-plugin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/getaxonflow","download_url":"https://codeload.github.com/getaxonflow/axonflow-codex-plugin/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/getaxonflow%2Faxonflow-codex-plugin/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31971500,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-18T00:39:45.007Z","status":"online","status_checked_at":"2026-04-18T02:00:07.018Z","response_time":103,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-04-06T20:02:47.595Z","updated_at":"2026-05-07T22:04:28.891Z","avatar_url":"https://github.com/getaxonflow.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# AxonFlow Plugin for OpenAI Codex\n\n**Runtime governance for OpenAI Codex: hard-enforce policy on every terminal command, guide Codex through skills for non-terminal tools, and keep a compliance-grade audit trail — without changing how you use Codex.**\n\n[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](./LICENSE)\n\n\u003e **→ Full integration walkthrough:** **[docs.getaxonflow.com/docs/integration/codex](https://docs.getaxonflow.com/docs/integration/codex/)** — architecture, the hybrid governance model, policy examples, troubleshooting, and the 15 MCP tools the platform exposes.\n\n\u003e **Upgrade strongly recommended.** AxonFlow ships substantial monthly security and quality hardening; staying on the latest major is the security-supported release line. [Latest release](https://github.com/getaxonflow/axonflow-codex-plugin/releases/latest) · [Security advisories](https://github.com/getaxonflow/axonflow-codex-plugin/security/advisories)\n\n---\n\n## Why you'd add this\n\nOpenAI Codex is a cloud-based agentic coding platform with sandboxed execution, MCP server support, and a composable skill system. It's excellent at agent-driven software delivery. It was never designed to be the layer where your security and compliance team lives.\n\nThe gaps start surfacing the moment Codex runs anywhere near production:\n\n| Production requirement | Codex alone | With this plugin |\n|---|---|---|\n| Policy enforcement on terminal commands | PreToolUse hooks available, no logic | **Hard-enforced: dangerous commands blocked with exit code 2** |\n| Policy checks for non-terminal tools | Not available | **Advisory via skills — Codex instructed to call `check_policy` before Write/Edit/MCP** |\n| PII / secrets in tool outputs | Not addressed | **Auto-scan on terminal outputs; skills guide detection on others** |\n| SQL-injection detection on MCP queries | MCP server's problem | **30+ patterns available via `check_policy` MCP tool** |\n| Compliance-grade audit trail | Execution logs, not compliance-formatted | **Every governed terminal call recorded with policies, decision, duration** |\n| Decision explainability after a block | Generic hook failure | **`decision_id` in stderr; `explain_decision` MCP tool returns the full record** |\n| Self-service, time-bounded exceptions | Not available | **`create_override` with mandatory justification, fully audited** |\n\nThe unique thing about Codex is that **not every tool can be hooked** — only terminal commands (`exec_command`) fire PreToolUse. This plugin is honest about that split, and uses a hybrid model that makes the boundary usable instead of fuzzy.\n\n---\n\n## The hybrid governance model\n\nCodex governance has two sides. AxonFlow spans both, but they are enforced differently — being explicit about this is what turns the plugin into something a platform team can reason about instead of a fuzzy \"guardrails\" story.\n\n| Tool class | Mechanism | Enforcement |\n|---|---|---|\n| **Bash / `exec_command` / shell** | PreToolUse hook → `check_policy` | **Hard-enforced.** Exit code 2 blocks execution before it starts. Cannot be bypassed. |\n| **Write, Edit, MCP tools** | Governance **skills** instruct Codex to call `check_policy` before acting | **Advisory.** The skill guides, Codex decides. Skills support implicit activation when the task matches. |\n| **Audit trail** | PostToolUse hook (terminal) + skills (others) | Automatic for terminal, skill-guided for everything else |\n\nBoth paths converge on the **same explainability and override surface** — a blocked `exec_command` and a blocked-by-skill MCP write can both be investigated with `explain_decision` and unblocked with `create_override` when policy allows. That's what a senior platform engineer needs to evaluate this: the enforced path and the advisory path share one audit story.\n\n---\n\n## How it works\n\n### Terminal commands (enforced)\n\n```\nCodex selects exec_command / shell\n    │\n    ▼\nPreToolUse hook fires automatically\n    │ → check_policy(\"codex.exec_command\", \"curl 169.254.169.254\")\n    │\n    ├─ BLOCKED (exit 2) → command never runs; decision_id in stderr\n    │\n    └─ ALLOWED (exit 0) → command executes\n                      │\n                      ▼\n                 PostToolUse hook\n                      │ → audit_tool_call(tool, input, output)\n                      │ → check_output(result for PII/secrets)\n```\n\n### Other tools (advisory via skills)\n\n```\nCodex selects Write / Edit / MCP tool\n    │\n    ▼\nGovernance skill activates (implicit or explicit via @axonflow)\n    │ → Codex calls check_policy(\"codex.Write\", file content)\n    │\n    ├─ Policy says blocked → Codex is instructed not to proceed\n    └─ Policy says allowed → Codex proceeds → audit skill records action\n```\n\n---\n\n## Where this kicks in during real use\n\n### 1. The dangerous-command problem (enforced path)\n\nA developer tells Codex *\"clean up old test data.\"* Codex selects `exec_command` and runs a destructive rm. That's the kind of mistake hooks exist for.\n\n**With the plugin:** PreToolUse fires before `exec_command` runs, the command is evaluated against 80+ policies (reverse shells, credential access, cloud metadata SSRF, path traversal, SQL-injection patterns), and blocked with exit 2 if it violates policy. The decision ID lands in stderr so Codex can call `explain_decision` and, if appropriate, `create_override`.\n\n### 2. The MCP query that returns too much (advisory path)\n\nCodex queries a database MCP server for \"recent orders\" and gets back a response with customer emails and phone numbers. Skills-side governance can't *force* a check, but it can make the check the path of least resistance.\n\n**With the plugin:** the `pii-scan` and `post-execute-audit` skills implicitly activate on MCP-returning tasks. Codex calls `check_output` against AxonFlow, which returns either a clean pass or PII-match details the model should honor. Every call is also auditable by running `search_audit_events` later.\n\n### 3. The converged unblock story\n\nA `exec_command` is blocked mid-session because a production pattern matched. The developer wants to proceed.\n\n**With the plugin:** Codex reads the decision ID from stderr, calls `explain_decision` to surface the policy family, and if the decision allows overrides, calls `create_override` with justification. The override is time-bounded and fully audited. Same workflow if the block came from an advisory skill path — converged UX, one audit story.\n\n---\n\n## Try AxonFlow on a real plugin rollout\n\nWe're opening limited **Plugin Design Partner** slots.\n\n30-minute hook lifecycle review, policy pack scoping, override workflow design, and IDE/CLI rollout pattern walkthrough — for solo developers and small teams putting governance on Codex.\n\n[Apply here](https://getaxonflow.com/plugins/design-partner?utm_source=readme_plugin_codex) or email [design-partners@getaxonflow.com](mailto:design-partners@getaxonflow.com). Personal email is fine — solo developers welcome.\n\n### See AxonFlow in Action\n\nThree short videos covering different angles of the platform:\n\n- **[Community Quickstart Demo (Code + Terminal, 2.5 min)](https://youtu.be/BSqU1z0xxCo)** — governed calls, PII block, Gateway Mode with LangChain/CrewAI, and MAP from YAML\n- **[Runtime Control Demo (Portal + Workflow, 3 min)](https://youtu.be/6UatGpn7KwE)** — approvals, retry safety, execution state, and the audit viewer\n- **[Architecture Deep Dive (12 min)](https://youtu.be/Q2CZ1qnquhg)** — how the control plane works, policy enforcement flow, and multi-agent planning\n\n### Plugin Evaluation Tier (Free 90-day License)\n\nOutgrown Community on a real plugin install? Evaluation unlocks the capacity and features that matter for plugin users — without moving to Enterprise yet:\n\n| Capability | Community | Evaluation (Free) | Enterprise |\n|---|---|---|---|\n| Tenant policies | 20 | 50 | Unlimited |\n| Org-wide policies | 0 | 5 | Unlimited |\n| Audit retention | 3 days | 14 days | Up to 10 years |\n| HITL approval gates | — | 25 pending, 24h expiry | Unlimited, 24h |\n| Evidence export (CSV/JSON) | — | 5,000 records · 14d window · 3/day | Unlimited |\n| Policy simulation | — | 300/day | Unlimited |\n| Session overrides (self-service unblock) | — | — | Enterprise-only |\n\nOrg-wide policies and session overrides are **Enterprise-only** — those are the actual upgrade triggers for plugin users.\n\n[Get a free Plugin Evaluation license](https://getaxonflow.com/plugins/evaluation-license?utm_source=readme_plugin_codex_eval)\n\n---\n\n## Privacy notice\n\n**Read before installing.** AxonFlow [Community SaaS](https://docs.getaxonflow.com/docs/deployment/community-saas/) at `try.getaxonflow.com` is the zero-config endpoint the plugin uses if neither `AXONFLOW_ENDPOINT` nor `AXONFLOW_AUTH` is configured. In that mode, governed tool inputs (tool name + arguments) and outbound message bodies are checked by AxonFlow's policy enforcement endpoint. **Community SaaS is for early exploration only** — not for production workloads, regulated environments, real user data, personal data, or any other sensitive information. It is offered \"as is\" on a best-effort basis with no SLA, no warranties, and no commitment to retention, deletion, or incident-response timelines.\n\nFor any serious use, choose one of the following instead:\n\n1. **[Self-host AxonFlow Community Edition](https://docs.getaxonflow.com/docs/deployment/self-hosted/)** — runs entirely on your infrastructure and keeps data within your boundary. Recommended for any real workload. The in-README quick start is in [Step 1](#step-1-install-the-axonflow-platform) below.\n2. **Community Edition with an [Evaluation License](https://docs.getaxonflow.com/docs/deployment/evaluation-rollout-guide/)** — for production use with real users or clients on the open core; adds production-fit limits and license-gated features. Free 90-day [evaluation license](https://getaxonflow.com/plugins/evaluation-license).\n3. **[AxonFlow Enterprise](https://docs.getaxonflow.com/docs/deployment/community-to-enterprise-migration/)** — production-grade governance, regulatory-grade controls, SLOs, and contractual commitments suitable for regulated industries. Contact [hello@getaxonflow.com](mailto:hello@getaxonflow.com).\n\nTo skip Community SaaS entirely: set `AXONFLOW_ENDPOINT` to a self-hosted AxonFlow URL. That alone flips the plugin into self-hosted mode — the Community SaaS auto-bootstrap is not attempted, and no env var is required. Get the AxonFlow platform from [getaxonflow/axonflow](https://github.com/getaxonflow/axonflow) and follow the [Getting Started](https://docs.getaxonflow.com/docs/getting-started/) guide for the Docker Compose setup. For air-gapped environments where AxonFlow is not yet reachable but you want to suppress the bootstrap attempt, set `AXONFLOW_COMMUNITY_SAAS=0`; set `AXONFLOW_TELEMETRY=off` to also disable the anonymous 7-day heartbeat.\n\nLLM provider keys never leave the user's machine in any mode — Codex makes the LLM calls; AxonFlow only enforces policies and records audit trails.\n\n## Mode-specific reference\n\nThe recommended self-hosted path is covered in [Install Step 1](#step-1-install-the-axonflow-platform). Two more modes worth knowing about:\n\n### Community SaaS — for early exploration only\n\nThe plugin's zero-config fallback when neither `AXONFLOW_ENDPOINT` nor `AXONFLOW_AUTH` is configured. The plugin registers a tenant with `try.getaxonflow.com` on first run and persists credentials at `~/.config/axonflow/try-registration.json` (mode `0600`). Every hook invocation logs a one-line canary on stderr:\n\n```\n[AxonFlow] Connected to AxonFlow at https://try.getaxonflow.com (mode=community-saas)\n```\n\n**Use only for early exploration of the plugin's behaviour. Not for production workloads, regulated environments, real user data, personal data, or any other sensitive information.**\n\n| What goes to `try.getaxonflow.com` | What does NOT |\n|---|---|\n| Tool name + arguments before each governed call | LLM provider API keys |\n| Outbound message bodies before delivery (PII/secret scan) | Codex conversation history outside governed tools |\n| Anonymous 7-day heartbeat (plugin version, OS, runtime) | Files outside the Codex runtime |\n\nThe endpoint runs against shared Ollama models, rate-limits at 20 req/min · 500 req/day per tenant, and is offered \"as is\" on a best-effort basis with no SLA, no warranties, no commitment to retention or deletion timelines, and may be modified or discontinued without notice. Read the [Try AxonFlow — Free Trial Server](https://docs.getaxonflow.com/docs/deployment/community-saas/) page for the full disclosure, including [data retention](https://docs.getaxonflow.com/docs/deployment/community-saas/#limitations-and-disclaimers) and [registration mechanics](https://docs.getaxonflow.com/docs/deployment/community-saas/#registration).\n\n### Air-gapped: zero outbound\n\nFor environments where no outbound traffic is permitted at all — air-gapped labs, regulated networks, classified deployments — set both env vars before the Codex process starts:\n\n```bash\nexport AXONFLOW_COMMUNITY_SAAS=0   # disable Community SaaS auto-bootstrap\nexport AXONFLOW_TELEMETRY=off      # disable the anonymous 7-day heartbeat\nexport AXONFLOW_ENDPOINT=http://your-internal-axonflow:8080\n```\n\nWith both env vars set and `AXONFLOW_ENDPOINT` pointing at a same-network instance, no traffic leaves your environment.\n\n---\n\n## Install\n\nThis is a **three-step** install: stand up the AxonFlow platform, add the plugin to Codex, then point the plugin at the platform. The plugin alone does not enforce policy — its hook scripts are thin clients that talk to an AxonFlow agent gateway. If the platform is not installed and reachable, governed tool calls have nothing to evaluate against. **Skipping Step 3 is the most common mistake**: the platform is running locally but the plugin still falls back to Community SaaS because no `AXONFLOW_ENDPOINT` is configured.\n\n### Prerequisites\n\n- [OpenAI Codex CLI](https://developers.openai.com/codex/cli)\n- `jq` and `curl` on `PATH`\n\n### Step 1: install the AxonFlow platform\n\nFor any real workload, run AxonFlow on your own infrastructure via Docker Compose:\n\n```bash\ngit clone https://github.com/getaxonflow/axonflow.git\ncd axonflow \u0026\u0026 docker compose up -d\n\n# verify\ncurl -s http://localhost:8080/health | jq .\n```\n\nFollow the [Getting Started](https://docs.getaxonflow.com/docs/getting-started/) guide for prerequisites (Docker Engine or Desktop, Docker Compose v2, 4 GB RAM, 10 GB disk) and the [Self-Hosted Deployment Guide](https://docs.getaxonflow.com/docs/deployment/self-hosted/) for production options. For production with real users or clients, run Community Edition with a free 90-day [Evaluation License](https://docs.getaxonflow.com/docs/deployment/evaluation-rollout-guide/) or [AxonFlow Enterprise](https://docs.getaxonflow.com/docs/deployment/community-to-enterprise-migration/).\n\n\u003e Skipping Step 1 makes the plugin fall back to the [Community SaaS](https://docs.getaxonflow.com/docs/deployment/community-saas/) endpoint at `try.getaxonflow.com` for early exploration only. **Do not skip Step 1 for any real workload** — see the [Privacy notice](#privacy-notice) above.\n\n### Step 2: install the plugin\n\n**No LLM provider keys are required** — Codex handles every LLM call; AxonFlow only evaluates policies and records audit trails.\n\n#### 2.1 Clone the plugin\n\n```bash\ngit clone https://github.com/getaxonflow/axonflow-codex-plugin.git\ncd axonflow-codex-plugin\n```\n\n#### 2.2 Point Codex at the AxonFlow MCP server\n\nCodex reads MCP config from `~/.codex/config.toml` (TOML), **not** from `.mcp.json` in the plugin directory:\n\n```bash\ncat \u003e\u003e ~/.codex/config.toml \u003c\u003c 'EOF'\n\n[mcp_servers.axonflow]\nurl = \"http://localhost:8080/api/v1/mcp-server\"\nEOF\n```\n\n#### 2.3 Enable hooks and install the hook file\n\n```bash\ncat \u003e\u003e ~/.codex/config.toml \u003c\u003c 'EOF'\n\n[features]\ncodex_hooks = true\nEOF\ncp hooks/hooks.json ~/.codex/hooks.json\n```\n\nThe `hooks.json` file uses relative paths (`./scripts/...`). Update those paths in `~/.codex/hooks.json` to the absolute location of the plugin's `scripts/` directory, or symlink so Codex can resolve them from the plugin checkout.\n\n#### 2.4 Register the plugin in Codex's local marketplace\n\nFrom the directory where you launch `codex`:\n\n```bash\nmkdir -p .agents/plugins\ncat \u003e .agents/plugins/marketplace.json \u003c\u003c 'EOF'\n{\n  \"name\": \"axonflow-local\",\n  \"plugins\": [{\n    \"name\": \"axonflow\",\n    \"source\": { \"source\": \"local\", \"path\": \"./axonflow-codex-plugin\" },\n    \"policy\": { \"installation\": \"INSTALLED_BY_DEFAULT\" },\n    \"category\": \"Security\"\n  }]\n}\nEOF\n\ncodex   # then install via /plugins\n```\n\n### Step 3: point the plugin at the platform\n\nWithout this step the plugin auto-registers with Community SaaS regardless of whether you ran Step 1 — it does not auto-detect a locally-running AxonFlow. Set `AXONFLOW_ENDPOINT` (and `AXONFLOW_AUTH` if you have credentials):\n\n```bash\n# Self-hosted local agent — that alone flips mode to self-hosted, no other env var needed\nexport AXONFLOW_ENDPOINT=http://localhost:8080\n\n# Self-hosted remote agent with credentials\nexport AXONFLOW_ENDPOINT=https://axonflow.your-company.com\nexport AXONFLOW_AUTH=$(echo -n \"your-client-id:your-client-secret\" | base64)\n```\n\nEvery hook invocation logs a one-line canary on stderr confirming the active mode:\n\n```\n[AxonFlow] Connected to AxonFlow at http://localhost:8080 (mode=self-hosted)\n```\n\nIf the canary says `mode=community-saas` after you ran Step 1, the plugin is still hitting `try.getaxonflow.com` because Step 3 was skipped or `AXONFLOW_ENDPOINT` is unset. Fix Step 3 and reload.\n\n---\n\n## Configure\n\n[Step 3](#step-3-point-the-plugin-at-the-platform) above covers `AXONFLOW_ENDPOINT` and `AXONFLOW_AUTH`. One more environment variable worth knowing about:\n\n```bash\n# Optional: longer request timeout for remote / VPN deployments\nexport AXONFLOW_TIMEOUT_SECONDS=12\n```\n\n**Fail behavior:**\n- AxonFlow unreachable (network) → fail-open, tool execution continues\n- AxonFlow auth/config error → fail-closed (exit 2), tool call blocked until config is fixed\n- PostToolUse failures → never block (audit and PII scan are best-effort)\n\n---\n\n## Pro tier (paid)\n\nThe plugin runs in two tiers:\n\n- **Free** — no `X-License-Token` header sent; agent applies free-tier quotas (3-day audit retention, 200 governed events / day, 2 active custom policies, 1 HITL approval per rolling 7d).\n- **Pro** — `X-License-Token: AXON-...` sent on every governed request; agent's plugin-claim middleware validates the Ed25519 signature + DB row and stamps a Pro-tier context (30-day audit retention, **2,000 events / day**, **unlimited active custom policies**, **unlimited HITL approvals**, plus the **LLM cost pre-flight** tool — estimate token cost for a multi-step plan before it runs).\n\nPro is **$9.99 USD for 90 days**, one-time payment, no auto-renewal, 14-day no-questions refund. See [getaxonflow.com/pricing](https://getaxonflow.com/pricing/) for the full breakdown and the Stripe buy button.\n\nTo activate Pro on this Codex install:\n\n1. **Find your tenant ID.** From the plugin install root, run:\n\n    ```bash\n    bash scripts/recover.sh status\n    ```\n\n    The output includes a `tenant_id   cs_\u003cuuid\u003e` line — that's the value Stripe Checkout needs. Copy it. (Or ask the agent: \"what is my AxonFlow tenant ID?\" — the [`pro-tier-status` skill](#agent-skills) will run the script and surface the value.)\n\n2. **Buy at the pricing page.** Visit [getaxonflow.com/pricing](https://getaxonflow.com/pricing/) and click **Buy Plugin Pro — $9.99**. At Stripe Checkout, paste your `tenant_id` into the **AxonFlow tenant ID** custom field.\n\n3. **Install the issued license token.** After checkout you'll receive an `AXON-...` token by email. Install it one of two ways:\n\n    ```bash\n    # Operator override / CI\n    export AXONFLOW_LICENSE_TOKEN=\"AXON-...your-token...\"\n\n    # Persistent: write to ~/.codex/axonflow.toml (mode 0600)\n    bash scripts/recover.sh apply-token\n    ```\n\nCheck current tier and config:\n\n```bash\nbash scripts/recover.sh status\n```\n\nToken resolution order: `AXONFLOW_LICENSE_TOKEN` env var, then `license_token = \"AXON-...\"` in `~/.codex/axonflow.toml`. The plugin filters out tokens that don't carry the canonical `AXON-` prefix before sending so the agent never sees malformed values.\n\n#### One-time MCP-session setup (required for Pro-tier MCP traffic)\n\nPer-call hooks (terminal command governance) carry your Pro-tier token automatically once `AXONFLOW_LICENSE_TOKEN` is set. **MCP-session traffic** (the long-lived connection codex opens to AxonFlow's MCP-server endpoint for tool discovery) needs a one-time setup because Codex's `mcp add` CLI doesn't expose a `--header` flag, but its `~/.codex/config.toml` schema does support `[mcp_servers.\u003cn\u003e.http_headers]` and `[mcp_servers.\u003cn\u003e.env_http_headers]` blocks. Run:\n\n```bash\nbash scripts/install-mcp-with-headers.sh\n```\n\nThis registers AxonFlow as a codex MCP server AND patches your `~/.codex/config.toml` to inject `X-Axonflow-Client: codex-plugin/\u003cversion\u003e` (static) plus `X-License-Token` and `Authorization` resolved from `AXONFLOW_LICENSE_TOKEN` and `AXONFLOW_AUTH` env vars at MCP-session time. The script is idempotent — safe to re-run after a plugin upgrade or token rotation.\n\nVerify with:\n\n```bash\ncodex mcp get axonflow\n```\n\nThe output should list non-empty `http_headers` and `env_http_headers` rows.\n\n## Recover lost credentials\n\nIf you've lost your `AXONFLOW_AUTH` / tenant secret (and your tenant was registered with an email):\n\n```bash\nbash scripts/recover.sh request    # POSTs /api/v1/recover; agent emails magic link\n# (open email, click link, copy hex token)\nbash scripts/recover.sh verify     # POSTs /api/v1/recover/verify; persists new creds\n```\n\nThe verify step writes the returned `tenant_id`, `secret`, `endpoint`, and `email` atomically into `~/.codex/axonflow.toml` (mode `0600`, inside a `0700` parent). An existing `license_token` line is preserved across recovery so you don't get silently downgraded from Pro to Free.\n\nFor automation / CI / runtime tests, the script reads `AXONFLOW_RECOVER_EMAIL`, `AXONFLOW_RECOVER_TOKEN`, and `AXONFLOW_LICENSE_TOKEN` from the environment instead of prompting.\n\nTwo new agent-callable skills (`recover-credentials` and `pro-tier-status`) let Codex guide a user through the same flows when they say things like *\"I lost my AxonFlow credentials\"* or *\"am I on the Pro tier?\"*.\n\n---\n\n## What gets checked\n\nAxonFlow ships with **80+ built-in system policies** that apply to Codex automatically. No configuration required — new policies added to the platform are immediately enforced.\n\n| Category | Coverage |\n|---|---|\n| **Dangerous commands** | Reverse shells, `rm -rf /`, `curl \\| bash`, credential file access, path traversal |\n| **SQL injection** | 30+ patterns including UNION injection, stacked queries, auth bypass, encoding tricks |\n| **PII detection** | SSN, credit card, Aadhaar, PAN, email, phone, NRIC/FIN (Singapore), and more — with redaction |\n| **Secrets exposure** | API keys, connection strings, hardcoded credentials, code secrets |\n| **SSRF** | Cloud metadata endpoint (`169.254.169.254`) and internal-network blocking |\n| **Prompt injection** | Instruction override, jailbreak attempts, role hijacking |\n| **Codex-specific** | `.codex-plugin/*.json` and `.mcp.json` write protection (enabled via `AXONFLOW_INTEGRATIONS=codex`) |\n\nCustom policies are easy — `POST /api/v1/dynamic-policies` or the Customer Portal. See [Policy Enforcement](https://docs.getaxonflow.com/docs/mcp/policy-enforcement/).\n\n---\n\n## The 15 MCP tools Codex can call\n\nBeyond the hook surface, the agent's MCP server exposes **15 tools** Codex can call directly. All served by the platform at `/api/v1/mcp-server`.\n\n### Governance (6)\n\n| Tool | Purpose |\n|------|---------|\n| `check_policy` | Evaluate specific inputs against policies |\n| `check_output` | Scan specific content for PII/secrets |\n| `audit_tool_call` | Record an additional audit entry |\n| `list_policies` | List active governance policies |\n| `get_policy_stats` | Summary of governance activity |\n| `search_audit_events` | Search individual audit records for debugging and compliance |\n\n### Decision explainability \u0026 session overrides (4)\n\n| Tool | Purpose |\n|------|---------|\n| `explain_decision` | Return the full [DecisionExplanation](https://docs.getaxonflow.com/docs/governance/explainability/) for a decision ID |\n| `create_override` | Create a time-bounded, audit-logged session override (mandatory justification) |\n| `delete_override` | Revoke an active session override |\n| `list_overrides` | List active overrides scoped to the caller's tenant |\n\n### Tenant identity \u0026 tier capability (5 — V1 Plugin Pro)\n\n| Tool | Free access | Pro access |\n|------|-------------|------------|\n| `axonflow_get_tenant_id` | Visible + callable — returns tenant_id, server-resolved tier, upgrade URL | Same |\n| `axonflow_list_pro_features` | Visible + callable — locked Pro feature list (5 differentiators + $9.99 / 90-day pricing) | Same |\n| `axonflow_request_approval` | Visible + 1 per rolling 7d | Unlimited |\n| `axonflow_create_tenant_policy` | Visible + 2 active max | Unlimited |\n| `axonflow_get_cost_estimate` | Filtered out of `tools/list` — Pro-only | Visible + callable |\n\nWhen a Free-tier cap is hit on these tools, the agent returns a structured upgrade envelope (same shape as the 429 daily-quota envelope) and the plugin surfaces the upgrade prompt to stderr — see [Free-tier limits and upgrade prompts](#free-tier-limits-and-upgrade-prompts) below.\n\nSee [Session Overrides](https://docs.getaxonflow.com/docs/governance/overrides/).\n\n---\n\n## Free-tier limits and upgrade prompts\n\nWhen the plugin's hooks hit a Free-tier cap (200 events/day, 2 active custom policies, 1 HITL approval per rolling 7d, or a Pro-only feature), the agent returns a structured upgrade envelope. The plugin parses it and prints a single-line nudge to stderr — visible in Codex's hook log:\n\n```\n[AxonFlow] Daily limit reached on Free tier (200 events). Pro raises this to 2,000/day. Resets at midnight UTC.\n[AxonFlow] Upgrade: https://buy.stripe.com/bJe28qbztcdVchjdkw8k800\n```\n\nThe plugin also stamps a local back-off file from the response's `Retry-After` header so subsequent governed calls fall through immediately (no thundering herd against the agent) until the cap clears. The upgrade nudge is shown at most once per UTC day so it doesn't spam every hook.\n\n---\n\n## Skills\n\nThe skills are how Codex gets governance guidance for non-terminal tools — the advisory half of the hybrid model. Implicit activation means Codex invokes them automatically when the task matches the skill description; explicit invocation is `@axonflow`.\n\n| Skill | When used | Activation |\n|-------|-----------|------------|\n| `pre-execute-check` | Before non-Bash tool calls that modify state | Implicit or explicit |\n| `post-execute-audit` | After non-Bash tool calls complete | Implicit or explicit |\n| `pii-scan` | After tool calls that return data | Implicit or explicit |\n| `governance-status` | Checking governance posture | Explicit |\n| `audit-search` | Searching compliance evidence | Explicit |\n| `policy-list` | Listing active policies | Explicit |\n| `recover-credentials` | Recovering lost credentials or installing a paid Pro license token | Implicit or explicit |\n| `pro-tier-status` | Checking which tier (free or Pro) the install is on | Implicit or explicit |\n\n---\n\n## Latency\n\n| Operation | Typical overhead |\n|-----------|-----------------|\n| Policy pre-check (hook) | 2–5 ms |\n| PII detection | 1–3 ms |\n| Audit write (async) | 0 ms (non-blocking) |\n| **Total per-terminal-call overhead** | **3–10 ms** |\n\nImperceptible in interactive Codex sessions.\n\n---\n\n## Sister integrations\n\nSame governance platform, same 80+ policies, same 15 MCP tools — different agent hosts:\n\n| Integration | Repo | Docs |\n|---|---|---|\n| OpenAI Codex | *this repo* | [codex](https://docs.getaxonflow.com/docs/integration/codex/) |\n| Claude Code | [axonflow-claude-plugin](https://github.com/getaxonflow/axonflow-claude-plugin) | [claude-code](https://docs.getaxonflow.com/docs/integration/claude-code/) |\n| Cursor IDE | [axonflow-cursor-plugin](https://github.com/getaxonflow/axonflow-cursor-plugin) | [cursor](https://docs.getaxonflow.com/docs/integration/cursor/) |\n| OpenClaw | [axonflow-openclaw-plugin](https://github.com/getaxonflow/axonflow-openclaw-plugin) | [openclaw](https://docs.getaxonflow.com/docs/integration/openclaw/) |\n\n---\n\n## Plugin structure\n\n```\naxonflow-codex-plugin/\n├── .codex-plugin/\n│   ├── plugin.json          # Plugin metadata\n│   └── marketplace.json     # Marketplace listing\n├── .mcp.json                # MCP server connection (platform-side)\n├── hooks/\n│   └── hooks.json           # PreToolUse + PostToolUse for exec_command\n├── skills/\n│   ├── pre-execute-check/\n│   ├── post-execute-audit/\n│   ├── pii-scan/\n│   ├── governance-status/\n│   ├── audit-search/\n│   ├── policy-list/\n│   ├── recover-credentials/  # Magic-link recovery + Pro-tier token install\n│   └── pro-tier-status/      # Reports Free vs Pro tier\n├── scripts/\n│   ├── pre-tool-check.sh    # Policy enforcement (PreToolUse)\n│   ├── post-tool-audit.sh   # Audit + PII scan (PostToolUse)\n│   ├── mcp-auth-headers.sh  # Basic-auth + X-License-Token headers for MCP\n│   ├── recover.sh           # request|verify|apply-token|status user surface\n│   ├── telemetry-ping.sh    # Anonymous telemetry (fires once per install)\n│   ├── uninstall.sh         # Clean removal of hooks, config, and marketplace entry\n│   └── lib/\n│       └── license-token.sh # Pro-tier token resolver + TOML config writer\n├── runtime-e2e/\n│   ├── v1-paid-tier/        # X-License-Token wire-up runtime test\n│   ├── recovery/            # Recovery surface runtime test\n│   └── ...                  # Read-side governance skill runtime tests\n└── tests/\n    ├── test-hooks.sh        # Regression tests (mock + live)\n    ├── E2E_TESTING_PLAYBOOK.md\n    └── e2e/                 # Smoke E2E against live AxonFlow\n```\n\n---\n\n## Testing\n\n```bash\n# Hook regression tests (no live stack required)\n./tests/test-hooks.sh\n\n# Smoke E2E against a live AxonFlow at localhost:8080\nbash tests/e2e/smoke-block-context.sh\n```\n\nThe smoke scenario runs the plugin's `pre-tool-check.sh` against a running platform, feeds a SQLi-bearing Bash tool invocation through it, and asserts Codex's deny semantics (exit 2 + stderr prefix `AxonFlow policy violation`) carry the richer-context markers (`decision:`, `risk:`). Exits 0 with `SKIP:` if no stack is reachable.\n\nFor the broader validation story — explain-decision, override lifecycle, audit-filter parity, cache invalidation — see the [Codex integration guide](https://docs.getaxonflow.com/docs/integration/codex/).\n\n---\n\n## Troubleshooting\n\n**MCP server connection failed?** Codex reads MCP config from `~/.codex/config.toml` (TOML format), not from `.mcp.json` in the plugin directory. Add `[mcp_servers.axonflow]` with `url = \"http://localhost:8080/api/v1/mcp-server\"`.\n\n**Hooks not firing on bash?** Hooks must be at `~/.codex/hooks.json` (not inside the plugin directory). Enable hooks with `[features] codex_hooks = true` in `~/.codex/config.toml`. The hook matcher should include `exec_command` — Codex uses this name for terminal commands, not `Bash`.\n\n**Skills not activating?** Skills activate implicitly when the task matches the description. For explicit invocation, use `@axonflow`. Ensure the plugin is installed via `/plugins` in Codex and the MCP server is reachable.\n\n**Plugin not visible in `/plugins`?** `marketplace.json` must live at `$CWD/.agents/plugins/marketplace.json` relative to where you launch `codex`. The `source.path` must be relative (start with `./`) and point inside the same root.\n\n**PII in file writes not detected?** Codex hooks only support Bash (`exec_command`). Write/Edit operations cannot be hooked. PII detection for file writes depends on advisory skills (`pre-execute-check`, `pii-scan`) — the skill instructs the agent to call `check_output` before writing, but this is not enforced. This is the advisory half of the hybrid model at work; see [Governance Model](#the-hybrid-governance-model).\n\nMore troubleshooting in the [integration guide](https://docs.getaxonflow.com/docs/integration/codex/#troubleshooting).\n\n---\n\n## Telemetry\n\nAnonymous heartbeat at most once every 7 days per machine: plugin version, OS, architecture, bash version, AxonFlow platform version, deployment mode (community-saas / self-hosted production / self-hosted development). **Never** tool arguments, message contents, or policy data. The stamp file mtime advances only after the HTTP POST returns 2xx, so a transient network failure does not silence telemetry until the next window.\n\nOpt out: set `AXONFLOW_TELEMETRY=off` in the environment Codex runs in.\n\n### Scope of `AXONFLOW_TELEMETRY=off`\n\n`AXONFLOW_TELEMETRY=off` disables the anonymous heartbeat described above. On **self-hosted** and **in-VPC** deployments, that heartbeat is the only data the plugin sends to AxonFlow, so setting `=off` means we receive nothing. On **Community SaaS** (`try.getaxonflow.com`) the hosted service also processes operational data — registrations, audit logs, policy enforcement records, workflow state, plan data, and request-header metadata aggregated for usage analytics — as part of running the platform; that operational data flow is governed by the [Privacy Policy](https://getaxonflow.com/privacy/), not by `AXONFLOW_TELEMETRY`.\n\n`DO_NOT_TRACK` is **not** honored as an opt-out for AxonFlow telemetry. It is commonly inherited from host tools and developer environments — and in Codex specifically, the CLI injects `DO_NOT_TRACK=1` into every hook subprocess regardless of user intent. That makes it an unreliable expression of user intent, so AxonFlow telemetry is controlled exclusively by `AXONFLOW_TELEMETRY=off`.\n\nGuarded by a stamp file at `$HOME/.cache/axonflow/codex-plugin-telemetry-sent` (delete to re-send). Details: [docs.getaxonflow.com/docs/telemetry](https://docs.getaxonflow.com/docs/telemetry/).\n\n---\n\n## Links\n\n- **[Codex Integration Guide](https://docs.getaxonflow.com/docs/integration/codex/)** — the full walkthrough (recommended starting point)\n- [AxonFlow Documentation](https://docs.getaxonflow.com)\n- [Codex Plugins docs (OpenAI)](https://developers.openai.com/codex/plugins)\n- [Policy Enforcement](https://docs.getaxonflow.com/docs/mcp/policy-enforcement/)\n- [Decision Explainability](https://docs.getaxonflow.com/docs/governance/explainability/)\n- [Session Overrides](https://docs.getaxonflow.com/docs/governance/overrides/)\n- [Self-Hosted Deployment](https://docs.getaxonflow.com/docs/deployment/self-hosted/)\n- [Security Best Practices](https://docs.getaxonflow.com/docs/security/best-practices/)\n- Sister plugins: [Claude Code](https://github.com/getaxonflow/axonflow-claude-plugin) · [Cursor](https://github.com/getaxonflow/axonflow-cursor-plugin) · [OpenClaw](https://github.com/getaxonflow/axonflow-openclaw-plugin)\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgetaxonflow%2Faxonflow-codex-plugin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgetaxonflow%2Faxonflow-codex-plugin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgetaxonflow%2Faxonflow-codex-plugin/lists"}