agentimport

package module
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2026 License: MIT Imports: 19 Imported by: 0

README

agentimport

Converters from other coding agents' session logs into the Agent Session Format: Claude Code, pi, Codex, classic Cline and Roo Code, the Cline SDK (Cline 4), OpenHands, OpenCode, Hermes Agent, and ATIF, Harbor's trajectory format, which many more agents write. Each conversion returns the sessions it made and a report that accounts for every native line and lists every difference between the two formats by a stable code, so nothing is lost without saying so.

go install github.com/ChristopherDavenport/agentimport/cmd/agentimport@latest

# What converting would change, added up across a corpus; writes nothing.
agentimport report ~/.claude/projects ~/.pi/agent/sessions ~/.codex/sessions

# Convert one session, or every session under a directory, into an
# agentsession jsonl store: <store>/<project-key>/<created-at>_<id>.jsonl.
agentimport convert -o ~/sessions ~/.claude/projects/<project>/<session>.jsonl
agentimport convert -o ~/sessions -report json ~/.codex/sessions

Each file's source is told from its name and first lines, an ATIF document by its schema_version, a Cline or Roo task by its files' names in a task directory, an OpenHands conversation by its directory or its files, an OpenCode store by its data directory, a file in it or its database, a Cline SDK session by its directory or a file in it, a Hermes database by its tables or the home or profile directory holding it; -from claudecode|pi|codex|atif|cline|clinesdk|openhands|opencode|hermes names it instead. A Claude Code session, and a Codex rollout, is converted with its sub-agents, each a session of its own linked to its parent; a Codex sub-agent's rollout given beside an ancestor's is converted with it, not again on its own, and on its own when the ancestor's conversion did not produce it. An ATIF document is converted with the continuations and sub-agent files it names, which are skipped as inputs when its conversion holds them. A Roo task is converted with the sub-tasks it waited for, and an OpenHands conversation with its sub-agents, which are skipped as inputs when its conversion holds them. An OpenCode store, a data directory such as ~/.local/share/opencode or a database, converts whole: every session, each with its sub-agents; its database is copied and read, never written. A Cline SDK session directory converts with the sub-agents and team tasks whose histories it holds, linked to their calls with the help of Cline's sessions.db, likewise copied and read. A Hermes database, ~/.hermes/state.db or a profile's, converts whole: every session, each with the continuations its compressions started and the sub-agents it ran; it too is copied and read. A session already in the store is kept as it is, listed, and is no failure, unless -force replaces it; the other sessions of the same conversion are written all the same, so converting a tree again adds what is new since. -slim drops what the model never saw rather than keep it in namespaced members, and -strict exits 1 when anything was dropped or met a gap docs/incompatibilities.md does not list; a listed gap is a known shape of the format, not a fact of one transcript. -accept code,... names finding codes -strict lets through. -derive writes the entries derivation rules infer from the converted path, each marked agentimport:derived: for every source, what a shell call published (a pushed branch or tag, a pull request opened), as an agentimport:published record carrying the call's call_id, and the revision a commit printed, as an env entry. A Codex rollout compressed with zstd is refused; decompress it with zstd -d first.

Each source is two packages: one that reads the native format as it is, importing the standard library alone, and a convert package that writes agentsession sessions. OpenCode, the Cline SDK and Hermes have a third, opencode/sqlite, clinesdk/sqlite and hermes/sqlite, the packages that import a database driver (modernc.org/sqlite, SQLite in Go, no cgo), all through internal/sqlite.

Source Format package Converter What maps and what does not
Claude Code claudecode claudecode/convert docs/formats/claudecode.md
pi pi pi/convert docs/formats/pi.md
Codex codex codex/convert docs/formats/codex.md
ATIF (Harbor) atif atif/convert docs/formats/atif.md
Cline (classic, before 4.0) and Roo Code cline cline/convert docs/formats/cline.md
Cline SDK (Cline 4: CLI, VS Code from 4.0, JetBrains) clinesdk, clinesdk/sqlite clinesdk/convert docs/formats/clinesdk.md
OpenHands (SDK conversations: CLI, agent server, Agent Canvas) openhands openhands/convert docs/formats/openhands.md
OpenCode (storage files, its database's V1 and V2 tables) opencode, opencode/sqlite opencode/convert docs/formats/opencode.md
Hermes Agent (its state.db: CLI, TUI, gateway, cron, sub-agents) hermes, hermes/sqlite hermes/convert docs/formats/hermes.md

What the session format itself cannot hold, across all sources, is in docs/incompatibilities.md.

Development

make check

See CONTRIBUTING.md.

License

MIT; see LICENSE. Some files port code of the programs whose logs they read, under those programs' MIT and Apache 2.0 licenses; THIRD_PARTY_NOTICES.md lists them.

Documentation

Overview

Package agentimport holds what every converter into the Agent Session Format shares: the Report of what a conversion did to its input, the Builder that appends a native log's entries to a session, and the CallIDs the format's call rules need.

The converters are in the source packages' convert subpackages, claudecode/convert, pi/convert, codex/convert, atif/convert, cline/convert, clinesdk/convert, openhands/convert and opencode/convert; the native formats are in claudecode, pi, codex, atif, cline, clinesdk, openhands and opencode, which import the standard library alone, and OpenCode's and Cline's databases are read by opencode/sqlite and clinesdk/sqlite. docs/plans/agentimport.md is the design.

Index

Constants

View Source
const DerivedMember = "agentimport:derived"

DerivedMember marks an entry no native line maps to that a converter inferred from the content of the converted path: its value names the rule and its inputs. Only an importer infers entries from content, so the mark is this module's own, not a format member, and every rewriter keeps it (docs/plans/agentimport.md, "Entries no line maps to"). A derived entry is written only when the conversion asks for derivation, and states only what its input states.

View Source
const ExitCodeMember = "agentimport:exit_code"

ExitCodeMember is the member an item entry carries for the exit status a source records of a command, structured or in a fixed wrapper of the harness's: the tool's own detail, which RFC 0001 does not define. A converter never infers failed from it; a command may exit nonzero without failing. It is kept under Slim, as it says how the command ended, not what the model was sent.

View Source
const IdentityCode = "agentimport/identity"

IdentityCode is the code of a finding that a native member naming a person, an account or organization, a machine or the native session was carried into the session. A conforming converter documents those members (RFC 0001, Conformance) and reports them by path and count, never by value, so a redaction can harvest the values from the original and check its output for them.

View Source
const Module = "github.com/ChristopherDavenport/agentimport"

Module is this module's path, as the provenance member names it.

View Source
const PublishedCode = "agentimport/published-refs"

PublishedCode is the code a published-refs record is reported under.

View Source
const PublishedNS = "agentimport:published"

PublishedNS is the namespace of the custom entry that records what a call published: a branch or tag pushed, a pull request opened. What a tool did is not the environment, so it is a record of the call, carrying its call_id, which goes with the call when a redaction leaves it out (RFC 0001, custom, 0.15).

View Source
const RevisionCode = "agentimport/commit-revision"

RevisionCode is the code a derived env entry carrying a commit's revision is reported under.

View Source
const SkillReadNS = "agentskill:read"

SkillReadNS is the namespace of the custom entry that records a skill read: agentskill's RecordNS, which agentturn's recorder writes when agentskill's skill tool serves one. An imported session writes the same record, so a reader finds a skill the same way in a session a harness recorded and in one converted from another agent's log.

View Source
const SourceMember = "agentimport:source"

SourceMember is the header member that says where a session was imported from. The format defines no import provenance, so it is a namespaced member.

View Source
const UsageInconsistentCode = "agentimport/usage-inconsistent"

UsageInconsistentCode is the code of the finding that a usage counts more input read from and written to the prompt cache than input, which openresponses' extensions §5 rules out: the writes and the cache reads are disjoint parts of the input, so a reader pricing the rest, input less both, would get a negative count. The counts are kept as the source reported them; agentimport computes no uncached input from them.

Variables

View Source
var DeriveRules = []string{"commit-revision", "published-refs"}

DeriveRules are the derivation rules a conversion that asks for derivation runs, as agentimport:source's derived names them.

Dispositions lists every disposition in report order.

Kinds lists every kind in report order.

Functions

func CacheWrites added in v0.0.3

func CacheWrites(d *openresponses.InputTokensDetails, total int64, byTTL map[string]int64)

CacheWrites sets the cache writes a source reports on d, as openresponses' extensions §5 asks of a writer whose provider reports them and as its Claude adapter does: nothing when total is not positive; the split by TTL, its zero entries left out, when the source gives one whose values sum to total; the count alone otherwise. The tokens are counted in the usage's input already, as each converter folds them in.

func CheckUsage added in v0.0.3

func CheckUsage(r *Report, file string, s *agentsession.Session)

CheckUsage reports, in one finding naming file, the usages of s whose cache reads and writes come to more than their input (UsageInconsistentCode). A Builder checks each entry it appends; this is for a session put together without one.

func CleanJSON

func CleanJSON(raw json.RawMessage) (out json.RawMessage, changed bool, err error)

CleanJSON returns raw as I-JSON: every string in it, member names included, made valid Unicode (invalid UTF-8 and lone surrogate escapes become U+FFFD), and an object that repeats a member name keeping the last, as JavaScript's JSON.parse reads it. The session format holds I-JSON, and its writer normalises a value but refuses a member name that is not, or a repeated one, so a native object copied into a member or a custom entry is cleaned first. Numbers keep their spelling. changed says something was replaced or dropped; see RepeatedMembers to tell which. raw that is already clean is returned as it is.

func CommitRevision

func CommitRevision(command, output string) string

CommitRevision reads the revision a git commit printed, "[<branch> <revision>] <subject>", abbreviated as git prints it. A command that is not a commit, a dry run, or a quiet commit that printed nothing yields "".

func Converter

func Converter() string

Converter names this module at the version the running binary was built with: "(devel)" in a build of the module itself.

func DocumentedGap

func DocumentedGap(code string) bool

DocumentedGap reports whether code is a gap docs/incompatibilities.md lists: a known, permanent shape of the session format, which says nothing about one transcript. A test holds every gap a converter reports to that table, so a gap this does not list is a converter's mistake.

func ErrorText

func ErrorText(err error) string

ErrorText renders an error for a finding's detail so it reads the same on every Go release. encoding/json's type errors name the field by a path whose form changed between releases (an embedded struct's name was dropped from it in Go 1.27), so they are rewritten to the member's own name, the JSON kind it held and the type it needed; anything wrapping such an error keeps its own text.

func Finish

Finish writes s, reads it back and checks the records on every leaf, the checks a reader of the converted file will make, and returns the session as read back. A converter returns that session rather than the one it built: a reader of the written file resumes on the leaf the file names, which an in-memory session's leaf can differ from. A converter whose output fails the checks has a bug.

func InvalidText

func InvalidText(raw json.RawMessage) bool

InvalidText reports whether a JSON text holds a string, member names included, that is not valid Unicode: invalid UTF-8, or a lone surrogate escape. CleanJSON replaces such text.

func MarkDerived

func MarkDerived(h *agentsession.Header) error

MarkDerived names, in a header's agentimport:source, the derivation rules the conversion runs: entries after a derived one have other ids than a conversion without derivation gives them.

func PublishedEntry

func PublishedEntry(callID, command, output string) (*agentsession.CustomEntry, error)

PublishedEntry is the derived record of what a call published, or nil when it published nothing the output says.

func RepeatedMembers

func RepeatedMembers(raw json.RawMessage) bool

RepeatedMembers reports whether an object anywhere in raw names a member twice, which I-JSON forbids.

func RevisionEnv

func RevisionEnv(base *agentsession.EnvEntry, cwd, rev string) *agentsession.EnvEntry

RevisionEnv is the env entry after a commit: an env entry is a whole snapshot (RFC 0001), so it repeats the one in force, base, its working directory, workspace, tools and vcs members (a branch, the git members a source keeps) among it, with the commit's revision. dirty is unknown after a commit and is left out, and so are the file hashes, which say what the tree held before it. With no env in force it holds cwd and a git vcs alone.

func SetExitCode

func SetExitCode(e agentsession.Entry, code int64)

SetExitCode sets ExitCodeMember on e.

func SetSource

func SetSource(h *agentsession.Header, s Source) error

SetSource records where a session came from in its header.

func ShellCommand

func ShellCommand(arguments string) string

ShellCommand reads the command a shell tool call ran from its JSON arguments: a "command" or "cmd" string, or a "command" argv, joined.

func Verify

func Verify(s *agentsession.Session) error

Verify is Finish for a caller that only needs the checks.

Types

type Builder

type Builder struct {
	S      *agentsession.Session
	Report *Report
	// NS is the source's namespace, the prefix of every member and
	// custom entry the converter writes: "claudecode", "pi", "codex".
	NS string
	// File is the source file findings name; empty for the main file.
	File  string
	Calls CallIDs

	// Derive asks DeriveAfter to write the entries the derivation rules
	// infer; ShellTools names the source's shell tools, whose calls the
	// rules read.
	Derive     bool
	ShellTools map[string]bool
	// contains filtered or unexported fields
}

Builder appends a native log's entries to a session. It holds the map from native IDs to entry IDs, hands out call IDs, and appends in whatever order the converter walks the native tree, which must put a parent before its children.

func NewBuilder

func NewBuilder(h agentsession.Header, ns string, r *Report) *Builder

NewBuilder starts a session with header h.

func (*Builder) Append

func (b *Builder) Append(parent string, e agentsession.Entry) (string, error)

Append adds e under parent, an entry ID this builder returned, or as a new root when parent is empty. A zero timestamp takes the last one appended, so a native record with no time of its own sorts where the file put it. An entry identical to one the session holds, which the format would fold into it, is moved a nanosecond later and the move reported.

func (*Builder) Bind

func (b *Builder) Bind(native, id string)

Bind records that native ID native became entry id.

func (*Builder) DeriveAfter

func (b *Builder) DeriveAfter(id string, e agentsession.Entry) (string, error)

DeriveAfter writes, after the entry id holding e, the entries the derivation rules infer when e is the output of one of the source's shell calls and the conversion asked for derivation, and returns the entry the session continues from: the last derived one, or id. The call is the one appended with e's call_id; the working directory the one the last env entry, or the header, names.

func (*Builder) EnvAt

func (b *Builder) EnvAt(id string) *agentsession.EnvEntry

EnvAt is the env entry in force at the entry id: the last on the path to it, or nil when none is.

func (*Builder) ID

func (b *Builder) ID(native string) (string, bool)

ID returns the entry a native ID became.

func (*Builder) Last

func (b *Builder) Last() string

Last returns the entry appended last, which is the file's last line.

func (*Builder) Leaf

func (b *Builder) Leaf(id string) error

Leaf makes id the leaf a reader resumes from. A reader with no leaf label takes the file's last line, so nothing is written when that line is id; a leaf label naming id is appended otherwise, so the reader resumes on id exactly, never on a later line of another branch. A converter calls it last, with the entry the native format names as current.

func (*Builder) Member

func (b *Builder) Member(e agentsession.Entry, name string, v any) error

Member sets a namespaced member, "<ns>:<name>", on e's body. A nil or empty value is not set.

func (*Builder) Resume

func (b *Builder) Resume() string

Resume returns the entry a reader of the session resumes from: the one Leaf named, or the last appended.

type CallIDs

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

CallIDs hands out call IDs unique across one session, as the format requires of every function call on every branch. A native ID is kept when it is free and well formed; otherwise the call gets the native ID with every character outside letters, digits, "_" and "-" made "_", cut so the whole is at most 64 characters, followed by "_" and a number ("call" when it has none), the scheme agentsession's export.ItemsFrom and agentturn use.

func (*CallIDs) Assign

func (c *CallIDs) Assign(native string) (id string, renamed bool)

Assign returns the call ID to record for a call whose native ID is native, and whether it differs from native. A converter that gets a renamed ID keeps the native one in a namespaced member of the item entry and maps the call's output by the same native ID, in the same order.

func (*CallIDs) Taken

func (c *CallIDs) Taken(id string) bool

Taken reports whether id has been handed out.

type Derivation

type Derivation struct {
	// Rule names the rule, the code its findings are reported under
	// without the agentimport/ prefix.
	Rule string `json:"rule"`
	// CallID is the call whose arguments and output the rule read.
	CallID string `json:"call_id,omitempty"`
}

Derivation is the value of DerivedMember.

type Derived

type Derived struct {
	Entry agentsession.Entry
	Code  string
}

Derived is one entry a rule derived, and the code it is reported under.

func DerivedEntries

func DerivedEntries(callID, command, output string, base *agentsession.EnvEntry, cwd string) ([]Derived, error)

DerivedEntries are the entries the derivation rules infer from a shell call's command and output, in the order they follow its output: an env entry carrying the revision a commit printed (RFC 0001: an env entry is a whole snapshot, so it repeats cwd; vcs.revision may be the abbreviation git printed), then the record of what the call published. Each carries agentimport:derived naming its rule and the call.

type Disposition

type Disposition string

Disposition is where one native line ended up. Every line read ends in exactly one, so a report's tally adds up to the lines read.

const (
	// LineMapped: the line became core entries.
	LineMapped Disposition = "mapped"
	// LineKept: the line became a namespaced extension, a custom entry or a
	// namespaced member, that other readers carry but do not interpret.
	LineKept Disposition = "kept"
	// LineDropped: the line is not in the output.
	LineDropped Disposition = "dropped"
	// LineMalformed: the line could not be read.
	LineMalformed Disposition = "malformed"
)

type Finding

type Finding struct {
	// Code is stable and namespaced by source, such as
	// "claudecode/thinking-signature". Each source documents its codes
	// in docs/formats/<source>.md.
	Code string `json:"code"`
	Kind Kind   `json:"kind"`
	// File is the source file, as the converter was given it; empty
	// for the main file.
	File string `json:"file,omitempty"`
	// Line is 1-based, or 0 when the finding is not tied to a line.
	Line   int    `json:"line,omitempty"`
	Detail string `json:"detail,omitempty"`
	// Path is, for an [IdentityCode] finding, the native member that
	// identifies a person, an account or organization, a machine or the
	// native session, as a dotted path: never its value.
	Path string `json:"path,omitempty"`
}

Finding is one place the output differs from the input.

type Group

type Group struct {
	Code  string `json:"code"`
	Kind  Kind   `json:"kind"`
	Count int    `json:"count"`
	// Example is the first finding's detail.
	Example string `json:"example,omitempty"`
	// At lists where the first few findings were, as file:line or line.
	At []string `json:"at,omitempty"`
	// Paths counts the findings of each native member path, for the
	// findings that name one ([IdentityCode]'s): every path, sorted.
	Paths []PathCount `json:"paths,omitempty"`
}

Group is the findings of one code, counted.

type Kind

type Kind string

Kind classifies a finding.

const (
	// Lossy: mapped, with a change of meaning or precision.
	Lossy Kind = "lossy"
	// Kept: carried as a namespaced extension, present but opaque
	// to other readers.
	Kept Kind = "kept"
	// Dropped: not in the output.
	Dropped Kind = "dropped"
	// Repaired: the source broke a rule of its own and the converter
	// fixed it or skipped it.
	Repaired Kind = "repaired"
	// Gap: the agentsession format has no place for this. The converter
	// falls back to keeping it aside or dropping it, and the code is
	// listed in docs/incompatibilities.md as a question for the RFC.
	Gap Kind = "gap"
)

type PathCount

type PathCount struct {
	Path  string `json:"path"`
	Count int    `json:"count"`
}

PathCount is how many findings named one native member path.

type PublishedRef

type PublishedRef struct {
	// Kind is branch, tag or pull_request.
	Kind string `json:"kind"`
	// Ref is the branch or tag pushed, as the remote names it.
	Ref string `json:"ref,omitempty"`
	// Remote is where git said it pushed ("To <remote>").
	Remote string `json:"remote,omitempty"`
	// URL is the pull request's URL.
	URL string `json:"url,omitempty"`
}

PublishedRef is one ref a command published, as its output says.

func PublishedRefs

func PublishedRefs(command, output string) []PublishedRef

PublishedRefs reads what a shell command published from its output: the refs a git push reports it updated, and the URL gh pr create prints. A command that is not one of those, a dry run, or output that does not say, yields nothing.

type Report

type Report struct {
	// Source names the native format, such as "claudecode".
	Source string `json:"source"`
	// Unit names what the tally counts, "lines" when empty. A source
	// whose native files are not line-oriented counts other units: ATIF,
	// one JSON document per file, counts each document's root and each
	// of its steps.
	Unit string `json:"unit,omitempty"`
	// Tally counts native lines, or units, by where they ended up.
	Tally    map[Disposition]int `json:"tally"`
	Findings []Finding           `json:"findings,omitempty"`
}

Report is what one conversion did to its input.

func NewReport

func NewReport(source string) *Report

NewReport starts a report for a source.

func (*Report) Add

func (r *Report) Add(f Finding)

Add records a finding.

func (*Report) Addf

func (r *Report) Addf(kind Kind, code, file string, line int, format string, args ...any)

Addf records a finding with a formatted detail.

func (*Report) Codes

func (r *Report) Codes() []string

Codes lists the distinct codes the report holds, sorted.

func (*Report) Groups

func (r *Report) Groups() []Group

Groups gathers the findings by code, ordered by kind as Kinds lists them and then by code.

func (*Report) Has

func (r *Report) Has(kinds ...Kind) bool

Has reports whether any finding is of one of the kinds.

func (*Report) HeaderIdentity

func (r *Report) HeaderIdentity(file string, h agentsession.Header, idPath, cwdPath string)

HeaderIdentity reports the identity members a converter carried into a session's header: the native session's ID, from idPath, and its working directory, from cwdPath, when the header has one.

func (*Report) Identity

func (r *Report) Identity(file string, line int, path, lands string)

Identity records that the native member at path, read at file and line, was carried into the session where lands says. The value is not recorded.

func (*Report) Line

func (r *Report) Line(d Disposition)

Line records where one native line ended up.

func (*Report) Lines

func (r *Report) Lines() int

Lines is the number of native lines the report accounts for.

func (*Report) MarshalJSON

func (r *Report) MarshalJSON() ([]byte, error)

MarshalJSON writes the tally, the groups and every finding.

func (*Report) Merge

func (r *Report) Merge(o *Report)

Merge adds another report's tally and findings to r, and its unit when r has none.

func (*Report) WriteText

func (r *Report) WriteText(w io.Writer) error

WriteText prints the tally and the grouped findings.

type Result

type Result struct {
	// Sessions holds the main session first, then its subsessions, each
	// after the session that spawned it.
	Sessions []*agentsession.Session
	Report   *Report
}

Result is one conversion: the sessions it made and what it did to the input.

func (*Result) ScrubIdentity

func (res *Result) ScrubIdentity()

ScrubIdentity takes out of the result's report every ID of a session the conversion made, and every native ID and parent session its headers name, from each finding's file and detail, naming each session by its place among the result's (session #1 for the first) and a parent the result does not hold as "the parent session". A report counts identity members by path and never holds their values (RFC 0001, Conformance): a native session ID reaches a finding through a file named for it, or a detail naming a child or a parent.

type SkillRead

type SkillRead struct {
	Name     string `json:"name"`
	Location string `json:"location,omitempty"`
	Path     string `json:"path,omitempty"`
	Bytes    *int   `json:"bytes,omitempty"`
	SHA256   string `json:"sha256,omitempty"`
}

SkillRead is the record's data, in the shape agentskill's Read writes: the skill's name, and when the log says it, the SKILL.md behind the name, the file inside the skill that was served ("" for the instructions), and the size and hex SHA-256 digest of the bytes served. A member the log does not say is left out.

func (SkillRead) Entry

func (r SkillRead) Entry(callID string) (*agentsession.CustomEntry, error)

Entry is the record as a custom entry, naming the call that served the skill when one did.

func (*SkillRead) Served

func (r *SkillRead) Served(text string)

Served sets the size and digest of the text served.

type Source

type Source struct {
	// Format names the native format, such as "claudecode".
	Format string `json:"format"`
	// NativeID is the session's ID in the native format, when it had
	// one and the session's own ID is not it.
	NativeID string `json:"native_id,omitempty"`
	// Converter is this module and its version.
	Converter string `json:"converter"`
	// Derived names the derivation rules the conversion ran, when it
	// ran any: entries after a derived one have other ids than a
	// conversion without derivation gives them.
	Derived []string `json:"derived,omitempty"`
}

Source is the value of SourceMember.

Directories

Path Synopsis
Package atif reads ATIF, the Agent Trajectory Interchange Format that Harbor (github.com/laude-institute/harbor) defines in its RFC 0001 and its Pydantic models: one JSON document per trajectory, holding the agent, its steps, and optionally embedded sub-agent trajectories.
Package atif reads ATIF, the Agent Trajectory Interchange Format that Harbor (github.com/laude-institute/harbor) defines in its RFC 0001 and its Pydantic models: one JSON document per trajectory, holding the agent, its steps, and optionally embedded sub-agent trajectories.
convert
Package convert converts ATIF trajectories into the Agent Session Format.
Package convert converts ATIF trajectories into the Agent Session Format.
Package claudecode reads Claude Code session transcripts: the JSONL files under ~/.claude/projects, one per session and one per sub-agent.
Package claudecode reads Claude Code session transcripts: the JSONL files under ~/.claude/projects, one per session and one per sub-agent.
convert
Package convert converts Claude Code sessions into the Agent Session Format.
Package convert converts Claude Code sessions into the Agent Session Format.
Package cline reads the task directories of classic Cline (the VS Code extension before 4.0, and the standalone hosts that kept its layout) and of Roo Code, which forked from it: one directory per task under <storage>/tasks/<id>, holding the model's context as a JSON array of Anthropic messages (api_conversation_history.json), the chat view's messages (ui_messages.json), and, per variant, the task's metadata, classic's context-window edits (context_history.json) and Roo's index entry (history_item.json).
Package cline reads the task directories of classic Cline (the VS Code extension before 4.0, and the standalone hosts that kept its layout) and of Roo Code, which forked from it: one directory per task under <storage>/tasks/<id>, holding the model's context as a JSON array of Anthropic messages (api_conversation_history.json), the chat view's messages (ui_messages.json), and, per variant, the task's metadata, classic's context-window edits (context_history.json) and Roo's index entry (history_item.json).
convert
Package convert converts classic Cline and Roo Code task directories into the Agent Session Format.
Package convert converts classic Cline and Roo Code task directories into the Agent Session Format.
Package clinesdk reads the sessions of the Cline SDK (@cline/core), which Cline's CLI, its JetBrains and SDK hosts, and the VS Code extension from 4.0 write under ~/.cline/data/sessions: one directory per session, holding its manifest (<id>.json), its canonical history (<id>.messages.json, a versioned JSON document), the compacted context of its latest compaction (<id>.compaction.json), and the histories of the sub-agents and team tasks it ran (<agentId>.messages.json, <agentId>__<teamTaskId>.messages.json).
Package clinesdk reads the sessions of the Cline SDK (@cline/core), which Cline's CLI, its JetBrains and SDK hosts, and the VS Code extension from 4.0 write under ~/.cline/data/sessions: one directory per session, holding its manifest (<id>.json), its canonical history (<id>.messages.json, a versioned JSON document), the compacted context of its latest compaction (<id>.compaction.json), and the histories of the sub-agents and team tasks it ran (<agentId>.messages.json, <agentId>__<teamTaskId>.messages.json).
convert
Package convert converts the Cline SDK's session directories into the Agent Session Format: a session's history, rebuilt as each request sent it, and the histories of the sub-agents and team tasks it ran, linked to the calls that ran them.
Package convert converts the Cline SDK's session directories into the Agent Session Format: a session's history, rebuilt as each request sent it, and the histories of the sub-agents and team tasks it ran, linked to the calls that ran them.
sqlite
Package sqlite reads Cline's session index, sessions.db: its sessions table, which alone records which agent spawned a sub-agent, yielding its rows as the clinesdk package's.
Package sqlite reads Cline's session index, sessions.db: its sessions table, which alone records which agent spawned a sub-agent, yielding its rows as the clinesdk package's.
cmd
agentimport command
Command agentimport converts other coding agents' session logs into the Agent Session Format, and reports what each conversion changed.
Command agentimport converts other coding agents' session logs into the Agent Session Format, and reports what each conversion changed.
Package codex reads the Codex CLI's rollout files: the JSONL files under ~/.codex/sessions/YYYY/MM/DD, one per thread.
Package codex reads the Codex CLI's rollout files: the JSONL files under ~/.codex/sessions/YYYY/MM/DD, one per thread.
convert
Package convert converts Codex CLI rollouts into the Agent Session Format.
Package convert converts Codex CLI rollouts into the Agent Session Format.
Package hermes reads the sessions of Hermes Agent (NousResearch/hermes-agent), the Python agent behind the hermes CLI, its TUI and its messaging gateway.
Package hermes reads the sessions of Hermes Agent (NousResearch/hermes-agent), the Python agent behind the hermes CLI, its TUI and its messaging gateway.
convert
Package convert converts Hermes Agent's sessions into the Agent Session Format: every session of a state.db, each with the continuations its compressions started and the sub-agents it ran.
Package convert converts Hermes Agent's sessions into the Agent Session Format: every session of a state.db, each with the continuations its compressions started and the sub-agents it ran.
sqlite
Package sqlite opens Hermes Agent's database, state.db, and reads its rows as the hermes package's types: sessions, messages, system_prompts, session_model_usage and async_delegations.
Package sqlite opens Hermes Agent's database, state.db, and reads its rows as the hermes package's types: sessions, messages, system_prompts, session_model_usage and async_delegations.
internal
doccheck
Package doccheck holds the converters to their documents: every finding code a conversion reports must be listed in the source's docs/formats document, every gap code in docs/incompatibilities.md as well, and every identity member a conversion reports in its document's Identity section.
Package doccheck holds the converters to their documents: every finding code a conversion reports must be listed in the source's docs/formats document, every gap code in docs/incompatibilities.md as well, and every identity member a conversion reports in its document's Identity section.
jsjson
Package jsjson holds a JSON value as JavaScript holds what JSON.parse returns, and writes it as JSON.stringify does, for a reader that must reproduce a JavaScript program's own bytes: a hash over its serialisation, or the text it sends.
Package jsjson holds a JSON value as JavaScript holds what JSON.parse returns, and writes it as JSON.stringify does, for a reader that must reproduce a JavaScript program's own bytes: a hash over its serialisation, or the text it sends.
jsonline
Package jsonline decodes and encodes the JSON objects of a native session log so that an object read and written again is the same JSON value: members the Go type does not declare are kept, and a declared member that was absent stays absent, a null stays null.
Package jsonline decodes and encodes the JSON objects of a native session log so that an object read and written again is the same JSON value: members the Go type does not declare are kept, and a declared member that was absent stays absent, a null stays null.
sqlite
Package sqlite reads another program's SQLite database without touching it: Open copies the database and its write-ahead log into a private temporary directory and opens the copy, which SQLite recovers as a crashed writer's, so every frame the log holds up to its last commit is read, checkpointed or not.
Package sqlite reads another program's SQLite database without touching it: Open copies the database and its write-ahead log into a private temporary directory and opens the copy, which SQLite recovers as a crashed writer's, so every frame the log holds up to its last commit is read, checkpointed or not.
testfix
Package testfix copies a fixture to a temporary directory with some of its text replaced, for tests that need a variant of a fixture without a second copy in testdata, whose IDs would collide.
Package testfix copies a fixture to a temporary directory with some of its text replaced, for tests that need a variant of a fixture without a second copy in testdata, whose IDs would collide.
usagecheck
Package usagecheck reads back what the converters write of a response's usage, for their tests.
Package usagecheck reads back what the converters write of a response's usage, for their tests.
Package opencode reads the sessions of OpenCode, the TypeScript coding agent (anomalyco/opencode, formerly sst/opencode), in each of the three ways it has stored them under its data directory, ~/.local/share/opencode:
Package opencode reads the sessions of OpenCode, the TypeScript coding agent (anomalyco/opencode, formerly sst/opencode), in each of the three ways it has stored them under its data directory, ~/.local/share/opencode:
convert
Package convert converts OpenCode's sessions into the Agent Session Format: a data directory's storage files, its database's V1 tables and its V2 tables, each session converted once, from the copy that holds the most of what its model saw.
Package convert converts OpenCode's sessions into the Agent Session Format: a data directory's storage files, its database's V1 tables and its V2 tables, each session converted once, from the copy that holds the most of what its model saw.
sqlite
Package sqlite opens OpenCode's database, opencode.db, and reads its rows as the opencode package's types: the V1 tables session, message and part, and the V2 tables session_v2, session_message, session_pending and session_inbox.
Package sqlite opens OpenCode's database, opencode.db, and reads its rows as the opencode package's types: the V1 tables session, message and part, and the V2 tables session_v2, session_message, session_pending and session_inbox.
Package openhands reads the conversation directories of the OpenHands software agent SDK (OpenHands/software-agent-sdk, 1.0.0 to 1.55), the format the OpenHands CLI, the agent server and Agent Canvas write: one directory per conversation holding base_state.json, the conversation's state, and events/event-<index>-<event id>.json, one event per file.
Package openhands reads the conversation directories of the OpenHands software agent SDK (OpenHands/software-agent-sdk, 1.0.0 to 1.55), the format the OpenHands CLI, the agent server and Agent Canvas write: one directory per conversation holding base_state.json, the conversation's state, and events/event-<index>-<event id>.json, one event per file.
convert
Package convert converts OpenHands SDK conversation directories into the Agent Session Format.
Package convert converts OpenHands SDK conversation directories into the Agent Session Format.
pi
Package pi reads pi's session files: the JSONL files under ~/.pi/agent/sessions, one per session.
Package pi reads pi's session files: the JSONL files under ~/.pi/agent/sessions, one per session.
convert
Package convert converts pi sessions into the Agent Session Format.
Package convert converts pi sessions into the Agent Session Format.

Jump to

Keyboard shortcuts

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