planr 1.6.0 → 1.7.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.
@@ -49,6 +49,16 @@ Planr V1 is a single Rust binary with explicit module ownership. The crate stays
49
49
  - `src/rolefiles.rs`: static host workflow roles and Cursor skill payloads. It does not select or pin models; externally generated routing artifacts stay outside Planr ownership.
50
50
  - `src/util.rs`: small CLI-boundary utilities. Owns ids, timestamps, path helpers, output formatting, and safe file writes.
51
51
 
52
+ ## Eval Contract V1/V1.1 Ownership
53
+
54
+ The frozen product contract lives in `docs/planr-spec/EVAL_CONTRACT_V1.md` until implementation promotes it into code. Its V1.1 efficiency-evidence amendment is additive and keeps the same owner split:
55
+
56
+ - repository EvalSuite manifests and fixtures are authored inputs;
57
+ - the suite loader owns validation, safe path resolution, normalization, canonical ordering, and digests;
58
+ - SQLite owns immutable suite snapshots, runs, case results, samples, attempt lineage, metering-basis provenance, comparisons, invalidations, rescoring provenance, and eval evidence references;
59
+ - the comparison engine owns verdicts, reason codes, matched effective-treatment compatibility, and derived failure-inclusive efficiency metrics;
60
+ - existing map/log/review/approval state remains authoritative for work closure, so eval evidence may support a review but must never close or reopen items by itself.
61
+
52
62
  ## Boundary Rules
53
63
 
54
64
  - Command parsing belongs in `src/cli.rs`; process startup belongs in `src/main.rs`; command execution belongs under `src/app/`.
package/docs/CI.md CHANGED
@@ -27,10 +27,11 @@ Run the full local gate:
27
27
  scripts/ci-local.sh
28
28
  ```
29
29
 
30
- `scripts/ci-local.sh` also runs the external consumer E2E project when `/Users/kregenrek/projects/planr-test` exists:
30
+ `scripts/ci-local.sh` also runs the external consumer E2E project when the sibling `planr-test` checkout exists. Override its location with `PLANR_TEST_DIR`:
31
31
 
32
32
  ```bash
33
- cd /Users/kregenrek/projects/planr-test
33
+ PLANR_TEST_DIR=/path/to/planr-test scripts/ci-local.sh
34
+ cd /path/to/planr-test
34
35
  npm test
35
36
  npm run test:npm-planr
36
37
  ```
@@ -38,10 +39,10 @@ npm run test:npm-planr
38
39
  Run local security and leak checks:
39
40
 
40
41
  ```bash
41
- scripts/security-local.sh
42
+ npm run security:check
42
43
  ```
43
44
 
44
- This uses BetterLeaks for secret history scanning and Trivy for filesystem vulnerability, secret, and misconfiguration scanning.
45
+ This checks tracked files for machine-specific home paths, rejects forbidden staged paths, uses BetterLeaks for secret history scanning, and runs Trivy for filesystem vulnerability, secret, and misconfiguration scanning. If Lefthook is installed, run `lefthook install` once to activate the staged-path guard for commits and pushes.
45
46
 
46
47
  ## Supply Chain
47
48
 
@@ -59,6 +59,14 @@ planr review ingest <item-id> (--from feedback.json|--stdin)
59
59
  planr review artifact <review-item-id> [--out .planr/reviews/custom.review.md]
60
60
  planr review evidence <item-id> [--pr-url https://...]
61
61
  planr review close <review-item-id> --verdict complete|not-complete|unclear [--close-target]
62
+ planr eval suite-check --input suite.json
63
+ planr eval run --input run.json
64
+ planr eval show suite|run|comparison|invalidation <id>
65
+ planr eval compare <baseline-run-id> <candidate-run-id> [--policy-digest default]
66
+ planr eval gate <comparison-id>
67
+ planr eval invalidate run|comparison <target-id> --reason "..." [--reason-code code] [--replacement-hint "..."]
68
+ planr eval rescore <run-id> [--id <new-run-id>]
69
+ planr eval evidence-ref run|comparison <target-id> log|review|artifact <attachment-id> --item <item-id>
62
70
  planr close [item-id] --summary "..." [--next]
63
71
  planr done [item-id] --summary "..." [--files a --files b] [--cmd "..."] [--tests "..."] [--review] [--next] [--profile <id>]
64
72
  planr context add "text" [--item <item-id>] [--tag discovery]
@@ -129,6 +137,8 @@ With `--json`, responses follow one convention so agents never guess where data
129
137
 
130
138
  `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
139
 
140
+ `eval` exposes the same stored evaluation services to CLI and MCP. Every eval JSON response is one document with the frozen envelope `ok`, `command`, `object`, `warnings`, `reasons`, and `error`; MCP tools return the same envelope inside the text content, including `isError` tool results. `suite-check` reports command `eval.suite.check`, stores or verifies an immutable suite snapshot, `run` starts a run from a JSON envelope and can record cases/samples plus a terminal status, `compare` persists a verdict from two stored runs, and `gate` exits non-zero for `regressed` or `insufficient_evidence` while still printing the verdict, blocker, effects, uncertainty, coverage/freshness gates, and deeper-read commands. Eval exit codes are fixed: `0` for accepted command outcomes, `1` for regression or promotion-gate failure, `2` for insufficient evidence, `3` for invalid or unsafe input, and `4` for infrastructure errors such as missing stored runs. Error objects include `code`, `message`, `reasons`, and `field`. `invalidate` records invalidation evidence for a run or comparison, and `rescore` starts a new run linked back to the source run. `evidence-ref` attaches a run or comparison to an existing log, review item, or artifact for audit/package portability; it is never closure authority and never changes map item status. MCP mirrors these operations as `planr_eval_suite_check`, `planr_eval_run`, `planr_eval_show`, `planr_eval_compare`, `planr_eval_gate`, `planr_eval_invalidate`, `planr_eval_rescore`, and `planr_eval_evidence_ref`. A repository-owned smoke suite lives at `examples/eval/planr-lifecycle-smoke.suite.json`; recalculate fixture digests before using it outside repo-local examples.
141
+
132
142
  `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
143
 
134
144
  `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.
package/docs/IMPORT.md CHANGED
@@ -7,10 +7,12 @@ planr import planr-package.json --preview
7
7
  planr import planr-package.json --confirm
8
8
  ```
9
9
 
10
- Planr packages are local-first JSON files created by `planr export`. They carry graph items, links, contexts, optional logs, optional plan file snapshots, and review artifacts.
10
+ Planr packages are local-first JSON files created by `planr export`. They carry graph items, links, contexts, optional logs, optional eval evidence refs, optional plan file snapshots, and review artifacts.
11
11
 
12
12
  Imports are preview-first. Preview reports package metadata, create counts, and conflicting item ids before mutating the current project.
13
13
 
14
+ Eval evidence exports only when logs are included. Packages carry immutable eval suite snapshots, runs, case results, raw samples, comparisons, invalidations, and evidence refs so imported refs resolve to local eval records and comparison verdicts can be reproduced from restored run evidence. Import preflights the whole eval graph before inserting package rows: duplicate immutable ids inside the package must be byte/field-identical, suite/run/comparison/invalidation/ref dependencies must resolve, case sample ids must match nested samples, and eval refs must have `closure_authority: false`. Existing immutable eval ids are accepted only when their stored content exactly matches the package, and imported eval timestamps/provenance are preserved. Review refs must point at a real `work_type=review` item linked to the claimed item. Restoring audit provenance never closes work or changes map ownership.
15
+
14
16
  Planr packages are local-first JSON. For encrypted sharing, review the JSON locally and encrypt the file with your team's standard tool, for example:
15
17
 
16
18
  ```bash
@@ -41,6 +41,7 @@ Required groups:
41
41
  - approval request, approve, deny, and list
42
42
  - artifact add, list, and show
43
43
  - event list and debug bundle preview
44
+ - eval suite check, run, show, compare, gate, invalidate, rescore, and evidence refs
44
45
  - trace item, log add, and log read (including three-stage route observations)
45
46
  - provider-neutral agent registry reads and route overrides
46
47
  - review annotate, ingest, artifact, evidence, and close
@@ -60,6 +61,10 @@ Review feedback ingestion is advisory:
60
61
 
61
62
  HTTP mirrors the same rule: `GET /v1/reviews/:id/artifact` is read-only; `POST /v1/reviews/:id/artifact` writes an artifact explicitly.
62
63
 
64
+ ## Eval Evidence Contract
65
+
66
+ `planr_eval_evidence_ref` mirrors `planr eval evidence-ref`: it attaches an eval run or comparison id to an existing log, review item, or artifact. The returned eval envelope records `closure_authority: false`; eval verdicts are audit evidence only and never close, approve, or otherwise mutate map item status.
67
+
63
68
  ## Install Contract
64
69
 
65
70
  `planr install <client> --dry-run` prints the complete client-owned MCP, role, skill, and hook-reconciliation paths for Codex, Claude Code, and Cursor without writing them. Non-dry install writes only repository-local files, with this ownership contract:
package/docs/TESTING.md CHANGED
@@ -67,7 +67,7 @@ npm pack --dry-run
67
67
  Installer changes also require:
68
68
 
69
69
  ```bash
70
- /Users/kregenrek/.agents/skills/shellck/scripts/run_shellck.sh scripts/install.sh
70
+ $HOME/.agents/skills/shellck/scripts/run_shellck.sh scripts/install.sh
71
71
  PREFIX="$(mktemp -d)" PLANR_DOWNLOAD=1 PLANR_RELEASE_BASE_URL="file://$PWD/dist" scripts/install.sh
72
72
  ```
73
73
 
@@ -42,6 +42,14 @@
42
42
  "planr_artifact_show",
43
43
  "planr_event_list",
44
44
  "planr_debug_bundle",
45
+ "planr_eval_suite_check",
46
+ "planr_eval_run",
47
+ "planr_eval_show",
48
+ "planr_eval_compare",
49
+ "planr_eval_gate",
50
+ "planr_eval_invalidate",
51
+ "planr_eval_rescore",
52
+ "planr_eval_evidence_ref",
45
53
  "planr_log_add",
46
54
  "planr_review_annotate",
47
55
  "planr_review_ingest",
@@ -100,6 +108,10 @@
100
108
  "planr review artifact",
101
109
  "planr review evidence",
102
110
  "planr review close",
111
+ "planr eval suite-check",
112
+ "planr eval compare",
113
+ "planr eval gate",
114
+ "planr eval evidence-ref",
103
115
  "planr recover sweep",
104
116
  "planr agents list",
105
117
  "planr agents check",
@@ -1,5 +1,7 @@
1
1
  # API And Data Model
2
2
 
3
+ Eval Contract v1, including the additive v1.1 efficiency-evidence amendment, is frozen in [EVAL_CONTRACT_V1.md](EVAL_CONTRACT_V1.md). That document owns the canonical eval manifest fields, normalized snapshot, stored objects, attempt lineage, metering basis, effective treatment identity, derived efficiency metrics, status values, reason codes, evidence identities, response examples, exit codes, database rules, and safety constraints. This file keeps the higher-level product API summary.
4
+
3
5
  ## Storage Locations
4
6
 
5
7
  - SQLite: authoritative map graph state, picks, contexts, logs, runs, events, search indexes.