Skip to main content

Module protocol

Module protocol 

Source

Structs§

InstructionTemplate
A terse instruction code and its human-readable expansion.

Functions§

compress_output
Compresses tool output text based on density level.
detect_project_root
Finds the outermost project root by walking up from file_path. For monorepos with nested .git dirs (e.g. mono/backend/.git + mono/frontend/.git), returns the outermost ancestor containing .git, a workspace marker, or a known monorepo config file — so the whole monorepo is treated as one project.
detect_project_root_or_cwd
Returns the project root for file_path, falling back to cwd if none found.
encode_instructions
Encode an instruction suffix using short codes with budget hints. Response budget is dynamic based on task complexity to shape LLM output length.
encode_instructions_with_snr
Encode instructions with SNR metric for context quality awareness.
format_savings
Formats a token savings summary like [42 tok saved (30%)].
instruction_decoder_block
Generates the INSTRUCTION CODES block for agent system prompts.
shorten_path
Returns the file name component of a path for compact display.