mirror of
https://github.com/docker/docker-agent.git
synced 2026-11-04 10:02:15 +00:00
Adds a new add_context builtin hook that renders Go text/template arguments against hook input and joins non-blank results as additional_context. No external dependencies (no jq, no shell) are required. - Renders each arg as an independent text/template against the hook input - Joins non-blank results with newlines as additional_context - Strict: template parse and execution errors propagate and follow on_error - Plain-text output only; no re-evaluation or command execution - Registered alongside existing builtins in pkg/hooks/builtins Updates schema descriptions, types.go comments, hooks reference docs, tips guide (updates session ID tip from jq command to add_context builtin), canonical examples/hooks.yaml, and adds standalone examples/context_hooks.yaml. Unit and runtime test coverage included.
14 lines
408 B
YAML
14 lines
408 B
YAML
agents:
|
|
root:
|
|
model: anthropic/claude-sonnet-4-5
|
|
description: Assistant with dependency-free session context.
|
|
instruction: You are a helpful assistant.
|
|
hooks:
|
|
session_start:
|
|
- type: builtin
|
|
command: add_context
|
|
args:
|
|
- "Current session ID: {{ .SessionID }}"
|
|
- "Agent: {{ .AgentName }}"
|
|
- "Working directory: {{ .Cwd }}"
|