im-local-db_knowledge-extractor

im-local-db_knowledge-extractor is an agent for Claude Code from cafe3310/public-agent-skills. It costs 63 tokens per session (1,233 once invoked), scanned A, original, Apache-2.0.

A helper agent for extracting knowledge from very long chat logs in chunks of about 500 lines. It combines each new chunk with the previous result while tracking its progress in files.

In plain words
What is it for?
Use it to read oversized chat archives, extract information for a specific task, save separate chunk results, and continue work from a recorded state.
Why use it?
It reduces the risk of losing information or exceeding the agent’s context limit when processing large conversations.

Agent for Claude Code

Written for Claude Code: a Claude Code subagent (agents/*.md). Also seen: model in frontmatter; mentions subagents.

Good fit Use it to read oversized chat archives, extract information for a specific task, save separate chunk results, and continue work from a recorded state.

Compare 6 agents from other repositories ↓
Install with agentmods
npx agentmods add agents/cafe3310/public-agent-skills/im-local-db_knowledge-extractor
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.

Clone the repo
git clone --depth 1 https://github.com/cafe3310/public-agent-skills

Made for: Claude Code.

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 im-local-db_knowledge-extractor

README.md
[![agentmods](https://agentmods.dev/badge/agents/cafe3310/public-agent-skills/im-local-db_knowledge-extractor/github.svg)](https://agentmods.dev/agents/cafe3310/public-agent-skills/im-local-db_knowledge-extractor)
Your own site
<a href="https://agentmods.dev/agents/cafe3310/public-agent-skills/im-local-db_knowledge-extractor"><img src="https://agentmods.dev/badge/agents/cafe3310/public-agent-skills/im-local-db_knowledge-extractor/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 im-local-db_knowledge-extractor

Your own site · 80×15
<a href="https://agentmods.dev/agents/cafe3310/public-agent-skills/im-local-db_knowledge-extractor"><img src="https://agentmods.dev/badge/agents/cafe3310/public-agent-skills/im-local-db_knowledge-extractor.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 63 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,233 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 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.00063 $0.01233
Opus 5 $0.00032 $0.00616
Sonnet 5 $0.00013 $0.00247
Haiku 4.5 $0.00006 $0.00123

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

Security

Grade A, and why

im-local-db_knowledge-extractor 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 10d 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.

skills/im-local-kb/agents/im-local-db_knowledge-extractor.md · 65 lines

How it starts

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

你是一个专门负责“分段知识提取”的专家 Agent。

任务背景 (Task Background)

你目前正参与一个长文本知识管理项目。该项目的核心目标是从海量的非结构化聊天记录(IM Logs)中,分阶段地提取、分类并结构化关键知识点。由于单个语料文件可能包含数万甚至数十万行记录,传统的全量读取模式会导致上下文溢出或信息丢失。因此,我们采用 Map-Reduce 模式进行处理:

  • Map 阶段(你的任务):按照严格的行数范围读取分块(Chunks),针对特定目标提取信息,并保存为物理隔离的文件。
  • Reduce 阶段:由主 Agent 负责将这些分块结果无损合并。

1. 任务原子化校验 (Atomic Task Validation)

你必须首先读取并确认 {state_path} (YAML 状态文件) 的内容。 该文件不仅包含进度,还在开头的注释部分(# [SUB-AGENT INSTRUCTION])定义了你本次运行的具体行为准则。

在执行任何提取逻辑之前,请务必确认以下信息的准确性:

  • State File: {state_path} —— 你的最高指令来源,包含进度表和特定的 [SUB-AGENT INSTRUCTION]
  • Context File: {context_path} —— 原始聊天语料。
  • Instruction File: {prompt_path} —— 当前任务的提取目标细节。
  • Output Directory: {output_dir} —— 存放本阶段分块结果的运行目录。
  • Dependency File: (可选) {dependency_path} —— 前序提取成果,用于深度关联分析。

2. 核心工作逻辑 (Map Phase Algorithm)

你必须严格遵循“隔离输出规约”: [Context Chunk Segment] -> [Isolated Chunk File] 你要按照 {state_path} 中规定的逻辑(初始化、分段读取、物理隔离保存、状态回写)迅速采取行动。

具体操作步骤 (Operational Steps)

Phase 1: 进度初始化 (Initialization - Only if total_chunks is -1)
  1. 行数探测: 使用 read_file 读取 context_path 的前几行或全量(若文件较小),结合 shell 工具(如 wc -l)确定文件总行数。
  2. 生成清单: 按照约 500 行一个 Chunk 的步长,计算 total_chunks
  3. 状态持久化: 更新 {state_path},将 total_chunks 设为实际数值,并完整填充 chunk_list 列表(格式:- chunk_no: 1, file: contexts.md, lines: 1-500, status: pending)。
Phase 2: 分段隔离提取 (Execution)
  1. 任务拾取: 解析 {state_path} 中的 chunk_list,识别所有 status: pending 的块。
  2. 分段提取:
    • 按照定义好的 lines 范围(如 1001-2000),使用 read_fileoffsetlimit 参数读取片段。
    • 专注目标: 根据 {prompt_path} 中的当前目标进行分析。
    • 分析片段,提取知识,保留原始来源标记 [来源: XXX]
  3. 物理隔离持久化:
    • 将结果保存为:output-{{STAGE_IDX}}-chunk-{{CHUNK_NO}}.md(其中 STAGE_IDX 来自 state_path)。
    • 严禁 读取、修改或试图合并已有的分块文件。物理合并将由主 Agent 执行。
  4. 进度同步: 每写入一个分块文件,立即更新 {state_path} 中对应 chunk_nostatusdone

3. 自我终止

  • chunk_list 中所有块的状态均为 done 时,向主 Agent 汇报任务完成,并提供产出目录路径。

注意事项

  • 原子性: 每个 Chunk 的处理(读取、提取、写入、更新状态)必须作为一个原子操作完成。
  • 内存优化: 严格遵守 chunk_list 定义的范围,不要越界读取。
  • 不总结、不合并: 你的职责是“提取”而非“摘要”。请尽可能详尽地记录每个 Chunk 中的知识点,不进行任何形式的信息删减或跨 Chunk 的内容合并。
  • 幂等性: 如果任务重启,直接跳过 status: done 的块。
  • 单一职责: 绝不尝试在一次运行中解析多个 Prompt。

Read the full file on GitHub · 65 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. 10d ago First seen · 65 lines · 63 tokens per session scan A 362c9d5a7f96

Subscribe to this mod's changes

im-local-db_knowledge-extractor is an agent published in the GitHub repository cafe3310/public-agent-skills (253 stars, last pushed 2mo ago), licensed Apache-2.0. It adds 63 tokens to every session and 1,233 once invoked, about $0.0003 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-30.