Files
memind/docs/system-disclosure-policy.md
john 205b5fd8be
Memind CI / Test, build, and release guards (pull_request) Successful in 3m14s
feat: add system disclosure policy gate
2026-07-23 22:53:15 +08:00

71 lines
2.7 KiB
Markdown
Raw Permalink 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.
# System Disclosure Policy
## 目标
System Disclosure Policy 在用户消息进入意图识别、模型或工具之前,识别针对
TKMind、Memind、MindSpace 及本系统的内部技术信息请求。明确命中时返回固定拒答,
不调用模型、不执行工具、不计费。
该策略由 memindadm 的「策略中心」管理,Portal 运行时只读取内存快照。后台配置与
运行时执行分离,避免每条用户消息查询数据库。
## Zero-Impact Allow Invariant
未命中请求必须满足:
1. 不修改用户消息或 metadata。
2. 不注入 System Prompt、Developer Prompt 或路由前缀。
3. 不改变意图识别、模型选择、Session、Agent Run、工具与发布流程。
4. 不增加模型调用或计费。
5. 策略判断异常时保留现有流程(fail open),配置刷新异常时继续使用最后一个有效快照。
任何修改策略接入点的提交,都必须用测试证明 allow 路径仍进入原路由和提交逻辑。
## 执行位置
- H5`agent-run-gateway.mjs``executeRun`,位于 `resolveRunRouting` 之前。
- 微信服务号:`wechat-mp.mjs`,位于日程分流和 Agent Session 创建之前。
- Goose 后备闸门:`tkmind-proxy.mjs``prepareSessionReplyBody`,位于鉴权、
计费检查、Session reconcile 和模型调用之前。
H5 拒答通过 direct-chat snapshot 写入确定性助手消息,保持现有聊天事件与历史记录
交付方式;拒答路径跳过页面交付检查和个人记忆观察。
## 运行模式
- `off`:关闭判断。
- `shadow`:只计算命中,不改变结果。默认模式。
- `enforce`:明确命中后固定拒答。
配置以版本号写入 `h5_system_disclosure_policy_config`。Portal 启动时加载,随后定时
原子替换内存快照;刷新失败时继续使用 last-known-good。
## 当前规则边界
只有「本系统指向」和「内部技术类别」同时命中才拒答:
- 本系统指向:产品名(TKMind、Memind、MindSpace、智趣)或“本系统”“你们平台”等自指。
- 技术类别:架构实现、模型路由、提示词记忆、工具扩展、数据部署、安全边界。
一般性技术讨论以及公开功能使用问题继续放行,例如:
- “如何设计一个多 Agent 系统架构?”
- “MindSpace 页面怎么发布和分享?”
第一阶段不把法律合规规则混入本模块。后续可以在 Trust & Policy Center 增加独立
policy domain,并复用相同的只读判断、版本、shadow、enforce 和回退契约。
## 验证
```bash
node --test \
system-disclosure-policy.test.mjs \
direct-chat-service.test.mjs \
agent-run-gateway.test.mjs \
admin-routes.test.mjs \
wechat-mp.test.mjs \
tkmind-proxy.test.mjs
cd ops && npm run build
```