Documentation
¶
Overview ¶
Package root implements the ctx agent command.
It prints a concise, AI-ready context packet assembled from .context/ files within a configurable token budget.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Cmd ¶
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
func Run ¶
func Run( cmd *cobra.Command, budget int, format string, cooldown time.Duration, session string, ) error
Run executes the agent command logic.
When a session and cooldown are provided, it checks a tombstone file to suppress repeated output within the cooldown window. On the first invocation (or after cooldown expires), it loads context from .context/ and outputs a context packet in the specified format.
Parameters:
- cmd: Cobra command for output stream
- budget: Token budget to include in the output
- format: Output format, "json" for JSON, or any other value for Markdown
- cooldown: duration to suppress repeated output (0 to disable)
- session: session identifier for tombstone isolation (empty to disable cooldown)
Returns:
- error: Non-nil if context loading fails or .context/ is not found
Types ¶
This section is empty.