Documentation
¶
Overview ¶
Package builtins contains the stock in-process hook implementations shipped with docker-agent.
Available builtins:
- add_date (turn_start) — today's date
- add_environment_info (session_start) — cwd, git, OS, arch
- add_prompt_files (turn_start) — contents of prompt files
- add_git_status (turn_start) — `git status --short --branch`
- add_git_diff (turn_start) — `git diff --stat` (or full)
- add_directory_listing (session_start) — top-level entries of cwd
- add_user_info (session_start) — current OS user and host
- add_recent_commits (session_start) — `git log --oneline -n N`
- max_iterations (before_llm_call) — hard stop after N model calls
Reference any of them from a hook YAML entry as `{type: builtin, command: "<name>"}`. The runtime additionally auto-injects add_date / add_environment_info / add_prompt_files from the matching agent flags.
turn_start builtins recompute every turn (date, git state). session_start builtins run once per session for context that's stable for its duration. max_iterations is stateful: its per-session counter lives on the State returned by Register; the runtime clears it via State.ClearSession from session_end.
LLM-as-a-judge hooks are NOT shipped here: write `type: model` with `schema: pre_tool_use_decision` instead — see pkg/hooks/shape_pre_tool_use_decision.go and examples/llm_judge.yaml.
Index ¶
Constants ¶
const AddDate = "add_date"
AddDate is the registered name of the add_date builtin.
const AddDirectoryListing = "add_directory_listing"
AddDirectoryListing is the registered name of the add_directory_listing builtin.
const AddEnvironmentInfo = "add_environment_info"
AddEnvironmentInfo is the registered name of the add_environment_info builtin.
const AddGitDiff = "add_git_diff"
AddGitDiff is the registered name of the add_git_diff builtin.
const AddGitStatus = "add_git_status"
AddGitStatus is the registered name of the add_git_status builtin.
const AddPromptFiles = "add_prompt_files"
AddPromptFiles is the registered name of the add_prompt_files builtin.
const AddRecentCommits = "add_recent_commits"
AddRecentCommits is the registered name of the add_recent_commits builtin.
const AddUserInfo = "add_user_info"
AddUserInfo is the registered name of the add_user_info builtin.
const MaxIterations = "max_iterations"
MaxIterations is the registered name of the max_iterations builtin.
Variables ¶
This section is empty.
Functions ¶
func ApplyAgentDefaults ¶
func ApplyAgentDefaults(cfg *hooks.Config, d AgentDefaults) *hooks.Config
ApplyAgentDefaults appends the stock builtin hook entries implied by d to cfg. A nil cfg is treated as empty. Returns nil iff no hook (user-configured or auto-injected) is present.
Types ¶
type AgentDefaults ¶
AgentDefaults captures the agent-level flags that map onto stock builtin hook entries. Pass each AgentConfig.AddXxx flag as-is.
type State ¶
type State struct {
// contains filtered or unexported fields
}
State holds the per-runtime state of the stateful builtins. It is returned by Register so callers can clear per-session entries on session_end. Stateless builtins don't appear here.
func Register ¶
Register installs the stock builtin hooks on r and returns a State handle the caller must use to clear per-session state on session_end.
func (*State) ClearSession ¶
ClearSession drops per-session state from every stateful builtin. A nil receiver is a no-op.