ctxbundle

package
v2.10.2 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2026 License: MIT Imports: 5 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 ctxbundle stages the files a dispatched agent should read before it starts.

A dispatched agent opens a FRESH session: no conversation history, and on an ssh/pct/sandbox target none of the control plane user's Claude config either. The same task therefore runs with far less knowledge remotely than it does locally, and nothing in the timeline says so — the output is just quietly worse.

Context paths close that gap. The control plane reads the listed files off its OWN filesystem (one place to curate) and stages them into the worktree at .lectern/context/ through the Executor, so every target kind gets byte-identical context.

Caps are deliberate and LOUD: an oversized or missing file is reported in the staged index and in the prompt, never dropped silently.

Index

Constants

View Source
const IndexName = "INDEX.md"

IndexName is the manifest written alongside the staged files.

View Source
const Subdir = "context"

Subdir is where staged files land inside the runtime dir.

Variables

View Source
var (
	MaxFileBytes  = 256 * 1024
	MaxTotalBytes = 1024 * 1024
)

Caps on a single file and on the whole bundle.

Functions

func IndexMarkdown

func IndexMarkdown(files []File, notes []string) string

IndexMarkdown is the manifest staged next to the files, so an agent can see where each one came from and what could not be staged.

func PromptPrefix

func PromptPrefix(files []File, notes []string) string

PromptPrefix is the header prepended to the task prompt so the agent cannot miss the bundle — or the fact that part of it is absent.

func Resolve

func Resolve(patterns []string) ([]string, []string)

Resolve expands glob patterns to existing files, reporting what missed.

Types

type File

type File struct {
	Name   string // flat, collision-free name inside the staging dir
	Source string // where it came from on the control plane
	Data   []byte
}

File is one staged context file.

func Collect

func Collect(patterns []string) ([]File, []string)

Collect reads the configured paths into staged files plus notes about everything that was truncated, unreadable or capped out.

Jump to

Keyboard shortcuts

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