中文 | English
MimirLink 是一个面向 QQ 场景的 Tavern 运行时,重点放在长期记忆、角色生命周期管理和后台可观测性上。
它通过 OneBot 接入 QQ,支持兼容 SillyTavern 的角色卡与世界书,并使用 SQLite 持久化记忆,让会话、摘要和角色绑定数据库在重启后仍能保留。
- 使用 SQLite 持久化长期记忆,而不是一次性内存上下文
- 支持多种记忆作用域模式:
user_persistent:同一用户跨群与私聊共享长期记忆group_user:群内每个用户独立记忆group_shared:整个群共享同一份记忆global_shared:所有流量共享同一份记忆
- 角色级数据库绑定与解绑
- 数据库迁移工具
- 世界书支持,包含 sticky 条目与摘要感知提示词
- 输入/输出正则处理流水线
- 运维与诊断 Web 控制面板
- OpenAI 兼容上游的模型探测与元数据查看
- TTS 语音支持
- TTS 语音缓存自动定时清理
MimirLink 围绕四个核心理念构建:
- 记忆作用域必须显式可控
- 角色切换必须带上数据库策略
- 数据库必须可管理,而不是隐藏文件
- 路由与记忆行为必须能在后台面板里观察到
- 存储:SQLite
- 摘要:按会话保留
- 全局上限:带裁剪策略
- 失败安全:用户入站消息会先持久化,再进入 AI 生成流程
- 从 PNG 导入角色卡
- 可选导入世界书、预设和兼容正则元数据
- 为角色绑定独立数据库
- 支持绑定自定义数据库路径
- 可解绑回默认数据库
- 删除角色时支持保留数据库或迁移数据库
- 仪表盘可查看:
- 当前角色
- 当前世界书
- 当前记忆数据库
- 访问控制模式
- 记忆作用域说明
- 数据库清单可查看:
- 路径
- 文件大小
- 更新时间
- 绑定关系
- 会话 / 消息 / 摘要数量
- 记忆迁移面板支持:
- 源数据库
- 目标数据库
- Session ID
- Session 前缀
- 用户 ID
- 覆盖模式
npm install
npm start默认后台地址:http://localhost:8001
关键运行配置包括:
onebot:QQ 连接配置ai:模型、API 地址、超时、token 配置chat.sessionMode:记忆作用域策略chat.accessControlMode:allowlist、blocklist或disabledmemory.storage.path:默认记忆数据库路径memory.participantProfile.triggerMessages:人物档案累计多少条新增消息后才进入异步建档候选memory.participantProfile.idleMs:人物档案在会话空闲多久后触发异步增量建档bindings.global.memoryDbPath:全局默认数据库覆盖路径bindings.characters.*.memoryDbPath:角色级数据库路径- TTS 音频缓存会自动清理:
- 每 10 分钟巡检一次
- 删除超过 24 小时的缓存
- 最多保留最新 50 个
tts_文件
大多数部署场景建议:
sessionMode = user_persistentaccessControlMode = allowlist- 保留一个全局默认数据库
- 只为确实需要隔离长期记忆的角色建立独立数据库
当前项目重点优化方向:
- 持久化记忆
- 数据库生命周期管理
- 角色 / 设定运行时管理
- 后台面板可观测性
- OneBot / NapCat 风格 QQ 接入
- SillyTavern 角色卡
- SillyTavern 兼容世界书
- OpenAI 兼容模型接口
MimirLink 已经不再只是 Tavern-Link 的记忆增强变体。
它目前正在收敛成一个更偏向“记忆 + 生命周期 + 运维”的 QQ 角色运行时,重点包括:
- 作用域化的持久记忆
- 角色级数据库策略
- 数据库迁移流程
- 面板级可观测性
MimirLink is a QQ Tavern runtime focused on long-term memory, character lifecycle management, and operational visibility.
It connects QQ via OneBot, supports SillyTavern-compatible character cards and world books, and stores memory in SQLite so sessions, summaries, and character-bound databases survive restarts.
- Persistent SQLite memory instead of throwaway in-memory context
- Multiple memory scope modes:
user_persistent: one user keeps memory across groups and private chatsgroup_user: each user has isolated memory inside a groupgroup_shared: the whole group shares one memory spaceglobal_shared: all traffic shares one memory space
- Character-level database binding and unbinding
- Memory migration between databases
- World book support with sticky entries and summary-aware prompting
- Regex pipeline for input/output processing
- Web control panel for operations, diagnostics, and configuration
- Model discovery and metadata probing from OpenAI-compatible upstreams
- TTS support
- Scheduled cleanup for cached TTS audio files
MimirLink is built around four ideas:
- Memory scope should be explicit
- Character switching should include database strategy
- Databases should be manageable, not hidden files
- Routing and memory behavior should be observable from the panel
- Storage: SQLite
- Summaries: retained per session
- Global limit: enforced with pruning
- Failure-safe inbound capture: user messages are persisted before AI completion
- Import character cards from PNG
- Optionally import world book, preset, and regex-compatible metadata
- Bind a dedicated database per character
- Bind a custom database path
- Unbind back to the default database
- Delete character with database retention or migration choices
- Dashboard shows:
- active character
- active world book
- active memory database
- access control mode
- memory scope description
- Database inventory shows:
- path
- file size
- update time
- binding relations
- sessions/messages/summaries count
- Memory migration panel supports:
- source database
- target database
- session IDs
- session prefix
- user ID
- replace mode
npm install
npm startOpen the panel at http://localhost:8001 by default.
Important runtime areas:
onebot: QQ connectionai: model, API endpoint, timeout, tokenschat.sessionMode: memory scope strategychat.accessControlMode:allowlist,blocklist, ordisabledmemory.storage.path: default memory database pathmemory.participantProfile.triggerMessages: how many new messages a participant must accumulate before async profile updates become eligiblememory.participantProfile.idleMs: how long the session must stay idle before the async participant profile update runsbindings.global.memoryDbPath: global default database overridebindings.characters.*.memoryDbPath: per-character memory database- TTS audio cache is cleaned automatically:
- scheduled sweep every 10 minutes
- files older than 24 hours are removed
- only the newest 50
tts_files are kept
For most deployments:
sessionMode = user_persistentaccessControlMode = allowlist- keep a global default database
- create dedicated databases only for characters that need isolated long-term memory
The project is currently optimized around:
- durable memory
- database lifecycle
- role/character operations
- observability from the admin panel
- OneBot / NapCat style QQ integration
- SillyTavern character cards
- SillyTavern-compatible world books
- OpenAI-compatible model endpoints