artifacts

package
v0.2.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 28, 2026 License: Apache-2.0 Imports: 14 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package artifacts reads the claude.ai artifacts Claude Code published from its session transcripts (~/.claude/projects/FOLDER/SESSION.jsonl). Nothing else records them: claude.ai offers no list, and the link an agent printed has scrolled off its full-screen interface by the time anybody looks. A transcript keeps every Artifact tool call and the tool's reply, which names the artifact's address.

The phone gateway (GET /api/artifacts) and the server (artifact.list) both read through here.

Index

Constants

This section is empty.

Variables

View Source
var MaxCached = 1 << 14

MaxCached bounds a cache. Listing every artifact reads every transcript on the computer, and there can be thousands, so a small bound would empty the cache part-way through each listing and make every request read them all again; an entry is a size, a time and a short list.

View Source
var Shared = NewCache()

Shared is the cache both readers use: one process reads a transcript once until it changes.

Functions

func FindTranscript

func FindTranscript(root, session string) string

FindTranscript is Claude Code's transcript for a session: a session id names one file, in the folder of whichever directory it started in.

func Parse

func Parse(r io.Reader) ([]proto.Artifact, error)

Parse reads a Claude Code transcript for the Artifact tool's publishes: one entry per artifact, newest first. Lines that are not JSON are skipped, as a transcript cut off mid-write ends in one.

func Plain

func Plain(f []Found) []proto.Artifact

Plain is the artifacts without their folders.

func Root

func Root() string

Root is Claude Code's folder of transcripts, or "" without a home.

Types

type Cache

type Cache struct {
	// contains filtered or unexported fields
}

Cache remembers each transcript's artifacts until the file changes: a long session's transcript runs to megabytes, and a live one to hundreds. A transcript only grows, so one that grew is read from where it was left (as internal/usage's history is), and one being read already is waited for rather than read a second time: every window of Conch.app asks for the whole list as it connects, and on an empty cache — the first start, and every reload — that was each of them reading every transcript.

func NewCache

func NewCache() *Cache

NewCache is an empty cache.

func (*Cache) Has

func (c *Cache) Has(path string) bool

Has says whether the cache holds path.

func (*Cache) Len

func (c *Cache) Len() int

Len is how many transcripts the cache holds.

func (*Cache) Read

func (c *Cache) Read(path string) ([]proto.Artifact, error)

Read is one transcript's artifacts, newest first.

func (*Cache) ReadAll

func (c *Cache) ReadAll(paths []string) ([]Found, error)

ReadAll merges the artifacts of several transcripts: an artifact two sessions published is one entry, with both sessions' versions.

type Found

type Found struct {
	proto.Artifact
	Folders []string
}

Found is an artifact and the transcript folders that published it: a folder is one directory's sessions, which is how a pane's agent is matched to what it published.

func All

func All(c *Cache, root string) ([]Found, error)

All is every artifact any Claude Code session under root published.

func OfSession

func OfSession(c *Cache, root, session string) ([]Found, bool, error)

OfSession is what the sessions saved beside session published: every session that ran in its directory, not just this one, since a resumed or cleared agent starts a new transcript there. Found is false when the session's transcript is not on disk (yet: it is written after the first answer).

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL