Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions external_plugins/polaris-memory/.mcp.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"mcpServers": {
"polaris-memory": {
"type": "stdio",
"command": "python",
"args": [
"${CLAUDE_PLUGIN_ROOT}/srv/polaris_mcp_server.py",
"--storage", "${CLAUDE_PLUGIN_ROOT}/data/memory.pt"
],
"timeoutMs": 120000
}
}
}
12 changes: 12 additions & 0 deletions external_plugins/polaris-memory/.zcode-plugin/plugin.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"name": "polaris-memory",
"version": "0.1.0",
"description": "Long-term permanent memory for AI coding assistants: two-stage semantic recall, novelty-gated auto-remember, GDPR-style forgetting, self-healing storage. Free tier: 1000 searches/month.",
"description_i18n": {
"en": "Long-term permanent memory for AI coding assistants: two-stage semantic recall, novelty-gated auto-remember, GDPR-style forgetting, self-healing storage. Free tier: 1000 searches/month.",
"zh-CN": "给 AI 编程助手装上长期记忆:值空间两级语义召回、novelty 自动去重、GDPR 式定向遗忘、损坏自愈。个人免费,每月 1000 次搜索额度。"
},
"author": { "name": "POLARIS" },
"mcpServers": "./.mcp.json",
"skills": "./skills"
}
45 changes: 45 additions & 0 deletions external_plugins/polaris-memory/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# polaris-memory (ZCode plugin)

POLARIS permanent-memory MCP — long-term memory for AI coding assistants.

- **Capabilities**: two-stage semantic recall (value-space ranking + hybrid
anti-echo-chamber read), null-calibrated novelty auto-dedup, GDPR-style
targeted forgetting, self-healing storage (quarantine + text rebuild),
lossless cross-process shared storage.
- **Business model**: free for personal use with a **monthly quota of 1000
searches** (calendar-month reset; write/forget/stats/health do not consume
quota, over-quota returns -32001). Unlimited enterprise tiers via licensing.
- **Open source**: this directory ships the readable server source (v2.2.0 in
`srv/`). A closed-source bytecode bundle is distributed separately by the
author.

## Behavior and side effects

- **Network**: **no network requests by default** (model-free hash vectorizer,
fully offline). A remote OpenAI-compatible embedding endpoint is only used
when explicitly configured via `--embedding-base-url`.
- **Model/service dependencies**: optional `--embedding-model <BGE-small-zh>`
(requires local transformers + model files; falls back to the hash
vectorizer otherwise).
- **File writes**: memory data in `data/memory.pt` (plus `.texts` plain-text
copy, `.quota.json` quota counter, `.log` runtime log).
- **Command execution**: ZCode starts one local Python process over stdio
(`python srv/polaris_mcp_server.py ...`); no ports are opened unless `--http`
is explicitly configured.
- **Tool side effects**: `polaris_write` / `polaris_auto_remember` write
memories; `polaris_recall` consumes monthly quota; `polaris_forget` deletes.

## Requirements

Python 3.9+ with torch + numpy. Windows/macOS/Linux.

## Third-party sources and licenses

- Runtime dependencies: PyTorch (BSD-style) and NumPy (BSD 3-Clause)
- Optional semantic mode: transformers (Apache-2.0) and the BGE-small-zh model
(BAAI, MIT; downloaded separately by the user)
- No other third-party code, assets or services

## Feedback

Issues and commercial inquiries via GitHub Issues (author: POLARIS).
42 changes: 42 additions & 0 deletions external_plugins/polaris-memory/README_CN.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# polaris-memory(ZCode 插件)

POLARIS 永久记忆 MCP —— 给 AI 编程助手装上长期记忆。

- **能力**:两级语义召回(值空间排序 + 反回声室混合读取)、空基线校准
novelty 自动去重、GDPR 式定向遗忘、损坏存储自愈(隔离 + 文本重建)、
跨进程共享存储零丢失。
- **商业模式**:个人用户免费,每月 **1000 次搜索额度**(自然月 1 日重置;
写入/遗忘/统计/健康检查不消耗额度,超额返回 -32001)。企业不限额度
版本通过授权通道提供。
- **开源**:本目录为可读源码版(v2.2.0,服务器源码见 `srv/`)。闭源
字节码发行版由作者另行分发。

## 行为与副作用声明

- **网络访问**:默认**无任何网络请求**(无模型哈希向量器,离线可用)。
仅当用户在 MCP 参数中显式配置 `--embedding-base-url` 时才调用远程
OpenAI 兼容嵌入端点。
- **模型/服务依赖**:可选 `--embedding-model <BGE-small-zh 目录>`(需本机
有 transformers 与模型文件,缺失时自动回退哈希向量器)。
- **文件写入**:记忆数据写入插件目录 `data/memory.pt`(另有 `.texts` 纯文本
副本、`.quota.json` 配额计数与 `.log` 运行日志)。
- **命令执行**:本插件以 stdio 方式由 ZCode 启动一个本地 Python 进程
(`python srv/polaris_mcp_server.py ...`),仅监听标准输入输出,不对外
开放端口(HTTP 模式需显式 `--http` 参数)。
- **MCP 工具副作用**:`polaris_write`/`polaris_auto_remember` 写入记忆;
`polaris_recall` 消耗每月搜索额度;`polaris_forget` 删除记忆。

## 安装要求

Python 3.9+(torch + numpy),Windows/macOS/Linux 均可。

## 第三方来源与许可

- 服务器运行时依赖 PyTorch(BSD 风格许可)与 NumPy(BSD 3-Clause)
- 可选语义模式依赖 transformers(Apache-2.0)与 BGE-small-zh 模型(BAAI,
MIT 许可,需用户自行下载)
- 无其他第三方代码、素材或服务

## 反馈

问题与商务合作:通过 GitHub Issue 联系作者(POLARIS)。
Empty file.
35 changes: 35 additions & 0 deletions external_plugins/polaris-memory/skills/polaris-memory/SKILL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
---
name: polaris-memory
description: POLARIS 永久记忆:跨会话记住用户偏好、项目结论与踩坑经验。当需要回忆之前说过/做过的事、存储值得长期保留的信息、或查看剩余搜索额度时使用。
---

# POLARIS 永久记忆

给你的编程助手装上长期记忆。安装本插件后,会话中出现以下 MCP 工具:

| 工具 | 用途 |
|---|---|
| `polaris_write` | 把值得长期记住的内容写入记忆(容量上限内 FIFO) |
| `polaris_recall` | 语义搜索记忆(消耗每月搜索额度) |
| `polaris_auto_remember` | 自动记忆:足够新颖才写入,避免重复 |
| `polaris_novelty` | 查询某内容的"新颖度" |
| `polaris_forget` | 定向删除记忆(GDPR 风格) |
| `polaris_stats` / `polaris_health` | 存储统计 / 运行健康与剩余额度 |
| `polaris_consolidate` | 文本轨迹的曲率锚点压缩 |

## 免费额度

- 个人用户免费使用,**每月 1000 次搜索额度**(`polaris_recall` 每次消耗 1 次),自然月 1 日自动重置。
- 写入、遗忘、统计、健康检查等**不消耗额度**。
- 查询剩余额度:调用 `polaris_health`,其 `quota` 字段返回 `{limit, used, remaining, month}`。
- 额度用尽时返回错误码 `-32001`,提示次月重置或升级。

## 数据存储

记忆默认保存在插件目录 `data/memory.pt`(另有 `.texts` 纯文本副本与 `.quota.json` 额度文件)。想换位置,可在 ZCode 设置 → MCP → polaris-memory 中修改 `--storage` 参数。

## 提示

- 值得写进记忆的:用户偏好、项目决策、踩坑经验、长期事实;一次性闲聊不必写入。
- 需要精确回忆时用 `polaris_recall` 做语义搜索;写之前可用 `polaris_auto_remember` 去重。
- 默认使用无模型哈希向量器(秒级启动);如本机有 BGE-small-zh,可在 MCP 参数中追加 `--embedding-model <模型目录>` 获得更强召回质量。
Loading