visual-living-plan 0.0.0-stage → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Marco Calderon
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,111 @@
1
- # Temporary Holding Version
1
+ # Visual Living Plan
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Agent-authored visual plans for human interaction — closer to [Visual Plan](https://visualplan.dev/) than to a workflow builder.
4
+
5
+ The agent owns a `.plan.md` file. Humans open a browser URL to:
6
+
7
+ - see live status as phases update
8
+ - answer choices, forms, questions, and approval gates
9
+ - follow a live **execution diagram** (React Flow) while plan forms are locked
10
+
11
+ Works for local agents (file + localhost URL) and is shaped so a cloud agent can host the same server and share the URL.
12
+
13
+ ## Quick start
14
+
15
+ ```bash
16
+ npm install
17
+ npm run serve -- examples/rate-limit.plan.md --port 9410
18
+ ```
19
+
20
+ Open `http://127.0.0.1:9410`. Edit the example file, change a phase `status`, and the page reloads. Click a choice or submit a form to send structured feedback to the agent.
21
+
22
+ ### Review mode
23
+
24
+ ```bash
25
+ npm run review -- examples/rate-limit.plan.md --iteration 1
26
+ ```
27
+
28
+ Blocks until Approve (`0`), Deny (`1`), or Iterate (`2`).
29
+
30
+ ### Wait for one interaction
31
+
32
+ With `serve` already running:
33
+
34
+ ```bash
35
+ npm run wait -- fail-mode --url http://127.0.0.1:9410
36
+ ```
37
+
38
+ ### Live execution canvas
39
+
40
+ The page has **Plan** and **Execution** tabs. While execution is active, Plan forms/gates are disabled. The Execution tab hosts a readonly [React Flow](https://reactflow.dev) graph the agent updates live.
41
+
42
+ ```bash
43
+ npm run execution -- start --url http://127.0.0.1:9410 \
44
+ --step "Implement middleware" \
45
+ --detail "Editing gateway.ts" \
46
+ --graph examples/execution-graph.json
47
+
48
+ npm run execution -- push --url http://127.0.0.1:9410 \
49
+ --step "Add coverage" \
50
+ --graph examples/execution-graph.json
51
+
52
+ npm run execution -- stop --url http://127.0.0.1:9410
53
+ ```
54
+
55
+ Agent payloads:
56
+
57
+ - `graph` — portable `{ nodes, edges }` (preferred; adapter-agnostic)
58
+ - `scene` — optional adapter-specific extras
59
+
60
+ ## Why this exists
61
+
62
+ Visual builders optimize for humans drawing graphs. Living Plan optimizes for **agents communicating**:
63
+
64
+ | Need | Mechanism |
65
+ |------|-----------|
66
+ | Show current status | `phase` blocks + file watch reload |
67
+ | Ask for direction | `choice`, `form`, `questions`, `approve` |
68
+ | Converge on a plan | review bar + iteration diffs |
69
+ | Show live execution | React Flow canvas via `/api/execution` |
70
+ | Local + cloud | same file + HTTP server URL |
71
+
72
+ ## Plan vocabulary
73
+
74
+ See `examples/rate-limit.plan.md` and `skills/living-plan/SKILL.md`.
75
+
76
+ YAML fenced blocks:
77
+
78
+ - `phase` — status timeline
79
+ - `callout` — note / tip / risk / decision / warning
80
+ - `choice` / `form` / `questions` / `approve` — human interactions
81
+ - `checklist` — definition of done
82
+
83
+ ## Execution canvas adapters
84
+
85
+ Execution rendering goes through a small port/adapter layer:
86
+
87
+ - `client/execution-canvas/port.ts` — adapter contract
88
+ - `client/execution-canvas/toCanvasModel.ts` — maps `ExecutionState` → portable model
89
+ - `client/execution-canvas/adapters/reactFlow/` — current React Flow adapter
90
+ - `client/execution-canvas/registry.ts` — set `ACTIVE_EXECUTION_CANVAS_ADAPTER_ID`
91
+
92
+ To swap libraries later, add another adapter and change the active id. Keep agent payloads on `graph` so the API stays stable.
93
+
94
+ ## API
95
+
96
+ - `GET /` — interactive HTML page (Plan + Execution tabs)
97
+ - `GET /api/plan` — plan metadata, responses, pending interaction ids, execution state
98
+ - `GET /api/execution` — current execution canvas state
99
+ - `PUT /api/execution` — set execution state (`active`, `step`, `detail`, `graph`, `scene`)
100
+ - `POST /api/execution/start` / `POST /api/execution/stop` — convenience toggles
101
+ - `GET /api/events` — SSE (`reload`, `interaction`, `review`, `execution`)
102
+ - `POST /api/interactions/:id` — submit an interaction response (409 while execution is live)
103
+ - `POST /api/review` — submit Approve / Deny / Iterate (review mode)
104
+
105
+ ## Agent skill
106
+
107
+ Install or point your coding agent at `skills/living-plan/SKILL.md` so it authors and maintains living plans with the correct loop (`serve` / `wait` / `execution`).
108
+
109
+ ## License
110
+
111
+ MIT
@@ -0,0 +1,40 @@
1
+ {
2
+ "nodes": [
3
+ {
4
+ "id": "design",
5
+ "label": "Confirm design",
6
+ "detail": "Fail-open chosen",
7
+ "status": "done",
8
+ "x": 40,
9
+ "y": 80
10
+ },
11
+ {
12
+ "id": "implement",
13
+ "label": "Implement middleware",
14
+ "detail": "Editing gateway.ts",
15
+ "status": "active",
16
+ "x": 320,
17
+ "y": 80
18
+ },
19
+ {
20
+ "id": "tests",
21
+ "label": "Add coverage",
22
+ "detail": "429 + Retry-After",
23
+ "status": "pending",
24
+ "x": 600,
25
+ "y": 80
26
+ },
27
+ {
28
+ "id": "observe",
29
+ "label": "Dashboards",
30
+ "status": "pending",
31
+ "x": 320,
32
+ "y": 280
33
+ }
34
+ ],
35
+ "edges": [
36
+ { "from": "design", "to": "implement" },
37
+ { "from": "implement", "to": "tests" },
38
+ { "from": "implement", "to": "observe" }
39
+ ]
40
+ }
@@ -0,0 +1,101 @@
1
+ ---
2
+ title: Rate limiting rollout
3
+ summary: Add a sliding-window limiter at the API gateway, keep humans in the loop for policy choices, and stream status as the agent works.
4
+ agent: local-cursor
5
+ mode: watch
6
+ ---
7
+
8
+ # Rate limiting rollout
9
+
10
+ We add a sliding-window limiter at the gateway, behind a flag. This living plan is the agent's status surface: phases update as work progresses, and interaction blocks pause for your direction.
11
+
12
+ ```phase
13
+ id: design
14
+ title: Confirm limiter design
15
+ status: done
16
+ body: |
17
+ Use Redis for a shared sliding window. Return 429 with Retry-After when over limit.
18
+ ```
19
+
20
+ ```phase
21
+ id: implement
22
+ title: Implement gateway middleware
23
+ status: active
24
+ body: |
25
+ Wire the limiter into the request path and add a feature flag defaulting to off.
26
+ ```
27
+
28
+ ```phase
29
+ id: observe
30
+ title: Ship dashboards and alerts
31
+ status: pending
32
+ body: |
33
+ Emit reject counts and latency, then alert on sustained 429 spikes.
34
+ ```
35
+
36
+ ```callout
37
+ kind: risk
38
+ title: Redis dependency
39
+ body: |
40
+ A Redis outage must not take down the API. Fail-open vs fail-closed is a human policy decision below.
41
+ ```
42
+
43
+ ```choice
44
+ id: fail-mode
45
+ prompt: If Redis is unreachable, how should the limiter behave?
46
+ options:
47
+ - id: open
48
+ label: Fail open
49
+ description: Allow traffic if Redis is down. Prefer availability.
50
+ - id: closed
51
+ label: Fail closed
52
+ description: Reject traffic if Redis is down. Prefer strict limiting.
53
+ ```
54
+
55
+ ```form
56
+ id: limits
57
+ prompt: Set the initial production limits
58
+ fields:
59
+ - name: max_rps
60
+ label: Max requests per window
61
+ type: number
62
+ required: true
63
+ default: 120
64
+ - name: window_s
65
+ label: Window seconds
66
+ type: number
67
+ required: true
68
+ default: 60
69
+ - name: rollout
70
+ label: Initial rollout percentage
71
+ type: select
72
+ required: true
73
+ options: ["1", "5", "25", "100"]
74
+ default: "5"
75
+ ```
76
+
77
+ ```questions
78
+ id: rollout-notes
79
+ prompt: Anything else the agent should know before coding?
80
+ items:
81
+ - Which environments should receive the flag first?
82
+ - Is there an existing dashboard the agent should extend?
83
+ ```
84
+
85
+ ```approve
86
+ id: proceed-implement
87
+ prompt: Proceed with implementation using your answers above?
88
+ body: |
89
+ The agent will update phase statuses in this file as it works. Keep the watch URL open to follow progress and answer any new gates.
90
+ ```
91
+
92
+ ```checklist
93
+ title: Done when
94
+ items:
95
+ - text: Middleware behind a flag
96
+ done: false
97
+ - text: 429 + Retry-After behavior covered by tests
98
+ done: false
99
+ - text: Dashboard panels for rejects and latency
100
+ done: false
101
+ ```
package/package.json CHANGED
@@ -1,6 +1,54 @@
1
1
  {
2
2
  "name": "visual-living-plan",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.1.0",
4
+ "description": "Agent-authored living plans with human interaction, live updates, and a swappable execution canvas",
5
+ "type": "module",
6
+ "bin": {
7
+ "living-plan": "./dist/cli.js",
8
+ "visual-living-plan": "./dist/cli.js"
9
+ },
10
+ "files": [
11
+ "dist",
12
+ "skills",
13
+ "examples",
14
+ "README.md"
15
+ ],
16
+ "repository": {
17
+ "type": "git",
18
+ "url": "git+https://github.com/marco-calderon/visual-living-plan.git"
19
+ },
20
+ "bugs": {
21
+ "url": "https://github.com/marco-calderon/visual-living-plan/issues"
22
+ },
23
+ "homepage": "https://github.com/marco-calderon/visual-living-plan#readme",
24
+ "license": "MIT",
25
+ "scripts": {
26
+ "build": "tsc && vite build",
27
+ "build:client": "vite build",
28
+ "dev": "tsx src/cli.ts",
29
+ "serve": "tsx src/cli.ts serve",
30
+ "review": "tsx src/cli.ts review",
31
+ "wait": "tsx src/cli.ts wait",
32
+ "execution": "tsx src/cli.ts execution",
33
+ "check": "tsx src/cli.ts check",
34
+ "typecheck": "tsc --noEmit"
35
+ },
36
+ "engines": {
37
+ "node": ">=20"
38
+ },
39
+ "dependencies": {
40
+ "@xyflow/react": "^12.12.0",
41
+ "react": "^19.3.0",
42
+ "react-dom": "^19.3.0",
43
+ "yaml": "^2.8.1"
44
+ },
45
+ "devDependencies": {
46
+ "@types/node": "^24.6.2",
47
+ "@types/react": "^19.3.0",
48
+ "@types/react-dom": "^19.3.0",
49
+ "@vitejs/plugin-react": "^6.1.2",
50
+ "tsx": "^4.20.6",
51
+ "typescript": "^5.9.3",
52
+ "vite": "^8.3.4"
53
+ }
54
+ }
@@ -0,0 +1,71 @@
1
+ ---
2
+ name: living-plan
3
+ description: Author and maintain a Living Plan markdown file so humans can see agent status and answer interactions in a browser.
4
+ ---
5
+
6
+ # Living Plan
7
+
8
+ Use a single `.plan.md` file as the visual channel between you and the human.
9
+
10
+ ## When to use
11
+
12
+ - You need to show current status as structured phases, not chat walls.
13
+ - You need a human choice, approval, form values, or answers before continuing.
14
+ - Local or cloud: keep the file updated; the human watches a URL from `living-plan serve` or `living-plan review`.
15
+
16
+ ## Commands
17
+
18
+ ```bash
19
+ # Live status URL (hot-reloads when you edit the file)
20
+ npm run serve -- path/to/plan.plan.md --port 9410
21
+
22
+ # Blocking review gate (Approve / Deny / Iterate)
23
+ npm run review -- path/to/plan.plan.md --iteration 1
24
+
25
+ # Wait for one interaction on a running server
26
+ npm run wait -- fail-mode --url http://127.0.0.1:9410
27
+
28
+ # Live execution canvas (locks Plan tab forms while active)
29
+ npm run execution -- start --url http://127.0.0.1:9410 \
30
+ --step "Implement middleware" --detail "Editing gateway.ts" \
31
+ --graph examples/execution-graph.json
32
+ npm run execution -- push --url http://127.0.0.1:9410 \
33
+ --step "Add tests" --graph path/to/updated-graph.json
34
+ npm run execution -- stop --url http://127.0.0.1:9410
35
+ ```
36
+
37
+ Exit codes for `review`: `0` approve, `1` deny, `2` iterate, `3` timeout.
38
+
39
+ The UI has two tabs:
40
+ - **Plan** — authored `.plan.md` status and interactions. Forms/gates disable while execution is live.
41
+ - **Execution** — readonly React Flow canvas updated live via `/api/execution` (prefer portable `graph` JSON; optional adapter-specific `scene`). The canvas library is swappable via `client/execution-canvas/registry.ts`.
42
+
43
+ ## File format
44
+
45
+ Optional YAML frontmatter, then markdown plus fenced blocks:
46
+
47
+ - `phase` — status timeline (`pending` | `active` | `blocked` | `done` | `failed`)
48
+ - `callout` — `note` | `tip` | `risk` | `decision` | `warning`
49
+ - `choice` — mutually exclusive options (human picks one)
50
+ - `form` — structured fields (`text` | `number` | `textarea` | `select`)
51
+ - `questions` — open answers
52
+ - `approve` — approve/deny gate with optional note
53
+ - `checklist` — definition of done
54
+
55
+ Every interactive block needs a stable `id`. Do not rename ids mid-run or the human response may not match.
56
+
57
+ ## Agent loop
58
+
59
+ 1. Create or update the `.plan.md` file with current phases and any needed interactions.
60
+ 2. Start or reuse `serve` for continuous status, or `review` when you need an overall verdict.
61
+ 3. If you need a specific answer before continuing, `wait <id> --url ...` (or poll `GET /api/plan`).
62
+ 4. Apply the human response, update phase statuses / checklist items in the same file, and keep going.
63
+ 5. On review `iterate`, revise the plan in place, bump `--iteration`, and open review again.
64
+
65
+ ## Authoring rules
66
+
67
+ - One composition: title, short summary, phases, then only the interactions that matter now.
68
+ - Prefer updating the existing file over creating many plan files.
69
+ - Mark exactly one phase `active` when work is underway.
70
+ - Add interaction blocks only when you truly need human direction.
71
+ - After answers arrive, remove or leave them answered; add new blocks for new decisions.