This document defines the Terminal User Interface (TUI) for ratelord. The TUI is the primary "pane of glass" for operators to observe the system's state, understand constraint pressure, and debug blocked agents.
The TUI must embody the ratelord principles: Predictive, Transparent, and Authoritative.
Constraint management is often a background concern until it becomes a critical failure. The TUI must provide high-density situational awareness immediately upon launch. An operator should answer "Are we healthy?" in < 1 second.
Color and layout must guide attention to risks.
- Green: Nominal. Operating within P99 forecasts.
- Yellow: Elevated risk. Burn rate is high; intent modifications are likely.
- Red: Critical. Exhaustion is imminent or active; intents are being denied.
The TUI is primarily an observer of the daemon's state. It does not calculate state itself; it renders the views provided by the daemon.
- It consumes the
/v1/eventsstream and/v1/forecastendpoints. - It does not write to the database directly.
- Exception: A debug "Command Mode" allows submitting test intents to verify policy behavior, but this uses the standard public API (
POST /v1/intent), identical to any other agent.
To maintain the "single binary, zero-ops" philosophy while delivering a rich, responsive interface:
- Language: Go
- Library: Bubble Tea (ELM architecture)
- Lip Gloss: For styling and layout.
- Bubbles: For table, list, and viewport components.
- Communication: HTTP/1.1 (REST + SSE) to
localhost:8090.
The TUI is organized into a main Dashboard View with modal Drill-Down Views.
- Left:
ratelordlogo/text. - Center: Daemon Status (
Connected|Reconnecting...), Uptime (14d 2h), Version (v0.1.0). - Right: Global Risk Score (0-100), rendered as a color-coded gauge.
A split-pane layout maximizing information density.
A table listing all active constraint pools.
- Row Entity:
Pool(e.g.,github:rest:core,github:graphql). - Columns:
- Name: Pool ID (e.g.,
github:rest). - Scope: Target (e.g.,
org:acme). - Rem: Remaining Capacity (e.g.,
4500/5000). - Burn Rate: Current consumption (e.g.,
12/min). - P99 TTE: Forecasted time to exhaustion (e.g.,
45m). Crucial metric. - Status: Badge (
OK,WARN,CRIT).
- Name: Pool ID (e.g.,
- Interaction: Arrow keys to highlight a row;
Enterto drill down.
A live-tail log of recent events, auto-scrolling.
- Format:
[timestamp] [AGENT_ID] [INTENT] -> [DECISION] - Coloring:
approve: Greenmodify: Yellowdeny: Red
- Example:
12:01:05 [crawler-01] intent:scan_repo -> APPROVED 12:01:08 [ci-agent-2] intent:build -> MODIFIED (wait 5s) 12:01:12 [dev-script] intent:dump_all -> DENIED (risk too high)
Sparklines or mini-charts showing global aggregate metrics.
- Total Intents/Min: Line chart.
- Denial Rate: Percentage gauge.
- DB Lag: Milliseconds.
Activated by selecting a pool in Pane A. Overlays the dashboard.
- Header:
Pool: github:rest:core [org:acme] - Forecast Graph: ASCII/Unicode line chart showing:
- Capacity Line: The hard limit.
- Historical Usage: Past 1h.
- Forecast Cone: P50/P90/P99 projection lines into the future (up to reset).
- Attribution Table: "Who is eating the budget?"
- List of Top 5 Agents by consumption in the current window.
- Key Controls:
Esc: Back to Dashboard.f: Force refresh forecast.
Activated by pressing :. A command-line input at the bottom of the screen.
- Commands:
:filter agent <id>: Filter Activity Stream by Agent ID.:filter decision deny: Show only denied intents.:clear: Reset filters.:test <json>: Open a form to manually submit a raw JSON intent (for testing policies).:quit/:q: Exit TUI.
- Operator sees CI job failing or slowing down.
- Opens
ratelord-tui. - Notices Global Risk is Yellow.
- Looks at Pools Table. Sees
github:rest:corefororg:acmehas P99 TTE < 5m (Critical). - Selects the pool and hits
Enter. - Pool Detail View shows a specific agent (
crawler-experimental) consuming 80% of the budget. - Operator kills the crawler agent;
ratelordforecast recovers; builds resume.
- Operator deploys
new-agent-v1in "dry-run" mode (submitting intents but not acting). - Opens TUI and types
:filter agent new-agent-v1. - Watches the Activity Stream.
- Sees a stream of
APPROVEDdecisions. - Notices one
MODIFIED (wait 2s)during a burst. - Concludes the agent is behaving well within the policy; proceeds to full deployment.
| Key | Action |
|---|---|
q / Ctrl+c |
Quit |
Use Arrows |
Navigate tables/lists |
Enter |
Select / Drill down |
Esc |
Go back / Clear selection |
: |
Enter Command Mode |
/ |
Quick Filter (Logs) |
? |
Show Help Modal |
- Connect to
/v1/healthand/v1/forecast. - Render static Pools Table and Activity Stream (polling, no SSE yet).
- Basic styling.
- Implement SSE client for
/v1/events(Live Tail). - Add Pool Detail View with attribution logic.
- Implement ASCII graphing for forecasts.
- Add filtering logic.
- Add "Test Intent" form.
- Refine aesthetics (colors, responsive layout).