NOHNAINOHNAI
文档中心Documentation
返回工作台Back to Workbench
首页Home/文档中心Documentation/SPL Agent EngineSPL Agent Engine

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.

版本Version:v1.0 运行方式Runtime纯 JavaScript · 零 IO · 可嵌入任意运行时Pure JS · zero IO · embeddable

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.

核心承诺Core Promise 相同初始状态 + 相同事件序列 = 完全相同的结果: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.
拟人化智能体引擎工作台界面
图 1Figure 1 引擎主界面:上方为自然语言对话区,下方为实时演示面板,可观察因果事件如何驱动 8 维情绪与 12 层心理状态。Engine main UI: natural-language chat on top, live demo panel below showing how causal events drive 8D emotions and 12-layer psyche.

2. 快速上手2. Quick Start

1

打开工作台Open the Workbench

进入 your-soulmate 页面,顶部导航可切换中 / EN、🌓 深色主题。Open your-soulmate; switch 中 / EN and 🌓 dark theme from the top nav.

2

自然语言对话Chat Naturally

点击「打招呼 / 夸夸它 / 打击它 / 承诺 / 背叛」等事件按钮,观察 8 维情绪实时变化。Click event buttons like Greet, Praise, Blame, Promise, Betray and watch the 8D emotions move in real time.

3

实时演示场景Live Demo Scenarios

选择智能客服 / 虚拟陪伴 / 游戏 NPC / 教育助手,触发事件序列,看因果链传播。Pick customer service, companion, game NPC or tutor, fire event sequences and trace causal chains.

4

养成模式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.

5

白箱分析White-Box Analysis

打开「白箱分析」,逐层查看身份 / 目标 / 价值观、世界信念与事件模拟器,手动调节心理参数。Open White-Box Analysis to inspect identity, goals, values, world beliefs and the event simulator; tune psychological parameters manually.

自然语言对话界面
图 2Figure 2 自然语言对话区:输入语句或点击快捷按钮,每句话都会作为因果事件注入引擎,驱动 8 维情绪与长期状态变化;可选接入大模型驱动自然语言回复。Natural-language chat: type or click quick-action buttons; every utterance is injected as a causal event that drives 8D emotions and long-term state. An optional LLM generates natural-language replies.

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
8维情绪流体雷达图与关键指标
图 3Figure 3 8 维情绪流体面板:雷达图实时显示喜 / 怒 / 哀 / 惧 / 惊 / 厌 / 信 / 期八维情绪值,下方以数值形式显示信任、自尊、认知失调、隐压、创伤电荷等关键慢变量。8D Emotion Fluid panel: the radar shows joy, anger, grief, fear, surprise, disgust, trust and anticipation in real time; below, slow variables like trust, self-esteem, dissonance, hidden pressure and trauma charge are displayed numerically.

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τ ≈ 180dAgent 对自身身份的持续建构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.

因果链追踪面板
图 4Figure 4 因果链追踪面板:每一次事件触发都会以时间戳、事件名、受影响层级与数值变化的形式逐行记录。点击事件按钮即可观察事件 → 快系统 → 慢系统的完整传播路径,每一步变化都可查账。Causal Chain panel: every event is logged line-by-line with timestamp, event name, affected layers and numeric deltas. Click any event button to see the full propagation path event → fast system → slow system — every step is auditable.

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:

养成模式小因蛋界面
图 5Figure 5 养成模式:顶部为宠物身份、时钟与心情/精力/信任/隐压四条需求条;中央画布实时渲染小因蛋形象,气泡显示它当下的「台词」;右侧栏展示随艾宾浩斯曲线变淡的记忆珠、你们的约定以及内心因果链;底部为照护动作、照护强度滑杆与快进/睡眠/存档等工具。Raising Mode: the top shows pet identity, clock, and four need bars (mood, energy, trust, hidden pressure); the center canvas renders Xiaoyin in real time with a speech bubble; the right column shows memory beads fading along an Ebbinghaus curve, your promise, and the inner causal chain; the bottom has care actions, intensity slider and fast-forward/sleep/save tools.

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)
花多少钱Cost0 yuan几亿元hundreds of millions
谁说了算Who decides你定的规则Your rulesAI 自己发挥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.

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.

白箱分析与心理参数调节面板
图 6Figure 6 白箱分析面板:上方三栏分别是 8 维情绪雷达 + 关键指标、因果链追踪、Agent 心理变化时序图;下方展示身份/目标/价值观等子系统状态,以及事件模拟器与心理参数调节区——可一键应用乐观 / 偏执 / 创伤后 / 缺觉预设,也可通过滑杆手动精细调整每一项偏见与心理变量。White-Box Analysis panel: the three top columns are the 8D emotion radar + key metrics, causal-chain trace, and psyche time-series; below are subsystem states (identity/goals/values), the event simulator and the psychological parameter panel — apply one-click presets (optimistic/paranoid/post-trauma/sleep-deprived) or fine-tune every bias and psychological variable via sliders.

3.7 API 集成:3 行代码接入3.7 API Integration in 3 Lines

性能Performance 单步推演 <1ms · 内存/Agent <1MB · 吞吐量 10 万/s · 零 IO 依赖 · 可复现性 100% Single-step inference <1ms · memory/agent <1MB · throughput 100k/s · zero IO · 100% reproducibility

引擎纯计算、无 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)