Skip to content

Commit c09a985

Browse files
committed
Make deepthink/refactor dispatch prompts environment-agnostic
1 parent 8fa9252 commit c09a985

3 files changed

Lines changed: 23 additions & 23 deletions

File tree

skills/refactor/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ refactor.py explore.py (x10 parallel)
1616
=========== =========================
1717
1818
Step 1: Dispatch -----------------> Step 1: Domain Context
19-
(launch 10 explore agents) Step 2: Principle + Violations
19+
(launch 10 exploration sub-agents) Step 2: Principle + Violations
2020
Step 3: Pattern Generation
2121
Step 4: Search
2222
Step 5: Synthesis
@@ -47,7 +47,7 @@ Step 5: Synthesize
4747

4848
## Design Decisions
4949

50-
### 1. Five-Step Explore Workflow
50+
### 1. Five-Step Exploration Workflow
5151

5252
The original 2-step explore workflow conflated multiple cognitive tasks in a
5353
single step. LLMs perform better when each cognitive task gets focused attention.
@@ -62,7 +62,7 @@ Step 5: Synthesis - Format findings
6262

6363
### 2. Domain Context Per-Category (Not Lifted to Parent)
6464

65-
Each explore agent does its own domain context analysis, rather than refactor.py
65+
Each exploration sub-agent does its own domain context analysis, rather than refactor.py
6666
doing it once and passing to all agents.
6767

6868
Rationale: Different smell categories need different domain context aspects. A

skills/scripts/skills/deepthink/think.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -515,7 +515,7 @@
515515
"- KEY ANALOGIES from Step 4\n"
516516
"- Their specific task definition from Step 8\n"
517517
"\n"
518-
"AGENT PROMPT STRUCTURE (use for each agent's Task tool prompt):\n"
518+
"AGENT PROMPT STRUCTURE (use for each dispatched sub-agent prompt):\n"
519519
"\n"
520520
"Explore this question from the assigned perspective.\n"
521521
"\n"
@@ -881,12 +881,12 @@ def build_dispatch_body() -> str:
881881
invoke_cmd = f'python3 -m {SUBAGENT_MODULE_PATH} --step 1'
882882

883883
dispatch_text = roster_dispatch(
884-
agent_type="general-purpose",
884+
agent_type="analytical reasoning (multi-perspective, evidence-grounded)",
885885
agents=DISPATCH_AGENTS,
886886
command=invoke_cmd,
887887
shared_context=DISPATCH_CONTEXT,
888-
model="sonnet",
889-
instruction="Launch ALL sub-agents from FINAL SUB-AGENT DEFINITIONS (Step 8). Use a SINGLE message with multiple Task tool calls.",
888+
model="reasoning-capable model suitable for nuanced synthesis",
889+
instruction="Launch ALL sub-agents from FINAL SUB-AGENT DEFINITIONS (Step 8). Use a SINGLE message with multiple agent dispatch calls.",
890890
)
891891

892892
return dispatch_text

skills/scripts/skills/refactor/refactor.py

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
55
Six-phase workflow:
66
1. Mode Selection - Analyze user request to determine design/code/both
7-
2. Dispatch - Launch parallel Explore agents (one per randomly selected target)
7+
2. Dispatch - Launch parallel exploration sub-agents (one per randomly selected target)
88
3. Triage - Review findings, structure as smells with IDs
99
4. Cluster - Group smells by shared root cause
1010
5. Contextualize - Extract user intent, prioritize issues
@@ -205,7 +205,7 @@ def select_targets(n: int = DEFAULT_CATEGORY_COUNT, mode_filter: str = "both") -
205205

206206

207207
def build_explore_dispatch(n: int = DEFAULT_CATEGORY_COUNT, mode_filter: str = "both", scope: str | None = None) -> str:
208-
"""Build parallel dispatch block for explore agents.
208+
"""Build parallel dispatch block for exploration sub-agents.
209209
210210
Each category uses the same 5-step explore workflow; only the category reference differs.
211211
Uses TemplateDispatchNode for SIMD-style dispatch: single instruction, multiple data.
@@ -223,7 +223,7 @@ def build_explore_dispatch(n: int = DEFAULT_CATEGORY_COUNT, mode_filter: str = "
223223
for t in selected
224224
)
225225

226-
# Scope propagation to explore agents
226+
# Scope propagation to exploration sub-agents
227227
scope_arg = f" --scope {shlex.quote(scope)}" if scope else ""
228228

229229
# Template prompt with $var placeholders
@@ -238,12 +238,12 @@ def build_explore_dispatch(n: int = DEFAULT_CATEGORY_COUNT, mode_filter: str = "
238238
command = f'<invoke working-dir="{_SKILLS_DIR}" cmd="python3 -m {EXPLORE_MODULE_PATH} --step 1 --category $ref --mode $mode{scope_arg}" />'
239239

240240
node = TemplateDispatchNode(
241-
agent_type="general-purpose",
241+
agent_type="exploration-capable",
242242
template=template,
243243
targets=targets,
244244
command=command,
245-
model="haiku",
246-
instruction=f"Launch {len(selected)} general-purpose sub-agents for code smell exploration.",
245+
model="fast lightweight model suitable for high-fanout pattern scanning",
246+
instruction=f"Launch {len(selected)} exploration sub-agents for code smell exploration.",
247247
)
248248

249249
return render_template_dispatch(node)
@@ -273,7 +273,7 @@ def format_expected_output(sections: dict[str, str]) -> str:
273273
},
274274
2: {
275275
"title": "Dispatch / Category Selection",
276-
"brief": "Non-custom: dispatch explore agents. Custom: LLM selects categories.",
276+
"brief": "Non-custom: dispatch exploration sub-agents. Custom: LLM selects categories.",
277277
},
278278
3: {
279279
"title": "Category Verification",
@@ -287,7 +287,7 @@ def format_expected_output(sections: dict[str, str]) -> str:
287287
"title": "Triage",
288288
"brief": "Structure smell findings with IDs for synthesis",
289289
"actions": [
290-
"REVIEW all smell_report outputs from explore agents.",
290+
"REVIEW all smell_report outputs from exploration sub-agents.",
291291
"",
292292
"STRUCTURE each finding as a smell object with unique ID:",
293293
"",
@@ -1190,7 +1190,7 @@ def format_step_2_dispatch(n: int, info: dict, mode_filter: str, scope: str | No
11901190
"",
11911191
format_expected_output({
11921192
"Per target": "smell_report with severity (none/low/medium/high) and findings",
1193-
"Format": "<smell_report> blocks from each Explore agent",
1193+
"Format": "<smell_report> blocks from each exploration sub-agent",
11941194
})
11951195
]
11961196

@@ -1357,23 +1357,23 @@ def format_step_4_dispatch_custom(info: dict, scope: str | None = None) -> str:
13571357
invoke_cmd = f'<invoke working-dir="{_SKILLS_DIR}" cmd="python3 -m {EXPLORE_MODULE_PATH} --step 1 --category $CATEGORY_REF --mode code{scope_arg}" />'
13581358

13591359
actions = [
1360-
"DISPATCH explore agents for verified categories.",
1360+
"DISPATCH exploration sub-agents for verified categories.",
13611361
"",
13621362
"Using the <verified_categories> from Step 3:",
13631363
"",
1364-
'<parallel_dispatch agent="Explore" count="N">',
1364+
'<parallel_dispatch agent="exploration-capable" count="N">',
13651365
" <instruction>",
1366-
" Launch one general-purpose sub-agent per verified category.",
1366+
" Launch one exploration-capable sub-agent per verified category.",
13671367
" </instruction>",
13681368
"",
13691369
' <execution_constraint type="MANDATORY_PARALLEL">',
13701370
" You MUST dispatch ALL agents in ONE assistant message.",
13711371
" FORBIDDEN: Waiting for any agent before dispatching the next.",
1372-
' FORBIDDEN: Using "Explore" subagent_type. Use "general-purpose".',
13731372
" </execution_constraint>",
13741373
"",
13751374
" <model_selection>",
1376-
" Use HAIKU (default) for all agents.",
1375+
" Prefer a fast lightweight model for high-fanout exploration.",
1376+
" If unavailable, use your environment's default model.",
13771377
" </model_selection>",
13781378
"",
13791379
" <template>",
@@ -1578,9 +1578,9 @@ def main(
15781578
default="both",
15791579
help="Category selection mode. custom: LLM selects based on problem statement")
15801580

1581-
# Filesystem constraint propagated to all explore agents
1581+
# Filesystem constraint propagated to all exploration sub-agents
15821582
parser.add_argument("--scope", type=str, default=None,
1583-
help="Filesystem scope constraint (e.g., 'src/planner/'). Propagates to explore agents.")
1583+
help="Filesystem scope constraint (e.g., 'src/planner/'). Propagates to exploration sub-agents.")
15841584

15851585
# Verification loopback counter (custom mode only, internal)
15861586
parser.add_argument("--retry", type=int, default=0,

0 commit comments

Comments
 (0)