Skip to content

rivet bundle <ID> --depth N — context-window paste artifact #206

@avrabe

Description

@avrabe

Problem

When an LLM agent is reasoning about a rivet artifact and its neighbours, the natural workflow is rivet get <ID> → read description → call rivet get again on each link target → paste the assembled context into the conversation. This is N round-trips for what should be one.

Karpathy's LLM Wiki gist describes the equivalent for markdown wikis: "the LLM reads the index first to find relevant pages, then drills into them." Rivet's typed graph already has the link information; we just don't have a verb that emits the closure as a single pasteable document.

Proposal

rivet bundle REQ-006 --depth 2 --as yaml
rivet bundle DD-064 --depth 1 --as jsonl
  • Root: any artifact ID.
  • --depth N: how many link-graph hops to include. Depth 1 = root + direct neighbours.
  • --as {yaml,jsonl}: output format. YAML preserves typed structure for paste-into-prompt; JSONL is one-record-per-line for tool consumers.
  • Inline link annotations: each artifact in the bundle carries its outgoing links, with the link type rendered as in-stream text (# satisfies → REQ-004) so an LLM reading top-to-bottom resolves references without a second lookup.

Why YAML, not Markdown

The closest Karpathy analogue is "paste the wiki into the LLM context." For rivet, YAML preserves typed structure with zero information loss; markdown would flatten typed links into prose and re-introduce exactly the ambiguity rivet's typed model exists to remove. See the companion blog post for the longer argument.

Implementation sketch

  • New module rivet-core/src/bundle.rs — graph traversal over Store::all_artifacts() + Link graph.
  • New CLI command in rivet-cli/src/main.rsCommand::Bundle { id, depth, format }.
  • New MCP tool rivet_bundle in rivet-cli/src/mcp.rs so an agent can call this without shelling out.
  • Tests: snapshot test against a small fixture; depth-0 → only root; depth-1 → root + direct neighbours; cycle handling.

Out of scope

  • Markdown rendering. Add a separate request if a rendered-for-humans surface is wanted.
  • Anything beyond the typed link graph. No prose stitching, no LLM-mediated synthesis.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions