cognitive-integrate-fragments

cognitive-integrate-fragments is a skill for Cursor from TashanGKD/cognitive-os. It costs 73 tokens per session (3,716 once invoked), scanned A, a copy of cognitive-integrate-fragments, MIT.

A knowledge-integration workflow moves pending small notes into larger, structured knowledge documents. It reviews how each note fits, asks the user to confirm changes, writes approved updates, and updates related indexes.

In plain words
What is it for?
Use it to list notes waiting for integration, process selected notes, update target knowledge documents, detect conflicts, and apply related map updates after confirmation.
Why use it?
It prevents scattered notes from remaining disconnected or being added in ways that conflict with existing knowledge. It also keeps the knowledge map and integration status current.

Skill for Cursor

Written for Cursor: installed under .cursor/.

Good fit Use it to list notes waiting for integration, process selected notes, update target knowledge documents, detect conflicts, and apply related map updates after confirmation.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/tashangkd/cognitive-os/cognitive-integrate-fragments
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add TashanGKD/cognitive-os --skill cognitive-integrate-fragments
Clone the repo
git clone --depth 1 https://github.com/TashanGKD/cognitive-os

Made for: Cursor.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for cognitive-integrate-fragments

README.md
[![agentmods](https://agentmods.dev/badge/skills/tashangkd/cognitive-os/cognitive-integrate-fragments/github.svg)](https://agentmods.dev/skills/tashangkd/cognitive-os/cognitive-integrate-fragments)
Your own site
<a href="https://agentmods.dev/skills/tashangkd/cognitive-os/cognitive-integrate-fragments"><img src="https://agentmods.dev/badge/skills/tashangkd/cognitive-os/cognitive-integrate-fragments/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for cognitive-integrate-fragments

Your own site · 80×15
<a href="https://agentmods.dev/skills/tashangkd/cognitive-os/cognitive-integrate-fragments"><img src="https://agentmods.dev/badge/skills/tashangkd/cognitive-os/cognitive-integrate-fragments.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 73 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 3,716 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin 88% copy Near-identical to another mod in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00073 $0.03716
Opus 5 $0.00036 $0.01858
Sonnet 5 $0.00015 $0.00743
Haiku 4.5 $0.00007 $0.00372

Measured 11d ago against content hash 41ea4e16ee95, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-11, from the pricing page.

Security

Grade A, and why

cognitive-integrate-fragments scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 11d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

Origin

This is a copy

88% identical to cognitive-integrate-fragments — 10 lines differ, which has more behind it and is treated as the original. This page carries a canonical link to it rather than competing with it.

.cursor/skills/cognitive-integrate-fragments/SKILL.md · 260 lines

How it starts

The opening of the file, as written. The whole thing — 260 lines — stays where its author put it; the contents beside it link to each section on GitHub.

碎片整合 Skill(Integrate Fragments)

实现「小人整合机制」:读取待整合碎片 → 判断同化/顺应 → 生成具体更新建议 → 用户确认 → 执行写入 → 级联更新。


知识导航表(执行前必须理解的概念根)

层级 文档 需要理解的概念
D0 认知根(必读) cognitive/L1_knowledge/formal_spec/self_evolving_agent_spec.md 层5:ceremony(K) = 备份+修改+版本+级联;层3:C2关系显式化(修改K1后必须通知依赖它的B-objects)
D3 规范参考 cognitive/maintenance_protocol.md K1文档修改规范:版本管理/历史备份/矛盾检测要求
D4 运行时数据 cognitive/L2_fragments/fragment_index.md + 目标L1文档 待整合碎片清单 + 目标文档当前内容(整合前必须理解已有结构)

核心概念速查: ① 小人机制 = 以「已在L1文档里居住的知识」视角判断碎片如何融入,不破坏已有结构 ② 整合 = K-object升级:fragment→被L1吸收,碎片整合索引更新为🔲→✅ ③ 整合后必须更新L0总地图——C2级联:K1变化需通知依赖该知识的所有对象


激活后立即执行

Step 1  读取待整合碎片列表
        Read: cognitive/L2_fragments/fragment_index.md
        → 筛选出所有「🔲 待整合」和「⚠️ 部分整合」的条目
        → 如果没有待整合碎片:「当前没有待整合的碎片。知识体系已是最新状态。」→ 结束
        → 展示待整合列表给用户,询问:「是处理全部(N个),还是指定某个?」

Step 0.5  判断是否启用独立整合器(CS-012 修复,在 Step 1 之后执行)
        统计本次用户选中的待整合碎片数量 N:
        
        IF N ≥ 5:
          调用 cognitive-fragment-integrator 子智能体:
          输入:{
            target_l1_doc_path: [目标 L1 文档路径],
            fragment_ids: [选中的碎片 ID 列表],
            fragment_paths: [对应的碎片文件路径列表]
          }
          等待 integration_plan 输出
          向用户展示整合方案:
          「━━ 批量整合方案(共 N 条碎片)━━
            [每条碎片:fragment_id / section_name / position_type / confidence]
            ⚠️ confidence="低" 的碎片已标注,建议优先审查
            ─────────────────────
            [逐条确认(推荐)] [全部确认] [逐条审查]」
          用户确认后,按 integration_plan 执行写入:
            a. 按方案执行 StrReplace(section_name + anchor_keyword 定位)
            b. 追加变更记录(每个文档一条)
            c. 更新碎片整合索引(所有已整合碎片状态改为 ✅)
            d. 更新 L0 大脑总地图
            e. 追加 L3 系统日志
          对 unresolved_fragments(有矛盾,无法自动处理):
            告知用户:「以下碎片存在矛盾,需手动决策:[碎片ID + 矛盾描述]」
          → 写入完成后跳到 Step 7(调用 cognitive-verifier)
        
        IF N < 5:
          继续原有流程(Step 2 → Step 7)

Step 2  对每个待整合碎片,用内置 explore 子智能体并行读取:
        - 碎片完整内容
        - 碎片关联的L1文档相关章节(只读相关章节,不是整篇)
        
        【为什么用 explore 子智能体】
        碎片内容 + L1 文档相关章节可并行读取,比串行快;
        且碎片内容留在子智能体 context 中,不膨胀主对话。
        主 Agent 只接收「关键摘要 + 关联段落」用于分析。

        [L1.5 模式匹配]
        → 碎片是否是已有L1.5原则(P1/P2)的一个新实例?
        → 是 → 记录「印证了P?」,不额外整合进L1(已有原则的例证不需要单独进L1)
        → 否 → 继续判断

        [同化/顺应判断]
        → 比较碎片与L1文档相关段落:
        → 同化(supplement):碎片是对现有内容的补充/延伸,无冲突
          → 生成补充建议:在[文档]的[章节]追加「...」
        → 顺应(revise):碎片与现有内容有张力或矛盾
          → 先运行矛盾检测(见 Step 3),再生成修订建议
        → 已覆盖(covered):现有文档已包含该观点
          → 标记碎片为「已覆盖」,告知用户,无需整合

Step 3  [矛盾检测](仅当发现顺应情况时执行)
        → 描述矛盾点:「碎片说X,但文档[Y]第Z章说了W,两者有[直接冲突/隐式张力]」
        → 基于L1.5原则推导消解方案:
          选项A:修改文档[Y]的[位置]
          选项B:两者都对,在文档中明确区分适用场景(添加前提条件)
          选项C:碎片观点需要修正(告知用户)
        → 向用户展示,请用户决策

Step 4  生成整合建议,逐个向用户展示确认(diff 格式)
        「━━ 碎片 F-XXX 整合建议 ━━
          目标文档:[文档名] > [章节]
          操作类型:[追加 | 修订 | 已覆盖]
          ┌ 建议内容 ┐
          [具体的新增/修改文字]
          └──────────┘
          归因:🟢 AI整理(基于用户原始碎片)
          风险:[🟢 低 | 🟡 中 | 🔴 高]
          ─────────────────────────
          [✅ 确认整合] [✏️ 修改后整合] [❌ 跳过] [⏸️ 延迟]」

Step 5  执行用户确认的整合
        对每个「确认」或「修改后确认」的建议:
        a. Write:精确修改L1文档对应位置(追加/替换/插入)
        b. 追加 [文档名]_变更记录.md(格式见下方)
        c. 更新碎片整合索引.md(✅已整合 + 整合时间)
        d. 更新 L0_大脑总地图.md(该文档最后更新时间)
        e. 追加 cognitive/L3_logs/system_log.md

        对「跳过」的:更新索引为「⚠️ 部分整合(用户跳过)」
        对「延迟」的:保持 🔲 待整合 状态

Step 6  收尾汇总 + 矛盾检测(E1A 修复:顺应型整合强制触发)
        「━━ 整合完成 ━━
          ✅ 已整合:N 个碎片
          ⚠️ 跳过:M 个
          🔲 仍待处理:K 个
          涉及文档:[文档名1]、[文档名2]」
          
        [强制条件] 本次整合中是否包含任何「顺应(revise)」类型的操作?
        → 是(本次有顺应操作):
          【强制执行】自动触发 cognitive-detect-contradiction
          → 检查范围:本次 revise 操作涉及的 L1 文档(限定范围,不做全库扫描)
          → 矛盾检测结果汇总到本步骤的输出中,用户无需再次手动确认触发
        → 否(本次全为同化/已覆盖):
          告知:「本次整合均为追加操作,无矛盾风险,可跳过矛盾检测。」
          (可选:「[仍然检查] [完成]」)

Step 7  调用 cognitive-verifier 子智能体(CS-010 修复)
        
        ⚠️ B4 任务日志写入在本步骤之后执行。
        
        输入:{
          target_doc_path: [本次整合涉及的主要 L1 文档路径],
          update_summary:  "碎片整合:共整合 N 个碎片,涉及 [章节] 的 [操作类型]",
          related_docs:    [本次整合中修改过的其他 L1 文档路径列表],
          call_context:    "integration"
        }
        
        处理验证报告(同 cognitive-update-knowledge Step 8 的处理逻辑):
        → verdict = "通过":告知用户验证通过,B4 写入(状态:完成)
        → verdict = "警告":展示警告,询问用户是否接受,接受则 B4 写入(完成)
        → verdict = "不通过":展示问题 + 建议,B4 写入(状态:挂起),任务挂起

Read the full file on GitHub · 260 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 11d ago First seen · 260 lines · 73 tokens per session scan A 41ea4e16ee95

Subscribe to this mod's changes

cognitive-integrate-fragments is a skill published in the GitHub repository TashanGKD/cognitive-os (9 stars, last pushed 5mo ago), licensed MIT. It adds 73 tokens to every session and 3,716 once invoked, about $0.0004 per session on Opus 5. A static security scan graded it A with 0 findings. It is 88% identical to cognitive-integrate-fragments, differing in 10 lines, and is treated as a copy.