SuperAPI AI 工具集

update-topic-ledger

写作与研究

查看项目

更新于 10-16 00:02

技能介绍

用途:维护 substacker 的 shared-context/topic-ledger.md,将其作为语料库中所有主题的追加与更新索引。供 ingest-inbox-item 在处理新种子第 8 步时调用,也供任何会改变状态(promote/publish/kill)的智能体调用。

主要能力:每个主题在账本中对应一个区块,记录 seeds 数、drafts 数、published 数、last_touched 日期、temperature(hot/warm/cold)以及 top_seeds(按 density 排名前三)。

使用方式:输入 {topic: str, event: str, seed_id: str, density: int}。流程为读取账本、找到或创建该主题行;按事件(ADDED/PROMOTED/PUBLISHED/KILLED)更新计数;更新 last_touched 为当天;重算 temperature;重算 top_seeds 为除 dead 外所有状态中 density 前三;写回该行。事件对计数的影响:ADDED 使 seeds +1;PROMOTED 使 seeds -1、drafts +1;PUBLISHED 使 drafts -1、published +1;KILLED 使对应计数 -1 并 dead +1。输出为更新后的 topic-ledger.md,副作用是单文件 diff 式写入。热度规则:last_touched 在 14 天内为 hot,14–60 天为 warm,超过 60 天为 cold,每次更新时重新计算而非存储。

限制与守则:即使计数降为 0 也不删除主题行,改标 cold 以保留历史信号;不将 pending 标签静默提升为 canonical,只更新已在 canonical 中的标签;top_seeds 排除 dead 种子,种子升为 draft 后保留其 density;不批量按字母重排行,保留现有顺序;单线程执行,由 Librarian 串行化调用以避免竞争。