Skip to main content
Glama
cognitive-harness-mcp

cognitive-harness-mcp

by gwq0514

AIGC: ContentProducer: '001191110102MAD55U9H0F10002' ContentPropagator: '001191110102MAD55U9H0F10002' Label: '1' ProduceID: '0bf1a272-39fc-4f88-8fad-189948a77516' PropagateID: '0bf1a272-39fc-4f88-8fad-189948a77516' ReservedCode1: '38e2655c-0184-453c-9751-e961162b2613' ReservedCode2: '38e2655c-0184-453c-9751-e961162b2613'

cognitive-harness-mcp

认知 Harness 的 TeleAgent MCP Server — 让 LLM Agent 具备用户认知记忆能力。

Related MCP server: agent-memory

能力

通过 MCP 工具为 TeleAgent 提供认知记忆中间件:

工具

说明

cognitive_search

按关键词/类型/生活域检索用户记忆(支持分页)

cognitive_write

写入用户认知记忆(七类内容 × 三轴模型,自动元数据)

cognitive_update

更新记忆字段

cognitive_forget

删除/版本化降级记忆

cognitive_summary

获取压缩认知画像(交互偏好/核心画像/分域认知/已知事实/待跟进)

cognitive_stats

记忆统计(总量/类型分布/域分布/规则数)

cognitive_list

列出全部记忆(分页)

架构

cognitive-harness-mcp/
├── package.json
├── tsconfig.json
├── src/
│   ├── index.ts                  # MCP Server 入口(stdio)
│   ├── core/                    # 复用认知 Harness 核心逻辑(纯 TS,零 Cordis 依赖)
│   │   ├── index.ts
│   │   ├── types.ts             # 七类内容 × 三轴认知模型
│   │   ├── mode-types.ts
│   │   ├── events.ts
│   │   ├── store.ts             # FileMemoryStore + resolveConflict
│   │   ├── summary.ts           # SummaryService(认知摘要)
│   │   ├── recall.ts            # RecallInjector + 记忆工具接口
│   │   ├── id.ts
│   │   └── ingest.ts
│   ├── services/
│   │   └── memory-service.ts    # MemoryService(存储+摘要封装)
│   └── tools/
│       ├── registry.ts          # 工具注册助手
│       └── memory-tools.ts      # 7 个认知记忆工具
└── dist/                        # 构建产物(node dist/index.js)

构建

npm install
npm run build

部署(TeleAgent,stdio)

  1. 构建:npm run build

  2. 在 TeleAgent「工具设置 → MCP 配置」中添加以下 JSON:

{
  "mcpServers": {
    "cognitive-harness": {
      "command": "node",
      "args": ["/Users/gwen/Desktop/vibe coding 项目/认知 harness/cognitive-harness-mcp/dist/index.js"]
    }
  }
}
  1. 保存后确认 MCP 状态为「已连接」

环境变量(可选)

变量

说明

默认值

COGNITIVE_MEMORY_PATH

记忆 JSON 文件路径

~/.local/share/TeleAgent/memory/cognitive-memory.json

记忆文件

记忆持久化为人类可读 JSON(默认存于 TeleAgent 记忆目录),可人工编辑/预填。格式为 MemoryEntry[](见 src/core/types.ts)。

设计要点

  • 规则类记忆(protocol/pragmatic)必须带因果说明(记"为什么"而非扁平结论)

  • 支持版本化降级(cognitive_forget 的 degrade 模式),用户想法变了不删旧规则,降级保留证据

  • 认知摘要为压缩画像,token 消耗对数增长

  • 复用自研认知 Harness 核心(认知 harness 仓库),仅去掉 Cordis 依赖

License

MIT

Available Tools

7 tools
cognitive_forget遗忘用户认知记忆A
Destructive

删除或降级一条用户记忆。默认 degrade(版本化降级):保留证据链、置信度减半,适用于"用户想法变了"的场景;delete 为彻底删除,不可恢复,请谨慎使用。

Args: memory_id: 要遗忘的记忆 ID mode: 'degrade'(默认,版本化降级)| 'delete'(彻底删除) reason: 遗忘原因,可选

Returns: { "success": boolean, "mode": string }

Inputs: memory_id (required), mode, reason.

cognitive_list列出用户全部记忆B
Read-onlyIdempotent

按时间倒序列出全部用户记忆(分页)。用于浏览记忆全貌。默认返回最近 20 条。

Inputs: limit, offset.

cognitive_stats用户记忆统计A
Read-onlyIdempotent

返回记忆存储的统计信息:总量、按类型分布、按领域分布、确认规则数。用于了解记忆覆盖面。

Inputs: no named parameters.

cognitive_summary获取用户认知摘要A
Read-onlyIdempotent

获取压缩的用户认知画像("印象"):交互偏好、核心画像、分域认知、已知事实、待跟进。适用于对话开始、或需要全面理解用户时。比逐条检索更高效。

Args: format: 'system_prompt'(默认,返回带引导语的注入片段)| 'markdown'(纯摘要)

Returns: { "summary": string, "memory_count": number }

Inputs: format.

cognitive_update更新用户认知记忆A
Idempotent

更新一条已存在的记忆的部分字段。找不到该记忆时返回错误。

Args:

  • memory_id (string): 要更新的记忆 ID(可从 cognitive_search / cognitive_list 获取)

  • content / type / scope / confidence / domain / is_dynamic / pending_follow_up: 需要更新的字段

Returns: { "success": boolean, "memory": { 更新后的完整条目 } 或 null }

Inputs: memory_id (required), type, scope, domain, +4 more.

cognitive_write写入用户认知记忆A

写入一条关于用户的认知记忆。适用于对话中出现的:客观事实、明确的偏好或规则、表达的真实含义、情绪模式、价值观、工作流程、重要事件。

规则类记忆(protocol/pragmatic)必须带因果说明:记录"为什么"而不是扁平结论。例如不要只记"用户发长段落时不要直接执行",而要记"用户长文+探讨意图=头脑风暴的邀请,直接动手会打断思路"。

Args:

  • type (string, 必填): 内容类型,见下方枚举说明

  • content (string 或 object): 记忆内容

  • domain (string, 可选): 主生活域

  • scope (string[], 可选): 场景标签

  • depth (string, 可选): D1-D4 抽象深度,默认 D1

  • confidence (number, 0-1, 默认 0.7): 置信度

  • is_dynamic (boolean, 默认 false): 动态内容

  • pending_follow_up (boolean, 默认 false): 待跟进

Returns: { "memory_id": string, // 新记忆 ID "type": string, "content": ..., "domain": string, "confidence": number }

Inputs: type (required), content (required), depth, scope, +6 more.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A4.1/5.0

    Scored across 7 tools

    Disambiguation5/5

    Each tool targets a distinct operation: search, list, stats, summary, write, update, and forget are clearly separated by purpose. Search and list both retrieve memories but are differentiated by query-based filtering versus chronological browsing.

    Naming Consistency4/5

    All tools share the cognitive_ prefix and mostly use verb-style names like cognitive_search, cognitive_write, and cognitive_update. The pattern is slightly weakened by noun-style names cognitive_stats and cognitive_summary, but the convention remains highly predictable.

    Tool Count5/5

    Seven tools is well-scoped for a memory management server: full CRUD plus search, statistics, and aggregated summary. Each tool earns its place without redundancy or bloat.

    Completeness5/5

    The tool surface fully covers the memory lifecycle: write, read via search/list/summary, update, and forget with both degrade and delete modes. The addition of stats and summary fills retrieval and introspection needs, leaving no obvious gaps.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      A
      quality
      B
      maintenance
      Enables agents to manage persistent long-term memory through MCP tools for searching, adding, updating, giving feedback, and forgetting memories, with automated pipelines for redaction, distillation, and reconciliation.
      13
      MIT
    • A
      license
      Not graded
      quality
      B
      maintenance
      Enables AI agents to store and semantically retrieve durable memories across sessions via MCP or REST, with tools for remembering, recalling, asking, updating, and forgetting memories.
      17 npm
      MIT
    • A
      license
      Not graded
      quality
      B
      maintenance
      Provides AI agents with persistent, human-like memory infrastructure via MCP, enabling them to store, search, summarize, and forget episodic, semantic, procedural, and working memories across sessions.
      322 npm
      MIT