# Session Focus — Iteration Tracking and State

> **NEVER edit `.agent/ops/focus.json` directly.** Always use `ao focus` subcommands.

## Focus Commands

### View Current Focus

```bash
ao focus                     # Show current focus.json state
ao --format json focus       # JSON output
```

### Set Current Work

```bash
ao focus set-doing FEAT-0042@abc123 --task "Implementing query parser" --confidence normal
```

### Set What Was Just Completed

```bash
ao focus set-just-did "Completed FEAT-0042: query parser optimization, 60% speedup"
```

### Set Next Up

```bash
ao focus set-next "BUG-0005: Fix null pointer in event replay"
```

### Iteration Tracking

```bash
# Increment iteration and record batch
ao focus iteration --increment --issues "FEAT-0042,BUG-0005" --confidence-mix "1 high, 1 normal"
```

### Sync Focus State

```bash
ao focus sync    # Rebuild in_progress/next_queue/recent_work from active issues
```

## Iteration Workflow

At the **start** of each iteration:

```bash
# 1. Increment iteration counter
ao focus iteration --increment --issues "FEAT-0042,BUG-0005" --confidence-mix "2 normal"

# 2. Set active issue
ao focus set-doing FEAT-0042@abc123 --task "Implementing feature" --confidence normal
```

At the **end** of each iteration:

```bash
# Record summary
ao focus set-just-did "Completed FEAT-0042 and BUG-0005. All tests pass."
```

## Focus JSON Structure

The `focus.json` file tracks:

| Field | Description |
|-------|-------------|
| `doing_now` | Current active issue and task |
| `just_did` | Summary of last completed work |
| `next` | What's planned next |
| `iteration_tracking` | Iteration counter, batch issues, confidence mix |
| `in_progress` | Issues currently in_progress status |
| `next_queue` | Ordered queue of next issues |
| `recent_work` | Recently completed issues |
