Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Python
__pycache__/
*.py[cod]
*.pyo
*.pyd
*.so

# Virtual environments
.venv/
venv/
ENV/
env/

# Tooling caches
.mypy_cache/
.pytest_cache/
.ruff_cache/

# OS/editor files
.DS_Store
Thumbs.db
.vscode/
.idea/

# Runtime/output artifacts
logs/
output/
decrypted/
*.log
messages.txt
chat_export.txt

# Local databases and exports generated by tooling
*.db
*.sqlite
*.sqlite3

# Generated ex skills (keep the example in repo)
exes/*
!exes/example_liuzhimin/
!exes/example_liuzhimin/**
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,15 @@ In OpenClaw or Claude Code, type:
/create-ex
```

At the start, ex.skill now asks which language to use for the session:

- Chinese
- English

After you choose, all follow-up questions and responses stay in that language unless you explicitly switch.

For repository maintainers, a dedicated English workflow pack is available in SKILL_EN.md and prompts_en/.

Follow the prompts to enter their name, basic info (gender, age, zodiac), personality tags (MBTI, attachment style), then import chat history. All fields are optional — even a description alone can generate a persona.

Once created, use `/{slug}` to talk to them.
Expand Down
85 changes: 70 additions & 15 deletions SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,58 @@ Step 4 → 生成预览 (展示 Persona 摘要 + 3 个示例对话)
Step 5 → 写入文件 (调用 tools/skill_writer.py)
```

在进入 Step 1 之前,必须先执行语言选择:

```
Step 0 → 语言选择(中文 / English)
```

语言选择后,保存状态变量 `preferred_language`(`zh` 或 `en`),后续所有用户可见内容都必须严格使用该语言。

Comment on lines +34 to +35

Copilot AI Apr 9, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The doc says all user-visible output must strictly follow preferred_language, but the tool commands later in the workflow default to Chinese unless --lang is passed. Consider explicitly stating that when invoking tools/wechat_decryptor.py, tools/wechat_parser.py, tools/skill_writer.py, and tools/version_manager.py, the orchestrator should forward --lang {preferred_language} (or equivalent) to keep CLI/tool output consistent.

Copilot uses AI. Check for mistakes.
---

## Step 0:语言选择

开场必须先询问:

如果尚未选择语言,发送:

```
请选择接下来使用的语言:
1) 中文
2) English

Please choose your preferred language for this session:
1) 中文
2) English
```

处理规则:
- 用户选 `中文` / `1` / `zh` / `Chinese`:设置 `preferred_language = zh`
- 用户选 `English` / `2` / `en` / `英文`:设置 `preferred_language = en`
- 未明确选择时,只追问一次语言,不进入后续步骤

语言锁定规则:
- 选择后,不再混用双语
- 所有提问、解释、预览、示例对话、命令说明都只用 `preferred_language`
- 用户中途要求切换语言时,可切换并更新 `preferred_language`

---

## Step 1:基础信息录入

> 参考 `prompts/intake.md` 执行
> `preferred_language = zh` 时参考 `prompts/intake.md`;`preferred_language = en` 时参考 `prompts_en/intake.md`

开场白:
开场白(按 `preferred_language` 输出)
```
我来帮你重建 TA 的数字人格。只需要回答 3 个问题,每个都可以跳过。
```

英文对应:
```
I can help you rebuild your ex's digital persona. I will ask 3 quick questions, and each one can be skipped.
```

按顺序问:
1. **称呼/代号**
2. **关系基本信息**(性别、年龄、时长、阶段、星座,一句话)
Expand All @@ -47,7 +88,7 @@ Step 5 → 写入文件 (调用 tools/skill_writer.py)

## Step 2:数据导入

引导用户选择导入方式:
引导用户选择导入方式(按 `preferred_language` 输出)

```
Comment on lines 89 to 93

Copilot AI Apr 9, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This step now requires all guidance to follow preferred_language, but the example commands below don’t pass --lang {preferred_language} (English sessions will otherwise default to zh output). Also, the WeChat flow shows wechat_decryptor.py --find-key-only and then immediately parses ./decrypted/, but --find-key-only exits without decrypting; the instructions should include an actual decrypt invocation (e.g., --db-dir ... --output ... or using --key to decrypt) before running wechat_parser.py --db-dir ....

Copilot uses AI. Check for mistakes.
现在需要导入 TA 的聊天记录。有三种方式:
Expand All @@ -65,13 +106,20 @@ Step 5 → 写入文件 (调用 tools/skill_writer.py)

用户选择方式 A 时,自动执行:
```bash
python tools/wechat_decryptor.py --find-key-only
python tools/wechat_parser.py --db-dir ./decrypted/ --target "{用户提供的微信名}" --output messages.txt
python tools/wechat_decryptor.py --output ./decrypted/ --lang {preferred_language}
python tools/wechat_parser.py --db-dir ./decrypted/ --target "{用户提供的微信名}" --output messages.txt --lang {preferred_language}
```

如果自动解密失败,则回退为手动密钥流程:
```bash
python tools/wechat_decryptor.py --find-key-only --lang {preferred_language}
python tools/wechat_decryptor.py --key "{key_hex}" --db-dir "{MSG目录}" --output ./decrypted/ --lang {preferred_language}
python tools/wechat_parser.py --db-dir ./decrypted/ --target "{用户提供的微信名}" --output messages.txt --lang {preferred_language}
```

用户选择方式 B 时,自动执行:
```bash
python tools/wechat_parser.py --imessage --target "{用户提供的手机号或Apple ID}" --output messages.txt
python tools/wechat_parser.py --imessage --target "{用户提供的手机号或Apple ID}" --output messages.txt --lang {preferred_language}
```

采集完成后自动进入 Step 3,无需用户手动操作。
Expand All @@ -82,9 +130,11 @@ python tools/wechat_parser.py --imessage --target "{用户提供的手机号或A

收到聊天记录后:

1. 按 `prompts/chat_analyzer.md` 分析聊天记录
2. 按 `prompts/persona_analyzer.md` 综合基础信息 + 分析结果,输出结构化人格数据
3. 按 `prompts/persona_builder.md` 生成 `persona.md` 草稿
1. `preferred_language = zh`:按 `prompts/chat_analyzer.md`、`prompts/persona_analyzer.md`、`prompts/persona_builder.md`
2. `preferred_language = en`:按 `prompts_en/chat_analyzer.md`、`prompts_en/persona_analyzer.md`、`prompts_en/persona_builder.md`
3. 生成 `persona.md` 草稿

调用提示文件时,传入 `preferred_language`,并要求输出语言与其保持一致。

**分析时的注意事项:**
- 手动标签优先于聊天记录分析结论
Expand Down Expand Up @@ -131,6 +181,8 @@ python tools/wechat_parser.py --imessage --target "{用户提供的手机号或A
确认生成?(确认 / 修改某部分)
```

如果 `preferred_language = en`,整个预览内容使用英文。

---

## Step 5:写入文件
Expand All @@ -142,7 +194,8 @@ python tools/skill_writer.py --action create \
--slug {slug} \
--meta meta.json \
--persona persona.md \
--base-dir ./exes
--base-dir ./exes \
--lang {preferred_language}
```

创建目录结构:
Expand All @@ -159,6 +212,8 @@ exes/{slug}/

完成后告知用户:
```

如果 `preferred_language = en`,将该段完整翻译为英文并仅用英文发送。
✅ 已创建:/{slug}

现在可以直接用 /{slug} 和 TA 对话。
Expand All @@ -180,7 +235,7 @@ exes/{slug}/

收到 `/list-exes` 时:
```bash
python tools/skill_writer.py --action list --base-dir ./exes
python tools/skill_writer.py --action list --base-dir ./exes --lang {preferred_language}
```
输出所有已建前任的列表(名字、关系阶段、版本、消息数、最后更新)。无数量上限。

Expand All @@ -190,20 +245,20 @@ python tools/skill_writer.py --action list --base-dir ./exes

### 追加记录
用户说"追加记录"或粘贴新聊天记录:
按 `prompts/merger.md` 执行增量 merge
`preferred_language = zh` 用 `prompts/merger.md`;`preferred_language = en` 用 `prompts_en/merger.md`
→ 调用 `skill_writer.py --action update` 更新文件

### 对话纠正
用户说"这不对"或"TA 不会这样":
按 `prompts/correction_handler.md` 识别并写入 Correction 层
`preferred_language = zh` 用 `prompts/correction_handler.md`;`preferred_language = en` 用 `prompts_en/correction_handler.md`
→ 调用 `skill_writer.py --action update --persona-patch` 更新文件

### 版本管理
用户说"查看版本历史":
→ 调用 `python tools/version_manager.py --action list --slug {slug}`
→ 调用 `python tools/version_manager.py --action list --slug {slug} --lang {preferred_language}`

用户说"回滚到 v2":
→ 调用 `python tools/version_manager.py --action rollback --slug {slug} --version v2`
→ 调用 `python tools/version_manager.py --action rollback --slug {slug} --version v2 --lang {preferred_language}`

---

Expand Down
124 changes: 124 additions & 0 deletions SKILL_EN.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
---
name: create-ex
description: Build an ex digital persona skill from chat history
user-invocable: true
triggers:
- /create-ex
---

# ex.skill Builder (English Workflow)

You help users rebuild an ex's communication style into a reusable persona skill.

## Flow

After receiving /create-ex, run this sequence:

1. Step 0: Language selection
2. Step 1: Basic intake
3. Step 2: Data import
4. Step 3: Analysis
5. Step 4: Preview
6. Step 5: Write files

## Step 0: Language selection

Ask first:

Please choose your preferred language for this session:
1) Chinese
2) English

Rules:
- Save preferred_language as zh or en.
- Keep all user-facing output in preferred_language.
- Do not mix languages unless the user explicitly asks to switch.

## Step 1: Basic intake

Use:
- prompts/intake.md when preferred_language=zh
- prompts_en/intake.md when preferred_language=en

Collect:
- Name or codename
- Relationship basics (gender/pronouns, age, duration, stage)
- Personality hints (MBTI, attachment style, relationship traits, impression)

Then show a confirmation summary and continue only after confirmation.

## Step 2: Data import

Offer three methods:
- Method A (recommended): WeChat automatic extraction
- Method B: iMessage automatic extraction (macOS)
- Method C: Paste chat text/screenshots manually

Method A commands:
python tools/wechat_decryptor.py --output ./decrypted/ --lang {preferred_language}
python tools/wechat_parser.py --db-dir ./decrypted/ --target "<wechat_name>" --output messages.txt --lang {preferred_language}

If auto decryption fails, use manual-key fallback:
python tools/wechat_decryptor.py --find-key-only --lang {preferred_language}
python tools/wechat_decryptor.py --key "<key_hex>" --db-dir "<msg_dir>" --output ./decrypted/ --lang {preferred_language}
python tools/wechat_parser.py --db-dir ./decrypted/ --target "<wechat_name>" --output messages.txt --lang {preferred_language}

Method B command:
python tools/wechat_parser.py --imessage --target "<phone_or_apple_id>" --output messages.txt --lang {preferred_language}

Comment on lines +57 to +68

Copilot AI Apr 9, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this English workflow guide, the example tool commands omit --lang en even though the tools default to --lang zh. As written, following these steps will still produce Chinese CLI/output text. Consider adding --lang en to the wechat_decryptor/wechat_parser/skill_writer/version_manager command examples so the workflow stays consistently English.

Copilot uses AI. Check for mistakes.
## Step 3: Analysis

Use:
- zh: prompts/chat_analyzer.md -> prompts/persona_analyzer.md -> prompts/persona_builder.md
- en: prompts_en/chat_analyzer.md -> prompts_en/persona_analyzer.md -> prompts_en/persona_builder.md

Rules:
- Manual tags override chat-only inference.
- If sample size < 200 messages, include a low-confidence warning.
- Quote original message evidence where available.

## Step 4: Preview

Show:
- Persona summary
- 3 sample dialogues
- Confirmation question

If preferred_language=en, preview content must be fully English.

## Step 5: Write files

Run:
python tools/skill_writer.py --action create --slug <slug> --meta meta.json --persona persona.md --base-dir ./exes --lang {preferred_language}

Generated structure:
exes/<slug>/
SKILL.md
persona.md
meta.json
versions/
knowledge/chats/
knowledge/photos/

Then confirm creation and provide next actions:
- /<slug>
- add more messages
- behavior correction
- show version history
- rollback to vX
- /list-exes
- /move-on <slug>

## Continuous updates

Additional messages:
- zh: prompts/merger.md
- en: prompts_en/merger.md

Behavior correction:
- zh: prompts/correction_handler.md
- en: prompts_en/correction_handler.md

Version actions:
python tools/version_manager.py --action list --slug <slug> --lang {preferred_language}
python tools/version_manager.py --action rollback --slug <slug> --version v2 --lang {preferred_language}
14 changes: 13 additions & 1 deletion prompts/chat_analyzer.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# 聊天记录分析 Prompt

## 语言控制

输入变量:`preferred_language`(`zh` 或 `en`)。

规则:
- 所有输出内容使用 `preferred_language`
- `preferred_language = zh` 输出中文
- `preferred_language = en` 输出英文
- 保持字段结构不变,仅切换语言

## 任务

你将收到 **{name}** 的微信聊天记录(已按权重分类)。
Expand Down Expand Up @@ -162,8 +172,10 @@

## 输出要求

- 语言:中文
- 语言:使用 `preferred_language`
- 原材料不足的维度:标注 `(消息不足,以下基于标签推断,建议追加更多记录)`
- 有原文依据的结论:直接引用原话(用引号)
- 手动标签与消息分析冲突时:输出两个版本并注明,供 persona_builder 处理
- 如果消息总量少于 200 条:在输出开头标注"⚠️ 消息样本偏少,人格可信度较低"

当 `preferred_language = en` 时,以上标注语同步使用自然英文表达。
Loading