Skip to content

Commit 2488353

Browse files
regenrekcursoragent
andcommitted
Cut per-item CLI overhead with a compound work flow
New src/app/flow.rs owns the compound flow: `planr done` chains completion log, review request or close, and an optional next pick; evidence logs refresh the owner heartbeat; `pick --json` includes the full trace work packet; `review close --close-target` closes the reviewed item with the review when evidence exists. The next pick excludes the worker's own freshly requested review so maker and checker stay separate. Per-item flow drops from ~8 commands to 3 with identical evidence. Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent de91af1 commit 2488353

18 files changed

Lines changed: 594 additions & 139 deletions

File tree

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "planr"
3-
version = "1.1.5"
3+
version = "1.1.6"
44
edition = "2021"
55
license = "MIT"
66
description = "Local-first planning and execution coordination for coding agents"

docs/ARCHITECTURE.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ Planr V1 is a single Rust binary with explicit module ownership. The crate stays
1919
- `src/cli.rs`: CLI contract boundary. Owns `clap` command definitions, option parsing types, value enums, and command DTOs used by app dispatch.
2020
- `src/app/mod.rs`: application composition boundary. Owns the `App` runtime state, top-level dispatch, shared app-local row helpers, and app submodule wiring.
2121
- `src/app/commands.rs`: CLI use-case orchestration. Owns project, plan, map, item, link, pick, approval, log, close, review, context, search, doctor, and install command handlers.
22+
- `src/app/flow.rs`: compound work-flow boundary. Owns evidence log writing (with heartbeat folding), the close transition core, review-request creation, the pick work packet, and the `done` command that chains them for CLI, HTTP, and MCP surfaces.
2223
- `src/app/git_review.rs`: Git and PR review evidence boundary. Owns worktree detection, scoped changed-file provenance, PR URL context, and dirty-worktree safety projections.
2324
- `src/app/mcp.rs`: MCP stdio boundary. Owns MCP protocol request routing, tool calls, resource reads, and prompt responses.
2425
- `src/app/packages.rs`: package import/export boundary. Owns reusable JSON templates, preview-before-import, review artifact package import, and local-first encrypted bundle metadata.

docs/CLI_REFERENCE.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,9 @@ planr review annotate <item-id> --message "..." [--severity info|warning|blockin
4949
planr review ingest <item-id> (--from feedback.json|--stdin)
5050
planr review artifact <review-item-id> [--out .planr/reviews/custom.review.md]
5151
planr review evidence <item-id> [--pr-url https://...]
52-
planr review close <review-item-id> --verdict complete|not-complete|unclear
52+
planr review close <review-item-id> --verdict complete|not-complete|unclear [--close-target]
5353
planr close [item-id] --summary "..." [--next]
54+
planr done [item-id] --summary "..." [--files a --files b] [--cmd "..."] [--tests "..."] [--review] [--next]
5455
planr context add "text" [--item <item-id>] [--tag discovery]
5556
planr search "query"
5657
planr doctor [--client codex|claude|cursor|all]
@@ -94,7 +95,11 @@ With `--json`, responses follow one convention so agents never guess where data
9495
}
9596
```
9697

97-
`review close` writes `.planr/reviews/<review-item-id>.review.md` and registers it as a review artifact. A `not-complete` or `unclear` verdict creates fix and follow-up review work.
98+
`review close` writes `.planr/reviews/<review-item-id>.review.md` and registers it as a review artifact. A `not-complete` or `unclear` verdict creates fix and follow-up review work. With `--close-target` (complete verdicts only) the reviewed item is closed in the same command, provided it already has a completion log.
99+
100+
`done` is the compound worker command: it writes a completion log, then requests a review (`--review`) or closes the item, and optionally picks the next ready item (`--next`). It chains the same single-owner operations as `log add`, `review request`, `close`, and `pick` — identical evidence, fewer commands.
101+
102+
`pick --json` returns the full work packet: the item, recall `context`, and a `trace` object (links, logs, runtime, recovery, conditions, approval), so no separate `trace item` call is needed. Evidence written via `log add` or `done` by the pick owner refreshes the runtime heartbeat automatically.
98103

99104
`review evidence` reports Git worktree status scoped to files named by item logs or artifacts. Dirty files without item provenance are listed as unrelated and are not treated as agent-owned evidence. `--pr-url` records an item-scoped PR reference before returning the evidence package.
100105

docs/OPERATING_MODEL.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,14 +49,15 @@ Product-plan task lists are candidates. Work becomes a live commitment only afte
4949

5050
## Daily Agent Loop
5151

52-
Agents should work one map item at a time:
52+
Agents should work one map item at a time. The short path is:
5353

5454
```bash
5555
planr pick --json
56-
planr trace item <item-id>
57-
planr pick heartbeat <item-id>
56+
planr done <item-id> --summary "what changed" --files a --files b --cmd "exact verification command" --review [--next]
5857
```
5958

59+
`pick --json` returns the item with recall context and the full `trace` work packet, so no separate `trace item` call is needed. `done` writes the completion log, then requests review (`--review`) or closes directly, and `--next` picks the following item. Evidence logging refreshes the heartbeat, so explicit `pick heartbeat` calls are only needed during long silent stretches.
60+
6061
For longer work, update runtime state instead of relying on chat history:
6162

6263
```bash
@@ -98,10 +99,11 @@ planr review request <item-id>
9899
planr review annotate <item-id> --message "review note" --severity warning
99100
planr review evidence <item-id> --pr-url https://example.invalid/pr/123
100101
planr review ingest <item-id> --from .planr/tmp/review-feedback.json
101-
planr review close <review-id> --verdict complete
102-
planr close <item-id> --summary "Verified with evidence"
102+
planr review close <review-id> --verdict complete --close-target
103103
```
104104

105+
With `--close-target` a complete verdict also closes the reviewed item (it must already carry a completion log); otherwise finish with `planr close <item-id> --summary "Verified with evidence"`.
106+
105107
`review evidence` records Git branch, commit, dirty state, item-scoped changed-file provenance, and optional PR URL context without treating unrelated dirty files as proof. Review ingestion records hook-compatible JSON feedback as contexts and logs only. It does not close the review, approve the item, or unblock downstream work.
106108

107109
For a browser-based local review pass:

docs/TASK_GRAPH_MODEL.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ Picking is the concurrency boundary:
6565
planr pick --json
6666
```
6767

68-
One ready item should be picked by one worker. Picked work records `worker_id`, `pick_token`, `picked_at`, and `last_heartbeat_at`. Worker identity is stable per client, host, and user, so heartbeats keep working across the many short-lived processes of an agent session. Parallel workers on the same machine must set `PLANR_SESSION_ID` to distinct values. Active agents should keep the claim fresh and make progress visible:
68+
One ready item should be picked by one worker. The pick output includes recall context and the full `trace` work packet. Picked work records `worker_id`, `pick_token`, `picked_at`, and `last_heartbeat_at`. Worker identity is stable per client, host, and user, so heartbeats keep working across the many short-lived processes of an agent session. Parallel workers on the same machine must set `PLANR_SESSION_ID` to distinct values. Evidence written via `log add` or `done` by the owner refreshes the heartbeat automatically; the explicit runtime commands cover long silent stretches:
6969

7070
```bash
7171
planr pick heartbeat [item-id]

plugins/planr/skills/planr-loop/SKILL.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,14 @@ Each iteration is one dispatch through the routing skill — never a hand-writte
3030
```text
3131
1. $planr-status read honest state; if stop condition holds -> exit loop
3232
2. $planr-plan / $planr-task-graph only if scope or map structure is missing
33-
3. $planr-work pick exactly one ready item, implement, log evidence
33+
3. $planr-work pick exactly one ready item, implement, finish with planr done --review
3434
4. live verify run the platform verification (below), log it with planr log add --cmd
35-
5. $planr-review independent audit; complete -> close, findings -> Planr creates fix items
35+
5. $planr-review independent audit; complete -> review close --close-target, findings -> Planr creates fix items
3636
6. repeat fix items are just the next ready items
3737
```
3838

39+
The short path per item is three commands: `planr pick --json` (includes the trace work packet), `planr done <item-id> --summary ... --cmd ... --review [--next]`, and the reviewer's `planr review close <review-id> --verdict complete --close-target`. Parent gates roll up automatically.
40+
3941
After any `planr map build`, dependency linking is part of step 2, not optional: add `blocks` links for every execution-order dependency before the first pick. An unlinked map makes the loop pick items in arbitrary order.
4042

4143
The loop never closes its own reviews when the host supports a second agent. Maker and checker stay separate.

plugins/planr/skills/planr-review/SKILL.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,11 @@ planr map show --json
1818
Inspect the actual changed files and verification evidence. Then close the review:
1919

2020
```bash
21-
planr review close <review-id> --verdict complete
21+
planr review close <review-id> --verdict complete --close-target
2222
```
2323

24+
`--close-target` also closes the reviewed item when the verdict is complete and a completion log exists — the worker does not need a separate close round-trip. Omit it when the worker should close explicitly.
25+
2426
or:
2527

2628
```bash

plugins/planr/skills/planr-task-graph/SKILL.md

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,15 @@ planr doctor --client all
3434

3535
## Core Loop
3636

37-
Use one item at a time:
37+
Use one item at a time. The short path is two commands per step:
3838

3939
```bash
4040
planr pick --json
41-
planr trace item <item-id>
42-
planr pick heartbeat <item-id>
41+
planr done <item-id> --summary "what changed" --files a --files b --cmd "exact verification command" --review [--next]
4342
```
4443

44+
`pick --json` includes the full work packet (`trace`: links, logs, runtime, conditions, approval). `done` writes the completion log, requests review (`--review`) or closes directly, and `--next` picks the following item. Evidence logs refresh the heartbeat automatically.
45+
4546
For longer work, keep the live claim visible:
4647

4748
```bash
@@ -65,14 +66,16 @@ planr log add --item <item-id> \
6566
--cmd "exact verification command"
6667
```
6768

68-
Request review, close review, then close the item:
69+
Granular alternative: request review, close review, then close the item:
6970

7071
```bash
7172
planr review request <item-id>
72-
planr review close <review-id> --verdict complete
73+
planr review close <review-id> --verdict complete --close-target
7374
planr close <item-id> --summary "Verified with evidence"
7475
```
7576

77+
`--close-target` closes the reviewed item together with the review when the verdict is complete and a completion log exists; the separate `planr close` is then unnecessary.
78+
7679
If human approval is part of the gate, request it and do not close until it is approved:
7780

7881
```bash

plugins/planr/skills/planr-work/SKILL.md

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,21 +11,23 @@ Use this for one picked item at a time.
1111

1212
```bash
1313
planr pick --json
14-
planr trace item <item-id>
15-
planr pick heartbeat <item-id>
1614
```
1715

18-
Read the linked plan/context, implement the smallest correct slice, then record evidence:
16+
The pick output already contains the full work packet (`trace`: links, logs, runtime, conditions, approval) plus recall context — no separate `trace item` call needed. Read the linked plan/context, implement the smallest correct slice, then finish the step in one command:
1917

2018
```bash
21-
planr log add --item <item-id> --summary "what changed" --files path-a --files path-b --cmd "exact verification command"
22-
planr review request <item-id>
19+
planr done <item-id> --summary "what changed" --files path-a --files path-b --cmd "exact verification command" --review
2320
```
2421

25-
Only close after review is complete:
22+
`done --review` writes the completion log and requests the review; add `--next` to pick the following item in the same call. Without `--review` it closes the item directly (only for items that need no review gate).
23+
24+
Evidence logging refreshes the heartbeat automatically — a separate `planr pick heartbeat` is only needed for long silent stretches without logs.
25+
26+
The granular commands remain available when you need them:
2627

2728
```bash
28-
planr review close <review-id> --verdict complete
29+
planr log add --item <item-id> --summary "..." --files a --files b --cmd "..."
30+
planr review request <item-id>
2931
planr close <item-id> --summary "Verified"
3032
```
3133

0 commit comments

Comments
 (0)