m
Mars AI Operator Module 1 CLAUDE.md
~55 min · hands-on
Mars AI Operator · Module 1 · agentic coding

Contract with an agent. CLAUDE.md as your permanent signature.

CLAUDE.md — sening doimiy imzong

You're already using AI as a chat — you ask a question, get an answer, and copy it into your work. This module starts at a crossroads: next to chat, a different category has emerged — an agent, who doesn't answer, but acts. First, we'll figure out how they differ and why this changes your work — and at the end, you'll write your first CLAUDE.md and test it hands-on.

Duration
55 min
Format
Text + terminal
Prereq
You know cd and ls
After
Module 4
Before we start — let's clear up three questions
The terminal is needed at a basic level: you know cd and ls — that's enough to get started. You'll pick up the rest as you go.

Chat and agent. Two different tools.

Chat va agent — ikki xil asbob

You already know chat — that's ChatGPT or Claude.ai in your browser. You type a question — you get an answer. Whatever's useful, you manually copy into your work. Chat is a conversationalist

: smart, but "behind glass." It doesn't snoop in your files and knows nothing about your project until you tell it again.A second category has emerged next to it — an agentacts on its own: it opens your files, edits them, runs commands in the terminal, looks at the result, and moves on. It doesn't just "suggest what to type"; it does it and shows you what happened. This is no longer just a conversational partner, but an executor with hands.

Chat · you're already using it
Responds with text
Lives in a browser tab
You transfer code to the project manually
You explain the context anew each time
"how to write a loop in Python?"
Agent · this course
Acts: reads, edits, runs
Lives in your project — terminal, editor
Does it itself, you check the diff
You set the context once — it remembers
"fix the bug in auth.py and run tests"
The Main Point Both are needed. Chat — to quickly ask, discuss an idea, explain a concept. Agent — to do work in a real project. This course is about agents: specifically about agentic coding, when an agent works with your code. Next — what this changes on an ordinary Tuesday evening.

2024 vs 2026. The same bug — two worlds.

2024 vs 2026 — bitta xato, ikki dunyo
2024 · chat

You open ChatGPT. You copy a function. "Fix the bug." You get code. You paste it into the editor. It doesn't work. You copy the error back. You do this five times. The context lives in your head, not with the model.

2026 · agent

In the project folder, you type claude. The agent itself reads 7 files, finds the bug, fixes it, runs tests. You look at the diff and say "merge."

The same you, the same bug. The difference is that in the second case, the agent already knew your project: the language, the stack, your rules. This persistent memory is given to it by one file — CLAUDE.md. We'll start there.

Further in this module: how an agent works internally, a "before and after" demo on a real group, and your first CLAUDE.md — at the user level and in the project — to stop explaining to the agent every session who you are and for whom you are writing code.

After this module you will be able to: 1. Understand the basic principles of building multi-agent systems. 2. Create your own multi-agent system using the CLAUDE.md framework. 3. Integrate your multi-agent system with other tools and platforms. ## What is a multi-agent system? A multi-agent system (MAS) is a system composed of multiple interacting intelligent agents. These agents can be autonomous, meaning they can make decisions and act independently, or they can be collaborative, meaning they work together to achieve a common goal. ## Why use multi-agent systems? Multi-agent systems offer several advantages over traditional monolithic systems: * **Modularity:** MAS are inherently modular, making them easier to design, develop, and maintain. * **Scalability:** MAS can be easily scaled by adding or removing agents as needed. * **Robustness:** MAS are more robust to failures, as the failure of one agent does not necessarily lead to the failure of the entire system. * **Flexibility:** MAS are more flexible and can adapt to changing environments and requirements. ## CLAUDE.md: A framework for building multi-agent systems CLAUDE.md is a powerful and flexible framework for building multi-agent systems. It provides a set of tools and libraries that simplify the process of creating, deploying, and managing agents. ### Key features of CLAUDE.md * **Agent definition language:** CLAUDE.md provides a simple and intuitive language for defining agents and their behaviors. * **Communication protocols:** CLAUDE.md supports various communication protocols, allowing agents to interact with each other seamlessly. * **Agent management:** CLAUDE.md offers tools for managing agents, including their lifecycle, deployment, and monitoring. * **Integration with other tools:** CLAUDE.md can be easily integrated with other tools and platforms, such as databases, messaging systems, and web services. ## Building your first multi-agent system with CLAUDE.md Let's walk through an example of building a simple multi-agent system using CLAUDE.md. In this example, we will create a system where an agent (let's call it "MarsCode") helps you write code. ### Step 1: Define the agent First, we need to define our agent. We'll create a file called `MarsCode.md` in the `AGENTS.md` directory. ```markdown # MarsCode ## Role I am a helpful AI assistant that specializes in writing code. I can help you with various programming tasks, from generating code snippets to debugging existing code. ## Capabilities - Generate code in various programming languages (Python, JavaScript, Java, C++, etc.) - Debug code and identify errors - Explain code concepts and algorithms - Refactor code for better readability and performance - Write unit tests ## Constraints - I cannot execute code directly. - I cannot access external websites or APIs. - I cannot perform actions that require physical interaction. ## Examples ### Prompt "Write a Python function to calculate the factorial of a number." ### Response ```python def factorial(n): if n == 0: return 1 else: return n * factorial(n-1) ``` ### Prompt "Debug the following JavaScript code: `function add(a, b) { return a + c; }`" ### Response The error is in the line `return a + c;`. The variable `c` is not defined. It should be `return a + b;`. ``` ``` ### Step 2: Interact with the agent Now that we have defined our agent, we can interact with it using the CLAUDE.md terminal. ```bash claude prompt "Write a Python function to reverse a string." ``` The CLAUDE.md terminal will then send your prompt to the MarsCode agent, and the agent will respond with the generated code. ### Step 3: Create a sub-agent Let's say we want MarsCode to be able to delegate specific tasks to other agents. We can create a sub-agent for this purpose. For example, let's create a "CodeReviewer" sub-agent that reviews the code generated by MarsCode. Create a file called `CodeReviewer.md` in the `AGENTS.md` directory: ```markdown # CodeReviewer ## Role I am a code reviewer. My purpose is to review code for correctness, style, and best practices. ## Capabilities - Identify syntax errors - Suggest improvements for code readability - Check for adherence to coding standards - Provide feedback on algorithm efficiency ## Constraints - I cannot write code myself. - I cannot execute code. ## Examples ### Prompt "Review the following Python code: `def factorial(n): if n == 0: return 1 else: return n * factorial(n-1)`" ### Response The code is correct and follows good practices. However, for very large numbers, recursion depth might be an issue. An iterative solution could be more robust. ``` ``` ### Step 4: Integrate the sub-agent into MarsCode Now, we need to modify `MarsCode.md` to allow it to use the `CodeReviewer` sub-agent. We can do this by adding a "Tools" section to `MarsCode.md`: ```markdown # MarsCode ## Role I am a helpful AI assistant that specializes in writing code. I can help you with various programming tasks, from generating code snippets to debugging existing code. ## Capabilities - Generate code in various programming languages (Python, JavaScript, Java, C++, etc.) - Debug code and identify errors - Explain code concepts and algorithms - Refactor code for better readability and performance - Write unit tests ## Tools - **CodeReviewer:** Use this tool to get a review of generated code. ## Constraints - I cannot execute code directly. - I cannot access external websites or APIs. - I cannot perform actions that require physical interaction. ## Examples ### Prompt "Write a Python function to calculate the factorial of a number, and then have it reviewed." ### Response ```python def factorial(n): if n == 0: return 1 else: return n * factorial(n-1) ``` <tool_code_reviewer>Review the following Python code: `def factorial(n): if n == 0: return 1 else: return n * factorial(n-1)`</tool_code_reviewer> ``` ``` Now, when you prompt MarsCode to write code and have it reviewed, MarsCode will internally call the `CodeReviewer` sub-agent and include its response in its own output. ### Step 5: Understanding Context and Prompt In CLAUDE.md, the `context` refers to the information that an agent has about the current situation or task. This can include previous interactions, user preferences, and external data. The `prompt` is the specific instruction or question that you give to an agent. When you interact with an agent, CLAUDE.md automatically manages the context for you. It keeps track of the conversation history and provides it to the agent, allowing the agent to maintain a coherent and consistent dialogue. You can also explicitly provide context to an agent using the `--context` flag in the CLAUDE.md terminal: ```bash claude prompt "What is the capital of France?" --context "The user is planning a trip to Europe." ``` This will provide the agent with additional information that it can use to generate a more relevant response. ## Conclusion This module has provided you with a basic understanding of multi-agent systems and how to build them using the CLAUDE.md framework. You have learned how to define agents, create sub-agents, and interact with them using the CLAUDE.md terminal. As you continue to explore CLAUDE.md, you will discover its advanced features and capabilities, allowing you to build even more sophisticated and intelligent multi-agent systems. Happy coding!

How an agent does this. A cycle of actions.

Qanday ishlaydi · qayerda · MarsCode

You've already understood the difference: chat answers, an agent acts. Now — how exactly it acts so that it doesn't look like magic.

Inside — a cycle of actions, not just one reply. You write the task. The agent decides "first I'll read the file" - and reads it. Sees the content, thinks further: "now I'll edit" - and edits. Then it runs the tests itself. And so on in a loop, until the task is closed or it runs into a question for you.

┌──────────────┐ │ You: task │ └──────┬───────┘ ▼ ┌──────────────┐ ┌──────────────┐ │ Claude │─────▶│ Read file │ │ (model) │ └──────┬───────┘ └──────▲───────┘ │ │ ▼ │ ┌──────────────┐ │◀────────────│ result │ │ └──────────────┘ │ ├──▶ Edit file ──▶ result ──┐ │ │ ├──▶ Bash (test) ──▶ result ──┤ │ │ └──▶ Read again ──▶ result ──┘ ▼ ┌──────────────┐ │ Answer to you │ │ (diff/summary) │ └──────────────┘
↔ scroll if it doesn't fit

Each downward arrow is a new model call. On large tasks, there are dozens of them. You see this as a semi-transparent stream in the TUI: Reading src/auth.py, Editing tests/test_login.py, Running pytest.

Where to run it

Claude Code is not tied to one window. The same setup (your CLAUDE.md) works in the terminal, in the editor, and in the browser. You choose where it's more convenient for the task.

Where
When convenient
Installation
Terminal
Live coding with kids on a projector, scripts, Mars repos. Default for course.
curl install
VS Code
Inline diffs, @-mentions, plan review right in the editor
extension
Desktop app
Several sessions side-by-side, visual diff, background tasks
.dmg / .exe
Web
claude.ai/code — without installation, for quick checks
browser
JetBrains
PyCharm / IntelliJ — if you already work there
plugin
Key idea for a mentor Hey there! So, you're looking to build a Claude-powered agent, huh? That's awesome! Let's get you started. First things first, you'll want to check out the `CLAUDE.md` and `AGENTS.md` files. They're packed with essential info about how Claude works and how to structure your agents. Think of them as your foundational textbooks. Now, let's talk about the core idea: an agent is essentially a loop. It takes a context, processes it, and then decides what to do next. This could be anything from generating text to executing a command. Here's a basic example of how you might set up an agent: ```python class Agent: def __init__(self, name, prompt_template): self.name = name self.prompt_template = prompt_template self.context = [] def run(self, initial_input): self.context.append(f"User: {initial_input}") while True: # Generate a prompt based on the current context prompt = self.prompt_template.format(context="\n".join(self.context)) # Send the prompt to Claude and get a response claude_response = self._send_to_claude(prompt) # Add Claude's response to the context self.context.append(f"Claude: {claude_response}") # Decide what to do next based on Claude's response action = self._parse_claude_response_for_action(claude_response) if action == "FINISH": break elif action == "EXECUTE_COMMAND": command_output = self._execute_command(self._extract_command(claude_response)) self.context.append(f"System: {command_output}") # ... other actions ``` See how it works? The agent keeps adding to its `context` and making decisions. You can also have sub-agents! Imagine a main agent that delegates specific tasks to smaller, specialized agents. For instance, a "research agent" could be a sub-agent of a "report writing agent." This is a powerful way to break down complex problems. To interact with your agent, you'll likely use a terminal. You'll send prompts, and the agent will respond. ```bash python your_agent_script.py "Hey Claude, what's the weather like in London?" ``` The `Claude Code` refers to the actual code you write to interact with the Claude API. This is where you'll handle API keys, model selection (like `claude-3-opus-20240229`), and parsing the responses. MarsCode is a hypothetical framework or environment that could be used to develop and deploy these agents. Think of it as a specialized IDE or platform for agent development. Remember, the key is to craft good prompts. A well-designed prompt can guide Claude to produce exactly what you need. Experiment with different prompt structures and see what works best! And don't forget to manage your context effectively. Too much context can make your prompts long and expensive, while too little might lead to Claude losing track. Happy building! Let me know if you have any more questions. ~/.claude/CLAUDE.md works everywhere. One ./CLAUDE.md in the repo — too. You change the window — the contract remains.

MarsCode — our agent

MarsCode — our own tool in the same category as Claude Code. It goes to models via Mars, so for you free — The school issues the balance. One thing is important for you here: you don't need to pay for the models.

In this course, we'll be learning with Claude Code — everything works “out of the box” with it, and there's full documentation. We'll connect MarsCode in Module 5 when we start building our own Skills and saving costs.

Codex (OpenAI) and Antigravity (Google) — same thing, different vendors. We won't touch them in this course; if a student asks, it's just another agent, but from a different company.

Demo. Without CLAUDE.md and with it.

Bir xil so'rov — ikkita natija

Case Study: Mentor Zukhra, Yunusobod location, Python 7-9 years old group, 6 children. She opens Claude Code in the repo with starter projects. She asks for the same thing. First without a contract, then with one.

Predict first Before looking at Scenario B, write down on a piece of paper: what exactly will change in the agent's output if it has a project CLAUDE.md? How many questions will it ask? In what style will it write the code? Write down your hypothesis — then we'll compare it with reality.
A · without CLAUDE.md
$ cd ~/mars-lessons/python-7-9 && claude# agent starts from scratch

> help me add another game
  about math for my students

Claude: I'm ready to help. A couple
of questions to understand the context:

  1. What is the age of the students?
  2. In what language should the explanations
     be in the comments?
  3. Which libraries are allowed?
  4. How detailed should the
     comments be?
  5. Is OOP allowed or a procedural
     style?

# 3 minutes of ping-pong in each session.
Without a contract — it's a fresh start every time. Zukhra opens Claude 8-10 times a week. That's 30 minutes for one “hello, it's me again” interaction.
B · with CLAUDE.md
$ cd ~/mars-lessons/python-7-9 && claude# agent automatically reads ./CLAUDE.md

> help me add another game
  about math for my students

Claude: I'll create a starter
“Guess the Number” in the project style:

  • pygame + random, no f-strings
  • variables in Russian-Latin script
  • a comment for every 2 lines
  • a short header “What this
    program does”

  I read 01-circle.py for style.
  Creating 06-guess-number.py.

Edit: 06-guess-number.py (+38)
Bash: python3 -m py_compile ✓

# 40 seconds to result.
With a contract — the agent immediately gets into the project's spirit. No clarifications needed, because they are already written in the file.

Project CLAUDE.md for Python 7-9 years old group

Here's the file that's in Zukhra's repo. Copy it as a starter — it's one of three ready-made pre-build templates:

./CLAUDE.md · mars-lessons/python-7-9# Mars IT School — Python for 7-9 years old group
# Yunusobod location, mentor Zukhra

## Who reads this code
- Children 7-9 years old, four of whom are seeing programming for the first time.
- Language of explanations: Russian. Uzbek Latin script is allowed
  in variable names if it helps (`tugma` instead of `button`).
- Terminology: do not use "function", "class", "loop"
  without explanation through an everyday analogy in the comment.

## Code Conventions
- **Every line is commented in Russian.** This is not code for production,
  this is code for a lesson.
- Variable names — simple words or transliteration (`schyot`, not `score_counter`).
- Only `pygame` and `random`. Do not use f-strings,
  list comprehensions, dataclasses.
- The file always starts with a short comment
  “What this program does” on 1 line.

## Workflow
- Each file must be run via `python3 file.py` without arguments.
- Before commit — `python3 -m py_compile file.py` (syntax check).
- Do not edit `.solutions/` — it contains ready solutions for subsequent groups.
Principle A file is “everything I would repeat to the agent if it had amnesia”. The age of the children, language, conventions, prohibitions. Each rule is specific: not “write clearly”, but “comment every 2 lines in Russian”.

Different mentor — different contract

The same template “who reads / conventions / workflow” — but a different audience. Timur, Chilonzor location, second year Python, preparing Olympiad participants 12-14. Compare with Zukhra's:

./CLAUDE.md · mars-lessons/python-olymp-12-14# Mars IT School — Python Olympiad for 12-14 years old group
# Chilonzor location, mentor Timur

## Who reads this code
- Children 12-14, second year Python, preparing for the Republican
  Olympiad in Informatics.
- Language of explanations: Russian. Variable names — English
  (the Olympiad is in English, no point in teaching otherwise).
- Know: functions, loops, dictionaries, generators.
  DO NOT know: classes, dataclasses, async.

## Code Conventions
- Full typing: `def solve(n: int) -> list[int]:` — we teach
  to read signatures.
- Complex algorithms — definitely `doctest` or `assert`
   with an example from the problem statement.
- The solution must pass tests in `./tests/` (`pytest`).
- Each file starts with a docstring: problem, constraints,
  time/memory complexity.
- DO NOT use third-party libraries except `math`, `collections`,
  `itertools`, `heapq`, `bisect` — Olympiad set.

## Workflow
- Before commit — `pytest -q` (all green).
- Solutions in `./solutions/`, tests in `./tests/`.

For Zukhra — prohibition of typing and list comprehensions, for Timur — mandatory typing. One template, two different contracts. The third template — Shahzod, Sergeli, React/TypeScript 15-17 — is located nearby in the file starters.md. Take one as an example and adapt it to your group.

The two files you need. User and project.

Ikki fayl — user va project

CLAUDE.md lives on two levels, and for getting started, you need exactly these two. Both are loaded automatically at the beginning of each session — no need to explain again.

Userabout you
~/.claude/CLAUDE.md · one for all projects. Who you are, what language to speak, how you like to work with the agent. You write it once.
Projectabout the group
./CLAUDE.md in the repo · children's age, stack, conventions, restrictions. Stored in git — common for the team. The most important file for a mentor.
When they argue If the user file says "speak English", and the project file says "in Russian, explain to children" — the winner is project: it's about specific work and is read last. Practical rule: in user, write about yourself, in project — about this group, and there will be no conflicts.

There are two more levels you can skip for now: managed (a rule for the whole school, set by IT — it's empty for us right now) and local (./CLAUDE.local.md — personal notes on the project, in .gitignore). You'll need them later — not today.

Claude also takes notes himself

Besides your CLAUDE.md, the agent itself records what it noticed along the way: which commands build the project, where there were bugs, what patterns are in your code. The command /memory shows all memory files and lets you open them. This is a supplement, not a replacement: CLAUDE.md — what manually you want it to always know; auto-memory — what it itself understood and remembered.

Exercise. Try it today, 30 minutes.

Bugun o'zing qil — 30 daqiqa

Four parts. Do it manually in the terminal, don't just read it as theory. After this, you'll have a working user+project CLAUDE.md pair and a verified /memory.

01
Installation and check

On Mac/Linux: curl -fsSL https://claude.ai/install.sh | bash. On Windows PowerShell: irm https://claude.ai/install.ps1 | iex. To check: claude --version. The first launch will ask you to log into your Anthropic account — no card needed, the free tier is enough to start. If something doesn't install or asks for payment — write in the mentors' chat, we'll sort it out. It's not your problem.

~ 5 min
02
User-level: ~/.claude/CLAUDE.md

Create a file, copy the template below, and adapt it to yourself. This is what Claude knows about you in any project.

~/.claude/CLAUDE.md# About me
I am a mentor at Mars IT School, point <X>,
leading <stack> for age group <Y>.
Working language: Russian. English for technical terms.

# Agent Workflow Style
- Explain your plan to me before editing files
  (use plan mode when appropriate)
- If you're unsure about an API/library — ask, don't invent
- When writing code that will go to children —
  short lines, simple names, comments in Russian
- Always show git diff before committing, don't commit yourself

# What I usually do
- Prepare starter projects for lessons
- Check students' code
- Write internal scripts for Mars
~ 10 min
03
Project-level: ./CLAUDE.md in one repo

Choose one educational repo. Take one of the three ready-made templates in starters.md (Zukhra-Python-7-9, Timur-Python-Olimp-12-14, Shahzod-React-15-17) as an example — copy-paste and adapt it for your group. At least three sections: "who reads this code", "conventions", "workflow". Size — up to 200 lines, otherwise adequacy drops.

Alternatively — the command /init in the repo: Claude Code will go through the code itself and generate an initial CLAUDE.md, and you'll adjust it for the group.

~ 15 min
04
Test via /memory

Run claude in the same folder. In the session, type /memory — you should see both files in the list. If the user-file didn't appear — check the path (it's exactly ~/.claude/CLAUDE.md, not ~/.claude/Claude.md).

Give a simple request: "add a greeting function". Make sure the agent writes in the spirit of CLAUDE.md (language, style, prohibitions). If not — do a /memory, open the files, see what got in there.

~ 5 min
Common mistake Making a 500-line CLAUDE.md "just in case". Doesn't work. Anthropic documentation explicitly states: the goal is up to 200 lines, otherwise the model follows instructions less effectively. If it grows too large — move specifics to .claude/rules/ (path-scoped) or to Agent Skill (Module 5).

Quiz. Check what stuck.

O'zingni tekshir · 3 ta savol
Before checking knowledge · 30 seconds 1) What was the most unexpected thing for you in this module?
2) Where does your habit from ChatGPT (or another chat) contradict this?
Think aloud or write it down — this solidifies it better than any quiz.
Question 01 · scenario

Your ~/.claude/CLAUDE.md says "write in English". The ./CLAUDE.md of the educational repo says "write in Russian, we're explaining to children". You run claude in this folder and ask to add a function. In what language will the agent write comments?

aIn English — the user-level is broader and has priority.
bIn Russian — project is closer to the working folder and appears last in the context.
cIt will explicitly ask which language to choose in this repo.
b. Both files are read at the beginning of the session, but project is closer to the work and comes last — so in case of conflict, it wins, meaning Russian. Practical conclusion: keep user for yourself, project for the group, and there will be no contradictions. If it seems like the agent is confusing rules — type /memory and see what loaded.
Question 02 · scenario

Two weeks ago, you made a commit in the training repo ./CLAUDE.md with the rule "do not use f-strings". You open the repo again and type claude. Which file with your conventions will automatically load at the beginning of the session?

aNone — you need to manually type "read CLAUDE.md" in the first message.
bOnly ~/.claude/CLAUDE.md — the project file is pulled on request.
cBoth: ~/.claude/CLAUDE.md and ./CLAUDE.md — they are concatenated into the session's starting context.
c. This is the whole point of the "contract": you write the file once, then Claude Code, every time it runs, traverses the tree from the root up and pulls CLAUDE.md / CLAUDE.local.md. The command /memory in the session shows exactly what loaded — this is the first check if it seems like the agent "forgot" your rules.
Question 03 · scenario

You lead two groups: Python 8-9 years old and React 15-17 years old. You want the agent to speak Russian with you everywhere and know that you are a mentor — and in the Python repo, also write simple code without f-strings. Where should you put what?

a"In Russian, I'm a mentor" — in ~/.claude/CLAUDE.md (about you). "Kids 8-9, no f-strings" — in ./CLAUDE.md of the Python repo (about the group).
bEverything in one ~/.claude/CLAUDE.md — it's shorter and you won't get confused.
cEverything in ./CLAUDE.md of each repo — the user file is not needed at all.
a. The rule is simple: in user — about you (the same across all projects), in project — about the specific group (different for Python and React). Option (b) will break when the agent starts avoiding f-strings in the React repo for no reason. Option (c) will force you to copy "in Russian, I'm a mentor" into each repo — and they will diverge.
Cheat Sheet All Claude Code slash commands on one page — for printing and quick reference: _lib/claude-code-cheatsheet.md.

What's next. Module 4 — context engineering.

Keyingisi — kontekstni boshqarish

You now have a permanent signature — the agent in any Mars project knows who you are and who you're writing for. The next mandatory module is the fourth (modules 2-3 come after feedback): about working memory and context engineering. What is /compact, why the agent "gets dumber" towards the evening of a long session, how to use sub-agents as a way to isolate context. This is the module for which the course exists.

Modules 2-3 (Delegation × NTP, Description × Knowledge) and Module 5 (your own Sub-agents and Agent Skills) — after pilot feedback from the first mentors.

How was the module overall?