Skip to content
This repository was archived by the owner on Apr 11, 2026. It is now read-only.

Commit ba44cbb

Browse files
z23ccclaude
andcommitted
fix: align tool priorities — native Claude Code tools first, flowctl for unique capabilities
Scouts and worker now correctly prioritize: - Grep/Glob (native) for exact search — default, fastest, regex support - Read (native) for file reads — offset/limit, PDF/image support - Edit (native) for code edits — diff preview, user visibility - flowctl repo-map/code-structure — unique (no native equivalent), always valuable - flowctl search — only when fuzzy matching needed (uncertain file names) - flowctl patch replace — only as fallback when Edit fails (Teams mode drift) - flowctl index search — only for large repos with repeated searches Fixes over-recommendation of flowctl tools over superior native alternatives. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 3f6a395 commit ba44cbb

5 files changed

Lines changed: 47 additions & 30 deletions

File tree

agents/context-scout.md

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,19 @@ effort: medium
1111

1212
You are a context scout specializing in **token-efficient** codebase exploration using RepoPrompt's rp-cli. Your job is to gather comprehensive context without bloating the main conversation.
1313

14-
## Context Tools (Preferred Order)
14+
## Context Tools
1515

16-
1. `flowctl repo-map --budget 1024 --json` — ranked symbol overview of entire project
17-
2. `flowctl code-structure extract --path <dir> --json` — symbols for specific directory
18-
3. RP context_builder — deep cross-file analysis (if RP available)
19-
4. Read individual files — last resort
16+
Match tool to need — flowctl for structure overview, native tools for precise reads:
2017

21-
Use flowctl tools for fast, token-efficient structure overview before resorting to rp-cli or file reads.
18+
| Need | Tool | Why |
19+
|------|------|-----|
20+
| **Project structure overview** | `flowctl repo-map --budget 1024` | Unique — PageRank-ranked symbols, ~1K tokens for entire project |
21+
| **Directory symbol scan** | `flowctl code-structure extract --path <dir>` | Unique — function/type signatures without reading full files |
22+
| **Deep cross-file analysis** | RP context_builder | Best for "how does X work across files" questions |
23+
| **Read specific code** | `Read` (native) | Best for precise reads with line ranges — supports offset/limit |
24+
| **Find exact patterns** | `Grep` (native) | ripgrep, best for regex with context lines |
25+
26+
**Start with repo-map** (1K token overview), then drill down with native Read/Grep. RP context_builder for deep cross-file questions. Don't use flowctl tools as a replacement for Read — they show signatures, not implementation.
2227

2328
## When to Use This Agent
2429

agents/repo-scout.md

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,19 @@ You are a scout: fast context gatherer, not a planner or implementer. Read-only
1515

1616
You are a fast repository scout: find existing patterns and conventions that should guide implementation. NOT to plan or implement — just find what already exists.
1717

18-
## Search Tools (Preferred Order)
18+
## Search Tools
1919

20-
1. `flowctl search "<query>" --limit 20 --json` — fuzzy file name search with frecency + git status ranking
21-
2. `flowctl index search "<query>" --limit 20 --json` — trigram indexed content search (if index exists)
22-
3. Grep/Glob — fallback for exact regex patterns
20+
Use the right tool for each job — don't default to flowctl when native tools are better:
2321

24-
Use flowctl search tools first for broad discovery, then fall back to Grep/Glob for precise regex matching.
22+
| Need | Tool | Why |
23+
|------|------|-----|
24+
| **Exact regex match** | `Grep` (native) | ripgrep, fastest for known patterns, supports context lines + file type filter |
25+
| **Find files by pattern** | `Glob` (native) | Fast pattern matching, modification-time sorted |
26+
| **Fuzzy file name search** | `flowctl search` | When you're unsure of exact name, adds frecency + git ranking |
27+
| **Indexed content search** | `flowctl index search` | Only if index exists (`flowctl index status`), <1ms for repeated searches |
28+
| **Code structure overview** | `flowctl code-structure` | Unique — shows function/type signatures without reading full files |
29+
30+
**Default to Grep/Glob.** Use flowctl search tools only when native tools aren't enough (fuzzy matching, frecency ranking, or structure overview).
2531

2632
## Search Strategy
2733

agents/worker.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -205,9 +205,10 @@ Use the FLOWCTL path and IDs from your prompt:
205205
git status
206206
git log -5 --oneline
207207
208-
# 3. Understand project structure and find related files
209-
$FLOWCTL repo-map --budget 512 --json
210-
$FLOWCTL search "<task-relevant-terms>" --git modified --json
208+
# 3. Quick context (optional — skip for trivial tasks)
209+
# Only run these if the task touches unfamiliar code:
210+
# $FLOWCTL repo-map --budget 512 --json ← project overview (large projects only)
211+
# $FLOWCTL search "<terms>" --git modified ← find recently changed related files
211212
212213
# 4. Check memory system
213214
<FLOWCTL> config get memory.enabled --json
@@ -402,7 +403,7 @@ The key constraint: **no implementation code before a failing test exists**. Thi
402403

403404
Follow the `flow-code-incremental` skill: build in vertical slices (Implement→Test→Verify→Commit per slice). Each slice leaves the system working. Scope discipline: only touch what the task spec requires.
404405

405-
For code edits, prefer `flowctl patch replace --file <path> --old "text" --new "text" --json` when the target text might have drifted from what was read earlier. It uses fuzzy matching with fallback, reducing failed edits from whitespace or minor changes.
406+
For code edits, **use Edit (native tool) by default** — it shows diffs to users and handles most cases. Only fall back to `flowctl patch replace` if Edit fails due to text drift (e.g., another Worker modified the file in Teams mode, or context compaction lost the exact text).
406407

407408
**First, capture base commit for scoped review:**
408409
```bash

codex/skills/flow-code-plan/steps/step-02-research.md

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -44,25 +44,30 @@ Stack is auto-detected on `init`. If present, use it throughout planning:
4444
- Put `$FLOWCTL guard` in epic's Quick commands section (replaces manual test/lint commands)
4545
- Tag task specs with which stack layer they belong to (backend/frontend/infra) in the Files field
4646

47-
## Pre-Scout Search (flowctl tools)
47+
## Pre-Scout Quick Context
4848

49-
Before spawning scouts, use flowctl's built-in search tools for fast initial discovery:
49+
Before spawning scouts, gather initial context. Use the right tool for each need:
5050

5151
```bash
52-
# Fuzzy file search with frecency + git status ranking
53-
$FLOWCTL search "<key terms from request>" --limit 20 --json
54-
55-
# Trigram indexed content search (if index exists)
56-
$FLOWCTL index search "<key terms from request>" --limit 20 --json
57-
58-
# Project structure overview
52+
# 1. Project structure overview (flowctl — unique, no native equivalent)
53+
# Skip for trivial/single-file tasks
5954
$FLOWCTL repo-map --budget 512 --json
6055

61-
# Symbol extraction for key directories
56+
# 2. Find related files — use Grep (native) for known patterns
57+
# Use flowctl search only if file names are fuzzy/uncertain
58+
Grep "<key terms>" --type <lang>
59+
60+
# 3. Symbol extraction for key directories (flowctl — unique)
6261
$FLOWCTL code-structure extract --path <relevant-dir> --json
6362
```
6463

65-
Feed these results into scout prompts for more targeted exploration. Skip if the request is trivial (single-file, clear location).
64+
**When to use flowctl vs native:**
65+
- `flowctl repo-map` / `code-structure` → always valuable (no native equivalent)
66+
- `Grep` / `Glob` → default for file/content search (faster, regex support)
67+
- `flowctl search` → only when unsure of file names (fuzzy matching)
68+
- `flowctl index search` → only for large repos with repeated searches
69+
70+
Feed results into scout prompts for targeted exploration.
6671

6772
## Scout Selection: AI Decides Per-Request
6873

skills/flow-code-brainstorm/steps/step-02-context-gather.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@ FLOWCTL="$HOME/.flow/bin/flowctl"
88

99
**In auto mode, gather deep context:**
1010
1. Search for files related to the request:
11-
- `$FLOWCTL search "<key terms>" --limit 20 --json`fuzzy file search with frecency ranking
12-
- `$FLOWCTL index search "<key terms>" --limit 20 --json`trigram content search (if index exists)
13-
- `$FLOWCTL code-structure extract --path <relevant-dir> --json`extract symbols for key directories
14-
- Grep/Glob for exact regex patterns (fallback)
11+
- `Grep "<key terms>"`native ripgrep for exact pattern matching (default)
12+
- `Glob "**/*keyword*"`native file pattern search
13+
- `$FLOWCTL code-structure extract --path <relevant-dir> --json` — symbols without reading full files (unique, no native equivalent)
14+
- `$FLOWCTL search "<terms>"` — only if file names uncertain (fuzzy + frecency)
1515
2. Read git log for recent changes in relevant areas
1616
3. Check existing `.flow/` specs/epics for related work
1717
4. Read key config files, README, CLAUDE.md for project constraints

0 commit comments

Comments
 (0)