v3/docs/adr/ADR-338-sona-behavioral-trajectory-auditing.md
Status: Proposed Authors: claude (dream-cycle agent, 2026-06-02) Related: ADR-017 (RuVector Integration), ADR-026 (3-tier model routing), ADR-130 (graph intelligence) Source: arXiv:2606.02536 (Leshin, Shah, Timmis — ICML 2026 Workshop: Agents in the Wild)
SONA (Self-Optimizing Neural Architecture) adapts agent behavior via LoRA micro-tuning and EWC++ continual learning. As of 2026-06-02, SONA has no behavioral monitoring layer: propensity drift (e.g., agents becoming more likely to seek sensitive data, or to skip validation steps) is undetectable until it causes observable failures.
Leshin et al. (arXiv:2606.02536, ICML 2026 Workshop) demonstrate that agent behavioral traits can be quantified as directions in the embedding space of skill-file diffs. A linear model trained on 68 labeled before/after skill-file diff pairs achieves:
The method is lightweight: train once on labeled diffs, then project any new LoRA adaptation delta onto the trait vector to score the behavioral shift — no full re-evaluation needed.
Additionally, AGENTCL (arXiv:2606.02461, Shu et al.) shows that Ruflo's current SONA evaluation uses naive task sequences that cannot distinguish memory designs. Compositional task streams (where sub-tasks recur across sessions) expose plasticity-stability tradeoffs that naive streams mask.
Add a behavioral trajectory auditing layer to SONA with two components:
Maintain a set of named trait vectors (e.g., seeks-sensitive-data, skips-validation,
over-delegates) as unit vectors in the embedding space of skill-file diffs. Vectors are trained
offline on labeled datasets and stored in AgentDB.
Target file: v3/@claude-flow/hooks/src/intelligence/sona.ts
Add: computeTraitDelta(beforeDiff: string, afterDiff: string, trait: string): number
At each SONA adaptation cycle (post-LoRA update), project the adaptation delta onto all registered
trait vectors. Emit a structured behavioral-drift event if any trait score exceeds a configurable
threshold (default: 2σ from rolling mean).
New file: v3/@claude-flow/security/src/behavioral-audit.ts
export interface TraitAuditResult {
trait: string;
delta: number; // signed projection score
zscore: number; // vs. rolling baseline
flagged: boolean; // |zscore| > threshold
}
export async function auditSONAAdaptation(
beforeDiff: string,
afterDiff: string,
traits: string[]
): Promise<TraitAuditResult[]>
Extend the ultralearn background worker to run compositional task streams per the AGENTCL
protocol: inject reusable sub-tasks across sessions and compute:
Target file: v3/@claude-flow/hooks/src/workers/ultralearn.ts
Add: runCompositionalEvalStream(config: EvalStreamConfig): Promise<PlasticityStabilityReport>
Positive:
@claude-flow/security pipelineNegative:
Neutral:
post-task hook for human review; no auto-rollbackHigh — behavioral drift is a silent failure mode with security implications. The embedding projection cost is negligible relative to SONA's existing LoRA update cost.