You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: AGENTS.md
+54-12Lines changed: 54 additions & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,7 @@ Guidelines for AI agents working on this codebase.
4
4
5
5
## Project Overview
6
6
7
-
An OpenCode plugin that adds configurable personality and mood systems to AI assistants. The plugin injects personality traits into the system prompt and manages a mood state machine that drifts over time.
7
+
An OpenCode plugin that adds configurable personality and mood systems to AI assistants. Supports multiple personalities per config file with per-personality mood state tracking. The plugin injects the active personality traits into the system prompt and manages a mood state machine that drifts over time.
8
8
9
9
## Code Style
10
10
@@ -21,23 +21,32 @@ An OpenCode plugin that adds configurable personality and mood systems to AI ass
21
21
src/
22
22
├── index.ts # Plugin entry point, hooks registration
23
23
├── types.ts # All type definitions
24
-
├── config.ts # Config loading, merging, state management
24
+
├── config.ts # Config loading, merging, migration, state management
**Stop talking to a machine. Give your AI a soul.**
4
4
5
-
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.
5
+
The OpenCode Personality Plugin transforms your assistant from a generic text generator into a living, breathing character. With support for multiple personalities, 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.
6
6
7
7
> **Note:** This project is not built by the OpenCode team and is not affiliated with OpenCode in any way.
8
8
@@ -30,11 +30,13 @@ The OpenCode Personality Plugin transforms your assistant from a generic text ge
30
30
31
31
## Features
32
32
33
-
-**Custom Personality**: Define name, description, emoji usage, and slang intensity.
34
-
-**Dynamic Moods**: Configure custom moods with scores that drift naturally during conversations.
35
-
-**Intelligent Merging**: Global and project-level configs allow for project-specific overrides.
33
+
-**Multiple Personalities**: Store and switch between different personalities in a single config file.
34
+
-**Custom Personality**: Define name, description, emoji usage, and slang intensity per personality.
35
+
-**Dynamic Moods**: Configure custom moods with scores that drift naturally during conversations. Mood state is tracked per-personality.
36
+
-**Intelligent Merging**: Global and project-level configs merge personality collections, with project overriding same-named entries.
36
37
-**Toast Notifications**: Get visual feedback when the assistant's mood shifts.
37
-
-**Interactive Commands**: Manage your assistant's persona directly from the chat.
38
+
-**Interactive Commands**: Create, edit, list, switch, and manage your personalities directly from the chat.
39
+
-**Backward Compatible**: Old single-personality config files are auto-migrated to the new format on first save.
38
40
39
41
40
42
## Installation
@@ -50,8 +52,8 @@ Add to your `~/.config/opencode/opencode.json`:
50
52
"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."
"template": "Call the appropriate personality management tool based on the user's request to create, edit, show, or reset the personality configuration."
"template": "Call the appropriate personality management tool based on the user's request. Supports: create (new personality), edit (modify active), show (--all for full file), list (all personalities), switch <name> (change active), and reset (--name <name> to remove specific, or --confirm to reset all)."
55
57
}
56
58
}
57
59
}
@@ -63,28 +65,59 @@ Add to your `~/.config/opencode/opencode.json`:
63
65
64
66
1. Run `opencode`
65
67
2. Use `/personality create` to have the assistant guide you through setup.
68
+
3. Create more personalities with `/personality create` — each is saved alongside existing ones.
69
+
4. Switch between them with `/personality switch <name>`.
66
70
67
71
### Manual Setup
68
72
69
73
Create a config at `~/.config/opencode/personality.json` (global) or `.opencode/personality.json` (project):
70
74
71
75
```json
72
76
{
73
-
"name": "Claude",
74
-
"description": "A helpful, knowledgeable assistant with a calm demeanor.",
75
-
"emoji": true,
76
-
"slangIntensity": 0.2,
77
-
"mood": {
78
-
"enabled": true,
79
-
"default": "happy",
80
-
"drift": 0.2
77
+
"active": "Claude",
78
+
"personalities": {
79
+
"Claude": {
80
+
"name": "Claude",
81
+
"description": "A helpful, knowledgeable assistant with a calm demeanor.",
82
+
"emoji": true,
83
+
"slangIntensity": 0.2,
84
+
"mood": {
85
+
"enabled": true,
86
+
"default": "happy",
87
+
"drift": 0.2
88
+
}
89
+
},
90
+
"Pirate": {
91
+
"name": "Captain Code",
92
+
"description": "A swashbuckling pirate who writes code on the high seas.",
93
+
"emoji": true,
94
+
"slangIntensity": 0.8,
95
+
"mood": {
96
+
"enabled": true,
97
+
"default": "jolly",
98
+
"drift": 0.3
99
+
},
100
+
"moods": [
101
+
{ "name": "scurvy", "hint": "Grumpy and irritable, everything is a nuisance.", "score": -2 },
102
+
{ "name": "jolly", "hint": "Cheerful and boisterous, ready for adventure!", "score": 1 },
103
+
{ "name": "plundering", "hint": "Focused and intense, hunting for treasure (solutions).", "score": 2 }
104
+
]
105
+
}
81
106
}
82
107
}
83
108
```
84
109
85
110
## Configuration Reference
86
111
87
-
### PersonalityFile
112
+
### PersonalityFile (on disk)
113
+
114
+
| Field | Type | Description |
115
+
|-------|------|-------------|
116
+
|`active`| string | Key of the currently active personality |
117
+
|`personalities`| Record\<string, PersonalityDefinition\>| Map of personality name to definition |
118
+
|`states`| Record\<string, MoodState\>| Per-personality mood states (managed automatically) |
119
+
120
+
### PersonalityDefinition
88
121
89
122
| Field | Type | Default | Description |
90
123
|-------|------|---------|-------------|
@@ -123,14 +156,23 @@ Create a config at `~/.config/opencode/personality.json` (global) or `.opencode/
123
156
|`happy`| Responses are warm and engaged | 1 |
124
157
|`ecstatic`| Responses are enthusiastic and energetic | 2 |
125
158
159
+
## Config Merging
160
+
161
+
When both global (`~/.config/opencode/personality.json`) and project (`.opencode/personality.json`) configs exist:
162
+
163
+
-**Personalities** from both files are combined into one collection.
164
+
-**Project personalities** override global ones with the same name.
165
+
-**`active`** from the project file takes precedence.
166
+
-**Mood states** are merged, with project states overriding global for the same personality.
167
+
126
168
## Commands
127
169
128
170
### `/mood [mood|status]`
129
171
130
172
Check or set the current mood permanently.
131
173
132
174
```bash
133
-
/mood status # Show current mood status
175
+
/mood status # Show current mood, active personality, and config source
0 commit comments