Skip to main content

CNB Agentic Memory

Latest Release PyPI License Python CI git-clone-yyds Star Fork

基于 CNB 平台的智能体记忆工具:以 Issue 为存储、知识库为语义检索,把 CNB 的 Issue、知识库、检索能力组合成一个开箱即用的记忆层。

功能特性

  • 一记忆 = 一 Issue — Issue number 即记忆唯一标识,免自定义 id / 免并发仲裁
  • 双通道检索 — 知识库语义检索(按内容模糊查找)+ 关键词标题检索(无需知识库),按需选路
  • 结构化组织 — 分类(category:xxx,CNB 平台约定)与标签过滤,适合按已知维度浏览
  • 多形态 — Python SDK / CLI / MCP Server / Agent Skill,同一语义层按需取用
  • 实测背书 — 两步写入、写后回读校验、超长拆分等架构红线全部来自 PoC 实测

前置准备

开始使用前需要准备三件事:

  1. 创建专用私有仓库——作为记忆仓库。必须是专用仓库(全部 Issue 均为记忆),检索与列表不做记忆/普通 Issue 区分
  2. 获取 CNB 访问令牌——在 CNB 个人设置中创建,需 repo-issue:rw(Issue 读写)+ repo-code:r(知识库检索)权限
  3. 配置知识库入库流水线——在记忆仓库的 .cnb.yml 挂载 knowledge:update 流水线($ 键下),语义检索依赖它;必须先配置再写入,错过事件的记忆不会被补录

令牌与配置的完整说明见 docs/API.md · 配置;流水线 YAML 示例见 docs/API.md · 记忆仓库前置条件

安装

uvx cnb-agentic-memory --help                  # 免安装直接运行(推荐)
uv add "cnb-agentic-memory[mcp]"               # 或安装为依赖(含 MCP Server)
pip install "cnb-agentic-memory[mcp]"          # 或 pip

快速开始

配置环境变量(四种形态通用):

export CNB_AGENTIC_MEMORY_TOKEN="<你的访问令牌>"
export CNB_AGENTIC_MEMORY_REPO="<组织名>/<仓库名>"

Agent Skill 是本工具的首要使用方式——安装 skill 后,智能体在对话中自动调用,无需手动执行任何命令:

# 安装 skill(任选一源)
npx skills add https://cnb.cool/xqitw/cnb-agentic-memory.git
npx skills add https://github.com/xqitw/cnb-agentic-memory.git

之后对智能体说一句话即可:

用户:记住这个:我们的 CI 用 cnb 流水线,配置文件是 .cnb.yml
智能体:(自动调用 skill 写入记忆,自动提炼 title 与标签)
用户:上次我们的 CI 是怎么配的?
智能体:(自动检索记忆,找回上面那条)

其他形态:希望手动操作可用 CLI,集成到自建智能体可用 MCP ServerPython SDK,见下方使用形态。

使用形态

形态 入口 文档
Python SDK from cnb_agentic_memory import CNBApiClient, Memory docs/API.md(配置、错误处理、语义层设计约定)
CLI cnb-agentic-memory --help docs/CLI.md(命令清单、错误处理)
MCP Server cnb-agentic-memory mcp(需 [mcp] extra) docs/MCP.md(客户端接入配置、智能体使用指导)
Agent Skill npx skills add https://cnb.cool/xqitw/cnb-agentic-memory.git 或 GitHub 源 https://github.com/xqitw/cnb-agentic-memory.git skills/cnb-agentic-memory/SKILL.md

贡献

欢迎参与贡献!开发环境搭建、分支与提交流程请参考 CONTRIBUTING.md

License

MIT

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cnb_agentic_memory-1.1.0.tar.gz (49.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cnb_agentic_memory-1.1.0-py3-none-any.whl (28.5 kB view details)

Uploaded Python 3

File details

Details for the file cnb_agentic_memory-1.1.0.tar.gz.

File metadata

  • Download URL: cnb_agentic_memory-1.1.0.tar.gz
  • Upload date:
  • Size: 49.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.12.7 {"installer":{"name":"uv","version":"0.12.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"13","id":"trixie","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for cnb_agentic_memory-1.1.0.tar.gz
Algorithm Hash digest
SHA256 24ffc6a7860083b74c18388f9aeabf93341a5cb00c5029dd934033f49452555f
MD5 28a797a10ef5579b5c47663d06e2b467
BLAKE2b-256 f095c34a7847d50c5a1105d5d839fe94e7a1535310c1fa07938e15eb54b0dbd8

See more details on using hashes here.

File details

Details for the file cnb_agentic_memory-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: cnb_agentic_memory-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 28.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.12.7 {"installer":{"name":"uv","version":"0.12.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"13","id":"trixie","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for cnb_agentic_memory-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 055f0c83b6346bc7735477f2d17c07bb96cf3ec5a53dbac519e8f53704a3438d
MD5 cf083c2ea08bcbb4657b621694f6efd6
BLAKE2b-256 18bde80855294972fe216eba697d365f977af5b28d95f9a2e1af9675ad10d9ab

See more details on using hashes here.

Release history Release notifications | RSS feed

2.0.4

2 files

2.0.3

2 files

2.0.2

2 files

2.0.1

2 files

2.0.0

2 files

This release

1.1.0 This release

2 files

1.0.1

2 files

1.0.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page