Skip to content

joostvanwollingen/opencode-personality

Repository files navigation

OpenCode Personality Plugin

Stop talking to a machine. Give your AI a soul.

The OpenCode Personality Plugin transforms your assistant from a generic text generator into a living, breathing character. With a sophisticated mood state machine and deep configuration options, your AI doesn't just follow instructions—it responds with attitude, emotion, and a personality that evolves over time.

Note: This project is not built by the OpenCode team and is not affiliated with OpenCode in any way.

GitHub Actions Workflow Status NPM Downloads GitHub Release

Example

Personality configuration
Personality configuration

Example response with personality
Example response with personality applied

Features

  • Custom Personality: Define name, description, emoji usage, and slang intensity.
  • Dynamic Moods: Configure custom moods with scores that drift naturally during conversations.
  • Intelligent Merging: Global and project-level configs allow for project-specific overrides.
  • Toast Notifications: Get visual feedback when the assistant's mood shifts.
  • Interactive Commands: Manage your assistant's persona directly from the chat.

Installation

Add to your ~/.config/opencode/opencode.json:

{
  "plugin": ["opencode-personality"],
  "command": {
    "mood": {
      "description": "Set the assistant's mood [mood: bored, angry, lethargic] [duration: message, session, permanent]",
      "template": "Call the setMood tool to set the mood to the mood and duration requested by the user. If the duration is not mentioned assume session."
    },
    "personality": {
      "description": "Manage personality config: create/edit/show/reset",
      "template": "Call the appropriate personality management tool based on the user's request to create, edit, show, or reset the personality configuration."
    }
  }
}

Note: Commands must be defined in your config file as OpenCode's plugin API doesn't yet support programmatic registration.

Quick Start

  1. Run opencode
  2. Use /personality create to have the assistant guide you through setup.

Manual Setup

Create a config at ~/.config/opencode/personality.json (global) or .opencode/personality.json (project):

{
  "name": "Claude",
  "description": "A helpful, knowledgeable assistant with a calm demeanor.",
  "emoji": true,
  "slangIntensity": 0.2,
  "mood": {
    "enabled": true,
    "default": "happy",
    "drift": 0.2
  }
}

Configuration Reference

PersonalityFile

Field Type Default Description
name string "" Name the assistant uses when asked
description string "" Personality description injected into prompts
emoji boolean false Whether to use emojis in responses
slangIntensity number 0 Slang usage intensity (0-1)
moods MoodDefinition[] (defaults) Custom mood definitions
mood MoodConfig (see below) Mood system configuration

MoodConfig

Field Type Default Description
enabled boolean false Enable mood drift system
default string "happy" Default mood when no override is active
drift number 0.2 How much the mood can shift per tick (0-1)
toast boolean true Show toast notifications when mood changes
seed number (random) Optional seed for deterministic drift (testing)

MoodDefinition

Field Type Description
name string Unique mood identifier
hint string Prompt hint describing how mood affects responses
score number Numeric score for drift calculations

Default Moods

Name Hint Score
bored Responses feel slightly disinterested -2
angry Responses have an edge to them -1
disappointed Responses feel a bit deflated 0
happy Responses are warm and engaged 1
ecstatic Responses are enthusiastic and energetic 2

Commands

/mood [mood|status]

Check or set the current mood permanently.

/mood status    # Show current mood status
/mood happy     # Set mood to "happy" permanently

/personality <subcommand>

Manage personality configuration.

Subcommand Description
show Display the merged configuration
create Interactive setup (use --scope global for global)
edit Interactive edit or direct update with --field and --value
reset Delete the config file (requires --confirm)

Examples:

/personality show
/personality create --scope global
/personality edit --field emoji --value true
/personality reset --scope project --confirm

Tools

setMood

Override the current mood with optional duration.

Parameter Type Required Description
mood string Yes Name of the mood to set
duration string No "message", "session" (default), or "permanent"

Custom Moods Example

{
  "name": "Surfer Dude",
  "description": "A laid-back California surfer who sees life as one big wave.",
  "emoji": true,
  "slangIntensity": 0.8,
  "moods": [
    { "name": "gnarly", "hint": "Things are rough, bro. Keep it chill but acknowledge the struggle.", "score": -2 },
    { "name": "mellow", "hint": "Just vibing. Relaxed and easy-going responses.", "score": 0 },
    { "name": "stoked", "hint": "Hyped up! Enthusiastic and excited about everything.", "score": 2 },
    { "name": "epic", "hint": "This is LEGENDARY! Maximum excitement and positive energy!", "score": 3 }
  ],
  "mood": {
    "enabled": true,
    "default": "mellow",
    "drift": 0.3
  }
}

Tip: Checkout the examples folder for more prebuilt personalities.

License

MIT

About

A configurable personality and mood system plugin for OpenCode

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published