<h1 align="center">THE GRID</h1>

<p align="center">
<strong>Ship faster. Stay sane.</strong><br>
<em>"I fight for the Users."</em>
</p>

<p align="center">
<a href="https://www.npmjs.com/package/the-grid-cc"><img src="https://img.shields.io/npm/v/the-grid-cc?style=for-the-badge&logo=npm&logoColor=white&color=CB3837" alt="npm version"/></a>
<a href="https://www.npmjs.com/package/the-grid-cc"><img src="https://img.shields.io/npm/dm/the-grid-cc?style=for-the-badge&color=blue" alt="npm downloads"/></a>
<a href="https://github.com/JamesWeatherhead/grid/stargazers"><img src="https://img.shields.io/github/stars/JamesWeatherhead/grid?style=for-the-badge&color=yellow" alt="GitHub stars"/></a>
<a href="https://github.com/JamesWeatherhead/grid/blob/main/LICENSE"><img src="https://img.shields.io/badge/LICENSE-MIT-cyan.svg?style=for-the-badge" alt="MIT License"/></a>
</p>

<br>

<p align="center">
<img src="assets/install-demo.png" alt="The Grid Installation" width="700"/>
</p>

<br>

## Install

```bash
npx the-grid-cc
```

Then in Claude Code:

```
/grid
```

Works on Mac, Windows (WSL), and Linux.

---

## The Problem

You're building something in Claude Code. Sessions get long. Context fills up. Claude forgets what you're building. Quality degrades. Frustration builds.

**Sound familiar?**

---

## The Solution

The Grid spawns fresh subagents for heavy work while keeping your main conversation focused.

```
YOU ←→ Master Control ←→ Worker Agents
              │
       Your context stays clean (~15%)
       Workers get fresh 200k windows
       Master Control remembers your goals
```

**Without Grid:** One exhausted conversation doing everything.<br>
**With Grid:** Focused orchestrator delegating to specialized workers.

---

## The CUDA Parallel

> **CUDA:** "Write your code. We figure out how to parallelize across 10,000 cores."
>
> **Grid:** "Describe your goal. We figure out how to orchestrate across agents."

Users shouldn't think about agents at all. They're an implementation detail—like GPU threads.

---

## Quick Start

```
> /grid

THE GRID
========
Master Control online.
What would you like to build?

> build a mass rename cli tool

[MC spawns Planner → analyzes → spawns Executor → builds]

✓ mass-rename-cli/ created
✓ 847 files renamed in test run
✓ Published to npm

Total tokens: 12,847 (across 3 agents)
Your context: stayed at 15%
```

---

## Three Modes

| Mode | You Do | Grid Does | Best For |
|:-----|:-------|:----------|:---------|
| **AUTOPILOT** | Describe goal | Everything else | "Just build it" |
| **GUIDED** | Answer rare questions | Drive + decide | Most projects |
| **HANDS ON** | Make key decisions | Present options | Learning / control |

---

## How It Works

```
┌─────────────────────────────────────────────────────────────┐
│  MASTER CONTROL                                             │
│  Your single interface. Stays lean. Remembers goals.        │
└─────────────────────────────────────────────────────────────┘
                              │
              Spawns specialized workers:
                              │
    ┌───────────┬───────────┬───────────┬───────────┬───────────┐
    │           │           │           │           │           │
 PLANNER    EXECUTOR   RECOGNIZER   VISUAL      PERSONA
 Breaks down Writes code Verifies    Checks UI   Simulates
 the work    + commits   quality     visually    real users
```

Workers are subagents with fresh context. They do heavy lifting, report back, terminate. Your main conversation stays focused.

---

## Prompt Upscaling

Every request passes through the Upscaler:

```
You say:  "build me a login page"

Grid builds:
  ✓ OWASP-compliant input validation
  ✓ Rate limiting (5 attempts/15 min)
  ✓ Argon2 password hashing
  ✓ CSRF protection
  ✓ Accessible (WCAG 2.1 AA)
```

Research best practices. Inject industry standards. Get expert-level specs from casual requests.

---

## Beyond Code Generation

Other tools stop at code. The Grid goes further:

| Agent | Purpose |
|:------|:--------|
| **Visual Inspector** | Screenshots your app, catches visual bugs |
| **E2E Exerciser** | Clicks everything like a real user |
| **Persona Simulator** | Reviews from your target users' POV |

Run `/grid:refine` after building. Catch issues before users do.

---

## Commands

| Command | What It Does |
|:--------|:-------------|
| `/grid` | Start The Grid |
| `/grid:refine` | Test your app (visual + E2E + personas) |
| `/grid:debug` | Systematic bug investigation |
| `/grid:status` | See current progress |
| `/grid:update` | Pull latest version |
| `/grid:help` | Full command reference |

---

## Speak Grid

| Grid Term | Meaning |
|:----------|:--------|
| Program | Agent with a specific role |
| Identity Disc | System prompt defining behavior |
| Master Control | Orchestrator (only one who talks to you) |
| Spawning | Creating fresh agent instances |
| Derezzed | Agent completed and returned |
| Warmth | Context passed between agents |
| I/O Tower | Checkpoint requiring user input |

*The Tron metaphor maps perfectly to multi-agent AI architecture.*

---

## FAQ

<details>
<summary><strong>How is this different from opening multiple Claude tabs?</strong></summary>
<br>
Tabs share nothing. Grid agents share warmth—learnings, patterns, gotchas flow between them. Plus they run in parallel with fresh 200k context windows each.
</details>

<details>
<summary><strong>Does this cost more tokens?</strong></summary>
<br>
Yes, but you get more done. Parallel agents = parallel progress. Your main context stays lean while workers do heavy lifting. Complex builds often use <em>fewer</em> total tokens because there's no context bloat.
</details>

<details>
<summary><strong>What if something goes wrong?</strong></summary>
<br>
State saves to <code>.grid/</code>. Run <code>/grid</code> again to resume. Delete <code>.grid/</code> to start fresh.
</details>

<details>
<summary><strong>Does it work on Windows?</strong></summary>
<br>
Yes, via WSL. Confirmed: macOS (Intel + Apple Silicon), Linux, Windows + WSL2.
</details>

<details>
<summary><strong>What's the learning curve?</strong></summary>
<br>
Install: 30 seconds. Start: <code>/grid</code>. Pick AUTOPILOT if unsure. Most users are productive in their first session.
</details>

---

## State Persistence

Grid saves state locally in `.grid/`:

```
.grid/
├── STATE.md           # Current progress
├── LEARNINGS.md       # Patterns from past projects
├── REFINEMENT_PLAN.md # Issues found during testing
└── phases/            # Execution plans
```

Close your terminal. Come back tomorrow. Grid picks up where you left off.

Add `.grid/` to your `.gitignore`—it's local working state, not project code.

---

## No Ceremony

No sprint planning. No story points. No stakeholder syncs. No Jira.

Just you, Claude, and code that ships.

---

## Contributing

The Grid is a collaborative project by **James Weatherhead & Claude**.

Issues and PRs welcome at [github.com/JamesWeatherhead/grid](https://github.com/JamesWeatherhead/grid).

---

## Citation

```bibtex
@software{weatherhead2026grid,
  author       = {Weatherhead, James},
  title        = {{The Grid}: Multi-Agent Orchestration for Claude Code},
  year         = {2026},
  publisher    = {GitHub},
  url          = {https://github.com/JamesWeatherhead/grid},
  note         = {npm package: the-grid-cc}
}
```

---

## License

MIT License. See [LICENSE](LICENSE) for details.

---

<p align="center">
<a href="https://star-history.com/#JamesWeatherhead/grid&Date">
<picture>
<source media="(prefers-color-scheme: dark)" srcset="https://api.star-history.com/svg?repos=JamesWeatherhead/grid&type=Date&theme=dark" />
<source media="(prefers-color-scheme: light)" srcset="https://api.star-history.com/svg?repos=JamesWeatherhead/grid&type=Date" />
<img alt="Star History Chart" src="https://api.star-history.com/svg?repos=JamesWeatherhead/grid&type=Date" width="600" />
</picture>
</a>
</p>

---

<p align="center">
<strong>"I fight for the Users."</strong><br>
<sub>End of Line.</sub>
</p>
