writers_room 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,200 @@
1
+ # Writer's Room - Quick Reference Card
2
+
3
+ ## πŸš€ Quick Start (3 Commands)
4
+
5
+ ```bash
6
+ ollama serve # 1. Start Ollama
7
+ ollama pull gpt-oss # 2. Get model
8
+ ./run_scene_example.sh # 3. Run scene
9
+ ```
10
+
11
+ ## πŸ“‹ Default Configuration
12
+
13
+ | Setting | Value |
14
+ |---------|-------|
15
+ | Provider | Ollama |
16
+ | Model | gpt-oss |
17
+ | URL | http://localhost:11434 |
18
+ | Timeout | 120 seconds |
19
+
20
+ ## πŸ”§ Common Commands
21
+
22
+ ### Run Scenes
23
+ ```bash
24
+ ./run_scene_example.sh # Interactive chooser
25
+ ./director.rb -s scenes/scene_01_gym_wars.yml # Scene 1
26
+ ./director.rb -s scenes/scene_02_statistical_anomaly.yml # Scene 2
27
+ ./director.rb -s scenes/scene_04_equipment_room.yml # Scene 4
28
+ ./director.rb -s scenes/scene_08_data_dump.yml # Scene 8
29
+ ```
30
+
31
+ ### Control Scene Length
32
+ ```bash
33
+ ./director.rb -s scenes/scene_01_gym_wars.yml -l 20 # Short (20 lines)
34
+ ./director.rb -s scenes/scene_01_gym_wars.yml -l 50 # Medium (50 lines)
35
+ ./director.rb -s scenes/scene_01_gym_wars.yml -l 100 # Long (100 lines)
36
+ ```
37
+
38
+ ### Debug Mode
39
+ ```bash
40
+ DEBUG_ME=1 ./director.rb -s scenes/scene_01_gym_wars.yml
41
+ ```
42
+
43
+ ## πŸ”„ Switch Models
44
+
45
+ ### Different Ollama Model
46
+ ```bash
47
+ export RUBY_LLM_MODEL="llama2"
48
+ ./director.rb -s scenes/scene_01_gym_wars.yml
49
+ ```
50
+
51
+ ### OpenAI
52
+ ```bash
53
+ export RUBY_LLM_PROVIDER="openai"
54
+ export RUBY_LLM_MODEL="gpt-4"
55
+ export OPENAI_API_KEY="sk-..."
56
+ ./director.rb -s scenes/scene_01_gym_wars.yml
57
+ ```
58
+
59
+ ### Anthropic Claude
60
+ ```bash
61
+ export RUBY_LLM_PROVIDER="anthropic"
62
+ export RUBY_LLM_MODEL="claude-3-5-sonnet-20241022"
63
+ export ANTHROPIC_API_KEY="sk-ant-..."
64
+ ./director.rb -s scenes/scene_01_gym_wars.yml
65
+ ```
66
+
67
+ ## πŸ§ͺ Test & Verify
68
+
69
+ ```bash
70
+ redis-cli ping # Check Redis
71
+ curl http://localhost:11434 # Check Ollama
72
+ ollama list | grep gpt-oss # Check model
73
+ ```
74
+
75
+ ## πŸ“ Project Structure
76
+
77
+ ```
78
+ actor.rb - AI actor process
79
+ director.rb - Scene orchestrator
80
+ characters/ - 6 character definitions
81
+ scenes/ - 4 scene definitions
82
+ messages/ - SmartMessage types
83
+ logs/ - Actor output logs
84
+ ```
85
+
86
+ ## 🎭 Available Characters
87
+
88
+ 1. **Marcus** - Math whiz, speaks in statistics
89
+ 2. **Jamie** - Robotics president, logical thinker
90
+ 3. **Tyler** - Soccer captain, secretly sensitive
91
+ 4. **Alex** - Basketball captain, intense competitor
92
+ 5. **Benny** - Class clown hiding insecurity
93
+ 6. **Zoe** - Theater kid quoting movies
94
+
95
+ ## 🎬 Available Scenes
96
+
97
+ | # | Name | Characters | Week | Type |
98
+ |---|------|------------|------|------|
99
+ | 1 | The Gym Wars | All 6 | 1 | First meeting |
100
+ | 2 | Statistical Anomaly | M, J, B | 2 | Library |
101
+ | 4 | Equipment Room | B, Z | 6 | Breakthrough |
102
+ | 8 | The Data Dump | All 6 | 16 | Finale |
103
+
104
+ *M=Marcus, J=Jamie, B=Benny, Z=Zoe*
105
+
106
+ ## βš™οΈ Environment Variables
107
+
108
+ ```bash
109
+ RUBY_LLM_PROVIDER=ollama # Provider (ollama/openai/anthropic)
110
+ RUBY_LLM_MODEL=gpt-oss # Model name
111
+ OLLAMA_URL=http://localhost:11434 # Ollama server
112
+ OPENAI_API_KEY=sk-... # OpenAI key (if used)
113
+ ANTHROPIC_API_KEY=sk-ant-... # Anthropic key (if used)
114
+ DEBUG_ME=1 # Debug mode
115
+ ```
116
+
117
+ ## πŸ“Š Output Files
118
+
119
+ ```bash
120
+ logs/marcus_[timestamp].log # Actor stdout
121
+ logs/marcus_[timestamp]_err.log # Actor stderr
122
+ transcript_scene_1_[timestamp].txt # Scene transcript
123
+ ```
124
+
125
+ ## πŸ› οΈ Troubleshooting
126
+
127
+ ### Redis not running
128
+ ```bash
129
+ brew services start redis
130
+ # OR
131
+ redis-server
132
+ ```
133
+
134
+ ### Ollama not running
135
+ ```bash
136
+ ollama serve
137
+ ```
138
+
139
+ ### Model not found
140
+ ```bash
141
+ ollama pull gpt-oss
142
+ ```
143
+
144
+ ### View actor logs
145
+ ```bash
146
+ tail -f logs/*.log
147
+ ```
148
+
149
+ ### Clear Redis
150
+ ```bash
151
+ redis-cli FLUSHALL
152
+ ```
153
+
154
+ ## πŸ“š Documentation
155
+
156
+ - `README.md` - Full documentation
157
+ - `QUICKSTART.md` - Getting started guide
158
+ - `CONFIGURATION.md` - Configuration details
159
+ - `CHANGELOG.md` - Recent changes
160
+
161
+ ## πŸ’‘ Tips
162
+
163
+ - Start with Scene 2 (only 3 characters, easier to follow)
164
+ - Use `-l 20` for quick tests
165
+ - Enable `DEBUG_ME=1` if actors aren't responding
166
+ - Check `logs/` directory if something goes wrong
167
+ - Press Ctrl+C to stop and save transcript
168
+
169
+ ## 🎯 Typical Workflow
170
+
171
+ ```bash
172
+ # Terminal 1: Services
173
+ redis-server
174
+ ollama serve
175
+
176
+ # Terminal 2: Run scene
177
+ cd writers_room
178
+ ./run_scene_example.sh
179
+
180
+ # Choose scene, watch magic happen!
181
+ # Press Ctrl+C when done
182
+ # Check transcript_*.txt for output
183
+ ```
184
+
185
+ ## πŸ”₯ One-Liner Examples
186
+
187
+ ```bash
188
+ # Quick test with llama2
189
+ RUBY_LLM_MODEL=llama2 ./director.rb -s scenes/scene_02_statistical_anomaly.yml -l 15
190
+
191
+ # Debug mode with custom output
192
+ DEBUG_ME=1 ./director.rb -s scenes/scene_01_gym_wars.yml -o test_run.txt
193
+
194
+ # Long scene with GPT-4
195
+ RUBY_LLM_PROVIDER=openai RUBY_LLM_MODEL=gpt-4 OPENAI_API_KEY=$OPENAI_API_KEY ./director.rb -s scenes/scene_08_data_dump.yml -l 100
196
+ ```
197
+
198
+ ---
199
+
200
+ **Need more help?** Check `README.md` or `CONFIGURATION.md`
@@ -0,0 +1,264 @@
1
+ # Writer's Room - Quick Start Guide
2
+
3
+ ## What You Have
4
+
5
+ A complete AI-powered multi-character dialog system with:
6
+
7
+ ### βœ… Core System
8
+ - `actor.rb` - Independent AI actor process (executable)
9
+ - `director.rb` - Orchestration and transcript management (executable)
10
+ - `run_scene_example.sh` - Easy scene launcher (executable)
11
+
12
+ ### βœ… Characters (6 fully defined)
13
+ - Marcus "Stats" Chen - The analytical math whiz
14
+ - Jamie Patel - The logical robotics president
15
+ - Tyler Rodriguez - The sensitive soccer captain
16
+ - Alex Washington - The intense basketball captain
17
+ - Benny Morrison - The insecure class clown
18
+ - Zoe Kim - The theatrical drama kid
19
+
20
+ ### βœ… Scenes (4 ready to run)
21
+ 1. **The Gym Wars** - All 6 characters meet (Week 1)
22
+ 2. **Statistical Anomaly** - Marcus, Jamie, Benny in library (Week 2)
23
+ 3. **Equipment Room Incident** - Benny & Zoe breakthrough (Week 6)
24
+ 4. **The Data Dump** - All 6, finale scene (Week 16)
25
+
26
+ ### βœ… Infrastructure
27
+ - SmartMessage classes for Redis communication
28
+ - Character YAML templates
29
+ - Scene YAML templates
30
+ - Comprehensive documentation
31
+
32
+ ## Getting Started in 3 Steps
33
+
34
+ ### Step 1: Install Dependencies
35
+
36
+ ```bash
37
+ # Install required gems
38
+ gem install debug_me ruby_llm smart_message redis
39
+
40
+ # Start Redis (choose one)
41
+ brew services start redis
42
+ # OR
43
+ redis-server
44
+ ```
45
+
46
+ ### Step 2: Start Ollama (Default LLM Provider)
47
+
48
+ The system uses **Ollama with gpt-oss model** by default:
49
+
50
+ ```bash
51
+ # Start Ollama server
52
+ ollama serve
53
+
54
+ # Pull the gpt-oss model (if not already installed)
55
+ ollama pull gpt-oss
56
+ ```
57
+
58
+ **Optional: Use different provider**
59
+ ```bash
60
+ # Use different Ollama model
61
+ export RUBY_LLM_MODEL="llama2"
62
+
63
+ # Or switch to OpenAI/Anthropic
64
+ export RUBY_LLM_PROVIDER="openai"
65
+ export OPENAI_API_KEY="your-key-here"
66
+ ```
67
+
68
+ ### Step 3: Run a Scene
69
+
70
+ **Option A: Use the quick-start script (recommended)**
71
+ ```bash
72
+ ./run_scene_example.sh
73
+ ```
74
+
75
+ **Option B: Run director directly**
76
+ ```bash
77
+ ./director.rb -s scenes/scene_01_gym_wars.yml
78
+ ```
79
+
80
+ That's it! Watch the AI characters converse in real-time.
81
+
82
+ ## What Happens When You Run
83
+
84
+ 1. Director loads scene and character definitions
85
+ 2. Spawns independent actor processes for each character
86
+ 3. Actors connect to Redis and subscribe to dialog channel
87
+ 4. Characters begin conversing based on:
88
+ - Their personality and voice patterns
89
+ - Scene objectives
90
+ - Conversation context
91
+ - Relationship dynamics
92
+ 5. Director monitors and displays dialog
93
+ 6. When complete, saves transcript with statistics
94
+
95
+ ## Example Output
96
+
97
+ ```
98
+ ============================================================
99
+ SCENE 1: The Gym Wars
100
+ Location: Riverside High gymnasium
101
+ Characters: Marcus, Jamie, Tyler, Alex, Benny, Zoe
102
+ ============================================================
103
+
104
+ [SCENE BEGINS]
105
+
106
+ Tyler: We're here until 6:30.
107
+ Alex: So are we. Guess we're roommates.
108
+ Marcus: According to the scheduling system, there's been a double-booking error. The probability of this happening is approximately 2.3%.
109
+ Jamie: Let me see that code. Oh, I found the bug! Your conditional logic is inverted.
110
+ Benny: Or we could just arm wrestle for it. I volunteer as tribute.
111
+ Zoe: As West Side Story taught us, when two rival gangs meet, only musical theatre can save us!
112
+ Tyler [laughing]: Okay, okay. How about we share the gym? Half court each?
113
+ Alex: Fair enough. But we make it interesting.
114
+
115
+ [continues...]
116
+ ```
117
+
118
+ ## File Structure Created
119
+
120
+ ```
121
+ writers_room/
122
+ β”œβ”€β”€ actor.rb # βœ… Core actor AI
123
+ β”œβ”€β”€ director.rb # βœ… Scene orchestrator
124
+ β”œβ”€β”€ run_scene_example.sh # βœ… Quick launcher
125
+ β”œβ”€β”€ README.md # βœ… Full documentation
126
+ β”œβ”€β”€ QUICKSTART.md # βœ… This file
127
+ β”œβ”€β”€ .gitignore # βœ… Git ignore rules
128
+ β”‚
129
+ β”œβ”€β”€ characters/ # βœ… 6 characters defined
130
+ β”‚ β”œβ”€β”€ marcus.yml
131
+ β”‚ β”œβ”€β”€ jamie.yml
132
+ β”‚ β”œβ”€β”€ tyler.yml
133
+ β”‚ β”œβ”€β”€ alex.yml
134
+ β”‚ β”œβ”€β”€ benny.yml
135
+ β”‚ └── zoe.yml
136
+ β”‚
137
+ β”œβ”€β”€ scenes/ # βœ… 4 scenes ready
138
+ β”‚ β”œβ”€β”€ scene_01_gym_wars.yml
139
+ β”‚ β”œβ”€β”€ scene_02_statistical_anomaly.yml
140
+ β”‚ β”œβ”€β”€ scene_04_equipment_room.yml
141
+ β”‚ └── scene_08_data_dump.yml
142
+ β”‚
143
+ └── messages/ # βœ… SmartMessage types
144
+ β”œβ”€β”€ dialog_message.rb
145
+ β”œβ”€β”€ scene_control_message.rb
146
+ β”œβ”€β”€ stage_direction_message.rb
147
+ └── meta_message.rb
148
+ ```
149
+
150
+ ## Tips for First Run
151
+
152
+ 1. **Start small**: Try Scene 2 first (only 3 characters)
153
+ 2. **Limit lines**: Use `-l 20` flag to keep it short initially
154
+ 3. **Watch the logs**: Check `logs/` directory if actors misbehave
155
+ 4. **Monitor Redis**: Run `redis-cli monitor` in another terminal
156
+ 5. **Interrupt anytime**: Ctrl+C saves transcript and stops gracefully
157
+
158
+ ## Common Commands
159
+
160
+ **Run specific scene:**
161
+ ```bash
162
+ ./director.rb -s scenes/scene_04_equipment_room.yml
163
+ ```
164
+
165
+ **Limit to 20 lines:**
166
+ ```bash
167
+ ./director.rb -s scenes/scene_01_gym_wars.yml -l 20
168
+ ```
169
+
170
+ **Custom transcript name:**
171
+ ```bash
172
+ ./director.rb -s scenes/scene_02_statistical_anomaly.yml -o my_test.txt
173
+ ```
174
+
175
+ **Run single actor manually (testing):**
176
+ ```bash
177
+ ./actor.rb -c characters/marcus.yml -s scenes/scene_01_gym_wars.yml
178
+ ```
179
+
180
+ **Enable debug output:**
181
+ ```bash
182
+ DEBUG_ME=1 ./director.rb -s scenes/scene_01_gym_wars.yml
183
+ ```
184
+
185
+ ## Next Steps
186
+
187
+ Once you've run a scene successfully:
188
+
189
+ 1. **Experiment with scenes** - Try all 4 included scenes
190
+ 2. **Adjust line limits** - See how longer conversations develop
191
+ 3. **Create new characters** - Use existing YAMLs as templates
192
+ 4. **Design new scenes** - Build your own scene configurations
193
+ 5. **Customize prompts** - Edit `actor.rb` to tune dialog generation
194
+ 6. **Try different LLMs** - Compare results across models
195
+
196
+ ## Understanding the Architecture
197
+
198
+ ```
199
+ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
200
+ β”‚ DIRECTOR PROCESS β”‚
201
+ β”‚ β€’ Spawns actors β”‚
202
+ β”‚ β€’ Monitors Redis dialog channel β”‚
203
+ β”‚ β€’ Records transcript β”‚
204
+ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
205
+ β”‚
206
+ β”Œβ”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”
207
+ β”‚ β”‚
208
+ Redis Pub/Sub Redis Pub/Sub
209
+ β”‚ β”‚
210
+ β”Œβ”€β”€β”€β”΄β”€β”€β”€β” β”Œβ”€β”€β”€β”΄β”€β”€β”€β”
211
+ β”‚MARCUS │←─────→│ JAMIE β”‚
212
+ β”‚Actor β”‚ β”‚ Actor β”‚
213
+ β””β”€β”€β”€β”¬β”€β”€β”€β”˜ β””β”€β”€β”€β”¬β”€β”€β”€β”˜
214
+ β”‚ β”‚
215
+ RubyLLM RubyLLM
216
+ β”‚ β”‚
217
+ LLM API LLM API
218
+ ```
219
+
220
+ Each actor:
221
+ 1. Receives character profile and scene info
222
+ 2. Subscribes to Redis dialog channel
223
+ 3. Generates dialog using LLM based on:
224
+ - Character personality and voice
225
+ - Scene objectives
226
+ - Recent conversation history
227
+ - Relationship context
228
+ 4. Decides when to speak (turn-taking logic)
229
+ 5. Publishes dialog to Redis
230
+ 6. Other actors receive and react
231
+
232
+ ## Troubleshooting
233
+
234
+ **"Redis connection refused"**
235
+ ```bash
236
+ # Start Redis first
237
+ brew services start redis
238
+ # OR
239
+ redis-server
240
+ ```
241
+
242
+ **"No output from actors"**
243
+ - Check LLM API key is set
244
+ - View actor logs in `logs/` directory
245
+ - Try `DEBUG_ME=1` for verbose output
246
+
247
+ **"Actors talking over each other"**
248
+ - This is normal! Adjust `should_respond?` logic in `actor.rb`
249
+ - Lower the random interjection probability
250
+
251
+ **"Scene runs forever"**
252
+ - Set `-l` flag to limit lines
253
+ - Press Ctrl+C to stop and save transcript
254
+
255
+ ## Support
256
+
257
+ - Full documentation: `README.md`
258
+ - Character reference: `characters/*.yml`
259
+ - Scene reference: `scenes/*.yml`
260
+ - Source code: `actor.rb`, `director.rb`
261
+
262
+ ## Have Fun! 🎭
263
+
264
+ You now have a complete AI theater company ready to perform. Experiment, iterate, and enjoy watching your characters come to life!