# Editing Code

The agent writes all the code for your app, and you shouldn't need to edit it yourself outside Agent Chat. The code is yours, however, so if you're comfortable with it, you can open your app's source and edit it manually.

## When to Edit Directly

Hand-editing is for when you're confident working in code and want to make a change yourself. It's an option for fine control, but prompting the agent is the recommended way to change your app. You might open the source when:

- You're confident making a specific change yourself and would rather do it directly.
- You want precise control over exactly how something is written.
- You want to see how the agent built something, to understand or learn from it.

For everything else, prompt the agent. It knows the whole project, keeps your [version history](/prompting/version-history) intact, and won't leave the app in a half-broken state. See [Iterating](/prompting/iterating) for the recommended way to make changes.

## Opening the Source

Each project lives in its own folder on your Mac. From the project's ** More…** menu, choose ** Reveal in Finder** to open that folder. Inside it, the editable source sits in a `.glaze-sources` subfolder. Point your editor at that folder to browse and edit the files directly. The agent reads from and writes to the same source, so what you see in your editor is exactly what the agent is working with.

> [!NOTE]
> A Glaze app is a normal project on disk: a renderer (the UI), a backend (the "main" process), and the files that tie them together. You don't need to know the layout to prompt the agent, but it helps if you plan to edit by hand.

## Picking Up Changes

Once you've edited a file, your app needs to pick up the change. While the app is running in development, it reloads as you save, so small UI tweaks show up quickly. Larger changes, like new dependencies or backend logic, may need a fresh build, which the agent normally handles for you when it runs the app.

If you're unsure whether an edit took effect, the simplest path is to ask the agent to run the app again. It rebuilds and relaunches from your current source. See [Running Your App](/capabilities/running-your-app).

## Staying in Sync

You don't need to tell the agent that you edited a file. It reads the current source each time it works, so your changes are simply part of the project from then on. There's no separate "import my edits" step.

It's still good practice to mention what you changed in your next prompt, so the agent builds on your edit rather than working around it. For example: "I tweaked the header spacing manually, please keep that and add a search box below it."

> [!WARNING]
> Manual edits are not saved as a [version](/prompting/version-history) on their own. A version is recorded when the agent makes a change. If you edit code directly and want a checkpoint, make a small follow-up prompt so the agent captures the current state.

## Reverting an Edit

If a manual edit breaks your app, you have two ways back:

- **Roll back to a version**: If your edit happened after the agent's last change, rolling back to that version discards your manual changes and returns to the last known-good state. See [Version History](/prompting/version-history).
- **Ask the agent to fix it**: Describe what you changed and what broke, and the agent can repair the file. Pasting any error you see makes this much faster.

### Will editing code manually break things the agent can't fix?

No. The agent reads your current source, and it can see and repair manual edits like any other code. If a change goes badly wrong, rolling back to the last version the agent made is always available as a clean reset.

### Do I need to edit code to build a good app?

Not at all. The agent does all the coding, and most people will never need to open the source. Hand-editing is an option for fine control, not a requirement.
