---
title: Dex for Claude Code and Codex | Cloud ex Machina
description: "The Dex plugin gives Claude Code and Codex the map Dex has built of your cloud: dependencies, network flows, database load and cost."
image: https://www.cloudexmachina.io/hubfs/Website/Social/og-coding-agents-v1.png
---

[Skip to content](https://www.cloudexmachina.io/product/coding-agents#main-content)

New Dex for Claude Code and Codex. Your coding agent now knows what your cloud costs. [See the plugin →](https://www.cloudexmachina.io/product/coding-agents)

<https://www.cloudexmachina.io/>

Product

[How Dex worksMap, investigate, fix, measure](https://www.cloudexmachina.io/product) [SecurityRead-only access and human approval](https://www.cloudexmachina.io/security) [Dex for coding agentsPlugin for Claude Code and Codex](https://www.cloudexmachina.io/product/coding-agents)

[Sign in](https://app.cloudexmachina.io) [Book a demo](https://www.cloudexmachina.io/book-a-demo)

Product

[How Dex worksMap, investigate, fix, measure](https://www.cloudexmachina.io/product) [SecurityRead-only access and human approval](https://www.cloudexmachina.io/security) [Dex for coding agentsPlugin for Claude Code and Codex](https://www.cloudexmachina.io/product/coding-agents)

[Sign in](https://app.cloudexmachina.io) [Book a demo](https://www.cloudexmachina.io/book-a-demo)

Dex for Claude Code and Codex

# Your agent knows the code. Dex shows it your cloud.

Dex has already mapped your cloud: what talks to what, network flows, database load and what every piece costs. The plugin gives that context to Claude Code and Codex, so changes ship without surprises after deploy.

$ `npx @cloudexmachina/cxm@latest install`

Copy

[Install the plugin](https://docs.cloudexmachina.io/coding-agent/install) [View on GitHub](https://github.com/cxmlabs/cxm-plugin)

Works in Claude Code and Codex, with your Cloud ex Machina account.

claude · ~/acme-infra

› What is app-db.cluster-c1ab2cd3.eu-west-3.rds.amazonaws.com?

The writer endpoint of Aurora PostgreSQL cluster app-db in the Acme account (111122223333), eu-west-3 (Paris). It's the main database for the platform: 15 ECS services in cluster acme-platform connect to it.

- One instance, app-db-1: a db.r6g.large on I/O-Optimized storage, no reader.
- Load in September: CPU averaged 36%, peaked at 99.5%. Connections averaged 55, peaked at 196.
- Defined in Terraform: acme/cloud-infra, module tenant/storage.

Traffic to app-db by service, last 30 days

Dagster code

208 GB32%

Dagster webserver

138 GB22%

Hatchet worker

94.8 GB15%

Dagster daemon

90.7 GB14%

Hatchet dashboard

66.4 GB10%

Hatchet engine

41.9 GB7%

Auth

0.5 GB0%

API

0.1 GB0%

DagsterHatchetApptotal 640 GB

- Unusual: the Dagster webserver (138 GB) and Hatchet dashboard (66 GB) are UIs but move a lot of data. They're probably polling run history, which may explain the CPU peaks.
- Logs: log\_connections, log\_disconnections and log\_duration are on. They sent 155.5 GB to CloudWatch in 30 days. Turning them off saves about $720/yr and keeps the slow-query log.

Want me to write the ticket for the logging fix?

✻ Cooked for 2m 20s

For developers

## No surprises after deploy.

Before a change ships, your agent knows what it touches: the services that call it, the traffic it carries, the load it adds and what it will cost.

Dependencies and traffic

Database and service load

Cost at your rate, with cheaper options

claude · ~/acme-infra

› Add two workers for the ingest queue

● **Update**(modules/ingest/main.tf)

 resource "aws\_instance" "ingest\_worker" {+ count = 2+ instance\_type = "r6i.2xlarge" }

● **Bash**(cxm price --service ec2 --instance-type r6i.2xlarge --region us-east-1)

⎿ $0.504/h on-demand · 2 instances

This change adds about $8,830/yr on-demand.

r7g.2xlarge (Graviton) has the same 8 vCPU and 64 GiB for about $7,505/yr, $1,325/yr less. Want me to switch the instance type and the AMI?

For DevOps, cloud architects and FinOps

## Make sense of what’s already running.

Ask why the bill moved, what a resource does or where the waste is. The plugin answers from the research Dex has already done and its library of optimizations.

Cost drivers

Spend trend

Month over month

You askWhat are our biggest cloud cost drivers?

The services, accounts and usage types behind the bill, for any period, with the ones that look like waste.

claude · ~/acme-infra

› What are my biggest cloud cost drivers?

● **Skill**(cxm-agent-plugin:cxm-cost-drivers)

⎿ Loaded

● **Bash**(cxm analytics query '{"measures": \["spend\_by\_service.sum\_current\_unblended\_cost"\],…}')

⎿ 10 rows

$2,696,687 total spend in the last 90 days (Aug 7 – Nov 5). Five services make up 72% of it.

Top 10 services by spend, last 90 days

RDS

$612,48023%

ECS

$538,21520%

S3

$301,76011%

Athena

$284,93011%

CloudWatch

$212,6048%

EC2

$143,9505%

VPC

$118,3774%

GuardDuty

$41,2802%

ELB

$36,9401%

KMS

$28,6151%

- Athena: 11%. High for a query service. Queries likely read too much data: unpartitioned tables, or raw JSON and CSV instead of Parquet.
- CloudWatch: 8%. High for monitoring. Log ingestion is usually the cause.
- VPC: 4%. Most likely NAT gateway hours and data processing.

Athena, CloudWatch and VPC look like the easiest to bring down. I can break each one down by usage type and check what savings Cloud ex Machina has already found.

✻ Crunched for 32s

You askHow has our spend moved over the last 45 days?

Trends by day, service and account, with the spikes explained down to the usage type that caused them.

claude · ~/acme-infra

› Show me daily spend for the last 45 days

Over the last 45 days (Sep 21 – Nov 4) you spent $1,134,431, about $25,200 a day. Daily cost dropped about 22% through October, with one spike on September 30.

Daily spend, Sep 21 – Nov 4

Sep 21Sep 30 · $63,968Oct 16Nov 4

- The daily rate fell step by step: about $27,600 a day in late September, $25,200 in early October, $21,600 in late October.
- September 30: $63,968, more than twice a normal day. It looks like a month-end batch job: S3 data sent to other regions jumped from $110 to $8,240, Athena scans from $3,170 to $8,560.
- November 1–4: about $24,800 a day. Four days, and month starts carry monthly fees, so it's too early to call a trend.

The September 30 spike will probably come back every month. I can find the job behind it: which bucket it reads and which region it sends data to.

✻ Cogitated for 50s

You askHow does October compare to September?

Period-over-period comparisons that separate real fixes from one-off dips, and flag new spend the moment it shows up.

claude · ~/acme-infra

› how does october compare to september?

October cost $749,117, down $195,783 (−20.7%) from September's $944,900. October has one more day, so the daily rate fell further: from $31,497 to $24,165 a day (−23%).

Change by service, October vs September

S3

−$41,758−40%

CloudWatch

−$40,062−46%

ECS

−$37,683−18%

Athena

−$34,457−41%

RDS

−$25,702−12%

EC2

−$10,475−22%

GuardDuty

−$4,598−41%

VPC

−$3,905−9%

ELB

+$210+2%

KMS

+$2,380+28%

- S3, CloudWatch and Athena: −$116,277 together, three-fifths of the drop. Each fell 40 to 46%. A drop that size usually means a change, like shorter log retention or an S3 cleanup.
- ECS −18% and RDS −12%: −$63,385. Still the two biggest costs, at 43% of October spend.
- New: IAM Access Analyzer, $2,140 in October, nothing in September. Someone likely turned on the paid unused-access analyzer.

I can break S3, CloudWatch and Athena down by day and usage type to confirm the drop is a real fix.

✻ Churned for 30s

## What your agent can see.

The map Dex keeps of your cloud, in every agent session.

### Dependencies

Which services call a resource, and what changes when it does.

"What depends on app-db?"

### Network flows

Traffic between services, regions and the internet, and what each flow costs.

"What's driving our NAT traffic?"

### Database load

CPU, connections and I/O on each database, and which services drive them.

"Why does app-db peak at 99% CPU?"

### Cost drivers

The services, accounts and usage types behind the bill, for any period.

"What drove spend last quarter?"

### Ownership and code

Who owns a resource, and which Terraform or code manages it.

"Who owns this NAT gateway?"

### Optimizations

The issues Dex has open and the optimizations it has researched, with their savings.

"Which Dex issues touch this service?"

## Set up in one command.

The installer adds the plugin to Claude Code and Codex, then signs you in.

Step 1

### Run the installer

Sets up both agents. Add --agent claude or --agent codex to pick one.

```
npx @cloudexmachina/cxm@latest install
```

Step 2

### Sign in and pick your organization

A browser page opens. Choose the organization the plugin should answer for.

```
cxm whoami
```

Step 3

### Open a new session and ask

The skills, commands and hooks load with the next agent session.

```
› What are my biggest cost drivers?
```

### Prefer to install by hand?

Claude Code

Codex

```
claude plugin marketplace add https://github.com/cxmlabs/cxm-plugin.git
claude plugin install cxm-agent-plugin@cxm-marketplace
cxm login
```

```
codex plugin marketplace add cxmlabs/cxm-plugin --ref main
codex plugin add cxm-agent-plugin@cxm-marketplace
cxm login
```

Claude Code or Codex

Node.js 22 or later

A Cloud ex Machina account

## Questions and answers

Do I need a Cloud ex Machina account?

Yes. The plugin answers from your organization's data in Cloud ex Machina: spend, usage, the infrastructure map and the code behind it. Book a demo to get your account set up.

Which agents does it work with?

Claude Code and Codex. The installer sets up both, or one of them with --agent claude or --agent codex.

Does the plugin change anything in my cloud?

The plugin reads your Cloud ex Machina data. Any change it suggests goes through your agent and your review, like any other edit.

Can I install it for a single repository?

Yes. Run cxm setup inside the repository to copy the skills there instead of installing them for every project.

How do I switch organization?

Run cxm login to sign in again and pick another organization. cxm whoami shows which one you're connected to.

## Keep building. Dex handles the cost work.

Give your agent the context Dex has built.

[Book a demo](https://www.cloudexmachina.io/book-a-demo) [Watch Dex in action](https://www.cloudexmachina.io/product/coding-agents#watch)

<https://www.cloudexmachina.io/>

Dex, the AI FinOps agent from Cloud ex Machina, investigates cloud costs and builds the fixes your engineers review and ship.

Product

- [How Dex works](https://www.cloudexmachina.io/product)
- [Security](https://www.cloudexmachina.io/security)
- [Dex for coding agents](https://www.cloudexmachina.io/product/coding-agents)

Resources

- [Blog](https://www.cloudexmachina.io/blog)
- [Documentation](https://docs.cloudexmachina.io/)
- [Trust Center](https://trust.cloudexmachina.io/)

Company

- [Contact](https://www.cloudexmachina.io/book-a-demo)

<https://github.com/cxmlabs/> <https://www.linkedin.com/company/cloudexmachina/> [mailto:info@cloudexmachina.io](mailto:info@cloudexmachina.io)

©Cloud ex Machina · [Terms & services](https://www.cloudexmachina.io/website-terms-of-use) · [Privacy policy](https://www.cloudexmachina.io/legal/privacy-policy) · [Cookie policy](https://www.cloudexmachina.io/legal/cookie-notice) ·

Cookie settings

![GDPR](https://www.cloudexmachina.io/hs-fs/hubfs/raw_assets/public/CXMV3/images/GDPR.png?width=48&height=48&name=GDPR.png) ![AICPA SOC](https://www.cloudexmachina.io/hs-fs/hubfs/raw_assets/public/CXMV3/images/aicpa.png?width=48&height=48&name=aicpa.png)