SPL Agent Engine · 用户指南SPL Agent Engine · User Guide
用因果动力学重新定义 Agent 的状态演化机制:确定性人格、12 层连续记忆、可审计偏见。不再是给大模型打补丁,而是从底层范式解决概率偏移、短时记忆与 AI 偏见三大顽疾。A deterministic causal-dynamics engine that replaces probabilistic drift with reproducible state evolution: a fixed persona, 12-layer continuous memory, and auditable, tunable bias.
1. 产品简介1. Overview
SPL Agent Engine 是一套「决定论因果拓扑」驱动的拟人化智能体引擎。它把 AI 的内部状态建模为一套 12 层心理动力学系统:每一句话都会被解析为因果事件,事件沿因果拓扑网络确定性传播,实时改变 8 维情绪与信任、自尊、创伤等长期变量。SPL Agent Engine is a deterministic causal-topology engine for anthropomorphic agents. It models the agent’s internal state as a 12-layer psychodynamic system: every utterance is parsed into causal events that propagate deterministically through the network, updating 8-dimensional emotions and long-term variables such as trust, self-esteem and trauma.
f(stateₙ, event) → stateₙ₊₁,纯函数、无随机、可复现、可测试、可审计。
Same initial state + same event sequence = exactly the same outcome: f(stateₙ, event) → stateₙ₊₁. Pure function, no randomness, reproducible, testable, auditable.
2. 快速上手2. Quick Start
打开工作台Open the Workbench
进入 your-soulmate 页面,顶部导航可切换中 / EN、🌓 深色主题。Open your-soulmate; switch 中 / EN and 🌓 dark theme from the top nav.
自然语言对话Chat Naturally
点击「打招呼 / 夸夸它 / 打击它 / 承诺 / 背叛」等事件按钮,观察 8 维情绪实时变化。Click event buttons like Greet, Praise, Blame, Promise, Betray and watch the 8D emotions move in real time.
实时演示场景Live Demo Scenarios
选择智能客服 / 虚拟陪伴 / 游戏 NPC / 教育助手,触发事件序列,看因果链传播。Pick customer service, companion, game NPC or tutor, fire event sequences and trace causal chains.
养成模式Raising Mode
养一只「小因蛋」:设照护强度、快进时间、睡觉,看信任与隐压如何随艾宾浩斯曲线演化;随时存档 / 读档 / 重置。Raise “Xiaoyin”: set care intensity, fast-forward hours, sleep — watch trust and hidden pressure evolve along a forgetting curve; save, load or reset anytime.
白箱分析White-Box Analysis
打开「白箱分析」,逐层查看身份 / 目标 / 价值观、世界信念与事件模拟器,手动调节心理参数。Open White-Box Analysis to inspect identity, goals, values, world beliefs and the event simulator; tune psychological parameters manually.
3. 核心机制3. Core Mechanics
3.1 8 维情绪流体3.1 8-Dimensional Emotion Fluid
快系统(秒级响应)实时表征情绪状态,与其他关键指标一起显示在演示面板:The fast system (second-level response) represents emotional state in real time, shown alongside key indicators on the demo panel:
| 指标Indicator | 含义Meaning | 典型驱动事件Typical Drivers |
|---|---|---|
| 信任 (trust)Trust | 对交互对象的信任程度,受信任上限约束Trust toward the counterpart, capped by the trust ceiling | 承诺兑现 ↑;背叛 ↓Kept promises ↑; betrayal ↓ |
| 自尊 (self-esteem)Self-esteem | 自我价值感,慢变量(约 7 天)Sense of self-worth; slow variable (~7 days) | 表扬 ↑;贬低 ↓Praise ↑; belittlement ↓ |
| 认知失调Cognitive dissonance | 信念冲突检测,驱动消解行为Belief-conflict detector that drives resolution | 言行不一 / 角色冲突Hypocrisy / role conflict |
| 隐压Hidden pressure | 累积压力,防御机制触发阈值Accumulated pressure; triggers defenses | 持续负面事件 ↑;休息 ↓Persistent negativity ↑; rest ↓ |
| 创伤电荷Trauma charge | 最深层的记忆残留(约 1 年时间常数)Deepest memory residue (~1-year constant) | 重大背叛 / 遗弃Major betrayal / abandonment |
3.2 12 层心理系统:连续动力学3.2 12-Layer Psyche: Continuous Dynamics
从快到慢、从表到深共 12 层,每层有独立时间常数(秒级 ~ 年级)。快系统积分驱动慢系统漂移,形成完整的时间尺度层级。Twelve layers from fast-shallow to slow-deep, each with its own time constant (seconds to years). Fast systems integrate and drift slow systems, forming a full temporal hierarchy.
| № | 层Layer | 时间常数Time Constant | 作用Role |
|---|---|---|---|
| 1 | 情绪层(8 维流体)Emotion (8D fluid) | τ ≈ 10s | 快系统,秒级响应Fast system, second-level response |
| 2 | 心境层Mood | τ ≈ 1h | 情绪的积分结果Integrator of emotions |
| 3 | 生理层Physiology | τ ≈ 4h | 能量 / 压力 / 睡眠 / 饥饿,昼夜节律Energy, stress, sleep, hunger; circadian rhythm |
| 4 | 防御机制层Defense mechanisms | τ ≈ 1min | 压抑 / 投射 / 合理化 / 否认等 12 种心理防御Repression, projection, rationalization, denial — 12 defenses |
| 5 | 自尊层Self-esteem | τ ≈ 7d | 受成功 / 失败 / 评价影响的自我价值感Self-worth driven by success, failure, appraisal |
| 6 | 信任层Trust | τ ≈ 30d | 信任度 + 信任上限(创伤后下降),关系核心Trust + ceiling (drops after trauma); relational core |
| 7 | 创伤层Trauma | τ ≈ 1y | 创伤电荷累积,触发闪回与回避Trauma charge; triggers flashbacks and avoidance |
| 8 | 认知失调层Cognitive dissonance | τ ≈ 2h | 信念冲突检测与消解Belief-conflict detection & resolution |
| 9 | 期望层Expectations | τ ≈ 1d | 对未来预期模型,影响情绪与决策Forward-looking model; shapes emotion & decisions |
| 10 | 价值观层Values | τ ≈ 90d | 核心价值观权重,决定行为优先级Core value weights; behavior priority |
| 11 | 自我叙事层Self-narrative | τ ≈ 180d | Agent 对自身身份的持续建构Ongoing identity construction |
| 12 | 存在层Existential | τ ≈ 365d | 意义感、目的感、存在焦虑Meaning, purpose, existential anxiety |
3.3 因果链追踪:零概率 · 全追溯3.3 Causal Chain: Zero-Probability, Fully Traceable
「因果链」面板记录每一步状态变化及其完整传播路径。点击事件按钮后,8 维情绪、关键指标与因果链实时刷新,每一步变化都可查账。The Causal Chain panel records every state change and its full propagation path. Click an event button and the 8D emotions, key indicators and causal chain refresh in real time — every step is auditable.
f(stateₙ, event) → stateₙ₊₁ // 纯函数 · 无随机 · 可复现
f(stateₙ, event) → stateₙ₊₁ // pure function · deterministic · reproducible
子系统状态(身份 / 目标 / 价值观)由 feature/*.py 转译并实时显示;背叛、指责等事件会直接冲击 dignity · loyalty · honesty 等核心价值观;世界信念层「信任他人」会因负面经验下降、正面经验缓慢回升。Subsystem state (identity / goals / values) is compiled from feature/*.py and shown live; betrayal or blame directly hits values like dignity · loyalty · honesty; the “trust others” world belief falls on negative experience and recovers slowly on positive experience.
3.4 养成模式3.4 Raising Mode
同一只宠物,你怎么养,它就长成什么性格——每一步都能翻因果链查账。核心机制:Raise one pet and it grows the personality you cultivate — every step is an auditable causal chain. Core mechanics:
- 记忆珠 · 艾宾浩斯曲线Memory Beads · Ebbinghaus curve:「你们的约定」等记忆随时间自然变淡,符合艾宾浩斯遗忘曲线。Memories like “the promise we made” fade naturally over time along an Ebbinghaus forgetting curve.
- 照护强度Care intensity:调节 0–1,决定照护行为的力度与效果。Adjust 0–1 to control the strength and effect of care actions.
- 时间流转Time flow:快进 1 小时、睡一晚,观察慢变量的演化。Fast-forward 1 hour or sleep a night and watch slow variables evolve.
- 存档 / 读档 / 重置Save / Load / Reset:随时保存成长状态,或重置重新开始。Persist progress anytime, or reset to start over.
3.5 范式对比:造钟 vs 雇报时员3.5 Clock vs Clock-Watcher
同一个目标——让 AI 有「人心」——两条路做法完全相反:Two radically different paths to one goal — giving AI a “heart”:
| 比什么Dimension | 造钟(SPL)The Clock (SPL) | 雇报时员(LLM 方案)Clock-Watcher (LLM) |
|---|---|---|
| 花多少钱Cost | 0 元yuan | 几亿元hundreds of millions |
| 谁说了算Who decides | 你定的规则Your rules | AI 自己发挥AI improvises |
| 稳不稳Stability | 永远一样Always identical | 每次可能不同Different every time |
| 能看透吗Transparency | 全透明Fully transparent | 黑箱,看不了Black box |
| 怎么调性格Tuning personality | 改个数字Change a number | 改段描述Rewrite a description |
| 造的是什么What is built | 地基The foundation | 装修The decor |
为什么 LLM 原生 Agent 解决不了三个问题:不是调参问题,是底层范式问题——概率生成模型的本质缺陷无法通过 prompt engineering 或 RAG 根治。Why native LLM agents can’t solve the three problems: it’s not a tuning issue but a foundational paradigm issue — the inherent flaws of probabilistic generative models cannot be cured by prompt engineering or RAG.
- 黑箱 · 不可控:每轮对话都是概率采样,同输入不同输出;长期运行后人格、立场、知识一致性逐步漂移,无法锚定。Black box · uncontrollable: every turn is a probabilistic sample; Drift grows over long runs; persona and knowledge cannot be anchored.
- 转身就忘:上下文窗口有限,超出即遗忘;RAG 是「查资料」不是真正的状态连续——创伤、信任、心境等慢变量无法持久化。Forgets instantly: bounded context window; RAG is lookup, not state continuity — slow variables like trauma and trust can’t persist.
- 有偏见改不了:训练数据中的偏见被概率化放大,来源不可追溯,只能靠 RLHF 事后压制。Untunable bias: training-data bias is amplified probabilistically; untraceable, only suppressed post-hoc by RLHF.
3.6 偏见显式化:看得见,能调能关3.6 Explicit Bias: Visible, Tunnable, Zeroable
所有认知偏见(乐观偏见、确认偏见…)都是可配置的显式参数:来源可追溯,大小可精确调控,甚至可以设为零实现完全理性。责任闭环锚定到具体参数节点,而非黑箱概率。All cognitive biases (optimism, confirmation…) are explicit configurable parameters: traceable source, precisely tunable, and can be zeroed for full rationality. Accountability anchors to concrete parameter nodes, not black-box probabilities.
bias = optimism + confirmation // 显式 · 可追溯 · 可归零
bias = optimism + confirmation // explicit · traceable · zeroable
心理参数调节面板提供预设:乐观人格、偏执人格、创伤后、缺觉状态,可手动精细调整。The psychological parameter panel ships presets — optimistic, paranoid, post-trauma, sleep-deprived — and supports fine manual tuning.
3.7 API 集成:3 行代码接入3.7 API Integration in 3 Lines
引擎纯计算、无 IO,可嵌入任何运行时(Web / Node / 服务端)。工作台顶部「接入文档」章节展示完整 API 用法,支持厂商选择与大模型驱动的回复切换。The engine is pure computation with no IO and embeds in any runtime (Web / Node / server). The “Docs” section in the workbench nav shows full API usage, including provider selection and LLM-driven replies.
4. 应用场景4. Scenarios
选择一个业务场景,触发事件序列,观察因果链如何确定性地传播。所有状态变化 100% 可追溯。Pick a business scenario, fire an event sequence, and watch causal chains propagate deterministically. Every state change is 100% traceable.
| 场景Scenario | 典型用法Typical Use |
|---|---|
| 智能客服Customer service | 情绪安抚、投诉升级判定、满意度建模Emotion de-escalation, escalation decisions, satisfaction modeling |
| 虚拟陪伴Virtual companion | 长期关系养成、信任建立、记忆持久化Long-term relationship, trust building, persistent memory |
| 游戏 NPCGame NPC | 可复现人设、剧情因果、好感度系统Reproducible persona, story causality, affinity systems |
| 教育助手Education assistant | 耐心与鼓励策略、自尊与认知失调监控Patience & encouragement, self-esteem and dissonance monitoring |
5. 常见问题5. FAQ
Q1:这个引擎需要联网 / API Key 吗?Q1: Does it need network / an API key?
纯前端运行,因果引擎本体零 IO、零外部依赖;API Key 仅用于可选的大模型驱动回复。数据不出本机。Runs fully in-browser; the causal core has zero IO and zero external dependencies. An API key is only needed for the optional LLM-driven replies. No data leaves your device.
Q2:人格会漂移吗?Q2: Does the persona drift?
不会。所有状态变化都是确定性函数驱动,相同输入永远相同输出,长期运行零漂移、可复现、可测试。No. Every state change is a deterministic function — same input always yields the same output, with zero drift over time. Reproducible and testable.
Q3:为什么长对话后它还记得「之前的约定」?Q3: Why does it still remember earlier promises after long chats?
记忆不是存在上下文窗口里,而是存在 12 层连续动力学中:慢系统(信任、自尊、创伤)有月年级时间常数,记忆珠按艾宾浩斯曲线自然衰减而非截断。Memory lives not in a context window but in the 12-layer continuous dynamics: slow systems (trust, self-esteem, trauma) run on month-year constants, and memory beads decay along an Ebbinghaus curve instead of being truncated.
Q4:信任上限是什么?Q4: What is the trust ceiling?
对交互对象信任度的硬上限;经历创伤后上限下降,即使当下表现良好,信任也难以快速回到原来水平——更接近真实的关系动力学。The hard cap on how much trust an agent can hold for a counterpart. After trauma the ceiling drops, so trust cannot quickly return to previous levels even with good behavior — closer to real relational dynamics.
Q5:怎么接入自己的产品或游戏?Q5: How do I integrate it into my product / game?
纯 JS 引擎,3 行代码接入;详见工作台「架构」与「API」章节。支持任意运行时嵌入。Pure JS — 3 lines to integrate; see the Architecture and API sections of the workbench. Embeds in any runtime.
6. 术语表6. Glossary
| 术语Term | 说明Definition |
|---|---|
| 决定论因果拓扑Deterministic causal topology | 状态由确定性函数沿因果边网络传播更新States update via deterministic functions across a causal-edge network |
| 8 维情绪流体8D emotion fluid | 喜 / 怒 / 哀 / 惧 / 惊 / 厌 / 信 / 期Joy / anger / grief / fear / surprise / disgust / trust / anticipation |
| 因果链Causal chain | 事件 → 状态变化的完整可追溯路径Full traceable path from event to state change |
| 信任上限Trust ceiling | 信任的硬上限,创伤后下降Hard cap on trust; drops after trauma |
| 创伤电荷Trauma charge | 创伤记忆的累积强度,触发闪回与回避Accumulated trauma intensity; triggers flashbacks & avoidance |
| 认知失调Cognitive dissonance | 信念冲突的检测量,驱动消解Belief-conflict detector that drives resolution |
| 白箱分析White-box analysis | 逐层查看与手动调节内部状态的面板Panel to inspect and manually tune internal state layer by layer |
| 艾宾浩斯曲线Ebbinghaus curve | 记忆随时间指数衰减的遗忘规律(记忆珠机制)Exponential memory decay over time (memory beads) |
NOHNAI