> ## Documentation Index
> Fetch the complete documentation index at: https://docs.vibely.sh/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Iterating

> Stay in flow across many turns without breaking what already works.

A Vibely session can run for hundreds of turns. Most of what makes a long session productive — not exhausting — is in how you iterate, not in how fast the model is.

**TL;DR**

* One change per turn. Revert, don't patch. Pin invariants you keep re-saying.
* Use [Plan Mode](/docs/tips/plan-mode) before anything that touches 3+ files.
* "Green state" = preview works + latest turn made sense + types clean. That's when you push to GitHub.

## Keep each turn small

A turn that does one thing is easy to roll back, easy to verify, and unlikely to break anything else. A turn that does five things is the opposite.

When you catch yourself writing a prompt with multiple "and"s, split it. Five small turns take less *total* time than one bundled prompt that fails twice.

## Trust the live preview

The preview reflects every turn within seconds. Click around between turns — don't wait until you have ten changes stacked up.

When something works, say so explicitly:

> *"Yes — that's the layout I want. Keep that pattern going forward."*

Confirmations get picked up by future turns. They prevent the agent from second-guessing a good answer.

## Roll back instead of patching

If a turn produces something wrong, the right next prompt is almost always a revert.

> *"Undo the last change to the orders page and try again — this time use a stacked card layout instead of a table."*

Reverts are clean. Bug-fix-on-top-of-bug-fix prompts accumulate cruft and make future iterations harder.

## Pin invariants early

Once you're happy with a foundational decision — component library, layout primitive, brand colour, copy tone — write it down in [project memory](/docs/tips/memory). Ask the agent: *"Save to memory: …"* and it lands in `.mana/memory.md` for every future turn.

The earlier you pin, the less drift you fight later.

## Sync to GitHub when you're in a green state

Green state checklist — push when **all** of these are true:

* The preview loads and renders without errors.
* The latest turn did what you asked.
* The code your eyes scanned looked right.
* `tsc` / lint is clean (or no worse than before the turn).
* You'd be okay with the project ending here.

If a future turn breaks something, branch off the green commit and replay. Don't treat the Vibely project as your only history. GitHub is your safety net.

## Use [Plan Mode](/docs/tips/plan-mode) for anything risky

When the next thing you're about to ask for touches more than one or two files, ask for a plan first.

> *"Plan how we'd switch from a single-tenant data model to multi-tenancy. List the files you'd touch."*

You get a written approach back. Edit, push back, ask for alternatives — until the plan is right. Then *"implement it"* unlocks the agent's full toolset.

[Plan Mode](/docs/tips/plan-mode) is the cheapest way to avoid expensive mistakes — flat 1 credit per turn regardless of how much it reads.

## Know when to start over

Sometimes the cheapest path forward is a new chat. Heuristics:

* **The agent has looped on the same error 3+ turns in a row.** Context is poisoned.
* **The chat has crossed 100 turns and the agent is contradicting itself.** Compaction has eaten too much.
* **You've changed the brief substantially mid-session.** The agent is still trying to satisfy the original brief.
* **The architecture you ended up with isn't the one you'd have asked for.** A fresh chat with the lessons from this one usually lands somewhere better.

Starting over *doesn't lose your code* — files are stored, the new session restores them. What you lose is the chat context, which at that point is more confusing than helpful.

Before starting over, ask the agent:

> *"Summarise the lessons from this session in 5–10 bullet points I can paste into a new chat."*

## Use comments and visual edits for design tweaks

For visual changes, two faster paths than prompting from scratch:

* **Visual edits** — click any element in the preview, type a change ("more padding", "use the brand purple"). The agent patches just that element. No re-think of the design system.
* **Pin comments** on the preview ([Project settings → People → Collaborators](/docs/workspace/project-settings#comments-on-the-preview)). Prompt *"address the open comments"* and the agent takes them as a batch.

## Next

<CardGroup cols={2}>
  <Card title="Prompting" icon="wand-magic-sparkles" href="/docs/tips/prompting">
    Prompt shapes that hold up across long sessions.
  </Card>

  <Card title="Memory" icon="brain" href="/docs/tips/memory">
    What survives compaction, what doesn't.
  </Card>

  <Card title="Troubleshooting" icon="wrench" href="/docs/tips/troubleshooting">
    When the loop breaks down.
  </Card>

  <Card title="Project settings" icon="gear" href="/docs/workspace/project-settings">
    GitHub sync, version history, and other safety nets.
  </Card>
</CardGroup>
