agent

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package agent implements the "ctx agent" command for generating AI-ready context packets.

The agent command reads context files from .context/ and produces a concise, token-budgeted output optimized for AI consumption. Output can be in Markdown (default) or JSON format.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Cmd

func Cmd() *cobra.Command

Cmd returns the "ctx agent" command for generating AI-ready context packets.

The command reads context files from .context/ and outputs a concise packet optimized for AI consumption, including constitution rules, active tasks, conventions, and recent decisions.

Flags:

  • --budget: Token budget for the context packet (default 8000)
  • --format: Output format, "md" for Markdown or "json" (default "md")
  • --cooldown: Suppress repeated output within this duration (default 10m)
  • --session: Session identifier for cooldown tombstone isolation

Returns:

  • *cobra.Command: Configured agent command with flags registered

Types

type Packet

type Packet struct {
	Generated    string   `json:"generated"`
	Budget       int      `json:"budget"`
	TokensUsed   int      `json:"tokens_used"`
	ReadOrder    []string `json:"read_order"`
	Constitution []string `json:"constitution"`
	Tasks        []string `json:"tasks"`
	Conventions  []string `json:"conventions"`
	Decisions    []string `json:"decisions"`
	Instruction  string   `json:"instruction"`
}

Packet represents the JSON output format for the agent command.

This struct is serialized when using --format json and contains all extracted context information for AI consumption.

Fields:

  • Generated: RFC3339 timestamp of when the packet was created
  • Budget: Token budget specified by the user
  • TokensUsed: Actual token count of loaded context files
  • ReadOrder: File paths in recommended reading order
  • Constitution: Rules from CONSTITUTION.md
  • Tasks: Active (unchecked) tasks from TASKS.md
  • Conventions: Key conventions from CONVENTIONS.md
  • Decisions: Recent decision titles from DECISIONS.md
  • Instruction: Behavioral instruction for the agent

Jump to

Keyboard shortcuts

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