Skip to main content

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

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
FieldRole
profileNamed preset (below) or JSON object string
rulesMap overrides (booleans / thresholds)
customLegacy custom rule maps
rule_definitionsDeclarative {id, trigger, when, action, condition, message}
state_trackingSets / counters / flags
classify_turnsEnable semantic classifier
classifierClassifier knobs (frequency, timeouts, vocab, ...)
brainOptional dedicated classifier brain
use_agent_brainPrefer agent brain when set

Actions on rules: block, warn, remind (post-tool reminder).

Built-in profiles (profiles.go)

ProfileHighlights
devStrictest coding discipline; injects DEV_PROMPT_SECTION; max_blind_reads: 2, changes_before_test_reminder: 2, autonomy medium, web_search_when_unknown: true
codingLike dev with web_search_when_unknown: false, max_blind_reads: 3, autonomy high
researchLooser edit/test/lint gates; web search on; max_blind_reads: 10, autonomy high
dataStrict reads/tests/lint; web search on; autonomy medium
creativeLow autonomy, detailed verbosity; weak test/verify gates
assistantLight 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.