Claude + Codex · a 6-step cleanup

Clean up your agent’s setup

Your agent follows the rules and uses fewer tokens without switching models. Just remove the accumulated clutter.

Banner: clean up your setup — Claude and Codex, your agent follows instructions and uses fewer tokens
In brief

This is a free guide to cleaning up the setup of anyone who uses Claude Code and Codex. Over time, duplicate instruction files, downloaded but unused skills, old memories, and conflicting rules pile up; they all enter the context before the first request, and the agent starts ignoring rules and using more tokens. The guide covers an audit with a prompt, a script that reads your history, one AGENTS.md, folders for each business, playbooks, and a three-question filter. All you need is Claude Code or Codex installed and Python 3.

What it is

Why your agent gets worse over time

It’s not the model. It’s what the model receives before you type the first word.

The six cleanup steps: audit, history, control tower, folders, playbooks, and filter

🗂️ Too many instructions

CLAUDE.md, AGENTS.md, and GEMINI.md all speaking at once, with rules that contradict each other.

🧰 Unused skills

Packages installed for a tutorial and then forgotten. Each one nudges the agent a little in the wrong direction.

📉 Context wasted

Old memory, outdated notes, and temporary files fill the context, and the limit runs out before the work is done.

Guide · step by step

The 6-step cleanup

First, clone the repository. Run the commands below from inside its folder.

git clone https://github.com/inematds/faxina-agentes
cd faxina-agentes
Illustration: a professional examines a bookshelf with a magnifying glass while a robot holds a checklist
1

Audit with a prompt

You don’t need a huge prompt. Specify three things: what to audit, what to compare it against, and what criteria to use. The agent only reads and makes suggestions; nothing changes without your OK.

# the prompt, ready to paste
cat prompts/auditoria.md
Illustration: a robot scans a long ribbon of conversations while a dashboard shows scores by area
2

A script reads your history

Reading hundreds of entire conversations with your agent is costly. The script scans Claude and Codex conversation files, counts messages showing friction ("that’s not what I asked for"), and lists skills you’ve never called. Read-only, no API.

python3 scripts/varrer_historico.py --dias 60
# expected: relatorio-faxina.md and relatorio-faxina.html | friction … | unused skills …

Start with low-risk cleanups: a dead hook, a temporary file, a skill unused for months.

Illustration: a control tower with a single dashboard and three colored runways
3

One AGENTS.md as a control tower

Rules that apply to all tools go in a single AGENTS.md: writing rules, what “done” means, and what must never be done. Codex reads this file directly; in Claude Code, CLAUDE.md simply points to it. Keep tool-specific rules separate only when a feature exists in just one tool.

cp modelos/AGENTS-raiz.md ~/trabalho/AGENTS.md
echo '@AGENTS.md' > ~/trabalho/CLAUDE.md
Illustration: a color-coded archive, each section with its own guide card
4

One folder per business or client

Each line of business and each client gets a folder with its own AGENTS.md (tone, audience, and local rules). It only enters context when the agent works there, so nothing leaks from one client to another.

mkdir -p ~/trabalho/{conteudo,vendas,clientes/cliente-a}
cp modelos/AGENTS-pasta.md ~/trabalho/clientes/cliente-a/AGENTS.md
Illustration: a professional speaks into a microphone as loose pages become notebooks on a shelf
5

Playbooks instead of another skill

What you know how to do by heart is more valuable than a generic skill. Record an hour explaining the process, transcribe it, and ask the agent to organize it into files such as lancamento.md e aula.md. The AGENTS.md above says when to consult each one.

mkdir -p ~/trabalho/playbooks
cp modelos/playbook-modelo.md ~/trabalho/playbooks/lancamento.md
Illustration: an attic crammed with papers, with a robot buried in the middle
6

Scheduled cleanup

The clutter comes back if no one cleans it up. Schedule the same audit every week (a scheduled Codex task or /schedule in Claude Code), with this rule: automatically clean up only low-risk items; put everything else on a list for you to decide.

# in Claude Code
/schedule every Monday at 8am: run prompts/auditoria.md and clean up only low-risk items
Before installing anything new

The three-question filter

A one-degree error in a ship’s heading seems tiny; by the end of the journey, it can be more than a hundred kilometers off course. Every misplaced skill adds that degree.

1

Is it useful for almost every task?

If not, don’t install it. Point the agent to the repository and copy only the relevant line into your AGENTS.md.

2

Is it only useful sometimes?

Then keep it in the folder of the project that uses it, never globally. The rest of your work won’t carry that weight.

3

Who cleans it up?

The scheduled cleanup each week. Better models need fewer rules: remove clutter instead of piling it up.

Illustration: a sailboat with two routes, one accurate and one off by one degree
Video

Watch the cleanup explained

The full explainer with illustrations and animated screens, plus a short reel to share with someone who needs it.

Full video (16:9)

Reel (9:16)

In the repository

What’s included

prompts/auditoria.md

The audit prompt to paste into Claude Code or Codex.

scripts/varrer_historico.py

Reads local history and generates a report in Markdown and HTML.

modelos/

Root AGENTS.md, folder AGENTS.md, and a playbook template.

tests/run.sh

Checks the script with sample data.