convert

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2026 License: Apache-2.0 Imports: 7 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 convert renders a conversation read from one agent for another agent's writer: what the receiving agent should see (its own words and the user's as messages, the other agent's tool activity as clearly labelled text), within a budget, with a report of everything left out and a briefing at the end. It never calls a model.

Index

Constants

View Source
const BudgetShare = 0.30

BudgetShare is the share of the target's context the converted history may use.

Variables

This section is empty.

Functions

This section is empty.

Types

type Briefing

type Briefing struct {
	FromVersion string
	SourceID    string
	SourceLoc   string
	TargetLoc   string
	When        time.Time
	Branch      string
	Head        string // the commit at transfer time
	Dirty       int
	Plan        []ir.PlanEntry
	Missing     []string // differences in instructions, skills, MCP servers
	ToolNames   string   // the target's own tool names, to use instead of the history's
	Note        string   // a handoff note the source agent wrote, if any
	Rules       []Rules  // the user's instructions for every project, carried when asked
}

Briefing is what the receiving agent is told at the end of the history.

type Fidelity

type Fidelity string

Fidelity is how much of the source the target gets.

const (
	// History: the whole conversation, tool activity as text (oldest steps summarised
	// when over budget).
	History Fidelity = "history"
	// Note: only the briefing, in a new session.
	Note Fidelity = "note"
)

type Report

type Report struct {
	Fidelity    Fidelity `json:"fidelity"`
	Budget      int      `json:"budgetTokens"`
	Used        int      `json:"usedTokens"`
	Messages    int      `json:"messages"`
	ToolCalls   int      `json:"toolCalls"`
	NativeCalls int      `json:"nativeCalls,omitempty"`
	Reasoning   int      `json:"reasoningDropped"`
	Attachments int      `json:"attachmentsAsPlaceholders,omitempty"`
	Truncated   int      `json:"outputsShortened"`
	Summarised  int      `json:"stepsSummarised"`
	Redactions  int      `json:"redactions,omitempty"`
	PathsMapped int      `json:"pathsMapped"`
	Summary     string   `json:"summary"`
}

Report is what a conversion keeps and leaves out.

type Request

type Request struct {
	Nodes      []ir.Node
	From       string // the source agent's name ("Claude Code")
	To         string // the target agent's name ("Codex")
	Fidelity   Fidelity
	Native     bool            // render exact tool calls natively (the target writer supports it)
	Window     int             // the target's context, in tokens
	Mappings   []agent.Mapping // source paths → target paths
	Briefing   Briefing
	Redact     func([]byte) ([]byte, int)
	SkipBefore int // render only nodes from this index (round-trip deltas); earlier ones are context
}

Request is one rendering.

type Result

type Result struct {
	Items  []ir.Item `json:"-"`
	Report Report    `json:"report"`
}

Result is a rendering.

func Render

func Render(r Request) Result

Render turns nodes into items for the target writer.

type Rules

type Rules struct {
	File string
	Text string
}

Rules are the text of one global instruction file.

Jump to

Keyboard shortcuts

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