# Library
URL: /documentation/plugin/library



## What it does [#what-it-does]

The Library holds a project's durable prose — decisions, notes, runbooks, research, reference
material — outside any one chat or work item, stored in Strata19 rather than scattered across the
filesystem, and linkable to the code or spec it describes. `strata19.library_read` browses,
searches, and fetches artifacts. `strata19.library_manage` creates, edits, archives, captures a
conversation excerpt, saves a URL, and drives Specbook-promotion review. `strata19.library_links`
attaches an artifact to the work item, finding, spec node, or file it supports, and answers the
reverse lookup — what links to a given target.

Bulk import is a separate, preview-then-commit flow: `strata19.library_ingest_preview` reports
exactly what would be imported from a file, a directory, or a conversation, writing nothing;
`strata19.library_ingest_commit` only then creates the artifacts, atomically by default;
`strata19.library_ingest_status` and `strata19.library_ingest_cancel` poll or stop a batch in
flight.

The Library is not the Specbook. Content here is placed into one of eleven taxonomy categories
(or `_inbox` when none fit) and never silently becomes canonical intent — promoting an artifact
into the Specbook is a separate, human-reviewed step described in
[Specs and Specbook](/documentation/plugin/specs-and-specbook).

## When to use it [#when-to-use-it]

Use `strata19.library_read` (`browse`) before answering "what has this project saved" — a
filesystem search for markdown answers a different question and misses everything captured
through the Library. Use `strata19.library_manage` (`create`) the moment durable knowledge is
produced: a decision's rationale, a research finding, an architecture note. Use
`strata19.library_ingest_preview`/`_commit` to bring in an existing folder of documents rather
than creating artifacts one at a time by hand.

Do not use the Library for accepted product intent — that is the Specbook
(`strata19.spec_manage`). Do not use it for a defect or a piece of work to be done — that is a
finding or a work item (`strata19.author_finding`, `strata19.manage_work_item`). Do not call
`strata19.library_ingest_commit` before the user has seen the matching `strata19.library_ingest_preview`
result — a commit against an unseen preview is a blind write.

## How to use it [#how-to-use-it]

<Steps>
  <Step>
    Browse before creating, to avoid a near-duplicate. A real call against this repository's Library
    returned:

    ```json title="Call — strata19.library_read"
    { "action": "browse", "limit": 5 }
    ```

    ```json title="Response (excerpt)"
    {
      "artifacts": [
        { "artifactKey": "art-376de2514593a4a5", "title": "verify capture", "kind": "conversation_capture", "status": "active" },
        { "artifactKey": "art-db21f58cf89e6bf1", "title": "verify-test", "kind": "imported", "status": "active" },
        { "artifactKey": "art-105f7c494b8c6eeb", "title": "probe", "kind": "note", "status": "active" }
      ],
      "total": 6,
      "hasMore": true,
      "window": { "limit": 5, "offset": 0, "returned": 5, "matched": 6 }
    }
    ```

    `hasMore`/`window` page through the corpus — pass the prior response's `nextCursor` back as
    `cursor` to continue, rather than raising `limit` unbounded.
  </Step>

  <Step>
    Create an artifact with a deliberate `category` — run the placement decision tree (the
    `strata19-library-placement` skill) rather than guessing:

    ```json title="Call — strata19.library_manage"
    {
      "action": "create",
      "title": "Why we chose Redpanda over Kafka for durable events",
      "kind": "architecture",
      "category": "decisions",
      "body": "..."
    }
    ```

    Omitting `category` is not an error — the artifact files to `_inbox` and the response says so —
    but it should be a last resort, not the default.
  </Step>

  <Step>
    Link the new artifact to what it explains:

    ```json title="Call — strata19.library_links"
    { "action": "link", "artifactKey": "art-...", "kind": "decision", "targetKey": "DEC-042", "role": "context-for" }
    ```
  </Step>
</Steps>

## Parameters [#parameters]

`strata19.library_read` requires `action` (`browse`, `get`, `list_proposals`, `summary`, or
`categories`) and, for `browse`, accepts `query`, `kind`, `status`, `tags`, `category`,
`pathPrefix`, `mode` (`lexical` or `hybrid` — hybrid fuses a deterministic hashed-term signal,
never a neural embedding), `cursor`, and `limit` (default 50). `get` requires `artifactKey`.

<TypeTable
  type="{
  action: {
    description: 'create, edit, archive, capture, promote, review_proposal, sync, save_url, confirm_capture, or capture_batch.',
    type: 'string',
    required: true,
  },
  title: { description: 'Title for a new artifact.', type: 'string' },
  kind: {
    description: 'note, document, research, architecture, customer_context, benchmark, design_reference, imported, conversation_capture, or generated.',
    type: 'string',
  },
  body: { description: 'The artifact text, inlined. Provide this or bodyFile.', type: 'string' },
  category: {
    description: 'architecture, decisions, domain, requirements, research, references, integrations, runbooks, conversations, benchmarks, or _inbox. Run the placement decision tree before choosing.',
    type: 'string',
  },
  artifactKey: { description: 'The artifact to edit, archive, or promote.', type: 'string' },
}"
/>

`strata19.library_links` requires `action` (`link` or `links_to`), plus `artifactKey`, `kind`
(`work`/`finding`/`routine`/`decision`/`requirement`/`spec_node`/`code_symbol`/`file`/`artifact`/`conversation`),
`targetKey`, and an optional `role` and `strength`. `strata19.library_ingest_preview` requires
`schemaVersion`, `projectKey`, `source`, `duplicatePolicy`, and `idempotencyKey`;
`strata19.library_ingest_commit` requires the `previewId` and `previewDigest` that preview
returned, plus `selected` and `commitMode` (`atomic` or `valid_items`).

## What you get back [#what-you-get-back]

`strata19.library_read` (`browse`) returns `artifacts[]`, `total`, `hasMore`, and a `window` for
pagination, shown above. `strata19.library_manage` (`create`/`edit`) returns the artifact record
including its `artifactKey`. `strata19.library_ingest_preview` returns discovered, ready,
excluded, blocked, and duplicate counts per item, plus the `previewDigest` the commit call must
echo back unchanged. `strata19.library_ingest_commit` returns a per-item receipt; replaying the
same `idempotencyKey` returns the same receipt rather than duplicating the import.

## Limits [#limits]

`strata19.library_manage` never writes to the Specbook directly — promotion is a separate,
human-reviewed proposal (`action: "promote"` then `review_proposal`), enforced by construction
rather than by convention. `strata19.library_ingest_commit` is atomic by default: one failing
item in the batch rejects the whole batch unless `commitMode` is explicitly `valid_items`. A
changed source file since preview, an expired preview, or a `previewDigest` mismatch refuses the
whole commit call rather than importing a stale selection. `strata19.library_ingest_cancel` stops
an in-flight batch but cannot undo artifacts already committed — those stay, with their receipts.

## Related [#related]

* [Specs and Specbook](/documentation/plugin/specs-and-specbook) — how Library content is promoted to canonical intent
* [Work and checkpoints](/documentation/plugin/work-and-checkpoints) — where defects and work belong instead
* [`strata19.library_read`](/documentation/reference/tools/library_read)
* [`strata19.library_manage`](/documentation/reference/tools/library_manage)
* [`strata19.library_links`](/documentation/reference/tools/library_links)
* [`strata19.library_ingest_preview`](/documentation/reference/tools/library_ingest_preview)
