Plan Stack
README.md
# Plan Stack for Google Antigravity
> **Nested discussion & task stack tracker integrated directly into Antigravity's Side Pane & Left Sidebar (MCP App).**
>
> *Never lose track of Step 1 when Step 1 spawns sub-discussion 1.a, which spawns 1.a.1!*
[](LICENSE)
[](https://nodejs.org/)
[-purple.svg)](https://github.com/modelcontextprotocol/ext-apps)
---
## Why Plan Stack? (Tại sao cần Plan Stack?)
When brainstorming or building with an AI agent, conversations rarely stay linear:
```text
1. Design Auth System [⏸ Paused: waiting on 1.a]
├── 1.a. Choose Token Format [⏸ Paused: waiting on 1.a.1]
│ └── 1.a.1. JWT vs Opaque [▶ ACTIVE FOCUS]
└── 1.b. Refresh Token Rotation [ ] Todo
2. Implement API Endpoints [ ] Todo
```
Flat checklists break down as soon as **Step 1** spawns **Step 1.a**, which spawns **Step 1.a.1**. You finish the deep tangent and forget what parent question you were originally trying to answer.
**Plan Stack** solves this natively inside **Google Antigravity** with:
- **Unlimited Nested Stack (`1` → `1.a` → `1.a.1` → `1.a.1.a`)**: Automatic hierarchical numbering and live **Focus Stack Breadcrumb**.
- **Auto-Pause & Auto-Return**: Branching (`branch`) automatically pauses the parent step with a waiting reason and shifts focus to the child. Completing (`complete`) automatically advances to the next unfinished sibling—or pops focus back up to the paused parent and resumes it.
- **Native Antigravity MCP App UI**: Opens directly in the **Side Pane (`+` → Plan Stack)** or full-page from the **Left Sidebar (Plan Stack)**. Updates live as the AI updates the plan.
- **2-Way Chat Integration**:
- Click **💬 Discuss** to focus a step and send its stack context to the active chat.
- Click **↗ Fork Tangent** to spin off a deep sub-discussion into a new background conversation without cluttering the main thread.
- Click **📎 Attach Context** to attach a step's path, notes, and decisions to your next prompt.
- **Decision Log & Markdown Export**: Capture locked-in conclusions on each node and copy the entire tree as Markdown in one click.
- **Built-in Proactive Agent Rule & `/plan-stack` Skill**: Teaches Antigravity to proactively capture discussion branches, notes, and decisions for any multi-topic brainstorming, analysis, or planning session—you can effortlessly edit or delete any unwanted branch in the Side Pane.
- **Zero-Setup Prebuilt Bundle**: Pre-compiled `dist/server.cjs` and `dist/app.html` are committed so end users only need `node` (Node.js 20+)—no `npm install` or build step required.
---
## Architecture
```mermaid
flowchart LR
U[User in Side Pane / Sidebar] <-->|MCP App postMessage| H[Antigravity Host]
A[Antigravity AI Agent] <-->|plan_stack tool| H
H <-->|stdio JSON-RPC| S[dist/server.cjs]
S -->|ui://plan-stack/app.html| UI[dist/app.html]
S -->|Atomic JSON| D[(PLUGIN_DATA/plans.json)]
R[rules/AGENTS.md + skills/plan-stack] -.->|Guides auto-branch & return| A
```
---
## 1-Command Installation
Requires **Node.js 20+** installed on your machine. Antigravity automatically discovers plugins placed in `~/.gemini/config/plugins/<name>/` (no manual config editing needed).
### Windows (PowerShell)
```powershell
git clone https://github.com/nguhoc94-blip/antigravity-plan-stack.git "$env:USERPROFILE\.gemini\config\plugins\plan-stack"
```
### macOS / Linux
```bash
git clone https://github.com/nguhoc94-blip/antigravity-plan-stack.git ~/.gemini/config/plugins/plan-stack
```
After cloning:
1. Open Antigravity → **Customizations / Plugins** (or start a new turn) and verify **Plan Stack** is enabled.
2. Open the UI from the Side Pane **`+`** menu → **Plan Stack**, or from the Left Sidebar → **Plan Stack**.
---
## Usage Guide
### 1. Using via Chat (with AI)
Because the plugin ships with `rules/AGENTS.md` and `/plan-stack` on a **proactive (opt-out)** model, you don't even need to ask explicitly—whenever a big topic starts branching into smaller sub-discussions, Antigravity automatically structures it in the Side Pane (and you can delete or edit any node you don't want):
- *"Let's design the auth flow — wait, before finishing Schema we need to compare UUID vs ULID."*
- *"Lock in the decision: we will use UUIDv7, resolve this sub-topic, and return to Schema."*
- *"Create a Plan Stack for redesigning our authentication flow with steps: Schema, API, UI."*
### 2. Using the Interactive Side Pane UI
- **+ Plan**: Create a new plan (optionally seed comma-separated initial steps).
- **+Sub**: Branch a child step under any node (pauses the parent and focuses the child).
- **▶**: Focus any step (updates the Focus Stack breadcrumb and pauses previous active steps).
- **✓**: Complete a step and automatically jump to the next unfinished sibling or pop back to the paused parent.
- **⋯**: Open the inline drawer to edit title/notes/status, record or remove **Decisions**, or delete a step.
- **Copy MD**: Copy the entire nested plan tree as clean Markdown.
### Hướng dẫn nhanh (Tiếng Việt)
1. Clone repo về thư mục `~/.gemini/config/plugins/plan-stack` theo lệnh ở trên.
2. Mở tab **Plan Stack** từ nút **`+`** ở khung phụ bên phải (**Side Pane**) hoặc thanh **Sidebar** bên trái.
3. Khi đang bàn bạc chủ đề lớn với AI (lập kế hoạch, thiết kế, hay phân tích chuyên môn), AI sẽ **chủ động** ghi lại các nhánh con (`1` → `1.a` → `1.b`), tạm hoãn chủ đề cha và tự động quay lại khi nhánh con chốt xong — nhánh nào bạn thấy chưa hợp lý có thể bấm xóa/sửa ngay trên Side Pane.
---
## MCP Tool Reference
| Tool | Visibility | Purpose |
| :--- | :--- | :--- |
| `plan_stack` | `model`, `app` | Main UI-linked tool (`view`, `create_plan`, `switch_plan`, `delete_plan`, `add_step`, `branch`, `focus`, `complete`, `pause`, `reopen`, `update_step`, `add_decision`, `delete_decision`, `delete_step`). Calling with `{}` opens/renders the view. |
| `app_get_state` | `app` only | Fetches latest persisted state from disk for UI synchronization. |
| `app_mutate` | `app` only | Executes UI-driven mutations and persists eagerly to `<data-dir>/plans.json`. |
---
## Development & Testing
```bash
# Install dev/runtime dependencies
npm install
# Type-check TypeScript
npm run typecheck
# Rebuild dist/server.cjs and self-contained dist/app.html
npm run build
# Run unit & stdio MCP end-to-end tests
npm test
```
### Fast UI Iteration
You can point `PLAN_STACK_APP_HTML` to a local HTML file path in `mcp_config.json` to reload UI changes without rebuilding the server bundle.
---
## Project Structure
```text
plan-stack/
├── plugin.json # Antigravity plugin manifest
├── mcp_config.json # MCP server launch config (${PLUGIN_ROOT}, ${PLUGIN_DATA})
├── assets/logo.svg # Plugin icon
├── rules/AGENTS.md # Always-on rule guiding branch/decision/return behavior
├── skills/plan-stack/SKILL.md # /plan-stack skill instructions
├── src/
│ ├── types.ts # Shared types & Zod input schema
│ ├── store.ts # Nested stack state engine & atomic JSON persistence
│ ├── server.ts # Stdio MCP server + MCP App resource/tools
│ └── ui/ # Self-contained MCP App HTML/CSS/TS UI
├── scripts/build.mjs # esbuild bundler for server.cjs + singlefile app.html
├── dist/ # Prebuilt zero-setup distribution artifacts
└── test/ # Unit + stdio JSON-RPC integration tests
```
---
## License
MIT © 2026 [nguhoc94-blip](https://github.com/nguhoc94-blip)
This server cannot be deployed
Maintenance
ActivityMaintained
ResponsivenessNo recent community issues