planr 1.6.0 → 1.7.1

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.
Files changed (63) hide show
  1. package/README.md +46 -22
  2. package/docs/ARCHITECTURE.md +12 -1
  3. package/docs/RELEASE.md +37 -7
  4. package/docs/SWITCHLOOM_COMPATIBILITY.md +46 -0
  5. package/docs/contracts/EVAL_CONTRACT_V1.md +2072 -0
  6. package/docs/documentation/CONTRACT.md +7 -7
  7. package/docs/documentation/COVERAGE.md +5 -3
  8. package/docs/documentation/INFORMATION_ARCHITECTURE.md +5 -2
  9. package/docs/fixtures/mcp-contract.json +12 -0
  10. package/npm/native/darwin-arm64/planr +0 -0
  11. package/npm/native/darwin-x86_64/planr +0 -0
  12. package/npm/native/linux-arm64/planr +0 -0
  13. package/npm/native/linux-x86_64/planr +0 -0
  14. package/package.json +5 -1
  15. package/plugins/planr/.claude-plugin/plugin.json +1 -1
  16. package/plugins/planr/.codex-plugin/plugin.json +1 -1
  17. package/plugins/planr/agents/planr-worker.md +1 -1
  18. package/plugins/planr/skills/planr-goal/SKILL.md +21 -49
  19. package/plugins/planr/skills/planr-loop/SKILL.md +28 -94
  20. package/plugins/planr/skills/planr-loop/agents/planr-worker.md +1 -1
  21. package/plugins/planr/skills/planr-loop/references/host-dispatch.md +10 -0
  22. package/plugins/planr/skills/planr-loop/references/recovery-and-verification.md +24 -0
  23. package/plugins/planr/skills/planr-task-graph/SKILL.md +21 -190
  24. package/docs/CI.md +0 -54
  25. package/docs/CLAUDE_CODE.md +0 -52
  26. package/docs/CLI_REFERENCE.md +0 -160
  27. package/docs/CODEX.md +0 -56
  28. package/docs/CURSOR.md +0 -114
  29. package/docs/EXAMPLE_WEBAPP.md +0 -103
  30. package/docs/GOALS.md +0 -175
  31. package/docs/HANDOFFS_AND_STORIES.md +0 -121
  32. package/docs/HOOKS.md +0 -34
  33. package/docs/IMPORT.md +0 -21
  34. package/docs/INSTALL.md +0 -115
  35. package/docs/MCP_CONTRACT.md +0 -73
  36. package/docs/MCP_GUIDE.md +0 -40
  37. package/docs/MODEL_ROUTING.md +0 -33
  38. package/docs/NPM.md +0 -40
  39. package/docs/OPERATING_MODEL.md +0 -250
  40. package/docs/ROUTING_BUNDLES.md +0 -15
  41. package/docs/SECURITY.md +0 -8
  42. package/docs/SKILLS.md +0 -261
  43. package/docs/TASK_GRAPH_MODEL.md +0 -272
  44. package/docs/TESTING.md +0 -87
  45. package/docs/TROUBLESHOOTING.md +0 -30
  46. package/docs/planr-spec/ADRS.md +0 -160
  47. package/docs/planr-spec/AI_SPEC.md +0 -138
  48. package/docs/planr-spec/ANALYTICS_OBSERVABILITY_SPEC.md +0 -124
  49. package/docs/planr-spec/API_AND_DATA_MODEL.md +0 -517
  50. package/docs/planr-spec/BACKEND_IMPLEMENTATION_SPEC.md +0 -178
  51. package/docs/planr-spec/CLIENT_IMPLEMENTATION_SPEC.md +0 -119
  52. package/docs/planr-spec/DESIGN_SYSTEM_SPEC.md +0 -102
  53. package/docs/planr-spec/PRODUCT_SPEC.md +0 -193
  54. package/docs/planr-spec/QA_ACCEPTANCE_TESTS.md +0 -146
  55. package/docs/planr-spec/README.md +0 -67
  56. package/docs/planr-spec/REFERENCES.md +0 -29
  57. package/docs/planr-spec/RELEASE_READINESS.md +0 -95
  58. package/docs/planr-spec/SAFETY_PRIVACY_SECURITY.md +0 -169
  59. package/docs/planr-spec/TASKS.md +0 -932
  60. package/docs/planr-spec/TECH_ARCHITECTURE.md +0 -143
  61. package/docs/planr-spec/UX_FLOWS.md +0 -235
  62. package/docs/release-candidates/planr-v1.5.2.md +0 -164
  63. /package/docs/{planr-spec → contracts}/V1_1_DIFFERENTIATION_CONTRACT.md +0 -0
@@ -1,22 +1,17 @@
1
1
  ---
2
2
  name: planr-task-graph
3
- description: Use Planr as the live local task graph for coding-agent coordination. Trigger when work needs project planning, build-plan splitting, map creation, dependency links, picking, log-backed closure, review gates, handoff context, interruption recovery, or multi-client coordination.
3
+ description: Coordinate Planr plans, map dependencies, leases, evidence, approvals, reviews, handoffs, and interruption recovery.
4
4
  ---
5
5
 
6
6
  # Planr Task Graph
7
7
 
8
- Use `planr` as the canonical local coordination system for this repository.
8
+ Use Planr as the canonical local coordinator. Markdown plans own scope and narrative; the map is the source of truth for live items, links, picks, approvals, logs, reviews, and closure.
9
9
 
10
- Planr has two first-class layers:
10
+ Evaluation subcommands run only when the user explicitly requests them, the selected item's acceptance criteria require them, or the maintainer release workflow invokes them. Never invoke them as routine or opportunistic goal, loop, or task-graph work.
11
11
 
12
- - Markdown plans for product context, build scope, verification, and narrative decisions.
13
- - SQLite map state for items, links, picks, runtime heartbeats, approvals, contexts, logs, reviews, runs, and closure.
12
+ ## Inspect And Work
14
13
 
15
- The map is the source of truth for live state. Markdown explains scope and acceptance.
16
-
17
- ## Start Here
18
-
19
- Inspect the project and map before changing work:
14
+ Before changes:
20
15
 
21
16
  ```bash
22
17
  planr project show --json
@@ -25,206 +20,42 @@ planr map lane --critical
25
20
  planr map pressure
26
21
  ```
27
22
 
28
- If no project exists:
29
-
30
- ```bash
31
- planr project init "Project Name" --client all
32
- planr doctor --client all
33
- ```
34
-
35
- ## Core Loop
23
+ If missing, initialize the project and run `planr doctor --client all`.
36
24
 
37
- Use one item at a time. The short path is two commands per step:
25
+ Work one item at a time:
38
26
 
39
27
  ```bash
40
28
  planr pick --json
41
- planr done <item-id> --summary "what changed" --files a --files b --cmd "exact verification command" --tests "exact test command" --review [--next]
42
- ```
43
-
44
- `pick --json` returns one flat work packet (item, links, logs, runtime, recovery, conditions, recall context, `remaining` progress); empty collections are omitted. `done` writes the completion log (test runs belong in `--tests`, build/serve commands in `--cmd`), requests review (`--review`, which moves the item to `in_review`) or closes directly, and `--next` picks the following item. Evidence logs refresh the heartbeat automatically.
45
-
46
- For longer work, keep the live claim visible:
47
-
48
- ```bash
49
- planr pick progress <item-id> --percent 50 --note "tests running"
50
- planr pick pause <item-id> --note "waiting for human input"
51
- planr pick resume <item-id>
29
+ planr done <item-id> --summary "<outcome and decisive result>" \
30
+ --files <path> --cmd "<build or live command>" \
31
+ --tests "<test command>" --review
52
32
  ```
53
33
 
54
- Capture decisions and discoveries another agent may need:
34
+ Every closure must be evidence-backed: changed files through `--files`, commands through `--cmd`, tests through `--tests`, remaining risk through context or findings, and review outcome through `planr review`. Use plain `done` only when review has no signal. Keep longer work current with `planr pick progress`, `pause`, and `resume`.
55
35
 
56
- ```bash
57
- planr context add "decision or discovery" --item <item-id> --tag discovery
58
- ```
36
+ ## Plans And Dependencies
59
37
 
60
- Record evidence before review:
38
+ Create/refine/check the plan, expand it into independently verifiable tasks, then `planr map build --from <plan-id>`. Annotate routed work types before mapping or retag afterward.
61
39
 
62
- ```bash
63
- planr log add --item <item-id> \
64
- --summary "what changed" \
65
- --files file-a,file-b \
66
- --cmd "exact verification command"
67
- ```
40
+ Create ordering explicitly with `planr link add <earlier> <later> --type blocks`; readiness comes from graph state, not Markdown checkboxes. Validate generated order and remove only incorrect links. Use `planr item breakdown <parent> --into <child>...` for a parent gate; later top-level work depends on the parent, which rolls up after children settle.
68
41
 
69
- Granular alternative: request review, close review, then close the item:
42
+ ## Reviews And Approvals
70
43
 
71
- ```bash
72
- planr review request <item-id>
73
- planr review close <review-id> --verdict complete --close-target
74
- planr close <item-id> --summary "Verified with evidence"
75
- ```
44
+ Request review after completion evidence. A complete review may use `planr review close <review-id> --verdict complete --close-target`. Findings use `--verdict not-complete`; Planr creates fix and follow-up review work.
76
45
 
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.
46
+ Human gates use `planr approval request <item-id> --reason <reason>`. Never close with an open or denied approval.
78
47
 
79
- If human approval is part of the gate, request it and do not close until it is approved:
48
+ ## Handoff And Recovery
80
49
 
81
- ```bash
82
- planr approval request <item-id> --reason "release approval"
83
- planr approval list --open
84
- ```
50
+ Use item notes for nearby handoff and contexts for reusable decisions. Logs are evidence, not chat summaries.
85
51
 
86
- If review finds issues:
87
-
88
- ```bash
89
- planr review close <review-id> \
90
- --verdict not-complete \
91
- --findings "specific actionable finding"
92
- planr map show --json
93
- planr pick --json
94
- ```
95
-
96
- Planr creates fix and follow-up review work instead of pretending the parent item is done.
97
-
98
- ## Planning Flow
99
-
100
- For broad app or product work:
101
-
102
- ```bash
103
- planr plan new "App idea" --platform web --ai --backend
104
- planr plan refine <plan-id> --note "Assumption or decision"
105
- planr plan split <plan-id> --slice "MVP implementation"
106
- planr plan check <build-plan-id>
107
- planr map build --from <build-plan-id>
108
- ```
109
-
110
- Product plan work lists are candidates. They become live commitments only after `planr map build --from ...`.
111
-
112
- `map build` creates items without ordering: everything starts ready. Linking is mandatory before the first pick — add a `blocks` link for every real execution dependency:
113
-
114
- ```bash
115
- planr link add <earlier-item> <later-item> --type blocks
116
- planr map lane --critical
117
- ```
118
-
119
- Do not pick from a freshly built map that has zero links unless the items are genuinely independent.
120
-
121
- When `planr agents list --json` shows routes with use-case `work_type` selectors (e.g. `frontend`, `backend`), retag freshly built items to match their work (`planr item update <id> --work-type frontend`) so pick packets carry the declared profile, model, and paired skill. This is the agent's job — never the user's; items matching no route keep `code` and fall to the default route.
122
-
123
- ## Parent Gate Pattern
124
-
125
- Model material changes as parent gates. The parent is the completion gate; linked children do the work.
126
-
127
- Default shape:
128
-
129
- ```text
130
- parent gate
131
- `- implementation or test child
132
- `- review item linked to that child
133
- |- pass -> child can close -> parent gate auto-closes
134
- `- findings -> fix item -> follow-up review -> ...
135
- ```
136
-
137
- Rules:
138
-
139
- - create a parent item for the change;
140
- - use `planr item breakdown <parent-id> --into "Implement" --into "Verify"` (one `--into` per child; a single value may also pack newline- or comma-separated titles) to create chained child work under that parent — the output lists every child with id and status plus the next pick command;
141
- - request review on the implementation or test child after evidence exists;
142
- - if review finds issues, let Planr create fix and follow-up review work from the review verdict;
143
- - make later top-level work depend on the parent gate, not only the first child.
144
-
145
- Parent gates roll up on their own: when every child is settled, the gate auto-closes unless a review or approval on the gate itself is still open. Do not pick a parent gate as work; `planr pick` skips them.
146
-
147
- ## Dependencies
148
-
149
- Create ordering explicitly:
150
-
151
- ```bash
152
- planr item create "Design API" --description "Define endpoints and data ownership."
153
- planr item create "Implement API" --description "Build endpoints after design is closed."
154
- planr link add <design-item> <implementation-item> --type blocks
155
- ```
156
-
157
- Readiness comes from graph links and item state, not Markdown checkboxes.
158
-
159
- Use:
160
-
161
- ```bash
162
- planr item breakdown <item-id> --into "Trace owner" --into "Implement" --into "Verify"
163
- planr link remove <from-item> <to-item> --type blocks
164
- ```
165
-
166
- ## Handoff Evidence
167
-
168
- Every closure must be evidence-backed:
169
-
170
- - changed files through `--files`;
171
- - commands through `--cmd`;
172
- - tests through `--tests`;
173
- - remaining risks through context, notes, or findings;
174
- - review outcome through `planr review ...`.
175
-
176
- Use task-local notes for nearby handoff:
177
-
178
- ```bash
179
- planr note add "Reviewer asked for an extra package dry-run before closure." --item <item-id>
180
- ```
181
-
182
- Use contexts for reusable project knowledge:
183
-
184
- ```bash
185
- planr context add "Do not edit global client config without explicit operator approval." --tag constraint
186
- ```
187
-
188
- Use a story log only when map state, logs, and contexts are too thin to preserve the decision chain. Story logs are narrative memory, not status authority.
189
-
190
- ## Recovery
191
-
192
- After interruption or handoff:
193
-
194
- ```bash
195
- git status --short
196
- planr project show --json
197
- planr map show --json
198
- planr map lane --critical
199
- planr map pressure
200
- ```
201
-
202
- Then inspect the item:
52
+ After interruption inspect Git status, map state, then:
203
53
 
204
54
  ```bash
205
55
  planr trace item <item-id>
206
56
  planr log list --item <item-id>
207
57
  planr context list --item <item-id>
208
- ```
209
-
210
- If a stale pick must be reset:
211
-
212
- ```bash
213
58
  planr pick stale --older-than-seconds 900
214
- planr pick stale --older-than-seconds 900 --release
215
- planr pick release <item-id> --force
216
59
  ```
217
60
 
218
- ## Completion Rule
219
-
220
- Do not call work complete until:
221
-
222
- - required child and review items are closed;
223
- - approval gates are approved or absent;
224
- - log evidence exists;
225
- - verification commands were actually run;
226
- - review findings are closed or converted into follow-up work;
227
- - `planr map show --json` shows no in-scope blocker;
228
- - the user-facing summary matches map, logs, and review state.
229
-
230
- For release-grade scopes, rerun the full verification ladder from the repository testing guide.
61
+ Release stale ownership only after inspection. Do not claim completion until children and reviews are closed, approvals are clear, verification commands ran, findings became settled follow-up work, and the user-facing summary matches Planr state.
package/docs/CI.md DELETED
@@ -1,54 +0,0 @@
1
- # CI
2
-
3
- Planr CI is defined in `.github/workflows/ci.yml` and `.github/workflows/security.yml`.
4
-
5
- ## Required Gates
6
-
7
- The main CI workflow runs:
8
-
9
- ```bash
10
- cargo fmt --check
11
- cargo clippy --all-targets -- -D warnings
12
- cargo test
13
- shellcheck scripts/*.sh
14
- cargo build --release
15
- npm pack --dry-run
16
- node npm/bin/planr.js --version
17
- cargo audit --deny warnings
18
- ```
19
-
20
- The security workflow runs a GitHub Actions security scan with pinned `zizmor`.
21
-
22
- ## Local Reproduction
23
-
24
- Run the full local gate:
25
-
26
- ```bash
27
- scripts/ci-local.sh
28
- ```
29
-
30
- `scripts/ci-local.sh` also runs the external consumer E2E project when `/Users/kregenrek/projects/planr-test` exists:
31
-
32
- ```bash
33
- cd /Users/kregenrek/projects/planr-test
34
- npm test
35
- npm run test:npm-planr
36
- ```
37
-
38
- Run local security and leak checks:
39
-
40
- ```bash
41
- scripts/security-local.sh
42
- ```
43
-
44
- This uses BetterLeaks for secret history scanning and Trivy for filesystem vulnerability, secret, and misconfiguration scanning.
45
-
46
- ## Supply Chain
47
-
48
- Dependabot is configured in `.github/dependabot.yml` for:
49
-
50
- - Cargo dependencies
51
- - npm dependencies
52
- - GitHub Actions
53
-
54
- GitHub Actions use read-only default permissions and pin checkout by commit SHA.
@@ -1,52 +0,0 @@
1
- # Claude Code Integration
2
-
3
- ## Plugin (preferred for skills)
4
-
5
- The Planr repository is a Claude Code plugin. Install it to get the skills (namespaced as `/planr:planr`, `/planr:planr-loop`, ...) plus the `planr-worker` and `planr-reviewer` subagents:
6
-
7
- ```text
8
- /plugin marketplace add instructa/planr
9
- /plugin install planr@planr
10
- ```
11
-
12
- See [Skills](SKILLS.md) for the skill workflow. For autonomous goal runs with `/goal` or `/loop` on top of Planr state, see [Long-Running Goals](GOALS.md).
13
-
14
- ## Long-Running Goals With `/goal`
15
-
16
- Claude Code `/goal` drives autonomous Planr runs the same way Codex does: `/goal` supplies continuation pressure, Planr supplies durable state, evidence, reviews, and recovery. Run the driver session on your strongest model (`/model fable`, `/effort high`), prep once, then start:
17
-
18
- ```text
19
- /planr:planr-goal <your goal>
20
- /goal Use $planr-loop on plan <plan-id>. The loop contract is stored in planr context (tag: goal-contract). Continue until the contract holds or the iteration budget is exhausted. You are operating autonomously: the user is not watching, so never end a turn on a plan, a question, or a promise — proceed until the contract holds or you are blocked on input only the user can provide.
21
- ```
22
-
23
- The plugin registers the `planr-worker` and `planr-reviewer` subagents automatically. The worker pins a cheaper tier in its frontmatter; the reviewer deliberately inherits the driver's model:
24
-
25
- ```yaml
26
- # planr-worker.md frontmatter
27
- model: opus # alias tracks the current generation; budget alternative: sonnet
28
- effort: medium
29
- ```
30
-
31
- Verify the pin once: `CLAUDE_CODE_SUBAGENT_MODEL` must be unset (it silently overrides all subagent frontmatter), then dispatch the worker on a trivial item and confirm the subagent's messages in `~/.claude/projects/<project>/*.jsonl` carry the worker model. Full workflow, recovery, and the tiering rationale: [Long-Running Goals](GOALS.md).
32
-
33
- ## MCP
34
-
35
- ```bash
36
- planr install claude --dry-run
37
- planr install claude
38
- planr doctor --client claude
39
- ```
40
-
41
- Dry-run prints both project-scope `.mcp.json` content and the optional user-scope CLI form. The non-dry command writes this repository's `.mcp.json`, standalone worker/reviewer roles, and additive fail-open session hooks. Workflow skills and plugin agents come from the Claude Code plugin. Use `--no-mcp` to omit `.mcp.json`, or `--no-hooks` to omit hook reconciliation.
42
-
43
- Claude Code should treat Planr map state as authoritative and use Markdown plans as context.
44
-
45
- For repo-local review feedback, write JSON to a file and ingest it:
46
-
47
- ```bash
48
- planr review ingest <item-id> --from .planr/tmp/claude-review.json
49
- planr review artifact <review-item-id>
50
- ```
51
-
52
- Planr does not edit global Claude Code configuration. Project hooks live in `.claude/settings.json`, preserve foreign entries, and can be omitted with `--no-hooks`. The review item remains open until `planr review close` records the final verdict.
@@ -1,160 +0,0 @@
1
- # CLI Reference
2
-
3
- Generated from `planr --help` shape for V1.
4
-
5
- ```text
6
- planr project init [--client codex|claude|cursor|all] [--force] [name]
7
- planr project show [--json]
8
- planr project list [--json]
9
- planr plan new "App idea" [--platform web] [--ai] [--backend]
10
- planr plan refine <plan-id> [--note "..."]
11
- planr plan split <plan-id> --slice "MVP backend"
12
- planr plan check <plan-id>
13
- planr plan audit <plan-id>
14
- planr plan show <plan-id>
15
- planr plan archive <plan-id>
16
- planr map show [--plan <plan-id>] [--view tree|diagram] [--full]
17
- planr map watch [--plan <plan-id>] [--view tree|diagram] [--full] [--interval-ms 1000] [--no-clear] [--until-settled]
18
- planr map build --from <plan-id>
19
- planr map lane --critical
20
- planr map pressure
21
- planr map status
22
- planr map preview --close <item-id>
23
- planr map unlocks <item-id>
24
- planr map lookahead [--from <item-id>] [--limit 10]
25
- planr item create "title" --description "..." [--after <item-id>] [--timeout-seconds N] [--max-retries N] [--retry-backoff fixed|exponential] [--retry-delay-ms N] [--pre "..."] [--post "..."]
26
- planr item breakdown <item-id> --into "A" --into "B" [--into "C"]
27
- planr item insert "title" --description "..." --after <item-id> [--before <item-id>] [--preview|--confirm]
28
- planr item amend <item-id> --note "..." [--tag amendment]
29
- planr item replan <parent-id> --into "A, B, C" [--preview|--confirm]
30
- planr item update <item-id> [--title "..."] [--description "..."] [--work-type <type>]
31
- # plan task lists can declare work types inline: `### TASK-001 (backend): ...` / `- [ ] (frontend) ...` seed map build directly
32
- planr item route <item-id> [--set <profile>|--clear]
33
- planr link add <from-item> <to-item> --type blocks
34
- planr prime [--hook-json]
35
- planr pick [--work-type <type>] [--plan <plan-id>] [--peek]
36
- planr pick release <item-id> [--force]
37
- planr pick heartbeat [item-id]
38
- planr pick progress <item-id> --percent 0..100 [--note "..."]
39
- planr pick pause <item-id> [--note "..."]
40
- planr pick resume <item-id>
41
- planr pick stale [--older-than-seconds 900] [--release]
42
- planr recover sweep [--older-than-seconds 900] [--apply]
43
- planr approval request <item-id> [--reason "..."]
44
- planr approval approve <item-id> --by "name" [--comment "..."]
45
- planr approval deny <item-id> --by "name" [--comment "..."]
46
- planr approval list [--open]
47
- planr artifact add "name"|--name "name" [--item <item-id>] [--kind evidence] [--path file] [--content "..."] [--mime text/plain]
48
- # --kind is free-form vocabulary; common values: evidence, screenshot, video, recording, report, review
49
- planr artifact show <artifact-id>
50
- planr artifact list [--item <item-id>]
51
- planr event list [--item <item-id>] [--limit 50]
52
- planr debug bundle [--item <item-id>] --preview
53
- planr trace item <item-id>
54
- planr log add --item <item-id> --summary "..." [--files a --files b | --files a,b] [--cmd "..."] [--kind completion|progress|verification] [--profile <id>] [--route-audit <observation.json>]
55
- # machine consumers: --cmd writes the `commands` field in log JSON; --tests writes `tests`
56
- planr review request <item-id>
57
- planr review annotate <item-id> --message "..." [--severity info|warning|blocking] [--file path] [--line N] [--author "..."]
58
- planr review ingest <item-id> (--from feedback.json|--stdin)
59
- planr review artifact <review-item-id> [--out .planr/reviews/custom.review.md]
60
- planr review evidence <item-id> [--pr-url https://...]
61
- planr review close <review-item-id> --verdict complete|not-complete|unclear [--close-target]
62
- planr close [item-id] --summary "..." [--next]
63
- planr done [item-id] --summary "..." [--files a --files b] [--cmd "..."] [--tests "..."] [--review] [--next] [--profile <id>]
64
- planr context add "text" [--item <item-id>] [--tag discovery]
65
- planr context list [--item <item-id>] [--tag <tag>]
66
- planr search "query"
67
- planr agents init [--force]
68
- planr agents init --profile|--skill|--route|--default-route|--interactive
69
- planr agents list [--json]
70
- planr agents check
71
- planr doctor [--client codex|claude|cursor|all]
72
- planr install codex|claude|cursor [--dry-run] [--no-mcp] [--force] [--no-hooks]
73
- planr prompt cli|mcp|http [--client codex|claude|cursor|all]
74
- planr prompt routing [--client codex|claude|cursor|all]
75
- planr mcp
76
- planr serve --port 7526
77
- planr import <file> [--preview] [--confirm]
78
- planr export --out planr.json [--include-plans] [--include-logs] [--template-name "..."] [--tag tag]
79
- ```
80
-
81
- Global flags: `--db <path>`, `--json`, `--no-color`. They are valid in both positions: `planr --json pick` and `planr pick --json` behave identically. Human map output uses ANSI status colors only when stdout is an interactive terminal. `--no-color`, `NO_COLOR` (even when empty), `TERM=dumb`, redirected stdout, and JSON disable color; `PLANR_FORCE_COLOR=1` is available for compatible terminal wrappers and tests, but never overrides an explicit opt-out.
82
-
83
- ## JSON Envelope Convention
84
-
85
- With `--json`, responses follow one convention so agents never guess where data lives:
86
-
87
- - Errors: `{"error": {"code": "...", "message": "..."}}` with a non-zero exit code. Codes include `not_found`, `invalid_transition`, `already_closed`, `bad_request`, `locked`, `parse_error`, and `internal_error`. `invalid_transition` messages carry the exact repair command for the current state (e.g. which review to close, which approval to resolve, or that blockers must settle first) — the error is the instruction.
88
- - List fields on logs (`files`, `commands`, `tests`, `review_findings`) are always arrays — `[]` when empty, never `null`.
89
- - The affected single item is always available under the top-level `item` key (`pick`, `close`, `item create/update/cancel`, `pick release`, `item breakdown`, approval and runtime commands). Action-specific keys like `closed`, `cancelled`, or `released` carry the id and stay for context.
90
- - Collections use plural keys: `items`, `plans`, `logs`, `reviews`, `artifacts`, `approvals`, `events`.
91
- - Other single objects use their semantic key: `plan`, `log`, `review`, `artifact`, `context`.
92
- - Optional guidance appears under `hint` or `next` when a follow-up command is the expected move.
93
-
94
- `plan check` validates path, YAML frontmatter, and that required sections have content: build plans need `## Scope Decision`, `## Verification`, and `## Acceptance Criteria` filled; product plans need `## Problem`, `## Requirements`, and `## Success Criteria` filled in `PRODUCT_SPEC.md`. It also flags a task list that still contains only the scaffold placeholder (or no work specs at all) — `map build` would turn that into a single coarse item, so the fix names the granularity contract: one `### TASK-00n:` heading (or `- [ ]` line) per verifiable slice, typically 4-8, in execution order. Each warning is structured — `{"file", "section", "message", "fix"}` — and names the exact file to edit plus the re-run command, so a failed check is a repair instruction, not a riddle.
95
-
96
- `plan audit <plan-id>` is the one-call contract verdict for a plan's map scope. JSON shape for machine consumers: top-level `holds` (bool) and `clauses[]` with `clause` (name) and `pass` (bool) — e.g. `planr plan audit <id> --json | jq '.holds, (.clauses[] | {clause, pass})'`. It evaluates four clauses with evidence: `items_settled` (open items listed), `reviews_complete` (open review items listed), `approvals_clear` (requested/denied approvals listed), and `verification_logged` (logs with `--kind verification` on scope items). The stored goal contract (`planr context --tag goal-contract` mentioning the plan id) is included; the verification clause is binding only when such a contract exists. `holds: true` means the contract is satisfied — loop agents use this as their stop condition instead of stitching the verdict together from `map status`, `log list`, and `approval list`. When the contract is open, `next` carries the exact next command derived from the first actionable gap: build the map, pick the ready review or work item (plan-scoped), resolve the blocking approval, inspect stalled leases, or log the missing verification. Also available as MCP `planr_plan_audit`.
97
-
98
- `map show` defaults to the compact `tree` view used by agents and existing terminal workflows; coding agents should prefer `map show --json` when they need structured state. The tree keeps the canonical edge vocabulary visible: active dependencies render as red `blocks`, while an edge satisfied by a `closed` or `closed_partial` upstream renders as dim `blocks✓`. `map show --view diagram` is exclusively a human-supervision view and coding agents must not invoke it. It provides fixed-width boxes with at most two content lines in `ICON ITEM-ID → TITLE` form, translating satisfied `blocks` edges to neutral `then` while active or cancelled blockers remain `blocks`; `hands_to`, joins, disconnected components, and cycle warnings remain explicit. Humans can add `--full` for verbose nodes with status words, complete wrapped titles, active workers, critical-lane markers, and downstream pressure. `--full` is rejected with tree view. This is a read-only presentation over the same canonical map projection; JSON/MCP/HTTP always retain the stored `kind: "blocks"` and are identical across diagram detail choices.
99
-
100
- `map show --plan <plan-id>` narrows either human view to one plan's items and the links among them, with plan-scoped counts — plan-scoped goal runs on shared boards audit their slice, not the whole board. An unknown plan id is an error, never a silent unscoped view. Also available on MCP `planr_map_show` (`plan`) and HTTP `GET /v1/projects/{id}/map?plan=<plan-id>`.
101
-
102
- `map watch` is the read-only live companion for a second human terminal. Coding agents must not invoke it; they should use `map show --json` snapshots or `planr serve` plus `/v1/events/stream`. Watch defaults to the condensed `--view diagram`, polls every 1000 ms, compares the canonical scoped projection, and clears/redraws an interactive terminal only when graph state changes. `--full`, `--view tree`, `--plan <plan-id>`, `--interval-ms <n>` (minimum 100), `--no-clear`, and `--until-settled` control presentation and lifetime; Ctrl-C uses normal process interruption. JSON mode remains rejected because watch is intentionally human-only.
103
-
104
- `context list --tag <tag>` filters notes by the tag they were stored with (`context add --tag`), so e.g. the goal contract is recoverable with `planr context list --tag goal-contract` instead of scanning all notes.
105
-
106
- `map build` chains the created items in plan order with `blocks` links — build plan steps are ordered, so the map inherits that order instead of leaving everything flat. The output lists every created item with its status, the created links, and the next command; adjust order with `planr link add` before picking if execution order differs from document order.
107
-
108
- `item breakdown` follows the same contract: each `--into` flag carries one child title (a single value may also pack newline- or comma-separated titles), children are chained with `blocks` links in the given order, and the parent parks as a blocked gate until they settle. The output lists every child with id and status, the chain links, and the next command — across CLI and MCP `planr_item_breakdown`.
109
-
110
- `review ingest` accepts hook-compatible JSON and records it as feedback only. It never closes review work and never approves an item by itself.
111
-
112
- ```json
113
- {
114
- "reviewer": "local-reviewer",
115
- "verdict": "not-complete",
116
- "findings": ["Add the missing failing-path test"],
117
- "annotations": [
118
- {
119
- "message": "The close path needs regression coverage",
120
- "severity": "blocking",
121
- "file": "tests/e2e.rs",
122
- "line": 42
123
- }
124
- ]
125
- }
126
- ```
127
-
128
- `review request` (and `done --review`) moves a picked or running target to `in_review`: work is finished, evidence is logged, the item waits on its gate. The owner keeps the pick and can still log evidence; `in_review` items are never handed out by `pick`. Reviews are gates, so pre-attaching one to a pending or blocked item is legal (the target keeps its status and the gate holds the close later); requesting a review on a settled item fails with `invalid_transition`. `done` on a ready item that was never picked adopts it first — the lease is written retroactively under the current worker, so the completion always carries a maker identity and the `in_review` transition is never skipped. The `done --review` response names the target's resulting status and a plan-scoped reviewer pick command (`next: planr pick --plan <id> --work-type review --json`).
129
-
130
- `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; the follow-up review gates the same target item, so the chain keeps working with `--close-target`. With `--close-target` (complete verdicts only) the reviewed item is closed in the same command, provided it already has a completion log; the artifact is rendered after the target transition, so it snapshots the final target status. `--close-target` is also available through MCP `planr_review_close` and HTTP `POST /v1/reviews/{id}/close` (`"close_target": true`). `review close` responses include the same `remaining` progress snapshot as `done` and `close`. `--reviewer <id>` records the checker's identity on the review log, artifact, and event (defaults to the worker id), keeping maker and checker distinguishable in the audit trail. Closing an already-settled review fails with error code `already_closed` instead of silently duplicating evidence logs. The maker/checker split is derived, not declared: `review_mode` compares the closing reviewer identity against the target item's lease holder and reports `single_agent`, `independent`, or `unattributed` in the response, review log, artifact, and event — no ceremony note required. An `unattributed` close explains itself in the output: it means the target has no recorded lease (work was never picked or its lease was released), not that the reviewer's identity was missing.
131
-
132
- `trace item` on a review item inlines the target item and its evidence logs under `target`, so a reviewer's first trace already contains what is being audited. The human (non-JSON) mode renders the packet: status, owner, links, logs. When the item has a declared route, a run profile, or a route observation, the trace gains a `routing` section — the declared route next to every run's actual client/profile and, when supplied, its independent requested → resolved → effective model/effort/context-fork stages, transition reason, policy/binding provenance, and per-dimension metering confidence. Unknown effective host values remain `null`/`unavailable`; requested values are never copied forward as proof. MCP `planr_trace_item` returns the identical JSON shape.
133
-
134
- `doctor` also reports the agent registry in all states without ever failing: absent (informational hint), degraded (parse error with line context), or loaded with profile/route counts, validation warnings, and per-artifact drift — a rendered role file whose content no longer matches what the current registry would render is flagged `drifted` with a `planr install <client> --force` hint, while files without the generated-from header are the user's (`manual`) and never flagged.
135
-
136
- `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`). Without `--next`, the response's `next` field carries the exact follow-up command instead (`planr pick --work-type review --json` after a review request, `planr pick --json` after a close), so every settlement output ends in an action. It chains the same single-owner operations as `log add`, `review request`, `close`, and `pick` — identical evidence, fewer commands. `done`, `close`, and `review close` report what the settlement `unlocked` (id, title, work type of every item that became ready), `done` and `close` echo the item's `post_condition` at completion time, and a `hint` asks for `--cmd`/`--tests` evidence when downstream items depend on an item that closed without any. `done`, `close`, `review close`, and the pick packet include a `remaining` progress snapshot so loop agents can evaluate their stop condition without an extra `map status` call. `remaining.counts` always carries the full status vocabulary (`pending`, `ready`, `picked`, `running`, `in_review`, `blocked`, `failed`, `cancelled`, `closed`, `closed_partial`) with explicit zeros — a missing count never has to be inferred.
137
-
138
- `prime` prints the compact state block host hooks inject at session start and after context compaction (project, map counts, held items with log status, goal contract, registry presence, next command); `--hook-json` emits the Claude Code SessionStart envelope. In a repo without a Planr database it exits silently and creates nothing — hooks must never break a session. Installs wire it into the host's hook system by default (`--no-hooks` skips; existing hook files are merged additively, never overwritten). Full guide: [Host Hooks](HOOKS.md).
139
-
140
- `pick --json` returns one flat work packet in which every fact appears exactly once: `item`, `links`, `logs`, `runtime`, `recovery`, `conditions`, `approval`, recall context (`contexts`, `relevant_contexts`, `upstream_handoffs`, `review_history`, `source_links`, `possible_file_conflicts`), `close_effect`, `privacy`, `deeper_reads`, and `remaining`. Worker identity lives in `item.worker_id` and `runtime.worker_id`. Empty collections and inactive gates are omitted — a missing key means "empty". No separate `trace item` call is needed. Evidence written via `log add` or `done` by the pick owner refreshes the runtime heartbeat automatically. The same packet shape is returned by MCP `planr_pick_item`, HTTP `POST /v1/pick`, and `done --next`. `pick --peek` (MCP: `"peek": true`) returns the same packet for the next pickable item *without* leasing it — no lease, heartbeat, or pick event is written, and the packet carries `"peek": true` with the item still `ready`. Built for dispatching drivers: read the routing block, dispatch the worker, and let the worker take the lease under its own identity — replacing the pick → `pick release --force` → re-pick sequence.
141
-
142
- `pick --work-type <type>` restricts the lease to one work type, so checker agents pick only `review` items and makers only work items. `pick --plan <plan-id>` restricts the lease to one plan's items, so plan-scoped goal runs never pick work outside their contract even when other plans share the board; an unknown plan id is an error, never a silent unscoped pick. Both filters are available on MCP `planr_pick_item` and HTTP `POST /v1/pick` (`work_type`, `plan`). A null pick is never blind: `{"item": null}` carries a `reason` (`empty_map`, `all_settled`, `nothing_ready`, `ready_items_excluded_by_filter`) and the `remaining` snapshot. When ready work exists but the active filters rejected all of it, `excluded` lists each ready item with the cause (`work_type` mismatch, outside the `--plan` scope, or just requested by this worker) and `repair` carries the exact pick commands that would lease that work — across CLI, MCP, and HTTP. On a review item, `close_effect` previews the full `--close-target` cascade: it lists the work that closing the review (and with it the reviewed item) would unlock.
143
-
144
- `policy show` and `policy check` inspect the provider-neutral Usage Policy v1 file (`.planr/policy.toml`). A missing policy is an explicit successful state that preserves existing advisory routing; a malformed or unsafe policy fails `check` with parser/field diagnostics and leaves enforcement unavailable. Usage Policy v1 fixes delegation depth at one and keeps retry, availability fallback, quality escalation, quota downgrade, and safety stop as distinct transition contracts. Its separate `execution` section declares bounded per-role filesystem, network, tool/MCP, structured command, environment, hook, secret-reference, and approval grants. `policy admit <request.json>` requires the picked item's current `item_id` and `pick_token`, authorizes the current worker as lease owner, evaluates a bounded task contract before delegation, previews any permission addition, records the decision and lease generation, rejects unclassified commands and destructive or out-of-scope work, permits overlapping readers, and admits concurrent writers only for disjoint scopes isolated in distinct worktrees. Released or recovered leases never inherit historical admitted scopes. MCP `planr_policy_show`, `planr_policy_check`, and `planr_policy_admit`, plus HTTP `POST /v1/policy/admit`, call the same admission service and return the same decision shape.
145
-
146
- `agents init` writes a provider-neutral `.planr/agents.toml` scaffold or compiles explicit profile and route flags. `agents list` and `agents check` inspect it, while pick packets carry the resolved opaque profile, host, model, effort, tier, skill, route chain, and matched selector. Full guide: [Model Routing](MODEL_ROUTING.md).
147
-
148
- `log add` and `done` accept `--profile <id>` — the registry profile the run actually executed on (`PLANR_PROFILE` env is the fallback, so rendered role files can export it). They also accept `--route-audit <observation.json>` for the strict three-stage observation contract. A route audit records each stage's model, effort, and context-fork value with enforcement state (`verified`, `requested_only`, `estimated`, or `unavailable`), an evidence-source enum, typed transition plus reason, policy/binding ids and versions, and wall-time/tool/token/credit values with independent confidence. It is stored in run metadata, projected into its durable log and trace, and emits local route-stage/transition events. The profile remains backward compatible: when it differs from the item's declared route, Planr emits advisory `route_mismatch_observed`. Runs without commands/tests record neither a run nor a route observation. MCP `planr_log_add` and HTTP item log accept the same optional `route_observation` object.
149
-
150
- `artifact add` infers the mime type from the file extension when `--path` is given without `--mime` (PNG screenshots land as `image/png`, not `text/plain`); inline `--content` defaults to `text/plain`. The same inference applies on MCP `planr_artifact_add` and HTTP `POST /v1/artifacts`.
151
-
152
- `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.
153
-
154
- `recover sweep` previews by default. With `--apply`, timed-out picked work that has a retry budget (`max_retries > 0`) is marked `failed` with an `item_timed_out` event; stale work and timeouts without a retry budget are released back to `ready`. Failed work re-enters `ready` once its retry delay has elapsed (`retry_delay_ms`, doubled per retry under `exponential` backoff) until the budget is exhausted. Every transition records a recovery event. Item pre/post conditions are visible in pick context, trace output, and close previews; post conditions are reported as manual verification gates instead of being guessed automatically.
155
-
156
- `serve` exposes the local review workspace at `/review` and its JSON projection at `/v1/review-workspace`.
157
-
158
- `prompt` prints ready-to-use agent instructions without editing global config. Use `prompt cli` for shell agents, `prompt mcp` for MCP setup text, and `prompt http` for localhost automation/review workspace usage. `prompt routing` emits a paste-ready model-prioritization block for the driver session: the route table from `.planr/agents.toml` (every route, profile, and fallback), native Codex `agent_type` plus explicit fork guidance referring to the generated repository role TOMLs, the Claude `CLAUDE_CODE_SUBAGENT_MODEL` env preemption, Cursor's silent plan/policy/Max-Mode overrides, and process-dispatch snippets (`pi`, `opencode run`) only for hosts without role files. `--json` carries the same content structured, and a missing or unreadable registry still prints the host guidance with a pointer instead of failing.
159
-
160
- `export` writes a reusable Planr JSON package with package requirements metadata, graph state, contexts, optional logs, optional plan file snapshots, review artifact snapshots, and — when present — the agent registry (`.planr/agents.toml`) as a raw snapshot. `import` previews JSON packages by default and mutates only with `--confirm`; the preview names the registry with its exact action (`create`, `identical`, or `conflict`), and an existing registry that differs is never overwritten — the conflict is reported with a hint to remove the local file first. Packages without a registry import unchanged.
package/docs/CODEX.md DELETED
@@ -1,56 +0,0 @@
1
- # Codex Integration
2
-
3
- ## Plugin (preferred for skills)
4
-
5
- The Planr repository is a Codex plugin. Install it to get the `$planr`, `$planr-loop`, and stage skills without copying folders:
6
-
7
- ```bash
8
- codex plugin marketplace add instructa/planr
9
- codex plugin add planr@planr
10
- ```
11
-
12
- See [Skills](SKILLS.md) for the skill workflow and subagent role templates.
13
-
14
- ## Long-Running Goals With `/goal`
15
-
16
- Codex `/goal` is the recommended orchestrator for autonomous Planr runs: `/goal` supplies continuation pressure, Planr supplies durable state, evidence, reviews, and recovery. Prep once with `$planr-goal`, then start:
17
-
18
- ```text
19
- $planr-goal <your goal>
20
- /goal Use $planr-loop on plan <plan-id>. The loop contract is stored in planr context (tag: goal-contract). Continue until the contract holds or the iteration budget is exhausted. You are operating autonomously: the user is not watching, so never end a turn on a plan, a question, or a promise — proceed until the contract holds or you are blocked on input only the user can provide.
21
- ```
22
-
23
- The stop condition lives in Planr (`--tag goal-contract`), so a dead session resumes with the same starter line from zero chat context.
24
-
25
- Optionally prepare repository-local routing declarations before starting the driver. Planr reads `.planr/agents.toml` and `.planr/policy.toml`; external tools such as [Switchloom v0.2.1](https://github.com/instructa/switchloom/releases/tag/v0.2.1) own any generated roles, application, or uninstall lifecycle:
26
-
27
- ```bash
28
- planr agents check
29
- ```
30
-
31
- Follow any externally generated repository role instructions outside Planr, restart after role changes when your host requires it, and confirm child metadata reports the expected model, effort, role path, and context-fork behavior. Full workflow: [Long-Running Goals](GOALS.md).
32
-
33
- ## MCP
34
-
35
- ```bash
36
- planr install codex --dry-run
37
- planr doctor --client codex
38
- ```
39
-
40
- The dry-run prints the MCP server snippet for `planr mcp`. Verify the client-side registration with the Codex CLI command shown by your local Codex installation.
41
-
42
- Codex should use the same public flow as every other client:
43
-
44
- ```text
45
- map -> pick -> work -> log -> review -> close
46
- ```
47
-
48
- Review hooks can feed Planr without changing global Codex settings:
49
-
50
- ```bash
51
- codex review --json > .planr/tmp/codex-review.json
52
- planr review ingest <item-id> --from .planr/tmp/codex-review.json
53
- planr review annotate <item-id> --message "Needs regression coverage" --severity blocking
54
- ```
55
-
56
- Ingested feedback is evidence only. A reviewer or agent must still close the review item explicitly with `planr review close`.