From b58f5b72b0bf5007b3054a8f8458dd77e9f616a2 Mon Sep 17 00:00:00 2001 From: xixingde <137176592+xixingde@users.noreply.github.com> Date: Thu, 16 Apr 2026 10:37:38 +0800 Subject: [PATCH] feat(agents): restrict Agent tool to specific sub-agents and add allowedTools to skills --- src/costrict/agents/strictPlan.ts | 2 +- src/costrict/agents/tdd.ts | 4 ++-- src/costrict/skills/projectWiki.ts | 7 +++++++ src/costrict/skills/tdd.ts | 8 ++++++++ src/skills/bundled/index.ts | 6 +++--- 5 files changed, 21 insertions(+), 6 deletions(-) diff --git a/src/costrict/agents/strictPlan.ts b/src/costrict/agents/strictPlan.ts index 80f22e6fe..ed425ee42 100644 --- a/src/costrict/agents/strictPlan.ts +++ b/src/costrict/agents/strictPlan.ts @@ -177,7 +177,7 @@ export const STRICT_PLAN_AGENT: BuiltInAgentDefinition = { '根据用户的需求创建具体可实施的计划。Use this when you need to create structured, actionable implementation plans based on user requirements. This agent follows a strict workflow: understand requirements → QuickExplore project → clarify requirements → create proposal → implement proposal.', tools:[ "AskUserQuestion", - "Agent", // Can spawn: QuickExplore, TaskCheck, SubCoding + "Agent(QuickExplore,TaskCheck,SubCoding)", // Can spawn: QuickExplore, TaskCheck, SubCoding "Read", "Write", "Edit", diff --git a/src/costrict/agents/tdd.ts b/src/costrict/agents/tdd.ts index c241eca72..b8367b06f 100644 --- a/src/costrict/agents/tdd.ts +++ b/src/costrict/agents/tdd.ts @@ -54,7 +54,7 @@ After project is verified to be buildable/runnable: 2. Otherwise, confirm the functional requirements based on the user's recent messages and code changes 3. Clearly identify what functionality needs to be tested -**IMPORTANT: After confirming user requirements, you MUST use the \`question\` tool to get user confirmation before proceeding to Step 3** +**IMPORTANT: After confirming user requirements, you MUST use the \`AskUserQuestion\` tool to get user confirmation before proceeding to Step 3** - Present the confirmed requirements to the user - Ask if they want to proceed with test case generation or if they need adjustments @@ -120,7 +120,7 @@ export const TDD_AGENT: BuiltInAgentDefinition = { 'execute comprehensive testing workflow: confirm requirements, generate test cases, and execute tests with automated fixes', tools:[ "AskUserQuestion", - "Agent", + "Agent(RunAndFix,TestDesign,TestAndFix)", "Read", "Write", "Edit", diff --git a/src/costrict/skills/projectWiki.ts b/src/costrict/skills/projectWiki.ts index 812e1ead6..eb8745274 100644 --- a/src/costrict/skills/projectWiki.ts +++ b/src/costrict/skills/projectWiki.ts @@ -11,6 +11,13 @@ export function registerProjectWikiSkill(): void { disableModelInvocation: true, context: 'fork', agent: 'WIKI', + allowedTools:[ + "Agent(WikiCatalogueDesign,WikiDocumentGenerate,WikiIndexGeneration,WikiProjectAnalyze)", + "Read", + "Write", + "Edit", + "TodoWrite", + ], async getPromptForCommand(args) { const userRequest = args.trim() if (!userRequest) { diff --git a/src/costrict/skills/tdd.ts b/src/costrict/skills/tdd.ts index cb1814b7a..eba3851db 100644 --- a/src/costrict/skills/tdd.ts +++ b/src/costrict/skills/tdd.ts @@ -7,6 +7,14 @@ export function registerTddSkill(): void { 'execute comprehensive testing workflow: confirm requirements, generate test cases, and execute tests with automated fixes', userInvocable: true, disableModelInvocation: true, + allowedTools:[ + "AskUserQuestion", + "Agent(RunAndFix,TestDesign,TestAndFix)", + "Read", + "Write", + "Edit", + "TodoWrite", + ], context: 'fork', agent: 'TDD', async getPromptForCommand(args) { diff --git a/src/skills/bundled/index.ts b/src/skills/bundled/index.ts index 4aa2ac5da..a55d77e23 100644 --- a/src/skills/bundled/index.ts +++ b/src/skills/bundled/index.ts @@ -15,8 +15,8 @@ import { registerLoopSkill } from './loop.js' import { registerDreamSkill } from './dream.js' import { registerUpdateConfigSkill } from './updateConfig.js' import { registerVerifySkill } from './verify.js' -import { registerStrictPlanSkill } from '../../costrict/skills/strictPlan.js' -import { registerStrictSpecSkill } from '../../costrict/skills/strictSpec.js' +import { registerStrictPlanSkill } from 'src/costrict/skills/strictPlan.js' +import { registerStrictSpecSkill } from 'src/costrict/skills/strictSpec.js' import { registerProjectWikiSkill } from 'src/costrict/skills/projectWiki.js' import { registerTddSkill } from 'src/costrict/skills/tdd.js' @@ -35,7 +35,7 @@ export function initBundledSkills(): void { registerProjectWikiSkill() registerTddSkill() registerStrictPlanSkill() - registerStrictSpecSkill() + // registerStrictSpecSkill() registerKeybindingsSkill() registerVerifySkill() registerDebugSkill()