# Track: Qwen, Llama & Grok Follow-Up (Post-Phase 5)

This is a TODO list for setting up the follow-up track. The Tier 2 Tech Lead will execute items in order.

## Status

- [x] Spec drafted: `conductor/tracks/qwen_llama_grok_followup_20260611/spec.md`
- [ ] state.toml initialized
- [ ] metadata.json created
- [ ] Phase 1 ready to start

## Immediate TODOs (in order)

1. **Read parent track state**
   - [ ] Read `conductor/tracks/qwen_llama_grok_integration_20260606/state.toml` to confirm Phase 6 is complete
   - [ ] Read `conductor/tracks/qwen_llama_grok_integration_20260606/plan.md` and find tasks tagged t6.* to confirm Phase 6 done

2. **Create the follow-up track structure**
   - [ ] Create `conductor/tracks/qwen_llama_grok_followup_20260611/state.toml` with 5 phases × ~7 tasks
   - [ ] Create `conductor/tracks/qwen_llama_grok_followup_20260611/metadata.json` with verification_criteria

3. **Phase 1: Tool Loop Lift (first concrete work)**
   - [ ] Read current tool-loop patterns in `_send_minimax` (231 → 75 lines after refactor) and `_send_anthropic/_send_gemini/_send_gemini_cli/_send_deepseek` (inline loops)
   - [ ] Design `run_with_tool_loop(client, request, capabilities, *, pre_tool_callback, qa_callback, patch_callback, base_dir, vendor_name, history_lock, history, trim_func)` helper
   - [ ] Write 5 Red tests: no-tool-calls returns immediately, tool-calls dispatch, max-rounds limit, history appending, error-in-tool-call doesn't crash
   - [ ] Implement helper in `src/ai_client.py`
   - [ ] Apply to all 8 vendors
   - [ ] Audit script `scripts/audit_no_inline_tool_loops.py` to enforce the pattern
   - [ ] Verify all 38+ existing tests still pass
   - [ ] Phase 1 checkpoint

4. **Phase 2: PROVIDERS Move**
   - [ ] Decide: `src/ai_client.py` vs new `src/ai_client_providers.py` (open question in spec)
   - [ ] Move PROVIDERS constant
   - [ ] Update 5 import sites
   - [ ] Add `scripts/audit_providers_source_of_truth.py`
   - [ ] Verify all 38+ tests pass
   - [ ] Phase 2 checkpoint

5. **Phase 3: UX Adaptations 2-9**
   - [ ] Apply each adaptation one at a time, 1-2 per commit
   - [ ] Run live_gui tests in batch after each commit
   - [ ] Phase 3 checkpoint when all 9 adaptations done

6. **Phase 4: Local-First + Matrix Expansion**
   - [ ] Add `local: bool` to VendorCapabilities
   - [ ] Native Ollama adapter (verify URL https://docs.ollama.com/api/chat is up)
   - [ ] Meta Llama API adapter (verify URL https://llama.developer.meta.com/docs/overview is up — was 400 last session)
   - [ ] GUI: "Local Model" badge
   - [ ] Add 12 v2 fields to VendorCapabilities
   - [ ] Update all vendor registry entries
   - [ ] UI adaptations for the new fields
   - [ ] Phase 4 checkpoint

7. **Phase 5: Anthropic / Gemini / DeepSeek Migration**
   - [ ] Populate Anthropic matrix entries
   - [ ] Populate Gemini matrix entries
   - [ ] Populate DeepSeek matrix entries
   - [ ] UI adaptations
   - [ ] Docs + archive

## Pre-Work Prerequisites

Before starting Phase 1, confirm the parent track's Phase 6 is complete:
- `docs/guide_ai_client.md` updated with new vendors, matrix, helper
- `docs/guide_models.md` updated with new PROVIDERS entries
- Parent track folder **stays open** in `conductor/tracks/` (not archived)
- `conductor/tracks.md` reflects active status

## Lessons from Parent Track (apply to this one)

- **Surface gaps as they appear, not at the checkpoint.** If a task is going to be deferred mid-phase, say so immediately — don't footnote it later.
- **Be explicit about architectural deviations.** The `src/models.py` PROVIDERS sprawl should have been raised at Phase 2, not at Phase 5.
- **Plan for the test infrastructure before coding.** The parent track's tool-loop regression wasn't caught because no test exercised the loop. Future work: every helper gets tests BEFORE implementation.

## Status

- T0: Spec drafted (this file) — DONE
- T1: Parent track Phase 6 verification — TODO
- T2: Follow-up track files created — TODO
- T3: Phase 1 (tool loop lift) — TODO
