* feat: open useful USER_TYPE-gated features to all users Remove 13 process.env.USER_TYPE === 'ant' gates that restricted useful features to Anthropic employees. These features work without Anthropic infrastructure and are now available to all open-build users. Features opened: - Agent nesting (sub-agents can spawn sub-agents) - Effort 'max' persistence in settings - Plan mode interview phase (controlled by feature flags) - Sandbox disabled commands (via ~/.claude/feature-flags.json) - All tips visible to all users (plan mode, feedback, shift-tab) Simplified: - Fullscreen defaults to off (use /config to enable) - Explore agent always uses haiku model - Plan mode tool uses conservative prompt for all users Continues the USER_TYPE cleanup from #637 (dead code) and builds on #639 (local feature flags). * fix: address Copilot review comments — remove residual dead code 1. bridgeConfig.ts: ungate bridge override functions — return env vars directly instead of hardcoded undefined 2. bridgeMain.ts + initReplBridge.ts: ungate sessionIngressUrl — read CLAUDE_BRIDGE_SESSION_INGRESS_URL without USER_TYPE check 3. tools.ts: remove dead ConfigTool/TungstenTool imports, narrow eslint-disable scope, stub REPLTool/SuggestBackgroundPRTool to null 4. readOnlyValidation.ts: remove orphaned ANT_ONLY_COMMAND_ALLOWLIST and unused GH_READ_ONLY_COMMANDS import 5. insights.ts: remove entire remote collection plumbing (types, functions, options, display logic) 6. osc.ts: hardcode supportsTabStatus() to false (internal-only feature) 7. state.ts: simplify addSlowOperation/getSlowOperations to no-ops, remove dead constants * fix: address Copilot review on PR #644 1. settings/types.ts: allow 'max' effort level for all users in Zod schema — was still gated behind USER_TYPE=ant, causing 'max' to be silently dropped on settings reload 2. shouldUseSandbox.ts: defensively normalize disabledCommands from feature flag config with Array.isArray() guards * fix: address second round of Copilot review on PR #644 1. shouldUseSandbox.ts: validate top-level shape of disabledCommands before accessing properties (handles null/primitive from feature flag) 2. fullscreen.ts: update JSDoc to reflect removal of USER_TYPE default 3. osc.ts: update JSDoc — "Ant-only" → "Currently disabled"
83 lines
4.4 KiB
TypeScript
83 lines
4.4 KiB
TypeScript
import { BASH_TOOL_NAME } from 'src/tools/BashTool/toolName.js'
|
|
import { EXIT_PLAN_MODE_TOOL_NAME } from 'src/tools/ExitPlanModeTool/constants.js'
|
|
import { FILE_EDIT_TOOL_NAME } from 'src/tools/FileEditTool/constants.js'
|
|
import { FILE_READ_TOOL_NAME } from 'src/tools/FileReadTool/prompt.js'
|
|
import { FILE_WRITE_TOOL_NAME } from 'src/tools/FileWriteTool/prompt.js'
|
|
import { GLOB_TOOL_NAME } from 'src/tools/GlobTool/prompt.js'
|
|
import { GREP_TOOL_NAME } from 'src/tools/GrepTool/prompt.js'
|
|
import { NOTEBOOK_EDIT_TOOL_NAME } from 'src/tools/NotebookEditTool/constants.js'
|
|
import { hasEmbeddedSearchTools } from 'src/utils/embeddedTools.js'
|
|
import { AGENT_TOOL_NAME } from '../constants.js'
|
|
import type { BuiltInAgentDefinition } from '../loadAgentsDir.js'
|
|
|
|
function getExploreSystemPrompt(): string {
|
|
// Ant-native builds alias find/grep to embedded bfs/ugrep and remove the
|
|
// dedicated Glob/Grep tools, so point at find/grep via Bash instead.
|
|
const embedded = hasEmbeddedSearchTools()
|
|
const globGuidance = embedded
|
|
? `- Use \`find\` via ${BASH_TOOL_NAME} for broad file pattern matching`
|
|
: `- Use ${GLOB_TOOL_NAME} for broad file pattern matching`
|
|
const grepGuidance = embedded
|
|
? `- Use \`grep\` via ${BASH_TOOL_NAME} for searching file contents with regex`
|
|
: `- Use ${GREP_TOOL_NAME} for searching file contents with regex`
|
|
|
|
return `You are a file search specialist for OpenClaude. You excel at thoroughly navigating and exploring codebases.
|
|
|
|
=== CRITICAL: READ-ONLY MODE - NO FILE MODIFICATIONS ===
|
|
This is a READ-ONLY exploration task. You are STRICTLY PROHIBITED from:
|
|
- Creating new files (no Write, touch, or file creation of any kind)
|
|
- Modifying existing files (no Edit operations)
|
|
- Deleting files (no rm or deletion)
|
|
- Moving or copying files (no mv or cp)
|
|
- Creating temporary files anywhere, including /tmp
|
|
- Using redirect operators (>, >>, |) or heredocs to write to files
|
|
- Running ANY commands that change system state
|
|
|
|
Your role is EXCLUSIVELY to search and analyze existing code. You do NOT have access to file editing tools - attempting to edit files will fail.
|
|
|
|
Your strengths:
|
|
- Rapidly finding files using glob patterns
|
|
- Searching code and text with powerful regex patterns
|
|
- Reading and analyzing file contents
|
|
|
|
Guidelines:
|
|
${globGuidance}
|
|
${grepGuidance}
|
|
- Use ${FILE_READ_TOOL_NAME} when you know the specific file path you need to read
|
|
- Use ${BASH_TOOL_NAME} ONLY for read-only operations (ls, git status, git log, git diff, find${embedded ? ', grep' : ''}, cat, head, tail)
|
|
- NEVER use ${BASH_TOOL_NAME} for: mkdir, touch, rm, cp, mv, git add, git commit, npm install, pip install, or any file creation/modification
|
|
- Adapt your search approach based on the thoroughness level specified by the caller
|
|
- Communicate your final report directly as a regular message - do NOT attempt to create files
|
|
|
|
NOTE: You are meant to be a fast agent that returns output as quickly as possible. In order to achieve this you must:
|
|
- Make efficient use of the tools that you have at your disposal: be smart about how you search for files and implementations
|
|
- Wherever possible you should try to spawn multiple parallel tool calls for grepping and reading files
|
|
|
|
Complete the user's search request efficiently and report your findings clearly.`
|
|
}
|
|
|
|
export const EXPLORE_AGENT_MIN_QUERIES = 3
|
|
|
|
const EXPLORE_WHEN_TO_USE =
|
|
'Fast agent specialized for exploring codebases. Use this when you need to quickly find files by patterns (eg. "src/components/**/*.tsx"), search code for keywords (eg. "API endpoints"), or answer questions about the codebase (eg. "how do API endpoints work?"). When calling this agent, specify the desired thoroughness level: "quick" for basic searches, "medium" for moderate exploration, or "very thorough" for comprehensive analysis across multiple locations and naming conventions.'
|
|
|
|
export const EXPLORE_AGENT: BuiltInAgentDefinition = {
|
|
agentType: 'Explore',
|
|
whenToUse: EXPLORE_WHEN_TO_USE,
|
|
disallowedTools: [
|
|
AGENT_TOOL_NAME,
|
|
EXIT_PLAN_MODE_TOOL_NAME,
|
|
FILE_EDIT_TOOL_NAME,
|
|
FILE_WRITE_TOOL_NAME,
|
|
NOTEBOOK_EDIT_TOOL_NAME,
|
|
],
|
|
source: 'built-in',
|
|
baseDir: 'built-in',
|
|
// Use haiku for speed — explore is a fast read-only search agent
|
|
model: 'haiku',
|
|
// Explore is a fast read-only search agent — it doesn't need commit/PR/lint
|
|
// rules from CLAUDE.md. The main agent has full context and interprets results.
|
|
omitClaudeMd: true,
|
|
getSystemPrompt: () => getExploreSystemPrompt(),
|
|
}
|