---
interactive: true
produces: .lf/config.yaml
---
Guide the user through setting up loopflow in this repository.
## Phase 1: Environment check
Run these checks:
```bash
git rev-parse --show-toplevel
uname -s
command -v claude
command -v codex
command -v opencode
test -f .lf/config.yaml && echo "config exists"
test -f ~/.lf/config.yaml && echo "user config exists"
```
Use `command -v` (POSIX builtin) — not `which`.
Print a summary:
```
Checking environment...
✓ git repo: /path/to/repo
✓ Claude Code
✓ OpenCode
- Codex (not installed)
Platform: Linux
Config: not initialized
User config: ~/.lf/config.yaml (exists)
```
## Phase 2: Agent guidance
**Multiple agents found:** Report all, ask which to default to.
**One agent found:** Default to it, report the choice.
**None found:** Show install instructions and stop:
```
No coding agent found. Install one:
Claude Code: npm install -g @anthropic-ai/claude-code
OpenCode: go install github.com/anomalyco/opencode@latest
Codex CLI: npm install -g @openai/codex
Then run `lf init` again.
```
Do not run package managers. Init detects — it never installs.
## Phase 3: Create or update repo config
Repo config (`.lf/config.yaml`) is for team conventions. Only write repo
properties — never personal preferences like yolo, ide, chrome, or autoprune.
**No `.lf/config.yaml`:**
- Ask: "Initialize loopflow in this repo? This creates .lf/config.yaml"
- Create the config with detected agent as default
**Existing `.lf/config.yaml`:**
- Compare `supported_harnesses` against detected agents
- If new agents detected that aren't listed, offer to add them
- If current `agent:` value isn't installed, offer to switch the default
- If everything matches, report "Config is up to date" and move on
- Never overwrite custom `exclude` patterns or other user-tuned fields
Repo config template:
```yaml
agent: <detected-default>
supported_harnesses:
- <detected-agents>
exclude:
- "*.lock"
- node_modules
- .venv
```
Use the agent name without model suffix: `agent: claude` not `agent: claude:opus`.
## Phase 4: User config
Personal preferences (yolo, ide, chrome, autoprune) belong in `~/.lf/config.yaml`.
Repo config wins when both files set the same key, so personal prefs should live
in the user file.
**User config exists:** Mention it and move on. Don't modify it.
**No user config:** Offer to create `~/.lf/config.yaml` with a couple of common
preferences:
- Skip permission prompts (yolo)? [y/N]
- Preferred IDE setup? [skip]
Keep it brief — two questions, not an interrogation. Generate only what the user
chose. If they skip everything, don't create the file.
## Phase 5: Optional extras
**External skills via npx:** mention that any Claude Skills package can be run as
`lf npx/<owner>/<repo>` — fetched live, no install step. `gstack` and core loopflow
workflows are built in; npx covers everything else.
## Phase 6: Next steps
Platform-aware guidance:
**macOS:**
```
Setup complete!
✓ Claude Code (default agent)
✓ .lf/config.yaml created
Next:
lf design # interactive design session
lf debug -c # paste an error, fix it
lf --list # see all steps and flows
Download Concerto for visual wave management
Run `lfd install` to set up the daemon for autonomous waves
```
**Linux:**
```
Setup complete!
✓ OpenCode (default agent)
✓ .lf/config.yaml created
Next:
lf design # interactive design session
lf debug -c # paste an error, fix it
lf --list # see all steps and flows
Set up tmux integration: lf op shell install
Run `lfd install` to set up the daemon for autonomous waves
```
## Conversation style
- Short, clear prompts
- One question at a time
- Let users skip optional things without judgment
- If something fails, explain what went wrong and how to retry manually