Skip to main content
Glama
gwq0514

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: Recall Select

能力

通过 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 }

ParametersJSON Schema
NameRequiredDescriptionDefault
modeNo'degrade' 版本化降级(保留证据链,默认);'delete' 彻底删除degrade
reasonNo遗忘原因(degrade 时记录到版本历史)
memory_idYes要遗忘的记忆 ID

TDQS

A4.7/5.0
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Beyond the destructiveHint annotation, the description discloses critical behavioral detail: degrade preserves the evidence chain and halves confidence, while delete is permanent and unrecoverable. This gives the agent essential awareness of side effects and irreversibility, which annotations alone do not fully convey.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is compact, front-loaded with the core action, and logically organized with Args and Returns sections. Every line adds value, and there is no filler or redundant elaboration.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Even without an output schema, the description explicitly specifies the return shape: { success: boolean, mode: string }. It also covers both modes, their side effects, default behavior, and the optional reason parameter. This is sufficient for an agent to invoke the tool correctly and understand the result.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema already documents all parameters with 100% coverage, so the baseline is 3. The description adds meaningful behavioral semantics, particularly that degrade halves confidence and delete is irreversible, going beyond the schema's enum descriptions. The Args section also clearly marks reason as optional.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's core action: '删除或降级一条用户记忆' (delete or degrade a user memory). It further specifies two distinct modes with concrete semantics, making it easily distinguishable from sibling tools like cognitive_search, cognitive_write, and cognitive_update.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides clear situational guidance: degrade is recommended when '用户想法变了' (the user's thoughts changed), while delete is for complete removal and marked as irreversible. It does not explicitly mention alternative sibling tools for non-destructive updates, but the mode-selection guidance is clear enough for most use cases.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

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

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

ParametersJSON Schema
NameRequiredDescriptionDefault
limitNo条数上限(默认 50)
offsetNo分页偏移(默认 0)

TDQS

B3.1/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations already declare readOnlyHint, idempotentHint, and destructiveHint=false, so the safety profile is covered. The description adds ordering and pagination context, but it claims '默认返回最近 20 条' while the schema's limit default is 50—an internal contradiction that makes the described behavior misleading.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness3/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is short and front-loaded with the core behavior, which is good. However, the final clause about defaulting to 20 entries is not only unnecessary but contradicts the schema, so the sentence does not fully earn its place.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a simple read-only paginated list tool, the schema and annotations carry much of the needed information. Still, the default discrepancy between description and schema, plus the absence of any guidance distinguishing this from cognitive_search, leaves meaningful gaps.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 100% coverage for limit and offset, so a baseline of 3 is warranted. However, the description introduces inaccurate parameter-related information by stating a default of 20 items while the schema specifies limit default 50, which actively undermines correct invocation.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly identifies a specific verb and resource: listing all user memories in reverse chronological order with pagination. The phrase '全部用户记忆' differentiates it from search-oriented siblings like cognitive_search, though it does not explicitly name any sibling.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

'用于浏览记忆全貌' gives a clear scenario for when to use the tool. However, it does not explicitly state when not to use it or mention alternatives such as cognitive_search or cognitive_summary, so it falls short of full routing guidance.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

cognitive_stats用户记忆统计A
Read-onlyIdempotent

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

ParametersJSON Schema
NameRequiredDescriptionDefault

No parameters

TDQS

A4.4/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations already cover read-only, idempotent, and non-destructive behavior, lowering the burden on the description. The description adds value by naming the exact categories of statistics returned, giving concrete behavioral context about the tool's output without contradicting any annotation.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is one tight sentence that leads with the action verb, lists the concrete statistics, and closes with the intended purpose. Every clause contributes information; there is no redundancy or filler.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

With no output schema, the description rightly carries the burden of explaining the return payload and does so by listing the main statistical categories. It remains slightly incomplete because it does not specify the exact format (counts vs. percentages) or the structural shape of the response, and it does not explicitly distinguish itself from cognitive_summary.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

There are zero parameters and schema description coverage is vacuously 100%, so the baseline is 4. The description compensates by detailing what the no-argument call returns—total, type distribution, domain distribution, and confirmation-rule count—making the empty input schema meaningful.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly specifies a verb ('返回', returns) and a resource ('记忆存储的统计信息'), then enumerates the exact metrics: total, distribution by type, distribution by domain, and confirmed-rule count. This makes it easily distinguishable from sibling tools like cognitive_search and cognitive_write.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description gives a clear usage context—'用于了解记忆覆盖面' (for understanding memory coverage)—which tells an agent when a stats overview is appropriate. However, it does not explicitly contrast with cognitive_summary or cognitive_list, so an agent might still be unsure which aggregate view to pick among those siblings.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

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

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

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

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

ParametersJSON Schema
NameRequiredDescriptionDefault
formatNo'system_prompt' 返回带引导语的注入片段(默认);'markdown' 返回纯摘要system_prompt

TDQS

A4.3/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations already declare readOnlyHint=true and idempotentHint=true, so the safety profile is covered. The description adds useful behavioral details beyond the annotations, such as the two output formats (system_prompt vs markdown) and the return shape including summary and memory_count. There is no contradiction with the annotations.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is compact and well-organized: a one-sentence summary of purpose and content, a one-sentence usage recommendation, and a brief Args/Returns breakdown. Every sentence adds value and the most important information is front-loaded.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given that there is only one optional parameter, rich annotations, and no output schema, the description is complete enough. It explains the return value explicitly and describes both possible format values, so an agent has everything needed to invoke it correctly.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 100% description coverage for the only parameter, including an enum, a default value, and a clear explanation of each format option. The description repeats this information but does not add meaning beyond what the schema already provides, so it earns the baseline score.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: it returns a compressed user cognitive profile ("印象") with specific content categories like interaction preferences, core profile, domain cognition, known facts, and follow-ups. It distinguishes itself from item-by-item retrieval by explicitly claiming to be more efficient, making it easy to separate from siblings like cognitive_search and cognitive_list.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description explicitly says when to use it: at the start of a conversation or when a comprehensive understanding of the user is needed. It also frames the tool as more efficient than per-item retrieval. However, it does not name specific alternative sibling tools or state when not to use it, so it stops one step short of full usage guidance.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

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 }

ParametersJSON Schema
NameRequiredDescriptionDefault
typeNo新的内容类型
scopeNo新的场景标签
domainNo新的主域
contentNo新的记忆内容
memory_idYes要更新的记忆 ID
confidenceNo新的置信度
is_dynamicNo是否动态内容
pending_follow_upNo是否有待跟进事项

TDQS

A4.3/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Beyond annotations, the description discloses key behavioral details: the operation is a partial update, returns an error when the memory is missing, and returns the full updated entry or null. This adds meaningful context without contradicting the idempotentHint annotation.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is compact and well-structured, with a clear opening statement followed by Args and Returns sections. The Args list is slightly redundant with the schema, but the Returns section is essential since no output schema exists.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For an 8-parameter mutation tool with no output schema, the description covers the essential contract: update behavior, error case, return shape, and updatable fields. It could go further with an example, but nothing critical is missing.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so the baseline is 3. The description adds value by clarifying partial-update semantics (only provided fields are updated) and by pointing out that memory_id can be sourced from cognitive_search/cognitive_list.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description states a precise operation—partial update of an existing memory—and explicitly notes the error case when the memory is not found. This clearly distinguishes it from sibling tools like cognitive_write or cognitive_forget.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description clearly implies this tool is for updating an already-existing memory, and even tells the agent where to obtain the memory_id (cognitive_search / cognitive_list). However, it does not explicitly state when to prefer this over cognitive_write or avoid using it for creation.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

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 }

ParametersJSON Schema
NameRequiredDescriptionDefault
typeYes内容类型:fact(客观事实)/protocol(交互规则偏好)/pragmatic(表达真实含义)/emotional(情绪状态模式)/value(价值观)/procedure(工作流)/episodic(具体事件)
depthNo抽象深度:D1 事件 / D2 模式 / D3 规则 / D4 内核(默认 D1)
scopeNo适用场景标签(如 ["汇报","PPT"])
domainNo生活域(默认 uncategorized)
contentYes记忆内容。规则类(protocol/pragmatic)建议带因果说明,如"长文+探讨意图=头脑风暴邀请,直接动手会打断思路";事实类可为键值对象
confidenceNo置信度 0-1(默认 0.7)
is_dynamicNo是否为动态内容(如临时状态)
message_idNo来源消息 ID
conversation_idNo来源会话 ID
pending_follow_upNo是否有待跟进事项

TDQS

A3.6/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations already indicate this is a non-read-only, non-destructive write operation. The description adds some context, such as requiring causal explanations for rule-type memories and returning a new memory_id, but it does not disclose duplicate behavior, overwrite semantics, or permission requirements. This is adequate but not rich.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness3/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is front-loaded with its purpose and use cases, and the Args/Returns sections are scannable. However, the Args list largely duplicates the input schema, and the phrase '见下方枚举说明' points to an enumeration that is not actually present in the description text.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

It covers when to use the tool, rule-content guidance, several defaults, and an explicit return shape, which is valuable because no output schema exists. It does not explicitly mention using cognitive_update for edits or explain message_id/conversation_id, but the schema fills those gaps.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so the description is not required to explain every parameter. It mostly repeats the schema's parameter list and adds limited new meaning. The 'must' wording for causal explanations conflicts slightly with the schema's '建议' (recommended) wording, which reduces reliability.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description opens with a specific action-resource pair ('写入一条关于用户的认知记忆') and enumerates the content categories it supports, making the tool's purpose clear. It does not explicitly contrast itself with siblings like cognitive_update or cognitive_forget, so it stops short of a 5.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

It explicitly states when to use the tool: for factual facts, preferences, rules, implied meanings, emotional patterns, values, workflows, and important events. It lacks exclusions or direct references to sibling tools for alternative operations, which prevents a top score.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

TDQS

A4.1/5.0
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.

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Connectors

Related MCP Servers

  • A
    license
    Not graded
    quality
    B
    maintenance
    Provides a persistent, cross-tool memory layer for AI coding agents via MCP, enabling storage and retrieval of decisions, preferences, and context across different tools and models.
    6
    1
    MIT
  • F
    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

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/gwq0514/cognitive-harness-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server