tokenknows-distill

tokenknows-distill is a skill for Codex from johnnywuj81/tokenknows. It costs 115 tokens per session (865 once invoked), scanned B, original, MIT.

A tool workflow that turns a Codex conversation into a structured knowledge document. It can produce formats such as a weekly report, technical design, architecture decision record, incident review, book, reusable agent skill, or knowledge graph.

In plain words
What is it for?
Use it to document recent work, record technical decisions, review incidents, create reusable instructions, or map people, events, concepts, and artifacts.
Why use it?
It preserves useful decisions, evidence, and lessons from a working session instead of leaving them buried in chat. The generated documents can be reviewed and edited in a web workspace.

Skill for Codex

Written for Codex: reads ~/.codex or $CODEX_HOME. Also seen: mentions Codex.

Good fit Use it to document recent work, record technical decisions, review incidents, create reusable instructions, or map people, events, concepts, and artifacts.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/johnnywuj81/tokenknows/tokenknows-distill
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 johnnywuj81/tokenknows --skill tokenknows-distill
Clone the repo
git clone --depth 1 https://github.com/johnnywuj81/tokenknows

Made for: Codex.

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 tokenknows-distill

README.md
[![agentmods](https://agentmods.dev/badge/skills/johnnywuj81/tokenknows/tokenknows-distill/github.svg)](https://agentmods.dev/skills/johnnywuj81/tokenknows/tokenknows-distill)
Your own site
<a href="https://agentmods.dev/skills/johnnywuj81/tokenknows/tokenknows-distill"><img src="https://agentmods.dev/badge/skills/johnnywuj81/tokenknows/tokenknows-distill/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 tokenknows-distill

Your own site · 80×15
<a href="https://agentmods.dev/skills/johnnywuj81/tokenknows/tokenknows-distill"><img src="https://agentmods.dev/badge/skills/johnnywuj81/tokenknows/tokenknows-distill.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 115 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 865 The whole file, excluding the scripts and references it only reads on demand.
Security scan B 1 finding. A grade says what 26 rules found in the file — not that it is safe.
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.1 $0.00115 $0.00865
Opus 5 $0.00057 $0.00432
Sonnet 5 $0.00023 $0.00173
Haiku 4.5 $0.00012 $0.00086

Measured 8d ago against content hash 95861be15517, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-08, from the pricing page.

Security

Grade B, and why

tokenknows-distill scanned grade B with 1 finding 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 8d 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.

Reads agent configuration directoriesmediumAgent snooping

.claude/, .codex/, .gemini/ hold keys, settings and other credentials a mod has no legitimate need for.

把研发会话沉淀成结构化知识资产。工具来自 `tokenknows` MCP server(在 `~/.codex/config.toml` 的 `[mcp_servers.tokenknows]` 配置)。
codex-plugin/plugins/tokenknows/skills/tokenknows-distill/SKILL.md · 47 lines

What it actually says

TokenKnows 蒸馏

把研发会话沉淀成结构化知识资产。工具来自 tokenknows MCP server(在 ~/.codex/config.toml[mcp_servers.tokenknows] 配置)。

何时用

  • 用户想把当前/最近的工作沉淀成文档:"写个周报"、"出个 ADR"、"复盘一下这次故障"、"做个知识图谱"
  • 用户想把会话提炼成可复用 skill:"把这套做法存成 skill"

7 种文档类型

type 用途
weekly_report 本周进展 / Bug / 决策 / 风险 / 下周计划
tech_design 技术方案 6 部分
adr 架构决策记录
incident 问题复盘
book 长文档 (卷-章-节)
agent_skill 蒸馏可复用 SKILL.md (需主题 topic_hint)
knowledge_graph 实体关系图谱

关键步骤

  1. 先确认会话已入库 (use mcp__tokenknows__submit_session_events): 把当前会话的关键 turn 提交到 TokenKnows,作为蒸馏素材。
  2. 触发蒸馏 (use mcp__tokenknows__distill_document): 传 type (上表之一) + 可选 time_window (this_week / last_7_days / last_14_days / last_30_days)。 agent_skill 类型必须带 topic_hint (单一主题,否则蒸不出可用 skill)。
  3. 取结果 (use mcp__tokenknows__list_assetsmcp__tokenknows__get_assetmcp__tokenknows__get_asset_chapters): 告诉用户文档已生成,给出 asset 标题 + view_url(绝对 URL,前缀由 TOKENKNOWS_WEB_BASE 决定,默认 http://127.0.0.1:5173;登录 Web 工作台后查看/编辑/发布)。

好例子 / 坏例子

  • 坏:用户说"写周报"→ 直接凭记忆编。 先 submit 会话 + distill,让后端基于真实事件 + 证据链生成。
  • 好:distill_document(type="knowledge_graph", time_window="last_14_days") → 返回 asset → get_asset_chapters 拿图谱节点/边 → 转述给用户。

注意

  • 工具会 POST 到本地后端 (默认 http://127.0.0.1:8001),后端必须在跑。后端不通 / 401 缺 token / 404 项目不存在时,工具会返回带修复指引的双语错误信息 — 原样转述给用户即可。
  • 蒸馏是后台 5 阶段流水线 (collect → outline → content → evidence → assess),distill_document 立即返回 generating 态,稍后 get_asset 轮询到 draft。
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. 8d ago First seen · 47 lines · 115 tokens per session scan B 95861be15517

Subscribe to this mod's changes

tokenknows-distill is a skill published in the GitHub repository johnnywuj81/tokenknows (4 stars, last pushed yesterday), licensed MIT. It adds 115 tokens to every session and 865 once invoked, about $0.0006 per session on Opus 5. A static security scan graded it B with 1 finding (reads agent configuration directories). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.