Skip to main content
ubx has a suite of AI-powered commands built on Claude. All are opt-in, require your own Anthropic API key (BYOK), and degrade gracefully if the API is unavailable.

Setup

1

Get an Anthropic API key

2

Configure ubx

export UBX_AI_API_KEY=sk-ant-...
Or in ubx.yaml:
ai:
  enabled: true
  api_key: "sk-ant-..."
  model: "claude-haiku-4-5"
  features:
    plan_summary: true
    cost_estimate: true
3

Verify

ubx ai status
ubx ai test
# ✓ API key valid — claude-haiku-4-5 responding

Commands

ubx explain

ubx explain                              # explain entire project
ubx explain main.iac                     # specific file
ubx explain unit.aws_rds_instance.db     # single resource
ubx explain --audience exec              # non-technical language
Produces: summary, resources, outputs, risks, next steps. See ubx explain.

ubx fix

ubx fix                  # fix all errors
ubx fix main.iac         # fix specific file
ubx fix --dry-run        # show diff without applying
ubx fix --yes            # apply without confirmation
Runs ubx validate, sends errors + source to Claude, proposes fixes as a unified diff.

ubx suggest

ubx suggest "add a PostgreSQL RDS instance with 20GB storage"
ubx suggest "add an S3 bucket for logs" --append main.iac
ubx suggest "add EKS cluster" --dry-run
Reads existing .iac files for context, generates new blocks, appends after confirmation.

ubx review

ubx review                        # review entire project
ubx review --focus security       # security findings only
ubx review --focus cost           # cost findings only
ubx review --min-severity high    # critical and high only
Structured findings by severity. Exit code 1 if any critical or high findings — safe for CI.

ubx upgrade

ubx upgrade --check          # exit 1 if any upgrades needed (CI mode)
ubx upgrade --dry-run        # show diff without applying
ubx upgrade --yes            # apply without confirmation
Two phases: mechanical mappings (instant) + AI suggestions (with API key). Known mechanical mappings:
DeprecatedCurrent
aws_s3_bucketaws_s3_bucket_v2
aws_rds_cluster_instanceaws_rds_cluster
aws_elasticache_clusteraws_elasticache_replication_group
kubernetes_deploymentkubernetes_deployment_v1

Plan Summary and Cost Estimate

When AI is enabled, ubx plan appends:
─── AI Summary ─────────────────────

This plan creates a PostgreSQL database and an S3 storage bucket.

Risk: medium — new database with hardcoded credentials

─── Cost Estimate ──────────────────

✓  Estimated monthly cost: ~$13.50  (high confidence)
RDS PostgreSQL db.t3.micro    $13.50
S3 bucket (assets)            $ 0.00

Cost Limits

unit "aws_rds_instance" "db" {
  instance_class = "db.r6g.4xlarge"
  cost_limit     = 500   # $500/month maximum
}
ubx validate --cost
# ✗  unit "db" estimated at $612/mo exceeds cost_limit of $500

Privacy

  • No telemetry. Data sent only to the Anthropic API.
  • API key shown as last 4 chars only in ubx ai status.
  • If key missing: all AI commands exit with a clear error.