smart-import

smart-import is a skill for Claude Code, Codex from Meari-Prototype/iftree-editor. It costs 95 tokens per session (2,212 once invoked), scanned A, original, Apache-2.0.

A document-import tool that turns any source file into a structured document tree while keeping its text exactly unchanged.

In plain words
What is it for?
Use it to import files by identifying their sections and paragraphs, generating validated JSON, and letting the system split paragraphs into sentences.
Why use it?
It separates structural work from writing, so imported content is not accidentally rewritten, corrected, or altered.

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/meari-prototype/iftree-editor/smart-import
Any agent
npx skills add Meari-Prototype/iftree-editor --skill smart-import
Clone the repo
git clone --depth 1 https://github.com/Meari-Prototype/iftree-editor

Made for: Claude Code, 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 smart-import

README.md
[![agentmods](https://agentmods.dev/badge/skills/meari-prototype/iftree-editor/smart-import.svg)](https://agentmods.dev/skills/meari-prototype/iftree-editor/smart-import)
Your own site
<a href="https://agentmods.dev/skills/meari-prototype/iftree-editor/smart-import"><img src="https://agentmods.dev/badge/skills/meari-prototype/iftree-editor/smart-import.svg" alt="Measured on agentmods" height="20"></a>
Per session 95 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,212 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.00095 $0.02212
Opus 5 $0.00048 $0.01106
Sonnet 5 $0.00019 $0.00442
Haiku 4.5 $0.00010 $0.00221

Measured 3d ago against content hash f735c40a59d2, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

smart-import 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 3d 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.

.iftree-llm-workspace/skills/smart-import/SKILL.md · 121 lines

How it starts

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

智能导入 skill(projectneed 4-3

把任意源文件整理成条件树文档并入库。本文写给执行导入的 LLM——内置 agent、外部模型、 或任何能跑脚本的工具都行:产物是与流式写入(db push)同一契约的 JSON, 经 db import-json 校验入库,不挑框架(4-3-4 去中心化)。

原则

  1. LLM 只贡献结构,不贡献正文。 正文 text 必须是导入源的逐字节切片, 由你写的脚本机械切割产生——你不得复述、改写、润色、纠错任何正文字符。 校验器会逐字节比对,改一个字就过不了。
  2. 观察样本、写脚本,不要逐段标注。 读源文的开头/中间/结尾各一段, 识别这个文件特有的结构模式(标题行特征、编号体系、段落分隔), 然后写一个一次性脚本扫全文产出 JSON。规则零成本,token 按量计费。
  3. 你造的文字走专用字段。 原文没有标题而你需要分组时,建虚拟容器: text 留空,章节名写进 nodeTitle,绝不把自己写的字混进 text
  4. 切到段落级,句子交给系统。 你只切到「章节 → 段落」两层:章节标题作 text 节点、 其下每个自然段作一个子 text 节点。不要自己切句子——产物 JSON 顶层加 "splitSentences": true, 入库后系统会用句末标点正则把每个段落自动细切成句子子节点(能用规则做的不劳你)。 也不要只切到章节那么粗:段落归属是规则识别不到、需要你判断的语义结构。

JSON 契约(与 db push 完全一致)

{
  "title": "文档标题",
  "splitSentences": true,
  "nodes": [
    {
      "text": "第一章 总则",
      "trustLevel": "不受控",
      "children": [
        { "text": "本章第一段的正文……。", "trustLevel": "不受控" },
        { "text": "本章第二段的正文……。", "trustLevel": "不受控" }
      ]
    },
    {
      "text": "第二章 罚则",
      "trustLevel": "不受控",
      "children": [
        { "text": "本章正文……。", "trustLevel": "不受控" }
      ]
    }
  ]
}

字段规则:

  • address:可选,不用写——系统按 children 嵌套前序自动生成(顶层 1-11-2…, 子节点为父地址 + 序号)。层级只用 children 嵌套表达即可,连续地址这种机械的事不用你算。
  • text:源文的逐字节连续切片。切片允许去掉首尾空白,不得改动内部任何字符 (包括空格、标点、换行——跨行句子保留原换行符)。
  • trustLevel:智能导入产物一律 "不受控"4-3-2-1)。
  • nodeTitle:你构造的标题(虚拟容器的章节名)。真实标题行不用它—— 原文里存在的标题行本身就是一个 text 节点。
  • 虚拟容器(text 为空的节点):必须给数值 sourcePosition, 取它后面第一个带正文的节点的句位序号减 0.5(句位序号 = 该节点在全部 text 非空节点的前序遍历中的序号,从 1 起)。相邻多个虚拟容器依次再减 (3.5、3.25 不必——用 3.5、3.4 等不冲突的小数即可,只为排序不碰撞)。
  • 带正文节点的 sourcePosition 可以省略:校验器锚定后自动回填句位。
  • nodeType 缺省 TEXT,导入阶段不做条件类型标注。

顺序铁律:树的前序遍历顺序必须与正文在源文中的出现顺序一致。 校验器按前序逐个在源文中向后匹配——你想重排章节顺序,那不是导入,别在这里做。

工作流

  1. 观察:读源文样本片段,写下这个文件的结构模式 (例:标题是独立行的「数字+顿号」;段落以空行分隔;含页眉「第 N 页」)。
  2. 写脚本:在 LLM 工作区(.iftree-llm-workspace)写一个一次性 node 脚本, 读源文 → 按你识别的模式切割 → 输出 tree.json。脚本要点: 按行/按模式定位结构边界,切到段落即可(句子层入库后由系统补);正文一律 slice 原文,不要重新拼写。
  3. 校验
    db import-json <工作区>/tree.json <源文件路径> --dry-run
    
    读返回的 JSON 报告,按 missing / out_of_order / uncovered 三类错误修脚本重跑,直到 ok: true
    • missing——正文在源文中不存在:九成是脚本改动了内部空白/换行, 或源文有不可见字符;对照 textPreview 定位。
    • out_of_order——正文存在但位置在已消费区间之前:JSON 顺序与源文不一致, 检查脚本的遍历顺序。
    • uncovered——源文有带字的区间没被任何节点覆盖:脚本漏切了这段,对照 textPreview 把它切进对应节点(系统不替你补、也不放行)。 地址、句子层由系统处理、你不用管:地址按 children 前序自动生成;段落正文由系统按句末标点切成 句子(段落本身变成空容器、句子作它的子)。但覆盖是你的事:纯空白(段落间空行、分页符)不用管、 靠段落空容器的位置表达边界;任何带字的区间(含装饰线 ⸻、漏掉的正文段)都得切进某个节点,否则报 uncovered
  4. 导入:去掉 --dry-run 正式入库(需要向量时加 --embed)。 命令自动完成:建文档(增量编辑模式)→ 批量建树 → 绑定源文档层与句位对照 (导入后的文档支持选区高亮与句位回溯)。
  5. 留档:脚本与 tree.json 留在工作区,默认保留 30 天—— 它们是这次导入的证据链,可追溯、可重跑、可修正后重导。

Read the full file on GitHub · 121 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. 3d ago First seen · 121 lines · 95 tokens per session scan A f735c40a59d2

Subscribe to this mod's changes

smart-import is a skill published in the GitHub repository Meari-Prototype/iftree-editor (5 stars, last pushed 1mo ago), licensed Apache-2.0. It adds 95 tokens to every session and 2,212 once invoked, about $0.0005 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

gog

Google Workspace CLI for Gmail, Calendar, Drive, Contacts, Sheets, and Docs.

the-open-agent/openagent · 20 tokens

powerpoint

Create designed, editable PowerPoint .pptx presentations with PptxGenJS. Use when the user asks to create, generate, update, or inspect a deck, slide deck, presentation, or .pptx file.

the-open-agent/openagent · 48 tokens

wiki-lint

Audit and maintain the health of the Obsidian wiki. Use this skill when the user wants to check their wiki for issues, find orphaned pages, detect contradictions, identify stale content, fix broken wikilinks, or perform general maintenance on their knowledge base. Also triggers on "clean up the wiki", "what needs…

Ar9av/obsidian-wiki · 152 tokens

docx

使用 OpenXML SDK (.NET) 进行专业的 DOCX 文档创建、编辑和格式化。 三种管道:(A) 从零创建新文档,(B) 在已有文档中填充/编辑内容, (C) 应用模板格式化并通过 XSD 验证门控检查。 当用户需要生成、修改或格式化 Word 文档时,必须使用此 skill—— 包括他们说"写一份报告"、"起草建议书"、"制作合同"、 "填写此表单"、"按此模板重新排版",或任何最终输出为 .docx 文件的任务。 即使用户未明确提及 "docx",如果任务暗示生成可打印/正式文档,也应使用此 skill。.

Playa-0v0/Cyrene-Agent · 169 tokens

pptx-generator

生成、编辑和读取 PowerPoint 演示文稿。使用 PptxGenJS 从零创建(封面、目录、内容、章节分隔、总结幻灯片),通过 XML 工作流编辑已有 PPTX,或使用 markitdown 提取文本。触发词:PPT、PPTX、PowerPoint、演示文稿、幻灯片、slide、deck、slides。.

Playa-0v0/Cyrene-Agent · 90 tokens

pdf

Create, inspect, fill, reformat, and visually verify PDFs on Windows with local Python rendering. Use whenever a PDF must preserve deliberate layout, including Chinese text, tables, charts, covers, or form fields.

Playa-0v0/Cyrene-Agent · 45 tokens