ljg-classic
Generator for classical Chinese character-by-character annotations, composite typesetting, chapter motif illustrations, and full-chapter interpretations. Arranges the original text, word/phrase notes, clause notes, textless header artwork, and chapter interpretation into a single readable long PNG. USE WHEN the user invokes ljg-classic OR requests character-by-character annotations, color-coded inline glosses, chapter interpretations, classical Chinese lecture-note graphics, or chapter illustrations for classical Chinese (wenyanwen), classical poetry, or traditional canonical literature (Classics, Histories, Masters, Collections). NOT FOR single-sentence translations, purely modern articles, or generic content cards.
1How It Works & Mechanism
Input must establish the original text, book title, and chapter; when the edition is ambiguous, preserve textual variant boundaries rather than deciding the base text for the user.
输入必须能确定原文、书名、章节;版本不明时保留异文边界。
Three tiers of color-coded inline notes serve distinct semantic roles and answer specific questions: cyan word notes for word/character meanings, vermilion clause notes for sentence actions, and ochre variant notes for textual variants and uncertainties.
| `word` | 青色 | 这个字词在此处是什么意思 | 古今义、虚词功能、语法、读音 |
'Character-by-character' is fulfilled via coverage rate: all non-punctuation tokens must have a note; compounds, function words, and phonetic loan characters are annotated by minimal meaningful unit without mechanically splitting them into isolated characters.
“逐字注解”通过覆盖率兑现:所有非标点 token 都有 note。
The renderer consumes UTF-8 JSON; concatenating text in token order must match original verbatim; non-punctuation tokens require note and tone.
按 token 顺序拼接 `text`,必须与 `original` 逐字一致。
Typesetting does only one thing: the eye first reads along the black original text, checks adjacent colored glosses when meeting friction, and naturally lands on the blue chapter interpretation upon finishing the whole chapter.
页面只做一件事:让眼睛先沿黑色原文读,再在遇到阻力时看身边的彩色注,读完整章后自然落到蓝色解读。
Defaults to invoking built-in image_gen to produce a textless, low-distraction chapter motif illustration placed between chapter title and original text; if image generation is unavailable, falls back to an image-free version with an explanation.
默认调用内置 `image_gen` 生成一幅无字、低干扰的章节意旨图,放在章节标题与原文之间;图像不可用时继续生成无图版本并说明。
Each run creates an exclusive /tmp/ljg-classic-* workspace where JSON, HTML, manifest, motif illustration, candidate PNG, and QA slices reside; files are copied to $HOME/Downloads/ only after acceptance.
候选 PNG 完成硬验收后,才复制到 `$HOME/Downloads/` 作为最终卡片;用户显式指定另一最终路径时以本次指令为准。
The chapter interpretation retains only one primary relationship, prioritizing directness over polish: intra-chapter components, condition-triggered actions, outcomes, and migration or failure boundaries.
章节解读只保留一个主关系。
Annotations must not alter the original text: suspected typos, phonetic loans, or edition variants in the base text are marked using variant rather than silently replaced.
注解不能改写原文。底本疑似错字、通假或版本差异用 `variant` 标出,不能静默替换。
The toolchain relies on local Bun/Playwright: RenderClassic.ts for rendering and ValidateClassic.ts for validation, both exposed via package.json scripts.
"render": "bun Tools/RenderClassic.ts",
2Core Capabilities
3External Dependencies
| Kind | Dependency / Endpoint |
|---|---|
| package | playwright |
| host-tool | 内置 image_gen(章节意旨图) |
4Recommended Governance & Evidence
- scripts/: Execute local scripts or commands: bun Tools/RenderClassic.ts: Local Playwright rendering that reads UTF-8 JSON and outputs PNG.
- 本地工作目录: File read/write and artifact output: Exclusive /tmp/ljg-classic-* workspace: JSON, HTML, manifest, motif image, candidate PNG, and overlapping QA slices.
5Second-Pass Verification
- [ok] 文件名与类型一致性 — SKILL.md、三份 References、Workflows/AnnotateAndRender.md、Tools/RenderClassic.ts、Tools/ValidateClassic.ts、package.json 均在 §1 清单中可见。
- [ok] 逐字注解覆盖率口径 — AnnotationMethod.md 与 InputSchema.md 均要求非标点 token 有 note,SKILL.md Gotchas 亦重申 100% 覆盖。
- [ok] original 拼接不变量 — InputSchema.md 第 1 条与 SKILL.md 合同一致:token 顺序拼接必须与 original 逐字一致。
- [ok] 交付路径与临时工作区 — SKILL.md 要求 /tmp 验收后复制到 $HOME/Downloads/ 并读回 SHA-256,与 gotchas 一致。
- [ok] 网络与凭证面 — 扫描命中的 URL 均为测试数据字符串;目录内无 fetch/curl、无 env/API key 读取。
- [ok] 判级口径 — 仅本地脚本与本地读写、零凭证零网络,符合 blue。
6Verdict & Scenarios
5821f03373434196…