Skip to content

LLM Wiki is a cross-platform desktop application that turns your documents into an organized, interlinked knowledge base — automatically. Instead of traditional RAG (retrieve-and-answer from scratch every time), the LLM incrementally builds and maintains a persistent wiki from your sources。

TypeScript

fix: include schema types in long source analysis

nash_su6085149d8a68
diff --git a/src/lib/ingest-source-path-collision.test.ts b/src/lib/ingest-source-path-collision.test.ts
index 0c8529dd..493695ea 100644
--- a/src/lib/ingest-source-path-collision.test.ts
+++ b/src/lib/ingest-source-path-collision.test.ts
@@ -135,7 +135,7 @@ describe("autoIngest source summary paths", () => {
await writeFileRaw(`${tmp.path}/purpose.md`, "# Purpose\n\nTrack project config files.\n")
await writeFileRaw(
`${tmp.path}/schema.md`,
- "# Schema\n\nEach source needs its own source summary page.\n",
+ "# Schema\n\nEach source needs its own source summary page.\n\n## Page Types\n| goal | wiki/goals/ | Outcomes |\n| habit | wiki/habits/ | Behaviours |",
)
await writeFileRaw(`${tmp.path}/wiki/index.md`, "# Index\n")
await writeFileRaw(`${tmp.path}/wiki/overview.md`, "# Overview\n")
@@ -335,6 +335,10 @@ describe("autoIngest source summary paths", () => {
String(messages?.[0]?.content ?? "").startsWith("You are analyzing a long source document"),
)
expect(chunkCalls.length).toBeGreaterThan(1)
+ const chunkSystemPrompt = String(chunkCalls[0][1]?.[0]?.content ?? "")
+ expect(chunkSystemPrompt).toContain("wiki/goals/")
+ expect(chunkSystemPrompt).toContain("Schema-Typed Candidates")
+ expect(chunkSystemPrompt).toContain("never invent goals")
expect(String(chunkCalls[0][1]?.[1]?.content ?? "")).toContain("## MAIN CHUNK TO ANALYZE")
expect(String(chunkCalls[1][1]?.[1]?.content ?? "")).toContain(
"Digest after chunk 1: stable context 1.",
diff --git a/src/lib/ingest.ts b/src/lib/ingest.ts
index 0f746498..986da579 100644
--- a/src/lib/ingest.ts
+++ b/src/lib/ingest.ts
@@ -2378,12 +2378,14 @@ function buildChunkAnalysisSystemPrompt(
"- Concise summary of the main chunk",
"- New or updated entities",
"- New or updated concepts",
+ "- Any schema-defined page types beyond entity/concept that the main chunk genuinely supports",
"- Claims, findings, evidence, contradictions",
"- Open questions or research gaps",
"",
"## Updated Global Digest",
"A compact document-level digest that incorporates this chunk and preserves prior cross-chunk context.",
- "Keep this digest structured under: Summary, Entities, Concepts, Claims, Evidence, Contradictions, Open Questions, Cross-Chunk Relations.",
+ "Keep this digest structured under: Summary, Entities, Concepts, Schema-Typed Candidates, Claims, Evidence, Contradictions, Open Questions, Cross-Chunk Relations.",
+ "Use schema-defined types only when the source actually supports them; never invent goals, habits, journal entries, decisions, or similar user-authored records that are not present in the source.",
"",
"Stable project context follows. It changes rarely and should be treated as background:",
purpose ? `## Wiki Purpose\n${purpose}` : "",