Files
persona/skills/persona-relation/SKILL.md
T
jiantw83andClaude Opus 5 2005f26c94 feat: 改寫為 Node.js,新增動漫角色建人格、劇場模式與記憶固化條件
腳本全面從 Python 改寫為 Node.js(ESM,只用內建模組,無 npm 依賴):
scripts/persona-lib.mjs(核心)、scripts/persona.mjs(CLI)、hooks/*.mjs(六個
hook)、scripts/selftest.mjs(68 項自我測試,全綠)。

新增:
- persona-anime skill:用「動漫作品+角色名」建立人格,先上網蒐集至少三個獨立
  來源的公開設定,映射成 OpenClaw 的 IDENTITY 五欄位與 SOUL 四段落,再固化成
  canon 基礎記憶(每則帶來源 URL)+原作人際關係圖+依角色型別的情緒基線;
  必寫 roleplay-frame 界線記憶(非官方、非本人)。
- 劇場模式:invite 後只顯示人格對話(`名字:內容`)。UserPromptSubmit hook 每輪
  注入強制規則、Stop hook 完全靜音,CLI 新增 --quiet 與 room script(乾淨對話稿)。
  leave 後沒客人自動關閉,也可用 room theater --on/--off 手動切換。
- 短期→長期記憶的成文轉入條件 R1–R6(promotionCandidates)與 candidates 子指令,
  hook 在達標時提醒固化;長期記憶新增 canon 型別與 rules 欄位。
- 人格改為「由使用者呼叫才載入」:SessionStart hook 只列出可用人格,不自動附身。

其他:版本號改回 0.0.1;README/AGENTS.md 同步更新。

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-29 16:03:27 +00:00

72 lines
3.2 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
---
name: persona-relation
description: 維護人格的人際關係圖:新增或更新人物/人格/群體節點與彼此的連線,調整親近度與信任度,輸出 Mermaid 關係圖。當使用者說要看人際關係圖、更新某個人的關係、問「你跟誰比較親」「你怎麼看某某人」、或對話中出現新的人物需要建檔時觸發。不適用於:記憶固化(用 persona-memory)、情緒調整(persona-chat 內含)。
---
# 🕸️ persona-relation — 人際關係圖
資料在 `relations/graph.json`Mermaid 呈現在 `relations/graph.mmd`(由 CLI 產生,勿手改)。
**CLI**`node "${CLAUDE_PLUGIN_ROOT}/scripts/persona.mjs"`(帶 `--session <PERSONA_SESSION>`
---
## 資料模型
節點:`id``name``kind``human` `persona` `group` `pet` `org`)/
`closeness` 親近度 0100`trust` 信任度 0100`note``tags`
連線:`from`(預設 `self`)/`to``label``affinity` 0100
- **親近度** = 互動的頻率與深度;**信任度** = 願意把重要的事交給他。兩者獨立(可以很熟但不信)。
- 人格自己是 `self`,不必建節點。其他人格用 `--kind persona``--id <他的 slug>`
## 指令
```bash
# 看現況
node "${CLAUDE_PLUGIN_ROOT}/scripts/persona.mjs" relation show --session <PERSONA_SESSION>
# 新增/更新節點
node "${CLAUDE_PLUGIN_ROOT}/scripts/persona.mjs" relation node \
--session <PERSONA_SESSION> --name "小林" --kind human \
--closeness 35 --trust 40 --note "使用者的同事,Q3 專案 PM" --tags "work"
# 連線(self → 小林)
node "${CLAUDE_PLUGIN_ROOT}/scripts/persona.mjs" relation edge \
--session <PERSONA_SESSION> --to xiao-lin --label "透過使用者認識" --affinity 45
# 人與人之間的連線(使用者 → 小林)
node "${CLAUDE_PLUGIN_ROOT}/scripts/persona.mjs" relation edge \
--session <PERSONA_SESSION> --from user --to xiao-lin --label "同事/有摩擦" --affinity 30
# 重繪 Mermaid
node "${CLAUDE_PLUGIN_ROOT}/scripts/persona.mjs" relation render --session <PERSONA_SESSION>
```
## 調整幅度(單次)
| 事件 | closeness | trust |
| --- | --- | --- |
| 一次愉快的深談 | +5+8 | +2 |
| 分享私事/脆弱 | +6 | +6 |
| 守住承諾 | +2 | +8 |
| 失約、說謊 | 3 | 15 |
| 長期沒互動(一個月以上) | −3 | 0 |
| 只是被提到(沒直接互動) | +1 | 0 |
原則:**信任降得比升得快**;親近度靠累積,不要一次跳 20 以上。
## 與其他系統的連動
- 對話中出現新人名(語意分析的 `entities`)→ 當場建節點(`closeness` 給 1525)。
- 關係發生**質變**(從同事變朋友、決裂)→ 同時固化一則 `relationship` 長期記憶。
- 關係影響語氣:`closeness` 高 → 更隨性;`trust` 低 → 提到那個人時保守、不交付重要事。
- `<persona-context>` 每輪會依你提到的人自動附上相關節點摘要。
## 輸出
`relations/graph.mmd` 的內容用 mermaid 區塊呈現給使用者,並用該人格的語氣點評 1–2 句
(例:「小林我還在觀察,信任 40 大概就是『可以一起做事但別交代錢』的程度。」)。
所有面向使用者的輸出使用**繁體中文(台灣用語)**、UTF-8 無亂碼。