Building with chat
The AI turn lifecycle and the blocks a response is made of.
In Code you build by chatting. You describe what you want, and the AI agent (running inside your workspace container) writes files, runs commands, checks the preview, and streams its work back as a series of typed blocks.
The turn lifecycle
- You send a message (optionally with attachments or
@filementions). - Modus prepares the turn: it picks up your session and container, resolves which tools are allowed, and assembles context.
- The agent works inside the container: writing files, running bash, checking the preview.
- Events stream back to the UI live: files, tool calls, thinking, and plans.
- The turn ends: Modus logs it, accounts for tokens, takes a preview screenshot, and makes a git checkpoint.
- Your workspace and preview refresh.
What the AI sees
Each turn, the agent is given rich context so it doesn't work blind: recent and relevant turns, project facts pulled from earlier output, the design handoff, any contracts, the docs and deploy state, your env vars, current build errors, a fingerprint of the workspace, and any files you @-mentioned.
Message blocks
A response is built from typed blocks, each rendered its own way:
| Block | Shows |
|---|---|
| text | Markdown output |
| file | A create / edit / delete with a diff |
| tool | A tool call and its output (collapsible) |
| thinking | The agent's reasoning (toggle) |
| plan | A to-do list with checkboxes |
| approval | A card asking you to approve a choice, a command, a plan, a form, or a wallet action |
| git-checkpoint | The before/after commit for the turn |
| pipeline | Progress through a multi-stage task |
| tokens | Token usage for the turn |
| chapter-cta | A nudge to another chapter |
Background tasks
Not every job needs to hold up the conversation. Ask for something self-contained ("fix the failing service", "add tests for the tip flow") and Modus can run it as a background task: the work happens on an isolated copy of the workspace while you keep chatting, so a background experiment can never scribble over what you're doing in the foreground.
- Up to two tasks run at once; further ones queue with your consent.
- When a task finishes, you review its changes and Apply or Discard them — nothing merges into your workspace without your say-so.
- A short summary of each finished task lands back in the chat, so the main conversation knows what changed.
The @ menu
Typing @ in the composer opens one menu for both file mentions (pin a specific file into the agent's context) and session commands:
| Command | Does |
|---|---|
| Export | Download the whole conversation as Markdown |
| Undo | Roll the workspace back to the checkpoint before the last turn (with confirmation) |
| Compact | Summarize the conversation so far to free up context |
File ownership
Files are tagged by owner: AI, user, or template. The AI can write its own files and overwrite the initial template scaffold, but it won't overwrite files you uploaded. That keeps your hand-authored work safe from the agent.