Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,12 @@ wikigraph wkg://book.wikg create ./book.epub
cat ./article.md | wikigraph wkg://article.wikg create --input-format markdown
```

Inspect and estimate before expensive work:
Inspect before expensive work:

```bash
wikigraph wkg://book.wikg/state get
wikigraph wkg://book.wikg/chapter/tree get --json
wikigraph wkg://book.wikg estimate --stage reading-summary
wikigraph wkg://book.wikg inspect
```

Build derived knowledge when you intend to spend LLM time:
Expand Down Expand Up @@ -106,7 +106,7 @@ Cost rule:

```text
Create is cheap.
Estimate before queueing Reading Graph, Reading Summary, or Knowledge Graph jobs.
Inspect before queueing Reading Graph, Reading Summary, or Knowledge Graph jobs.
Queue Reading Graph, Reading Summary, or Knowledge Graph jobs only when the cost and wait time are acceptable.
Search, get, related, evidence, pack, and export are cheap after build.
```
Expand Down Expand Up @@ -187,7 +187,7 @@ SpineDigest's CLI-first design exposes `.wikg` as a managed LLM Wiki archive.
- **Choose an exploration mode first.** For synthesis and structural understanding, start with `wkg://.../chapter/tree get --json`; use `search` for candidate discovery and exact wording; use `get` for continuous prose after selecting the relevant URI.
- **Use help as the discovery surface.** Start with `wikigraph --help` as the root page, then follow `wikigraph help overview`, `wikigraph help ai`, topic pages, or command-specific `--help` before guessing behavior.
- **Prefer `--json`.** Use it when composing with tools.
- **Estimate before queueing jobs.** Do not queue broad Reading Graph, Reading Summary, or Knowledge Graph work without `wikigraph <archive-uri> estimate`.
- **Inspect before queueing jobs.** Do not queue broad Reading Graph, Reading Summary, or Knowledge Graph work without `wikigraph <archive-uri> inspect`.
- **Check exit codes.** Success returns `0`; failure returns non-zero with a plain-text error on `stderr`.
- **Do not inspect `database.db` routinely.** Use `search`, `list`, `get`, and graph navigation commands instead.

Expand Down
17 changes: 0 additions & 17 deletions data/help/commands/archive/estimate.jinja

This file was deleted.

12 changes: 6 additions & 6 deletions data/help/commands/archive/evidence.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Use when:
- You need support before quoting, verifying, or answering from a claim.

Usage:
wikigraph <object-uri> evidence [query] [--all] [--limit <n>] [--context <n>] [--cursor <token>] [--json|--jsonl] [--help|-h]
wikigraph <object-uri> evidence [--query <query>] [--all] [--limit <n>] [--context <n>] [--cursor <token>] [--json|--jsonl] [--help|-h]

Returns:
- Evidence items anchored to source text.
Expand All @@ -20,19 +20,19 @@ Notes:
- `evidence` is for verification, not broad context assembly.
- When the user asks for source passages mentioning, grounding, or supporting a known entity, start from `<archive-uri>/entity/<qid> evidence`.
- Do not use source search by entity label as the primary method; labels may have aliases, translations, variants, and grounded mentions that do not match literal text. Use source search only as a secondary literal-text check.
- Do not infer Wikipedia URLs from entity labels or QIDs; use `<archive-uri>/entity/<qid>/wikipage get` for mapped pages.
- Optional `query` uses the current FTS index to filter and rank only the evidence items that would otherwise be returned; run `<archive-uri>/index build` first if the index is missing or outdated.
- Do not infer Wikipedia URLs from entity labels or QIDs; use `<archive-uri>/entity/<qid>/wikipage` for mapped pages.
- Optional `--query` uses the current FTS index to filter and rank only the evidence items that would otherwise be returned; run `<archive-uri>/index build` first if the index is missing or outdated.
- Evidence source ranges include 2 nearby sentences before and after by default. Use `--context 0` for exact cited ranges, or `--context <n>` for a different nearby source window.
- Read `wikigraph help retrieval` before choosing `--limit`, `--all`, `--json`, or `--jsonl`.
- Use `wikigraph next <cursor>` for any returned `nextCursor`.
- Source, chapter, and chapter-tree objects are evidence endpoints or structure objects; `evidence` is not available for them.
- Source, chapter scope, and chapter-tree objects are evidence endpoints or structure objects; `evidence` is not available for them.
- Use `pack` when the goal is bounded context around a selected object.

Next steps:
- Use `get` to inspect readable objects mentioned by evidence output.
- Open readable objects mentioned by evidence output directly.
- Use `pack` when evidence confirms the object is a useful answer anchor.

Examples:
wikigraph wikg:///books/book.wikg/entity/Q162593 evidence
wikigraph wikg:///books/book.wikg/entity/Q162593 evidence "baptism"
wikigraph wikg:///books/book.wikg/entity/Q162593 evidence --query "baptism"
wikigraph wikg:///books/book.wikg/chapter/3/triple/Q162593/discusses/Q9476 evidence
23 changes: 23 additions & 0 deletions data/help/commands/archive/inspect.jinja
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
Help Type: command
Command: wikigraph <archive-uri> inspect

Purpose:
Inspect archive content, graph coverage, FTS readiness, and recommended next steps.

Usage:
wikigraph <archive-uri> inspect [--help|-h]
wikigraph <chapter-uri> inspect [--help|-h]

Output:
Prints a readable report. JSON and JSONL output are not supported.

Report:
- Content statistics: content chapters, planned chapters, source words, and summary words.
- FTS index status and the impact on query-based search, related, and evidence commands.
- Reading Graph, Knowledge Graph, and Summary coverage by chapter and source words.
- Retrieval guidance for source search and object search.
- Improvement commands with rough planning cost for LLM-backed work.

Examples:
wikigraph wikg://book.wikg inspect
wikigraph wikg://book.wikg/chapter/13 inspect
18 changes: 9 additions & 9 deletions data/help/commands/archive/list.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,21 @@ Use when:
- You need objects of a kind without a text query, such as all chapters or all entities.

Usage:
wikigraph <located-wikg-uri>/<chapter|entity|triple|source|summary|chunk> list [--all] [--limit <n>] [--context <n>] [--evidence [n]] [--backlinks] [--cursor <token>] [--json|--jsonl] [--help|-h]
wikigraph <scope-uri> [--query <query>] [--all] [--limit <n>] [--context <n>] [--evidence [n]] [--backlinks] [--cursor <token>] [--json|--jsonl] [--help|-h]

Returns:
- URI-addressable objects in document order.

Notes:
- Conceptually, `list` is `search` without query text, scoped by a URI lens.
- Use `<located-wikg-uri>/chapter`, `<located-wikg-uri>/entity`, `<located-wikg-uri>/triple`, `<located-wikg-uri>/source`, `<located-wikg-uri>/summary`, or `<located-wikg-uri>/chunk` to choose the collection.
- Scope URIs enumerate without query text.
- Use `<located-wikg-uri>/chapter`, `<located-wikg-uri>/entity`, `<located-wikg-uri>/triple`, or `<located-wikg-uri>/chunk` to choose the collection.
- Some chapters are structural table-of-contents nodes that organize child chapters; missing generated artifacts alone does not make them abnormal.
- Lens position controls scope: `<archive-uri>/entity` lists archive-wide entities, while `<chapter-uri>/entity` lists entities scoped to one chapter.
- Use `<archive-uri>/entity list` for an archive-wide entity inventory. Use `<chapter-uri>/entity list` only when you need one chapter.
- Use `<archive-uri>/entity` for an archive-wide entity inventory. Use `<chapter-uri>/entity` only when you need one chapter.
- Use `_` as an any-value placeholder in triple pattern lenses such as `<archive-uri>/triple/Q1/_/Q2`.
- Trailing triple placeholders may be omitted: `<archive-uri>/triple/Q1` means `<archive-uri>/triple/Q1/_/_`.
- Put the lens after a chapter URI, such as `<chapter-uri>/entity`, to list within one chapter.
- Use `search` when you have query text.
- Add `--query <query>` when you have query text.
- Add `--evidence` or `--evidence <n>` to include source evidence previews on entity and triple results.
- Evidence previews include 2 nearby sentences before and after by default. Use `--context 0` for exact cited ranges.
- Add `--backlinks` to include reverse references on top-level source results; nested evidence sources are not expanded.
Expand All @@ -33,7 +33,7 @@ Notes:
- Use `wikigraph help uri` before constructing Wiki Graph URIs; bare filesystem paths are not valid object command inputs.

Examples:
wikigraph wikg:///books/book.wikg/chapter list
wikigraph wikg:///books/book.wikg/entity list
wikigraph wikg:///books/book.wikg/chapter/3/entity list
wikigraph wikg:///books/book.wikg/triple/_/_/Q178561 list
wikigraph wikg:///books/book.wikg/chapter
wikigraph wikg:///books/book.wikg/entity
wikigraph wikg:///books/book.wikg/chapter/3/entity
wikigraph wikg:///books/book.wikg/triple/_/_/Q178561
10 changes: 5 additions & 5 deletions data/help/commands/archive/related.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@ Use when:
- You have a selected entity and need Knowledge Graph triples involving it.

Usage:
wikigraph <chunk-uri> related [query] [--all] [--limit <n>] [--context <n>] [--cursor <token>] [--evidence [n]] [--json|--jsonl] [--help|-h]
wikigraph <entity-uri> related [query] [--all] [--limit <n>] [--context <n>] [--cursor <token>] [--role <any|subject|object|self>] [--evidence [n]] [--json|--jsonl] [--help|-h]
wikigraph <chunk-uri> related [--query <query>] [--all] [--limit <n>] [--context <n>] [--cursor <token>] [--evidence [n]] [--json|--jsonl] [--help|-h]
wikigraph <entity-uri> related [--query <query>] [--all] [--limit <n>] [--context <n>] [--cursor <token>] [--role <any|subject|object|self>] [--evidence [n]] [--json|--jsonl] [--help|-h]

Returns:
- Related full `wikg://...` URIs with labels or summaries.

Notes:
- `related` starts from a known URI; `search` starts from query text.
- Optional `query` uses the current FTS index to filter and rank only the related objects that would otherwise be returned; run `<archive-uri>/index build` first if the index is missing or outdated.
- Optional `--query` uses the current FTS index to filter and rank only the related objects that would otherwise be returned; run `<archive-uri>/index build` first if the index is missing or outdated.
- `--role` only applies to entity URIs. Default is `any`.
- Add `--evidence` or `--evidence <n>` to include source evidence previews where available.
- Evidence previews include 2 nearby sentences before and after by default. Use `--context 0` for exact cited ranges.
Expand All @@ -29,12 +29,12 @@ Notes:
- Read `wikigraph help uri` before constructing object URIs.

Next steps:
- Use `get` to inspect a readable returned URI.
- Open a readable returned URI directly.
- Use `evidence` to verify a returned URI.
- Use `pack` when one related object becomes the answer anchor.

Examples:
wikigraph wikg:///books/book.wikg/chunk/123 related
wikigraph wikg:///books/book.wikg/entity/Q162593 related "baptism"
wikigraph wikg:///books/book.wikg/entity/Q162593 related --query "baptism"
wikigraph wikg:///books/book.wikg/entity/Q162593 related
wikigraph wikg:///books/book.wikg/entity/Q162593 related --role subject --evidence
21 changes: 8 additions & 13 deletions data/help/commands/archive/search.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,7 @@ Use when:
- You have words, names, phrases, or concepts and need candidate object URIs.

Usage:
wikigraph <archive-uri> search <query> [--all] [--limit <n>] [--context <n>] [--evidence [n]] [--backlinks] [--cursor <token>] [--json|--jsonl] [--help|-h]
wikigraph <chapter-uri> search <query> [--all] [--limit <n>] [--context <n>] [--evidence [n]] [--backlinks] [--cursor <token>] [--json|--jsonl] [--help|-h]
wikigraph <archive-uri>/<entity|triple|source|summary|chunk> search <query> [--all] [--limit <n>] [--context <n>] [--evidence [n]] [--backlinks] [--cursor <token>] [--json|--jsonl] [--help|-h]
wikigraph <chapter-uri>/<entity|triple|source|summary|chunk> search <query> [--all] [--limit <n>] [--context <n>] [--evidence [n]] [--backlinks] [--cursor <token>] [--json|--jsonl] [--help|-h]
wikigraph <scope-uri> --query <query> [--all] [--limit <n>] [--context <n>] [--evidence [n]] [--backlinks] [--cursor <token>] [--json|--jsonl] [--help|-h]

Returns:
- In text output, a ranked list of full `wikg://...` URIs.
Expand All @@ -23,28 +20,26 @@ Notes:
- Search requires a current FTS index. If the index is missing or outdated, run `<archive-uri>/index build`.
- Search results are leads, not source evidence.
- Search the archive URI for broad discovery.
- Search a lens URI such as `<archive-uri>/source`, `<archive-uri>/summary`, `<archive-uri>/chunk`, `<archive-uri>/entity`, or `<archive-uri>/triple` to choose one object kind.
- Search a scope URI such as `<archive-uri>/chapter`, `<archive-uri>/chunk`, `<archive-uri>/entity`, or `<archive-uri>/triple` to choose one object kind.
- Lens position controls scope: `<archive-uri>/entity` searches archive-wide entities, while `<chapter-uri>/entity` searches entities scoped to one chapter.
- Use `_` as an any-value placeholder in triple pattern lenses such as `<archive-uri>/triple/Q1/_/Q2`.
- Trailing triple placeholders may be omitted: `<archive-uri>/triple/Q1` means `<archive-uri>/triple/Q1/_/_`.
- Put the lens after a chapter URI, such as `<chapter-uri>/entity`, to keep retrieval local to one chapter.
- Add `--evidence` or `--evidence <n>` to include source evidence previews on entity and triple results.
- Source and summary search hits, plus evidence previews, include 2 nearby sentences before and after by default. Use `--context 0` for exact matched or cited ranges.
- Source and summary objects, plus evidence previews, include 2 nearby sentences before and after by default. Use `--context 0` for exact matched or cited ranges.
- Add `--backlinks` to include reverse references on top-level source results; nested evidence sources are not expanded.
- Read `wikigraph help retrieval` before choosing `--limit`, `--all`, `--json`, or `--jsonl`.
- Use `wikigraph next <cursor>` for any returned `nextCursor`.
- Use a located chapter URI to keep retrieval local.
- Read `wikigraph help uri` before constructing Wiki Graph URIs; bare filesystem paths are not valid object command inputs.

Next steps:
- Use `get` to inspect a readable returned URI.
- Open a readable returned URI directly to inspect it.
- Use `evidence` when source-backed verification is needed.
- Use `pack` after selecting a useful readable URI.

Examples:
wikigraph wikg:///books/book.wikg search "恩典 婴儿洗礼"
wikigraph wikg:///books/book.wikg/source search "infant baptism"
wikigraph wikg:///books/book.wikg/entity search "infant baptism"
wikigraph wikg:///books/book.wikg/chapter/3/source search "infant baptism"
wikigraph wikg:///books/book.wikg/chapter/3/entity search "infant baptism"
wikigraph wikg:///books/book.wikg/triple/_/_/Q178561 search "battle"
wikigraph wikg:///books/book.wikg --query "恩典 婴儿洗礼"
wikigraph wikg:///books/book.wikg/entity --query "infant baptism"
wikigraph wikg:///books/book.wikg/chapter/3/entity --query "infant baptism"
wikigraph wikg:///books/book.wikg/triple/_/_/Q178561 --query "battle"
Loading
Loading