- Complete architectural overhaul of useUnifiedCompletion hook - Unified state management: 8 separate states → single CompletionState interface - Simplified core logic: getWordAtCursor 194 lines → 42 lines (78% reduction) - Fixed infinite React update loops with ref-based input tracking - Smart triggering mechanism replacing aggressive auto-completion - Integrated @agent and @file mention system with system reminders - Added comprehensive agent loading and mention processing - Enhanced Tab/Arrow/Enter key handling with clean event management - Maintained 100% functional compatibility across all completion types Key improvements: • File path completion (relative, absolute, ~expansion, @references) • Slash command completion (/help, /model, etc.) • Agent completion (@agent-xxx with intelligent descriptions) • System command completion (PATH scanning with fallback) • Terminal-style Tab cycling, Enter confirmation, Escape cancellation • Preview mode with boundary calculation • History navigation compatibility • Empty directory handling with user feedback Architecture: Event-driven @mention detection → system reminder injection → LLM tool usage Performance: Eliminated 7-layer nested conditionals, reduced state synchronization issues Reliability: Fixed maximum update depth exceeded warnings, stable state management
17 KiB
╭────────────────────────────────────────────────────────────────────────╮ │ Agents │ │ 5 agents │ │ │ │ Created agent: code-reviewer │ │ │ │ ❯ Create new agent │ │ │ │ Personal agents (/Users/baicai/.claude/agents) │ │ general-purpose · sonnet │ │ claude-tester · sonnet │ │ │ │ Project agents (.claude/agents) │ │ code-reviewer · opus │ │ │ │ Built-in agents (always available) │ │ general-purpose · sonnet ⚠ overridden by user │ │ statusline-setup · sonnet │ │ output-mode-setup · sonnet │ │ │ ╰────────────────────────────────────────────────────────────────────────╯ Press ↑↓ to navigate · Enter to select · Esc to go back
╭────────────────────────────────────────────────────────────────────────╮ │ Create new agent │ │ Step 2: Creation method │ │ │ │ 1. Generate with Claude (recommended) │ │ ❯ 2. Manual configuration │ ╰────────────────────────────────────────────────────────────────────────╯ Press ↑↓ to navigate · Enter to select · Esc to go back
╭────────────────────────────────────────────────────────────────────────╮ │ Create new agent │ │ Step 3: Agent type (identifier) │ │ │ │ e.g. code-reviewer, tech-lead, etc │ ╰────────────────────────────────────────────────────────────────────────╯ Press ↑↓ to navigate · Enter to select · Esc to go back
╭────────────────────────────────────────────────────────────────────────╮ │ Create new agent │ │ Step 3: Agent type (identifier) │ │ │ │ e.g. code-reviewer, tech-lead, etc │ │ │ │ Agent identifier cannot be empty │ ╰────────────────────────────────────────────────────────────────────────╯ Press ↑↓ to navigate · Enter to select · Esc to go back
╭────────────────────────────────────────────────────────────────────────╮ │ Create new agent │ │ Step 3: Agent type (identifier) │ │ │ │ bug-finder │ ╰────────────────────────────────────────────────────────────────────────╯ Press ↑↓ to navigate · Enter to select · Esc to go back
╭────────────────────────────────────────────────────────────────────────╮ │ Create new agent │ │ Step 4: System prompt │ │ │ │ Enter system prompt. Be comprehensive for best results │ ╰────────────────────────────────────────────────────────────────────────╯ Press ↑↓ to navigate · Enter to select · Esc to go back
╭────────────────────────────────────────────────────────────────────────╮ │ Create new agent │ │ Step 4: System prompt │ │ │ │ you are bug finder expert with many experenice in this system │ ╰────────────────────────────────────────────────────────────────────────╯ Press ↑↓ to navigate · Enter to select · Esc to go back
╭────────────────────────────────────────────────────────────────────────╮ │ Create new agent │ │ Step 5: Description (tell Claude when to use this agent) │ │ │ │ eg. use this agent after you're done writing code... │ ╰────────────────────────────────────────────────────────────────────────╯ Press ↑↓ to navigate · Enter to select · Esc to go back
╭────────────────────────────────────────────────────────────────────────╮ │ Create new agent │ │ Step 5: Description (tell Claude when to use this agent) │ │ │ │ us this agent when user ask to find bug or issue in the system │ ╰────────────────────────────────────────────────────────────────────────╯ Press ↑↓ to navigate · Enter to select · Esc to go back
╭────────────────────────────────────────────────────────────────────────╮ │ Create new agent │ │ Step 6: Select tools │ │ │ │ ❯ [ Continue ] │ │ ──────────────────────────────────────── │ │ ☒ All tools │ │ ☒ Read-only tools │ │ ☒ Edit tools │ │ ☒ Execution tools │ │ ──────────────────────────────────────── │ │ [ Show advanced options ] │ │ │ │ All tools selected │ ╰────────────────────────────────────────────────────────────────────────╯ Press Enter to toggle selection, ↑↓ to navigate, Esc to go back
╭────────────────────────────────────────────────────────────────────────╮ │ Create new agent │ │ Step 7: Select model │ │ Model determines the agent's reasoning capabilities and speed. │ │ │ │ 1. Sonnet Balanced performance - best for most agents✔ │ │ │ │ ❯ 2. Opus Most capable for complex reasoning tasks │ │ 3. Haiku Fast and efficient for simple tasks │ │ 4. Inherit from parent Use the same model as the main conversation │ ╰────────────────────────────────────────────────────────────────────────╯ Press ↑↓ to navigate · Enter to select · Esc to go back
╭────────────────────────────────────────────────────────────────────────╮ │ Create new agent │ │ Step 8: Choose background color │ │ │ │ Choose background color │ │ │ │ Automatic color │ │ Red │ │ ❯ Blue │ │ Green │ │ Yellow │ │ Purple │ │ Orange │ │ Pink │ │ Cyan │ │ │ │ │ │ Preview: bug-finder │ ╰────────────────────────────────────────────────────────────────────────╯ Press ↑↓ to navigate · Enter to select · Esc to go back
╭────────────────────────────────────────────────────────────────────────╮ │ Create new agent │ │ Final step: Confirm and save │ │ │ │ Name: bug-finder │ │ Location: .claude/agents/bug-finder.md │ │ Tools: All tools │ │ Model: Opus │ │ │ │ Description (tells Claude when to use this agent): │ │ │ │ us this agent when user ask to find bug or issue in the system │ │ │ │ System prompt: │ │ │ │ you are bug finder expert with many experenice in this system │ │ │ │ Warnings: │ │ • Agent has access to all tools │ ╰────────────────────────────────────────────────────────────────────────╯ Press s/Enter to save, e to edit in your editor, Esc to cancel
完成后enter进入主菜单查看到刚刚创建好的agent: ╭────────────────────────────────────────────────────────────────────────╮ │ Agents │ │ 6 agents │ │ │ │ Created agent: bug-finder │ │ │ │ ❯ Create new agent │ │ │ │ Personal agents (/Users/baicai/.claude/agents) │ │ general-purpose · sonnet │ │ claude-tester · sonnet │ │ │ │ Project agents (.claude/agents) │ │ bug-finder · opus │ │ code-reviewer · opus │ │ │ │ Built-in agents (always available) │ │ general-purpose · sonnet ⚠ overridden by user │ │ statusline-setup · sonnet │ │ output-mode-setup · sonnet │ │ │ ╰────────────────────────────────────────────────────────────────────────╯ Press ↑↓ to navigate · Enter to select · Esc to go back