PostHog Code tasks
Contents
A task is the unit of work in PostHog Code. Every time you ask the agent to fix a bug, add a feature, or investigate something, you're creating a task. Each task is tied to a specific repository and persists across restarts, handoffs between your computer and the cloud, and handoffs between people.
Task modes
Tasks run in one of three places. The mode determines where the agent works and how changes are isolated from the rest of your work.
| Mode | Where it runs | Isolation | Best for |
|---|---|---|---|
| Local | Your computer, current branch | None | Quick, small changes |
| Worktree | Your computer, dedicated branch + working directory | Per-folder isolation | Longer work, parallel tasks on the same repo |
| Cloud | PostHog-managed workspace | Fully isolated from your computer | Long-running tasks |
To run several tasks in a grid (mixing these modes), use Command Center.
Local
The agent runs on your computer, inside your repo, on your current branch. There's no isolation: changes land in your working tree until you commit them.
Local is the fastest option and the right choice for contained, focused work like a quick fix, a one-off refactor, or something you want to watch closely.
Worktree
The agent runs on your computer, but inside a dedicated git worktree on a per-task branch.
Worktrees give you full isolation without switching branches or juggling separate clones. You can run several tasks in parallel on the same repo, each one on its own branch and in its own working directory.
For setup details and configuration options, see Worktrees.
Cloud
The agent runs in a sandbox PostHog spins up for the task. You can close the app, switch networks, or shut your computer, and the task keeps going. Reconnect when you're ready to take over locally or open a PR.
See Cloud runs for the full story, including how to move tasks between cloud and local.
Autonomy modes
Separate from where a task runs, each task has an autonomy mode that controls how much the agent does on its own before checking in with you. Switch modes from the selector in the chat window, even partway through a task.
| Mode | What the agent does |
|---|---|
| Plan | Investigates and asks questions first, then proposes a plan for you to approve before it changes any code |
| Default | Makes changes, but pauses to ask before sensitive or destructive actions |
| Accept edits | Applies file edits automatically without asking for each one |
| Auto | Runs autonomously with minimal interruptions |
New tasks start in Plan mode by default. You can change this in settings to remember the last-used mode instead.
Plan mode
In Plan mode the agent explores the problem and asks clarifying questions before writing any code. It surfaces options you can pick from, and if none of them fit you can type your own answer in the field. Once you approve the plan, it moves on to making the changes. It's the safest way to start anything non-trivial, since you align on the approach before the agent touches your code.
Queue and steer follow-ups
You don't have to wait for the agent to finish before sending your next message. A toggle in the chat window controls what happens when you send a follow-up while the agent is still working:
- Queue adds your message to the back of the line. The agent finishes what it's doing, then works through your queued follow-ups in order.
- Steer interrupts the agent at its next turn and redirects it right away, instead of waiting for the whole task to finish.
Next steps
- Learn how environments prepare a task before the agent starts.
- Learn how cloud runs keep a task going without your computer.