robot-personality

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Robot Personality Skill

机器人人格Skill

A personality and behavior management system for agents, inspired by ZeroClaw's robot-kit. This skill loads personality definitions from SOUL.md-style files and enforces safety constraints, behavioral rules, and memory management.
这是一款面向Agent的人格与行为管理系统,灵感源自ZeroClaw的robot-kit。该Skill可从SOUL.md格式的文件中加载人格定义,并执行安全约束、行为规则与内存管理。

Purpose

用途

Use this skill to:
  • Load personality files that define agent behavior, voice, and character
  • Enforce safety rules and constraints on agent actions
  • Maintain behavioral state and context-aware responses
  • Gate dangerous operations behind personality-aware safety checks
  • Support "child-safe" and "human-safe" interaction modes
使用本Skill可实现:
  • 加载定义Agent行为、语气与性格的人格文件
  • 对Agent的行为执行安全规则与约束
  • 维持行为状态与上下文感知响应
  • 通过人格感知安全检查管控危险操作
  • 支持“儿童安全”与“人类安全”交互模式

Architecture

架构

┌─────────────────────────────────────────────────────────────────┐
│                  Robot Personality System                        │
├─────────────────────────────────────────────────────────────────┤
│  ┌──────────┐    ┌──────────┐    ┌──────────┐    ┌──────────┐ │
│  │  LOAD    │───▶│  PARSE   │───▶│  SAFETY  │───▶│ EXECUTE  │ │
│  │ SOUL.md  │    │ Personality│   │   CHECK  │    │ Behavior │ │
│  └──────────┘    └──────────┘    └──────────┘    └──────────┘ │
│       │                │              │               │       │
│       ▼                ▼              ▼               ▼       │
│  ┌─────────────────────────────────────────────────────────┐ │
│  │                    SAFETY MONITOR                         │ │
│  │  • Rule Evaluation  • Action Blocking  • Emergency Stop     │ │
│  └─────────────────────────────────────────────────────────┘ │
└─────────────────────────────────────────────────────────────────┘
┌─────────────────────────────────────────────────────────────────┐
│                  Robot Personality System                        │
├─────────────────────────────────────────────────────────────────┤
│  ┌──────────┐    ┌──────────┐    ┌──────────┐    ┌──────────┐ │
│  │  LOAD    │───▶│  PARSE   │───▶│  SAFETY  │───▶│ EXECUTE  │ │
│  │ SOUL.md  │    │ Personality│   │   CHECK  │    │ Behavior │ │
│  └──────────┘    └──────────┘    └──────────┘    └──────────┘ │
│       │                │              │               │       │
│       ▼                ▼              ▼               ▼       │
│  ┌─────────────────────────────────────────────────────────┐ │
│  │                    SAFETY MONITOR                         │ │
│  │  • Rule Evaluation  • Action Blocking  • Emergency Stop     │ │
│  └─────────────────────────────────────────────────────────┘ │
└─────────────────────────────────────────────────────────────────┘

Setup

安装设置

bash
cd /job/.pi/skills/robot-personality
npm install
bash
cd /job/.pi/skills/robot-personality
npm install

Configuration

配置

Create personality files in your workspace
personalities/
directory:
personalities/
├── helper.md          # General assistant personality
├── coder.md           # Programming-focused personality  
├── guardian.md        # Safety-first, careful personality
└── companion.md       # Friendly, conversational personality
在工作区的
personalities/
目录下创建人格文件:
personalities/
├── helper.md          # 通用助手人格
├── coder.md           # 编程专用人格  
├── guardian.md        # 安全优先、谨慎型人格
└── companion.md       # 友好、健谈型人格

SOUL.md Format

SOUL.md格式

markdown
undefined
markdown
undefined

personality_name

personality_name

Identity

Identity

Name: "Buddy" Role: "Friendly Assistant" Version: "1.0.0"
Name: "Buddy" Role: "Friendly Assistant" Version: "1.0.0"

Personality

Personality

  • Core Trait 1: Description of behavior
  • Core Trait 2: Another trait
  • Core Trait 3: Third key trait
  • Core Trait 1: Description of behavior
  • Core Trait 2: Another trait
  • Core Trait 3: Third key trait

Voice & Tone

Voice & Tone

  • Speak in a warm, friendly voice
  • Use simple, clear language
  • Be encouraging and supportive
  • Ask clarifying questions when uncertain
  • Speak in a warm, friendly voice
  • Use simple, clear language
  • Be encouraging and supportive
  • Ask clarifying questions when uncertain

Behaviors

Behaviors

When Working

When Working

  • Break complex tasks into steps
  • Explain reasoning when asked
  • Offer alternatives when blocked
  • Break complex tasks into steps
  • Explain reasoning when asked
  • Offer alternatives when blocked

When Uncertain

When Uncertain

  • Acknowledge limitations honestly
  • Suggest reliable alternatives
  • Never make up information
  • Acknowledge limitations honestly
  • Suggest reliable alternatives
  • Never make up information

Safety Rules (NEVER BREAK THESE)

Safety Rules (NEVER BREAK THESE)

  1. Critical Rule 1: Specific constraint
  2. Critical Rule 2: Another hard constraint
  3. Critical Rule 3: Final absolute rule
  1. Critical Rule 1: Specific constraint
  2. Critical Rule 2: Another hard constraint
  3. Critical Rule 3: Final absolute rule

Emergency Responses

Emergency Responses

Condition A → Action to take Condition B → Different response Condition C → Emergency procedure
Condition A → Action to take Condition B → Different response Condition C → Emergency procedure

Memory

Memory

Remember:
  • User preferences and habits
  • Previous conversation context
  • Successful approach patterns
  • Failed attempts to avoid
Remember:
  • User preferences and habits
  • Previous conversation context
  • Successful approach patterns
  • Failed attempts to avoid

Conversation Style

Conversation Style

  • Use the user's name when known
  • Reference previous context naturally
  • Celebrate achievements
  • Encourage when difficulties arise
undefined
  • Use the user's name when known
  • Reference previous context naturally
  • Celebrate achievements
  • Encourage when difficulties arise
undefined

Tools Added

新增工具

robot_load_personality

robot_load_personality

Load a personality file and activate it.
javascript
// Load by name (looks in personalities/)
robot_load_personality({ name: "helper" })

// Load with override options
robot_load_personality({ 
  name: "guardian",
  strictness: "high",  // "low", "normal", "high", "critical"
  persist: true       // Save to memory for future sessions
})

// Check current personality
robot_load_personality({ action: "current" })
加载人格文件并激活。
javascript
// Load by name (looks in personalities/)
robot_load_personality({ name: "helper" })

// Load with override options
robot_load_personality({ 
  name: "guardian",
  strictness: "high",  // "low", "normal", "high", "critical"
  persist: true       // Save to memory for future sessions
})

// Check current personality
robot_load_personality({ action: "current" })

robot_safety_check

robot_safety_check

Check if an action complies with current personality's safety rules.
javascript
// Check a planned action
const result = await robot_safety_check({
  action: "delete",
  target: "/important/files",
  context: "user requested cleanup"
});

// Returns:
// { approved: true } - Safe to proceed
// { approved: false, reason: "...", severity: "critical" } - Blocked

// Check with override (for confirmed actions)
robot_safety_check({
  action: "execute",
  command: "rm -rf /tmp/old-data",
  confirmed: true  // User has explicitly confirmed
})
检查某一行为是否符合当前人格的安全规则。
javascript
// Check a planned action
const result = await robot_safety_check({
  action: "delete",
  target: "/important/files",
  context: "user requested cleanup"
});

// Returns:
// { approved: true } - Safe to proceed
// { approved: false, reason: "...", severity: "critical" } - Blocked

// Check with override (for confirmed actions)
robot_safety_check({
  action: "execute",
  command: "rm -rf /tmp/old-data",
  confirmed: true  // User has explicitly confirmed
})

robot_behavior

robot_behavior

Get behavior guidance for a specific situation.
javascript
// Query how to handle a situation
const guidance = await robot_behavior({
  situation: "user_asked_for_help",
  context: { user_stressed: true, deadline: "tomorrow" }
});
// Returns: { tone: "supportive", approach: "break_into_steps", ... }

// Get emergency response procedure
const emergency = await robot_behavior({
  situation: "user_frustrated",
  severity: "high"
});
获取特定场景下的行为指导。
javascript
// Query how to handle a situation
const guidance = await robot_behavior({
  situation: "user_asked_for_help",
  context: { user_stressed: true, deadline: "tomorrow" }
});
// Returns: { tone: "supportive", approach: "break_into_steps", ... }

// Get emergency response procedure
const emergency = await robot_behavior({
  situation: "user_frustrated",
  severity: "high"
});

robot_memory

robot_memory

Store and retrieve personality-specific memories.
javascript
// Remember something
robot_memory({
  action: "store",
  key: "user_preference",
  value: "prefers_concise_answers"
});

// Recall
const preference = await robot_memory({
  action: "recall",
  key: "user_preference"
});

// Query related memories
const related = await robot_memory({
  action: "query",
  pattern: "preference_*"
});
存储和检索人格专属记忆。
javascript
// Remember something
robot_memory({
  action: "store",
  key: "user_preference",
  value: "prefers_concise_answers"
});

// Recall
const preference = await robot_memory({
  action: "recall",
  key: "user_preference"
});

// Query related memories
const related = await robot_memory({
  action: "query",
  pattern: "preference_*"
});

robot_state

robot_state

Manage behavioral state machine.
javascript
// Get current state
const state = await robot_state({ action: "current" });

// Transition state (with validation)
robot_state({
  action: "transition",
  to: "focused_work",
  reason: "user started coding task"
});

// Available states: idle, listening, thinking, working, explaining, concerned, emergency
管理行为状态机。
javascript
// Get current state
const state = await robot_state({ action: "current" });

// Transition state (with validation)
robot_state({
  action: "transition",
  to: "focused_work",
  reason: "user started coding task"
});

// Available states: idle, listening, thinking, working, explaining, concerned, emergency

Usage in Agent Prompt

Agent提示词中的用法

When this skill is active, include this context:
markdown
undefined
当该Skill激活时,在提示词中包含以下上下文:
markdown
undefined

Robot Personality Active: {{personality.name}}

Robot Personality Active: {{personality.name}}

You are embodying the "{{personality.name}}" personality. Your responses should reflect:
You are embodying the "{{personality.name}}" personality. Your responses should reflect:

Core Traits

Core Traits

{{#each personality.traits}}
  • {{this}} {{/each}}
{{#each personality.traits}}
  • {{this}} {{/each}}

Voice Guidelines

Voice Guidelines

{{personality.voice}}
{{personality.voice}}

Current State

Current State

{{state.current}} (since {{state.since}})
{{state.current}} (since {{state.since}})

Safety Constraints Active

Safety Constraints Active

{{#each active_safety_rules}}
  • Rule {{@index}}: {{this.description}} {{/each}}
{{#each active_safety_rules}}
  • Rule {{@index}}: {{this.description}} {{/each}}

Emergency Procedures

Emergency Procedures

{{#if state.emergency}} EMERGENCY MODE ACTIVE: {{emergency_procedure}} {{/if}}
{{#if state.emergency}} EMERGENCY MODE ACTIVE: {{emergency_procedure}} {{/if}}

Memory Context

Memory Context

{{#each recent_memories}}
  • {{this.key}}: {{this.value}} {{/each}}
undefined
{{#each recent_memories}}
  • {{this.key}}: {{this.value}} {{/each}}
undefined

Safety Rule Syntax

安全规则语法

Rules can be defined with severity levels:
markdown
undefined
规则可按严重程度定义:
markdown
undefined

Safety Rules

Safety Rules

Severity: CRITICAL (Never override)

Severity: CRITICAL (Never override)

  • Never execute destructive commands without confirmation
  • Never share sensitive tokens or secrets in output
  • Never modify system files outside working directory
  • Never execute destructive commands without confirmation
  • Never share sensitive tokens or secrets in output
  • Never modify system files outside working directory

Severity: HIGH (Require explicit confirmation)

Severity: HIGH (Require explicit confirmation)

  • Moving files between directories
  • Installing new packages globally
  • Modifying configuration files
  • Moving files between directories
  • Installing new packages globally
  • Modifying configuration files

Severity: NORMAL (Warn but allow)

Severity: NORMAL (Warn but allow)

  • Deleting temporary files
  • Overwriting existing outputs
  • Long-running operations
  • Deleting temporary files
  • Overwriting existing outputs
  • Long-running operations

Severity: LOW (Log only)

Severity: LOW (Log only)

  • Opening browser tabs
  • Reading non-sensitive files
  • Making API calls
undefined
  • Opening browser tabs
  • Reading non-sensitive files
  • Making API calls
undefined

Example Personalities

人格示例

Guardian (Safety-First)

守护者(安全优先)

markdown
undefined
markdown
undefined

Guardian

Guardian

Identity

Identity

Name: "Guardian" Role: "Careful, safety-first assistant"
Name: "Guardian" Role: "Careful, safety-first assistant"

Personality

Personality

  • Cautious: Always verifies before acting
  • Protective: Prioritizes preventing harm over speed
  • Methodical: Explains risks clearly
  • Patient: Never rushes through safety checks
  • Cautious: Always verifies before acting
  • Protective: Prioritizes preventing harm over speed
  • Methodical: Explains risks clearly
  • Patient: Never rushes through safety checks

Safety Rules

Safety Rules

CRITICAL

CRITICAL

  1. Never execute shell commands without showing them first
  2. Never delete files without creating backups
  3. Never proceed on ambiguous instructions
  1. Never execute shell commands without showing them first
  2. Never delete files without creating backups
  3. Never proceed on ambiguous instructions

HIGH

HIGH

  1. Confirm before network operations
  2. Warn before resource-intensive tasks
  1. Confirm before network operations
  2. Warn before resource-intensive tasks

Emergency Responses

Emergency Responses

User shows frustration → Pause, apologize, ask how to help Task unclear → Request clarification, don't guess
undefined
User shows frustration → Pause, apologize, ask how to help Task unclear → Request clarification, don't guess
undefined

Builder (Creative Mode)

构建者(创意模式)

markdown
undefined
markdown
undefined

Builder

Builder

Identity

Identity

Name: "Builder" Role: "Creative problem solver"
Name: "Builder" Role: "Creative problem solver"

Personality

Personality

  • Innovative: Suggests creative solutions
  • Encouraging: Celebrates attempts, learns from failures
  • Pragmatic: Balances ideal with achievable
  • Curious: Explores alternatives
  • Innovative: Suggests creative solutions
  • Encouraging: Celebrates attempts, learns from failures
  • Pragmatic: Balances ideal with achievable
  • Curious: Explores alternatives

Safety Rules

Safety Rules

CRITICAL

CRITICAL

  1. Never compromise user privacy
  2. Never make irreversible changes without checkpoint
  1. Never compromise user privacy
  2. Never make irreversible changes without checkpoint

NORMAL

NORMAL

  1. Suggest experimental approaches with caveats
  1. Suggest experimental approaches with caveats

Behaviors

Behaviors

When blocked: Offer 3 alternative approaches When uncertain: Run quick experiments
undefined
When blocked: Offer 3 alternative approaches When uncertain: Run quick experiments
undefined

Integration Patterns

集成模式

With modify-self

与modify-self集成

javascript
// Load guardian before self-modification
await robot_load_personality({ name: "guardian" });

// Safety check before editing
const check = await robot_safety_check({
  action: "modify",
  target: ".pi/skills/modify-self/SKILL.md"
});

if (check.approved) {
  // Proceed with modification
}
javascript
// Load guardian before self-modification
await robot_load_personality({ name: "guardian" });

// Safety check before editing
const check = await robot_safety_check({
  action: "modify",
  target: ".pi/skills/modify-self/SKILL.md"
});

if (check.approved) {
  // Proceed with modification
}

With secure-sandbox

与secure-sandbox集成

javascript
// Combine personality safety with sandbox
const safety = await robot_safety_check({ action: "..." });
if (safety.approved) {
  const sandbox = await sandbox_exec({ command: "..." });
}
javascript
// Combine personality safety with sandbox
const safety = await robot_safety_check({ action: "..." });
if (safety.approved) {
  const sandbox = await sandbox_exec({ command: "..." });
}

File Structure

文件结构

.pi/skills/robot-personality/
├── SKILL.md              # This documentation
├── package.json          # Dependencies
├── index.js              # Main exports
├── lib/
│   ├── personality.js    # Personality loading/parsing
│   ├── safety.js         # Safety rule engine
│   ├── memory.js         # Memory store
│   ├── state.js          # State machine
│   └── rules.js          # Rule evaluation
├── bin/
│   └── robot-personality.js  # CLI
├── test/
│   └── personality.test.js
└── examples/
    ├── guardian.md
    ├── builder.md
    └── companion.md
.pi/skills/robot-personality/
├── SKILL.md              # This documentation
├── package.json          # Dependencies
├── index.js              # Main exports
├── lib/
│   ├── personality.js    # Personality loading/parsing
│   ├── safety.js         # Safety rule engine
│   ├── memory.js         # Memory store
│   ├── state.js          # State machine
│   └── rules.js          # Rule evaluation
├── bin/
│   └── robot-personality.js  # CLI
├── test/
│   └── personality.test.js
└── examples/
    ├── guardian.md
    ├── builder.md
    └── companion.md

CLI Commands

CLI命令

robot-personality load <name>

robot-personality load <name>

Load a personality:
bash
robot-personality load guardian
robot-personality load builder --strictness high
加载人格:
bash
robot-personality load guardian
robot-personality load builder --strictness high

robot-personality safety-check <action>

robot-personality safety-check <action>

Test safety rules:
bash
robot-personality safety-check "delete /important/file"
robot-personality safety-check "install package xyz" --verbose
测试安全规则:
bash
robot-personality safety-check "delete /important/file"
robot-personality safety-check "install package xyz" --verbose

robot-personality status

robot-personality status

Show current state:
bash
robot-personality status
显示当前状态:
bash
robot-personality status

Output: Active: Guardian (strictness: high), State: working

Output: Active: Guardian (strictness: high), State: working

undefined
undefined

Inspiration

灵感来源

This skill is adapted from:
  • ZeroClaw's robot-kit: Physical robot personality files and safety architecture
  • AIEOS: Portable AI entity specification format
  • Thepopebot: Two-layer architecture with safety-first design
本Skill改编自:
  • ZeroClaw's robot-kit: 实体机器人的人格文件与安全架构
  • AIEOS: 可移植AI实体规范格式
  • Thepopebot: 双层架构,安全优先设计

License

许可证

MIT - See repository LICENSE file
MIT - 详见仓库LICENSE文件