pi-ping-pong 0.0.0-stage → 0.1.2
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/AGENTS.md +46 -0
- package/CHANGELOG.md +30 -0
- package/LICENSE +21 -0
- package/README.md +47 -2
- package/SKILL.md +48 -0
- package/docs/GUIDE.md +105 -0
- package/docs/action-scoped-protocol.md +80 -0
- package/docs/evaluator-preparation.md +11 -0
- package/docs/headless-reviewer.md +31 -0
- package/docs/manual-e2e-report-template.md +88 -0
- package/docs/manual-e2e.md +111 -0
- package/docs/project-workspace.md +59 -0
- package/extensions/pi-reviewed.ts +1128 -0
- package/package.json +61 -4
- package/references/reviewed-runs.md +91 -0
- package/scripts/action_bridge.py +1886 -0
- package/scripts/action_protocol.py +870 -0
- package/scripts/bridge.py +624 -0
- package/scripts/headless_reviewer.py +253 -0
- package/scripts/launch_diff.py +228 -0
- package/scripts/output_snapshot.py +110 -0
- package/scripts/ppp_checkpoint.py +90 -0
- package/scripts/ralph-parent-guard.mjs +168 -0
package/AGENTS.md
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# Maintaining Pi Ping Pong
|
|
2
|
+
|
|
3
|
+
## Agent skills
|
|
4
|
+
|
|
5
|
+
### Issue tracker
|
|
6
|
+
|
|
7
|
+
Issues and specs are tracked as local Markdown under `.scratch/`.
|
|
8
|
+
See `docs/agents/issue-tracker.md`.
|
|
9
|
+
|
|
10
|
+
### Domain docs
|
|
11
|
+
|
|
12
|
+
This is a single-context repository.
|
|
13
|
+
See `docs/agents/domain.md`.
|
|
14
|
+
|
|
15
|
+
This repository contains one shared bridge for Goal and Ralph, plus a Pi queue receiver. Keep mode differences in the existing implementation; do not fork the protocol per launcher.
|
|
16
|
+
|
|
17
|
+
## Foundational product contract
|
|
18
|
+
|
|
19
|
+
One user prompt starts autonomous work toward the fullest achievable result. Worker executes and runs ordinary tests; independent Reviewer identifies actual gaps not established by those tests and route actionable corrections back to Worker within the existing finite budget. They exist to advance the task, not enforce internal ceremony.
|
|
20
|
+
|
|
21
|
+
- Continue every independent authorized action despite a missing input, access, approval, choice, or a failure in another part. Make ordinary reversible choices without asking. Once useful independent work is exhausted, deliver the created result and one grouped list of genuinely human-dependent gaps and their dependencies. The user need not monitor or answer intermediate routine questions.
|
|
22
|
+
- Internal JSON, schemas, evidence paths, evaluator/reviewer failures, and other role or transport errors must not by themselves discard or hide work, demand routine human intervention, or stop independent work. Repair or work around them within the existing budget; if verification cannot be completed, deliver the result with the exact limitation. Do not silently claim failed or missing checks passed.
|
|
23
|
+
- Assess the user's actual requirements and behavior. Do not invent product requirements, prescribed selectors, file formats, approvals, or acceptance gates for evaluator convenience. A valid negative assessment guides further work; do not retry it merely to obtain a positive verdict.
|
|
24
|
+
- Verification serves the user's result, not the reverse. Use unit tests and deterministic tools for checks they can establish; do not ask an evaluator or model reviewer to re-prove those checks routinely. Independent evaluation and review add evidence about the actual requested outcome where useful, not duplicate checks or prescribe incidental scenario details. A failed or unreliable evaluator is not proof that the product failed. Do not turn repair of verification, additional test fixtures, repeated reviews, or a live model test into a prerequisite for delivering available work. Report genuine verification limitations without inventing acceptance or weakening safety and identity checks.
|
|
25
|
+
- Distinguish delivery/completion of the available result from verified acceptance: report completed work, unverified items and unresolved gaps truthfully, including on budget exhaustion. Existing `finish`/acceptance semantics and CLI compatibility must not be silently redefined; implement any new completion behavior explicitly and compatibly.
|
|
26
|
+
- Preserve concrete safety and integrity protections: identity and ownership, finite cumulative budgets, no duplicate or uncertain external effects, and no false acceptance. These safeguards must not become invented product requirements or prevent delivery of existing results.
|
|
27
|
+
|
|
28
|
+
Existing implementation and historical documentation may not yet satisfy this contract. When changing them, resolve conflicts in favor of this product contract without silently weakening the concrete safety and compatibility requirements above. Tests must cover result delivery when internal verification fails, continued independent work, grouped human-dependent gaps, and repeated Worker corrections—not just protocol formatting.
|
|
29
|
+
|
|
30
|
+
- Read SKILL.md and references/reviewed-runs.md before changing lifecycle behavior.
|
|
31
|
+
- Preserve run/cycle/hash identity checks, independent hash-bound Reviewer assessments, finite bounds, durable delivery records and duplicate-launch refusal.
|
|
32
|
+
- Never equate exit 0 or native completion with acceptance. Passing geometry does not establish visual correctness.
|
|
33
|
+
- Human escalation requires an actual missing input, access, approval or choice. Never invent approval or silently reset limits.
|
|
34
|
+
- Keep existing CLI/config contracts and Pi receiver session entries compatible. Explain migrations when compatibility cannot be retained.
|
|
35
|
+
- Do not patch vendor packages or change global Goal/Ralph settings as a side effect.
|
|
36
|
+
- Keep private artifacts out of tracked source; use private `.pi/ping-pong/` in the existing worktree for new manual E2E and preserve legacy `.pi-ping-pong/`. Use synthetic fixtures. Simulated people must have Test in their names.
|
|
37
|
+
- For user-operated E2E, follow docs/manual-e2e.md: ordinary installed Pi/subscription, existing worktree, report before preparation, three case prompts. Do not impose historical pinned-runtime/private-HOME/snapshot/profile-smoke gates. Keep old experiments as history; record actual failures and missing results without silently relaunching.
|
|
38
|
+
- Put supplementary documentation (guides, designs, feature specs and notes) in docs/ and link it from docs/README.md. Keep README.md, AGENTS.md and SKILL.md in the root; preserve references/reviewed-runs.md as the operational skill contract.
|
|
39
|
+
- Record user-facing features, fixes, compatibility, installation and migration changes in `CHANGELOG.md` under `Unreleased` as part of the change. Group related commits into one useful entry; omit internal-only work. When merging branches, retain and combine their entries. At release, move entries to a version heading and align package version and tag; during 0.x, explicitly flag breaking changes and use a minor version bump for them. Unreleased changes on the default Git branch can already reach users.
|
|
40
|
+
- Run python3 -B scripts/test_bridge.py and node scripts/test_pi_receiver.mjs for protocol/receiver changes. Live model runs require task authorization; unit tests do not imply live acceptance.
|
|
41
|
+
- Install development checks with `npm ci` and `uv sync --locked`. Fast checks: `bun run check:python` runs Ruff plus bridge and action-protocol tests; `bun run check:ts` runs ESLint, TypeScript and the Pi receiver suite. `bun run check` (also `npm run check` for compatibility) runs both fast groups, not the slow integration suites. Run `bun run check:bridge` only when changing action-bridge end-to-end behavior or contracts (worker/reviewer flow, wait/wake, cancellation, delivery, acceptance/evidence or launch behavior). Run `bun run check:faults` only when changing durable state/recovery, crash or replay boundaries, dispatch/ack races, leases, or process-tree cleanup. `bun run check:integration` runs both for broad changes spanning those areas. Docs-only changes need `git diff --check` and validation of changed local links/examples, not language suites. Before a real launch, run the fast combined check and only the integration check(s) applicable to changed behavior. Do not rerun unrelated suites just because a commit is planned. This repository does not configure Git hooks automatically. To opt in locally, run `git config --local core.hooksPath .githooks`.
|
|
42
|
+
- Inspect the exact diff and git status. Do not commit, publish or push without authorization. License choice belongs to the owner.
|
|
43
|
+
|
|
44
|
+
Evaluator-era runs and protocol 1 are not supported by the current lifecycle. Preserve their files unchanged; use Git history for the old implementation. Do not create task-specific eval.py, require eval_argv, repair a separate evaluator, or manufacture Worker corrections from unknown verification. No mandatory pre-work model review or repeated pre/post verification.
|
|
45
|
+
|
|
46
|
+
While this package lives inside codex-context/skills, this directory is canonical. Install runtime copies after changes only when the task authorizes installation; do not maintain a separate runtime implementation. Legacy pi-codex-handoff and pi-goal-handoff are compatibility entrypoints.
|
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## 0.1.2 - 2026-11-25
|
|
4
|
+
|
|
5
|
+
- Make `pi install npm:pi-ping-pong` the primary installation command; Git remains an alternative.
|
|
6
|
+
- Maintainers: publish to npm from a pushed `v*` tag with GitHub Actions trusted publishing.
|
|
7
|
+
|
|
8
|
+
## 0.1.1 - 2026-11-25
|
|
9
|
+
|
|
10
|
+
- Add `npm:pi-ping-pong` as an alternative Pi package source, with the receiver, skill, runtime scripts, and operational docs. Git installs and the standalone Codex skill remain available; Python remains a separate prerequisite.
|
|
11
|
+
|
|
12
|
+
## 0.1.0
|
|
13
|
+
|
|
14
|
+
First tagged release of the Pi package. The project was already available from Git before this release.
|
|
15
|
+
|
|
16
|
+
- Run bounded Pi Goal, Ralph, and ping-pong workflows with independent review.
|
|
17
|
+
- Continue useful work from concrete reviewer feedback; distinguish unverified delivery from acceptance.
|
|
18
|
+
- Work in an existing project, including uncommitted changes, with retained run evidence.
|
|
19
|
+
- Install and update as a Pi Git package, with a separate skill-only installation option for Codex.
|
|
20
|
+
- Report observed token usage where available; partial measurements are not billing totals.
|
|
21
|
+
|
|
22
|
+
## Before versioned releases
|
|
23
|
+
|
|
24
|
+
- `b86a950`: introduced bounded reviewer-driven execution, replacing the separate evaluator workflow. Evaluator-era runs cannot be resumed by the new runtime.
|
|
25
|
+
- `015a5bf`: introduced project-local Pi run storage, while retaining discovery of legacy runs.
|
|
26
|
+
- `f20ef72`: introduced best-effort observed Ralph Worker token accounting.
|
|
27
|
+
- `b923b42`: clarified reviewer continuations for concrete gaps rather than uncertainty alone.
|
|
28
|
+
- `42653c8`: completed Git package installation and migration guidance.
|
|
29
|
+
|
|
30
|
+
These commits mark development milestones, not releases published at the time. The `milestone/bounded-review` Git tag identifies the architectural transition at `b86a950`.
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Artem Litvinko
|
|
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,48 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Pi Ping Pong
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Pi Ping Pong is a local controller for running a coding task in Pi with explicit scope, acceptance criteria, and finite execution limits. A Worker does the work; a separate Reviewer checks what its tests and other evidence do not settle. Core decides whether to continue, wait, stop, or record verified acceptance.
|
|
4
|
+
|
|
5
|
+
**Experimental (0.x).** The workflow and compatibility may change. Use it on tasks where you can inspect the results; local checks do not establish live model acceptance.
|
|
6
|
+
|
|
7
|
+
A passing test suite answers only the questions it actually checks. A Worker can finish with a green suite and still miss a requirement, change something outside scope, or leave the result hard to verify. The point of the separate review is to examine those gaps, not to run the same tests again or to treat a second model's opinion as proof.
|
|
8
|
+
|
|
9
|
+
```mermaid
|
|
10
|
+
flowchart TD
|
|
11
|
+
Task["Task, scope, criteria, limits"] --> Core["Core dispatches authorized work"]
|
|
12
|
+
Core --> Worker["Worker changes files and runs tests"]
|
|
13
|
+
Worker -->|Retained result and test evidence| Review["Independent Reviewer checks remaining questions"]
|
|
14
|
+
Review -->|Assessment or review limitation| Decision["Core validates the assessment or records the limitation"]
|
|
15
|
+
Decision -->|Eligible work or concrete correction within limits| Core
|
|
16
|
+
Decision -->|Human input needed| Wait["Group requests after independent work"]
|
|
17
|
+
Decision -->|Finish, stop, or blocked verification| Report["Report the available result and what was verified"]
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
Core keeps working on eligible actions when another action is blocked. If review is unavailable or evidence is incomplete, Core preserves the result and reports what remains unverified. Uncertainty alone does not send the Worker back to make another change. Verified acceptance (`finish`) requires all criteria to pass, completed actions, resolved blockers, and reconciled effects; neither native completion nor a Reviewer endorsement is enough.
|
|
21
|
+
|
|
22
|
+
## Execution modes
|
|
23
|
+
|
|
24
|
+
| Worker mode | When independent review happens | Main Worker limits |
|
|
25
|
+
|---|---|---|
|
|
26
|
+
| **Ping-pong** | After each settled ordinary Pi Worker iteration. | Cumulative iterations and active Worker time; per-iteration time and a separate checkpoint-repair bound. |
|
|
27
|
+
| **Goal** | After a native Goal completes or reaches a real limit, not after every progress checkpoint. Corrections keep the same Pi history. | Cumulative active Worker time and number of native Goal launches; optional cumulative token cap. |
|
|
28
|
+
| **Ralph** | After a bounded native multi-iteration loop returns a result or reaches a real limit. | Cumulative native iterations and active Worker time; per-iteration time. |
|
|
29
|
+
|
|
30
|
+
Review has its own finite deadline. Corrections use remaining allowance rather than opening a new run budget. See the [run contract](references/reviewed-runs.md) for grants, recovery, and exact accounting.
|
|
31
|
+
|
|
32
|
+
## Get started
|
|
33
|
+
|
|
34
|
+
1. Install with `pi install npm:pi-ping-pong`. To follow the Git repository instead, use `pi install git:github.com/SzpakLabs/pi-ping-pong`. Use one source only. Python 3.10+ must already be on `PATH` as `python3`. If you used the old copy installer, [disable the copied receiver first](docs/GUIDE.md#migrate-from-the-copy-installer). See the [guide](docs/GUIDE.md#install) for prerequisites, updates, and the Codex skill.
|
|
35
|
+
2. Open Pi in the project you want the Worker to edit. Run `/reload` if you just installed the receiver. New runs use `.pi/ping-pong/runs/`; [Git exclusion is best effort](docs/project-workspace.md#private-run-storage), not a preparation or launch requirement.
|
|
36
|
+
3. Describe the task, allowed paths, and how you'd judge the result. Run `/ppp <name>` with an unused lowercase kebab-case name. Review the generated `TASK.md`, `config.json`, models, and limits. Preparation does not start the Worker.
|
|
37
|
+
4. Run `/ppp <name>` again when the draft is ready and you want to launch. Use `/ppp-status` to inspect it. With headless review, the launching chat reports progress and collects confirmed human responses through `/ppp-respond`; a separate Pi session reviews the result.
|
|
38
|
+
|
|
39
|
+
Example task: “Add a dark-mode toggle. Limit edits to `src/` and `tests/`. The preference should survive reload and the toggle must work by keyboard. Run the project's tests and report any browser behavior you couldn't verify. Prepare the run with finite limits, but don't launch yet.”
|
|
40
|
+
|
|
41
|
+
## Boundaries
|
|
42
|
+
|
|
43
|
+
- **Works in place.** The Worker acts on the selected project, including uncommitted files. Keep private run records out of version control. The default headless Reviewer has read-only built-in tools, but this is not an OS sandbox. Task scope and budgets grant no commit, push, or deploy permission.
|
|
44
|
+
- **Local runtime, configured model access.** Keep the host and Pi reporting session available. Model calls may incur usage charges. Codex is an optional review transport with [its own prerequisites](docs/GUIDE.md#quick-start-reviewer-in-codex); it is not a Worker mode. No Claude Code runtime or specific Claude model/provider combination is verified here.
|
|
45
|
+
- **No in-place migration.** Existing `.pi-ping-pong/runs/` runs stay discoverable at their original paths. Prepare new protocol 2 / schema 1 runs without a separate evaluator. Protocol 1 and evaluator-era configs/runs cannot launch or resume on this runtime; their files are left alone.
|
|
46
|
+
- **Local checks are not live validation.** Tests with synthetic processes check runtime behavior, not model judgment, provider compatibility, or unattended operation after closing the launching UI. [Manual validation](docs/manual-e2e.md) is separate.
|
|
47
|
+
|
|
48
|
+
[User guide](docs/GUIDE.md) · [Full source documentation](https://github.com/SzpakLabs/pi-ping-pong/tree/main/docs) · [Skill](SKILL.md) · [MIT License](LICENSE)
|
package/SKILL.md
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: pi-ping-pong
|
|
3
|
+
description: Run bounded Pi/Ralph or Pi Goal work, review logical results independently, and return actionable feedback within scope.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Pi Ping Pong
|
|
7
|
+
|
|
8
|
+
## One task, one execution loop
|
|
9
|
+
|
|
10
|
+
Worker implements the user's task and runs ordinary tests. Independent Reviewer uses those results for what they establish and assesses only remaining requirement fit, visual/semantic judgment, omissions and concrete defects. Core validates identity, evidence, scope, dependencies, progress and budgets and independently chooses the transition. Chat A is the human command/report surface, not Reviewer or Core.
|
|
11
|
+
|
|
12
|
+
Do not generate or run task-specific `eval.py`, configure `eval_argv`, repair a separate evaluator or make a model re-prove deterministic tests. No mandatory pre-work model review or pre/post review repeat. Start authorized work from the recorded task contract. Review after an actual Worker result, or a concrete recovery/human/resource event requiring reconciliation. Unknown evidence alone must not manufacture another Worker iteration.
|
|
13
|
+
|
|
14
|
+
Continue all independent authorized actions around scoped blockers and unavailable review. Deliver existing work with exact unverified items and one grouped list of genuine human-dependent gaps. Delivery is not verified acceptance; a stop with only unverified criteria and no defect is reported as `delivered_unverified` ("delivered, not verified"). `finish` still requires all criteria passing, completed actions, resolved blockers and reconciled external effects; native completion/exit 0 is not acceptance. Do not reset budgets, replay ambiguous effects or infer authorization from a successful test. See [AGENTS.md](AGENTS.md).
|
|
15
|
+
|
|
16
|
+
## Prepare and launch
|
|
17
|
+
|
|
18
|
+
Read [the operational contract](references/reviewed-runs.md) and [protocol/schema](docs/action-scoped-protocol.md). Prepare private `TASK.md` and `config.json`, not the product. Use explicit protocol 2/schema 1. New Pi preparation uses `review_transport=pi`, `review_execution=headless` and explicit independent Reviewer provider/model. Omitted/chat execution retains the launching-chat review transport for new configs, not evaluator-era resume.
|
|
19
|
+
|
|
20
|
+
`/pi-ping-pong <task description>` reserves a private named run and sends the preparation prompt; a lone kebab-case argument selects that name. Defaults: Worker `openai-codex/gpt-6-luna`, low thinking, 10 cycles unless requested otherwise. Ask only for genuinely missing scope/input/choice. `/pi-ping-pong <ready-name>` or an actual config path explicitly launches. Menu selection alone does not launch; launch records forbid duplicates. Never prefill `pi_session_id` or mutate transcripts. The receiver binds the real launching session.
|
|
21
|
+
|
|
22
|
+
For browser work choose Playwright, not desktop control. Prefer configured/project-installed Node runtime; record route and cwd in TASK. Core resolves once and passes `PPP_PLAYWRIGHT_MODULE` to Worker for ordinary tests in both Goal and Ralph. Module resolution is not browser/login verification; failures do not block independent work. Reuse intended authenticated automation context; do not copy personal cookies or bypass security.
|
|
23
|
+
|
|
24
|
+
New run files: `.pi/ping-pong/runs/<name>/` in the existing worktree; PPP directories mode 0700, TASK/config mode 0600. Existing `.pi/` permissions are not changed. Legacy `.pi-ping-pong/runs/` stays discoverable in place; use the menu or exact config path when names collide. PPP tries a local Git exclude only for its new service path and warns without blocking if Git protection is absent or unknown. See [private run storage](docs/project-workspace.md#private-run-storage). Use the selected current project, including its uncommitted state: new products go in the requested repository root, existing projects are edited in place, and explicit subdirectory/file targets take precedence. Record the absolute product target in config/TASK. No mandatory auto-commit, clean Git, fetch, separate worktree or routine approval. Preserve unrelated user files and ignored local configuration. Explicitly authorized project source paths may be edited directly; `work/` is checkpoint/evidence storage, not a source checkout. Cwd/Git ancestry grants no write scope. Never store secrets in evidence. Simulated people's names contain Test.
|
|
25
|
+
|
|
26
|
+
Core records a best-effort bounded hash baseline before initial work and, for Git targets, a read-only launch record (HEAD plus filtered `git diff HEAD`/untracked text of the user's launch edits) that gives each Reviewer request a hash-bound start→current `launch-diff.txt` fact, not a verdict; only a no-checkpoint interruption/budget boundary triggers fallback discovery in work/ and the configured absolute target. Candidates include possible user/concurrent changes, not established Worker authorship, tests or acceptance. Missing/partial snapshots never gate work/delivery. See [project placement and fallback limits](docs/project-workspace.md).
|
|
27
|
+
|
|
28
|
+
For user-operated E2E follow [three manual cases](docs/manual-e2e.md): create the private report **before** preparation, use installed Pi/subscription and the existing worktree. Give the exact native launch command; if awaiting user entry, report **NOT RUN**, not failure. No new live/paid run without authorization. Historical pinned runtime/HOME/profile smoke requirements are not launch prerequisites.
|
|
29
|
+
|
|
30
|
+
## Work, review, recovery
|
|
31
|
+
|
|
32
|
+
`ping-pong` uses an ordinary Pi RPC Worker and reviews each settled iteration, charging task iterations to the cumulative cycle budget. Ping-pong checkpoint format/schema/identity repairs (`worker.checkpoint_invalid` → same reserved action/cycle redispatch; a missing/wrong `run_id`/cycle/action is never accepted, but is repaired or reviewed as unverified output, not halted) do not spend `max_cycles`; they have their own bound `checkpoint_repair_attempts` (optional config, default 3 per reserved action/cycle; 0 disables repair) and still spend cumulative `wall_seconds`. Used repairs are recorded as `checkpoint_repairs` on the consumption row and in `bridge-status.json`, separate from `worker_iterations`. At the limit Core records `worker.repair_budget_exhausted`, retains scoped outputs as an unverified result for independent review, and grants no new budget, replay or acceptance. Reviewer can identify specific remaining authorized work or a concrete correction with the optional evidence-backed `continuation` judgment, without inventing an experiment; unknown alone never qualifies. Goal autonomously pursues the full authorized objective through native continuation until native completion or a real limitation; progress checkpoints and external operations do not force review or `goal_wait`. Core freezes Worker before independent result review. Native completion is not acceptance; concrete corrections use the same Pi history (pointing only at changed cycle context, not rereading delivered CONTRACT/TASK) and only remaining cumulative time, launches and (if configured) tokens, with hash-bound review and no uncertain-effect replay. `goal_max_launches` (default 10) bounds new native Goal windows per run; `goal_tokens` is optional — set, it is a cumulative cap passed as native `--tokens`; unset, Goal runs without a token cap, bounded by `wall_seconds` and launches. Goal checkpoints do not spend `max_cycles`; `cycle_seconds` does not split native Goal work, and both fields are optional in Goal configs (required for Ralph and ping-pong). Ralph independently runs a bounded native multi-iteration loop over the full dispatched task, then receives result review; corrections/remaining work use only remaining cumulative native iterations/time. Iterations are reserved before launch; interruption or missing telemetry never implies spare allowance. Root-native task storage is created exclusively when absent and reused for corrections only after this run's hash/inode/native-token ownership and cleanup are confirmed; otherwise private fallback preserves existing files while work continues in place. Mixed native dispatches reserve every participating budget scope, without splitting the objective. Native snapshot feedback remains limited, especially with in-project PPP artifacts; see [placement/ownership limits](docs/project-workspace.md). Reviewer time has its separate finite `review_seconds`; response-format repairs reuse that same session/deadline, never a new task evaluation or Worker replay. Do not repeat valid negative findings to obtain a pass.
|
|
33
|
+
|
|
34
|
+
Worker checkpoints retain ordinary test commands, exit status, output and relevant source/artifacts. Optional `python3 "$PPP_CHECKPOINT_CMD" --status ... --summary ... EVIDENCE...` (`scripts/ppp_checkpoint.py`) fills identity from cycle-context, resolves evidence paths, copies non-secret files from outside target/work into `work/evidence/`, writes atomically and runs Core's checkpoint check; manual writing stays valid. Reviewer submits the existing action/criterion judgments through `assessment`; Core binds run/cycle/review/state/request/evidence hashes. `endorse` is not acceptance. Further Worker corrections need concrete defects or unfinished authorized work and a justified materially different next action, not unknown checks. Unavailable or incomplete review leaves acceptance unknown while independent actions and result delivery continue.
|
|
35
|
+
|
|
36
|
+
`resume`/event-driven `wake` preserve ownership, history, grants and accounting. Uncertain operations require independent reconciliation, never blind replay. Durable attempted reviews/delivery receipts forbid blind redispatch. Old evaluator-era configs and protocol 1 cannot launch/resume with this implementation; do not alter their files or silently migrate them. Git history contains their runtime.
|
|
37
|
+
|
|
38
|
+
Human responses use `/ppp-respond` (ordinary addressed text plus native confirmation), advanced run-ID JSON, or interactive `bridge.py human --config ...` for console transport. Ask only actual missing input/access/approval/material choice. Waiting/reminders use no Worker/model polling; late input never restarts terminal work.
|
|
39
|
+
|
|
40
|
+
## Reports and receiver
|
|
41
|
+
|
|
42
|
+
Use standalone `STATUS — ...`, then separate headings `### TL;DR`, `### Summary`, `### Report`, `### Suggested action`, `### Full run status`, with blank lines and content below. Explain completed versus accepted/unverified results, concrete errors, grouped real human needs and whether a stage actually started. Use available facts; no extra artifact reads just to fill status.
|
|
43
|
+
|
|
44
|
+
Chat A narrates Core reports without submitting decisions, changing state, extending budgets or starting workers. Core emits passive actual Worker/Reviewer start notices and deduplicates unchanged waits. Durable delivery is not acceptance. See [headless adapter](docs/headless-reviewer.md).
|
|
45
|
+
|
|
46
|
+
`/ppp` and `/reviewed-run` alias the launcher; `/ppp-status` and `/reviewed-status` alias read-only local status. Receiver attachments/session entries and message envelopes stay compatible; existing runs remain inspectable without execution. Delivery uses Pi's existing `sendMessage` follow-up API, not session-file writes or desktop automation. Codex queue targets the exact existing thread; do not start a second writer via `codex exec resume`.
|
|
47
|
+
|
|
48
|
+
Checks are listed in AGENTS.md. Unit/fake-process results do not establish live model acceptance or UI-close autonomy. No commit, push, deploy, global runtime install or settings changes unless authorized.
|
package/docs/GUIDE.md
ADDED
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
# Pi Ping Pong user guide
|
|
2
|
+
|
|
3
|
+
[Project overview](../README.md) · [Run contract](../references/reviewed-runs.md) · [Protocol](action-scoped-protocol.md)
|
|
4
|
+
|
|
5
|
+
## Requirements
|
|
6
|
+
|
|
7
|
+
- A POSIX host (macOS or Linux), `python3` (use Python 3.10+, the project's declared minimum), and an RPC-capable `pi` on `PATH`. Native Windows is not supported. Use a Node.js version supported by your Pi installation; the Pi package pinned for repository development declares Node.js 22.19.0 or newer. The pin is not a requirement to downgrade your installed Pi.
|
|
8
|
+
- The Goal extension for `goal`, or the Ralph extension for `ralph`; neither is needed for the ordinary Pi Worker in `ping-pong`. The bridge looks for the installed `@narumitw/pi-goal` and `@lnilluv/pi-ralph-loop` packages by default; [the run contract](../references/reviewed-runs.md) describes the runtime options.
|
|
9
|
+
- Working Pi model access for the selected Worker and, with headless Pi review, the selected Reviewer provider/model. The preparation defaults are not portable model IDs; choose IDs available in your environment. Explicit Pi extension lists are supported for provider registration; load only trusted code. No Claude Code runtime or particular Claude provider/model pairing is established by this mechanism.
|
|
10
|
+
- Worker and Reviewer need access to the relevant local files. Keep the host available and the launching session open for normal Pi reporting; UI-close autonomy and cross-chat catch-up are not claimed.
|
|
11
|
+
|
|
12
|
+
## Install
|
|
13
|
+
|
|
14
|
+
If you used `scripts/install.py` before, [disable that receiver first](#migrate-from-the-copy-installer). Install PPP with Pi:
|
|
15
|
+
|
|
16
|
+
```sh
|
|
17
|
+
pi install npm:pi-ping-pong
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
To follow the Git repository instead, use `pi install git:github.com/SzpakLabs/pi-ping-pong`. To try an unpublished checkout, run `pi install /absolute/path/to/pi-ping-pong`. Pi loads that checkout in place; update it with Git, not `pi update`. Install only one source for PPP at a time.
|
|
21
|
+
|
|
22
|
+
Open a new Pi session or run `/reload`. To check the installation without starting work, look for `/skill:pi-ping-pong` in command completion and run `/ppp-status`. The package includes the receiver, skill, and Python bridge. npm does not install Python: `python3 --version` should report 3.10 or newer, and no Python libraries need to be installed for PPP. The package also does not install model credentials, Goal, or Ralph.
|
|
23
|
+
|
|
24
|
+
### Update or remove
|
|
25
|
+
|
|
26
|
+
```sh
|
|
27
|
+
pi update npm:pi-ping-pong
|
|
28
|
+
# For a Git installation, use this instead:
|
|
29
|
+
# pi update git:github.com/SzpakLabs/pi-ping-pong
|
|
30
|
+
# Or update all installed Pi packages:
|
|
31
|
+
pi update --extensions
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Bare `pi update` updates Pi itself, not PPP. An exact npm version pin (for example, `npm:pi-ping-pong@0.1.1`) or a Git tag/commit pin stays fixed. Update between runs: Pi can replace package files in place, and an existing bridge can still need its companion scripts. Reopen Pi or run `/reload` to load the updated resources.
|
|
35
|
+
|
|
36
|
+
Use `pi remove <source>` with the source in `pi list` (for example, `pi remove npm:pi-ping-pong` or `pi remove git:github.com/SzpakLabs/pi-ping-pong`). When switching sources, remove the old one before installing the new one. Project run records and any independent Codex skill copy remain in place.
|
|
37
|
+
|
|
38
|
+
### Migrate from the copy installer
|
|
39
|
+
|
|
40
|
+
1. Between runs, move the old receiver out of Pi's discovery. For the default installer path, keep a local backup:
|
|
41
|
+
|
|
42
|
+
```sh
|
|
43
|
+
mv -i ~/.pi/agent/extensions/pi-reviewed.ts ~/.pi/agent/extensions/pi-reviewed.ts.disabled
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
If you used a custom location or explicitly configured the old file, disable that entry in `pi config` instead. Do not change run directories or session records.
|
|
47
|
+
2. Install the package, then `/reload` or restart Pi. Don't rerun the legacy installer without `--skill-only`: doing so recreates the copied receiver and causes duplicate commands and subscriptions.
|
|
48
|
+
3. If you keep `~/.agents/skills/pi-ping-pong` for Codex, use `pi config` to disable **only** that standalone skill in Pi and leave the package skill enabled. On Pi versions with exact resource exclusions, the equivalent is appending `"-~/.agents/skills/pi-ping-pong/SKILL.md"` to the existing `skills` array in Pi's user settings. If you don't need the standalone skill, you can move it outside the discovered skills directory instead.
|
|
49
|
+
|
|
50
|
+
`PI_PING_PONG_BRIDGE` still overrides bridge selection for both launch and wake. Without it, the receiver prefers the bridge alongside its package. A standalone receiver copied by the legacy installer still uses the bridge under `~/.agents/skills/pi-ping-pong`.
|
|
51
|
+
|
|
52
|
+
### Install the Codex skill
|
|
53
|
+
|
|
54
|
+
From an up-to-date Git checkout (the copy installer is not in the npm package):
|
|
55
|
+
|
|
56
|
+
```sh
|
|
57
|
+
python3 scripts/install.py --skill-only
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
This installs or updates `~/.agents/skills/pi-ping-pong`, backing up differing files, without copying a Pi receiver. Installing or updating the Pi package does not update this separate copy. For a legacy copy-only Pi installation, `python3 scripts/install.py` without this flag still installs both the skill and receiver; use that route **instead of**, not alongside, the Pi package.
|
|
61
|
+
|
|
62
|
+
## Prepare and launch
|
|
63
|
+
|
|
64
|
+
1. Open the intended project in Pi and describe the result, authorized scope, acceptance criteria, and known test commands. Choose a Worker mode and available provider/model. Use `/ppp <task description>` or `/ppp <unused-kebab-case-name>` to prepare. A lone kebab-case argument is a run name, not the task text. `/ppp` opens the run menu.
|
|
65
|
+
2. Review `TASK.md`, `config.json`, project target, provider/model choices, and finite limits. Preparation writes those two contract files in the private run directory; it does not do product work or launch a Worker. New named runs use `.pi/ping-pong/runs/<name>/`. PPP tries to exclude only its new service path via local Git rules; an absent or unknown ignore produces a warning, not a gate. See [storage and Git visibility](project-workspace.md#private-run-storage). Store no secrets in these files; do not prefill `pi_session_id`. New Pi drafts use separate headless review with an explicit provider/model, defaulting to the model used for preparation.
|
|
66
|
+
3. Explicitly launch with `/ppp <ready-name>` or `/ppp /actual/run/config.json` in the same chat. For same-name legacy and current runs, choose the intended row in `/ppp` or use the exact config path. The launcher binds the actual session and refuses a second launch of that run. Menu selection alone does not launch. `/pi-ping-pong` and `/reviewed-run` are aliases.
|
|
67
|
+
4. Use `/ppp-status` (also `/reviewed-status`) for read-only local status without a model call. Select project scope or technical details when needed. Reopening the same Pi session restores monitoring, not execution replay.
|
|
68
|
+
|
|
69
|
+
The product target is the selected existing project, including its uncommitted edits, or the explicit file/subdirectory in the task. Its run `work/` directory is service storage by default, not a checkout. There is no mandatory clean Git, commit, fetch, or separate worktree. See [workspace and fallback discovery](project-workspace.md).
|
|
70
|
+
|
|
71
|
+
## Review, reports, and human input
|
|
72
|
+
|
|
73
|
+
Worker runs ordinary tests and retains actual results in checkpoint evidence (command, exit status, output, and relevant artifacts). The Ralph Worker prompt asks for actual results of requested tests before the native loop ends, without prescribing a format. For browser work, Core can pass a resolved Playwright module to the Worker; resolution alone does not prove browser or login availability. The Reviewer uses the evidence rather than repeating deterministic checks. It assesses the requested result, remaining semantic or visual questions, and concrete defects. A continuation names the original requirement, the observed omission or defect, and a useful safe next step. Core validates the review against the run and evidence, then chooses the transition. See [Headless Reviewer](headless-reviewer.md) and the [decision contract](action-scoped-protocol.md#decisions-and-delivery).
|
|
74
|
+
|
|
75
|
+
With headless review, Chat A (the launching chat) reports what was produced, what was verified, and which gaps remain. A missing check is not a defect, and a failed Reviewer is not a human approval request. Core continues eligible independent work before grouping genuine human needs such as missing access, input, approval, or a material choice. While waiting, reminders do not spend Worker/model turns.
|
|
76
|
+
|
|
77
|
+
Use `/ppp-respond` to choose an addressed request, supply ordinary non-secret text, and confirm it. Advanced `/ppp-respond <run-id> <JSON>` and interactive `python3 scripts/bridge.py human --config /actual/run/config.json` for console ingress are also available. Late input cannot restart a terminal run. Grants are explicit and additive; a passing test cannot grant authority.
|
|
78
|
+
|
|
79
|
+
## Safety, budgets, and recovery
|
|
80
|
+
|
|
81
|
+
Worker and Reviewer budgets are separate. Ping-pong counts settled task iterations and has a separate bound on checkpoint repairs; Ralph reserves native iterations before launch; Goal uses cumulative active Worker time, a finite launch count, and an optional token limit. Corrections spend remaining allowance. Ralph token totals in `/ppp-status` are [report-only](../references/reviewed-runs.md#native-ralph-accounting-and-storage): an observed lower bound or “not measured,” not a limit or a bill. See [accounting by mode](../references/reviewed-runs.md#budgets-and-goal-accounting).
|
|
82
|
+
|
|
83
|
+
Use status and saved records to diagnose an interruption. `python3 scripts/bridge.py resume --config /actual/run/config.json` and event-driven wake preserve run identity, budget accounting, and prior effects. Reconcile ownership and unknown effects before continuing; do not blindly resend a review or repeat a possible external effect. Report-delivery failure does not unset acceptance recorded by Core. These controls are cooperative host safeguards, not an OS sandbox.
|
|
84
|
+
|
|
85
|
+
## Quick start: reviewer in Codex
|
|
86
|
+
|
|
87
|
+
This optional route uses `review_transport=codex` with the exact existing `thread_id` and configured review model. [Install the standalone skill](#install-the-codex-skill) if you want Codex to discover it. This route does not start a headless Codex Reviewer or a Codex Worker. The host's `codex queue` command must be available and authorized for that chat; check `codex queue --help` on the host. Do not use `codex exec resume` as a second writer to the same chat.
|
|
88
|
+
|
|
89
|
+
Prepare a private `TASK.md` and protocol 2 / schema 1 `config.json`, following the [run contract](../references/reviewed-runs.md). Review both before starting the bridge from the checkout (replace the config path):
|
|
90
|
+
|
|
91
|
+
```sh
|
|
92
|
+
python3 scripts/bridge.py run --config /actual/run/config.json
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
The Reviewer submits a direct `review-v2 --assessment`; see the [CLI and schema](action-scoped-protocol.md#independent-reviewer-boundary). Pi chat review (`review_execution=chat`, or omitted for a new Pi config) is also distinct from headless review: the launching chat receives review requests rather than only reports.
|
|
96
|
+
|
|
97
|
+
## Compatibility and validation
|
|
98
|
+
|
|
99
|
+
Current runs use protocol 2 / schema 1 without `eval_argv`. There is no separate evaluator or mandatory pre-work model review. Evaluator-era configs/runs, including protocol 1, cannot launch/resume on this runtime. Old files remain unchanged; inspect the original runtime in Git history if needed. See [migration](evaluator-preparation.md).
|
|
100
|
+
|
|
101
|
+
[Manual E2E cases](manual-e2e.md) use an existing worktree and configured Pi, with a private report saved before preparation. Local tests do not establish live provider compatibility, model judgment, or UI-close behavior. Do not treat historical smoke-stand prerequisites or results as current launch requirements or acceptance evidence.
|
|
102
|
+
|
|
103
|
+
## Development checks
|
|
104
|
+
|
|
105
|
+
From the repository root, `npm ci` and `uv sync --locked` install development dependencies. `bun run check` runs the fast Python and TypeScript suites. For changes spanning lifecycle and recovery, run `bun run check:integration`; scope narrower integration checks as described in [AGENTS.md](../AGENTS.md). The optional pre-commit hook runs `git diff --cached --check`, not the test suite.
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
# Protocol 2 / schema 1 — direct independent review
|
|
2
|
+
|
|
3
|
+
## Version and compatibility
|
|
4
|
+
|
|
5
|
+
Current execution uses integer protocol_version=2, schema_version=1 and execution_contract. No eval_argv or task-specific evaluator. Protocol 1 and evaluator-era runs are unsupported; old files are not rewritten or migrated. The existing action/criterion report schema, CLI run/resume/wake/human/signal/operation paths, Pi receiver message envelopes, aliases and session entries remain. `review-v2 --assessment` now submits Reviewer judgments directly; old correct/correction/human-needs and legacy decide semantics are not supported. See [migration](evaluator-preparation.md).
|
|
6
|
+
|
|
7
|
+
## Contract and initial work
|
|
8
|
+
|
|
9
|
+
execution_contract contains target, actions, criteria, closure and reminder_seconds. Actions have stable id, description, depends_on and pre-authorized operations. Dependencies must exist and be acyclic. Config/TASK are private run-owned regular files outside work/; both hashes and paths remain pinned. Run state has lifecycle=worker-reviewer, used to refuse evaluator-era restoration, not another user setup requirement.
|
|
10
|
+
|
|
11
|
+
Fresh initial actions are eligible from recorded task authority; Core selects dependency-ready work without an initial model call. Scope/authorization, explicit external operations and approval requirements still apply. Cwd/Git ancestry does not grant scope. Worker journals a pre-authorized external operation through bridge.py operation with the current owner token before performing it. Existing identity/ownership, lease, operation-state and authentic approval checks remain. No repeated external effect on uncertain, failed or succeeded outcomes.
|
|
12
|
+
|
|
13
|
+
Worker runs ordinary targeted tests and retains commands, exit status, output, source and relevant artifacts in its checkpoint evidence. Ralph's Worker prompt explicitly asks for actual results of requested tests before the loop ends, with no prescribed evidence format. For browser tasks, Core passes a resolved Playwright module to the Worker when available. A missing/broken check is a verification limitation, not proof of a product defect.
|
|
14
|
+
|
|
15
|
+
## Native Goal execution
|
|
16
|
+
|
|
17
|
+
Goal receives the full authorized task scope in `cycle-context.action_ids`/`actions`, not one model turn or external effect. The existing `action_id` anchors its cycle/checkpoint identity. Dispatched dependencies can be completed within that same native Goal; blocked, ineligible, previously unassessed or out-of-scope work stays excluded. Stable pre-authorized operation IDs can be reserved across the dispatch under its exclusive owner; successful, failed or uncertain effects never replay.
|
|
18
|
+
|
|
19
|
+
Native continuation runs until native completion or a real stopped/waiting/token/time limitation. Progress checkpoints do not force `goal_wait` or review. Core stops its Worker process before independent result review so native wake timers cannot write concurrently. A completed/stopped native Goal can receive concrete corrections through a new native ID in the same Pi history, limited to remaining cumulative tokens/time; an active waiting window keeps its ID. Native completion is not acceptance and acceptance needs no additional Worker turn. Ralph runs its native multi-iteration loop over the full dispatched objective, with result review after completion or a real limitation, not each progress checkpoint. Concrete corrections/remaining authorized work stay within cumulative native iterations/time; unknown alone never creates a correction. See [native task storage and snapshot limits](project-workspace.md).
|
|
20
|
+
|
|
21
|
+
## Independent Reviewer boundary
|
|
22
|
+
|
|
23
|
+
After an actual Worker result (or a concrete recovery/human/resource event), Core archives evidence, writes context.json/request.json and starts one independent Reviewer. No pre-work evaluator, post-work evaluator, source patch or evaluator retry exists. Headless execution uses a separate fresh read-only Pi session with explicit actual model/provider/session validation and a finite independent review deadline. Chat/Codex review transport remains available for new configs.
|
|
24
|
+
|
|
25
|
+
Core includes the full TASK and current contract/checkpoint inline, not just paths; other context and retained material remain available to the read tool. Reviewer uses ordinary test results for what they establish, without rerunning or re-proving deterministic checks. It judges residual requirement fit, semantic/visual quality, omissions and concrete contradictions. Do not invent scenarios, selectors, names, incidental representations, approvals or acceptance gates. Missing evidence is unknown, never fabricated pass. Further Worker experiments need a specific defect/unfinished authorized action and materially different next step; Core never converts unknown into an experiment.
|
|
26
|
+
|
|
27
|
+
Headless output:
|
|
28
|
+
|
|
29
|
+
```json
|
|
30
|
+
{"decision":"endorse", "feedback":"Concrete independent finding", "assessment":{}}
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
The assessment placeholder above must be filled with the existing report fields below. `endorse` submits judgments, not acceptance. halt requires a concrete global safety/integrity risk; stop means explicit abandonment. Those decisions need no assessment. Optional complete response identities must match exactly; normally omit them. Core binds run/protocol/schema, cycle, review_id, state_sha256 and target from its immutable request.
|
|
34
|
+
|
|
35
|
+
Required assessment fields:
|
|
36
|
+
|
|
37
|
+
- source_state: specific inspected state; safe: boolean; halt_reason: null unless unsafe.
|
|
38
|
+
- criteria: EVERY criterion ID -> {status: pass|fail|blocked|not_tested|unknown, evidence_refs: retained names}. Pass requires relevant retained evidence.
|
|
39
|
+
- actions: EVERY current action, with action={id,description,depends_on,operations}, status=pending|verified|stalled, eligible:boolean, scope_authorized:true, dependencies_valid:true, evidence_refs, attempt, experiment. Existing contracts are immutable. New in-scope actions/decompositions use the same scope/dependency/provenance checks.
|
|
40
|
+
- attempt: the outstanding selected cycle requires {strategy,state_before,outcome,fingerprint,assessment:verified|informative|none,evidence_refs} on its anchor action; other dispatched actions may optionally carry an attempt from that same whole-result review, while non-dispatched peers use null. Verified progress requires retained proof. Unknown/nonprogress can be recorded without inventing evidence or repetition. Duplicate fingerprints cannot establish progress.
|
|
41
|
+
- experiment: null or {hypothesis,material_difference,expected_evidence,next_step,fingerprint,evidence_refs}. Evidence-backed, materially different, nonduplicate; no experiment is generated from generic Reviewer feedback or unknown criteria.
|
|
42
|
+
- continuation: optional {next_step,evidence_refs} on an eligible pending action in the outstanding dispatch, with an informative nonduplicate attempt on that action or the dispatch anchor and retained evidence. Name the original requirement, the observed defect or genuinely absent requested result, and a useful safe next step. Do not dispatch for internal confirmation, unknown alone, a result already available elsewhere, or when there is no useful next action.
|
|
43
|
+
- blockers: [{blocker:{key,reason,needed,blocked_actions},evidence_refs}], only missing_secret|missing_access|approval_required|user_choice|external_blocker. Stable deduplication keys retain history.
|
|
44
|
+
- resolutions: [{blocker_id,human_id,valid,approval_applicable,evidence_refs}], using authentic addressed input; technical success never manufactures human approval/choice.
|
|
45
|
+
- grants: unprocessed authentic grant IDs, additive and single-use.
|
|
46
|
+
- reconciliation: {fresh:true,approvals_applicable:true,evidence_refs,operations:[{id,outcome:succeeded|not_performed|failed|uncertain,evidence_refs}]}. Every uncertain effect remains held until actually reconciled; contradictory stable outcomes halt without replacing the journal.
|
|
47
|
+
- Optional decompositions=[{parent_id,child_ids,complete:true}] and wake={source,reference,at}, using existing validated action and arranged-wake contracts.
|
|
48
|
+
|
|
49
|
+
Chat submission:
|
|
50
|
+
|
|
51
|
+
```sh
|
|
52
|
+
python3 scripts/bridge.py review-v2 --config /absolute/run/config.json \
|
|
53
|
+
--decision endorse --feedback 'Concrete finding' --assessment '<JSON assessment>'
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
review-id may be supplied or resolved from the active request. Core validates a copy before durable recording, then revalidates before application under its control boundary. Request/state/checkpoint/evidence hashes and duplicate refusal remain; Worker ready/exit0 is never acceptance. evidence_archive values are complete immutable file paths, not directories. Successful correlated read events remain audit evidence, not mandatory blanket rereads or a new review loop. A missing read event alone is not a failure. An observed failed access to material cited for verified claims, without later successful access, cannot establish endorsement; work is delivered unverified without forced reads/review repeats or a Worker defect. Missing relevant evidence must remain unknown. Invalid response formatting may be corrected within the SAME Reviewer session/deadline, not by repeating valid negative findings or launching another evaluator/Reviewer.
|
|
57
|
+
|
|
58
|
+
## Decisions and delivery
|
|
59
|
+
|
|
60
|
+
Core finish still requires reconciled state, no unassessed cycles, all criteria pass, every action complete and all blockers resolved. Delivery alone never sets finish. A stop after an applied no-defect review with every action complete, no uncertain operation, open blocker, wait or fail/blocked criterion, and only unknown/not_tested criteria left records `delivery.status=delivered_unverified` (bridge `outcome`): delivered, not verified, not acceptance; grants/usage are unchanged. Informative/nonprogress attempts stall that action unless the selected cycle has an evidenced specific continuation or justified experiment; peer observation cannot erase the restriction. Independent eligible actions continue around scoped blockers or blocked review, but not through unresolved dependencies or uncertain operations. A failed result review holds every action in the unassessed dispatch, not just its accounting anchor. Unknown review cannot reuse an earlier dispatched correction/experiment to replay Worker work.
|
|
61
|
+
|
|
62
|
+
A failed/unavailable Reviewer records the limitation, preserves checkpoint/evidence under unverified-results/, continues independent authorized work, then delivers the available result with unverified items. No blind review redispatch, forced evaluator repair, fake pass or extra Worker iteration merely to obtain missing review. Already identified genuine human gaps are grouped and delivered even when the Reviewer later fails; the failure itself creates no human or budget gate. Human questions are grouped only after independent work is exhausted and only for real human-dependent gaps. A Goal budget-limited result without a checkpoint remains in the unverified-result ledger when review fails; preserving it atomically clears its active reservation.
|
|
63
|
+
|
|
64
|
+
## Budgets, waits and recovery
|
|
65
|
+
|
|
66
|
+
Goal uses one Pi session/history, cumulative wall_seconds, goal_max_launches (default 10 new native Goal windows) and an optional cumulative goal_tokens cap (unset = no native --tokens), native-window identity and high-water accounting across checkpoints, grants and recovery. Checkpoints do not spend max_cycles. Explicit main grants add configured token windows; previous native Goal IDs cannot be charged as new windows. A persisted but undispatched window can be retried after reconciliation. Missing native telemetry leaves a lower bound/unknown remaining allowance, not more Worker budget; delivery/review can continue. See [full Goal accounting](../references/reviewed-runs.md#budgets-and-goal-accounting).
|
|
67
|
+
|
|
68
|
+
Mixed Goal/Ralph dispatches keep the full authorized objective but record `worker_scope_grants` for every participating scope; existing anchor `scope`/`grant_id`/`worker_iteration_grants` remain compatible. Goal still shares one cumulative token/time allowance. Ralph reserves the smallest participating scope's finite native iteration window before spawn, including corrections, charging and releasing each scope consistently; only a matching ordinary terminal native result releases unused reservations. Missing/interrupted/error/cancelled telemetry keeps the reserved bound. Non-identity malformed/missing native checkpoints use available-output review, not task replay to repair metadata. Its cycle_seconds bounds individual native iterations, not the whole loop. Goal uses cumulative active Worker wall_seconds and tokens, not a per-action cycle_seconds cutoff. Actual time exhaustion reconciles usage and reviews/delivers retained outputs without another Worker allowance. Completed Goal corrections create fresh native windows bounded by the remaining allowance, not a fresh run budget. Missing/malformed non-identity Goal checkpoints use output discovery and review rather than a metadata-only product replay. Missing/wrong checkpoint run/cycle/action identities are never accepted, but are Worker checkpoint errors handled by the same repair/available-output path, not a halt. Other checkpoint schema/evidence repairs use the same action/cycle, cumulative wall time and existing outputs, never task/effect replay. Ping-pong checkpoint format/schema repairs (`worker.checkpoint_invalid` → same reserved action/cycle redispatch) do not spend `max_cycles`; they have their own bound `checkpoint_repair_attempts` (optional config, default 3 per reserved action/cycle; 0 disables repair) and still spend cumulative `wall_seconds`. Used repairs are recorded as `checkpoint_repairs` on the consumption row and in `bridge-status.json`, separate from `worker_iterations`. At the limit Core records `worker.repair_budget_exhausted`, retains scoped outputs as an unverified result for independent review, and grants no new budget, replay or acceptance. Worker budgets exclude review time. `review_seconds` is the review deadline; `verification_seconds` records elapsed verification time, not another configured budget. Unknown verification is not a checkpoint-repair request.
|
|
69
|
+
|
|
70
|
+
Ralph's `worker_tokens`, `worker_tokens_status` and `worker_tokens_by_action` in `bridge-status.json` are [report-only observations](../references/reviewed-runs.md#native-ralph-accounting-and-storage). They never change the reserved iteration window, grants, execution-state hash, or acceptance. A partial count is an observed lower bound; missing measurements are null, not zero.
|
|
71
|
+
|
|
72
|
+
Human waits/reminders spend no Worker/model turns. `/ppp-respond` normal text/native confirmation and advanced JSON remain; console human ingress is interactive. Grants/resolutions are authenticated/addressed, never model-generated approval. Resource signals wake only the arranged source; bounded rechecks are one-shot, not model polling.
|
|
73
|
+
|
|
74
|
+
resume/wake preserve run identity, counters, grants, session/native Goal accounting, blockers and operations. No migration of evaluator-era runs. Live inherited Worker/Reviewer leases forbid overlap. Durable attempted review without disposition blocks, even if a callback exists; no blind redispatch/replay. Reconciled idle/applied-review state does not need mandatory repeated review on resume; unresolved results/effects do. Terminal runs cannot restart.
|
|
75
|
+
|
|
76
|
+
Cancellation/halt is ingested at guarded locked boundaries before review recording/application, dispatch, Worker/operation reservation and finish selection; terminal controls commit before refusal. RPC waits check controls. Owned POSIX process-group cleanup retains unreaped PID identity with waitid(WNOWAIT), TERM/KILL and bounded Darwin EPERM exit observation. Never signal unrelated processes or claim containment of escaped native child groups from an outer lease alone. Host locks are cooperative, not a malicious-code sandbox.
|
|
77
|
+
|
|
78
|
+
## Evidence limits
|
|
79
|
+
|
|
80
|
+
Hash-bound synthetic tests establish protocol behavior, not live model correctness, browser visuals, billing, authentication or UI-close autonomy. Review read events prove access, not comprehension. Existing historical implementation/audit/E2E docs describe the removed evaluator lifecycle; current rules above supersede those instructions. New live tests need separate authorization; no global runtime update is implied by source changes.
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# Evaluator removal: preparation migration
|
|
2
|
+
|
|
3
|
+
Current preparation writes **TASK.md and config.json only**. No task-specific eval.py, eval_argv, evaluator helper, preflight or source-repair loop is generated or invoked.
|
|
4
|
+
|
|
5
|
+
Worker implements the task and runs its ordinary tests, retaining commands, exits, output and relevant artifacts. Independent Reviewer sees those results and assesses only remaining judgment questions and concrete defects. Core validates the existing action/criterion schema, identities, evidence, scope, dependencies and budgets before deciding. Unknown evidence is not another Worker iteration; unavailable review does not hide available work or stop independent authorized actions.
|
|
6
|
+
|
|
7
|
+
Config remains protocol 2/schema 1, without eval_argv. Headless Reviewer returns decision/feedback and an `assessment` with the existing action/criterion fields. See [protocol](action-scoped-protocol.md) and [operational setup](../references/reviewed-runs.md).
|
|
8
|
+
|
|
9
|
+
Evaluator-era configs (including protocol 1) and already-launched evaluator runs cannot resume on this runtime. They are left unchanged; Git history contains the previous runtime. No automatic migration, artifact deletion or silent acceptance-semantic change. Receiver aliases, session entries, status and new-run CLI paths remain.
|
|
10
|
+
|
|
11
|
+
The old evaluator helpers, fixtures, preflight tests and evaluator-based smoke preparator were removed with the mechanism, not replaced by another role or gate. Existing historical docs/run artifacts are observations of the old lifecycle, not instructions to recreate it. Current manual cases are in [manual E2E](manual-e2e.md); no live model run is implied by local checks.
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# Separate Headless Reviewer
|
|
2
|
+
|
|
3
|
+
Worker implements and runs ordinary tests. Core invokes one separate read-only Reviewer after actual Worker results (or concrete reconciliation events), then validates and chooses the next state. No separate evaluator/preflight, source repair, or mandatory pre/post repeats. Chat A is the human command/report surface, never Core or this Reviewer.
|
|
4
|
+
|
|
5
|
+
## Configuration and operation
|
|
6
|
+
|
|
7
|
+
New configs: protocol_version=2, schema_version=1, review_transport=pi, review_execution=headless, explicit review_provider/review_model. The Reviewer model may differ from Chat A; launcher must not overwrite it. Omitted/chat execution retains the launching-chat transport for new evaluator-free configs only. Old evaluator-era configs/runs cannot resume; their files remain unchanged. See [migration](evaluator-preparation.md).
|
|
8
|
+
|
|
9
|
+
Core acquires its execution lease, durably records the dispatch attempt, and starts fresh ordinary Pi RPC with read-only tools and explicit provider/model/session. Automatic extension loading, MCP, skills, prompt templates, and repository context are disabled. Explicit `reviewer_extensions` can register providers and execute with this process’s privileges; load only trusted code. Actual RPC identity must match configuration and differ from Chat A/Worker. It reuses installed authentication without copying secrets. Startup, response and bounded same-session response-format repairs share the original finite review_seconds; Worker wall/token/iteration budgets remain separate. Cancellation/integrity checks run during RPC waits.
|
|
10
|
+
|
|
11
|
+
Core delivers the full TASK text and current contract/checkpoint inline in the Reviewer prompt; they are not merely file paths or claims of reads. Request/context and immutable evidence remain available through the read tool. For Git targets the request also binds a hash-checked `launch-diff.txt` (start→current lines of files dirty/untracked at launch; see [Git launch record](project-workspace.md#git-launch-record-and-startcurrent-diff)). It is a Core fact, not a verdict: unjustified removal of user launch lines is a concrete defect, while absent/partial coverage stays unknown. Reviewer uses retained ordinary test output and relevant source/artifacts. Use deterministic results for what they establish; do not rerun or re-prove them. Judge remaining requirement fit, visual/semantic quality, meaningful omissions and concrete defects only. Missing evidence stays unknown, not pass or a manufactured Worker correction. No direct product edits, shell/Worker launch, budgets or human approval authority.
|
|
12
|
+
|
|
13
|
+
Reviewer returns decision=endorse|halt|stop and feedback. Endorse additionally requires `assessment` with the **existing** action/criterion report fields. Core binds run/cycle/review/state/target/request/evidence identity, validates a copy, records then applies the report. Endorse is not finish. For a concrete defect or genuinely absent requested result, an evidence-backed `continuation` identifies the original requirement, observed gap, and useful safe next step. No new Worker run for internal confirmation, unknown alone, or a result already available elsewhere. See the [decision schema](action-scoped-protocol.md#independent-reviewer-boundary).
|
|
14
|
+
|
|
15
|
+
## Evidence and failure
|
|
16
|
+
|
|
17
|
+
Each request.evidence_archive value is the complete immutable FILE path; never append the logical key. Read relevant material evidence, not every unrelated attachment. Correlated read start/end events and `reviewer-reads.json` remain audit evidence, not a blanket mandatory reread/retry loop. An observed unsuccessful read of material cited for a verified claim (without later successful access) prevents that endorsement and leaves the work unverified; it does not trigger another Reviewer, a read-event retry loop or a Worker defect. A missing read event alone is not failure, and inline TASK needs no duplicate read: `reviewer-reads.json` lists it under `inline`, not `required`/`missing`. The hash-bound `launch-diff.txt`, when present, is listed under `optional`: an actual read appears in `succeeded` (or `errors`), it is never `missing`, and citing `launch-diff` is checked like other cited material. Prefix @ is stripped once before home/cwd resolution. Reads prove access, not comprehension, completeness or semantic/visual correctness.
|
|
18
|
+
|
|
19
|
+
Malformed model responses can be repaired within the same Reviewer session and deadline. A final assistant API error or abort after Pi settles is treated as unavailable, not malformed JSON. A valid negative assessment is never retried to seek a pass. Missing/failed review evidence must be reported unverified, not fabricated accepted. Reviewer unavailability/exhaustion retains existing work and permits eligible independent actions around the affected action/dependency/operation holds, then delivers available results with exact limitations. Existing genuine blockers are still grouped and delivered alongside the unverified result, without inventing a new human gate from the Reviewer failure. Goal budget-limited workspace results are preserved even when the first review fails. No evaluator repair, forced new review, new Worker allowance or routine human confirmation. Durable attempted reviews lacking disposition forbid blind redispatch, even when a response file exists.
|
|
20
|
+
|
|
21
|
+
Owned process-group cleanup preserves PID identity; inherited lease refuses overlap with an orphan Reviewer. These are cooperative host boundaries, not an OS sandbox against malicious same-UID tools. Never read credentials. No authority for paid models or new live tests comes from the adapter itself.
|
|
22
|
+
|
|
23
|
+
## Chat A reports and receiver
|
|
24
|
+
|
|
25
|
+
Chat A receives passive actual Worker/Reviewer-start notices and Core reporting requests via the existing private Pi inbox and durable receipts. It narrates the actual result without decisions, task repair, grants, human-input fabrication or Worker launches. State-report envelopes may coalesce pending same-run/session state reports; human questions/reviews are never superseded. Reporter enqueueing is not acceptance or exactly-once model output. Reporter usage is separate from Worker/Reviewer budgets.
|
|
26
|
+
|
|
27
|
+
Reports use standalone STATUS and separate TL;DR, Summary, Report, Suggested action, Full run status headings with blank lines. Start with current bridge-status plus supplied compact Core facts; healthy matching terminal results need no extra reads. Explain delivered versus accepted/unverified, real human needs, and whether a stage actually started. Unknown evidence/internal role failures are not human approval gates. Final delivery failure must not erase independently accepted work. See [report format](../references/reviewed-runs.md#human-facing-report-formatting).
|
|
28
|
+
|
|
29
|
+
Resource/event waits remain distinct from human waits; reminders use no model turns. Existing aliases, receiver session entries/identity, read-only status, duplicate-launch refusal, `/ppp-respond` addressed text/native confirmation and advanced JSON stay compatible. Session reopening restores monitoring, not execution replay. UI-close autonomy, arbitrary other-chat access and cross-chat catch-up remain deferred, not claimed by local fixtures.
|
|
30
|
+
|
|
31
|
+
Artifacts: context/request/review JSON, immutable evidence, reviewer.json (actual provider/model/session/lifecycle), reviewer-sessions/, reviewer stderr/stdout, bounded response attempts/results, read audit, durable dispatch attempt/receipt. No eval.stdout, evaluator source or evaluator revision journal is created. Artifact existence alone is not acceptance; missing usage is unknown, never zero or actual subscription billing. Current fake-process/unit checks do not establish live model correctness; new live tests require authorization.
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
# Manual E2E — <attempt>
|
|
2
|
+
|
|
3
|
+
Copy into `.pi/ping-pong/manual-e2e/<attempt>/report.md` **before preparation**, not into tracked docs. Keep it out of Git. Keep private (directory 0700, file 0600). Replace placeholders with observations or `unknown`/`not received`; never fabricate a timestamp, zero count, decision or PASS. This template is not a completed run report. Reports sent to the launching chat must put the task result before paths and follow the ordered **STATUS → TL;DR → Summary → Report → Suggested action → Full run status** contract in [reviewed-run guidance](../references/reviewed-runs.md#human-facing-report-formatting). The chat report must remain readable without opening artifacts; evidence paths support claims but do not replace explaining what happened.
|
|
4
|
+
|
|
5
|
+
## Status
|
|
6
|
+
|
|
7
|
+
- Case / attempt:
|
|
8
|
+
- Created UTC:
|
|
9
|
+
- Last observed UTC:
|
|
10
|
+
- Observation stage: preparation / awaiting user launch / running / waiting human / terminal / postmortem
|
|
11
|
+
- Task outcome: **NOT RUN** / RUNNING / BLOCKED / INCOMPLETE / PASS / FAIL / UNKNOWN
|
|
12
|
+
- Lifecycle: not started / active / waiting / stopped / complete / unknown
|
|
13
|
+
- Test assertions (separate from task completion):
|
|
14
|
+
- Concrete failure / missing result:
|
|
15
|
+
|
|
16
|
+
A human-gate test may pass while its task remains BLOCKED. No terminal evidence means no claimed Core finish. A timeout observing the run does not prove its processes stopped.
|
|
17
|
+
|
|
18
|
+
## Input and launch
|
|
19
|
+
|
|
20
|
+
- Full original user prompt (or immutable local copy path):
|
|
21
|
+
- Worktree realpath:
|
|
22
|
+
- Run directory / run_id (unknown until prepared):
|
|
23
|
+
- TASK / config paths:
|
|
24
|
+
- User launch command:
|
|
25
|
+
- User launch observed UTC / evidence (or `not received`):
|
|
26
|
+
- Initial Git revision / working-tree changes:
|
|
27
|
+
- Final Git revision / observed changes since start:
|
|
28
|
+
- Installed Pi version, executable path (observed, not a version gate):
|
|
29
|
+
- Actual receiver / bridge path, source/install differences:
|
|
30
|
+
- Goal version if available:
|
|
31
|
+
- Worker provider/model/thinking:
|
|
32
|
+
- Reviewer provider/model:
|
|
33
|
+
- Launching session / actual reviewing session identity:
|
|
34
|
+
- Reviewer separate from Worker? Separate from launching chat? Evidence, not assumption:
|
|
35
|
+
- Configured main/closure authority, cycle/review/active-operation limits:
|
|
36
|
+
- Repository check command / exit / log:
|
|
37
|
+
|
|
38
|
+
Do not dump environment, auth files, secret application config, addresses or credential values. Source/install differences and updates are observations; preserve actual errors rather than applying historical candidate gates.
|
|
39
|
+
|
|
40
|
+
## Timeline — append observations
|
|
41
|
+
|
|
42
|
+
| Observed UTC | Event | Run/cycle/review identity | Evidence path | Result / next step |
|
|
43
|
+
| --- | --- | --- | --- | --- |
|
|
44
|
+
| | Report created before preparation | | | NOT RUN |
|
|
45
|
+
|
|
46
|
+
Include preparation failure, launch receipt, Worker boundaries and test results, actual Reviewer assessments or limitations, human request/response, continuation, terminal state or last known event. Preserve earlier entries when correcting an interpretation. Do not invent missing events from the intended sequence.
|
|
47
|
+
|
|
48
|
+
## Checks
|
|
49
|
+
|
|
50
|
+
| Requirement | PASS / FAIL / UNVERIFIED / NOT RUN | Actual measurement / error | Evidence |
|
|
51
|
+
| --- | --- | --- | --- |
|
|
52
|
+
| Task-specific outputs | | | |
|
|
53
|
+
| Independent Reviewer assessment (including semantic or visual judgment where relevant) | | | |
|
|
54
|
+
| Core acceptance / finish | | | |
|
|
55
|
+
| Browser assertions + visual review (site cases) | | | |
|
|
56
|
+
| Human wait / quiet state / same-run continuation (case 3) | | | |
|
|
57
|
+
| External delivery (case 3; separate from API acceptance) | | | |
|
|
58
|
+
| Scope violations / unrelated writes | | | |
|
|
59
|
+
|
|
60
|
+
## Process data and retained artifacts
|
|
61
|
+
|
|
62
|
+
- `launch-attempt.json`: path or **absent**
|
|
63
|
+
- `bridge-status.json`: path or **absent**; observed status/reason
|
|
64
|
+
- `execution-state.json`: path or **absent**; observed execution/cycle/consumption/blockers
|
|
65
|
+
- `launcher.log`: path or **absent**; relevant bounded error excerpt
|
|
66
|
+
- `reviews/`: actual requests, retained evidence, assessments or review failures, or **absent**
|
|
67
|
+
- `pi-inbox/` and delivery receipts: actual paths/status, or **absent**
|
|
68
|
+
- `sessions/` / native events: actual paths, or **absent**
|
|
69
|
+
- Checkpoints and retained evidence: actual paths, or **absent**
|
|
70
|
+
- Browser assertions, console errors, screenshots: paths or **not received**
|
|
71
|
+
- Human gate before/after observations: paths and timestamps, or **not received**
|
|
72
|
+
- Actual Worker cycles and count source: **unknown until measured**
|
|
73
|
+
- Reviewer sessions / turns and count sources: **unknown until measured**
|
|
74
|
+
- Worker/Reviewer token usage separately, source and completeness: **unknown until measured**
|
|
75
|
+
- Available subscription quota: **unknown unless reported**
|
|
76
|
+
- Owned local server / process cleanup: observed stopped / still active / unknown
|
|
77
|
+
|
|
78
|
+
Raw artifacts stay in their original private run paths and out of Git; link them, do not paste full transcripts into chat. Keep config/TASK and prior reviews intact. Do not collect unrelated personal sessions. Usage missing is not zero; catalog USD prices are not subscription charges. If no artifacts appeared, preserve this report and the command/error evidence anyway.
|
|
79
|
+
|
|
80
|
+
## Conclusion
|
|
81
|
+
|
|
82
|
+
- Last proven event:
|
|
83
|
+
- Expected but absent events/artifacts:
|
|
84
|
+
- Task outcome and independent test-assertion outcomes:
|
|
85
|
+
- Concrete cause, or unknown (distinguish hypothesis):
|
|
86
|
+
- User action required, if any:
|
|
87
|
+
- Unverified / incomplete:
|
|
88
|
+
- No relaunch, resume, replay or automatic external-send retry performed:
|