# @blackwell-systems/gcf 中文文档

规范地址：https://npmcn.com/package/%40blackwell-systems/gcf/

版本：2\.6\.1
npm 元数据更新时间：2026-08-16T03:02:50.064Z
中文译文更新时间：2026-11-08T06:03:41.001Z
软件包许可：MIT

本文由上游 README 翻译，可能存在偏差，请结合原文核对 API、命令与配置。版权与许可归原作者所有。

原始 npm 页面：https://www.npmjs.com/package/%40blackwell-systems/gcf
原文对照：https://npmcn.com/package/%40blackwell-systems/gcf/?lang=original
项目主页：https://gcformat.com/
源码仓库：https://github.com/blackwell-systems/gcf-typescript

## 关键信息（来自 npm 元数据）

- 包体积（解压后）：611 kB，94 个文件
- 模块格式：ESM + CJS
- TypeScript 类型：包内自带
- 运行依赖：0 个
- 首次发布：2026-06-04T00:16:31.513Z
- 最新版本发布：2026-08-16T03:02:49.719Z
- 近 30 天下载量：40708（2026-10-09 至 2026-11-07，npm 官方下载统计）
- 已发布版本数：30（近 12 个月 30 个）

## 中文简介

结构化数据的AI-内置线条格式. 比JSON少出50-92%的代币,为代理环路提供多回合三角形编码. 百分之百理解每个前沿模型。 零从属.

## 安装

```sh
npm install @blackwell-systems/gcf
```

也可以使用：`pnpm add @blackwell-systems/gcf`、`yarn add @blackwell-systems/gcf`、`bun add @blackwell-systems/gcf`

## README

[![Playground](https://img.shields.io/badge/playground-live-2563eb?style=for-the-badge)](https://gcformat.com/playground.html) [![Benchmarks](https://img.shields.io/badge/benchmarks-2%2C500%2B%20evals-22c55e?style=for-the-badge)](https://gcformat.com/guide/benchmarks.html) [![npm](https://img.shields.io/npm/v/@blackwell-systems/gcf?style=for-the-badge&logo=npm&logoColor=white&color=cb3837)](https://www.npmjs.com/package/@blackwell-systems/gcf) [![License](https://img.shields.io/badge/license-MIT-333?style=for-the-badge)](https://github.com/blackwell-systems/gcf-typescript/blob/main/LICENSE)

![gcf-typescript](https://raw.githubusercontent.com/blackwell-systems/gcf-typescript/main/assets/gcf-hero-wire-delta.png)

# gcf 类型标记

类型脚本执行 [全球合作框架](https://gcformat.com/),是 LLMs 中最具象征性效率的线条格式。 用于任何结构化数据的JSON和TON的倒置替代.

![](https://raw.githubusercontent.com/blackwell-systems/gcf-typescript/main/assets/divider-wave-2.png)

![gcf-typescript](https://raw.githubusercontent.com/blackwell-systems/gcf-typescript/main/assets/gcf-ts-diagram.png)

![](https://raw.githubusercontent.com/blackwell-systems/gcf-typescript/main/assets/divider.png)

**为代理环所建,同一结构上下文会穿过模型边界后转弯.** 单个有效载荷比JSON小50-92%,但GFS也使重复的结构跨个倒转并只在上下文变化时发送三角洲,因此到第5个重叠呼叫时,每次响应都比JSON花费99%的代币,一个10个呼叫会场运行比每次转弯重接JSON要便宜94.4%. 分会场和三角洲都需要本地的ID和多回合设计,JSON和TON都没有.

-   **100%理解每个前沿模式**零训练 在16个数据集中,29%的代币比TON少,56%的代币比JSON少;在结构复杂的代码图上为91.2%(等于TON 68.8%,JSON 54.1%).
-   **证明无损失** 5种形式和6种语言的43 000 000 000+往返旅行。 零运行时间依赖关系.
-   **一种格式,四种属性,没有其他单一格式同时持有:** schema-free,无亏损,有符相通(50-92% vs JSON),并采用零训练可读模式. JSON是动词,Protobuf需要一个计划,MessagePack是二进制,而TOON也不是可靠的无损失.

2,500+ LLM评价. [全部基准](https://gcformat.com/guide/benchmarks.html)。 。 。 .

文档 : [gcformat.com (英语)](https://gcformat.com/) • 妇女 [游戏场](https://gcformat.com/playground.html) • 妇女 [绿色气候基金对TON](https://gcformat.com/guide/vs-toon.html)

## 安装

```
npm install @blackwell-systems/gcf
```

零从属. 类型脚本第一. 包括CLI. 不想改变代码吗? 使用 [MCP 代理服务器](https://github.com/blackwell-systems/gcf-proxy) 用于零码通过.

## 国 际

```bash
npx @blackwell-systems/gcf encode < payload.json    # JSON to GCF
npx @blackwell-systems/gcf decode < payload.gcf     # GCF to JSON
npx @blackwell-systems/gcf stats  < payload.json    # token comparison
```

```
Payload: 50 symbols, 20 edges

  JSON  ██████████████████████████████  4,200 tokens
  GCF   ████████░░░░░░░░░░░░░░░░░░░░░░  1,150 tokens

  Savings: 73% fewer tokens with GCF
```

或在全球安装: `npm install -g @blackwell-systems/gcf` 然后使用 `gcf` 直接说.

## 图书馆

### 快速启动

```typescript
import { encodeGeneric } from '@blackwell-systems/gcf';

const output = encodeGeneric({
  employees: [
    { id: 1, name: 'Alice', department: 'Engineering', salary: 95000 },
    { id: 2, name: 'Bob', department: 'Sales', salary: 72000 },
  ],
});
```

输出 :

```
## employees [2]{id,name,department,salary}
1|Alice|Engineering|95000
2|Bob|Sales|72000
```

## 解码

```typescript
import { decode } from '@blackwell-systems/gcf';

const p = decode(input);
console.log(p.tool, p.symbols.length, 'symbols', p.edges.length, 'edges');
```

## 会话重复

通过多个工具响应跟踪传输的符号. 先前存在的符号成为赤裸裸的参考,而不是全部声明:

```typescript
import { Session, encodeWithSession } from '@blackwell-systems/gcf';

const sess = new Session();

const out1 = encodeWithSession(payload1, sess); // full declarations
const out2 = encodeWithSession(payload2, sess); // reused symbols as "@N  # previously transmitted"
```

到会话第5回:单从脱口而出,比JSON少了86%的代币,有99%被三角洲编码堆放.

## 正在流出编码

随着符号和边缘的到来,逐步写入全球合作框架产出。 零缓冲,每行O(1)内存. 对行走大图表或相接结果的 MCP 服务器的理想:

```typescript
import { StreamEncoder } from '@blackwell-systems/gcf';

const enc = new StreamEncoder(writer, 'context_for_task', { tokenBudget: 5000 });

// Symbols emit immediately as they're discovered.
enc.writeSymbol({ qualifiedName: 'pkg.Auth', kind: 'function', score: 0.95, provenance: 'lsp', distance: 0 });
enc.writeSymbol({ qualifiedName: 'pkg.Server', kind: 'function', score: 0.60, provenance: 'lsp', distance: 1 });

// Edges emit immediately too.
enc.writeEdge({ source: 'pkg.Server', target: 'pkg.Auth', edgeType: 'calls' });

// Close emits the ##! summary trailer with final counts.
enc.close();
```

输出 :

```
GCF tool=context_for_task budget=5000
## targets
@0 fn pkg.Auth 0.95 lsp
## related
@1 fn pkg.Server 0.60 lsp
## edges [?]
@0<@1 calls
##! summary symbols=2 edges=1 counts=1,1,1
```

这个 `writer` 是带有一个 `write(s: string)` 方法(Node.js流,web WritableStreams,或简单的回调). 标准 `decode()` 处理无变化的流出.

## Delta 编码

当消费者已经有前置上下文包时,只发送已改变的内容:

```typescript
import { encodeDelta, type DeltaPayload } from '@blackwell-systems/gcf';

const delta: DeltaPayload = {
  tool: 'context_for_task',
  baseRoot: 'aaa111',
  newRoot: 'bbb222',
  removed: [{ qualifiedName: 'pkg.OldFunc', kind: 'function', score: 0, provenance: '', distance: 0 }],
  added: [{ qualifiedName: 'pkg.NewFunc', kind: 'function', score: 0.85, provenance: 'rwr', distance: 0 }],
  removedEdges: [],
  addedEdges: [],
  deltaTokens: 30,
  fullTokens: 200,
};

const output = encodeDelta(delta);
```

81.2%的储蓄来自小包稍有变化的再饮.

## 通用编码

将任何联署材料价值(不只是图表载荷)编码成全球合作框架表格格式:

```typescript
import { encodeGeneric } from '@blackwell-systems/gcf';

const output = encodeGeneric({
  employees: [
    { id: 1, name: 'Alice', department: 'Engineering', salary: 95000 },
    { id: 2, name: 'Bob', department: 'Sales', salary: 72000 },
  ],
});
```

输出 :

```
## employees [2]{id,name,department,salary}
1|Alice|Engineering|95000
2|Bob|Sales|72000
```

研究对象、阵列和原始物 统一物体的阵列得到表格行. 使用嵌入式对象 `## key` 区域标题.

## 一般文件三角洲(多回合)

在代理循环中,同一个按键表在转后会转动。 不再每次重排整个表格,只发送已更改的行(SPEC §10a):

```typescript
import {
  diffGenericSets,
  encodeGenericDelta,
  verifyGenericDelta,
  type GenericSet,
} from '@blackwell-systems/gcf';

const base: GenericSet = {
  key: 'id',
  fields: ['id', 'status'],
  rows: [
    { id: 1001, status: 'pending' },
    { id: 1002, status: 'shipped' },
  ],
};
const next: GenericSet = {
  key: 'id',
  fields: ['id', 'status'],
  rows: [
    { id: 1001, status: 'shipped' }, // changed
    { id: 1003, status: 'pending' }, // added (1002 removed)
  ],
};

const d = diffGenericSets(base, next);          // GenericDeltaPayload
const wire = encodeGenericDelta(d);             // ## added / ## changed / ## removed
const held = verifyGenericDelta(base, d, d.newRoot); // atomic apply + new_root verification
```

以内容为主的组合根 至第5次重叠通话时,相较于JSON重发的代号为~97%.

### 重新锁定会话助手

`GenericDeltaSession` 为您管理三角洲/再锚地:每个 `next()` 返回一个紧凑的三角洲,或者在其下方有一个完整的再锁定器(重新定位消费者),更新其控取的基数.

```typescript
import { GenericDeltaSession, sizeGuard } from '@blackwell-systems/gcf';

const sess = new GenericDeltaSession(base, 'orders', sizeGuard());
let wire = sess.currentFull();                  // transmit the base once to establish it
for (const snapshot of stream) {                // each turn's current GenericSet
  const { wire, isFull } = sess.next(snapshot); // a compact delta, or a periodic full re-anchor
}
```

`fixedN(15)` 每转N个转弯时均重新锁定; `sizeGuard()` 一旦累积三角洲达到一个完整的有效载荷大小,(建议)重新锁定。 它没有引入新的线语法,而解码器保持了cadence-agnostic,所以重制解码器只是协议的"完全"在时间表上的结果.

## API 密码

| 函数 | 说明 |
| --- | --- |
| `encode(p: Payload): string` | 将一个图表有效载荷编码到全球合作框架文本 |
| `encodeGeneric(data: unknown): string` | 将任意值编码到全球合作框架表格格式 |
| `decode(input: string): Payload` | 将 GFC 文本重新分析到有效载荷 |
| `encodeWithSession(p: Payload, s: Session): string` | 用会话分解编码 |
| `new StreamEncoder(w, tool, opts)` | 创建流码器( 0- 缓冲) |
| `encodeDelta(d: DeltaPayload): string` | 编码三角洲( 仅添加/ 取消) |
| `diffGenericSets(base, next): GenericDeltaPayload` | Diff 二个按键记录集( generic profile) |
| `encodeGenericDelta(d): string` 编号 : `decodeGenericDelta(s)` | 通用三角铁丝网(§10a) |
| `verifyGenericDelta(base, d, root): GenericSet` | 原子应用 + `new_root` 核查 |
| `new GenericDeltaSession(base, tool, policy)` | 生产者-侧式再接力辅助器(第10a.8节) |
| `new Session()` | 创建新会话跟踪器 |

## 类型

| 类型 | 目的 |
| --- | --- |
| `Payload` | 全球合作框架的全部有效载荷:工具、预算、符号、边缘、包根 |
| `Symbol` | 图表节点:合格名称、类型、分数、出处、距离 |
| `Edge` | 定向关系:来源、目标、边缘类型 |
| `DeltaPayload` | 介于两包之间:添加/删除的符号和边缘 |
| `GenericSet` 编号 : `GenericDeltaPayload` | 密钥记录集及其通用缩写(§10a) |
| `GenericDeltaSession` | 指定三角洲对全再锁定的国有生产商(第10a.8节) |
| `Session` | 用于多点调试的跟踪器 |
| `KIND_ABBREV` 编号 : `KIND_EXPAND` | 双向类型缩略图 |

## 基准

2500+LLM评价跨越了11个模型,4个供应商,50+独立测试运行.

|  | 全球合作框架 | 东 | 贾森 |
| --- | --- | --- | --- |
| **理解** (23跑道,10个型号) | **91.2% (单位:千美元)** | 68.8% | 54.1% |
| **生成** (28个运行,9个型号) | **第5/5条** | 第1.0/5号决定 | 第5.0/5号决定 |
| **输入符号** (500个符号) | **11 090个** | 16 378个 | 53 341美元 (单位:千美元) |
| **输出符号** (100个符号) | **5 976个** | 8 937个 | 16 121个 |

全球合作框架在扩大后获得15/16个数据集 [表示效率基准](https://github.com/blackwell-systems/toon/tree/gcf-comparison). 全面结果: [gcformat.com/指南/基准](https://gcformat.com/guide/benchmarks.html)

## 执行情况

| 语言 | 软件包 | 仓库 |
| --- | --- | --- |
| 走开 | `go get github.com/blackwell-systems/gcf-go` | [开始](https://github.com/blackwell-systems/gcf-go) |
| 类型脚本 | `npm install @blackwell-systems/gcf` | [gcf 类型标记](https://github.com/blackwell-systems/gcf-typescript) |
| 蟒 | `pip install gcf-python` | [gcf-平通语](https://github.com/blackwell-systems/gcf-python) |
| 锈 | `cargo add gcf` | [gcf-rust 函数](https://github.com/blackwell-systems/gcf-rust) |
| 挥发 | Swift 软件包管理器 | [gcf-swift (英语)](https://github.com/blackwell-systems/gcf-swift) |
| 科特林语Name | 齐打包 | [gcf-kotlin (英语)](https://github.com/blackwell-systems/gcf-kotlin) |
| MCP 代理服务器 | `pip install gcf-proxy` | [gcf 代用键](https://github.com/blackwell-systems/gcf-proxy) (双向,会话解开, HTTP 前端) |
| 克劳德代码插件 | `/plugin install` | [gcf-claude-plugin (英语)](https://github.com/blackwell-systems/gcf-claude-plugin) (一个命令安装, 会话 stats hook) |
| 代码插件 | `codex plugin add` | [gcf-codex-插件](https://github.com/blackwell-systems/gcf-codex-plugin) (一个命令安装, 会话 stats hook) |
| VS 代码 | `ext install blackwell-systems.gcf-vscode` | [gcf-vscode 编码](https://marketplace.visualstudio.com/items?itemName=blackwell-systems.gcf-vscode) (语法突出显示) |
| 无 8n | `npm install n8n-nodes-gcf` | [gcf-n8n-节点](https://github.com/blackwell-systems/gcf-n8n-nodes) (工作流程编码/解码) |
| 植树人 | `npm install tree-sitter-gcf` | [树保姆- gcf](https://github.com/blackwell-systems/tree-sitter-gcf) |

**零运行时间依赖关系. 永远.** 所有6个执行都只依赖于其语言的标准库. 没有过渡性依赖。 无供应链风险。 这是一项长期承诺:全球合作框架永远不会依赖外部运行时间。 麻省理工学院有执照 所有执行都支持这两个通用简介(第1段)`encodeGeneric`)和图表简介(`encode`所有6种语言都包含CLI.

**规格 :** [SPEC v3.5.3 稳定](https://github.com/blackwell-systems/gcf/blob/main/SPEC.md) 有279个符合性固定装置,43,000,000,000+无损失的往返路线经过5种格式和6种语言的核实。 目前版本:去v1.7.0,TypeScript v2.6.0,Python v2.6.0,Rust v3.0.0,斯威夫特 v2.7.0,克特林 v2.6.0,.NET v0.2.0. 所有7个SDK的交叉语言兼容性都得到验证.

## 通过后

| 项目 |  |
| --- | --- |
| **[Chrome DevTools 磁共振](https://github.com/ChromeDevTools/chrome-devtools-mcp)** | 47K★ → Google Chrome DevTools 团队的 MCP 服务器;将活浏览器状态(DOM,网络,控制台,性能)曝光给AI编码代理 |
| **[说话方便](https://speakeasy.com/)** | OpenAPI 工具(客户包括Google, Verizon, Mistral AI, DocuSign, Vercel); GFPS是其本土输出格式 `oq` 国 际 |
| **[欧姆尼鲁特](https://omniroute.online/)** | 17K★ AI网关,注册,以及AI客户端与模型提供者之间的代理;GFS销售其压缩引擎 |
| **[网络Claw](https://github.com/automateyournetwork/netclaw)** | 610★ 人工智能网络自动化(113个技能,66个MCP集成);在每个MCP服务器上用GFS取代TON |
| **[页:1](https://github.com/stevesolun/ctx)** | 552 \* 克洛德码的实时上下文选择器;只从103K-节点知识图显示相关工具 |
| **[林克尔](https://github.com/Fast-Editor/Lynkr)** | 531++ 用于 AI 编码客户端的本地 LLM 网关; GFS 与 TOON 并列作为入站工具结果压缩器 |
| **[打开数据产品 SDK](https://opendataproducts.org/sdk/)** | Linux基金会 · Python 工具包和用于数据产品标准的 MCP 服务器;用于代理环境的 GFS 侧车 |
| **[欧元最高值](https://neuronest.cc/)** | 第一次IDE;第一次商业全球合作框架的采用,涉及四个编码表面,并有会话解开和三角洲 |
| **[雷克丝](https://raycast.com/blackwell-systems/json-to-gcf-converter)** | JSON 对GCF Raycast Store中的转换器扩展,用于 MacOS 生产率启动器 |

[见所有收养人](https://gcformat.com/ecosystem/adopters.html)

## 许可证

麻省理工学院 [戴安娜·布莱克威尔](https://github.com/blackwell-systems)

## 常见问题

### @blackwell-systems/gcf 是什么？

结构化数据的AI-内置线条格式\. 比JSON少出50-92%的代币,为代理环路提供多回合三角形编码\. 百分之百理解每个前沿模型。 零从属\.

### 如何安装 @blackwell-systems/gcf？

在项目目录运行 npm install @blackwell-systems/gcf，或使用 pnpm add / yarn add / bun add。它还提供命令行工具 gcf，可以用 npx gcf 直接运行。

### @blackwell-systems/gcf 支持 TypeScript 吗？

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

### @blackwell-systems/gcf 支持 ESM 还是 CommonJS？

同时提供 ES Module 与 CommonJS 入口，import 和 require\(\) 都可以使用，打包工具会自动选择合适的版本。

### @blackwell-systems/gcf 可以商用吗？

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

### @blackwell-systems/gcf 的下载量有多少？

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

### @blackwell-systems/gcf 还在维护吗？

最新版本 2\.6\.1 发布于 2026/08/16（2 个月前）；至今共发布 30 个版本，其中过去 12 个月发布了 30 个；首次发布于 2026/06/04。发布频率只是参考信号：功能稳定的工具可能很少需要更新，建议结合源码仓库的 issue 和提交记录判断。

