Skip to content

Commit 4be614f

Browse files
refactor: Remove focus_areas parameter from agent tool and related components (#541)
Removed the focus_areas parameter throughout the automation plugin to simplify the interface and reduce parameter complexity. Users can achieve similar functionality by using the constraints parameter in workflows when needed. Changes include: - Remove focus_areas from agent tool input schema - Update ExploreAgent to remove focus_areas from prepare_context() and explore() - Remove focus_areas from agent_step workflow step - Remove focus_areas from ai_split operation and prompt building - Update ai_exploration_workflow.yaml to remove focus_areas input - Update documentation to reflect parameter removal - Update all related tests to remove focus_areas assertions - All 176 automation tests pass successfully 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude <[email protected]>
1 parent 99ecc82 commit 4be614f

File tree

9 files changed

+19
-69
lines changed

9 files changed

+19
-69
lines changed

plugins/automation/README.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,6 @@ All operations use a consistent 3-parameter structure:
110110
- `session_id`: Session ID for conversation context
111111
- `model`: Model to use (e.g., "haiku", "gpt-4")
112112
- `cli_type`: CLI to use ("claude", "codex", "copilot")
113-
- `focus_areas`: Array of specific areas to focus on
114113
- `working_directories`: Array of working directory paths
115114

116115
### Operations
@@ -270,13 +269,12 @@ The tool maintains session-based agents. Use the same `session_id` in the `conte
270269

271270
### ExploreAgent Methods
272271

273-
#### `explore(question, codebase_path=None, focus_areas=None)`
272+
#### `explore(question, codebase_path=None)`
274273
General exploration method for any codebase question.
275274

276275
```python
277276
answer = await agent.explore(
278-
"Where is the database connection configured?",
279-
focus_areas=["config", "database"]
277+
"Where is the database connection configured?"
280278
)
281279
```
282280

plugins/automation/agents/explore_agent.py

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -180,15 +180,13 @@ def _get_exploration_instructions(self) -> str:
180180
def prepare_context(
181181
self,
182182
codebase_path: Optional[str] = None,
183-
focus_areas: Optional[List[str]] = None,
184183
**kwargs
185184
) -> Optional[str]:
186185
"""
187186
Prepare context for codebase exploration.
188187
189188
Args:
190189
codebase_path: Path to the codebase root
191-
focus_areas: Specific areas or components to focus on
192190
**kwargs: Additional context parameters
193191
194192
Returns:
@@ -209,11 +207,6 @@ def prepare_context(
209207
if self.config.cwd:
210208
context_parts.append(f"**Current Directory**: `{self.config.cwd}`")
211209

212-
# Add focus areas if provided
213-
if focus_areas:
214-
areas = "\n".join([f" - {area}" for area in focus_areas])
215-
context_parts.append(f"**Focus Areas**:\n{areas}")
216-
217210
# Add search paths if configured
218211
if self.explore_config.search_paths:
219212
paths = "\n".join([f" - `{p}`" for p in self.explore_config.search_paths])
@@ -228,23 +221,20 @@ async def explore(
228221
self,
229222
question: str,
230223
codebase_path: Optional[str] = None,
231-
focus_areas: Optional[List[str]] = None,
232224
) -> str:
233225
"""
234226
Explore the codebase to answer a specific question.
235227
236228
Args:
237229
question: Question about the codebase
238230
codebase_path: Path to the codebase root
239-
focus_areas: Specific areas to focus on
240231
241232
Returns:
242233
Answer with code locations and explanations
243234
"""
244235
return await self.invoke(
245236
prompt=question,
246237
codebase_path=codebase_path,
247-
focus_areas=focus_areas,
248238
)
249239

250240
async def find_implementation(

plugins/automation/tests/test_agent_tool.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,6 @@ async def test_execute_with_full_context(self):
332332
"session_id": "custom-session",
333333
"model": "gpt-4",
334334
"cli_type": "codex",
335-
"focus_areas": ["auth", "database"],
336335
"working_directories": ["/project/src"]
337336
}
338337
})
@@ -348,10 +347,6 @@ async def test_execute_with_full_context(self):
348347
assert call_args.kwargs["codebase_path"] == "/project"
349348
assert call_args.kwargs["working_directories"] == ["/project/src"]
350349

351-
# Verify focus_areas passed to explore
352-
explore_call_args = mock_agent.explore.call_args
353-
assert explore_call_args.kwargs["focus_areas"] == ["auth", "database"]
354-
355350
@pytest.mark.asyncio
356351
async def test_execute_invalid_operation(self):
357352
"""Test execution with invalid operation"""

plugins/automation/tests/test_ai_split_operation.py

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ def test_build_split_prompt_basic(self):
4747
prompt = operation._build_split_prompt(
4848
goal="Understand authentication",
4949
codebase_path=None,
50-
focus_areas=[],
5150
constraints=None,
5251
context="",
5352
min_tasks=2,
@@ -67,7 +66,6 @@ def test_build_split_prompt_comprehensive(self):
6766
prompt = operation._build_split_prompt(
6867
goal="Understand security",
6968
codebase_path="/path/to/code",
70-
focus_areas=["authentication", "authorization"],
7169
constraints="Focus on backend only",
7270
context="Legacy system",
7371
min_tasks=3,
@@ -76,7 +74,6 @@ def test_build_split_prompt_comprehensive(self):
7674

7775
assert "Understand security" in prompt
7876
assert "/path/to/code" in prompt
79-
assert "authentication" in prompt
8077
assert "Focus on backend only" in prompt
8178
assert "Legacy system" in prompt
8279

@@ -273,19 +270,18 @@ def test_parse_ai_response_valid(self):
273270
assert tasks[1]["index"] == 1
274271

275272
@pytest.mark.asyncio
276-
async def test_execute_with_focus_areas(self):
277-
"""Test execution with focus areas."""
273+
async def test_execute_with_constraints(self):
274+
"""Test execution with constraints."""
278275
config = {"max_tasks": 5}
279276
inputs = {
280277
"goal": "Understand system",
281-
"focus_areas": ["performance", "security"],
282-
"constraints": "Backend only"
278+
"constraints": "Backend only, focus on security"
283279
}
284280

285281
operation = AISplitOperation(config, inputs)
286282

287283
mock_response = {
288-
"reasoning": "Focused on performance and security",
284+
"reasoning": "Focused on backend security",
289285
"tasks": [
290286
{"title": "Security", "query": "Security aspects", "type": "question", "priority": "high"}
291287
]
@@ -296,11 +292,9 @@ async def test_execute_with_focus_areas(self):
296292

297293
result = await operation.execute()
298294

299-
# Verify focus areas were included in the call
295+
# Verify constraints were included in the call
300296
call_args = mock_call.call_args[0][0] # Get prompt
301-
assert "performance" in call_args
302-
assert "security" in call_args
303-
assert "Backend only" in call_args
297+
assert "Backend only, focus on security" in call_args
304298

305299

306300
class TestAISplitIntegration:
@@ -318,7 +312,7 @@ async def test_full_ai_split_execution(self):
318312
inputs = {
319313
"goal": "Understand authentication flow in the application",
320314
"codebase_path": "/path/to/code",
321-
"focus_areas": ["security", "user management"]
315+
"constraints": "Focus on security and user management"
322316
}
323317

324318
operation = AISplitOperation(config, inputs)

plugins/automation/tests/test_explore_agent.py

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -143,19 +143,19 @@ def test_prepare_context_with_working_directories(self):
143143
assert "/dir2" in context
144144
assert "Working Directories" in context
145145

146-
def test_prepare_context_with_focus_areas(self):
147-
"""Test context preparation with focus areas"""
148-
config = ExploreAgentConfig()
146+
def test_prepare_context_with_search_paths(self):
147+
"""Test context preparation with search paths"""
148+
config = ExploreAgentConfig(
149+
search_paths=["/src/auth", "/src/db"]
150+
)
149151
agent = ExploreAgent(config)
150152

151-
context = agent.prepare_context(
152-
focus_areas=["authentication", "database layer"]
153-
)
153+
context = agent.prepare_context()
154154

155155
assert context is not None
156-
assert "authentication" in context
157-
assert "database layer" in context
158-
assert "Focus Areas" in context
156+
assert "/src/auth" in context
157+
assert "/src/db" in context
158+
assert "Search Paths" in context
159159

160160
def test_prepare_context_comprehensive(self):
161161
"""Test context preparation with all parameters"""
@@ -167,16 +167,13 @@ def test_prepare_context_comprehensive(self):
167167
agent = ExploreAgent(config)
168168

169169
context = agent.prepare_context(
170-
codebase_path="/work",
171-
focus_areas=["api", "models"]
170+
codebase_path="/work"
172171
)
173172

174173
assert context is not None
175174
assert "/work" in context
176175
assert "/work/current" in context
177176
assert "/work/src" in context
178-
assert "api" in context
179-
assert "models" in context
180177

181178
@pytest.mark.asyncio
182179
async def test_explore(self):

plugins/automation/tools/agent_tool.py

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -82,11 +82,6 @@ def input_schema(self) -> Dict[str, Any]:
8282
"description": "CLI type: claude, codex, or copilot",
8383
"enum": ["claude", "codex", "copilot"],
8484
},
85-
"focus_areas": {
86-
"type": "array",
87-
"items": {"type": "string"},
88-
"description": "Specific areas to focus on",
89-
},
9085
"working_directories": {
9186
"type": "array",
9287
"items": {"type": "string"},
@@ -158,7 +153,6 @@ async def execute_function(
158153
# Extract context (optional)
159154
context = parameters.get("context", {})
160155
codebase_path = context.get("codebase_path")
161-
focus_areas = context.get("focus_areas")
162156
cli_type_str = context.get("cli_type", "claude")
163157
model = context.get("model")
164158
session_id = context.get("session_id")
@@ -183,7 +177,6 @@ async def execute_function(
183177
result = await agent.explore(
184178
question=prompt,
185179
codebase_path=codebase_path,
186-
focus_areas=focus_areas,
187180
)
188181

189182
elif operation == AgentOperationType.FIND_IMPLEMENTATION:

plugins/automation/workflows/examples/ai_exploration_workflow.yaml

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,6 @@ workflow:
2727
required: true
2828
description: Path to the codebase to explore
2929

30-
focus_areas:
31-
type: array
32-
required: false
33-
default: []
34-
description: Optional areas to focus on (e.g., ["security", "performance"])
35-
3630
constraints:
3731
type: string
3832
required: false
@@ -64,7 +58,6 @@ workflow:
6458
inputs:
6559
goal: "{{ inputs.goal }}"
6660
codebase_path: "{{ inputs.codebase_path }}"
67-
focus_areas: "{{ inputs.focus_areas }}"
6861
constraints: "{{ inputs.constraints }}"
6962
outputs:
7063
tasks: result.tasks

plugins/automation/workflows/steps/agent_step.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,6 @@ async def _execute_explore_operation(
227227
ValueError: If operation not supported
228228
"""
229229
codebase_path = inputs.get("codebase_path")
230-
focus_areas = inputs.get("focus_areas")
231230

232231
if self.operation == "explore":
233232
question = inputs.get("question")
@@ -236,7 +235,6 @@ async def _execute_explore_operation(
236235
return await agent.explore(
237236
question=question,
238237
codebase_path=codebase_path,
239-
focus_areas=focus_areas,
240238
)
241239

242240
elif self.operation == "find_implementation":

plugins/automation/workflows/steps/operations/ai_split.py

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ class AISplitOperation(BaseOperation):
3030
Inputs:
3131
- goal: High-level exploration goal or question
3232
- codebase_path: Path to codebase being explored (optional, for context)
33-
- focus_areas: Optional list of areas to focus on
3433
- constraints: Optional constraints (e.g., "focus on security", "prioritize performance")
3534
3635
Returns:
@@ -72,7 +71,6 @@ async def execute(self) -> Dict[str, Any]:
7271
"""Execute AI-powered task splitting."""
7372
goal = self.inputs.get("goal")
7473
codebase_path = self.inputs.get("codebase_path")
75-
focus_areas = self.inputs.get("focus_areas", [])
7674
constraints = self.inputs.get("constraints")
7775

7876
# Get config
@@ -85,7 +83,6 @@ async def execute(self) -> Dict[str, Any]:
8583
prompt = self._build_split_prompt(
8684
goal=goal,
8785
codebase_path=codebase_path,
88-
focus_areas=focus_areas,
8986
constraints=constraints,
9087
context=context,
9188
min_tasks=min_tasks,
@@ -117,7 +114,6 @@ def _build_split_prompt(
117114
self,
118115
goal: str,
119116
codebase_path: Optional[str],
120-
focus_areas: List[str],
121117
constraints: Optional[str],
122118
context: str,
123119
min_tasks: int,
@@ -129,7 +125,6 @@ def _build_split_prompt(
129125
Args:
130126
goal: High-level exploration goal
131127
codebase_path: Path to codebase
132-
focus_areas: Areas to focus on
133128
constraints: Additional constraints
134129
context: Extra context
135130
min_tasks: Minimum tasks to generate
@@ -146,9 +141,6 @@ def _build_split_prompt(
146141
if codebase_path:
147142
prompt += f"\n**Codebase:** {codebase_path}"
148143

149-
if focus_areas:
150-
prompt += f"\n**Focus Areas:** {', '.join(focus_areas)}"
151-
152144
if constraints:
153145
prompt += f"\n**Constraints:** {constraints}"
154146

0 commit comments

Comments
 (0)