PSI (Persistent Shared Interface): A shared-state architecture for coherent AI-generated instruments in personal AI agents. Enables cross-module reasoning and synchronized actions across interfaces. Use for: AI agent architecture, shared state design, personal AI systems, tool coordination, multi-module integration. Activation: PSI architecture, shared state, AI agent coordination, personal AI, cross-module reasoning.
Scanned 9/11/2026
Install to Claude Code
npx -y skills add hiyenwong/ai_collection --skill psi-shared-state-architecture --agent claude-codeInstalls into .claude/skills of the current project.
Are you the author of Psi Shared State Architecture?
Add the live security badge to your README — it updates automatically with every re-scan.
[](https://www.skillsdirectory.com/skills/hiyenwong-psi-shared-state-architecture-2302b3c7)More formats (shields.io, HTML) on the badges page.
---
name: psi-shared-state-architecture
description: "PSI (Persistent Shared Interface): A shared-state architecture for coherent AI-generated instruments in personal AI agents. Enables cross-module reasoning and synchronized actions across interfaces. Use for: AI agent architecture, shared state design, personal AI systems, tool coordination, multi-module integration. Activation: PSI architecture, shared state, AI agent coordination, personal AI, cross-module reasoning."
---
# PSI Shared State Architecture
基于论文 "PSI: Shared State as the Missing Layer for Coherent AI-Generated Instruments in Personal AI Agents" (arXiv:2604.08529v1, 2026) 的共享状态架构方法论。
## 核心问题
个人AI工具可以从自然语言请求生成,但生成后往往保持孤立状态。PSI解决了将独立生成的模块转化为连贯工具的问题。
### 现有问题
1. **工具孤岛**: AI生成的模块相互独立,缺乏协调
2. **状态不一致**: 不同界面显示不同状态
3. **重复交互**: 用户需要在多个工具间手动同步
4. **上下文丢失**: 跨工具推理困难
## PSI架构
### 核心概念
PSI是一个共享状态架构,将独立生成的模块转化为**连贯工具**:
- **Persistent**: 状态持久化
- **Connected**: 模块间互联
- **Chat-complementary**: 与聊天界面互补
### 架构层次
```
┌─────────────────────────────────────────┐
│ User Interfaces │
│ (GUI, Chat, Voice, API) │
└─────────────────┬───────────────────────┘
│
┌─────────────────▼───────────────────────┐
│ Shared Personal-Context Bus │
│ (State Publication & Write-Back) │
└─────────────────┬───────────────────────┘
│
┌─────────────────▼───────────────────────┐
│ AI-Generated Instruments │
│ (Module A, Module B, Module C, ...) │
│ • Publish current state │
│ • Expose write-back affordances │
└─────────────────────────────────────────┘
```
## 关键机制
### 1. 状态发布 (State Publication)
每个模块向共享总线发布当前状态:
```json
{
"module_id": "calendar",
"state": {
"current_view": "week",
"selected_date": "2026-04-09",
"events": [...]
},
"timestamp": "2026-04-09T10:30:00Z"
}
```
### 2. 写回能力 (Write-Back Affordances)
模块暴露可操作的能力:
```json
{
"module_id": "calendar",
"affordances": [
{
"action": "create_event",
"parameters": ["title", "start_time", "end_time"],
"description": "Create a new calendar event"
},
{
"action": "update_event",
"parameters": ["event_id", "updates"],
"description": "Update an existing event"
}
]
}
```
### 3. 跨模块推理
利用共享状态进行跨模块推理:
```
用户: "我下周的会议和任务冲突吗?"
系统:
1. 从Calendar模块获取会议状态
2. 从Task模块获取任务状态
3. 进行时间冲突分析
4. 通过各自模块的写回能力提出调整建议
```
## 实现模式
### 模式1: 事件驱动同步
```python
class SharedStateBus:
def __init__(self):
self.state_cache = {}
self.subscribers = {}
def publish(self, module_id, state):
"""模块发布状态更新"""
self.state_cache[module_id] = {
"state": state,
"timestamp": time.now()
}
self._notify_subscribers(module_id, state)
def subscribe(self, module_id, callback):
"""订阅其他模块状态变化"""
if module_id not in self.subscribers:
self.subscribers[module_id] = []
self.subscribers[module_id].append(callback)
def execute_affordance(self, module_id, action, params):
"""执行模块的写回操作"""
module = self.get_module(module_id)
return module.execute(action, params)
```
### 模式2: 查询响应
```python
class CrossModuleReasoning:
def query(self, intent):
"""跨模块查询"""
# 收集相关模块状态
relevant_states = self._collect_states(intent)
# 进行推理
analysis = self._analyze(relevant_states, intent)
# 生成建议动作
actions = self._generate_actions(analysis)
return {
"analysis": analysis,
"suggested_actions": actions
}
```
### 模式3: 自动集成
新模块通过相同契约自动集成:
```python
class NewModule:
def __init__(self, bus):
self.bus = bus
self._register()
def _register(self):
"""向共享总线注册"""
self.bus.register_module(
module_id=self.id,
state_schema=self.state_schema,
affordances=self.affordances
)
def update_state(self, new_state):
"""状态变化时发布更新"""
self.bus.publish(self.id, new_state)
```
## 应用场景
### 场景1: 个人助手系统
```
模块: 日历、任务、邮件、笔记
用户: "把我明天的会议准备材料整理出来"
系统动作:
1. Calendar模块 → 获取明天会议列表
2. Email模块 → 获取相关邮件
3. Task模块 → 获取相关任务
4. Note模块 → 创建准备笔记,整合信息
```
### 场景2: 智能家居控制
```
模块: 灯光、温度、安防、娱乐
用户: "我要看电影"
系统动作:
1. Entertainment模块 → 启动播放器
2. Light模块 → 调暗灯光
3. Temperature模块 → 调整温度
4. Security模块 → 检查门窗状态
```
### 场景3: 开发环境
```
模块: 代码编辑器、终端、文档、调试器
用户: "这个bug是什么原因?"
系统动作:
1. Editor模块 → 获取当前文件和光标位置
2. Terminal模块 → 获取最近命令输出
3. Debugger模块 → 获取运行时状态
4. Doc模块 → 查询相关API文档
```
## 设计原则
### 1. 松耦合
模块间不直接依赖,通过共享总线通信:
- 模块可以独立开发
- 新模块可以无缝集成
- 故障隔离
### 2. 状态一致性
所有界面显示一致的状态:
- 单一数据源
- 实时同步
- 冲突解决机制
### 3. 可发现性
模块能力自动可发现:
- 自描述能力
- 动态集成
- 无需硬编码
### 4. 隐私优先
个人数据保持本地:
- 状态存储在用户设备
- 细粒度权限控制
- 数据最小化
## 与现有架构比较
| 架构 | 耦合度 | 扩展性 | 一致性 | 适用场景 |
|------|--------|--------|--------|----------|
| 单体应用 | 高 | 低 | 高 | 简单应用 |
| 微服务 | 低 | 高 | 中 | 企业系统 |
| 插件系统 | 中 | 中 | 低 | 编辑器IDE |
| **PSI** | 低 | 高 | 高 | 个人AI系统 |
## 实现建议
### 技术栈选择
1. **状态存储**: SQLite, Redis, 或内存存储
2. **通信机制**: WebSocket, EventEmitter, 或消息队列
3. **序列化**: JSON, Protocol Buffers
4. **接口**: REST API, GraphQL, 或gRPC
### 开发流程
1. 定义共享状态模式
2. 实现共享总线
3. 开发核心模块
4. 添加新模块(自动集成)
5. 构建用户界面
## 激活关键词
- PSI architecture
- shared state
- AI agent coordination
- personal AI
- cross-module reasoning
- coherent instruments
- 共享状态架构
- 个人AI系统
- 模块协调
## 相关技能
- `llm-decision-centric-design`: LLM决策中心设计
- `agent-memory-framework`: Agent记忆框架
- `meta-cognitive-tool-optimization`: 元认知工具优化
## 参考文献
Wang, Z., Hu, E., Rucker, M., & Barnes, L.E. (2026). PSI: Shared State as the Missing Layer for Coherent AI-Generated Instruments in Personal AI Agents. arXiv:2604.08529v1.
Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.
No comments yet. Be the first to comment!