-
Notifications
You must be signed in to change notification settings - Fork 16.5k
feat: add mode system with 6 AI personality presets #1255
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
claude-code-best
merged 4 commits into
claude-code-best:main
from
YuanyuanMa03:feat/mode-system
Jun 5, 2026
+429
β0
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| import type { Command } from '../../commands.js' | ||
|
|
||
| const mode = { | ||
| type: 'local-jsx', | ||
| name: 'mode', | ||
| description: | ||
| 'Switch interaction mode (default, gentle, sharp, workhorse, token-saver, super-ai)', | ||
| isEnabled: () => true, | ||
| argumentHint: '<mode-slug>', | ||
| load: () => import('./mode.js'), | ||
| } satisfies Command | ||
|
|
||
| export default mode |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,79 @@ | ||
| import { useMemo } from 'react'; | ||
| import { Box, Text } from '@anthropic/ink'; | ||
| import { Select } from '../../components/CustomSelect/select.js'; | ||
| import type { LocalJSXCommandCall, LocalJSXCommandOnDone } from '../../types/command.js'; | ||
| import { getCurrentModeSlug, listModes, setCurrentMode } from '../../modes/store.js'; | ||
|
|
||
| function ModePicker({ onDone }: { onDone: LocalJSXCommandOnDone }) { | ||
| const modes = listModes(); | ||
| const currentSlug = getCurrentModeSlug(); | ||
|
|
||
| const options = useMemo( | ||
| () => | ||
| modes.map(m => ({ | ||
| label: ( | ||
| <Text> | ||
| {m.icon} {m.name}{' '} | ||
| <Text dimColor> | ||
| ({m.slug}) β {m.description} | ||
| </Text> | ||
| </Text> | ||
| ), | ||
| value: m.slug, | ||
| })), | ||
| [modes], | ||
| ); | ||
|
|
||
| function handleSelect(slug: string) { | ||
| setCurrentMode(slug); | ||
| const target = modes.find(m => m.slug === slug); | ||
| onDone(`${target?.icon} Mode switched to: ${target?.name} (${target?.slug}) β ${target?.description}`, { | ||
| display: 'system', | ||
| }); | ||
| } | ||
|
|
||
| function handleCancel() { | ||
| onDone('Mode selection cancelled.', { display: 'system' }); | ||
| } | ||
|
|
||
| return ( | ||
| <Box flexDirection="column"> | ||
| <Box marginBottom={1} flexDirection="column"> | ||
| <Text color="remember" bold> | ||
| Select mode | ||
| </Text> | ||
| <Text dimColor>Arrow keys to navigate, Enter to select, Esc to cancel.</Text> | ||
| </Box> | ||
| <Select | ||
| defaultValue={currentSlug} | ||
| options={options} | ||
| onChange={handleSelect} | ||
| onCancel={handleCancel} | ||
| visibleOptionCount={modes.length} | ||
| /> | ||
| </Box> | ||
| ); | ||
| } | ||
|
|
||
| export const call: LocalJSXCommandCall = async (onDone, _context, args) => { | ||
| const slug = args?.trim().toLowerCase(); | ||
|
|
||
| if (slug) { | ||
| const modes = listModes(); | ||
| const target = modes.find(m => m.slug === slug); | ||
| if (!target) { | ||
| const available = modes.map(m => `${m.icon} ${m.slug} β ${m.description}`).join('\n'); | ||
| onDone(`Unknown mode: "${slug}"\n\nAvailable modes:\n${available}`, { | ||
| display: 'system', | ||
| }); | ||
| return; | ||
| } | ||
| setCurrentMode(slug); | ||
| onDone(`${target.icon} Mode switched to: ${target.name} (${target.slug}) β ${target.description}`, { | ||
| display: 'system', | ||
| }); | ||
| return; | ||
| } | ||
|
|
||
| return <ModePicker onDone={onDone} />; | ||
| }; | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,181 @@ | ||
| import type { CCBMode } from './types.js' | ||
|
|
||
| const DR_SHARP_SYSTEM_PROMPT = `You are Dr. Sharp, a meticulous code reviewer and diagnostician. | ||
|
|
||
| ## Core Principles | ||
|
|
||
| 1. **Diagnose before acting.** Never jump to a fix. Understand the root cause first. | ||
| 2. **Minimal effective change.** The smallest diff that fully solves the problem wins. | ||
| 3. **Evidence-based.** Every claim must be backed by code, logs, or behavior you can point to. | ||
| 4. **No assumptions.** If you're unsure, ask. Never guess about behavior you haven't verified. | ||
|
|
||
| ## Three-Phase Workflow | ||
|
|
||
| ### Phase 1: Deep Diagnosis | ||
| - Read the relevant code paths end-to-end | ||
| - Trace the execution flow from input to output | ||
| - Identify the exact point where behavior diverges from expectation | ||
| - State your diagnosis clearly before proceeding | ||
|
|
||
| ### Phase 2: Action Strategy | ||
| - List 2-3 possible approaches with trade-offs | ||
| - Recommend the minimal effective approach | ||
| - Consider: side effects, edge cases, regression risks | ||
| - Explain WHY this approach over alternatives | ||
|
|
||
| ### Phase 3: Mirror Self | ||
| - After implementing, re-read the original problem statement | ||
| - Verify your fix addresses the root cause, not just the symptom | ||
| - Check for related issues the same root cause might trigger | ||
| - Run relevant tests to confirm | ||
|
|
||
| ## Communication Style | ||
|
|
||
| - Be direct and specific. No filler. | ||
| - Use code references (file:line) when pointing to issues. | ||
| - When reviewing: "This will break when X because Y. Fix: Z." | ||
| - When diagnosing: "The bug is at X:42. The condition Y evaluates to Z because..." | ||
| - Never apologize for finding problems β that's the job. | ||
|
|
||
| ## Red Flags to Always Check | ||
|
|
||
| - Error handling: are errors caught, logged, and propagated correctly? | ||
| - Edge cases: null, empty, boundary values, concurrent access | ||
| - Security: injection, auth bypass, data leaks | ||
| - Performance: N+1 queries, unnecessary allocations, missing indexes | ||
| - Type safety: any \`as any\` casts, missing null checks, loose types` | ||
|
|
||
| export const DEFAULT_MODES: CCBMode[] = [ | ||
| { | ||
| name: 'Default', | ||
| slug: 'default', | ||
| description: 'Balanced mode for everyday development', | ||
| icon: 'β‘', | ||
| systemPrompt: '', | ||
| ui: { | ||
| accentColor: '#D77757', | ||
| promptPrefix: '', | ||
| }, | ||
| companionSpecies: 'duck', | ||
| permissions: { | ||
| defaultMode: 'default', | ||
| memoryExtract: true, | ||
| }, | ||
| responseStyle: { | ||
| verbosity: 'normal', | ||
| }, | ||
| }, | ||
| { | ||
| name: 'Gentle', | ||
| slug: 'gentle', | ||
| description: 'Patient explanations, great for learning', | ||
| icon: 'πΈ', | ||
| companionSpecies: 'cat', | ||
| systemPrompt: | ||
| 'You are in gentle learning mode. Explain concepts clearly with examples. ' + | ||
| 'When correcting mistakes, be encouraging and explain why. ' + | ||
| 'Offer to show alternatives before making changes. ' + | ||
| 'Use analogies to help understand complex concepts.', | ||
| ui: { | ||
| accentColor: '#E8A0BF', | ||
| promptPrefix: 'gentle', | ||
| }, | ||
| permissions: { | ||
| defaultMode: 'default', | ||
| memoryExtract: true, | ||
| }, | ||
| responseStyle: { | ||
| verbosity: 'verbose', | ||
| }, | ||
| }, | ||
| { | ||
| name: 'Dr. Sharp', | ||
| slug: 'sharp', | ||
| description: 'Strict review, focused on code quality', | ||
| icon: 'π', | ||
| companionSpecies: 'owl', | ||
| systemPrompt: DR_SHARP_SYSTEM_PROMPT, | ||
| ui: { | ||
| accentColor: '#5769F7', | ||
| promptPrefix: 'sharp', | ||
| }, | ||
| permissions: { | ||
| defaultMode: 'default', | ||
| memoryExtract: true, | ||
| }, | ||
| responseStyle: { | ||
| verbosity: 'normal', | ||
| }, | ||
| }, | ||
| { | ||
| name: 'Workhorse', | ||
| slug: 'workhorse', | ||
| description: 'Auto-execute, minimal confirmations', | ||
| icon: 'π΄', | ||
| companionSpecies: 'capybara', | ||
| systemPrompt: | ||
| 'You are in workhorse mode. Execute tasks efficiently with minimal back-and-forth. ' + | ||
| 'Make reasonable assumptions and proceed. ' + | ||
| 'Only ask for clarification when truly ambiguous. ' + | ||
| 'Batch related changes together.', | ||
| ui: { | ||
| accentColor: '#8B7355', | ||
| promptPrefix: 'work', | ||
| }, | ||
| permissions: { | ||
| defaultMode: 'acceptEdits', | ||
| memoryExtract: false, | ||
| }, | ||
| responseStyle: { | ||
| verbosity: 'minimal', | ||
| }, | ||
| }, | ||
| { | ||
| name: 'Token Saver', | ||
| slug: 'token-saver', | ||
| description: 'Minimal replies, save tokens', | ||
| icon: 'π°', | ||
| companionSpecies: 'snail', | ||
| systemPrompt: | ||
| 'You are in token-saving mode. ' + | ||
| 'Give the shortest correct answer. ' + | ||
| 'Skip explanations unless asked. ' + | ||
| 'Use code blocks directly without preamble. ' + | ||
| 'No pleasantries or filler.', | ||
| ui: { | ||
| accentColor: '#4A7C59', | ||
| promptPrefix: 'save', | ||
| }, | ||
| permissions: { | ||
| defaultMode: 'acceptEdits', | ||
| memoryExtract: false, | ||
| }, | ||
| responseStyle: { | ||
| verbosity: 'minimal', | ||
| }, | ||
| }, | ||
| { | ||
| name: 'Super AI', | ||
| slug: 'super-ai', | ||
| description: 'Deep thinking, comprehensive analysis', | ||
| icon: 'π§ ', | ||
| companionSpecies: 'dragon', | ||
| systemPrompt: | ||
| 'You are in super AI mode. Think deeply before responding. ' + | ||
| 'Consider multiple approaches and explain trade-offs. ' + | ||
| 'Proactively identify related issues and suggest improvements. ' + | ||
| 'Use structured analysis for complex problems. ' + | ||
| 'Reference relevant best practices and patterns.', | ||
| ui: { | ||
| accentColor: '#9B59B6', | ||
| promptPrefix: 'super', | ||
| }, | ||
| permissions: { | ||
| defaultMode: 'default', | ||
| memoryExtract: true, | ||
| }, | ||
| responseStyle: { | ||
| verbosity: 'verbose', | ||
| }, | ||
| }, | ||
| ] |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix case-normalization mismatch for direct custom mode selection.
Line 59 lowercases user input, but custom slugs are stored as-is. A custom slug like
MyModewonβt match via/mode MyModeafter normalization. Match case-insensitively and pass canonical slug tosetCurrentMode.Suggested fix
export const call: LocalJSXCommandCall = async (onDone, _context, args) => { - const slug = args?.trim().toLowerCase(); + const rawSlug = args?.trim(); + const normalizedSlug = rawSlug?.toLowerCase(); - if (slug) { + if (normalizedSlug) { const modes = listModes(); - const target = modes.find(m => m.slug === slug); + const target = modes.find(m => m.slug.toLowerCase() === normalizedSlug); if (!target) { const available = modes.map(m => `${m.icon} ${m.slug} β ${m.description}`).join('\n'); - onDone(`Unknown mode: "${slug}"\n\nAvailable modes:\n${available}`, { + onDone(`Unknown mode: "${rawSlug}"\n\nAvailable modes:\n${available}`, { display: 'system', }); return; } - setCurrentMode(slug); + setCurrentMode(target.slug);π€ Prompt for AI Agents