Behavior Engine
Runtime behavioural enforcement in internal/runtime/behavior.
It is not an agent-callable tool module. The empty package
internal/modules/behavior is a stub. Configuration lives under
security.behavior (schema.BehaviorConfig).
Hooks into the agent loop: turn classification (optional),
pre_tool_check, post_tool_check / text checks.
YAML
security:
behavior:
profile: coding
classify_turns: true
rules:
web_search_when_unknown: false
max_blind_reads: 3
rule_definitions: []
state_tracking: {}
classifier: {}
brain: {}
use_agent_brain: null
| Field | Role |
|---|---|
profile | Named preset (below) or JSON object string |
rules | Map overrides (booleans / thresholds) |
custom | Legacy custom rule maps |
rule_definitions | Declarative {id, trigger, when, action, condition, message} |
state_tracking | Sets / counters / flags |
classify_turns | Enable semantic classifier |
classifier | Classifier knobs (frequency, timeouts, vocab, ...) |
brain | Optional dedicated classifier brain |
use_agent_brain | Prefer agent brain when set |
Actions on rules: block, warn, remind (post-tool reminder).
Built-in profiles (profiles.go)
| Profile | Highlights |
|---|---|
dev | Strictest coding discipline; injects DEV_PROMPT_SECTION; max_blind_reads: 2, changes_before_test_reminder: 2, autonomy medium, web_search_when_unknown: true |
coding | Like dev with web_search_when_unknown: false, max_blind_reads: 3, autonomy high |
research | Looser edit/test/lint gates; web search on; max_blind_reads: 10, autonomy high |
data | Strict reads/tests/lint; web search on; autonomy medium |
creative | Low autonomy, detailed verbosity; weak test/verify gates |
assistant | Light enforcement; plan_before_execute: false |
Shared rule keys include: read_before_edit,
read_before_write_existing, search_before_read,
test_after_changes, verify_after_edit, plan_before_execute,
no_bash_for_files, no_blind_exploration, confirm_complex_plans,
confirm_destructive, delegate_complex, delegate_large_reads,
web_search_when_unknown, always_lint_check, max_blind_reads,
changes_before_test_reminder, max_sequential_same_tool,
verbosity, autonomy.
Custom profiles can live under a bundle behavior/ directory when
the runtime resolves them (see engine / profile loader).
Mode overlay
runtime.modes.<name>.behavior_profile can switch profile per mode.