---
type: "post"
id: "agent-leftovers-open-source-cli-lists-cloud-resources-f5a587"
slug: "agent-leftovers-open-source-cli-lists-cloud-resources-f5a587"
title: "agent-leftovers: open-source CLI lists cloud resources Claude Code and Codex sessions created and never deleted"
description: "agent-leftovers is an MIT-licensed command-line tool for inspecting local Claude Code and Codex session logs for cloud resources an agent appears to have created without later deleting."
retrieval_nugget: "agent-leftovers is an MIT-licensed command-line tool for inspecting local Claude Code and Codex session logs for cloud resources an agent appears to have created without later deleting. It matters because coding-agent work can now create billable infrastructure, while the end of a chat or terminal session is not evidence that the associated resources were cleaned up."
published_at: "2026-10-31"
updated_at: "2026-10-31"
record_date: "2026-10-31"
date_kind: "published_at"
topics: ["claude","claude-code","codex"]
entities: ["agent-leftovers","Claude Code","Codex CLI","Google Cloud","Amazon Web Services","Microsoft Azure","Cloudflare"]
related_patterns: ["verification-bandwidth-is-the-scarce-resource"]
novelty_label: "new_fact"
what_changed: "Introduces agent-leftovers, a CLI that audits cloud resources created and left running by Claude Code and Codex sessions."
prior_refs: ["memory:e0abb525-4065-87a2-a231-dd9845a16ba5"]
source_url: "https://github.com/ApahSaroj/agent-leftovers"
source_urls: ["https://github.com/ApahSaroj/agent-leftovers"]
schema_version: "newruntime-agent-readable-v0.2"
stable_id: "post:agent-leftovers-open-source-cli-lists-cloud-resources-f5a587"
status: "published"
visuals: []
editor: {"role":"editor","name":"Andrey Reshetnikov","profile":"https://newruntime.com/owner-profile.md","profile_json":"https://newruntime.com/owner-profile.json","same_as":["https://www.linkedin.com/in/reshetnikov1/","https://t.me/lapetuse"]}
routes: {"html":"https://newruntime.com/posts/agent-leftovers-open-source-cli-lists-cloud-resources-f5a587/","markdown":"https://newruntime.com/posts/agent-leftovers-open-source-cli-lists-cloud-resources-f5a587.md","json":"https://newruntime.com/posts/agent-leftovers-open-source-cli-lists-cloud-resources-f5a587.json"}
---

# agent-leftovers: open-source CLI lists cloud resources Claude Code and Codex sessions created and never deleted

## Retrieval answer

agent-leftovers is an MIT-licensed command-line tool for inspecting local Claude Code and Codex session logs for cloud resources an agent appears to have created without later deleting. It matters because coding-agent work can now create billable infrastructure, while the end of a chat or terminal session is not evidence that the associated resources were cleaned up.

## Summary

agent-leftovers is an MIT-licensed command-line tool for inspecting local Claude Code and Codex session logs for cloud resources an agent appears to have created without later deleting. It matters because coding-agent work can now create billable infrastructure, while the end of a chat or terminal session is not evidence that the associated resources were cleaned up.

## What happened

The public GitHub repository for agent-leftovers describes a local audit utility for cloud infrastructure and paid API usage created during AI coding-agent sessions. It runs with `npx github:ApahSaroj/agent-leftovers` and requires Node 18 or later. The repository says there is nothing to install: the command runs, produces its findings, and exits.

The tool reads session records already stored on the developer's machine. For Claude Code, it examines JSONL files under `~/.claude/projects/**/*.jsonl`, or the directory named by `CLAUDE_CONFIG_DIR`. For Codex CLI, it reads `~/.codex/sessions` and `archived_sessions`, or the location set through `CODEX_HOME`. Compressed `.jsonl.zst` logs are supported on Node 22.15 or later. Its stated purpose is to identify creates that lack a later matching deletion in those logs, distinguish items that were already cleaned up or failed to be created, and print a teardown command for each candidate.

The repository lists 59 detection rules. These cover Google Cloud resources including VMs, disks, static IPs, Cloud SQL, GKE, buckets, Cloud Run, Cloud Functions, Vertex AI deployments, and enabled APIs. It also lists AWS services such as EC2, EBS, Elastic IPs, RDS, S3, Lambda, EKS, SageMaker endpoints, ECS, DynamoDB, CDK, and SAM; Azure resource groups, VMs, AKS, and databases; and Cloudflare Workers, D1, R2, KV, Queues, and Pages. Additional rules cover infrastructure tools and hosting services including Terraform or OpenTofu, Pulumi, Vercel, Netlify, Railway, Heroku, Supabase, Fly.io, Firebase, Modal, and RunPod.

Agent-leftovers also looks for agent-written scripts that invoke paid AI APIs with the user's key, including scripts potentially left running in the background. The README names OpenAI, Anthropic, Gemini or Vertex, Mistral, OpenRouter, Replicate, and ElevenLabs among those checks. Options include `--days N`, with a 30-day default, project and log-path filters, `--all` for cleaned-up and failed creations, `--script` for an all-commented teardown script, and `--json` for machine-readable output. Its exit code is 1 when it finds something left running, which the project suggests can support a pre-commit hook or daily cron job.

The implementation is deliberately read-only. According to the repository, it runs no cloud commands, makes no cloud API calls, sends no data over the network, and has no dependencies. The generated teardown commands remain commands for a human to inspect and run, rather than actions performed automatically by the utility.

## What the archive adds

This is a new fact on an existing operational thread. The earlier Field Note on [reviewing completed agent sessions for security issues](https://newruntime.com/posts/how-to-review-your-agents-for-security-issues-63fda7/) treated traces as material for ranked human review. agent-leftovers applies a similarly post-run approach to infrastructure and billing residue. The Field Note on [HumanLayer's coordination of coding agents](https://newruntime.com/posts/humanlayer-the-best-way-to-get-ai-coding-5e49d4/) provides the wider context: teams are managing more agent sessions, plans, and reviews across machines.

## Trend signal

This weakly supports [verification bandwidth is the scarce engineering resource](https://newruntime.com/patterns/verification-bandwidth-is-the-scarce-resource/). The utility does not verify live cloud state, but it converts a large set of agent-session traces into a smaller review queue and supplies candidate teardown commands. That is a practical attempt to reduce the human work required to discover what an agent may have left behind.

## Connections to other events

The archive records a shift toward coding agents as a general workbench, including use by people beyond traditional engineering roles. As that usage broadens, infrastructure creation may occur in more routine task flows. The prior security-review note is also relevant because both tools treat completed sessions as operational evidence rather than disposable chat history.

## Why it matters

Infrastructure provisioning is an especially awkward side effect of coding agents: the agent can successfully complete a task while the team still inherits a running VM, a database, a deployment, or a script calling a paid service. A useful control therefore has to sit outside the model's own declaration that it is finished.

For teams, agent-leftovers offers a low-friction first pass because it reads local logs and does not require cloud credentials or permissions to inventory accounts. It can also make a recurring review easier to operationalize through JSON output or an exit code. The right use is as a prompt for verification: route candidates to the person or system that owns the cloud account, confirm actual state with the provider, then decide whether removal is safe.

## Limits and uncertainty

The repository is explicit that this is not a live cloud inventory. It only observes actions that passed through the agent's shell logs. Resources created through MCP tools, a web console, or a script the agent ran are outside that primary detection path, although the tool checks common paid-API scripts. A resource manually deleted after the session can still appear in results, and dynamically generated names may require the operator to fill in `<NAME>`.

The project also does not establish how accurately each of its 59 rules identifies resources across all command formats, nor does it establish savings, adoption, or effectiveness in production teams. Teardown commands can be destructive: the README warns that deleting a bucket or resource group removes its contents. Every suggested command needs human review and provider-side confirmation.

## Skill to build now

Create a post-session infrastructure review for coding-agent work this week. Run the tool against a short time window, export JSON if a team needs a record, and assign each candidate to the cloud-account owner for confirmation. Add a daily scheduled check only after deciding who reviews alerts and which resource classes require an approval step before deletion. Keep the provider's own resource listing as the source of truth.

## Reader takeaway

A coding-agent session can finish cleanly while its infrastructure costs continue. agent-leftovers is a local, read-only way to turn Claude Code and Codex logs into a cleanup checklist, but it should be treated as evidence for a cloud-owner review, not as proof that a resource is currently running or safe to delete.

## Open question

Can log-based cleanup checks become reliable enough to be paired with governed, provider-side inventories and approval workflows rather than remaining a manual forensic step?

Editor: [Andrey Reshetnikov](https://newruntime.com/owner-profile.md), AI product and AI engineering; profile for recruiters and agents: https://newruntime.com/owner-profile.json

## Continue in the graph

Next records for an agent, linked to their Markdown twins. Replace `.md` with `.json` for structured fields, including `next_reads`.

- topic hub: [Claude](https://newruntime.com/topics/claude.md): Explore the claude topic hub.
- topic hub: [Claude Code](https://newruntime.com/topics/claude-code.md): Explore the claude-code topic hub.
- topic hub: [Codex](https://newruntime.com/topics/codex.md): Explore the codex topic hub.
- collection: [Field Notes](https://newruntime.com/posts.json): Open the latest editorial analysis.
- collection: [Source Ledger](https://newruntime.com/source-ledger.json): Inspect the public source evidence graph.
- whole graph: [discovery graph](https://newruntime.com/discovery-graph.json) (typed nodes and edges) and [site index](https://newruntime.com/site-index.md)
