reduce

A cleanup workflow for a thinking-tree fragment pool, a file containing saved pieces of thought.

In plain words
What is it for?
Filtering, merging, deleting, and keeping fragments in the thinking-tree files.
Why use it?
It helps remove entries outside your preferences, duplicates, and outdated ideas while letting you review each group.

Skill for Claude CodeCodex

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.

agentmods
npx agentmods add skills/corallips/thinking-tree/reduce
Any agent
npx skills add CoralLips/thinking-tree --skill reduce
Clone the repo
git clone --depth 1 https://github.com/CoralLips/thinking-tree

Made for: Claude Code, Codex.

Per session 36 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,374 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found 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 $0.00036 $0.01374
Opus 5 $0.00018 $0.00687
Sonnet 5 $0.00007 $0.00275
Haiku 4.5 $0.00004 $0.00137

Measured yesterday against content hash 83ae203909e8, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

reduce 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 yesterday.

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.

skills/reduce/SKILL.md · 129 lines

How it starts

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

碎片池瘦身

对 thinking-tree 碎片池进行清理:偏好过滤、去重、过时删除。 纯减法操作——不读不写思路文件,只在碎片池内部操作。 使用 AskUserQuestion 提供选项式交互,用户无需打字即可审核。

推荐顺序:先 /reduce(清垃圾),再 /distill(建结构)


工具准备

本 skill 依赖 AskUserQuestion 提供选项式确认。进入交互前:

  1. 若工具列表已含 AskUserQuestion → 直接使用
  2. 未加载 → 先执行 ToolSearch("select:AskUserQuestion") 加载 schema
  3. 加载失败(session 不支持该工具)→ 降级为纯文本确认:
    • 清晰列出编号选项(例如 1) 全部删除 2) 逐条选择 3) 全部保留
    • 明确告知回复格式(例如「回复编号」)
    • 不要跳过确认步骤

降级只影响呈现方式,不影响功能。


执行步骤

1. 读取数据

读取以下文件(~ = 用户 home 目录):

  • ~/.thinking-tree/fragments.md — 碎片池(主要处理对象)
  • ~/.thinking-tree/.preferences.md — 用户偏好(判断碎片是否符合记录范围)

2. 分析碎片

对每个碎片(以 ## 开头、由 --- 分隔的段落)逐条评估,分为四组:

判断标准 动作
偏好外组 不符合 .preferences.md 中的记录范围(如工程细节) 删除
重复组 核心论点与另一条碎片相同(仅措辞/例子不同) 合并为一条
过时组 已被后续思考覆盖、推翻、或已无参考价值 删除
保留组 独立有效,不重复不过时 保留原位

3. 输出总览

先输出一行统计,让用户了解整体情况:

整理分析完成:73 条碎片 → 偏好外 6 条,重复 12 条,疑似过时 5 条,保留 50 条

4. 逐组确认(AskUserQuestion 交互)

重要:使用 AskUserQuestion 工具让用户通过选项确认,不要让用户打字。 交互原则:推荐操作放第一位,让用户一键确认即可进入下一步。

4a. 偏好外组 — 单选批量确认

读取 .preferences.md 的记录范围,标记不符合的碎片。使用 AskUserQuestion:

  • question: "发现 N 条碎片不符合当前记录偏好(如:工程细节),如何处理?"
  • header: "偏好过滤"
  • multiSelect: false
  • options:
    • label: "全部删除 (Recommended)", description: "删除全部 N 条偏好外碎片:[列出标题摘要]"
    • label: "逐条选择", description: "展开每条碎片,逐一确认是否删除"
    • label: "全部保留", description: "不做改动"

如果用户选"逐条选择",再用 multiSelect 展开每条碎片供选择(最多 4 条一批)。

4b. 重复组 — 每组重复碎片一起确认

对每组重复碎片(2-3 条一组),使用 AskUserQuestion:

  • question: "这 N 条碎片表达了相似观点,如何处理?"
  • header: "去重"
  • options:
    • label: "合并 (Recommended)", description: "保留最精炼的表述,删除冗余"
    • label: "全部保留", description: "不做改动"
  • preview: 展示这几条碎片的标题和关键内容对比
  • multiSelect: false
4c. 过时组 — 单选批量确认

使用 AskUserQuestion:

  • question: "发现 N 条碎片可能已过时,如何处理?"
  • header: "过时清理"
  • multiSelect: false
  • options:
    • label: "全部删除 (Recommended)", description: "删除全部 N 条过时碎片:[列出标题摘要+过时原因]"
    • label: "逐条选择", description: "展开每条碎片,逐一确认是否删除"
    • label: "全部保留", description: "不做改动"

Read the full file on GitHub · 129 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. yesterday First seen · 129 lines · 36 tokens per session scan A 83ae203909e8

Subscribe to this mod's changes

reduce is a skill published in the GitHub repository CoralLips/thinking-tree (1 stars, last pushed 4mo ago), licensed MIT. It adds 36 tokens to every session and 1,374 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other skills, from other repositories