@cleocode/brain

中文文档
2026.11.1发布于 2026/11/12MITTypeScriptES Module构建来源已验证近 30 天下载 7749

CLEO unified-graph Brain substrate — BRAIN + NEXUS + TASKS + CONDUIT + SIGNALDOCK projection

原始使用文档
文档目录6 节
  1. Purpose
  2. Substrates
  3. Usage
  4. Wire Format
  5. Naming
  6. License

@cleocode/brain

Part of CLEO. Start with the root README; run cleo <command> --help for any command.

The unified-graph Brain substrate for CLEO — a substrate-agnostic projection across all five CLEO databases: BRAIN, NEXUS, TASKS, CONDUIT, and SIGNALDOCK.

Purpose

@cleocode/brain promotes the unified-graph substrate from a studio-internal module to a first-class workspace package, mirroring @cleocode/nexus. Operator mandate per T962 reconciliation: BRAIN is the super-domain (wraps memory + nexus + tasks + conduit + signaldock), deserves CLI access, and needs a package standalone publish lane.

Substrates

Every node carries a substrate-prefixed ID so cross-substrate edges can reference nodes unambiguously, e.g. brain:O-abc vs nexus:sym-123.

SubstrateDatabaseNode kinds
brainbrain.db (project)observation, decision, pattern, learning
nexusnexus.db (global)symbol, file
taskstasks.db (project)task, session
conduitconduit.db (project)message
signaldocksignaldock.db (global)agent

Usage

import { getAllSubstrates, type BrainGraph } from '@cleocode/brain';

const graph: BrainGraph = getAllSubstrates({ limit: 500, minWeight: 0 });
console.log(`${graph.nodes.length} nodes across ${Object.keys(graph.counts.nodes).length} substrates`);

Individual substrate adapters are exported from @cleocode/brain/adapters:

import {
  getBrainSubstrate,
  getConduitSubstrate,
  getNexusSubstrate,
  getSignaldockSubstrate,
  getTasksSubstrate,
} from '@cleocode/brain/adapters';

Wire Format

The wire format (types BrainNode, BrainEdge, BrainGraph, BrainQueryOptions, BrainStreamEvent) is re-exported from the top-level entry point. See src/types.ts for the canonical definitions.

A parallel contracts mirror lives at @cleocode/contracts/operations/brain (T968) for programmatic-API consumers. It describes the HTTP wire format for the brain.* operations and is intentionally structurally distinct from these runtime types (e.g. contract BrainNode uses type: string + data, runtime uses kind: BrainNodeKind + meta + an optional adapter-produced weight).

Naming

All exported types carry the Brain* prefix (BrainNode, BrainEdge, BrainGraph, BrainSubstrate, BrainQueryOptions, BrainStreamEvent, BrainConnectionStatus, BrainNodeKind). T973 completed the LB* → Brain* rename started by the T969 package extraction. The LB* prefix is no longer exported by this package.

License

MIT — see LICENSE.

版本与发布记录

@cleocode/brain 共发布 289 个版本,首次发布于 2026/04/19;过去 12 个月发布了 289 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
2026.11.1latest2026/11/12今天
2026.11.1-rc.ci.711canary2026/11/12今天
2026.11.1-canary.122026/11/12今天
2026.11.1-canary.112026/11/12今天
2026.11.1-canary.102026/11/12今天
2026.11.1-canary.92026/11/111 天前

关于 @cleocode/brain 的常见问题

@cleocode/brain 是什么?

CLEO unified-graph Brain substrate — BRAIN + NEXUS + TASKS + CONDUIT + SIGNALDOCK projection

如何安装 @cleocode/brain?

在项目目录运行 npm install @cleocode/brain,或使用 pnpm add / yarn add / bun add。

@cleocode/brain 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@cleocode/brain 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@cleocode/brain 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=24.16.0。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@cleocode/brain 可以商用吗?

@cleocode/brain 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@cleocode/brain 的下载量有多少?

根据 npm 官方下载统计,@cleocode/brain 在 2026/10/10 – 2026/11/08 这 30 天内被下载 7,749 次,日均约 258 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@cleocode/brain 还在维护吗?

最新版本 2026.11.1 发布于 2026/11/12(今天);至今共发布 289 个版本,其中过去 12 个月发布了 289 个;首次发布于 2026/04/19。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。