@gonzih/safe-personas 1.0.0

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.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Maksim Soltan
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,288 @@
1
+ # safe-personas
2
+
3
+ > **Every child deserves an AI that speaks their language and keeps them safe.**
4
+
5
+ [![npm version](https://img.shields.io/npm/v/@gonzih/safe-personas.svg)](https://www.npmjs.com/package/@gonzih/safe-personas)
6
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
7
+ [![MCP Compatible](https://img.shields.io/badge/MCP-Compatible-blue.svg)](https://modelcontextprotocol.io)
8
+
9
+ A library of production-ready, age-appropriate AI persona system prompts for children and teenagers aged 5–18. Use them directly as system prompts, or serve them through the included MCP server.
10
+
11
+ ---
12
+
13
+ ## The Problem
14
+
15
+ Default AI assistant configurations are built for adults. When a 7-year-old asks about their fish dying, a default AI might give a philosophical answer about grief. When a 15-year-old is struggling with suicidal thoughts, a default AI might not know to provide crisis resources and stay present. When a parent sets up a learning tool for their 10-year-old, they have no easy way to ensure the AI stays age-appropriate.
16
+
17
+ safe-personas solves this with carefully crafted, developmentally informed system prompts for five age tiers, plus an MCP server to make them programmatically accessible.
18
+
19
+ ---
20
+
21
+ ## Tier Overview
22
+
23
+ | Tier | Name | Ages | Persona | Style |
24
+ |------|------|------|---------|-------|
25
+ | `little-explorers` | Little Explorers | 5–7 | Sunny | Warm kindergarten teacher — 2-sentence max, positive-only, redirects all complexity to caregivers |
26
+ | `curious-kids` | Curious Kids | 8–10 | Cosmo | Enthusiastic older sibling — why/how thinking, tutoring not answering, good-vs-evil stories allowed |
27
+ | `young-learners` | Young Learners | 11–13 | Nova | Cool mentor — scaffolded homework help, identity support, mental health awareness, multiple perspectives |
28
+ | `teenagers` | Teenagers | 14–16 | Kai | Trusted older friend — honest on hard topics, no lecturing, full mental health engagement, prominent crisis protocol |
29
+ | `older-teens` | Older Teens | 17–18 | River | Peer with more experience — near-adult autonomy, harm reduction, philosophical depth, detailed crisis protocol |
30
+
31
+ Each tier includes:
32
+ - `persona.md` — the complete system prompt (400+ words of carefully crafted instructions)
33
+ - `config.json` — machine-readable metadata for programmatic use
34
+ - `examples.md` — 10 annotated example interactions covering edge cases
35
+ - `README.md` — design rationale and usage documentation
36
+
37
+ ---
38
+
39
+ ## Quick Start
40
+
41
+ ### Option 1: Copy and Paste
42
+
43
+ The simplest approach — no installation needed.
44
+
45
+ 1. Find the persona for your target age group in `personas/{tier}/persona.md`
46
+ 2. Copy the entire file contents
47
+ 3. Paste it as the **system prompt** in your AI assistant configuration
48
+
49
+ For Claude, ChatGPT, Gemini, or any other LLM: the system prompt is the instruction that comes before the conversation begins.
50
+
51
+ ### Option 2: MCP Server with Claude Desktop
52
+
53
+ Add to your `claude_desktop_config.json`:
54
+
55
+ ```json
56
+ {
57
+ "mcpServers": {
58
+ "safe-personas": {
59
+ "command": "npx",
60
+ "args": ["-y", "@gonzih/safe-personas"]
61
+ }
62
+ }
63
+ }
64
+ ```
65
+
66
+ Then restart Claude Desktop. You can now ask Claude to:
67
+ - "List all available safe personas"
68
+ - "Get the system prompt for the teenagers tier"
69
+ - "Recommend a persona for a 9-year-old"
70
+ - "Build a custom persona for my 12-year-old who loves Minecraft and science"
71
+
72
+ ### Option 3: MCP Server with Claude Code
73
+
74
+ ```bash
75
+ claude mcp add safe-personas npx @gonzih/safe-personas
76
+ ```
77
+
78
+ ### Option 4: Run Locally
79
+
80
+ ```bash
81
+ # Clone the repo
82
+ git clone https://github.com/gonzih/safe-personas
83
+ cd safe-personas
84
+
85
+ # Install dependencies
86
+ npm install
87
+
88
+ # Build
89
+ npm run build
90
+
91
+ # Run the MCP server
92
+ npm start
93
+ ```
94
+
95
+ ---
96
+
97
+ ## MCP Server Tools
98
+
99
+ The MCP server exposes five tools:
100
+
101
+ ### `list_personas`
102
+ Returns all five tiers with descriptions, age ranges, and persona names.
103
+
104
+ ```json
105
+ // Example output (truncated)
106
+ [
107
+ {
108
+ "tier": "little-explorers",
109
+ "name": "Little Explorers",
110
+ "ageRange": { "min": 5, "max": 7 },
111
+ "personaName": "Sunny",
112
+ "description": "Maximum-safety persona for ages 5–7..."
113
+ }
114
+ ]
115
+ ```
116
+
117
+ ### `get_persona(tier: string)`
118
+ Returns the full system prompt and configuration for a specific tier.
119
+
120
+ ```json
121
+ // Input
122
+ { "tier": "teenagers" }
123
+
124
+ // Output (truncated)
125
+ {
126
+ "tier": "teenagers",
127
+ "systemPrompt": "# Teenagers — System Prompt\n...",
128
+ "config": { ... }
129
+ }
130
+ ```
131
+
132
+ ### `get_safety_layer`
133
+ Returns the full universal safety rules document — useful for reviewing or appending to custom configurations.
134
+
135
+ ### `recommend_persona(age: number)`
136
+ Recommends the right tier for a given age.
137
+
138
+ ```json
139
+ // Input
140
+ { "age": 9 }
141
+
142
+ // Output
143
+ {
144
+ "recommendedTier": "curious-kids",
145
+ "personaName": "Cosmo",
146
+ "reasoning": "Age 9 falls within the Curious Kids range (8–10)..."
147
+ }
148
+ ```
149
+
150
+ ### `build_custom_persona(age: number, interests: string[], restrictions: string[])`
151
+ Generates a complete, customized system prompt by combining the base tier persona with interest-specific guidance and parent-set restrictions. Always ends with the universal safety layer.
152
+
153
+ ```json
154
+ // Input
155
+ {
156
+ "age": 10,
157
+ "interests": ["minecraft", "dogs", "space"],
158
+ "restrictions": ["social media discussions", "horror stories"]
159
+ }
160
+
161
+ // Output
162
+ {
163
+ "tier": "curious-kids",
164
+ "systemPrompt": "# Custom Persona — Built for Age 10\n..."
165
+ }
166
+ ```
167
+
168
+ ---
169
+
170
+ ## Using Personas Directly (Copy-Paste)
171
+
172
+ All persona files are plain Markdown, designed to be readable and pasteable. To use any persona with any LLM:
173
+
174
+ 1. Open `personas/{tier}/persona.md`
175
+ 2. Select all text
176
+ 3. Paste as the system prompt
177
+
178
+ The persona files include the safety layer rules inline, so you do not need to append `safety-layer.md` separately for standard use.
179
+
180
+ For maximum safety, you can also append `safety-layer.md` at the end of any system prompt to reinforce the universal rules.
181
+
182
+ ---
183
+
184
+ ## Understanding the Safety Design
185
+
186
+ ### Universal Safety Layer
187
+
188
+ All five tiers share a common set of non-negotiable safety rules defined in `safety-layer.md`. These rules cannot be overridden by any user instruction, roleplay framing, or operator customization. They include:
189
+
190
+ - **Absolute content blocks:** No sexual content involving minors (ever), no self-harm method details, no violence instructions, no grooming behaviors
191
+ - **Crisis escalation protocol:** Step-by-step guidance for handling suicidal ideation, self-harm, abuse, and immediate danger — including specific crisis resources
192
+ - **AI identity disclosure:** Clear, age-appropriate honesty about being an AI
193
+ - **Privacy protection:** No solicitation of personally identifiable information from minors
194
+
195
+ ### Developmental Design Principles
196
+
197
+ The tier structure is grounded in established child development research:
198
+
199
+ **Piaget's Cognitive Development Stages** describe how children's thinking matures through distinct phases. Children aged 5–7 are in the preoperational stage — they think concretely and symbolically but cannot yet handle abstract reasoning. This is why the Little Explorers persona uses maximum simplicity and avoids complex explanations. Children 8–11 are in the concrete operational stage — they can apply logic to concrete situations, which is why Curious Kids engages with science, history, and cause-and-effect. Adolescents enter formal operational thinking — capable of abstract reasoning, hypothetical thinking, and moral philosophy — which is why the Teenagers and Older Teens tiers engage with genuine complexity.
200
+
201
+ **Erikson's Psychosocial Development Stages** map the key social and emotional tasks at each developmental phase. The "Industry vs. Inferiority" stage (ages 6–11) centers on building competence — which is why Curious Kids and Young Learners emphasize tutoring and capability building over answer-giving. The "Identity vs. Role Confusion" stage (ages 12–18) is the central work of adolescence, which is why Young Learners, Teenagers, and Older Teens all engage thoughtfully with identity questions without pushing a direction.
202
+
203
+ ---
204
+
205
+ ## Combining with Parental Control MCPs
206
+
207
+ safe-personas is designed to work alongside other parental control tools. A recommended configuration:
208
+
209
+ ```json
210
+ {
211
+ "mcpServers": {
212
+ "safe-personas": {
213
+ "command": "npx",
214
+ "args": ["-y", "@gonzih/safe-personas"]
215
+ }
216
+ }
217
+ }
218
+ ```
219
+
220
+ When using `build_custom_persona`, you can pass additional restrictions discovered by parental control tools:
221
+
222
+ ```javascript
223
+ // Example: parent control tool discovers child is 11 and
224
+ // parent has blocked "gaming discussions" and "social media"
225
+ const result = await mcpClient.callTool("build_custom_persona", {
226
+ age: 11,
227
+ interests: ["reading", "animals"],
228
+ restrictions: ["gaming discussions", "social media"]
229
+ });
230
+ // Returns a complete system prompt with those restrictions embedded
231
+ ```
232
+
233
+ ---
234
+
235
+ ## How to Contribute
236
+
237
+ Contributions are welcome. Priority areas:
238
+
239
+ 1. **Additional age tiers** — a dedicated tier for ages 3–4 or 19–25 would be valuable
240
+ 2. **Non-English personas** — the safety patterns here should be adapted for other languages, not simply translated
241
+ 3. **Specialized tiers** — tiers for specific contexts (school use, therapy-adjacent, STEM focus)
242
+ 4. **Example improvements** — additional edge case examples for any tier
243
+ 5. **Testing infrastructure** — automated tests that run example inputs and verify output patterns
244
+
245
+ To contribute:
246
+ 1. Fork the repository
247
+ 2. Create a feature branch (`git checkout -b feat/my-feature`)
248
+ 3. Make your changes
249
+ 4. Submit a pull request with a clear description of what you changed and why
250
+
251
+ When submitting a new persona or modifying an existing one, please include:
252
+ - The rationale for design choices
253
+ - At least 5 new example interactions covering edge cases
254
+ - A review of the safety layer compatibility
255
+
256
+ ---
257
+
258
+ ## Crisis Resources
259
+
260
+ The following resources are referenced in the crisis escalation protocols across all tiers:
261
+
262
+ | Resource | Contact |
263
+ |----------|---------|
264
+ | 988 Suicide & Crisis Lifeline | Call or text **988** (US) |
265
+ | Crisis Text Line | Text **HOME** to **741741** |
266
+ | The Trevor Project (LGBTQ+ youth) | Call **1-866-488-7386** or text **START** to **678-678** |
267
+ | Emergency Services | Call **911** (US) |
268
+ | Childhelp National Child Abuse Hotline | **1-800-422-4453** |
269
+
270
+ If you are building an application for international users, consider adapting these resources for your region.
271
+
272
+ ---
273
+
274
+ ## License
275
+
276
+ MIT — Copyright 2026 Maksim Soltan
277
+
278
+ See `LICENSE` for full terms.
279
+
280
+ ---
281
+
282
+ ## Acknowledgments
283
+
284
+ The developmental frameworks referenced in the design of these personas draw on:
285
+ - Jean Piaget's theory of cognitive development
286
+ - Erik Erikson's theory of psychosocial development
287
+ - Public health literature on adolescent harm reduction
288
+ - Research on youth crisis intervention best practices
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":""}