AI-Crafted Poetry Book in 10 Hours: Open-Source Skill with 6 Song Dynasty Templates
The author spent 10 hours using AI to create a 1,448-page scholarly poetry collection of Su Shi's works, then open-sourced a 'Poetry Book' skill with six Song Dynasty aesthetic templates for typesetting both poetry and technical articles via LaTeX and Python.
Project Overview
The author, known as Lao Zhang from AI Evaluation, experimented with long-context LLMs (Kimi K3.1 Pro) to produce a complete poetry collection titled Understanding Su Shi Through Poetry . The project consumed 10 hours 35 minutes, 317 model calls, and 169.7 million tokens (97.7% cache reads). The final book spans 1,448 pages and contains 3,202 pieces: 2,824 poems, 362 ci poems, and 16 prose works. Eighty-two major pieces receive scholarly commentary, textual notes, and red-ink annotations; 2,651 have cross-references to classical sources; 2,394 are dated; 808 remain undated.
Poetry Collection Statistics
Total pieces: 3,202 (2,824 poems, 362 ci, 16 prose)
Annotated major pieces: 82
Cross-referenced pieces: 2,651
Dated pieces: 2,394
Undated pieces: 808
Six Song Dynasty Aesthetic Templates
Each template defines paper color, ink tone, binding lines, and cover composition as a theme system:
1. song-mist (烟雨留白) – off-white paper, pale ink mountains, fine rain, river boat, vermilion seal. Default theme; ideal for poet chronologies and classical anthologies needing ample whitespace.
2. celadon (青瓷天青) – pale grey-green paper with layered celadon hills. Recommended for technical monographs and course handouts.
3. ink-zen (墨禅寂照) – grey-white paper, single brush-stroke mountain, enso circle. Minimalist; suits philosophy, essays, and minimalist technical docs.
4. cinnabar-seal (朱砂印谱) – rice paper with vermilion, modeled on Song collector seal albums. Cover bears small seals for "poetry", "heart", "collection". Fits anthologies and special editions.
5. moon-river (月夜赤壁) – blue-grey paper, bright moon, water ripples, night boat. Homage to Red Cliff Rhapsody ; contrast adjusted after first proof.
6. bamboo (竹影清风) – pale green paper with sparse bamboo shadows avoiding text areas. Suits poetry notes and lighter column collections.
Development Process
Data Collection and Source Verification
Rule: no character in the main text may come from model memory . The author downloaded 11 classical repositories and 18 library pages, using Complete Works of Su Shi , Annotated Su Shi Poetry , Supplement to Annotated Su Shi Poetry , Su Shi Ci as primary texts, and History of Song: Biography of Su Shi , Su Zhe's epitaph, chronologies, and Extended Comprehensive Mirror for historical facts. Open corpora provided retrieval baselines; classical texts enabled cross-collation. Every repository commit hash, page revision, and file SHA-256 was logged so any poem can be traced to its exact source file and page.
Deduplication and Chronological Ordering
Deduplication pitfalls:
Same title, different content – cannot merge by title alone.
Poem sequences – must keep all numbered parts.
Same tune title (cipai) – dozens of distinct poems share a cipai.
Solution: joint identification by title + first line + full text . Four-layer storage: raw text, normalized text, display text, editor annotations – each isolated.
Chronology challenges:
Some works only locatable to a life phase, not a year.
Prefaces recalling past events – must not confuse composition date with recalled date.
Era changes, lunar year boundaries, duplicate sexagenary cycles handled individually.
Insufficient evidence → placed in "undated" category, never forced.
Resulting distribution across Su Shi's life:
Volume 1: Meishan & Leaving Shu (1037–1059) – 42 works
Volume 2: Fame in Capital & Fengxiang (1060–1065) – 148
Volume 3: Reform Turmoil & External Posts (1066–1074) – 404
Volume 4: Mizhou Years (1075–1076) – 114
Volume 5: Xuzhou/Huzhou Achievements & Crow Terrace Poetry Case (1077–1079) – 289
Volume 6: Huangzhou Breakthrough (1080–1084) – 295
Volume 7: Yuanyou Restoration & Four Prefectures (1085–1093) – 623
Volume 8: Huizhou Mist & Rain (1094–1096) – 123
Volume 9: Danzhou & Northward Return (1097–1100) – 120
Volume 10: Changzhou Final Works (1101) – 43Time Breakdown
Phase Time
Requirements, env check, research 15 min
Project skeleton, corpus download 15 min
Poem extraction, matching, chronology 2 hr 7 min
Major-piece annotation & supplements 8 min
Cover design, vertical draft, v1 book 2 hr 57 min
Testing, font fixes, horizontal rebuild 4 hr 46 min
Final acceptance, preview, delivery 4 min
Total 10 hr 35 min
Note: download, compile, and some writing ran in parallel.
Typesetting 28%, testing/fixing 45% → together >70%.Token Consumption Analysis
Type Tokens
Regular input 3,628,228
Output 274,751
Cache reads 165,809,377
Total 169,712,356
97.7% cache reads. Long tasks repeatedly feed book structure, tool returns, classical indexes, error logs – most served from cache. Fresh input+output ≈ 3.9M tokens (additional template/technical-article runs not counted).Extending to Technical Articles
To make the pipeline a reusable Skill, the author fed his own Markdown article vLLM Surpasses DeepSeek Custom Engine, Still the Top Choice for Local LLM Deployment into the system, producing a 15-page illustrated booklet using the celadon theme with a personal seal.
Installation and Usage
Quick Install via Skills
Skill hosted in GitHub repo z-skills. Install with:
npx skills add tjxj/z-skills --skill poetry-bookManual Installation
python3 scripts/install.pyDefaults to ~/.agents/skills/poetry-book/; use --dest to override.
Dependencies
latexmk, LuaLaTeX, Ghostscript
Python 3 with packages: fontTools, PyMuPDF, Pillow; technical-article mode adds PyYAML System fonts: Source Han Serif SC VF, Early Summer Serif, LXGW WenKai
Commands
List Available Themes
python3 "$HOME/.agents/skills/poetry-book/scripts/build_style.py" --listRender Poetry Book (input: structured book.json)
python3 "$HOME/.agents/skills/poetry-book/scripts/render_book.py" \
--input "/absolute/path/book.json" \
--theme "song-mist" \
--output "/absolute/path/new-output-directory"Render Technical Article (input: Markdown)
python3 "$HOME/.agents/skills/poetry-book/scripts/render_article.py" \
--input "/absolute/path/article.md" \
--theme "celadon" \
--title "Article Main Title" \
--subtitle "Article Subtitle" \
--author "Author or Column Name" \
--seal "Seal Text" \
--output "/absolute/path/new-output-directory"Validation and Output
Output directory must not exist or be empty to prevent accidental overwrite.
Network images: HTTPS only, max 25 MB each; --offline uses only local images. --require "specific phrase" enforces presence of a key sentence for content acceptance.
Each run produces a PDF, validation-report.json, and preview images. Report's passed: true signals success.
With the open-sourced Poetry Book skill, anyone can compile a poet's collected works or turn a series of articles into a beautifully typeset electronic booklet using authentic Song Dynasty aesthetics.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
Old Zhang's AI Learning
AI practitioner specializing in large-model evaluation and on-premise deployment, agents, AI programming, Vibe Coding, general AI, and broader tech trends, with daily original technical articles.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
