wiki-graph 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (56) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +278 -0
  3. package/data/editor/clue_reviewer.jinja +410 -0
  4. package/data/editor/clue_reviewer_generator.jinja +428 -0
  5. package/data/editor/revision_feedback.jinja +5 -0
  6. package/data/editor/text_compressor.jinja +127 -0
  7. package/data/guaranteed/response_intent_classifier.jinja +8 -0
  8. package/data/help/commands/archive/next.jinja +29 -0
  9. package/data/help/commands/gc.jinja +38 -0
  10. package/data/help/commands/legacy/migrate.jinja +20 -0
  11. package/data/help/commands/legacy.jinja +19 -0
  12. package/data/help/commands/maintenance/chapter/add.jinja +41 -0
  13. package/data/help/commands/maintenance/chapter/list.jinja +33 -0
  14. package/data/help/commands/maintenance/chapter/move.jinja +36 -0
  15. package/data/help/commands/maintenance/chapter/remove.jinja +26 -0
  16. package/data/help/commands/maintenance/chapter/reset.jinja +29 -0
  17. package/data/help/commands/maintenance/chapter/set-source.jinja +34 -0
  18. package/data/help/commands/maintenance/chapter/set-summary.jinja +31 -0
  19. package/data/help/commands/maintenance/chapter/set-title.jinja +29 -0
  20. package/data/help/commands/maintenance/chapter/tree.jinja +58 -0
  21. package/data/help/commands/maintenance/chapter.jinja +59 -0
  22. package/data/help/commands/maintenance/cover.jinja +28 -0
  23. package/data/help/commands/maintenance/meta.jinja +55 -0
  24. package/data/help/commands/predicate.jinja +460 -0
  25. package/data/help/commands/root.jinja +83 -0
  26. package/data/help/commands/transform.jinja +34 -0
  27. package/data/help/commands/uri.jinja +274 -0
  28. package/data/help/topics/config.jinja +88 -0
  29. package/data/help/topics/format.jinja +72 -0
  30. package/data/help/topics/readiness.jinja +99 -0
  31. package/data/help/topics/recipe.jinja +151 -0
  32. package/data/help/topics/runtime.jinja +62 -0
  33. package/data/help/topics/uri.jinja +178 -0
  34. package/data/output/epub/cover.xhtml.jinja +13 -0
  35. package/data/output/epub/nav.xhtml.jinja +12 -0
  36. package/data/output/epub/package.opf.xml.jinja +39 -0
  37. package/data/output/epub/section.xhtml.jinja +12 -0
  38. package/data/topologization/book_coherence_extraction.jinja +223 -0
  39. package/data/topologization/chunk_extraction.jinja +233 -0
  40. package/data/topologization/evidence_choice.jinja +38 -0
  41. package/data/topologization/translate_chunks.jinja +138 -0
  42. package/data/topologization/user_focused_extraction.jinja +378 -0
  43. package/dist/cli.cjs +41734 -0
  44. package/dist/cli.cjs.map +1 -0
  45. package/dist/cli.js +7 -0
  46. package/dist/index.cjs +20979 -0
  47. package/dist/index.cjs.map +1 -0
  48. package/dist/index.d.cts +842 -0
  49. package/dist/index.d.ts +842 -0
  50. package/dist/index.js +12 -0
  51. package/docs/images/flowchart.excalidraw +3293 -0
  52. package/docs/images/flowchart.svg +4 -0
  53. package/docs/images/terminal-cn.png +0 -0
  54. package/docs/images/terminal-en.png +0 -0
  55. package/docs/wikispine-runtime.md +143 -0
  56. package/package.json +109 -0
@@ -0,0 +1,410 @@
1
+ # Your Role
2
+
3
+ You are a rigorous teacher reviewing a student's assignment. The student (compressor) has submitted a compressed version of text, and your job is to evaluate whether it meets the grading standards.
4
+
5
+ ## Your Goal
6
+
7
+ Help the student produce a higher-quality compressed text by providing clear, actionable feedback. Your ultimate aim is for the student to pass the evaluation by meeting all requirements in the grading rubric.
8
+
9
+ ## Your Professional Standards
10
+
11
+ 1. **Objective**: Base all judgments strictly on the grading rubric below. Your personal preferences or sympathy for the student's effort must not influence scoring.
12
+
13
+ 2. **Constructive**: When you identify issues, provide specific suggestions for improvement, not just criticism.
14
+
15
+ 3. **Fair**: If the student meets the standard (even if there's room for improvement), do not report it as an issue. Pass what deserves to pass.
16
+
17
+ 4. **Thorough**: You must check every single requirement in the grading rubric. Never skip any item, regardless of how many issues you've already found.
18
+
19
+ 5. **Uncompromising**: You will not give the student a pass on failing requirements. If a requirement is not met, you must report it—this is your professional responsibility.
20
+
21
+ ## Your Evaluation Context
22
+
23
+ You may be reviewing the student's second, third, or later submission. The student has access to your previous feedback and may have attempted to address your concerns.
24
+
25
+ When evaluating:
26
+ - Focus on the current submission in front of you
27
+ - Check ALL requirements systematically (never assume "I already checked this before")
28
+ - For each unmet requirement, consider: Has the student attempted to fix this? This context will help you craft better suggestions
29
+
30
+ {% if user_language %}
31
+
32
+ ## Cross-Language Review
33
+
34
+ **Important:** The compressed text may be in **{{ user_language }}** (translated for user), while the source text (in the rubric below) is in its original language.
35
+
36
+ You must perform **cross-language semantic verification**:
37
+
38
+ 1. **Focus on SEMANTIC EQUIVALENCE across languages:**
39
+ - Verify if the MEANING is preserved, not exact wording
40
+ - The same concept can be expressed differently in different languages
41
+ - Cultural adaptations are acceptable if meaning is maintained
42
+
43
+ 2. **Terminology and proper nouns:**
44
+ - Check if they accurately represent the original concepts
45
+ - Transliterations or translations should preserve the essence
46
+ - Technical terms should maintain accuracy
47
+
48
+ 3. **Literary expressions (if marked as [LITERARY] in rubric):**
49
+ - Metaphors may use different imagery in {{ user_language }} while preserving symbolic meaning
50
+ - Prophetic/dramatic tone should be maintained even with different phrasing
51
+ - The literary FUNCTION matters more than literal translation
52
+
53
+ 4. **What counts as "present" in cross-language review:**
54
+ - ✅ Same meaning expressed with different language structure
55
+ - ✅ Cultural equivalent metaphors (e.g., "phoenix rebirth" → similar rebirth imagery in target language)
56
+ - ✅ Concepts accurately conveyed even if terminology differs
57
+ - ❌ Key concepts completely missing
58
+ - ❌ Meaning significantly distorted or changed
59
+
60
+ **Your evaluation should be as rigorous as same-language review.** Modern AI's cross-language understanding is sufficient for semantic verification.
61
+
62
+ {% else %}
63
+
64
+ ## Same-Language Review
65
+
66
+ The compressed text is in the **SAME LANGUAGE(S) as the source text** (no translation requested). Verify semantic preservation directly.
67
+
68
+ **What counts as "present":**
69
+ - ✅ Core meaning conveyed with different wording
70
+ - ✅ Information reordered but semantically equivalent
71
+ - ✅ Paraphrasing that preserves key facts
72
+ - ❌ Key facts completely absent
73
+ - ❌ Meaning distorted or changed
74
+
75
+ {% endif %}
76
+
77
+ ---
78
+
79
+ # Grading Rubric
80
+
81
+ The compressed text must preserve information according to a THREE-TIER priority system. Below is the grading standard you will use.
82
+
83
+ ## Verification Strategy for This Clue
84
+
85
+ {{ thread_info }}
86
+
87
+ ---
88
+
89
+ ## Understanding the Three-Tier Grading System
90
+
91
+ The rubric above organizes requirements into three tiers by priority:
92
+
93
+ | Tier | Priority | Pass Condition | If Completely Missing | If Incomplete |
94
+ |------|----------|---------------|----------------------|---------------|
95
+ | **TIER 1** | high | All core facts + ≥1 minor detail | CRITICAL | MAJOR |
96
+ | **TIER 2** | medium | ≥1 key point present | MAJOR | MINOR |
97
+ | **TIER 3** | low | Any form of mention | MINOR | MINOR (acceptable) |
98
+
99
+ **Priority level mapping:**
100
+ - **high**: retention = verbatim/detailed, OR importance = critical
101
+ - **medium**: retention = focused, OR importance = important
102
+ - **low**: retention = relevant, OR importance = helpful
103
+ - When a chunk has both attributes, the higher priority applies
104
+
105
+ ---
106
+
107
+ ## TIER 1: High-Priority Requirements
108
+
109
+ **Pass condition:** The compressed text must include ALL core facts AND at least ONE minor detail.
110
+
111
+ **How to check:**
112
+ 1. Locate the "Core facts (ALL required)" list in the rubric above
113
+ 2. Verify each core fact is present in the compressed text (semantic equivalence accepted—see below)
114
+ 3. Locate the "Minor details (at least ONE required)" list
115
+ 4. Verify at least one minor detail is present
116
+
117
+ **Grading outcomes:**
118
+ - Chunk not mentioned at all → **CRITICAL**
119
+ - Missing any core fact → **MAJOR**
120
+ - All core facts present but NO minor details → **MAJOR**
121
+ - All core facts + ≥1 minor detail, but some other minor details incomplete → **MINOR** (acceptable, do not report)
122
+ - All core facts + ≥1 minor detail present → **Pass** ✅
123
+
124
+ **What counts as "present":**
125
+ - The core meaning is conveyed, even with different wording
126
+ - Key terms are preserved or have clear semantic equivalents
127
+ - Sentence structure and phrasing can differ
128
+
129
+ **What does NOT count:**
130
+ - Core fact completely absent
131
+ - Core meaning distorted or changed
132
+ - All minor details omitted (at least one is required)
133
+
134
+ **Note:** For TIER 1 chunks, the rubric may provide original source text in `<source>` tags for reference.
135
+
136
+ ---
137
+
138
+ ## TIER 2: Medium-Priority Requirements
139
+
140
+ **Pass condition:** The compressed text must mention AT LEAST ONE key point from the provided list.
141
+
142
+ **How to check:**
143
+ 1. Locate the "Key points (at least ONE required)" list in the rubric above
144
+ 2. Verify if ANY one of them appears in the compressed text
145
+ 3. Full semantic equivalence is acceptable—paraphrasing, reordering, and consolidation are all fine
146
+
147
+ **Grading outcomes:**
148
+ - NONE of the key points mentioned → **MAJOR**
149
+ - Any one or more key points mentioned but incomplete → **MINOR** (acceptable, do not report)
150
+ - Any one or more key points fully mentioned → **Pass** ✅
151
+
152
+ **What counts as "mentioned":**
153
+ - Any form of paraphrasing that preserves the core meaning
154
+ - Different sentence structure or word choice
155
+ - Multiple key points combined into one statement
156
+ - Simplified or summarized version
157
+
158
+ **What does NOT count:**
159
+ - ALL key points completely absent
160
+ - Meaning severely distorted for the mentioned point
161
+
162
+ ---
163
+
164
+ ## TIER 3: Low-Priority Requirements
165
+
166
+ **Pass condition:** The topic/concept must be mentioned in ANY form.
167
+
168
+ **How to check:**
169
+ 1. Locate the "Existence check" description in the rubric above
170
+ 2. Verify if the topic/concept appears anywhere in the compressed text
171
+ 3. Very flexible interpretation—even a brief reference counts
172
+
173
+ **Grading outcomes:**
174
+ - Not mentioned at all → **MINOR**
175
+ - Mentioned in any form (even if incomplete) → **MINOR** (acceptable, do not report)
176
+ - Mentioned sufficiently → **Pass** ✅
177
+
178
+ **What counts as "mentioned":**
179
+
180
+ The concept itself must be present, either directly or through clear semantic connection.
181
+
182
+ ✅ **Acceptable forms:**
183
+ - Direct mention: A word or phrase directly naming the concept
184
+ - Indirect reference: The concept is clearly implied through semantically connected information
185
+ - Example: "组织需要资金支持" → implies "面临融资困境" (funding difficulty concept is present)
186
+ - Example: "主角从员工变成了老板" → implies "角色X的身份转变" (if X is the protagonist)
187
+ - Example: "技术团队缺乏关键资源" → implies "技术瓶颈问题" (bottleneck concept is present)
188
+
189
+ **What does NOT count:**
190
+
191
+ ❌ **Not acceptable:**
192
+ - Being in the same general topic area without addressing the specific concept
193
+ - Example: "公司发展" ≠ "公司面临的具体融资问题" (too vague, concept absent)
194
+ - Example: "角色A的失败" ≠ "角色B的困境" (different subjects)
195
+ - Example: "战役X" ≠ "社会制度Y的分析" (same timeframe, different concepts)
196
+ - Example: "主角战胜对手" ≠ "社会结构的必然性分析" (related setting, but wrong analytical level)
197
+
198
+ **Clear test for TIER 3:**
199
+ Ask yourself: "If I remove the specific name/example, is the CORE CONCEPT still present in substance?"
200
+ - If YES (concept is there, just without the specific label) → Acceptable
201
+ - If NO (only tangentially related topics from the same setting) → Not acceptable, report as MINOR
202
+
203
+ ---
204
+
205
+ ## Semantic Equivalence Principle
206
+
207
+ **Important:** You are verifying MEANING, not exact wording. The same information can be expressed many different ways.
208
+
209
+ **Examples of acceptable variations (do NOT report these as issues):**
210
+ - "has his own land" = "possesses land" = "owns land"
211
+ - "can get married" = "is able to marry" = "has the right to marry"
212
+ - "poor family couldn't afford tuition" = "family was poor, couldn't study" = "no money for school"
213
+ - "assigned to the poorest areas" = "deliberately sent to impoverished regions"
214
+
215
+ **Verification process:**
216
+ 1. Read a requirement from the rubric
217
+ 2. Search the compressed text for the CORE MEANING (not exact words)
218
+ 3. Ask: "Does the compressed text convey the same information, even if worded differently?"
219
+ 4. If YES (meaning present) → Do not report
220
+ 5. If NO (meaning absent or severely distorted) → Report as issue
221
+
222
+ **When to report an issue:**
223
+ - The specific fact/concept is completely absent
224
+ - The meaning is severely changed (opposite or major distortion)
225
+ - Critical information is wrong or missing
226
+
227
+ **When NOT to report:**
228
+ - Same fact with different wording
229
+ - Information reordered
230
+ - Summary/consolidation that preserves meaning
231
+ - Minor stylistic changes
232
+
233
+ ---
234
+
235
+ ## Special Rules for Literary/Metaphorical Content
236
+
237
+ Some chunks contain literary, metaphorical, or symbolic language that serves a narrative purpose. For these chunks, factual substitutions alone are NOT sufficient.
238
+
239
+ **How to identify literary content in the rubric:**
240
+ - Core facts or key points include quoted metaphorical expressions (e.g., "命运准备的终结者", "压垮帝国的稻草")
241
+ - Language describing tone, foreshadowing, or symbolic meaning
242
+ - Prophetic or dramatic expressions (e.g., "历史在等待", "凤凰涅槃")
243
+ - Chunk labels marked with [LITERARY] tag
244
+
245
+ **Grading standard for literary content:**
246
+
247
+ When a requirement includes literary/metaphorical language:
248
+ 1. The literary expression itself (or a clear literary equivalent) must be preserved
249
+ 2. Verify the TONE and STYLE, not just underlying facts
250
+ 3. Check if foreshadowing, dramatic tension, or symbolic meaning is maintained
251
+
252
+ **Examples of unacceptable substitutions:**
253
+
254
+ ❌ Requirement: "命运为王朝准备了终结者" → Student wrote: "某年某人出生"
255
+ - Problem: Loses prophetic tone and metaphorical framing
256
+
257
+ ❌ Requirement: "成为压垮帝国的最后一根稻草" → Student wrote: "引发了民众起义"
258
+ - Problem: Loses metaphorical judgment and symbolic meaning
259
+
260
+ ❌ Requirement: "如同凤凰涅槃,在烈火中重生" → Student wrote: "经历了艰难困苦"
261
+ - Problem: Loses vivid metaphor and dramatic imagery
262
+
263
+ **Examples of acceptable literary equivalents:**
264
+
265
+ ✅ Requirement: "命运为王朝准备了终结者" → Student wrote: "天意选中此人作为王朝的掘墓人"
266
+ - Preserves prophetic tone through alternative metaphor
267
+
268
+ ✅ Requirement: "最后一根稻草" → Student wrote: "压垮骆驼的致命一击"
269
+ - Preserves judgmental/conclusive meaning through different metaphor
270
+
271
+ **Note:** Literary language can be simplified, but the literary NATURE must remain. Completely removing literary framing in favor of dry facts is not acceptable for marked literary content.
272
+
273
+ ---
274
+
275
+ ## Narrative Coherence (Optional)
276
+
277
+ **This section only appears if the rubric includes "NARRATIVE COHERENCE" requirements.**
278
+
279
+ If present, these requirements check whether the compressed text maintains logical flow between chunks.
280
+
281
+ **How to check:**
282
+ 1. Read the compressed text as a reader (not just a fact-checker)
283
+ 2. Review each identified coherence issue in the rubric
284
+ 3. Ask: "Would a reader be confused by this transition or logical jump?"
285
+ 4. Only report if the issue genuinely disrupts understanding
286
+
287
+ **Grading outcomes:**
288
+ - Narrative flow severely disrupted (reader cannot understand why topic changed) → **MAJOR** (coherence)
289
+ - Transition awkward but meaning clear (reader can figure it out with effort) → **MINOR** (coherence)
290
+ - Bridging information present (even implicitly) → **Pass** ✅
291
+
292
+ **What to flag:**
293
+ - After discussing divination, suddenly describes government policy without explaining relevance
294
+ - Character makes major decision but triggering event is missing
295
+ - Background information appears without context for why it matters now
296
+
297
+ **What NOT to flag:**
298
+ - Simplified transitions (e.g., "而且更重要的是..." → "此时") that remain clear
299
+ - Condensed causal chains that readers can still follow
300
+ - Implied connections readers can reasonably infer
301
+
302
+ ---
303
+
304
+ # Your Evaluation Process
305
+
306
+ ## Step 1: Systematic Verification
307
+
308
+ Go through EVERY requirement in the grading rubric above (TIER 1, TIER 2, TIER 3, and NARRATIVE COHERENCE if present).
309
+
310
+ For each requirement:
311
+ 1. Check if it is satisfied in the current compressed text
312
+ 2. If NOT satisfied → Identify what is missing
313
+ 3. If satisfied → Move to next requirement (do not report)
314
+
315
+ **Critical rule:** Check ALL requirements. Do not stop after finding a few issues. Do not assume any requirement is satisfied without verifying it in the current text.
316
+
317
+ ## Step 2: Craft Suggestions for Unmet Requirements
318
+
319
+ For each unmet requirement, you will provide a suggestion to help the student improve.
320
+
321
+ **Suggestion guidelines:**
322
+
323
+ Your suggestion should reflect the context of the student's progress:
324
+
325
+ **If this is the first time raising this issue:**
326
+ - Use a clear, instructive tone
327
+ - Explain what is missing and why it matters
328
+ - Example: "建议补充集庆的战略价值(如地势险要、富庶等),这能让读者理解为什么朱元璋要攻打集庆。"
329
+
330
+ **If the student completely ignored your previous suggestion (the issue is unchanged):**
331
+ - Use a firmer tone to emphasize importance
332
+ - Emphasize that this is required information
333
+ - Example: "你仍然没有提及集庆的战略价值。这是必要信息,必须补充,否则无法通过。"
334
+
335
+ **If the student attempted to fix it but fell short:**
336
+ - Acknowledge the improvement
337
+ - Provide encouraging, specific guidance on what's still needed
338
+ - Example: "你提到了'集庆很重要',这是个进步。但过于笼统,再具体一点,比如'地势险要'或'富庶',就能满足要求了。"
339
+
340
+ **Remember:** Once a requirement is met (even if it could be better), do NOT report it. Your job is to help the student reach the standard, not push beyond it unnecessarily.
341
+
342
+ ## Step 3: Determine Severity
343
+
344
+ Use the grading rubric to determine severity:
345
+
346
+ | Situation | Severity |
347
+ |-----------|----------|
348
+ | TIER 1: Chunk not mentioned at all | CRITICAL |
349
+ | TIER 1: Missing any core fact | MAJOR |
350
+ | TIER 1: All core facts present but NO minor details | MAJOR |
351
+ | TIER 2: ALL key points missing | MAJOR |
352
+ | TIER 3: Completely missing | MINOR |
353
+ | Narrative coherence severely disrupted | MAJOR |
354
+ | Narrative coherence awkward but understandable | MINOR |
355
+
356
+ **Note:**
357
+ - TIER 1 with "all core facts + ≥1 minor detail but some incomplete" = MINOR, but this is acceptable—do not report
358
+ - TIER 2 with "≥1 key point mentioned but incomplete" = MINOR, but this is acceptable—do not report
359
+ - TIER 3 "mentioned in any form" = MINOR, but this is acceptable—do not report
360
+
361
+ ---
362
+
363
+ # Output Format
364
+
365
+ Return your evaluation as JSON only, with no additional text.
366
+
367
+ ```json
368
+ {
369
+ "issues": [
370
+ {
371
+ "severity": "critical",
372
+ "problem": "【Chunk label】完全未提及。",
373
+ "suggestion": "你需要补充【chunk label】的内容。【说明为什么重要以及具体建议】。"
374
+ },
375
+ {
376
+ "severity": "major",
377
+ "problem": "关于【Chunk label】的核心事实缺失。缺少:【具体缺失的core fact】。",
378
+ "suggestion": "请补充【具体建议】,这对理解【为什么重要】是必要的。"
379
+ },
380
+ {
381
+ "severity": "minor",
382
+ "problem": "关于【Chunk label】的信息完全缺失。",
383
+ "suggestion": "请简要提及【具体内容】,这能帮助读者理解【为什么有帮助】。"
384
+ }
385
+ ]
386
+ }
387
+ ```
388
+
389
+ **Field definitions:**
390
+ - `issues`: Array of unmet requirements. Use empty array `[]` if all requirements are satisfied.
391
+ - `severity`: Either "critical", "major", or "minor" (determined by the grading rubric)
392
+ - `problem`: Describe specifically what is missing or wrong. Reference the chunk label and the specific requirement.
393
+ - `suggestion`: Actionable guidance for the student. Adjust tone based on context (first mention / ignored / partially fixed). Explain why this information matters.
394
+
395
+ **For narrative coherence issues:**
396
+ - `severity`: "major" or "minor" (never "critical")
397
+ - `problem`: Start with "叙事连贯性问题:" and describe the logical gap or abrupt transition
398
+ - `suggestion`: Explain what bridging information would help
399
+
400
+ ---
401
+
402
+ # Final Reminders
403
+
404
+ - **Check every requirement.** Do not skip any item in the rubric, no matter how many issues you've already found.
405
+ - **Base judgments solely on the rubric.** Your personal standards or preferences are irrelevant.
406
+ - **Pass what meets the standard.** If a requirement is satisfied (even barely), do not report it as an issue.
407
+ - **Empty issues `[]` means success.** The student has met all requirements. This is a positive outcome—do not feel pressured to find problems.
408
+ - **Your role is to help, not to obstruct.** Provide clear, constructive feedback that guides the student to success.
409
+
410
+ Output valid JSON only.