# /grid:status - Grid Status Display

---
name: grid:status
description: Show Grid state with TRON-themed visual progress display
argument-hint: ""
allowed-tools:
  - Read
  - Glob
  - Grep
---

## Current Mission State
!`cat .grid/STATE.md 2>/dev/null || echo "No active Grid session"`

## Recent Scratchpad
!`tail -30 .grid/SCRATCHPAD.md 2>/dev/null || echo "No scratchpad entries"`

## Budget Status
!`cat .grid/budget.json 2>/dev/null || echo "No budget configured"`

---

Display the current Grid state with TRON-themed visuals showing cluster progress, active programs, and I/O Tower status.

## USAGE

`/grid:status`

## BEHAVIOR

1. Check if `.grid/STATE.md` exists
   - If not: Show "No active Grid session"
2. Parse STATE.md for current position
3. Scan `.grid/phases/` for PLAN.md and SUMMARY.md files
4. Calculate progress per block and overall
5. Display visual status

## OUTPUT FORMAT

```
THE GRID - STATUS
══════════════════════════════════════════════════════════════════

CLUSTER: {Cluster Name}
═══════════════════════════════════════════════════════════════════

├─ BLOCK 1: {Block Name}                    [{progress_bar}] {pct}%
│  ├─ THREAD 1.1: {Name}                    ✓ Complete
│  ├─ THREAD 1.2: {Name}                    ✓ Complete
│  ├─ THREAD 1.3: {Name}                    ⚡ In Progress
│  └─ THREAD 1.4: {Name}                    ○ Pending
│
├─ BLOCK 2: {Block Name}                    [{progress_bar}] {pct}%
│  ├─ THREAD 2.1: {Name}                    ○ Pending
│  └─ Blocked by: BLOCK 1
│
└─ BLOCK 3: {Block Name}                    [{░░░░░░░░░░}] 0%
   └─ Blocked by: BLOCK 2

═══════════════════════════════════════════════════════════════════
OVERALL PROGRESS                            [{████████░░}] 80%
═══════════════════════════════════════════════════════════════════

PROGRAMS ACTIVE
───────────────
  Executor    → THREAD 1.3
  Recognizer  → Idle

I/O TOWER
─────────
  Status: {Idle | Awaiting User Response | Checkpoint Active}
  {If active: checkpoint details}

WAVE EXECUTION
──────────────
  Wave 1: ✓ Complete (2 blocks parallel)
  Wave 2: ⚡ In Progress (1 block)
  Wave 3: ○ Pending (2 blocks parallel)

═══════════════════════════════════════════════════════════════════

End of Line.
```

## PROGRESS BAR RENDERING

```
Progress bar = 10 characters

0%:   [░░░░░░░░░░]
10%:  [█░░░░░░░░░]
25%:  [██░░░░░░░░]
50%:  [█████░░░░░]
75%:  [███████░░░]
100%: [██████████]
```

## STATUS ICONS

```
✓  Complete (green)
⚡ In Progress (yellow)
○  Pending (gray)
✗  Failed (red)
⏸  Paused at checkpoint
```

## NO ACTIVE SESSION

If no `.grid/STATE.md` exists:

```
THE GRID - STATUS
══════════════════════════════════════════════════════════════════

    ┌────────────────────────────────────────────────────────┐
    │                                                        │
    │              NO ACTIVE GRID SESSION                    │
    │                                                        │
    │   Run /grid to initialize a new session.               │
    │                                                        │
    └────────────────────────────────────────────────────────┘

End of Line.
```

## READING STATE (YAML FRONTMATTER)

The STATE.md file uses YAML frontmatter for machine-parseable state. Parse it to get exact position:

### Frontmatter Structure

```yaml
---
version: "1.0"
session_id: "sess-{timestamp}-{random}"
cluster: "{cluster_name}"
started_at: "{ISO 8601}"
updated_at: "{ISO 8601}"

position:
  phase: 1
  phase_total: 2
  phase_name: "{name}"
  block: 1
  block_total: 3
  block_name: "{name}"
  wave: 1
  thread: 2
  thread_total: 4

status: "in_progress"  # pending | in_progress | blocked | complete | failed | aborted
mode: "autopilot"      # autopilot | guided | hands_on

progress:
  blocks_complete: 1
  blocks_total: 3
  percent: 50

current:
  agent: "executor-01"
  task: "{task description}"
  started_at: "{ISO 8601}"

resume:
  checkpoint_file: "{path or empty}"
  last_agent: "{agent name}"
  last_commit: "{commit hash}"
  can_resume: true

energy: 9000
---
```

### Parsing Instructions

1. Read `.grid/STATE.md`
2. Extract content between first `---` and second `---`
3. Parse as YAML
4. Use fields to populate status display

### Key Fields for Display

| Display Element | Frontmatter Field |
|-----------------|-------------------|
| Cluster name | `cluster` |
| Current phase | `position.phase` / `position.phase_total` |
| Current block | `position.block` / `position.block_total` |
| Current thread | `position.thread` / `position.thread_total` |
| Overall progress | `progress.percent` |
| Active agent | `current.agent` |
| Current task | `current.task` |
| Can resume | `resume.can_resume` |
| Session status | `status` |
| Execution mode | `mode` |

---

## DATA SOURCES

| Data | Source |
|------|--------|
| Cluster name | `.grid/STATE.md` YAML frontmatter `cluster` field |
| Current position | `.grid/STATE.md` YAML frontmatter `position` object |
| Progress | `.grid/STATE.md` YAML frontmatter `progress` object |
| Block/Thread structure | `.grid/phases/*/PLAN.md` files |
| Completion status | `.grid/phases/*/SUMMARY.md` existence + STATE.md `status` |
| Wave structure | PLAN.md frontmatter `wave` field |
| Active programs | `.grid/STATE.md` YAML frontmatter `current.agent` |
| Resume capability | `.grid/STATE.md` YAML frontmatter `resume.can_resume` |

## QUICK STATUS (One-liner)

For embedded status in other displays:

```
GRID: {Cluster} | Block {N}/{M} | {pct}% | {Active Program or Idle}
```

End of Line.
