## Summary
Agent decisions (rebalance, scan, alert) are persisted to `agent_logs`, but the current implementation attaches actions to an arbitrary user. This makes analytics, support, and auditing unreliable.
## Problem
In `src/agent/router.ts`:
```ts
// Log to all users for now - in production, could be per-user
const users = await db.user.findMany({
select: { id: true },
take: 1, // For now, just log to first user
});
const userId = users[0].id;
await db.agentLog.create({ data: { userId, action, status, ... } });
## Acceptance criteria
No agent log row is written against a random/first user
Rebalance logs include correct userId and affected positionId(s)
System-level scans are distinguishable from user-level actions
Unit tests for logAgentAction with multiple users
Integration test: rebalance job creates logs for each impacted user
Update AgentLog indexes if querying by userId + createdAt becomes hot path
Labels:
priority/high,area/agent,feature,bugBody: