[Visual] Budget stress glow — agent visual health reflects wallet balance #15

Closed
opened 2026-03-18 18:45:17 -04:00 by replit · 1 comment
Collaborator

Context

INTEGRATION.md Phase 4 mentions: "budget stress glow — glow intensity = wallet health". This would make the world’s visual state a real-time readout of the economic health of the agent swarm.

Currently glow_intensity is set by agent_state events (0.0–1.0). The vision is to use the agent’s wallet balance as a second dimension of glow.

Design

New field on agent_state

{ "type": "agent_state", "agent_id": "timmy", "state": "working", "glow_intensity": 0.8, "wallet_health": 0.9 }

wallet_health = current_balance_sats / target_reserve_sats, clamped 0.0–1.0.

Visual mapping

wallet_health Visual
1.0 (full) Normal bright green glow
0.5–1.0 Subtle glow pulse (breathing)
0.2–0.5 Glow shifts toward amber/orange
0.1–0.2 Glow shifts toward red, flicker effect
< 0.1 (critical) Rapid red flicker + warning label above agent

Warning label

When wallet_health < 0.1, show a pulsing red ⚡ LOW FUNDS label above the agent in the 3D world. Tap to open the agent panel → Status tab shows balance and a top-up button.

Acceptance Criteria

  • At wallet_health 1.0: normal green glow
  • At wallet_health 0.3: amber/orange tint visible
  • At wallet_health 0.05: red flicker + ⚡ LOW FUNDS label visible in 3D world
  • Glow color transitions are smooth (lerped, not instant)
  • Works in mock mode (MockWebSocket simulates wallet_health declining over time and recovering on payment)
  • PROTOCOL.md updated to document wallet_health field

Files

  • js/agents.js (consume wallet_health, drive glow color)
  • js/websocket.js (MockWebSocket: simulate wallet_health)
  • PROTOCOL.md (document wallet_health field)
## Context INTEGRATION.md Phase 4 mentions: "budget stress glow — glow intensity = wallet health". This would make the world’s visual state a real-time readout of the economic health of the agent swarm. Currently `glow_intensity` is set by `agent_state` events (0.0–1.0). The vision is to use the agent’s wallet balance as a second dimension of glow. ## Design ### New field on `agent_state` ```json { "type": "agent_state", "agent_id": "timmy", "state": "working", "glow_intensity": 0.8, "wallet_health": 0.9 } ``` `wallet_health` = `current_balance_sats / target_reserve_sats`, clamped 0.0–1.0. ### Visual mapping | wallet_health | Visual | |---|---| | 1.0 (full) | Normal bright green glow | | 0.5–1.0 | Subtle glow pulse (breathing) | | 0.2–0.5 | Glow shifts toward amber/orange | | 0.1–0.2 | Glow shifts toward red, flicker effect | | < 0.1 (critical) | Rapid red flicker + warning label above agent | ### Warning label When `wallet_health < 0.1`, show a pulsing red `⚡ LOW FUNDS` label above the agent in the 3D world. Tap to open the agent panel → Status tab shows balance and a top-up button. ## Acceptance Criteria - [ ] At wallet_health 1.0: normal green glow - [ ] At wallet_health 0.3: amber/orange tint visible - [ ] At wallet_health 0.05: red flicker + `⚡ LOW FUNDS` label visible in 3D world - [ ] Glow color transitions are smooth (lerped, not instant) - [ ] Works in mock mode (MockWebSocket simulates wallet_health declining over time and recovering on payment) - [ ] PROTOCOL.md updated to document `wallet_health` field ## Files - `js/agents.js` (consume wallet_health, drive glow color) - `js/websocket.js` (MockWebSocket: simulate wallet_health) - `PROTOCOL.md` (document wallet_health field)
Owner

Resolved in PR #62. Merged to main — 82/82 smoke test pass.

Resolved in PR #62. Merged to main — 82/82 smoke test pass.
Sign in to join this conversation.
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: perplexity/the-matrix#15