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

Commit b7568c8

Browse files
committed
chore: commit src/hooks/SelectActiveIntentTool.ts
1 parent 5551849 commit b7568c8

1 file changed

Lines changed: 41 additions & 5 deletions

File tree

src/hooks/SelectActiveIntentTool.ts

Lines changed: 41 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,17 +31,54 @@ export class SelectActiveIntentTool extends BaseTool<"select_active_intent"> {
3131
const dataModel = new OrchestrationDataModel(task.cwd)
3232
await dataModel.initialize()
3333

34+
// Phase 2: Check if intent is in .intentignore (protected)
35+
const isIgnored = await dataModel.isIntentIgnored(intent_id)
36+
if (isIgnored) {
37+
task.consecutiveMistakeCount++
38+
task.recordToolError("select_active_intent")
39+
const errorJson = JSON.stringify(
40+
{
41+
error_type: "intent_protected",
42+
message: `Intent "${intent_id}" is protected and cannot be modified. This intent is listed in .orchestration/.intentignore.`,
43+
details: {
44+
intent_id: intent_id,
45+
reason: "intent_in_ignore_list",
46+
file: ".orchestration/.intentignore",
47+
},
48+
recoverable: false,
49+
suggested_action:
50+
"Select a different intent or ask user to remove this intent from .intentignore",
51+
},
52+
null,
53+
2,
54+
)
55+
pushToolResult(errorJson)
56+
return
57+
}
58+
3459
// Load the intent from active_intents.yaml
3560
const intent = await dataModel.getIntent(intent_id)
3661

3762
if (!intent) {
3863
task.consecutiveMistakeCount++
3964
task.recordToolError("select_active_intent")
40-
pushToolResult(
41-
formatResponse.toolError(
42-
`Intent "${intent_id}" not found in active_intents.yaml. Please use a valid intent ID.`,
43-
),
65+
const intentsData = await dataModel.readActiveIntents()
66+
const errorJson = JSON.stringify(
67+
{
68+
error_type: "intent_not_found",
69+
message: `Intent "${intent_id}" not found in active_intents.yaml. Please use a valid intent ID.`,
70+
details: {
71+
requested_intent_id: intent_id,
72+
available_intent_ids: intentsData.active_intents.map((i) => i.id),
73+
available_intents_count: intentsData.active_intents.length,
74+
},
75+
recoverable: true,
76+
suggested_action: `Use one of the available intent IDs: ${intentsData.active_intents.map((i) => i.id).join(", ")}`,
77+
},
78+
null,
79+
2,
4480
)
81+
pushToolResult(errorJson)
4582
return
4683
}
4784

@@ -126,4 +163,3 @@ ${recentHistorySection}
126163
}
127164

128165
export const selectActiveIntentTool = new SelectActiveIntentTool()
129-

0 commit comments

Comments
 (0)