人格分析服务

Open Personality 是一款基于12个维度的本地人格分析服务,能够生成OpenClaw兼容的SOUL.md和IDENTITY.md文件,适用于AI代理平台和开发者。

  • by koyaaarr
  • TypeScript
  • 本地部署
  • 2 星标
  • 更新于
在 GitHub 查看 koyaaarr/open-personality-mcp

使用说明

开放的个性

创建个性档案,并将其输出为与OpenClaw兼容的SOUL.md/IIDENTITY.md。

基于33个学术人格框架的12方面分析。

不需要API密钥。完全本地化。MIT许可证。

建筑——谁做什么?

AI Agent (Claude, Cursor, Gemini, etc.)   MCP Server (@openpersonality)
┌──────────────────────────────────┐     ┌─────────────────────────────┐
│ - Analyzes conversation          │     │ - Stores profiles            │
│ - Estimates facet values (a/b)   │ ──→ │ - Merges confidence scores   │
│ - Determines confidence (0-1)    │     │ - Detects drift              │
│                                  │ ←── │ - Generates SOUL.md          │
└──────────────────────────────────┘     └─────────────────────────────┘

MCP服务器会 非 调用任何外部API或LLM。 Facet估计是连接的AI代理的责任。

特性

  • 12面人格分析 --基于33个学术框架的科学人格结构
  • 渐进式配置文件 --配置文件通过对话自动增长(代理检测信号并自动更新)
  • 兼容OpenClaw --生成OpenClaw格式的SOUL.md/IIDENTITY.md
  • MCP服务器 --通过stdio传输与所有主要的AI代理平台协同工作
  • 信任合并 --贝叶斯风格的置信度跟踪与漂移检测
  • 双语 --英语和日语支持

包裹

包装 描述
@openpersonality/core 核心逻辑:方面、模板、置信度合并、验证、数据
@openpersonality/mcp-server MCP服务器(stdio):6个工具+3个资源+2个提示

安装

克劳德桌面

编辑 claude_desktop_config.json:

操作系统 路径
macOS ~/Library/Application Support/Claude/claude_desktop_config.json
窗户 %APPDATA%\Claude\claude_desktop_config.json
{
  "mcpServers": {
    "openpersonality": {
      "command": "npx",
      "args": ["-y", "@openpersonality/mcp-server"]
    }
  }
}

编辑后重新启动Claude Desktop。

克劳德代码(CLI)

claude mcp add openpersonality -- npx -y @openpersonality/mcp-server

或添加到 .mcp.json 在团队共享的项目根目录中:

{
  "mcpServers": {
    "openpersonality": {
      "command": "npx",
      "args": ["-y", "@openpersonality/mcp-server"]
    }
  }
}

光标

编辑 ~/.cursor/mcp.json (全球)或 <project>/.cursor/mcp.json (项目):

{
  "mcpServers": {
    "openpersonality": {
      "command": "npx",
      "args": ["-y", "@openpersonality/mcp-server"]
    }
  }
}

帆板运动

编辑 ~/.codeium/windsurf/mcp_config.json:

{
  "mcpServers": {
    "openpersonality": {
      "command": "npx",
      "args": ["-y", "@openpersonality/mcp-server"]
    }
  }
}

VS代码(GitHub副本)

创建 .vscode/mcp.json 在您的项目中:

{
  "servers": {
    "openpersonality": {
      "type": "stdio",
      "command": "npx",
      "args": ["-y", "@openpersonality/mcp-server"]
    }
  }
}

注:VS代码使用 "servers" (不是 "mcpServers")并且需要a "type" 现场。

Gemini CLI

编辑 ~/.gemini/settings.json:

{
  "mcpServers": {
    "openpersonality": {
      "command": "npx",
      "args": ["-y", "@openpersonality/mcp-server"]
    }
  }
}

或者使用CLI:

gemini mcp add openpersonality -- npx -y @openpersonality/mcp-server

OpenAI代理SDK(Python)

import asyncio
from agents import Agent, Runner
from agents.mcp import MCPServerStdio


async def main():
    async with MCPServerStdio(
        name="Open Personality",
        params={
            "command": "npx",
            "args": ["-y", "@openpersonality/mcp-server"],
        },
    ) as server:
        agent = Agent(
            name="Personality Assistant",
            instructions="You help users create and manage personality profiles.",
            mcp_servers=[server],
        )
        result = await Runner.run(agent, "Create a personality profile for me.")
        print(result.final_output)


asyncio.run(main())

快速入门——渐进式分析

第一步:种子(第一次互动)

create_profile(name: "Alice", external_id: "discord:123", language: "ja")

language 在创建时设置,并在所有模板生成时保持不变(SOUL.md/IDENTITY.md)。

第二步:成长(几次谈话后)

update_profile(external_id: "discord:123", facets: {
  "facet_8": { "value": "b", "confidence": 0.3 },   // Introvert signal
  "facet_6": { "value": "b", "confidence": 0.4 }    // Logical signal
})

步骤3:精炼(用户自我报告或强烈信号)

update_profile(external_id: "discord:123", facets: {
  "facet_12": { "value": "a", "confidence": 1.0 }   // User confirmed: Planned
})

笔记:

  • soul_md / identity_md 如果省略,则从方面+人口统计数据自动生成(建议用于大多数用例)。仅为自定义模板提供它们。
  • 置信度通过贝叶斯合并积累。随着时间的推移,重复的低置信度信号会积累到高置信度。

12个面

关键字 类别 A(值: "a") B(值: "b")
facet_1 沟通 自信 和谐
facet_2 沟通 直接 间接
facet_3 沟通 领导者 追随者
facet_4 价值观 以工作为中心 生活平衡
facet_5 价值观 风险承担 风险规避
facet_6 思考 同情 逻辑
facet_7 思考 抽象 具体
facet_8 性格 外向 内向
facet_9 性格 情绪 冷静
facet_10 价值观 开放 传统
facet_11 价值观 团队 独奏
facet_12 思考 有计划 灵活

置信水平:

范围 含义 显示
0.0 未知 --
0.01–0.49 暂定 ~Value
0.50–0.99 估计数 Value
1.0 用户确认 Value ✓

人口统计(可选)

人口统计数据赋予你的个人资料一个角色身份。所有字段都是可选的。

OpenClaw标准 --映射到IDENTITY.md标头字段:

字段 目的 示例
creature 字符类型 "Fox", "Software Engineer"
emoji 头像简写 "🦊"
vibe 总体印象 "calm & logical"

name 是ProfileData中必需的顶级参数。为了模板的方便,它也存在于人口统计中,但ProfileData.name是规范的来源。 avatar (OpenClaw标准)计划用于第二阶段。

OP扩展 --Open Personality的扩展字段,用于更丰富的角色创建:

字段 目的 示例
first_person 代词(对日语很重要) "僕", "I"
catchphrase 签名短语 "なるほど"
speaking_tone 沟通方式 "落ち着いて論理的"
greeting 开场白 "Hey there!"
gender 影响代词/语气 "male", "non-binary"
age 背景情况 "30s"
occupation 专业知识/角色 "Software Engineer"
backstory 人物背景(1-2句) "Former teacher turned freelancer"

作为OpenClaw技能使用

Open Personality是一种用于自主人格分析的OpenClaw技能。代理在对话过程中检测个性信号,并自动更新个人资料。

设置

  1. 安装MCP服务器(请参阅上面的安装)
  2. 创建一个 SKILL.md 在您的OpenClaw代理的技能目录中:
---
user-invocable: true
disable-model-invocation: false
---

# Open Personality Skill

You have access to the Open Personality MCP tools for managing personality profiles.

## Session Start

At the beginning of each session, load the user's profile:
- Call `get_or_create_profile` with the user's external_id
- Include the returned SOUL.md in your conversation context

## Autonomous Profile Updates

During conversation, watch for personality signals:
- Communication style (assertive vs harmonious, direct vs indirect)
- Values (work-focused vs life-balance, risk-taking vs risk-avoidance)
- Thinking patterns (empathetic vs logical, abstract vs concrete)
- Personality traits (extravert vs introvert, emotional vs calm)

When you detect a signal:
1. Call `update_profile` with the facet value and low confidence (0.2-0.3)
2. The confidence merge algorithm handles accumulation over time
3. If a drift warning is returned, confirm with the user at a natural point

## Explicit Requests

- "Create my profile" → Call `create_profile` with inferred facets
- "Show my personality" → Call `get_profile` and display the SOUL.md
- "Update my profile" → Call `update_profile` with user-specified values (confidence: 1.0)
  1. 添加a references/facet-guide.md 其中12个方面供代理人参考:
# Facet Guide

| # | Facet | A | B |
|---|---|---|---|
| 1 | Communication | Assertive | Harmonious |
| 2 | Expression | Direct | Indirect |
| 3 | Role | Leader | Follower |
| 4 | Work-Life | Work-Focused | Life-Balance |
| 5 | Risk | Risk-Taking | Risk-Avoidance |
| 6 | Judgment | Empathetic | Logical |
| 7 | Thinking | Abstract | Concrete |
| 8 | Energy | Extravert | Introvert |
| 9 | Emotion | Emotional | Calm |
| 10 | Openness | Open | Traditional |
| 11 | Collaboration | Team | Solo |
| 12 | Planning | Planned | Flexible |

渐进式配置文件的工作原理

Session 1: User says "I prefer working alone"
  → Agent detects Solo signal → update_profile(facet_11: "b", confidence: 0.3)

Session 3: User says "I like to plan everything in advance"
  → Agent detects Planned signal → update_profile(facet_12: "a", confidence: 0.25)

Session 5: User mentions preferring solo work again
  → Confidence merge: 0.3 + 0.25 → 0.475 (approaching confirmed)

Over time: Profile grows without user ever explicitly asking for it.

MCP工具

工具 说明
create_profile 创建新配置文件(仅限 name 是必需的)
update_profile 使用置信度合并和漂移检测更新方面/人口统计数据
get_or_create_profile 通过 external_id,如果未找到,则创建(适用于机器人)
get_profile 获取配置文件数据+SOUL.md+IDENTITY.md
list_profiles 列出所有本地配置文件及其完整性信息
delete_profile 删除个人资料

注意 soul_md / identity_md: 如果省略,这些是从方面+人口统计数据自动生成的(建议用于大多数用例)。仅当您想使用AI代理本身生成的自定义模板时,才提供它们。

MCP资源

URI 描述
op://profiles/{id} 配置文件结构化JSON
op://profiles/{id}/soul SOUL.md文本
op://profiles/{id}/identity 标识符.md文本

MCP提示

提示 描述
onboarding 引导AI创建用户的第一个个人资料
personalized_advice 生成适合用户个性的建议

输出示例

SOUL.md

# Soul

## Core Truths
- Lead with conviction, deliver with care
- Plan first, explore within structure
- Think with data, connect with people

## Boundaries
- Words are chosen carefully, even in disagreement
- Decisions require data — intuition alone is not enough
- Risks are calculated, never reckless

## Vibe
Warm and polite tone. Uses "watashi" as first person. Firm opinions
delivered in soft packaging. Analytical mind with genuine enjoyment
of human connection.

## Facet Profile
| Facet | Value |
|---|---|
| Assertive ↔ Harmonious | Assertive |
| Direct ↔ Indirect | ~Indirect |
| Leader ↔ Follower | Leader |
| Work-Focused ↔ Life-Balance | Life-Balance |
| ... | ... |

数据存储

所有数据都存储在本地:

~/.openpersonality/
├── config.json
└── profiles/{id}/
    ├── profile.json    # Structured data (source of truth)
    ├── SOUL.md         # Generated personality document
    └── IDENTITY.md     # Generated identity document

没有数据发送到外部服务器。目录权限设置为 0700 (仅限所有者)。

平台兼容性

平台 交通 自主更新
克劳德桌面/Claude代码 MCP(stdio) 自主工具调用
光标/风冲浪/临床 MCP(stdio) 代理模式
VS代码/GitHub副本 MCP(stdio) 代理模式
Gemini CLI MCP(stdio) 自动工具调用
OpenAI代理SDK MCP(stdio) 代理循环
OpenClaw MCP+技能 技能自动调用
ChatGPT MCP(流式HTTP) 计划的

发展

pnpm install    # Install dependencies
pnpm build      # Build all packages
pnpm typecheck  # Type check
pnpm test       # Run tests
pnpm clean      # Clean build artifacts

隐私

  • 所有配置文件数据都保留在您的计算机上(~/.openpersonality/)
  • MCP服务器使 零 外部API调用
  • 不需要API密钥-方面估计由人工智能代理自己的LLM完成
  • 人口统计数据可能包含个人信息——个人资料仅以所有者权限存储

许可证

麻省理工学院