# enable: pre-select detected agents instead of skipping the picker

`44e0220`→[main](/content/gh/entireio/cli/commits/main/index.html)

On first run, a single detected built-in agent was used automatically and the multi-select picker was skipped entirely, so the user had no chance to add more agents without re-running. Route that case through the same picker used by the multi-agent and re-run paths, where detected built-in agents are already pre-selected — the user can confirm with enter or tick more first.

The non-interactive (no-TTY) path is unchanged: it still uses the detected agents without prompting. --yes likewise keeps using the caller's selection.

## Sessions

01KX0V5VG0RCW15C633W60GP9DView transcript

## Changes

2

- cmd/entire/cli

- Msetup.go+12/-11

- Msetup_test.go+45

```
1461 unmodified lines

// Returns the detected/selected agents and any error.
//
// On first run (no hooks installed):
//   - Single detected built-in agent: used automatically
//   - Single detected external agent: interactive multi-select prompt
//   - Multiple/no detected agents: interactive multi-select prompt
//   - Always shows the interactive multi-select (when a TTY is available)
//   - Pre-selects detected built-in agents so the user can confirm with enter
//     or add more; detected external agents are shown but not pre-selected
//   - Non-interactive (no TTY): uses detected agents, else the default agent
//
// On re-run (hooks already installed):
//   - Always shows the interactive multi-select
//   - Shows the interactive multi-select (when a TTY is available)
//   - Pre-selects only agents that have hooks installed (respects prior deselection)
//   - Non-interactive (no TTY): keeps the currently installed agents
//
// selectFn overrides the interactive prompt for testing. When nil, the real form is used.
// It receives available agent names and returns the selected names.
```

Mcmd/entire/cli/setup.go+12/-11

```go
if !hasInstalledHooks {
    switch {
    case len(detected) == 1:
        if isBuiltInAgent(detected[0]) {
            // When a selectFn is provided (e.g. --yes), skip the single-agent
            // shortcut so the caller's selection logic runs instead.
            if selectFn == nil {
                fmt.Fprintf(w, "Detected agent: %s\n\n", detected[0].Type())
                return detected, nil
            }
        // Announce the single detected built-in agent; it is pre-selected
        // in the multi-select form below so the user can confirm it or add
        // more. --yes (selectFn != nil) uses the caller's selection and
        // skips the announcement.
        if selectFn == nil && isBuiltInAgent(detected[0]) {
            fmt.Fprintf(w, "Detected agent: %s\n\n", detected[0].Type())
        }

case len(detected) > 1:
}

Mcmd/entire/cli/setup_test.go+45
