Help us shape the future of Go! Take the 2026 Go Developer Survey

contextpack

package
v2.4.6 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Render

func Render(pack *Pack, format string) (string, error)

Render formats the pack according to the requested format ("markdown", "xml", "json", "compact").

func RenderCompact added in v2.3.10

func RenderCompact(pack *Pack, maxTokens int) string

RenderCompact formats the pack into an ultra-dense, token-budgeted representation. It prioritizes critical directives/rules, gotchas/bugfixes, architectural decisions, and core God Nodes, truncating gracefully when the estimated token budget is reached. If maxTokens <= 0, a default budget of 1500 tokens is used.

func RenderJSON

func RenderJSON(pack *Pack) (string, error)

RenderJSON serializes the Pack into indented JSON.

func RenderMarkdown

func RenderMarkdown(pack *Pack) string

RenderMarkdown produces human-and-agent readable Markdown.

func RenderXML

func RenderXML(pack *Pack) string

RenderXML produces compact XML suitable for system prompt injections.

Types

type Options

type Options struct {
	Project        string
	Format         string // "markdown", "xml", "json", "compact" (default "markdown")
	MaxDecisions   int    // default 5
	MaxBugfixes    int    // default 5
	MaxGodNodes    int    // default 5
	IncludeRules   bool   // default true
	IncludeRepoMap bool   // default false
	RepoMapBudget  int    // default 1024
	MaxTokens      int    // token budget for compact rendering (default 1500)
}

Options specifies criteria for building an agent context pack.

type Pack

type Pack struct {
	Project   string                `json:"project"`
	Rules     []*domain.Observation `json:"rules,omitempty"`
	Decisions []*domain.Observation `json:"decisions,omitempty"`
	Bugfixes  []*domain.Observation `json:"bugfixes,omitempty"`
	GodNodes  []code.GodNode        `json:"god_nodes,omitempty"`
	RepoMap   string                `json:"repo_map,omitempty"`
}

Pack represents the assembled intelligence packet for an AI agent.

func BuildPack

func BuildPack(
	project string,
	allObs []*domain.Observation,
	codeGraph *code.CodeGraph,
	opts Options,
) *Pack

BuildPack filters and extracts context items into a unified Pack.

Jump to

Keyboard shortcuts

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