# Core concepts

> The model, the agent, and the action layer.

Source: https://maincode.com/docs/core-concepts
Section: Matilda Code · Matilda documentation

---

## The pieces

Matilda is a model, an agent, and the action layer between them. Name the
three and the rest of the product is just how they connect.

**Matilda** — The model

Matilda is Maincode's assistant, served from Melbourne. It reads your
code, reasons about it, and produces edits and commands. It never touches
your machine on its own.

**Matilda Code** — The agent

The coding agent that drives the model in a loop: read the repo, plan,
act, check the result, repeat until the task is done or it needs you.

**Action layer** — The tools

The typed tools the agent is allowed to call: read a file, write an edit,
run a shell command, search the tree. Every call is visible, and in the
default approval mode every write waits for you.

**Context** — What it sees

The working set the model reasons over: the files in play, the
conversation so far, and any notes the agent has kept about your project.

## How a task flows through

A request you type becomes a sequence of tool calls before a single line of
your code changes.

1. **Read.** The agent pulls the files it needs from the working tree into
   context. It reads them in place; it does not copy them.
2. **Plan.** The model proposes a sequence of edits and commands, and shows
   you that plan for anything non-trivial.
3. **Act.** Each step runs through the action layer. Edits appear as diffs;
   commands appear as the exact line to be run.
4. **Verify.** The agent runs your tests or build, reads the output, and
   either moves on or corrects course.

## The model, in one paragraph

Matilda is a single model with a long context window, not a router over
smaller ones. Maincode serves it from infrastructure we operate in
Melbourne. You give it the problem and the relevant slice of your codebase;
it returns edits, commands, and an explanation of why. It has no standing
access to your machine. The action layer does, and in the default mode the agent only reaches it
with your approval. That separation is the whole safety story: the model can
be wrong, but it cannot act on being wrong without a human or an explicit
permission in the loop.

> The point isn't a model that writes code. It's an agent that can change a
> real repository and still be safe to leave running.

## What we deliberately don't do

Matilda Code doesn't run as a background service, doesn't watch your
filesystem, and doesn't phone home with your source. It's a foreground
process you start, that acts only while you're there, and that stops when you
close it. If you ever wonder what it's doing when you're not looking, the
answer is nothing; it isn't running.

> **Note** — This is the design decision teams question first and rely on most: the agent
> has no life of its own outside the session you started.

## Where to go next

- [Headless and CI](https://maincode.com/docs/headless), running Matilda Code from scripts and
  pipelines.
- [Context and memory](https://maincode.com/docs/retention), what the agent keeps and what it
  forgets.
- [How an agent run works](https://maincode.com/docs/agent-runs), the loop and the five
  approval modes in detail.
