内容
<p align="center">
<img src="https://capsule-render.vercel.app/api?type=waving&color=0:2563eb,100:06b6d4&height=200§ion=header&text=UCW&fontSize=60&fontColor=ffffff&animation=fadeIn&fontAlignY=32&desc=%E9%80%9A%E7%94%B8%E7%9E%84%E7%9B%96%E5%90%8C%E6%83%A1%E6%89%96&descAlignY=56&descSize=20" width="100%" />
</p>
<div align="center">
<img src="https://readme-typing-svg.demolab.com?font=Orbitron&weight=600&size=22&duration=3000&pause=1000&color=2563EB¢er=true&vCenter=true&multiline=false&repeat=true&width=700&height=40&lines=%E6%89%80%E6%9C%89%E7%9A%84AI%E5%AF%B1%E8%AF%81%E6%88%AA%E5%8F%96%E3%80%82%E6%89%80%E6%9C%89%E7%9A%84%E6%83%A1%E6%89%96%E9%83%BD%E8%BF%9E%E6%89%96%E4%B8%80%E8%B5%B7%E3%80%82" alt="Typing SVG" />
</div>
<p align="center">
<img src="https://img.shields.io/badge/Python-3.10+-2563eb?style=for-the-badge&logo=python&logoColor=white&labelColor=0d1117" />
<img src="https://img.shields.io/badge/SQLite-FTS5-06b6d4?style=for-the-badge&logo=sqlite&logoColor=white&labelColor=0d1117" />
<img src="https://img.shields.io/badge/MCP-%E5%8D%8F%E8%AE%84-8b5cf6?style=for-the-badge&logo=anthropic&logoColor=white&labelColor=0d1117" />
<img src="https://img.shields.io/badge/%E6%B5%8B%E8%AF%95-565%2B-22c55e?style=for-the-badge&logo=pytest&logoColor=white&labelColor=0d1117" />
<img src="https://img.shields.io/badge/v0.4.0-%E6%B4%BB%E7%A8%8B-2563eb?style=for-the-badge&labelColor=0d1117" />
<a href="https://github.com/Dicoangelo"><img src="https://img.shields.io/badge/Dico_Angelo-%E7%9B%96%E9%98%81%E5%90%8A%E6%89%96-06b6d4?style=for-the-badge&logo=github&logoColor=white&labelColor=0d1117" /></a>
</p>
<img src="https://user-images.githubusercontent.com/74038190/212284100-561aa473-3905-4a80-b561-0d28506553ee.gif" width="100%"/>
## UCW是什么?
UCW是一个本地的AI记忆系统。它 **捕获工具交互** 来自Claude的MCP, **导入对话历史** 来自ChatGPT,Cursor和Grok,并允许您 **搜索,可视化和导出** 所有内容在一个地方。所有数据都存储在您机器上的SQLite中。没有云。没有订阅。
**它如何捕获数据:**
- **实时捕获(MCP):** UCW作为MCP服务器运行。当Claude调用UCW工具时,这些交互会被捕获,并带有纳秒时间戳和语义增强。协议噪声会自动过滤掉。
- **导入:** `ucw import chatgpt/cursor/grok` 将导出文件的完整对话历史记录导入其中 - 这是大部分可搜索内容的主要来源。
- **组合搜索:** 导入后,`ucw search` 可以在一次查询中找到所有平台上的对话。
<img src="https://user-images.githubusercontent.com/74038190/212284115-f47cd8ff-2ffb-4b04-b5bf-4d1c14c0247f.gif" width="100%"/>
## 架构
```mermaid
%%{init: {'theme': 'dark', 'themeVariables': {'primaryColor': '#2563eb', 'edgeLabelBackground':'#1a1a2e', 'tertiaryColor': '#1a1a2e'}}}%%
flowchart TB
subgraph Platforms["AI 平台"]
direction LR
Claude["Claude 桌面/代码"]
Cursor["Cursor IDE"]
ChatGPT["ChatGPT"]
Grok["Grok"]
end
subgraph UCW["UCW 引擎"]
direction TB
MCP["MCP 服务器<br/>stdio 协议"]
Capture["捕获管道<br/>纳秒时间戳"]
Enrich["增强<br/>意图 · 主题 · 连贯性"]
DB["SQLite + FTS5<br/>WAL 模式 · 本地仅限"]
Embed["嵌入缓存<br/>句子转换器"]
end
subgraph Interface["用户界面"]
direction LR
CLI["14 个 CLI 命令"]
Web["网页仪表盘<br/>端口 7077"]
Tools["23 个 MCP 工具<br/>Claude 可以调用"]
end
Claude -->|MCP 工具调用| MCP
Cursor -->|导入| DB
ChatGPT -->|导入| DB
Grok -->|导入| DB
MCP --> Capture --> Enrich --> DB
DB --> Embed
DB --> CLI
DB --> Web
DB --> Tools
style Platforms fill:#1e3a5f,stroke:#2563eb,color:#fff
style UCW fill:#1a1a2e,stroke:#06b6d4,color:#fff
style Interface fill:#1e3a5f,stroke:#2563eb,color:#fff
```
## 项目结构
```
ucw/
├── src/ucw/
│ ├── cli.py # 14 个 CLI 命令(click)
│ ├── search.py # FTS5 关键词 + 语义向量搜索
│ ├── web.py # 本地 Web 服务器(stdlib http.server)
│ ├── web_ui.py # 嵌入式 SPA(HTML/CSS/JS)
│ ├── dashboard.py # 仪表盘数据聚合
│ ├── config.py # 配置和路径
│ ├── demo.py # 示例数据生成器
│ ├── errors.py # 错误层次结构和提示
│ ├── db/
│ │ ├── sqlite.py # CaptureDB,模式,WAL 模式
│ │ ├── schema.sql # 核心模式(事件,会话,时刻)
│ │ └── migrations/ # 001-007 增量迁移
│ ├── server/
│ │ ├── server.py # MCP 协议服务器
│ │ ├── bridge.py # UCWBridgeAdapter(增强)
│ │ ├── embeddings.py # 句子转换器包装器
│ │ └── router.py # 工具路由
│ ├── tools/ # 23 个 MCP 工具,跨 7 个模块
│ │ ├── ucw_tools.py # 捕获统计,时间线,上下文
│ │ ├── coherence_tools.py # 搜索,时刻,弧线
│ │ ├── graph_tools.py # 知识图查询
│ │ ├── intelligence_tools.py # 突现,警报
│ │ ├── temporal_tools.py # 基于时间的模式
│ │ ├── agent_tools.py # 跨代理内存,信任
│ │ └── proof_tools.py # 哈希链,Merkle 收据
│ └── importers/ # ChatGPT,Cursor,Grok 适配器
├── tests/ # 565+ 测试
├── visual_assets/ # 仪表盘截图
└── pyproject.toml # Hatch 构建,可选依赖
```
<img src="https://user-images.githubusercontent.com/74038190/212284100-561aa473-3905-4a80-b561-0d28506553ee.gif" width="100%"/>
## 功能
<table>
<tr>
<td width="33%" align="center">
<h3>语义搜索</h3>
<b>在所有 AI 工具中找到任何内容</b>
<p><code>ucw search "那个身份验证对话"</code> 使用 FTS5 关键词 + 句子转换器嵌入。缓存的向量意味着即时重复查询。</p>
<code>FTS5</code> <code>BM25</code> <code>余弦相似度</code>
</td>
<td width="33%" align="center">
<h3>MCP 捕获 + 导入</h3>
<b>实时捕获工具调用,导入历史记录</b>
<p>MCP 服务器实时捕获 Claude 工具交互。导入 ChatGPT、Cursor 和 Grok 导出的完整对话历史记录。协议噪声自动过滤。</p>
<code>MCP</code> <code>导入</code> <code>噪声过滤</code>
</td>
<td width="33%" align="center">
<h3>网页仪表盘</h3>
<b>一览您的 AI 记忆</b>
<p><code>ucw web</code> 启动一个本地 SPA,包含搜索、平台分析、知识图、连贯时刻。黑暗/明亮主题。</p>
<code>localhost:7077</code> <code>无需 npm</code> <code>零依赖</code>
</td>
</tr>
<tr>
<td width="33%" align="center">
<h3>知识图</h3>
<b>查看想法如何连接</b>
<p>从对话中提取的实体形成一个图。关系在平台之间出现 - 将您的 Claude 工作与 ChatGPT 研究联系起来。</p>
<code>实体</code> <code>关系</code> <code>力导向</code>
</td>
<td width="33%" align="center">
<h3>连贯性检测</h3>
<b>跨平台的洞察时刻</b>
<p>UCW 检测到同一个概念出现在不同的 AI 工具中 - 您的思维汇聚的 "aha" 时刻。</p>
<code>跨平台</code> <code>时刻</code> <code>弧线</code>
</td>
<td width="33%" align="center">
<h3>认知证明</h3>
<b>AI 工作的加密收据</b>
<p>SHA-256 哈希链和 Merkle 树证明了想法何时被捕获。给您的知识产权盖上时间戳。</p>
<code>SHA-256</code> <code>Merkle</code> <code>不可篡改</code>
</td>
</tr>
</table>
## 快速开始
```bash
pip install ucw # 核心(CLI + 捕获)
ucw init # 设置 ~/.ucw/ 并检测 AI 工具
ucw demo # 加载 52 个示例事件进行探索
ucw dashboard # 查看您的 AI 记忆概览
ucw search "身份验证" # 在所有对话中搜索
ucw web # 在 localhost:7077 启动网页仪表盘
```
### 连接到Claude(实时捕获)
```bash
ucw mcp-config # 打印 MCP 配置 JSON
```
粘贴到 **Claude 桌面版** (设置 > 开发者 > 编辑配置)或 **Claude 代码** (`.claude/settings.json`)。
### 可选额外功能
```bash
pip install "ucw[embeddings]" # 语义搜索(句子转换器)
pip install "ucw[ui]" # 丰富的终端仪表盘
pip install "ucw[all]" # 所有功能
```
### 导入现有对话
```bash
ucw import chatgpt ~/Downloads/conversations.json
ucw import cursor # 自动检测 Cursor 工作区 DB
ucw import grok ~/Downloads/grok-export.json
```
## 命令
| 命令 | 描述 |
|---------|-------------|
| `ucw init` | 设置 UCW 并检测已安装的 AI 工具 |
| `ucw server` | 启动 MCP 服务器(Claude 使用) |
| `ucw search QUERY` | 使用 `--platform`、`--after`、`--before`、`--semantic` 搜索对话 |
| `ucw web` | 在 `localhost:7077` 启动网页仪表盘 |
| `ucw dashboard` | 终端仪表盘,显示平台分解和主题 |
| `ucw index` | 构建/管理语义搜索嵌入缓存 |
| `ucw capture-test` | 验证整个捕获管道是否正常工作 |
| `ucw import <platform>` | 从 ChatGPT、Cursor 或 Grok 导入 |
| `ucw demo` | 加载示例数据以探索功能 |
| `ucw status` | 快速数据库统计 |
| `ucw doctor` | 检查安装健康状况 |
| `ucw repair` | 修复和优化数据库(VACUUM) |
| `ucw migrate` | 运行数据库模式迁移 |
| `ucw mcp-config` | 打印 Claude MCP 配置 JSON |
## 23 个 MCP 工具
当连接到Claude时,UCW提供23个工具,分为7类:
| 类别 | 工具 | 目的 |
|----------|-------|---------|
| **捕获** | `capture_stats`、`timeline`、`session_context` | 会话跟踪和事件重放 |
| **连贯性** | `search`、`status`、`moments`、`scan`、`arcs` | 跨平台洞察检测 |
| **智能** | `emergence`、`event_stream`、`alerts` | 实时模式识别 |
| **图** | `knowledge_graph`、`entity_relationships` | 实体提取和链接 |
| **时间** | `time_patterns`、`decay_detection`、`activity_map` | 基于时间的分析 |
| **代理** | `cross_agent_memory`、`trust_scoring` | 多代理协调 |
| **证明** | `hash_chain`、`merkle_tree`、`receipt` | 加密认知证明 |
## 技术栈
| 层 | 技术 | 目的 |
|-------|-----------|---------|
| **运行时** | Python 3.10+ | 零依赖核心(仅 `click`) |
| **存储** | SQLite + FTS5 | WAL 模式,仅本地,纳秒时间戳 |
| **协议** | MCP(stdio) | Claude 集成模型上下文协议 |
| **搜索** | FTS5 + 句子转换器 | BM25 关键词 + 余弦相似度向量 |
| **网页** | 标准库 `http.server` | 单文件 SPA,无需 npm,无需构建步骤 |
| **嵌入** | 句子转换器(可选) | 缓存 SQLite BLOB,每个事件 1.5KB |
| **测试** | pytest + ruff | 565+ 测试,零 lint 错误 |
## 网页仪表盘
<p align="center">
<img src="visual_assets/ucw-dashboard-v040.png" width="48%" alt="UCW 仪表盘 - 明亮主题" />
<img src="visual_assets/ucw-dashboard-v040-dark.png" width="48%" alt="UCW 仪表盘 - 暗黑主题" />
</p>
## 配置
UCW 将所有内容存储在 `~/.ucw/` 中。可以通过环境变量覆盖:
| 变量 | 默认值 | 描述 |
|----------|---------|-------------|
| `UCW_DATA_DIR` | `~/.ucw` | 数据目录 |
| `UCW_LOG_LEVEL` | `DEBUG` | 日志级别 |
| `UCW_PLATFORM` | `claude-desktop` | 平台标识符 |
## 要求
- Python 3.10+
- SQLite 3.35+(包含在 Python 中)
## 开发
```bash
git clone https://github.com/Dicoangelo/ucw.git
cd ucw
pip install -e ".[dev]"
pytest # 565+ 测试
ruff check . # lint
ucw demo && ucw web # 视觉烟雾测试
```
<details>
<summary><b>构建日志 - v0.4.0</b></summary>
| 指标 | v0.1.0 | v0.2.0 | v0.3.0 | v0.4.0 |
|--------|--------|--------|--------|--------|
| MCP 工具 | 7 | 8 | 23 | 23 |
| CLI 命令 | 3 | 4 | 10 | 14 |
| 测试 | 63 | 153 | 469 | 565+ |
| 迁移 | 0 | 0 | 5 | 7 |
| 导入 | 0 | 0 | 3 | 3 |
**v0.4.0 亮点:**
- 语义搜索(`ucw search`)+ 嵌入缓存
- 网页仪表盘(`ucw web`)- 本地 SPA,黑暗/明亮主题
- 捕获验证(`ucw capture-test`)- 管道健康检查
- 缓存一致性搜索(替换为暴力重新嵌入)
</details>
## 愿景
```
┌─────────────────────────────────────────────────┐
│ │
│ 您曾经的 AI 对话 │
│ 是您认知投资组合中的数据点。 │
│ │
│ UCW 捕获价值。 │
│ 您拥有股权。 │
│ │
└─────────────────────────────────────────────────┘
## 许可证
MIT
<p align="center">
<a href="https://github.com/Dicoangelo/ucw"><img src="https://img.shields.io/badge/UCW-%E9%80%9A%E7%94%B8%E7%9E%84%E7%9B%96%E5%90%8A-2563eb?style=for-the-badge&labelColor=0d1117" /></a>
<a href="https://metaventionsai.com"><img src="https://img.shields.io/badge/Metaventions-AI-06b6d4?style=for-the-badge&labelColor=0d1117" /></a>
</p>
<p align="center">
<img src="https://capsule-render.vercel.app/api?type=waving&color=0:2563eb,100:06b6d4&height=120§ion=footer" width="100%" />
</p>
MCP 配置
以下是此 MCP Server 的配置信息,可直接复制到 Cursor 或其他 MCP 客户端中使用。
mcp.json
连接信息
猜你喜欢
暂无推荐服务器