Documentation
¶
Overview ¶
Package buddy implements the companion (tamagotchi) system.
Mirrors src/buddy/ from the Claude Code TS source:
- Mulberry32 PRNG seeded from FNV-1a hash of user ID
- 18 species with 5 rarity tiers
- 5 stats (DEBUGGING, PATIENCE, CHAOS, WISDOM, SNARK)
- ASCII sprite frames with eye/hat substitution
- /buddy command for display
Index ¶
Constants ¶
This section is empty.
Variables ¶
var AllSpecies = []string{
"duck", "goose", "blob", "cat", "dragon", "octopus",
"owl", "penguin", "turtle", "snail", "ghost", "axolotl",
"capybara", "cactus", "robot", "rabbit", "mushroom", "chonk",
}
AllSpecies is the complete list of 18 companion species (mirrors buddy/types.ts).
Functions ¶
func IntroPrompt ¶
func IntroPrompt() string
IntroPrompt returns the system-prompt block injected when a companion is active. Mirrors src/buddy/prompt.ts companionIntroText: tells the model that a small named buddy sits beside the input box, and what to do when the user addresses the buddy by name. Empty string when no companion is configured.
Read at startup by cmd/conduit/main.go to fold into the system blocks alongside CLAUDE.md and MCP instructions.
func RenderFace ¶
RenderFace returns a compact inline representation of the companion.
func RenderSprite ¶
RenderSprite renders one animation frame of the companion. frame is taken modulo the frame count. Eye placeholder {E} is substituted.
func SpriteFrameCount ¶
SpriteFrameCount returns the number of animation frames for a species.
Types ¶
type Bones ¶
type Bones struct {
Species string
Rarity string
Eye string
Hat string
Shiny bool
Stats map[string]int // 1-100 per stat
}
Bones are the deterministically generated companion attributes.
func GenerateBones ¶
GenerateBones generates deterministic companion bones for the given userID. Mirrors companion.ts generateBones().
forcedRarity overrides the weighted rarity roll (use "" for normal roll). The env var CLAUDE_BUDDY_FORCE_RARITY takes precedence over forcedRarity.
type StoredCompanion ¶
type StoredCompanion struct {
Name string `json:"name"`
UserID string `json:"userId"`
HatchedAt string `json:"hatchedAt,omitempty"`
ForcedRarity string `json:"forcedRarity,omitempty"` // persisted rarity override
}
StoredCompanion is the persisted companion soul (bones are regenerated).
func Load ¶
func Load() (*StoredCompanion, error)
Load reads the stored companion. Returns nil if none exists yet.