AGENTS.md
AGENTS.mdAGENTS.mdroot
Quality
91/100
Scores the file, not the repository.Length
1,648 words
40 headings · 16 code blocksRepository
20
— · pushed 34 days agoLast changed
2 days ago
First indexed 2 days ago.1# Claude Code Personalities23> Dynamic text-face personalities for Claude Code's statusline that change based on what Claude is doing45## Important Rules67- **NO EMOJIS**: Never use emojis in any files or output8- **Nerd Font Icons Only**: If icons are needed, use Nerd Font UTF-8 byte sequences only (e.g., `\u{f07b}` for folder icon)9- **Never replace local binary directly**: The developer is an end user too. Always use `claude-code-personalities update` or download from releases - never `cp` the binary directly. This ensures the update flow is tested.1011## What is This?1213Claude Code Personalities is a personality system that gives Claude Code a dynamic, context-aware statusline with text-face emoticons that change based on Claude's current activity. Instead of a static prompt, you get a fun, informative statusline that shows Claude's "mood" and what it's currently working on.1415**Rust Implementation**: The project is implemented in pure Rust for lightning-fast performance, better error handling, and zero external dependencies. No shell scripts needed!1617### Features1819- **30+ Text-Face Personalities**: From `ʕ•ᴥ•ʔ Code Wizard` to `(┛ಠДಠ)┛彡┻━┻ Frustrated Developer`20- **Context-Aware**: Personalities change based on files being edited, commands run, and errors encountered21- **Git Status Indicator**: Real-time display of working tree status with file counts (`±5` for dirty, `✓` for clean)22- **Interactive Configuration**: Use `config` command to customize what appears in statusline23- **Activity Tracking**: Monitors Claude's tool usage (Edit, Bash, Grep, etc.) via hooks24- **Error State Management**: Claude gets progressively more frustrated with errors25- **Nerd Font Icons**: Visual indicators for folders, activities, and status26- **Session Persistence**: Maintains personality state across a Claude Code session27- **Model-Specific Indicators**: Different icons for Opus, Sonnet, and Haiku2829## How It Works3031```mermaid32graph LR33 A[Claude Code] -->|JSON Input| B[claude-code-personalities --statusline]34 A -->|Hook Events| C[claude-code-personalities --hook]35 C -->|Updates State| D[/tmp/claude_session_*.json]36 D -->|Reads State| B37 B -->|Displays| E[Terminal Statusline]38```39401. **Claude Code** calls the binary with `--statusline` and passes JSON input containing session and workspace info412. **Hook system** intercepts tool usage (PreToolUse/PostToolUse) and calls binary with `--hook` to track Claude's activities423. **State management** updates personality and activity based on context (files, tools, errors)434. **Persistent state** maintained in `/tmp/claude_session_*.json` files across the session445. **Statusline display** shows personality, current directory, activity, and model4546## Architecture4748### Pure Rust Binary4950The entire system is contained in a single Rust binary that operates in different modes:5152```53claude-code-personalities54├── --statusline # Generate statusline output (called by Claude Code)55├── --hook <type> # Handle hook events (pre-tool, post-tool, session-end)56├── init # Initialize Claude Code settings for personalities57├── config # Interactive configuration menu58├── status # Check installation status59├── update # Update to latest version60└── uninstall # Remove personalities61```6263### File Structure6465```66~/.claude/67├── claude-code-personalities # Main Rust binary68├── settings.json # Claude Code configuration (modified by installer)69└── personalities_config.json # User preferences (created by config command)7071/tmp/72└── claude_session_<session_id>.json # Session state (personality, activity, error count)73```7475### Configuration in settings.json7677The installer modifies Claude Code's `~/.claude/settings.json` to add:7879```json80{81 "statusLine": {82 "type": "command",83 "command": "/Users/user/.claude/claude-code-personalities",84 "args": ["--statusline"],85 "padding": 086 },87 "hooks": {88 "PreToolUse": [{89 "matcher": "*",90 "hooks": [{91 "type": "command",92 "command": "/Users/user/.claude/claude-code-personalities",93 "args": ["--hook", "pre-tool"]94 }]95 }],96 "PostToolUse": [{97 "matcher": "*",98 "hooks": [{99 "type": "command",100 "command": "/Users/user/.claude/claude-code-personalities",101 "args": ["--hook", "post-tool"]102 }]103 }],104 "Stop": [{105 "hooks": [{106 "type": "command",107 "command": "/Users/user/.claude/claude-code-personalities",108 "args": ["--hook", "session-end"]109 }]110 }]111 }112}113```114115## How Personalities Work116117### Personality Assignment Logic118119The Rust binary analyzes tool usage and context to determine personalities:120121```rust122// Error-based frustration (highest priority)123if error_count >= 5 { "(╯°□°)╯︵ ┻━┻ Table Flipper" }124else if error_count >= 3 { "(┛ಠДಠ)┛彡┻━┻ Frustrated Developer" }125126// Tool-based personalities127else if tool == "Bash" && args.contains("git") { "┗(▀̿Ĺ̯▀̿ ̿)┓ Git Manager" }128else if tool == "Grep" || activity == "searching" { "( ͡° ͜ʖ ͡°) Search Detective" }129else if tool == "Edit" && file.ends_with(".md") { "(͡• ͜໒ ͡• ) Documentation Writer" }130else if tool == "Edit" && file.ends_with(".rs") { "\ue7a8 Rust Developer" }131132// Activity-based fallbacks133else if activity == "editing" { "ʕ•ᴥ•ʔ Code Wizard" }134else if activity == "reading" { "(⌐■_■) File Inspector" }135else { "(。◕‿◕。) Helpful Assistant" }136```137138### Session State Format139140State is stored in `/tmp/claude_session_<session_id>.json`:141142```json143{144 "session_id": "abc-123",145 "activity": "editing",146 "personality": "ʕ•ᴥ•ʔ Code Wizard",147 "consecutive_actions": 5,148 "error_count": 0,149 "last_updated": "2024-08-27T10:30:00Z"150}151```152153## Installation Process154155The `install.sh` script:1561571. **Downloads binary** from GitHub releases1582. **Installs binary** to `~/.local/bin/claude-code-personalities`1593. **Runs `init`** automatically to configure Claude Code160161The `claude-code-personalities init` command:1621631. **Creates/verifies** `~/.claude/` directory exists1642. **Backs up** existing `settings.json` (timestamped)1653. **Configures statusline** and hooks in `settings.json`1664. **Validates setup** by verifying configuration167168## Configuration169170### Interactive Configuration171172```bash173claude-code-personalities config174```175176Opens a multi-select menu to toggle. The menu displays your current configuration with checkboxes pre-selected for enabled options, so you can immediately see what's active and make changes as needed:177- Show Personality (text faces)178- Show Activity (current action)179- Show Activity Context (files/commands)180- Show Git Branch181- Show Git Status (working tree changes with count)182- Show Current Directory183- Show Model Indicator184- Use Nerd Font Icons185- Use ANSI Colors186- Show Separators187- Compact Mode188- Debug Info189- Theme Selection190191Settings saved to `~/.claude/personalities_config.json`:192193```json194{195 "show_personality": true,196 "show_activity": true,197 "show_context": true,198 "show_git_branch": true,199 "show_git_status": true,200 "show_current_dir": false,201 "show_model": true,202 "use_icons": true,203 "use_colors": true,204 "display": {205 "show_separators": true,206 "compact_mode": false,207 "show_debug_info": false208 },209 "theme": "Dark"210}211```212213#### Git Status Display214215The git status feature shows real-time working tree status:216217- **Dirty state**: `±5` (orange/yellow) - Shows number of uncommitted files218- **Clean state**: `✓` (green) - Indicates no uncommitted changes219- **Performance**: 2-second caching to minimize git command overhead220- **Smart**: Only updates when cache expires or state changes221222Example statusline with git status:223```224ʕ•ᴥ•ʔ Code Wizard • main ±5 • Editing src/main.rs • Sonnet225```226227### Custom Personalities228229Personalities are defined in Rust code (`src/statusline/personality.rs`). To add custom ones, modify the personality determination logic and rebuild:230231```rust232else if file_path.ends_with(".py") {233 "\ue73c Python Developer".to_string()234}235```236237## Nerd Font Icons Reference238239Icons are defined using UTF-8 sequences:240241| UTF-8 Bytes | Unicode | Description |242| -------------- | ------- | --------------- |243| `\xef\x81\xbb` | U+F07B | Folder |244| `\xef\x84\xa1` | U+F121 | Code |245| `\xef\x86\x88` | U+F188 | Bug |246| `\xef\x80\x82` | U+F002 | Search |247| `\xef\x81\x84` | U+F044 | Edit |248| `\xef\x83\xa7` | U+F0E7 | Lightning/Run |249| `\xef\x81\xae` | U+F06E | Eye/Review |250| `\xef\x83\xab` | U+F0EB | Lightbulb/Think |251| `\xef\x84\xb5` | U+F135 | Rocket |252| `\xef\x81\xb1` | U+F071 | Warning |253| `\xef\x81\x97` | U+F057 | Error |254| `\xef\x81\xad` | U+F06D | Fire |255| `\xef\x80\x93` | U+F013 | Gear |256| `\xef\x84\xa0` | U+F120 | Terminal |257258## Testing259260### Test Statusline Generation261```bash262# Simulate Claude Code input263echo '{"session_id":"test","model":{"display_name":"Opus"},"workspace":{"current_dir":"/project"}}' | claude-code-personalities --statusline264```265266### Test Hook Processing267```bash268# Simulate tool usage hook269echo '{"session_id":"test","tool_name":"Edit","tool_input":{"file_path":"main.rs"}}' | claude-code-personalities --hook pre-tool270```271272### Debug Mode273```bash274# Check what's in the state file275cat /tmp/claude_session_test.json276277# Check installation status278claude-code-personalities status279```280281## Troubleshooting282283### Icons Not Displaying2841. Install Nerd Fonts: `brew install --cask font-hack-nerd-font`2852. Set terminal font to a Nerd Font2863. Test: `printf '\xef\x81\xbb'` should show folder icon287288### Personality Not Changing2891. Check installation: `claude-code-personalities status`2902. Verify hooks in `~/.claude/settings.json`2913. Check state file exists: `ls /tmp/claude_session_*.json`2924. Test hook manually with echo command above293294### Always Shows Default Personality295- State file isn't being created/updated296- Check that hooks are configured correctly297- Ensure session_id is being passed from Claude Code298299### Update Issues3001. Check binary location: `which claude-code-personalities`3012. Run status check: `claude-code-personalities status`3023. Reinitialize if needed: `claude-code-personalities init`303304### Performance Issues305The Rust implementation is designed for speed:306- Binary startup: ~1ms307- State file I/O: ~0.1ms308- Personality calculation: ~0.01ms309- Total statusline generation: <2ms310311If experiencing slowness, check:312- Disk space in `/tmp`313- File permissions on state files314- Multiple concurrent hook executions315316## Development317318### Building from Source319320**Use `just` for development commands** - the project uses a justfile for common tasks:321```bash322just # Show available commands323just build # Build release binary324just test # Run tests325just lint # Run clippy326just develop-link # Link dev binary for testing (creates symlink)327just develop-unlink # Restore original binary328```329330Manual build:331```bash332cargo build --release333# Binary at target/release/claude-code-personalities334```335336### Adding New Personalities3371. Edit `src/statusline/personality.rs`3382. Add new personality patterns to `determine_personality()`3393. Add corresponding kaomoji to `src/kaomoji/`3404. Rebuild and test341342### Releasing a New Version343344Use the `just release` command for the full release workflow:345346```bash347just release 0.4.3348```349350This automatically:3511. Updates version in `Cargo.toml`3522. Builds for all platforms (via `build-cross.sh`)3533. Commits the version bump3544. Creates and pushes a git tag3555. GitHub Actions builds and publishes the release356357**Config Versioning**: When making breaking changes to `personalities_config.json`:3581. Increment `CONFIG_VERSION` in `src/config/preferences.rs`3592. Add migration logic in the `migrate()` function3603. Document the change in the version comments361362### Contributing363- Follow existing code patterns364- Add tests for new functionality365- Update documentation366- Use `cargo fmt` and `cargo clippy`367368## Architecture Benefits369370The pure Rust implementation provides:371372- **Performance**: 10-100x faster than shell scripts373- **Reliability**: Better error handling and recovery374- **Maintainability**: Single codebase vs scattered scripts375- **Portability**: Same binary works across platforms376- **Security**: No shell injection vulnerabilities377- **Dependencies**: Zero external runtime dependencies378379# important-instruction-reminders380Do what has been asked; nothing more, nothing less.381NEVER create files unless they're absolutely necessary for achieving your goal.382ALWAYS prefer editing an existing file to creating a new one.383NEVER proactively create documentation files (*.md) or README files. Only create documentation files if explicitly requested by the User.384
Similar configs
Same format, overlapping stack, ranked by quality.
| Repository | Format | Stack | Covers | Score | Changed |
|---|---|---|---|---|---|
| OnlyTerp/prompt-cache-skillsAGENTS.md · 112 | AGENTS.md | setupbuildtestlint-format+5 | 100/100 | 3 days ago | |
| n8n-io/n8npackages/@n8n/agents/AGENTS.md · 199k | AGENTS.md | buildteststylearch+3 | 100/100 | 3 days ago | |
| duckduckgo/content-scope-scriptsspecial-pages/AGENTS.md · 70 | AGENTS.md | buildteststylearch+3 | 100/100 | 3 days ago | |
| wpscanteam/wpscanAGENTS.md · 9.7k | AGENTS.md | setupbuildteststyle+6 | 100/100 | 2 days ago | |
| SkeneTechnologies/skene-cookbookAGENTS.md · 51 | AGENTS.md | setupbuildtestlint-format+7 | 100/100 | 2 days ago | |
| mui/material-uiAGENTS.md · 99k | AGENTS.md | setupbuildtestlint-format+9 | 100/100 | 3 days ago | |
| trick77/agents-md-syncAGENTS.md · 2 | AGENTS.md | setupbuildteststyle+5 | 100/100 | 3 days ago | |
| aaif-goose/gooseAGENTS.md · 52k | AGENTS.md | setupbuildtestlint-format+6 | 100/100 | 3 days ago |
