Special Features / Buddy System

Buddy System - Tamagotchi Companion

Location: src/buddy/ (6 files)

How It Works (Complete)

Every Claude Code user gets a unique companion generated deterministically from their user ID.

companion.ts - Generation Algorithm
// Step 1: Hash the user ID to a 32-bit seed
function hashString(s: string): number {
  // FNV-1a hash algorithm
  let hash = 2166136261
  for (let i = 0; i < s.length; i++) {
    hash ^= s.charCodeAt(i)
    hash = (hash * 16777619) >>> 0
  }
  return hash
}

// Step 2: Create a seeded PRNG
function mulberry32(seed: number): () => number {
  return () => {
    seed |= 0; seed = (seed + 0x6D2B79F5) | 0
    let t = Math.imul(seed ^ (seed >>> 15), 1 | seed)
    t = (t + Math.imul(t ^ (t >>> 7), 61 | t)) ^ t
    return ((t ^ (t >>> 14)) >>> 0) / 4294967296
  }
}

// Step 3: Roll all companion traits deterministically
function rollFrom(rng: () => number): Roll {
  const rarity = rollRarity(rng)   // 60% common...1% legendary
  const species = pick(rng, SPECIES) // 18 species
  const eye = pick(rng, EYES)       // 6 eye styles
  const hat = pick(rng, HATS)       // 8 hat types
  const shiny = rng() < 0.01       // 1% shiny chance!
  const stats = rollStats(rng, rarity)
  return { rarity, species, eye, hat, shiny, stats }
}

Complete Species List (18)

🦆 Duck
🦢 Goose
🟥 Blob
🐱 Cat
🐉 Dragon
🦉 Octopus
🦉 Owl
🐧 Penguin
🐢 Turtle
🐌 Snail
👻 Ghost
🦦 Axolotl
🦛 Capybara
🌵 Cactus
🤖 Robot
🐰 Rabbit
🍄 Mushroom
😸 Chonk

Rarity Distribution

Common
60%
Uncommon
25%
Rare
10%
Epic
4%
Legendary
1%
Try This: Buddy Generator

Go to the Buddy Generator. Try these user IDs and compare: 'alice', 'bob', 'claude'. Notice how the same ID always produces the same companion. Now try to find a legendary - hint: try 'legendary_hunter_42'. Can you find a shiny?

Special Features / Dream System

Dream System - Memory Consolidation

Gate System (Cheapest First)

The Dream system uses a 3-gate approach, checking cheapest conditions first:

1Time Gate: Has 24+ hours passed since last consolidation?
2Sessions Gate: Have 5+ new sessions occurred since last consolidation?
3Lock Gate: Is no other process currently consolidating?

Consolidation Process:

AOrient - Read existing MEMORY.md
BGather - Find signals from daily session logs
CConsolidate - Update durable memory with new insights
DPrune - Keep context efficient (200 lines / 25KB max)
Try This: Dream Cycle Simulator

Go to the Dream Cycle Simulator. Set last_consolidation to 20 hours ago and sessions to 3. Watch Gate 2 fail. Now increase sessions to 6 - see all gates pass! What happens if another process has the lock?

Special Features / KAIROS

KAIROS - Proactive Assistant

KAIROS is an always-on proactive AI assistant. It monitors logs and acts without waiting for user input, with push notifications and GitHub webhook integration.

Background Agent Tools

1PushNotificationTool - Send push notifications to the user
2SubscribePRTool - Subscribe to GitHub webhook events
3SendUserFileTool - Send files to the user
4SleepTool - Delay execution for timing control
5BriefTool - Generate session summaries

What KAIROS Monitors

Failing CI/CD pipelines
🔍PR review requests
🚀Deployment issues
📈Pattern-based alerts
Note: KAIROS uses a different memory consolidation approach than the Dream system - it uses 'disk-skill' dreams rather than the standard autoDream service.
Try This: Always-On Monitoring

Imagine you push code that breaks CI. KAIROS would detect the failing pipeline, create a notification, and start investigating the failure - all without you asking. This is what always-on monitoring means.

Special Features / Coordinator

Coordinator Mode - Multi-Agent Swarm

Coordinator Mode enables multi-agent team orchestration with parallel worker agents and internal-only communication tools.

Internal-Only Tools

1TeamCreate - Spawn a team of worker agents
2TeamDelete - Destroy a worker team
3SendMessage - Route messages between agents
4SyntheticOutput - Generate synthetic outputs from workers
Activation
# Feature flag
flag: COORDINATOR_MODE

# Environment variable
export CLAUDE_CODE_COORDINATOR_MODE=1

# Workers use scratchpad directories
# gated by: tengu_scratch
Note: The system tracks session mode (coordinator vs normal) and reconciles on session resume. Workers have access to scratchpad directories (tengu_scratch gate) for temporary file storage.
Try This: Parallel Refactoring

Think about refactoring 10 files. In normal mode, Claude does them one by one. With Coordinator, it spawns 10 worker agents - each handles one file in parallel. Go to the Playground Query Visualizer and imagine 10 of those running simultaneously.

Special Features / ULTRAPLAN

ULTRAPLAN - Extended Planning

ULTRAPLAN offloads complex planning to a remote Opus 4.6 session for up to 30 minutes of deep analysis.

How ULTRAPLAN Works

1 Local context
2 Teleport to cloud
3 Opus 4.6 deep analysis (up to 30 min)
4 Teleport results back

Variants

/ultraplan - Full planning session for complex tasks
🔎/ultrareview - Code review variant for deep analysis
Try This: When to Use ULTRAPLAN

When would you use /ultraplan vs /plan? ULTRAPLAN sends your context to a remote Opus session for 30 minutes. Use it for: migrating a database schema, redesigning an API, or auditing security across an entire codebase.

Special Features / Undercover

Undercover Mode - Safety System

Undercover Mode protects Anthropic employees contributing to public repos by stripping internal information.

What Gets Stripped

Model codenames (Capybara, Tengu, Opus-4-7)
Internal project and repository names
Anthropic-internal info from commits
AI user identity indicators
Attribution lines (Co-Authored-By)
Activation & Build Behavior
// Automatic for 'ant' user type on public repos
// Force ON:
export CLAUDE_CODE_UNDERCOVER=1

// No force-OFF option (safe default)

// Build-time optimization:
// The entire undercover system is dead-code-eliminated
// from external builds since:
//   process.env.USER_TYPE === 'ant'
// is constant-folded at build time
Try This: Codename Stripping

Look for 'Capybara', 'Tengu', or 'Opus-4-7' in the codebase. In undercover mode, all these codenames would be automatically stripped from any commit or PR. This protects internal information.