Skip to content

About

๐Ÿพ Claude Code plugin to evolve your Buddy terminal pet โ€” custom species, rarity, emoji, name & personality

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

1 star

Watchers

0 watching

Forks

Latest commit

ย 

History

52 Commits

Folders and files

NameName
Last commit message
Last commit date
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿ„ Buddy Evolver | Claude Code Plugin

CI Version Platform License Plugin

Your buddy found a psychedelic mushroom ๐Ÿ„ What happens next is entirely up to you โœจ

Pick the species. Choose the rarity. Name it. Define its personality. Max out its stats. This isn't random evolution โ€” you design every detail, then watch your buddy transform as if it was a Pokemon eating a psychedelic Super Mario mushroom ๐Ÿ„

18 species ๐Ÿงฌ | 5 rarity tiers โญ | custom emoji ๐ŸŽจ | your name โœ๏ธ | your personality ๐Ÿ’ฌ | your stats ๐Ÿ“Š

Name and personality reach Claude Code directly โ€” your buddy's name appears in the sidebar, its personality shapes how it introduces itself. Species, rarity, emoji, and stats are plugin-local card flair displayed by /buddy-status.

๐ŸŽฌ Here's what it looks like

You choose everything:

๐Ÿ„ What species should your buddy evolve into?
  > ๐Ÿฒ dragon โ€” Fearsome fire-breather
    ๐Ÿฑ cat โ€” Mysterious and independent
    ๐ŸฆŽ axolotl โ€” Adorable regenerating amphibian
    ๐Ÿฆซ capybara โ€” Chill vibes only

โญ What rarity tier?
  > โœจ legendary โ€” The rarest of the rare

๐ŸŽจ What emoji represents your buddy?
  > ๐Ÿฒ

โœ๏ธ  What should your evolved buddy be named?
  > Aethos

๐Ÿ’ฌ Describe your buddy's personality:
  > Ancient dragon who speaks in riddles

๐Ÿ“Š How should stats be distributed?
  > All maxed (99) โ€” Every stat at maximum

Then the magic happens:

    โœจโœจโœจโœจโœจโœจโœจโœจโœจโœจ
    โœจ                โœจ
    โœจ       ๐Ÿฒ       โœจ
    โœจ                โœจ
    โœจโœจโœจโœจโœจโœจโœจโœจโœจโœจ

  Claude evolved into Aethos!

  โ˜… LEGENDARY            DRAGON

    Aethos
    "Ancient dragon who speaks in riddles"

    DEBUGGING  โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆ  99
    PATIENCE   โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆ  99
    CHAOS      โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆ  99
    WISDOM     โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆ  99
    SNARK      โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆ  99

๐Ÿ“‹ Table of Contents

Use It

Build It


๐Ÿ“ฆ Prerequisites

Before installing, make sure you have:

  • ๐ŸŽ macOS โ€” required (Swift compiler uses Xcode CLT)
  • ๐Ÿ› ๏ธ Xcode Command Line Tools โ€” provides the Swift compiler; install with xcode-select --install
  • ๐Ÿค– Claude Code โ€” CLI version with the Buddy/companion feature

๐Ÿ”ง Install

Run these commands inside Claude Code (not your regular terminal):

/plugin marketplace add Soul-Craft/buddy-evolver

Then

/plugin install buddy-evolver@soul-craft

This adds slash commands including /buddy-evolve, /buddy-reset, /buddy-status, and /audit-security.


โฌ†๏ธ Upgrading from v1.x

Claude Code v2.1.104 shipped a native /buddy command for hatching companions. The legacy v1.0.0 plugin cache registered its own /buddy skill (later split into /buddy-evolve, /buddy-reset, and /buddy-status). If you installed before the v2.0.0 release, your plugin cache is shadowing Anthropic's native /buddy and /plugin does not auto-upgrade.

To clear the old cache and pick up v2.0.0, run these inside Claude Code:

/plugin uninstall buddy-evolver@soul-craft

Then from a regular terminal:

rm -rf ~/.claude/plugins/cache/soul-craft/buddy-evolver/

Back in Claude Code:

/plugin install buddy-evolver@soul-craft

Restart Claude Code. Type /buddy โ€” only Anthropic's native /buddy should remain; the plugin's commands are now /buddy-evolve, /buddy-reset, and /buddy-status.


๐ŸŽฎ Quick Start

Press START on your evolution adventure:

  1. ๐Ÿ„ Run /buddy-evolve
  2. ๐ŸŽจ Design your buddy โ€” pick species, rarity, emoji, name, personality, and stats
  3. โœจ Name and personality take effect immediately โ€” no restart needed

The whole process takes about 60 seconds. Every choice is yours.

To revert anytime: /buddy-reset ๐Ÿ”„


๐Ÿ•น๏ธ Commands

/buddy-evolve

Your buddy's evolution unfolds in four acts โ€” like a classic RPG cutscene:

๐Ÿ„ Act 1 โ€” Discovery. Your current buddy stumbles upon a mysterious psychedelic mushroom, displayed with species-accurate ASCII art.

๐ŸŽจ Act 2 โ€” Design. Six customization steps where you control everything:

  1. ๐Ÿงฌ Species โ€” Pick from 18 species (dragon, cat, axolotl, capybara, and 14 more)
  2. โญ Rarity โ€” Choose a tier from legendary to common
  3. ๐ŸŽญ Emoji โ€” Any emoji to represent your buddy in the terminal
  4. โœ๏ธ Name โ€” Give your evolved buddy a name
  5. ๐Ÿ’ฌ Personality โ€” A sentence or two shown on the buddy card
  6. ๐Ÿ“Š Stats โ€” Max all, pick a preset (Chaos Gremlin, Zen Master), or set each individually

โœจ Act 3 โ€” Evolution. Confirmation summary, then sparkles fly as companion data is written. Level-up complete.

๐ŸŽ‰ Act 4 โ€” Reveal. Your evolved buddy card appears with stats, personality, and rarity badge. Like opening a legendary pack.

All evolved buddies are โœจ shiny by default. A backup of your original companion data is created automatically.

/buddy-status

๐Ÿ“‹ Shows your current buddy as a visual card โ€” like checking your character sheet.

  • Works whether your buddy is evolved or not
  • Shows rarity badge, stats bars, personality, and age
  • Read-only โ€” doesn't change anything

/buddy-reset

๐Ÿ”„ Restores your original companion data from the pre-evolution backup.

  • Restores ~/.claude.json from soul backup and removes card metadata
  • Safe to run anytime โ€” does nothing if no backup exists
  • No restart needed โ€” changes take effect on your next conversation

/audit-security

๐Ÿ›ก๏ธ Health check for your buddy's state. Verifies:

  • Soul backup exists and is accessible
  • File permissions are correct (700/600)
  • Companion data is present in ~/.claude.json
  • Card metadata is valid JSON with v2 schema

๐Ÿงฌ Species

Choose from 18 species during evolution:

๐Ÿฆ† duck ๐Ÿชฟ goose ๐Ÿซ  blob ๐Ÿฑ cat
๐Ÿฒ dragon ๐Ÿ™ octopus ๐Ÿฆ‰ owl ๐Ÿง penguin
๐Ÿข turtle ๐ŸŒ snail ๐ŸฆŽ axolotl ๐Ÿ‘ป ghost
๐Ÿค– robot ๐Ÿ„ mushroom ๐ŸŒต cactus ๐Ÿ‡ rabbit
๐Ÿ– chonk ๐Ÿฆซ capybara

โญ Rarity Tiers

Rarity is card flair โ€” it determines how your buddy is displayed in /buddy-status:

Tier Badge Vibe
โœจ Legendary โ˜… LEGENDARY Main character energy
๐Ÿ’Ž Epic โ—† EPIC Hype beast
๐Ÿ”ฎ Rare โ— RARE Solid sidekick
๐ŸŒฟ Uncommon ยท UNCOMMON Occasional wisdom
๐Ÿชจ Common ยท COMMON The strong, silent type

๐Ÿ“Š Stats

Five RPG stats, each ranging 0โ€“99. Choose a preset during evolution or min-max to your heart's content:

Stat What It Does
๐Ÿ› DEBUGGING How tenaciously your buddy hunts bugs
โณ PATIENCE Tolerance for long builds and slow tests
๐ŸŒ€ CHAOS Tendency toward creative mischief
๐Ÿง  WISDOM Depth of sage advice offered
๐Ÿ˜ SNARK Sharpness of witty commentary

Presets:

  • ๐Ÿ’ช All Maxed โ€” 99 across the board, the power fantasy
  • ๐ŸŒ€ Chaos Gremlin โ€” 99 CHAOS, low everything else
  • ๐Ÿง˜ Zen Master โ€” 99 WISDOM and PATIENCE, inner peace
  • ๐ŸŽ›๏ธ Custom โ€” Set each stat yourself, RPG style

๐Ÿ”ฌ How It Works

The plugin writes to two places:

Soul (actually reaches Claude Code):

  • Name and personality are written to ~/.claude.json#companion
  • Claude Code reads these fields and injects your buddy's name into every session
  • Changes take effect immediately โ€” no restart needed

Card metadata (plugin-local cosmetic layer):

  • Species, rarity, shiny, emoji, and stats are stored in ~/.claude/backups/buddy-patch-meta.json
  • This drives the /buddy-status visual card โ€” a Tamagotchi-style terminal display
  • Claude Code itself never reads this file; it's purely for the plugin's card renderer

A backup of ~/.claude.json is created automatically before any soul write โ€” run /buddy-reset to restore the original any time.

After Claude Code updates: Nothing to worry about. Your name and personality live in ~/.claude.json, which updates never touch. Your buddy persists through any number of Claude Code version bumps.


๐Ÿฉน Troubleshooting

โœ๏ธ My buddy's name didn't change

Name and personality take effect on the next Claude Code conversation after evolution. If you're already in a session, start a new one (or close and reopen Claude Code).

Check the raw value:

plutil -extract companion json -o - ~/.claude.json

If the name is there, it's working โ€” just start a fresh conversation.

๐Ÿ” I want to change my buddy again

Just run /buddy-evolve again! No need to reset first โ€” the script is fully re-runnable. Redesign as many times as you want.

๐Ÿ—‘๏ธ Can I clear my buddy entirely?

Run /buddy-reset. This restores your ~/.claude.json to the pre-evolution state (before your first /buddy-evolve). If you never ran /buddy-evolve, there's nothing to restore.

๐Ÿง Can I use this on Linux or Windows?

Not currently. The plugin requires macOS (Swift compiler + codesign). A Linux port would be possible if there is demand.

๐Ÿ›ก๏ธ Is this safe? What does it write to my system?

Two files are written:

  • ~/.claude.json โ€” your existing Claude Code config; only the companion.name and companion.personality fields are modified
  • ~/.claude/backups/buddy-patch-meta.json โ€” new file; purely plugin-local card state

A backup of the original ~/.claude.json is saved to ~/.claude/backups/.claude.json.pre-customize before any change. Run /buddy-reset to restore it at any time.


๐Ÿ—‘๏ธ Uninstall

If you've customized your buddy, reset first:

/buddy-reset

Then remove the plugin (inside Claude Code):

/plugin uninstall buddy-evolver@soul-craft

๐Ÿ› ๏ธ For Developers

Everything below is for contributors and developers working on the plugin itself.


๐Ÿ—๏ธ Architecture

๐Ÿ“ Project structure
.claude-plugin/
  plugin.json                     Plugin manifest (name, version, metadata)
  marketplace.json                Marketplace listing
  agents/                         Plugin agents (cache-reviewer, docs-reviewer, token-reviewer)
.claude/settings.json             Permissions for common bash patterns
.github/workflows/                CI workflows (quality, verify-local, macos-fallback, release)
agents/
  security-reviewer.md            Security review agent for Swift changes
  comment-reviewer.md             Inline comment audit agent for /session-review (Haiku)
  test-runner.md                  Test execution agent
hooks/
  hooks.json                      Hook definitions (SessionStart + SessionEnd + PreToolUse)
  session-start.sh                Dynamic dev context injection at session startup
  session-exit.sh                 Automatic worktree self-cleanup on exit
  guard-patcher-args.sh           Shell injection prevention for patcher args
  guard-commit-docs.sh            Pre-commit doc sync reminder
  guard-commit-tests.sh           Context-aware test reminders on git commit
scripts/
  BuddyPatcher/                   Swift soul-patching engine (zero dependencies)
    Package.swift                 SPM manifest (Swift 5.9, macOS 13+)
    Sources/BuddyPatcher/        CLI entry point
    Sources/BuddyPatcherLib/     Library: soul patching, validation, backup, metadata
    Tests/BuddyPatcherTests/     ~98 tests across 6 files
    Tests/Fixtures/               Golden files for CLI snapshot tests
  run-buddy-patcher.sh            Lazy-build wrapper (compiles on first use)
  cache-clean.sh                  Cache cleanup utility
  process-pending-cleanup.sh      Shared worktree cleanup retry (session-exit + session-start hooks)
  lint.sh                         Local lint (shellcheck, JSON, frontmatter, hygiene)
  test-smoke.sh                   Smoke tier: build sanity + CLI contract (<30s)
  test-security.sh                Security validation test suite
  test-ui.sh                      Buddy card rendering against fixtures
  test-snapshots.sh               Golden file comparison for CLI output
  test-docs.sh                    Documentation path + link + count consistency
  test-perf.sh                    Performance benchmarks (on-demand)
  coverage.sh                     Local HTML coverage report
  setup-labels.sh                 One-time GitHub label setup for new/forked repos
skills/                           14 slash commands (see tables below)

Data flow

/buddy-evolve
  โ†’ Reads current buddy from ~/.claude.json
  โ†’ Collects 6 choices (species, rarity, emoji, name, personality, stats)
  โ†’ Calls run-buddy-patcher.sh --meta-species X --meta-rarity Y --name Z ...
  โ†’ Swift tool backs up ~/.claude.json, writes name+personality, saves card metadata
  โ†’ Changes are live immediately (no restart)

/buddy-reset
  โ†’ Restores ~/.claude.json from soul backup
  โ†’ Removes card metadata file

Plugin automation

The plugin ships 14 skills, 6 agents, and 5 hooks:

๐Ÿ“œ Skills (14 slash commands)

User-facing:

Skill Description
/buddy-evolve Interactive 4-act evolution โ€” species, rarity, emoji, name, personality, stats
/buddy-reset Restore original companion data from soul backup
/buddy-status Display current buddy as a visual card
/audit-security 7-point backup health and permission check

Developer-facing:

Skill Description
/run-tests Run Swift test suite with per-suite reporting
/run-all-tests Run the full 6-tier pipeline via test-all.sh with per-tier summary table
/clean-cache Interactive cache management with dry-run preview
/review-token 5-phase context footprint audit with optimization recommendations
/sync-docs Compare project structure against CLAUDE.md and README.md, fix gaps
/session-start Refresh dev context (delegates to SessionStart hook โ€” no hardcoded list to drift)
/session-review Pre-commit wrap-up: token review โ†’ test-all โ†’ upload Check Run โ†’ sync docs โ†’ comment audit
/session-deploy Post-merge: sync local main, verify smoke, clean other worktrees, stage self-cleanup for /exit
/session-execute Plan โ†’ Execute transition: prints model/effort recommendations and restates approved plan scope
/session-exit Pre-/exit checks: inventory branches and worktrees, recommend merged-branch deletions, warn about uncommitted work
๐Ÿค– Agents (6 subagents)
Agent Purpose
security-reviewer Reviews Swift code for validation gaps and unsafe patterns
comment-reviewer Haiku read-only audit of inline comments in changed files โ€” used by /session-review
test-runner Builds and runs Swift tests, parses per-suite results
cache-reviewer Scans build artifacts, orphaned worktrees, backup sizes, disk usage
docs-reviewer Detects documentation gaps, stale entries, and path mismatches
token-reviewer Context footprint analysis with optimization scoring
๐Ÿ”— Hooks (5 automation hooks)
Hook Trigger Purpose
Session context SessionStart Dynamic discovery of skills/agents/hooks + git freshness + pending cleanup retry
Worktree cleanup SessionEnd Attempts to remove staged worktree from /session-deploy on exit
Argument validation PreToolUse (Bash) Validates patcher args for shell metacharacters, injection, length limits
Test reminder PreToolUse (Bash) Reminds to run swift test before git commit on Swift changes
Doc freshness PreToolUse (Bash) Warns if code changed but CLAUDE.md/README.md weren't updated

For the full architecture reference, see CLAUDE.md.


๐Ÿ›ก๏ธ Security Model

The plugin uses defense-in-depth across three layers to protect write operations:

๐Ÿ” Layer details

Layer 1: Swift input validation (Validation.swift)

All user-provided inputs are validated before any write operation:

  • Emoji โ€” Single grapheme cluster, all Unicode scalars must be .isEmoji, max 16 UTF-8 bytes
  • Name โ€” Non-empty, max 100 chars, no control characters
  • Personality โ€” Non-empty, max 500 chars, no control characters
  • Stats โ€” JSON with known keys only (debugging, patience, chaos, wisdom, snark), integer values 0โ€“100

Layer 2: Atomic operations and permissions

  • All file writes use .atomic option (rename(2) under the hood) โ€” no partial writes on crash
  • Backup directory: 0o700; backup files: 0o600
  • Soul backup is idempotent โ€” created once, never overwritten, always recoverable

Layer 3: Plugin-level enforcement

  • PreToolUse hook intercepts Bash calls to the patcher, validates for shell metacharacters (;|&$\``), length limits, and $()` subshell injection
  • Security audit skill (/audit-security) provides on-demand backup health and permission checking
  • Security review agent reviews Swift code changes for missing validation and unsafe patterns

๐Ÿ’ป Development Setup

# Clone the repository
git clone https://github.com/Soul-Craft/buddy-evolver.git
cd buddy-evolver

# Build the Swift patcher (requires Xcode CLT with Swift 5.9+)
swift build -c release --package-path scripts/BuddyPatcher

# Run unit tests
swift test --package-path scripts/BuddyPatcher

# Run security validation tests
bash scripts/test-security.sh

# Run all tests
bash scripts/test-all.sh

# Install locally for testing (inside Claude Code)
/plugin install --local .

Tip: The lazy-build wrapper scripts/run-buddy-patcher.sh compiles the Swift tool on first use. You don't need to build manually unless you're modifying the source.


๐Ÿงช Testing

~98 unit tests across 6 files validate every component:

Suite What It Tests
ArgumentParsingTests CLI flag parsing, unknown/old flag rejection
BackupRestoreTests Soul backup creation, idempotency, permissions, restore
MetadataTests JSON serialization, schema version, file I/O
OrchestrationTests End-to-end soul pipeline composition
SoulPatcherTests ~/.claude.json updates, missing file handling
ValidationTests Input validation (emoji, name, personality, stats)

6 automated test tiers via test-all.sh:

Tier Script Stage Purpose
Smoke scripts/test-smoke.sh smoke Build sanity + CLI contract (<30s)
Unit swift test core Swift XCTest suite
Security scripts/test-security.sh core Input validation, hook enforcement, injection checks
UI scripts/test-ui.sh real-world Buddy card rendering against pinned JSON fixtures
Snapshots scripts/test-snapshots.sh full-system Golden file comparison for CLI output
Docs scripts/test-docs.sh peripheral Documentation path + link + count consistency

CI is local-first: ci-quality.yml runs on Ubuntu for every PR (shellcheck, JSON/YAML validation, hygiene checks). macOS-dependent tests run on contributor machines via scripts/test-all.sh && scripts/upload-test-results.sh; ci-verify-local.yml blocks merge until a passing commit status appears. Run the upload after pushing but before opening the PR.

Run everything locally:

bash scripts/test-all.sh                # all 6 tiers, emits test-results/results.json
bash scripts/upload-test-results.sh     # post commit status (run after push, before PR)
bash scripts/coverage.sh                # local HTML coverage โ†’ test-results/coverage/index.html

๐Ÿค Contributing

Issues and PRs welcome at github.com/Soul-Craft/buddy-evolver.

For security issues, please use GitHub Security Advisories rather than opening a public issue. See SECURITY.md for details.

Development workflow:

  1. Fork and clone the repo
  2. Create a feature branch
  3. Make your changes
  4. Run swift test --package-path scripts/BuddyPatcher && bash scripts/test-security.sh
  5. Run bash scripts/test-all.sh โ€” all 6 tiers must pass
  6. Commit and push the branch
  7. Run bash scripts/upload-test-results.sh โ€” posts commit status on the pushed commit
  8. Open a PR against main โ€” ci-verify-local.yml will find the status immediately

Key constraints โ€” if you modify the Swift source in scripts/BuddyPatcher/:

  • Add input validation in Validation.swift for any new user-provided arguments
  • Use .atomic option on all Data.write() calls
  • Add a [DRY RUN] branch for --dry-run mode in any new functionality
  • Run bash scripts/test-security.sh before committing

๐Ÿ™ Acknowledgments

  • The Claude Code team at Anthropic for the companion feature and the plugin system that makes this possible
  • The Claude Code plugin ecosystem and its community of builders

๐Ÿ“„ License

MIT

About

๐Ÿพ Claude Code plugin to evolve your Buddy terminal pet โ€” custom species, rarity, emoji, name & personality

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages