knowledge-vault/requirements/skills-vault/lightweight-web-article-cli...

278 lines
8.2 KiB
Markdown

# Lightweight Web Article Clipper Skill Request
## Status
Requested by `knowledge-vault` on 2026-06-27.
This is a client-side requirement record for a reusable Skill to be built in:
```text
C:\Users\wangq\Documents\Codex\skills-vault
```
## Requesting Project
`knowledge-vault`
## Needed Capability
Create a lightweight Skill that takes a user-provided article URL and saves the visible article content as local Markdown plus local images.
The saved article is discussion material, not a durable archive. In the user's workflow, these articles usually serve as temporary targets for critical discussion. The downstream value is not the article itself, but the viewpoints distilled after discussion. After discussion, the clipped article may lose most of its value and can be deleted.
The Skill should therefore optimize for quick capture and low clutter, not auditability, platform taxonomy, or long-term preservation.
## Primary Output Location
Save results under:
```text
C:\Users\wangq\Documents\Codex\knowledge-vault\sources\clipped-articles\文章参考
```
Do not use platform-based subfolders by default. The user does not care whether the article came from Zhihu, WeChat, X, Xiaohongshu, or another platform once it is saved as discussion material.
## Expected Output Shape
Each clipped article should be saved as one folder:
```text
sources/clipped-articles/文章参考/
20260627-标题简称/
标题.md
img_1.jpg
img_2.jpg
```
This follows the existing migrated material style in:
```text
sources/clipped-articles/文章参考
```
Current examples include folders such as:
```text
AI真能自己-0418
为什么创业失-0504
20260506-王煜全竟然熬夜养龙虾
```
## File And Folder Naming
Default folder naming:
```text
YYYYMMDD-标题简称
```
Where:
- Use article publish date when it is easy to extract.
- Use capture date when publish date is unavailable or unreliable.
- `标题简称` should be short enough for Windows paths and human scanning.
- If the folder already exists, append a simple suffix such as `-2`, `-3`, or a short URL hash.
Markdown file naming:
```text
标题.md
```
Image naming:
```text
img_1.jpg
img_2.jpg
img_3.png
```
Keep image links in the Markdown relative to the article folder, for example:
```markdown
![](img_1.jpg)
```
## Markdown Content Requirements
The Markdown file should contain only the useful article material:
- Article title as the top heading.
- Article body text.
- Local image links in the right positions when possible.
- Minimal author or date text only if it is already part of the article extraction and does not add clutter.
Do not add an original URL line to the `.md` file by default.
Do not add YAML frontmatter by default.
Do not add clipping notes, provenance blocks, capture logs, comments, or tool diagnostics to the `.md` file.
## Required Behaviors
### Single URL Capture
The normal user request is:
```text
下载文章 <URL>
```
The Skill should:
1. Identify the URL type internally only as needed for routing.
2. Capture the article's visible content.
3. Convert it to Markdown.
4. Download article images when possible.
5. Rewrite image references to local relative paths.
6. Save the folder under `sources/clipped-articles/文章参考`.
7. Report the saved path and image count.
### Platform Scope
Initial priority platforms:
- Zhihu articles and answers.
- WeChat public account articles.
- X / Twitter posts, threads, or long-form articles when capture is feasible.
- Xiaohongshu notes when capture is feasible.
- Ordinary web articles as a best-effort fallback.
The Skill should not expose platform taxonomy in the output folder structure unless the user explicitly asks for it.
### Existing Tool Reference
Use the previous local implementation as a capability reference:
```text
D:\article-download
```
Relevant behaviors to preserve:
- URL routing for WeChat, Zhihu, and X.
- Markdown output.
- Local image download.
- Simple article folder.
- Simple image names such as `img_1.jpg`.
- User-facing success report with saved path and image count.
Behaviors not to preserve:
- Hardcoded old machine paths.
- Cookie-file workflow as the default user experience.
- Output to `temp/downloads`.
- Platform-based output folders as the default.
- Deleting or overwriting existing output folders.
## Browser And Login Boundary
The Skill may use available browser automation when needed, but should keep the workflow low-risk.
Default preference:
- Use public-page or clean browser capture when enough.
- Use the user's connected Chrome/Edge profile only when the page requires real login state or the content is only visible there.
Do not:
- Read or save raw cookies, localStorage, passwords, session stores, or tokens.
- Ask the user to paste cookies as the normal path.
- Bypass CAPTCHA, access controls, paywalls, age gates, DRM, or platform restrictions.
- Perform account side-effect actions such as posting, liking, following, commenting, collecting, or sending messages.
- Batch scrape feeds or accounts.
If a page cannot be captured without login, verification, or anti-bot interaction, the Skill should stop and ask the user to open the page in a connected browser or provide the content manually.
## Non-Goals
- No metadata JSON.
- No capture log.
- No raw HTML archive.
- No screenshots by default.
- No long-term source index update.
- No topic classification.
- No platform classification in output folders.
- No content evaluation, critique, summarization, or viewpoint distillation.
- No durable provenance or citation system.
- No batch crawler.
- No attempt to make saved articles canonical knowledge.
## Suggested Skill Name
Preferred:
```text
clip-web-article
```
Acceptable alternatives:
```text
lightweight-web-article-clipper
article-to-markdown-clipper
```
## Suggested User-Facing Behavior
On success, the agent should respond tersely:
```text
已保存到:
C:\Users\wangq\Documents\Codex\knowledge-vault\sources\clipped-articles\文章参考\20260627-标题简称
Markdown: 标题.md
Images: 5
```
On partial success:
```text
正文已保存,部分图片下载失败,已保留可用内容。
```
On failure:
```text
未能抓取正文。原因: <short reason>
建议: 在已登录浏览器中打开该页面后重试,或手动提供正文。
```
## Suggested Tests
Minimum fixtures or smoke cases:
1. A simple HTML article with text and two images.
2. An article title containing Windows-invalid filename characters.
3. A duplicate-title capture that must create a non-overwriting folder.
4. A Markdown rewrite case where remote image URLs become `img_1.jpg` style local links.
5. A failed image download case where the Markdown remains usable.
Manual smoke tests after implementation:
1. Save one existing public web article into `sources/clipped-articles/文章参考`.
2. Save one WeChat public account article if accessible.
3. Save one Zhihu article or answer if accessible.
4. Try one login-dependent page through the connected browser path without saving cookies.
## Acceptance Criteria
The Skill is acceptable when a future Codex session can:
1. Receive one article URL from the user.
2. Save the article under `sources/clipped-articles/文章参考`.
3. Produce one article folder containing a `.md` file and local images only.
4. Avoid creating metadata JSON, logs, raw HTML, screenshots, or index entries by default.
5. Keep the Markdown free of original URL lines and frontmatter by default.
6. Preserve existing outputs by creating a new non-colliding folder.
7. Report the saved path and image count.
8. Stop rather than bypassing login, CAPTCHA, paywall, DRM, anti-bot, or account side-effect boundaries.
## Rationale
The user's article-clipping workflow is intentionally lightweight. The saved article is only a convenient substitute for manual copy-paste or F12-based extraction from sites that make copying difficult.
Most self-media posts are not trusted source material. They often contain many flaws and only one or two usable prompts for discussion. The repository's durable value comes later, after critical discussion turns useful observations into distilled viewpoints and possible writing material.
Therefore, this Skill should minimize archival overhead and avoid turning low-value source posts into heavy, canonical records.