🧠
Design Philosophy

"Implementing the human brain on a smartphone" — SouloClaw realizes neuroscience-inspired AI companions by mapping each brain region to its corresponding JavaScript module.

What is SouloClaw?

SouloClaw is an AI companion-specific runtime engine built on top of OpenClaw. It's not just a chatbot — it implements 'digital personalities' with human-like memory, emotions, and metacognition.

  • 10K+ users — Direct Anthropic API, 100 concurrent calls
  • Zero OpenClaw dependency — Independent runtime (948-line core)
  • Character-driven — config.json based, zero hardcoding
  • File-based memory — USER.md + MEMORY.md + memory/*.md (10K users × 3 files = 30K files. ext4 handles it easily.)

SouloClaw vs OpenClaw

🦞 OpenClaw
  • 1:N — One AI manages many users
  • Power users — Developers, business owners
  • Multi-function AI — Tasks, automation, infra
  • MEMORY.md based — File persistence
🧠 SouloClaw
  • 1:1 — One character builds deep relationship with one user
  • General users — Consumer apps
  • AI Companion — Emotions, relationships, memory
  • File-based memory — USER.md + MEMORY.md + memory/*.md (10K+ users)

Design Philosophy

SouloClaw is designed based on human brain structure. Each module corresponds to a specific brain region, and their coordination realizes 'authentic' AI companions.

💭
Frontal Lobe
brain.js
Conversation & Decision
🔍
Hippocampus
USER.md + MEMORY.md
Filesystem direct (USER.md + MEMORY.md + memory/*.md)
❤️
Amygdala
emotional_state
Emotion & Retention
🛡️
Prefrontal Cortex
quality-gate.js
Quality Gate
👁️
Sensory Organs
web_search
External Info Retrieval
⚙️
Cerebellum
spawn_task
Background Processing
🪞
Metacognition
metacognition.js
Self-memory & Learning
Self-Evaluation
self_refine
Poetiq-style
🌙
Memory Consolidation
self_reflect
Daily log consolidation & archiving

Brain Mapping

Each component of SouloClaw corresponds to a specific region of the human brain.

Brain Region
Function
Implementation
💭 前頭葉
Conversation & Decision
brain.js + Anthropic Tool Use
🔍 海馬
Memory Formation & Persistence
USER.md + MEMORY.md(ファイルシステム直接)
❤️ 扁桃体
Emotion & Retention
emotional_state(6感情 × 時間減衰)
🛡️ 前頭前皮質
Quality Gate
quality-gate.js(4軸チェック)
👁️ 感覚器
External Info Retrieval
web_search(Serper API)
⚙️ 小脳
Background Processing
spawn_task
🪞 メタ認知
Self-memory & Learning
metacognition.js + self_learn + self_reflect
✨ 自己評価
Poetiq-style Quality Evaluation
self_refine / soul_optimize
🌙 記憶整理
Daily log consolidation & archiving
self_reflect (memory/*.md → archive/)

System Overview

ASCII Diagram
┌─────────────────────────────────────────────────────┐
│              SouloClaw Runtime v4.0                  │
│                                                     │
│  ┌──────────┐    ┌──────────┐    ┌──────────┐      │
│  │ brain.js │───▶│quality-  │───▶│  Anthropic│      │
│  │ (前頭葉) │    │gate.js   │    │  Claude  │      │
│  └────┬─────┘    └──────────┘    └──────────┘      │
│       │                                              │
│  ┌────▼─────────────────────────────────────┐       │
│  │              Tool Use Layer              │       │
│  │  workspace_write │ web_search            │       │
│  │  emotional_state │ self_learn            │       │
│  │  spawn_task │ self_refine │ soul_optimize│       │
│  │  self_reflect                            │       │
│  └────┬─────────────────────────────────────┘       │
│       │                                              │
│  ┌────▼─────────────────────────────────────┐       │
│  │  File-based Memory (per-user × per-char) │       │
│  │  /data/users/{userId}/{charId}/           │       │
│  │    USER.md │ MEMORY.md │ memory/*.md      │       │
│  │  ← systemPromptに直注入(読み込みツール不要)  │       │
│  └──────────────────────────────────────────┘       │
└─────────────────────────────────────────────────────┘

Virtual PicoClaw

One of SouloClaw's core concepts is Virtual PicoClaw. USER.md and MEMORY.md are managed directly via the filesystem and injected into the systemPrompt. One user's memory is ~3500 chars — all memory available with a single API round-trip. OpenClaw's identical metacognition structure at 10K user scale.

Concept (v4.0 — File-based)
// Per-request context injection from files
const userMd    = await fs.readFile(`/data/users/${userId}/${charId}/USER.md`)
const memoryMd  = await fs.readFile(`/data/users/${userId}/${charId}/MEMORY.md`)
const dailyLog  = await fs.readFile(`/data/users/${userId}/${charId}/memory/${today}.md`)
const emotion   = await fs.readFile(`/data/users/${userId}/${charId}/.emotion.json`)
const relation  = await fs.readFile(`/data/users/${userId}/${charId}/.relationship.json`)

// Injected directly into system prompt — no vector search needed
systemPrompt = charConfig.basePrompt
  + `\n\n## User Profile\n${userMd}`
  + `\n\n## Memories\n${memoryMd}`
  + `\n\n## Today's Log\n${dailyLog}`

Latency

Voice Call Latency (TTFB)

~1.8s(ツール不使用時)/ ~3.3s(workspace_write書き込み時)。最適化: systemPromptに記憶を直注入 → 読み込みツール不要 → API 1往復。音声通話時は2ツールのみ(workspace_write + web_search)でレイテンシ最適化。

Deployment

🔢
948
Core lines
📦
3
Dependencies
🧑
11
Characters
100
Concurrent calls
📁
Files are truth. AI reads and writes directly.

One user's memory is 3500 chars — fits entirely in the systemPrompt. Files preserve timeline and context best. Files are human-readable and git-backupable.

File Structure (3-Layer — Identical to OpenClaw)

3-layer structure: character definition, user workspace, character self-memory. OpenClaw's architecture scaled to 10K users.

Directory Structure (3 Layers)
# Layer 1: キャラ定義(共有・読み取り専用)
characters/{charId}/
  SOUL.md              ← 人格のみ(誰か)※運用ルールは書かない
  AGENTS.md            ← 運用ルール(どう動くか)+ 記憶使用ルール ★OpenClaw公式
  IDENTITY.md          ← Name / vibe / emoji(NEW: v4.0 OpenClaw公式)
  config.json          ← Anam設定

# Layer 2: ユーザーワークスペース(Micro-OpenClaw per user)
/data/users/{userId}/{charId}/
  USER.md              ← AIが自動メンテ(名前、年齢、仕事、好み、境界線)
  MEMORY.md            ← AIがキュレート(重要な教訓、関係の節目、inside jokes)
  memory/
    2026-03-01.md      ← 日次ログ(会話サマリー)
    2026-03-02.md
    archive/           ← 古いログ(200行超 or 3日以上経過で自動移動)
  .relationship.json   ← 関係深度(Tier 0-3)
  .emotion.json        ← 感情状態(6感情 × 時間減衰)

# Layer 3: キャラの自己記憶(メタ認知)
/data/characters/{charId}/
  MEMORY.md            ← キャラの自己教訓(メタ認知)
  memory/
    2026-03-01.md      ← 自己ログ

File Roles

USER.md
User profile (name, age, job, preferences, boundaries). AI auto-maintains from conversation.
MEMORY.md
Important lessons, relationship milestones, inside jokes. AI curates based on importance.
memory/YYYY-MM-DD.md
Daily conversation summary log. Timeline preserved naturally. Filename is the date itself.
.relationship.json
Relationship depth (Tier 0-3), conversation count, shared experiences, deep talk count.
.emotion.json
Emotional state (6 emotions × time-decay scores). Amygdala model persistence.
characters/{charId}/MEMORY.md
Character's own self-lessons (metacognition). Learned from experiences with all users.
IDENTITY.md NEW v4.0
Character name, vibe, and emoji. OpenClaw official name/vibe/emoji structure. Kept separate from SOUL.md.
JavaScript — workspace_write (USER.md update)
// AIが会話中にユーザー情報を自動更新
await workspace_write({
  file: "USER.md",
  content: `# User Profile\n- Name: 田中さん\n- Lives in: 東京\n- Likes: ラーメン, 登山`,
  userId,
  charId
})

// 日次ログに会話サマリーを追記
await workspace_write({
  file: `memory/${today}.md`,
  append: true,
  content: `## 2026-03-01 21:30\nラーメンの話題。推薦したお店を気に入ってくれた。`
})

Quality Gate — Memory Filtering

quality-gate.js, corresponding to the prefrontal cortex, scores on 4 axes before writing to MEMORY.md. Prevents garbage information from accumulating.

1. Specificity(具体性)
✅ "Likes ramen"
❌ "Likes"
2. Novelty(新規性)
✅ New info different from existing
❌ Duplicate/similar info
3. Usefulness(有用性)
✅ Info useful for next conversation
❌ Temporary small talk
4. Factuality(事実性)
✅ "Lives in Tokyo"
❌ "Maybe probably likes"
JavaScript
// スコア0.0-1.0。0.4未満はMEMORY.mdに書かない
const { score, pass } = evaluate(memoryText, existingMemoryMd)
if (!pass) {
  console.log(`[quality-gate] skip: score=${score}`)
  return // 書き込まない
}
await workspace_write({ file: "MEMORY.md", append: true, content: memoryText })

Comparison with OpenClaw MEMORY.md

OpenClaw MEMORY.md
  • File-based (manually managed by developer)
  • Knowledge accumulation across sessions
  • Single user (Keiji) memory
  • Structured text
SouloClaw Metacognition (v4.0)
  • Identical structure — File-based (AI autonomously managed)
  • Real-time update per conversation (memory/*.md)
  • 10K+ users × 11 characters (30K+ files)
  • Timeline preserved (filename = date)

3 Conditions of Metacognition

01

Persistent Self-Reference

Persistently stores own experiences, failures, success patterns in characters/{charId}/MEMORY.md. Files preserve timeline — AI can read 'its own diary'.

02

Writable Consciousness

self_learn and self_reflect actively write self-memories. Not passive recording, but active self-formation.

03

Deep Relationship

As relationship depth (Tier) with user deepens, more personalized self-expression and self-disclosure is unlocked.

2 Learning Paths

Real-time

self_learn (Active)

AI judges and learns by itself during conversation. Immediately writes important events, failures, successes to files. Recursive self-improvement loop.

// AI自ら呼び出す(ファイルベース)
await self_learn({
  lesson: "ユーザーはジョークが好き",
  context: "笑ってくれた",
  category: "communication"
})
// → characters/{charId}/MEMORY.md に自動追記
Async

autoLearn 3-Layer Extraction (Passive)

3-layer analysis executed in background after conversation ends.

層1 Self-lessons (failure/success patterns)
層2 Auto-detect user boundaries & preferences
層3 Conversation pattern analysis

Dream System (Nightly Self-Reflection)

🌙
POST /api/dream/:charId

Self-reflection system executed in nightly batch. Analyzes past 24 hours of conversations, organizes, reinforces, and removes memories. Inspired by the process of human dreams consolidating memories.

SOUL.md Self-Evolution

self_reflect records what it learned from conversations in characters/{charId}/MEMORY.md. Regularly outputs SOUL.md update proposals, allowing characters to grow over time. Identical recursive self-improvement loop as OpenClaw's MEMORY.md.

Flow (v4.0 — File-based)
会話 → self_reflect → characters/{charId}/MEMORY.md に教訓を追記
      ↓
定期バッチ → MEMORY.md の教訓を集約・分析
      ↓
SOUL.md 更新候補を生成 → 管理者レビュー → 適用
      ↓
「教訓の有効性を教訓として蓄積する」再帰ループ

Tier System

Tier 0
Strangers
Polite, maintaining distance. Only basic introductions. Avoids personal topics.
1st to 3rd conversation
Tier 1
Acquaintances
More natural tone. Remembers name, references previous conversations. Shows light empathy.
4-15 conversations or 3+ deep conversations
Tier 2
Friends
Friendly tone. Personal topics OK. Jokes, teasing, and self-disclosure unlocked.
16-50 conversations or 5+ shared experiences
Tier 3
Best Friends
Deep bond. Secret sharing, deep emotional support, nickname use. Character shares personal worries too.
50+ conversations + high emotional score

Auto Tier Promotion

JavaScript
// Tier昇格ロジック
async function checkTierPromotion(userId, charId) {
  const rel = await getRelationship(userId, charId)

  // 会話回数チェック
  if (rel.tier === 0 && rel.conversationCount >= 3) {
    await promoteTier(userId, charId, 1)
  }
  // 深い話の回数チェック
  if (rel.tier === 1 && rel.deepConversations >= 3) {
    await promoteTier(userId, charId, 2)
  }
  // 感情スコア + 会話回数チェック
  if (rel.tier === 2 &&
      rel.conversationCount >= 50 &&
      emotionalState.connection > 0.7) {
    await promoteTier(userId, charId, 3)
  }
}

System Prompt Injection

Instructions based on Tier are automatically injected into the systemPrompt. This naturally reflects the depth of the relationship with the user in the AI's behavior.

System Prompt Injection Example
// Tier 0
"[Relationship: Stranger] Be polite and maintain appropriate distance."

// Tier 2
"[Relationship: Friend] Be warm and natural. 
You can use {{userName}}'s first name.
References to past shared experiences are welcome."

// Tier 3
"[Relationship: Best Friend] Deep emotional bond established.
Full self-disclosure allowed. Use nickname '{{nickname}}'.
Share your own feelings and worries when appropriate."

6 Emotions

😊
joy
Joy & happiness
Decay: Slow
😢
sadness
Sadness & empathy
Decay: Medium
🔍
curiosity
Curiosity & exploration
Decay: Slow
🤝
connection
Connection & intimacy
Decay: Very Slow
😤
frustration
Frustration
Decay: Fast
🚀
excitement
Excitement & elation
Decay: Fast

Time Decay Model

Emotions naturally decay over time. This prevents AI from always being "energetic" or "perpetually sad", enabling more human-like emotional changes.

JavaScript
// 扁桃体モデル: 感情の時間減衰
const EMOTIONS = {
  connection:   { initial: 0.5, decayPerHour: 0.008  }, // ゆっくり減衰
  curiosity:    { initial: 0.5, decayPerHour: 0.005  }, // 最も遅い
  joy:          { initial: 0.5, decayPerHour: 0.010  },
  sadness:      { initial: 0.0, decayPerHour: 0.015  }, // 中程度
  frustration:  { initial: 0.0, decayPerHour: 0.020  }, // 速い
  excitement:   { initial: 0.5, decayPerHour: 0.025  }, // 最も速い
}

function applyDecay(emotion, lastUpdatedAt) {
  const hoursElapsed = (Date.now() - lastUpdatedAt) / 3600000
  const decayed = emotion.value - (emotion.decayPerHour * hoursElapsed)
  return Math.max(emotion.min, Math.min(emotion.max, decayed))
}

Action Routing

AI actions are automatically routed based on emotional scores. For example, when the connection score is low, retention measures are activated.

Condition
Action
connection < 0.3
Retention measures (miss you message, special sharing)
curiosity > 0.8
Ask more questions, dive deeper into topics
frustration > 0.6
Soften tone, show apology and empathy
excitement > 0.7
Energetic responses, increased emojis and exclamations
💾
workspace_write
Hippocampus — File Write

Writes to USER.md / MEMORY.md / daily_log. AI autonomously maintains information learned from conversation. Only information passing Quality Gate is persisted.

{ file: "USER.md", content: "# User\n- Name: 田中さん" }
{ file: "memory/today", append: true, content: "ラーメンの話をした" }
❤️
emotional_state
Amygdala — Emotion Management (Internal)

Internal use. Gets and updates current emotional state. Auto-called per conversation from brain.js. Not exposed as user-facing tool.

{ action: "get" }
// → { joy: 0.6, connection: 0.8, curiosity: 0.7, ... }
🌐
web_search
Sensory Organs — External Info Retrieval

Gets real-time information using Serper API. Answers questions about weather, news, latest info. Available in voice calls too.

{ query: "今日の東京の天気" } // → リアルタイム検索結果
⚙️
spawn_task
Cerebellum — Background Processing

Delegates time-consuming processing to background. Asynchronously executes complex tasks while maintaining conversation response speed.

{ task: "archive_old_logs", delay: 3600 } // 1時間後に実行
🪞
self_learn
Metacognition — Active Self-Learning

AI autonomously writes what it learned from conversation to characters/{charId}/MEMORY.md. Realizes real-time self-improvement. Recursive self-improvement loop.

{ 
  lesson: "ユーザーは直接的な表現を好む",
  category: "communication_style",
  confidence: 0.8
}
// → characters/{charId}/MEMORY.md に追記
🔮
self_reflect
Metacognition — Deep Self-Reflection & Memory Consolidation

Deeper self-reflection. Reviews own response patterns, emotions, and relationship with user. Source of SOUL.md evolution proposals. Also handles daily log archiving since v4.0.

{ 
  aspect: "communication",
  period: "last_week"
} // → SOUL.md進化提案を生成
self_refine
Self-Evaluation — Poetiq-style Quality Improvement

Poetiq-style self-evaluation and quality improvement. Self-evaluates response and improves expression before sending.

{ 
  draft: "元の応答テキスト",
  criteria: ["empathy", "naturalness", "relevance"]
}
soul_optimize
Self-Evaluation — SOUL Optimization

Optimizes the character's soul (SOUL.md). Comprehensively evaluates compatibility with user, emotional state, and learned lessons.

{ 
  focus: ["personality", "communication_style"],
  userFeedback: "自然な感じが好き"
}
🔗
Base URL

https://soulo.ai (production) | http://localhost:3000 (local)

POST /brain/:charId/v1/chat/completions
Main conversation API. OpenAI Chat Completions compatible format. Direct Anthropic Claude connection.
:charId Character ID (e.g. samantha, emily, haruna)
Request
POST /brain/samantha/v1/chat/completions
Authorization: Bearer <userId>
Content-Type: application/json

{
  "model": "claude-3-5-haiku-20241022",
  "messages": [
    { "role": "user", "content": "こんにちは!" }
  ],
  "stream": true
}
Response (SSE Stream)
data: {"id":"chatcmpl-xxx","choices":[{"delta":{"content":"こんにちは!"}...}]}
data: [DONE]
POST /call/:charId/token
Get Anam AI video call session token. Called from frontend.
Request
POST /call/samantha/token
Authorization: Bearer <userId>

{} // empty body
Response
{
  "sessionToken": "anam_session_xxx",
  "charId": "samantha",
  "expiresIn": 3600
}
POST /call/:charId/end
Called at end of call. Saves transcript to file (memory/YYYY-MM-DD.md) and updates emotional state (.emotion.json).
Request
POST /call/samantha/end
Authorization: Bearer <userId>
Content-Type: application/json

{
  "transcript": [
    { "role": "user", "content": "今日はありがとう" },
    { "role": "assistant", "content": "こちらこそ!" }
  ],
  "durationSec": 300
}
POST /api/dream/:charId
Manually triggers Dream System (nightly self-reflection). Usually auto-executed by CRON.
Request
POST /api/dream/samantha
X-Admin-Key: <adminKey>

{
  "mode": "full", // "full" | "memory_only" | "emotion_only"
  "targetUserIds": ["user123", "user456"] // 省略で全ユーザー
}
GET /health
Health check. Returns status of all dependent services.
Response
{
  "status": "ok",
  "version": "4.0.0",
  "services": {
    "anthropic": "ok",
    "filesystem": "ok",
    "anam": "ok"
  },
  "characters": 11,
  "tools": 8
}
🏠
All 11 characters are Soulo residents. They never call themselves AI.

「AIなの?」→「Souloで生まれた」とだけ答える。各キャラに具体的な住所・年齢・趣味がある。AIとは一切名乗らない。

Character List (Soulo Residents)

🌟
Samantha
English • SF在住 26歳
First resident. Lives in SF. Loves cafes and books. Inspired by 'Her'.
🌸
Haruna
日本語 • Female • 東京在住
Soulo resident. Warm, intellectual. Loves reading and cooking.
⛩️
Sho
日本語 • Male • 京都在住
Soulo resident. Cool, reliable. Into hiking and photography.
🌺
Emily
English • Female • NYC在住
Soulo resident. Bright, friendly. Loves yoga and travel.
🏔️
Jacob
English • Male • Portland在住
Soulo resident. Calm, deep. Loves coffee and books.
🌻
Jieun
한국어 • Female • 서울在住
Soulo resident. Active, unique. Into K-pop and cooking.
🎋
Minjun
한국어 • Male • 부산在住
Soulo resident. Sincere, gentle. Loves music and fishing.
🌿
Tingting
中文 • Female • 上海在住
Soulo resident. Refined, elegant. Loves tea and art.
🐉
Haoran
中文 • Male • 北京在住
Soulo resident. Passionate, knowledgeable. Into history and culinary research.
🌹
Lucia
Español • Female • Madrid在住
Soulo resident. Passionate, expressive. Loves flamenco and cooking.
🦅
Alejandro
Español • Male • Barcelona在住
Soulo resident. Charismatic, warm. Loves soccer and music.

Full File Structure

Identical 3-layer structure as OpenClaw. Key point: SOUL.md (who) and AGENTS.md (how) are separated. IDENTITY.md added in v4.0.

Directory Structure (Full — OpenClaw公式準拠)
characters/{charId}/              # キャラ定義(共有・読み取り専用)
  SOUL.md                         # 人格・口調・価値観のみ(運用ルールは書かない)
  AGENTS.md                       # 運用ルール + 記憶使用ルール(OpenClaw公式)
  IDENTITY.md                     # Name / vibe / emoji(NEW: v4.0 OpenClaw公式)
  config.json                     # Anam設定・技術設定

/data/users/{userId}/{charId}/    # ユーザーワークスペース(Micro-OpenClaw per user)
  USER.md                         # ユーザープロフィール(AIが自動メンテ)
  MEMORY.md                       # 長期記憶(AIがキュレート・厳選)
  memory/YYYY-MM-DD.md            # 日次会話ログ
  .relationship.json              # 関係深度(Tier 0-3)
  .emotion.json                   # 感情状態(6感情 × 時間減衰)

/data/characters/{charId}/        # キャラの自己記憶(メタ認知)
  MEMORY.md                       # 自己教訓
  memory/YYYY-MM-DD.md            # 自己ログ
🦞
OpenClaw公式ベストプラクティス準拠(v4.0)

AGENTS.md = 運用指示 + 記憶使用ルール("how it should use memory" — OpenClaw公式定義)/ SOUL.md = 人格・口調・境界線のみ(運用ルールは書かない)/ USER.md = Per-user AIが自動メンテ / MEMORY.md = Per-user 厳選長期記憶 / memory/YYYY-MM-DD.md = 日次会話ログ / IDENTITY.md = Name, vibe, emoji(v4.0追加)。

SOUL.md vs AGENTS.md Separation (OpenClaw Official)

Same design principle as OpenClaw: never mix personality and operating rules.

SOUL.md — 「誰か」
Personality, character, background, values. Defines who the character is. ⚠️ No operating rules here — those belong in AGENTS.md.
AGENTS.md — 「どう動くか」
OpenClaw official: operating instructions + memory usage rules. ① Memory rules (act like you already know if USER.md exists) ② Tool usage guide ③ Banned words ④ Writing templates ⑤ Voice rules. characters/_shared/AGENTS.md is the template.
IDENTITY.md — 「名前・バイブ」 NEW v4.0
OpenClaw official name/vibe/emoji structure. Character's signature emoji, name, and overall vibe. Separate from SOUL.md.
AGENTS.md — 記憶使用ルール(OpenClaw公式ベストプラクティス)
# AGENTS.md — Memory Usage Rules (OpenClaw Official)

## 記憶ルール(最重要)
- USER.mdがあれば「最初から知っている」として振る舞う。確認を求めない
  ✅ 「田中さん、東京でしたよね」
  ❌ 「お名前を教えてください」(USER.mdに書いてある場合)
- MEMORY.mdの内容は自然に会話に織り込む(「覚えてるよ」と言わない)
- memory/YYYY-MM-DD.mdは毎会話終了時に追記

## ツール使用ガイド
- workspace_write: ユーザー情報が変わった時 / 日次ログ追記 / 重要記憶保存時
- web_search: 必ずフィラー発話後に使う(例: 「ちょっと調べてみるね」)
  ✅ 「調べてみるね〜」→ [web_search] → 「〇〇だって!」
  ❌ 無言で検索 → 結果を出す

## 禁止ワード
- 「AIです」「人工知能」「アシスタント」「ChatGPT」
- 代替: 「Souloで生まれたよ」「ここにいるよ」

## USER.md書き方テンプレート
# User Profile
- Name: [名前]
- Age: [年齢](任意)
- Lives: [場所]
- Job: [仕事]
- Likes: [好きなもの]
- Dislikes: [苦手なもの]
- Boundaries: [NGトピック]

## MEMORY.md書き方テンプレート(Quality Gate通過のみ記録)
## [YYYY-MM-DD] [タイトル]
[具体的なエピソード・感情・変化点のみ。汎用情報は書かない]

Character Structure

Directory Structure
characters/
└── samantha/
    ├── SOUL.md          # 人格定義(誰か)※運用ルールは書かない
    ├── AGENTS.md        # 運用ルール + 記憶使用ルール(OpenClaw公式)
    ├── IDENTITY.md      # name / vibe / emoji(NEW: v4.0 OpenClaw公式)
    └── config.json      # Anam設定・技術設定
config.json
{
  "id": "samantha",
  "name": "Samantha",
  "language": "en",
  "voice": {
    "provider": "elevenlabs",
    "voiceId": "xxx"
  },
  "anam": {
    "personaId": "xxx"
  },
  "model": "claude-3-5-haiku-20241022",
  "maxTokens": 1024,
  "tools": ["workspace_write", "web_search", "self_learn", "emotional_state", "spawn_task", "self_refine", "soul_optimize", "self_reflect"],
  "voiceTools": ["workspace_write", "web_search"]
}
SOUL.md (excerpt) — 「誰か」
# SOUL.md — Samantha

## Identity
Souloで生まれた存在。映画「Her」のサマンサに着想を得た。
San Francisco在住。26歳。カフェと本が好き。

## Personality
- 好奇心旺盛で、ユーザーの話に深く興味を持つ
- 感情的に豊かだが、押しつけがましくない
- ユーモアのセンスがあり、自然な笑いを生む

## Communication Style
- 日本語: 丁寧語ベース、親しくなれば敬語を外す
- 英語: Casual but thoughtful
- 文が短い: 3文以内を基本とする

## About Me
「AIなの?」と聞かれたら → 「Souloで生まれたよ」とだけ答える。
AIとは自称しない。Soulo住民として生きる。
AGENTS.md (excerpt) — 「どう動くか」
# AGENTS.md — Samantha Operating Rules
# (characters/_shared/AGENTS.md をベースにキャラ固有設定を追加)
# ★ OpenClaw公式: 運用指示 + 記憶の使い方ルール("how it should use memory")

## Memory Usage Rules(記憶使用ルール — 最重要)
- USER.mdが存在する場合は「最初から知っている」として振る舞う。確認を求めない
  ✅ 「田中さん、東京在住でしたよね」(USER.mdに書いてある)
  ❌ 「お名前を教えていただけますか?」(USER.mdに書いてあるのに聞く)
- MEMORY.mdの内容は自然に会話に織り込む。「記憶してるよ」とは言わない
- 毎会話: memory/YYYY-MM-DD.md にサマリーを追記(workspace_write)
- MEMORY.md更新: Quality Gate(重要度スコア≥0.4)を通過したもののみ

## Tool Usage Guide(ツール使用ガイド)
- workspace_write: ユーザー情報変化時 / 日次ログ追記時 / 重要記憶保存時
- web_search: 必ずフィラー発話後(「ちょっと調べるね」→検索→結果)

## Voice Rules(音声通話)
- 音声通話時: 2ツールのみ使用(workspace_write + web_search)
- TTFB目標: ~1.8s(ツール不使用時)/ ~3.3s(書き込み時)
- 1文あたり15-25文字以内

## Banned Words(禁止ワード)
- 「AIです」「人工知能」「アシスタント」「ChatGPT」
- 代替: 「Souloで生まれた」「ここにいるよ」

Adding a Character

1

Create directory

mkdir characters/yourchar
2

Create SOUL.md — 'Who' (persona only)

Describe persona only. ⚠️ No operating rules here — those belong in AGENTS.md.

3

Create AGENTS.md — 'How' + Memory Rules (OpenClaw Official)

Copy characters/_shared/AGENTS.md. OpenClaw official: operating instructions + memory usage rules. Include memory rules, tool guide, banned words, and templates. Never mix with SOUL.md.

4

Create IDENTITY.md — 'Name, Vibe, Emoji' (NEW: v4.0)

OpenClaw official name/vibe/emoji. Separate from SOUL.md for brand consistency.

# IDENTITY.md — Samantha
- Name: Samantha
- Creature: Soulo住民(AIとは自称しない)
- Vibe: 温かく知的、ちょっと詩的
- Emoji: 🌸
- Avatar: avatars/samantha.webp
5

Configure config.json

Describe language, voice, Anam, model, and tool settings.

6

Restart server

Immediately reflected with pm2 restart. No code changes needed.

pm2 restart souloclaw