---
title: "Keep one active Dynamic Profile"
lesson_id: "02"
---

# Keep one active Dynamic Profile

- **Lesson ID:** 02
- **Goal:** Switch Profile branches from app state so only one Profile is active.
- **Human lesson:** [02-one-active-profile.html](02-one-active-profile.html)

## Prerequisites

- Lesson 01 states.

## Inputs, outputs, and artifacts

- **Inputs:** Mode enum.
- **Outputs:** A DynamicProfile switch.

## Agent build steps

1. Store mode on an observable orchestrator.
2. Switch inside `body` to one Profile per mode.
3. Change mode before respond.
4. Do not run two sessions for two personas in one turn.

## Constraints

Illustrative Swift. Cite [WWDC26 241](https://developer.apple.com/videos/play/wwdc2026/241/). No em dashes.

## Key concepts

- A Dynamic Profile switches on `state.mode` and resolves to one Profile.
- Each mode gets its own instructions and model modifier.
- Change `mode` before `respond`, or the old Profile stays active.
- Do not open a second session for a second persona in the same turn.

## Takeaways

- Use the model router if gather stays on-device and decide uses PCC.
- Nested instructions compose but one configuration runs.
- The body re-evaluates each prompt.

## Acceptance checks

- Gather, decide, act, review, and done are shown.
- One active Profile is stated.
- Agent brief link is present.
