diff --git a/CHANGELOG.md b/CHANGELOG.md index c75dce8..dccb859 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,8 @@ Add an entry here when the project meaningfully changes for users, for example: - DeepPaperNote can now be installed as a Claude Code plugin from the repository's own marketplace, with `claude plugin marketplace add 917Dhj/DeepPaperNote`. The skills CLI (`npx skills add`) remains the agent-neutral route. +- `organize-wiki` is a new companion skill that organizes the paper library with you. It agrees on the domain folders and writes them as `/DeepPaperNote/domains.md`. After you confirm a preview, it moves misfiled paper folders, fixes `papers/` tags, and rewrites path links. Every reorganization is logged and the last one can be undone. + ### Changed - The agent now chooses each new paper's domain folder after reading what the existing domains hold, or the user's convention in `/DeepPaperNote/domains.md`. It reuses an existing domain by default and creates a new one only with a stated reason, which the final report repeats. The keyword table `domain_rules.yaml` is removed. diff --git a/README.md b/README.md index b89f4f9..de0c7cd 100644 --- a/README.md +++ b/README.md @@ -71,7 +71,7 @@ claude plugin install deeppapernote@deeppapernote npx skills add 917Dhj/DeepPaperNote ``` -Both routes install the same skills. The plugin route brings `deeppapernote`, `paper-glossary`, and `research-memory`; the skills CLI installer lets you choose which skills to install and which agents should receive them. For most users, start with `deeppapernote`; add `paper-glossary` if you want reusable terminology notes, and `research-memory` if you want takeaways tailored to your own research. +Both routes install the same skills. The plugin route brings `deeppapernote`, `paper-glossary`, `research-memory`, and `organize-wiki`; the skills CLI installer lets you choose which skills to install and which agents should receive them. For most users, start with `deeppapernote`; add `paper-glossary` if you want reusable terminology notes, `research-memory` if you want takeaways tailored to your own research, and `organize-wiki` if you want help keeping your library's domain folders in order. ### 2. Install the core PDF dependency @@ -124,6 +124,7 @@ DeepPaperNote remains the main product. The repository also includes optional co | [`deeppapernote`](./skills/deeppapernote/SKILL.md) | **Core product · recommended** | Read one paper deeply and produce a structured, evidence-based Obsidian note with figures, results, and limitations | | [`paper-glossary`](./skills/paper-glossary/SKILL.md) | Optional companion | Select terms from existing paper artifacts, create reusable Obsidian glossary notes, and optionally link them back to the paper note | | [`research-memory`](./skills/research-memory/SKILL.md) | Optional companion | Let the agent interview you, with evidence from the papers you have read, to record your research directions in Obsidian; DeepPaperNote then tailors each note's transferable ideas to them | +| [`organize-wiki`](./skills/organize-wiki/SKILL.md) | Optional companion | Agree on your library's domain folders with the agent, then refile misplaced papers and fix their tags after a preview; DeepPaperNote follows the resulting convention when it files a new paper, and the last reorganization can be undone | You do not need to install every skill. Choose the ones that match your workflow during installation. diff --git a/README.zh-CN.md b/README.zh-CN.md index 27d80ab..c3c9857 100644 --- a/README.zh-CN.md +++ b/README.zh-CN.md @@ -71,7 +71,7 @@ claude plugin install deeppapernote@deeppapernote npx skills add 917Dhj/DeepPaperNote ``` -两条路径安装的是同一组 skill。插件路径会一并装上 `deeppapernote`、`paper-glossary` 与 `research-memory`;skills CLI 安装程序则让你选择需要安装的 skill,以及要安装到哪些 Agent。大多数用户可以先选择 `deeppapernote`;需要可复用术语笔记时,再选择 `paper-glossary`;希望阅读收获贴合自己的研究方向时,再选择 `research-memory`。 +两条路径安装的是同一组 skill。插件路径会一并装上 `deeppapernote`、`paper-glossary`、`research-memory` 与 `organize-wiki`;skills CLI 安装程序则让你选择需要安装的 skill,以及要安装到哪些 Agent。大多数用户可以先选择 `deeppapernote`;需要可复用术语笔记时,再选择 `paper-glossary`;希望阅读收获贴合自己的研究方向时,再选择 `research-memory`;想让 agent 帮你整理知识库的领域文件夹时,再选择 `organize-wiki`。 ### 2. 安装核心 PDF 依赖 @@ -124,6 +124,7 @@ DeepPaperNote 仍然是唯一主产品。仓库同时提供几个可选 companio | [`deeppapernote`](./skills/deeppapernote/SKILL.md) | **核心产品 · 推荐安装** | 精读单篇论文,生成包含图表、关键结果与局限的结构化、证据充分的 Obsidian 笔记 | | [`paper-glossary`](./skills/paper-glossary/SKILL.md) | 可选 companion | 从已有论文材料中筛选术语,创建可复用的 Obsidian 术语笔记,并按需链接回论文笔记 | | [`research-memory`](./skills/research-memory/SKILL.md) | 可选 companion | 由 agent 结合你读过的论文向你提问,把你的研究方向记录在 Obsidian 里;DeepPaperNote 之后会据此写每篇笔记的"可迁移" | +| [`organize-wiki`](./skills/organize-wiki/SKILL.md) | 可选 companion | 和 agent 一起商定知识库的领域分类,预览确认后再把放错的论文归位、修正标签;DeepPaperNote 之后按这份约定为新论文选择文件夹,上一次整理可以撤销 | 你不需要一次安装所有 skill。安装时选择适合自己工作流的部分即可。 diff --git a/skills/deeppapernote/SKILL.md b/skills/deeppapernote/SKILL.md index 2e5f350..b02128b 100644 --- a/skills/deeppapernote/SKILL.md +++ b/skills/deeppapernote/SKILL.md @@ -122,7 +122,7 @@ Lint is a floor, not polish: while the readability review is pending, say the dr Final user report: - After a successful Formal Save, report in the user's conversation language, and derive every claim from current-run artifacts; the `summary` of `scripts/run_state.py status` carries these fields. -- Lead with the final note link or path, the save mode, and the actual saved domain, read from the note path under the configured papers root in Obsidian mode or the output root in workspace mode. When admission reused an existing directory, report that directory's existing domain. When the save receipt's `new_domain` is true, say that this domain folder was created and give its `new_domain_reason`. +- Lead with the final note link or path, the save mode, and the actual saved domain, read from the note path under the configured papers root in Obsidian mode or the output root in workspace mode. When admission reused an existing directory, report that directory's existing domain. When the save receipt's `new_domain` is true, say that this domain folder was created, give its `new_domain_reason`, and suggest the organize-wiki skill to add the domain to the user's convention. - Then report, in order: 1. the paper title and strongest verified identifier 2. the Grounding Lint, Final Note Lint, Final Quality Review, and Final Readability Review results, plus the warning count diff --git a/skills/deeppapernote/references/domain-routing.md b/skills/deeppapernote/references/domain-routing.md index 2959878..b661e50 100644 --- a/skills/deeppapernote/references/domain-routing.md +++ b/skills/deeppapernote/references/domain-routing.md @@ -26,7 +26,7 @@ The note's `tags` carry exactly one `papers/` tag, naming the saved doma ## The Domains File -`/DeepPaperNote/domains.md` is the user's classification convention, maintained with the user outside DeepPaperNote. DeepPaperNote only reads it: +`/DeepPaperNote/domains.md` is the user's classification convention, which the organize-wiki skill keeps with the user. DeepPaperNote only reads it: ```markdown --- diff --git a/skills/organize-wiki/README.md b/skills/organize-wiki/README.md new file mode 100644 index 0000000..86f31bc --- /dev/null +++ b/skills/organize-wiki/README.md @@ -0,0 +1,15 @@ +# Organize Wiki + +`organize-wiki` keeps your paper library in domain folders you agree with. It writes the convention `/DeepPaperNote/domains.md`, which DeepPaperNote follows when it files a new paper, and it moves and retags papers to match. + +The agent reads your library and your research memory, proposes merges, splits, renames, and moves with evidence, and asks you in short rounds. Nothing changes until you have seen the preview and confirmed it. Every reorganization is logged under `/DeepPaperNote/organize-log/`, and "撤销上一次整理" / "undo the last reorganization" restores it while the touched files stay unedited. + +Start it with `/organize-wiki`, or ask "整理我的知识库" / "organize my paper library". + +It moves whole paper folders between domains and never renames a paper folder or a note, so links by file name keep working; links that spell out a moved path are rewritten. Notes without frontmatter are moved but never edited. + +See [`references/file-contract.md`](references/file-contract.md) for the file format and script interfaces. + +```bash +python3 -m pytest -q skills/organize-wiki/tests +``` diff --git a/skills/organize-wiki/SKILL.md b/skills/organize-wiki/SKILL.md new file mode 100644 index 0000000..4e3c690 --- /dev/null +++ b/skills/organize-wiki/SKILL.md @@ -0,0 +1,67 @@ +--- +name: organize-wiki +description: Use when the user wants to organize their paper library (整理知识库): review or change its domain folders, write the domain convention DeepPaperNote follows, refile misplaced papers, fix papers/ tags, or undo the last reorganization. +--- + +# Organize Wiki + +Keep the user's paper library in domain folders they agree with. You **propose**, with evidence from the library and their research memory; the user decides. Only a confirmed plan reaches the vault, only through `scripts/organize.py`, and only after the user has seen its preview. + +`references/file-contract.md` defines the library layout, the domains file, the scan, the plan, and the log. Read it before step 3. + +To undo the last reorganization, run `python3 scripts/organize.py undo --latest`, report what it restored or the conflicts it lists, and stop. + +## 1. Read the library + +Run `python3 scripts/scan_library.py --output /scan.json`. It finds the vault through DeepPaperNote's configuration. On `needs_vault` or `not_a_vault`, ask the user once for their Obsidian vault folder and pass `--vault ` to every script. + +**Done when** the scan reports `status: ok`. + +## 2. Agree on the convention + +The **convention** is the set of domains, each with a definition, what it includes, what it excludes and where that goes instead, and three to five representative papers. `domains_file.exists` picks the mode. + +**Building** (no domains file): draft each existing domain's fields from its papers' titles and excerpts, then propose changes to the set: +- merge a domain holding one or two papers, or two domains whose papers mostly overlap; +- split a domain past about 25 papers that holds at least two clear sub-areas of five or more papers each; +- rename a domain whose name is broader or vaguer than what its papers are about; +- add a domain for papers no domain covers. + +**Updating** (the file exists): every domain in it counts as confirmed. Ask only about change: papers no domain includes, papers a domain's own excludes rule out, domains grown past about 25 or shrunk to one or two, definitions that overlap. + +In both modes: +- With `research_memory.exists`, split finer along the user's directions and keep not-focus topics coarse. Without it, say once that a research memory would fit the split to their research, and go on. +- The thresholds are guides; give the reason when you depart from them. +- Domains stay one level: a split makes sibling folders. A new name is a specific research area at the level of its siblings, written with letters, digits, `_`, and `-` only. + +Interview in **rounds** of at most four numbered questions in the user's language. Each asks one decision, with your proposal and its evidence (paper counts and titles), worded so "yes" accepts it. Show the full convention draft once the rounds settle it. + +**Done when** the user has confirmed the complete convention. + +## 3. Plan the changes + +Assign every paper to a domain of the convention by its title and excerpt; its current folder is weak evidence. Present the plan in groups, each item numbered with a one-line reason: + +1. **Folder changes**: domains created, renamed, merged, or removed. +2. **Moves**: each misfiled paper, from and to. +3. **Tag fixes**: papers that stay put with `tag_status` `mismatch` or `multiple`. Moved papers get the same fix automatically. Notes without frontmatter stay untouched. +4. **Structure**: flatten each `nested_folder`, wrap each `loose_file` in its own paper folder, and move each `paper_at_root` into a domain. Report each `images_index` without changing it. +5. **Needs your judgment**: each paper you cannot place with confidence, asked as a question with your best guess. + +The user accepts everything or rejects items by number. Write what they accepted as the plan JSON. + +**Done when** every item is accepted or rejected and no question is open. + +## 4. Preview, confirm, apply + +Run `python3 scripts/organize.py preview --plan `. On `refused`, fix the plan for each error and rerun. + +Show the user the summary counts, the moves, the domains file diff (the full text when it is new), and the warnings. Name any note outside the paper folder whose links will be rewritten. + +After the user confirms, run `python3 scripts/organize.py apply --plan --expected-digest `. A refusal because the library changed means rerunning preview and showing what differs before asking again. A lock refusal means DeepPaperNote is saving a note; retry once it finishes. + +**Done when** apply reports `status: ok` with `verify.status: ok`, or the user declined. Report any issue `verify` lists. + +## 5. Report + +Give the log path, the counts of moved papers, fixed tags, and rewritten links, and the domains file path. Say that DeepPaperNote now follows the convention when it files a new paper, that the user can edit the domains file in Obsidian, and that "撤销上一次整理" / "undo the last reorganization" restores the library while the touched files stay unedited. diff --git a/skills/organize-wiki/agents/openai.yaml b/skills/organize-wiki/agents/openai.yaml new file mode 100644 index 0000000..7de9da4 --- /dev/null +++ b/skills/organize-wiki/agents/openai.yaml @@ -0,0 +1,4 @@ +interface: + display_name: "Organize Wiki" + short_description: "Organize my paper library's domain folders with me, then refile and retag papers." + default_prompt: "Use $organize-wiki to organize my paper library: read my vault, agree on the domain convention with me in short rounds, propose moves and tag fixes, show the preview, and apply only what I confirm." diff --git a/skills/organize-wiki/references/file-contract.md b/skills/organize-wiki/references/file-contract.md new file mode 100644 index 0000000..9aa4405 --- /dev/null +++ b/skills/organize-wiki/references/file-contract.md @@ -0,0 +1,134 @@ +# organize-wiki file contract + +organize-wiki writes the domains file and moves paper folders; DeepPaperNote reads the domains file when it chooses a new paper's domain. Neither imports the other's code. + +## Library layout + +- The vault and paper folder come from DeepPaperNote's configuration, `~/.deeppapernote/config.json` (or `DEEPPAPERNOTE_CONFIG_PATH`): `obsidian_vault`, `papers_dir`, `output_language`. `--vault` and `--papers-dir` win. A vault holds `.obsidian/`. +- A **domain** is a folder directly under the papers root. A **paper folder** is a folder directly under a domain. Its notes are the `.md` files directly inside it. +- A paper's **id** is `/`, relative to the papers root. +- A folder directly under the papers root that holds `.md`, `.zh-CN.md`, `.en.md`, or `.deeppapernote.json` is a paper folder without a domain, reported as an anomaly. +- A paper's **domain tag** is `papers/`, whitespace written as `_`. A conforming note has frontmatter whose `tags` hold exactly one `papers/` tag, its domain tag. + +## Domains file + +`/DeepPaperNote/domains.md`: + +```md +--- +aliases: [领域分类] +tags: [paper-domains] +updated: 2026-11-07 +--- + +# 领域分类 + +> 这份约定由整理知识库 skill 与你一起维护。DeepPaperNote 保存新论文时按它选择领域文件夹。 + +## 长视频理解 + +- 定义:理解长视频的模型、方法与基准。 +- 收录:长视频问答、长视频基准、视频记忆机制。 +- 不收录:短视频动作识别(去 计算机视觉)。 +- 代表论文:[[LVBench.zh-CN|LVBench]]、[[VideoAgent|VideoAgent]] +``` + +- Each `##` heading is a domain folder name. Under it, `-