Перейти до основного змісту
Ievgen Kovalevskyi presents a structured project workspace for Claude Code, Codex, and AI agents.

How to structure a Claude Code and Codex project to save AI tokens

A universal AI project structure for Claude Code and Codex: when to use CLAUDE.md, when to use AGENTS.md, and how to organize memory.md, plan.md, raw, business, outputs, and evals so the agent reads less noise.

Short answer: if you work with Claude Code or Codex, do not keep the whole project context in chat. Create a simple file system inside the project: agent rules, memory, the current plan, raw sources, business context, finished outputs, and quality checks. Then the AI reads less noise, understands the task faster, and is less likely to invent facts.

Who this structure is for

This setup is for people who want to use AI agents as a working system inside a project, not as a one-off chat.

You may use Claude Code, Codex, or both. Their starting files have different names, but the idea is the same: the agent needs to know where the rules live, where the project memory lives, what the current plan is, where raw materials are stored, and where finished work should go.

Use this as a universal base, not as something to copy blindly. The goal is to give the AI enough structure so it does not restart from zero on every task.

Main idea: not one huge prompt, but a project map

A long prompt quickly becomes messy. Today you add business context, tomorrow style rules, the next day a new task, and a week later the agent is reading too much irrelevant context.

A file structure works better because every type of information has its own place:

  1. Agent rules live separately.
  2. Long-term memory is not mixed with the current plan.
  3. Raw materials do not pollute approved business context.
  4. Finished outputs do not disappear in chats.
  5. Unknown facts are captured as questions instead of being guessed.

Claude Code and Codex: which files to use

Claude Code and Codex use similar starting rule files, but the names are different.

If you work inMain rule fileWhat it does
Claude CodeCLAUDE.mdTells Claude Code how to work with this project.
CodexAGENTS.mdTells Codex and other agents the rules, boundaries, and workflow route.
Both toolsCLAUDE.md + AGENTS.mdKeep one file as the canonical source and make the other a short loader.

In practice, CLAUDE.md and AGENTS.md play almost the same role for different AI systems. They should answer the same questions:

  • what the agent should read first;
  • where project memory lives;
  • where the current plan lives;
  • where business context lives;
  • what must not be changed without approval;
  • how the result should be checked.

If you use only Claude Code, start with CLAUDE.md. If you use only Codex, start with AGENTS.md. If you use both, do not duplicate long rules in two places. Make one file the source of truth and let the other point to it.

Minimal structure from scratch

You do not need a complex system on day one. Start with this:

CLAUDE.md or AGENTS.md
memory.md
plan.md
raw/

business/
  INDEX.md
  project-summary.md
  open-questions.md
  products/
  audience/
  marketing/
  economics/
  voice/

outputs/
evals/
archive/

This already turns an empty project into a workspace an AI agent can understand.

What each block does

BlockRole in the project
CLAUDE.md or AGENTS.mdMain rules for the AI agent in your project.
memory.mdStable facts, important decisions, constraints, and long-term memory.
plan.mdCurrent task, next steps, blockers, and verification notes.
raw/Raw sources: briefs, transcripts, CSV files, audits, screenshots, prompts.
business/Clean business memory: products, audience, offer, economics, brand voice.
business/INDEX.mdMap of business files: where to look for each topic.
business/project-summary.mdShort business summary with links to deeper files.
business/open-questions.mdPlace for unknown or doubtful facts.
outputs/Finished results: articles, briefs, prompts, copy, audits.
evals/Quality checklists the agent uses to verify the work.

What to put into the rule file

The starting rule file should not be huge. Its job is not to store everything, but to route the agent.

Example logic for CLAUDE.md or AGENTS.md:

1. Read this file first.
2. If the task is about business, marketing, ads, content, or sales, open business/INDEX.md.
3. If you need the current state, open plan.md.
4. If you need stable project facts, open memory.md.
5. Look for raw materials in raw/.
6. Save finished outputs in outputs/.
7. If a fact is unknown, write it to business/open-questions.md instead of guessing.

This gives the agent a route and prevents random full-project reading.

How this saves tokens

Tokens are spent not only on the final answer. They are spent on every piece of context the model reads before doing the work.

When everything sits in one file, the agent is forced to read too much. When project-summary.md exists, it can understand the business quickly. When business/INDEX.md exists, it sees the map and opens only the relevant file. When raw materials live in raw/, the agent does not confuse drafts with approved memory.

The practical shift is simple: instead of "read everything and guess", the agent gets "read the rules, the current plan, the short summary, and only the relevant thematic file".

Business layer: why the business/ folder matters

If AI only helps with code, rules, memory, and a plan may be enough. But if it helps with ads, content, sales, products, or customer service, it needs business memory.

The business/ folder separates company knowledge from technical noise.

DataWhere to put it
Short business summarybusiness/project-summary.md
Business file navigationbusiness/INDEX.md
Unknown or doubtful factsbusiness/open-questions.md
Products and servicesbusiness/products/catalog.md
Offers, bonuses, guaranteesbusiness/products/offer-matrix.md
Audience segmentsbusiness/audience/segments.md
Search demandbusiness/market/search-demand.md
Funnel and frictionbusiness/marketing/funnel.md
Economics, CPA, CAC, ROIbusiness/economics/unit-economics.md
Brand voicebusiness/voice/tone-of-voice.md

The key rule for project-summary.md

business/project-summary.md should not become a warehouse for everything. It is a short summary the agent can read quickly before starting work.

Put this there:

  • what the business does;
  • what products or services it sells;
  • who it sells to;
  • what the main offer is;
  • what pains, desires, and objections the audience has;
  • what economics matter for the task;
  • what tone of voice to use;
  • what the current goal is;
  • links to the full files.

If the agent needs the big picture, it reads the summary. If it needs depth, it opens the exact thematic file.

What to do if the project already exists

Do not break the old structure or move everything mechanically. Add the missing layer carefully.

  1. Decide which agent you use: Claude Code, Codex, or both.
  2. Add CLAUDE.md or AGENTS.md.
  3. Create memory.md and plan.md if they do not exist.
  4. Move raw materials into raw/.
  5. Create business/INDEX.md and business/project-summary.md.
  6. Distill important business facts into thematic files.
  7. Put unknown facts into open-questions.md.

The goal is not to create another storage dump. The goal is to help the agent find the right context quickly.

Common mistakes

  • Putting all rules, memory, and plans into one file.
  • Duplicating different instructions in CLAUDE.md and AGENTS.md.
  • Putting raw transcripts directly into memory.md.
  • Not maintaining plan.md, which makes the agent restart from zero.
  • Not recording open questions.
  • Not having evals/, so the result is not checked.

FAQ

Should I create CLAUDE.md or AGENTS.md?

If you work in Claude Code, create CLAUDE.md. If you work in Codex, create AGENTS.md. If you use both tools, you can have both files, but do not keep conflicting rules in them.

Are CLAUDE.md and AGENTS.md the same?

Their role is very similar: they are startup instructions for an AI agent. The difference is that different systems read different file names. The rule structure can be almost the same, but the file name depends on the tool.

How do you save tokens in Claude Code and Codex?

Do not make the agent read the whole project. Use the rule file as a router, project-summary.md as a compressed overview, business/INDEX.md as a context map, and raw/ for source material.

Does every project need business/?

It is especially useful when AI works with product, marketing, ads, sales, content, or customer knowledge. For a purely technical project, you can start with the minimal structure and add business/ later.

Bonus: a ready-to-use prompt for Claude Code or Codex

Copy this prompt into Claude Code or Codex from the root of a new or existing project. It asks the agent to create the structure carefully: without deleting old files, duplicating rules, or inventing business facts.

You are working in the root of my project. Set up a file structure for working with an AI agent in Claude Code or Codex.

Main rules:
1. First, check which files and folders already exist.
2. Do not delete, rename, or overwrite existing files without my approval.
3. If a file already exists, do not replace it completely. Add only a small missing block or suggest changes.
4. If a business fact is unknown, write it to business/open-questions.md instead of guessing.

Rule file:
- if you are running in Claude Code, the main rule file is CLAUDE.md;
- if you are running in Codex, the main rule file is AGENTS.md;
- if the project needs both files, make one file canonical and make the other a short loader that points to the canonical file.

Create or complete this structure:

CLAUDE.md or AGENTS.md
memory.md
plan.md
raw/

business/
  INDEX.md
  project-summary.md
  open-questions.md
  products/
    catalog.md
    offer-matrix.md
  audience/
    segments.md
  marketing/
    funnel.md
  economics/
    unit-economics.md
  voice/
    tone-of-voice.md

outputs/
evals/
archive/

Add a short route for the agent into the rule file:
1. Read the rule file first.
2. Read plan.md for the current state.
3. Read memory.md for stable facts.
4. For business, marketing, ads, sales, and content tasks, read business/INDEX.md.
5. Look for raw sources in raw/.
6. Save finished outputs in outputs/.
7. Write unknown facts to business/open-questions.md.

In business/INDEX.md, create a map of business files.
In business/project-summary.md, create a short template: business summary, products, audience, offer, pains/desires/objections, economics, tone of voice, current goal, and links to full files.
In plan.md, create a short block: current task, next steps, blockers, and how to verify the result.
In memory.md, create a place for stable facts and important decisions.
In evals/, create a simple checklist for checking the structure.

After the work is done, show:
- which files were created;
- which files were updated;
- which questions remain open;
- how to verify that the structure works.

Conclusion

AI agents work more reliably when they have a clear file system instead of a chaotic chat: rules, memory, plan, raw sources, business context, outputs, and checks.

Use this approach as a base and adapt it to your tool and business. If you use Claude Code, start with CLAUDE.md. If you use Codex, start with AGENTS.md. If you need a business system, add business/ and teach the agent to work from facts instead of assumptions.

This is how you build AI agents that follow rules and company knowledge instead of inventing answers from scratch.