Help Type: command
Command: spinedigest

SpineDigest CLI

Purpose:
  Create and operate portable LLM Wiki archives for AI agents.
  Treat `.sdpub` as the primary knowledge archive: create archives from sources, queue derived knowledge generation, then search, browse, read source fragments, navigate links, and export projections without unpacking it.

Agent safety:
  Do not modify `.sdpub` as a ZIP file or edit its internals directly. Use `spinedigest` commands for all archive mutations; direct ZIP edits can break the archive structure and make data unreadable.

Three exploration modes:
  1. Search mode:
     Use `find` for whitespace-separated keyword discovery and `grep` for exact continuous text.
     Choose a search lens with `--type`:
       --type node      topology / LLM Wiki structure
       --type summary   quick overview
       --type fragment  original source wording
  2. Structure mode:
     Use `chapter tree --json` for table-of-contents hierarchy, `list` for bounded object collections, and `page` to open one detailed object with local navigation.
  3. Reading mode:
     Use `read` to print chapter, summary, fragment, or node text as continuous plain text.

Task routing:
  For synthesis, timelines, relationship analysis, process reconstruction, or concept-structure tasks, start with Structure mode:
    status -> index -> chapter tree --json -> list --type chapter -> page --chapter <id>
  Use `find --type node|summary|fragment` to locate candidate objects or verify missing concepts. Use `grep --type fragment` for exact source wording.

Archive-first usage:
  spinedigest create <archive.sdpub> [source] [--input-format <format>] [--llm <json>] [--prompt <text>]
  spinedigest queue add <archive.sdpub> --chapter <id> [--to graph|summary] --accept-cost [--boost] [--llm <json>] [--prompt <text>]
  spinedigest queue list [--all] [--active]
  spinedigest queue watch <job-id> [--jsonl] [--from beginning|now]
  spinedigest estimate <archive.sdpub> [--stage <source|graph|summary>] [--json]
  spinedigest status <archive.sdpub> [--json]
  spinedigest index <archive.sdpub> [--json]
  spinedigest list <archive.sdpub> --type <chapter|summary|node|fragment|meta> [--id <ids>] [--chapter <ids>] [--limit <n>] [--cursor <token>] [--json]
  spinedigest find <archive.sdpub> <query> --type <node|summary|fragment> [--match <any|all>] [--chapter <ids>] [--json]
  spinedigest grep <archive.sdpub> <query> --type <node|summary|fragment> [--chapter <ids>] [--json]
  spinedigest page <archive.sdpub> (--chapter <id>|--node <id>|--fragment <chapter>:<fragment>|--summary <id>|--meta book) [--json]
  spinedigest read <archive.sdpub> (--chapter <id>|--node <id>|--fragment <chapter>:<fragment>|--summary <id>|--meta book)
  spinedigest links <archive.sdpub> --node <id> [--json]
  spinedigest backlinks <archive.sdpub> --node <id> [--json]
  spinedigest related <archive.sdpub> --node <id> [--json]
  spinedigest path <archive.sdpub> --from <id> --to <id> --chapter <id>
  spinedigest pack <archive.sdpub> <selector> [--budget <chars>] [--json]
  spinedigest export <archive.sdpub> --output-format <format> [--output <path>]

Direct transform usage:
  spinedigest transform [--input <path>] [--output <path>] [--input-format <format>] [--output-format <format>] [--digest-dir <path>] [--llm <json>] [--prompt <text>] [--stage <stage>] [--verbose|-v] [--help|-h]

Maintenance usage:
  spinedigest meta <archive.sdpub> [metadata options] [--json] [--llm <json>] [--help|-h]
  spinedigest cover <archive.sdpub> [--llm <json>] [--help|-h]
  spinedigest chapter <action> <archive.sdpub> [options] [--llm <json>] [--help|-h]
  spinedigest queue <action> [options] [--help|-h]
  spinedigest config status [--llm <json>] [--help|-h]
  spinedigest help [topic] [--help|-h]

  `transform` is for direct one-shot digest/export. `chapter tree` without `apply` is read-only structure inspection. Maintenance commands are for metadata, cover extraction, and mutating chapter tree edits. Routine archive exploration should use `index`, `chapter tree`, `list`, `page`, `find`, `grep`, and `read`.

Object selectors:
  --chapter <id>                A chapter-like archive page.
  --node <id>                   A graph knowledge node.
  --fragment <chapter>:<id>     A source reading fragment.
  --summary <id>                A chapter summary projection.
  --meta book                   Archive metadata.

Cost contract:
  Create is cheap when it stops at source.
  List, search, page, read, links, and export are cheap after the needed archive data exists.
  Queue graph and summary jobs call an LLM, consume tokens, may incur provider charges, and can run for minutes to hours on large archives.
  `queue add` requires `--accept-cost` as an explicit cost/time acknowledgement.
  Run `spinedigest estimate <archive.sdpub> --stage summary` before scheduling large graph or summary batches.

Help contract:
  - Append `--help` to commands and subcommands to see command-specific usage.
  - Use `spinedigest help <topic>` for cross-command concepts, constraints, and runtime behavior.
  - Treat `spinedigest --help` as the root page of the same help system.

Search lens examples:
  spinedigest find book.sdpub "keyword" --type node
    Topology / LLM Wiki structure.
  spinedigest find book.sdpub "keyword" --type summary
    Quick overview.
  spinedigest find book.sdpub "keyword" --type fragment
    Original source wording.

Help topics:
{% for topic in helpTopics %}
  - spinedigest help {{ topic.name }}
    {{ topic.summary }}
{% endfor %}

Formats:
  {{ formats | join(", ") }}

Start here:
  - Read `spinedigest help overview` for the archive-first mental model.
  - Read `spinedigest help ai` for the agent operating contract.
  - Read `spinedigest help command` for command shapes.
