@atrib/summarize

中文文档
0.6.1发布于 2026/10/24Apache-2.0TypeScriptES Module构建来源已验证近 30 天下载 2902

Legacy summarization MCP server retained during the D164 alias window. Summarizes signed records so agents read context, not raw bytes.

原始使用文档
文档目录9 节
  1. Install
  2. Tool
  3. LLM provider
  4. Reads
  5. Behaviors
  6. Wire-up
  7. Relationship to the attest/recall rename ( D164 )
  8. Status
  9. Part of atrib

@atrib/summarize

MCP server exposing the summarize tool for atrib's verifiable action layer. It synthesizes a narrative across N records using an OpenAI-compatible LLM.

Deprecated on npm. summarize has no successor shape in the recall verb (D164): the read surface returns verified material and the caller synthesizes. The tool stays mounted through the alias window.

Closes the consumer-side cognitive-loop primitive companion to atrib-trace: trace returns the declared-relationship path; summarize returns the synthesized meaning across the selected records. Both read the same local mirror including the optional _local sidecar.

Install

pnpm add @atrib/summarize

Verify a local build with pnpm --filter @atrib/summarize test.

Tool

mcp__atrib-summarize__summarize({
  context_id?: string,        // 32-hex trace; summarize all records in it
  record_hashes?: string[],   // explicit list; unioned with context_id
  focus?: string,             // optional steering for the synthesis
  max_records?: number,       // cap on records fed to LLM (default 50, max 200)
  model?: string              // override model from env
})
→ {
  narrative: string | null,
  cited_record_hashes: string[],
  records_summarized: number,
  records_skipped: number,           // beyond max_records
  records_with_sidecar: number,      // had semantic content
  records_without_sidecar: number,   // legacy bare records, impoverished input
  model_used: string | null,
  warnings: string[]
}

LLM provider

OpenAI-compatible HTTP. Defaults to NVIDIA NIM with qwen/qwen3.5-397b-a17b. Override via env or per-call model input:

Env varDefault
ATRIB_SUMMARIZE_API_KEYfallback to provider env/cache
ATRIB_SUMMARIZE_BASE_URLhttps://integrate.api.nvidia.com/v1
ATRIB_SUMMARIZE_MODELqwen/qwen3.5-397b-a17b
ATRIB_SUMMARIZE_MAX_TOKENS4000
ATRIB_SUMMARIZE_TEMPERATURE0.3
ATRIB_SUMMARIZE_TIMEOUT_MS120000

Provider env/cache fallback:

Provider URL containsEnv varCache file
integrate.api.nvidia.comNVIDIA_API_KEY~/.atrib/secrets/nvidia-api-key
api.cerebras.aiCEREBRAS_API_KEY~/.atrib/secrets/cerebras-api-key
cloudflare.comCLOUDFLARE_API_KEY~/.atrib/secrets/cloudflare-api-key

Without an API key, the tool returns a warnings-only response per the §5.8 graceful-degradation contract.

Reads

Same as @atrib/trace: every *.jsonl mirror under ~/.atrib/records/ (override via ATRIB_RECORDS_DIR). Tolerates both legacy bare-record and current envelope shapes.

Summarize reads _local.content first, then derives the same content shape from legacy wrapper or OpenInference sidecar fields when needed. OpenInference content can add span kind/name, tool/agent/model, prompt identifiers and templates, input/output, usage, cost, score, metadata, and topics to the synthesis prompt. Those fields stay local sidecar payload per D108; they are not promoted to signed protocol fields.

When a record lacks usable local content (legacy entry), the prompt includes a marker telling the LLM the input is impoverished, only event_type + cryptographic metadata is available, so the synthesis can be honest about gaps. The output reports records_with_sidecar and records_without_sidecar counts so callers know how rich the input was.

Behaviors

  • Selection: record_hashes ∪ records-with-matching-context_id, deduplicated.
  • Capping: chronological-ascending sort, then take max_records. Skipped count surfaced.
  • Honest input flagging: a per-record line in the prompt marks records lacking semantic content; the system prompt instructs the LLM not to invent semantics.
  • Network access only on LLM call: storage reads are local, but the selected record content is sent to the configured LLM endpoint (NVIDIA NIM by default) to produce the narrative. This is the one read primitive that sends mirror content off-machine. Point ATRIB_SUMMARIZE_BASE_URL at a self-hosted or local model to keep record content on-machine. Tests use the same FORBIDDEN_HOSTS guard as the rest of the workspace to prevent fixture leakage.
  • No retry on LLM failure: surfaces the error in warnings and returns null narrative. Caller decides whether to retry with smaller max_records or different model.
  • Instrumented (per D084 Surface 6): every call writes a per-invocation jsonl entry to ~/.atrib/state/read-primitives/calls.jsonl for the unified loop-closure analyzer. Includes elapsed_ms covering the full LLM round-trip plus errored: true on LLM failure paths. Silent-failure per §5.8; instrumentation never blocks the summarize response. ATRIB_READ_PRIMITIVES_LOG overrides the default path for tests.

Wire-up

Add to your MCP host config:

{
  "atrib-summarize": {
    "command": "npx",
    "args": ["-y", "@atrib/summarize"],
    "env": {
      "ATRIB_SUMMARIZE_MODEL": "qwen/qwen3.5-397b-a17b"
    }
  }
}

From a monorepo checkout, use "command": "node" with "args": ["/path/to/atrib-summarize/dist/main.js"] instead. The API key can live in the host env or in the cache file above. Do not write secret values into shared MCP config.

Relationship to the attest/recall rename (D164)

summarize has no successor shape in the recall verb. recall returns verified material; the caller synthesizes. The npm package is deprecated without a replacement pointer; the tool stays mounted through the alias window.

Status

Published and maintained. Unit tests cover record selection (by hash, by context, unioned, missing-skip) and the degradation paths (no inputs, no API key). An integration test against a real LLM is gated behind ATRIB_SUMMARIZE_API_KEY and not run in CI.

The companion atrib-trace is the structural primitive; together they close the consumer side of the cognitive loop.

Part of atrib

atrib is an open protocol for verifiable agent actions. Every action becomes a signed, chain-linked record that anyone can verify against a public Merkle log, with no operator to trust. This package is one entrypoint. See the full package family and the protocol spec.

版本与发布记录

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

版本发布日期距今
0.6.1latest2026/10/2415 天前
0.6.02026/10/1919 天前
0.5.52026/10/1722 天前
0.5.42026/10/1622 天前
0.5.32026/07/293 个月前
0.5.22026/07/293 个月前

关于 @atrib/summarize 的常见问题

@atrib/summarize 是什么?

Legacy summarization MCP server retained during the D164 alias window. Summarizes signed records so agents read context, not raw bytes.

如何安装 @atrib/summarize?

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

@atrib/summarize 支持 TypeScript 吗?

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

@atrib/summarize 支持 ESM 还是 CommonJS?

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

@atrib/summarize 需要什么版本的 Node.js?

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

@atrib/summarize 可以商用吗?

@atrib/summarize 使用 Apache-2.0 许可。宽松许可:允许商业使用、修改和再分发,并附带明确的专利授权;分发时需保留许可与 NOTICE 文件,修改过的文件要注明改动。以上为概括,不构成法律意见,请以许可原文为准。

@atrib/summarize 的下载量有多少?

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

@atrib/summarize 还在维护吗?

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