Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ integration tests, and application-context smoke tests pass; no Spring Boot 3.x
artifacts remain; and the migration guide is updated. Open a PR or MR, but do not merge or deploy.
```

Autopilot requires Node.js 24+ and Git. Optional harness integrations can provide delegated workers and live activity; Autopilot falls back to direct harness execution when they are unavailable. Remote delivery also requires `gh` or `glab` and explicit per-run grants.
Autopilot requires Node.js 24+ and Git. Pi can load the packaged Autopilot extension and an active `pi-subagents` owner for process-local structured execution; an unavailable owner selects the distinct direct Pi CLI fallback before admission. Autopilot never installs or enables these components. Remote delivery also requires `gh` or `glab` and explicit per-run grants.

Use `/autopilot status` to check overnight progress, `/autopilot resume` to continue an interrupted nonterminal run, or `/autopilot stop` to end a run while preserving its work. `/autopilot address review comments` snapshots feedback from the exact open PR/MR, creates a sealed amendment successor, and resolves provider-resolvable threads only after the fix passes. After provider-confirmed merge, `/autopilot wrap up` performs guarded remote-branch, sibling-worktree, local-branch, and amendment-chain cleanup; use `/autopilot wrap up with handoff` to preserve project-local summaries.

Expand Down
2 changes: 1 addition & 1 deletion docs/prerequisites.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ The [`autopilot`](../skills/autopilot) skill requires these tools:
- Node.js 24 or newer
- Git
- At least one supported harness CLI: Claude Code, Codex, Pi, or OpenCode
- Optional: `pi-subagents` 0.53.0 or newer for delegated Pi workers and visible activity; direct Pi remains available as a fallback
- Optional: an installed and active `pi-subagents` 0.53.0 or newer for the process-local Pi backend; the packaged Autopilot Pi extension probes it before launch, and direct Pi remains a distinct fallback
- `gh` for GitHub delivery or `glab` for GitLab delivery

Autopilot checks these tools automatically before starting a run and reports anything missing. It never installs tools, downloads runtimes, or changes authentication.
4 changes: 3 additions & 1 deletion skills/autopilot/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Autopilot is not a prompt loop. It seals your request into an immutable charter,

## Use it

You need Node.js 24+, Git, and at least one supported harness CLI. Remote delivery also needs authenticated `gh` or `glab`. Autopilot checks the environment before launch; it never installs tools or signs you in.
You need Node.js 24+, Git, and at least one supported harness CLI. Remote delivery also needs authenticated `gh` or `glab`. Pi can use the packaged Autopilot extension with an installed and active `pi-subagents` 0.53.0+ owner for process-local execution; otherwise it reports the distinct direct CLI fallback. Autopilot checks the environment before launch; it never installs tools, enables extensions, or signs you in.

From the project repository, invoke the skill through your host:

Expand All @@ -19,6 +19,8 @@ replace removed APIs, and preserve the existing HTTP and persistence behavior. D
changes and rollback notes. Open a PR, but do not merge or deploy it.
```

When using Pi's process-local backend, load `runtime/dist/src/pi-extension-entry.js` through Pi's documented extension or package mechanism, then start the sealed charter with `/autopilot-start <charter-file>`. The owning Pi process must remain uninterrupted; losing it makes the exact attempt unknown and never triggers a replacement.

Autopilot will:

1. turn the request into explicit work items, completion predicates, budgets, and grants;
Expand Down
8 changes: 5 additions & 3 deletions skills/autopilot/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ disable-model-invocation: true

# Autopilot

Autopilot delegates bounded coding work to a fresh Claude Code, Codex, Pi, or OpenCode process. Its runtime owns lifecycle state, Git commits, verification, remote delivery, and completion decisions.
Autopilot delegates bounded coding work to a fresh Claude Code, Codex, Pi, or OpenCode execution. Pi implementations prefer the packaged process-local extension backend; other modes and the Pi fallback use their declared CLI boundaries. The runtime owns lifecycle state, Git commits, verification, remote delivery, and completion decisions.

## New-run preconditions

Expand Down Expand Up @@ -64,13 +64,13 @@ Start the successor normally. The runtime revalidates the immutable feedback sna
7. Set `commitPolicy.preCommitHook` explicitly. Prefer `run` when the repository configures a project pre-commit hook; use `skip` only when the user approves bypassing that project policy. Inspect hook code without executing it and include its known outputs in `commitPolicy.writableRoots`, repository writable roots, and runtime `files.read`/`files.write` grants without widening the worker's roots. Ask when those effects cannot be bounded.
8. Save the proposed charter outside the repository or in an explicitly writable documentation path.
9. Before starting the foreground process, report the work titles, branches, delivery boundary, and known unverified boundaries. The skill can rediscover the run later; do not ask the user to record runtime paths or identifiers.
10. Start in the foreground:
10. Start in the foreground. For Pi, when the packaged Autopilot extension and compatible process-local `pi-subagents` owner are active, instruct the operator to run `/autopilot-start <charter-file>` in that owning Pi session; do not start a second outer Pi process. For other harnesses, or when Pi reports the distinct direct fallback, run:

```bash
node runtime/dist/src/cli.js start <charter-file>
```

11. During Pi runs, surface the runtime's stderr activity lines instead of hiding the command output. When `pi-subagents` 0.53.0+ is available, these lines show the delegated worker's live tool, token, and terminal activity; otherwise report the direct-worker fallback.
11. During Pi runs, surface bounded stderr activity instead of hiding it. The process-local path remains visible through Pi's ordinary foreground subagent observability and binds completion to the exact extension instance. An unavailable owner is selected and reported as the direct fallback before admission; never infer one mode's assurance from the other.
12. Report the terminal result and any new unverified boundaries. After every recorded PR/MR is merged, use `wrap-up` only when the user wants Autopilot to remove its exact remote branches, sibling worktrees, local branches, and canonical run-state chain.

## Lifecycle commands
Expand All @@ -86,6 +86,8 @@ node runtime/dist/src/cli.js [--state-dir <path>] [--handoff] wrap-up [run-id]
node runtime/dist/src/cli.js doctor
```

The packaged Pi extension additionally provides `/autopilot-start <charter-file>`, `/autopilot-resume [run-id]`, and `/autopilot-recover <run-id> <recovery-request-json>`. These commands invoke the same runtime core without giving the extension or worker journal ownership. A reload, session replacement, or whole-process loss during an admitted process-local implementation becomes `EXECUTION_STATE_UNKNOWN`.

These are internal and recovery commands; users normally invoke the skill forms above. Use the same `--state-dir` for every direct command addressing a run. Omitted-ID lifecycle commands discover unsuperseded runs for the current repository and mutate only one unambiguous candidate. `pause` enters nonterminal waiting only after active implementation is observed quiescent. `resume` continues an interrupted or paused nonterminal run. A stopped run requires a successor charter. `wrap-up` is destructive: without a run ID it proceeds only when discovery finds exactly one successful unsuperseded provider-delivered run; otherwise it lists candidates without mutation. `--handoff` writes optional Markdown and JSON summaries under `.autopilot/handoffs/` before cleanup.

## Safety rules
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ Add `test/attempt-context.test.ts` only if context assembly becomes a distinct p
5. Write an immutable, user-only context artifact under the existing attempt-report area before recording `ATTEMPT_STARTED`. A crash may leave an unreferenced artifact; it must not create a lifecycle transition.
6. Add the context hash and source journal sequence or hash to `ATTEMPT_STARTED`. Parse these fields compatibly for journals created before this change.
7. Render one worker prompt from the normalized context. Adapter-specific argument builders may change transport syntax, but they must not add authority or omit required semantics.
8. Continue to pass the rendered task through the Pi bridge. Do not teach the bridge a second context format unless Pi needs structured fields for a demonstrated capability.
8. Pass the same rendered task through Pi process-local structured delegation or the distinct direct fallback. Do not introduce a second context format unless a demonstrated capability requires structured fields.
9. On a replacement attempt, build a new context from reconciled state. Never reuse a stale lease, deadline, expected head, or prior context artifact.
10. Treat repository guidance and review findings as labeled data. They may appear only through sealed assumptions or normalized evidence fields and cannot alter grants or predicates.

Expand Down Expand Up @@ -487,7 +487,7 @@ skills/autopilot/runtime/test/fault-injection.test.ts

## Phase 7: Finish documentation and packaging

**Result:** Implemented for Phases 0–6A. Phase 6B is not promoted under the recorded no-receiver decision and is not a current release blocker. The current validation baseline is 162 Node tests locally and a 93-file package dry run; the previous 137-test baseline passed on Ubuntu and Windows.
**Result:** Implemented for Phases 0–6A. Phase 6B is not promoted under the recorded no-receiver decision and is not a current release blocker. The current validation baseline is 200 Node tests locally, including the later Pi process-local backend; the earlier 162-test and 137-test baselines passed at their recorded revisions on Ubuntu and Windows.

### Files

Expand Down Expand Up @@ -560,7 +560,7 @@ GitHub Actions run [33335872725](https://github.com/drafael/coding-harness/actio

### Direct Pi validation evidence

Pi 0.84.4 completed five isolated `--no-session --no-extensions` calls against a disposable Git repository. The matrix covered two sequential calls in one worktree, an explicit retry context, two additional calls in a sibling worktree under distinct run identities, and a read-only exact-tree review. Each implementation call created only its unique nonce file with the expected content; the review returned `AUTOPILOT_REVIEW_RESULT:{"verdict":"clean","findings":[]}`. No output contained the historical `ctx is stale` error or either captured-context invalidation phrase. This validates the current direct Pi path for repeated process-isolated calls; it does not change the structured `pi-subagents` worker path or claim compatibility for the retired `/run` slash bridge.
Pi 0.84.4 completed five isolated `--no-session --no-extensions` calls against a disposable Git repository. The matrix covered two sequential calls in one worktree, an explicit retry context, two additional calls in a sibling worktree under distinct run identities, and a read-only exact-tree review. Each implementation call created only its unique nonce file with the expected content; the review returned `AUTOPILOT_REVIEW_RESULT:{"verdict":"clean","findings":[]}`. No output contained the historical `ctx is stale` error or either captured-context invalidation phrase. This remains evidence for the distinct direct Pi fallback at that revision; the later process-local structured backend has its own exact-admission and continuity tests and does not rely on the retired `/run` slash bridge.

## Cross-cutting test matrix

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Cooperative harness execution implementation plan

- **Status:** Approved design; PR 1 decision/promotion shutdown, PR 2 execution assurance, and PR 3 fenced unknown-execution recovery are complete; harness integration remains pending
- **Status:** Approved design; PR 1 decision/promotion shutdown, PR 2 execution assurance, PR 3 fenced unknown-execution recovery, and PR 4 Pi process-local integration are complete; Windows native-path removal remains pending
- **Date:** 2026-08-31
- **Audience:** Autopilot implementers and reviewers
- **Related:** [Architecture](architecture.md), [continuity implementation plan](2026-08-30-continuity-evidence-implementation-plan.md), [durable event engine ADR](adr/0001-durable-event-engine.md)
Expand Down Expand Up @@ -453,8 +453,8 @@ Pause and revisit the design if implementation shows any of the following:

## Remaining evidence gaps

- Live Pi fault-injection against extension reload, session replacement, whole-process loss, and late writes has not been run.
- Controlled Pi process-local tests cover exact admission, cancellation, terminal-before-shutdown precedence, reload/session invalidation, lost admission, late/mismatched result rejection, direct fallback, and runtime-core completion in one reused local repository fixture. Whole-process live fault evidence remains environment-specific and does not prove OS quiescence or provider parity.
- No provider currently proves Windows process-tree quiescence through its public subagent contract.
- Codex app-server live rejoin, OpenCode disconnect reconciliation, and Claude interruption behavior were researched but not exercised for this design.
- Cooperative terminality does not prevent external effects performed by worker tools before terminal response.
- The exact Pi extension packaging and invocation surface must be chosen from complete Pi documentation during PR 4.
- The Pi entry point follows the documented package manifest at `runtime/dist/src/pi-extension-entry.js` and registers `/autopilot-start`, `/autopilot-resume`, and `/autopilot-recover`; callers must load it through Pi's normal package or extension mechanism.
2 changes: 1 addition & 1 deletion skills/autopilot/docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,4 @@ Both figures use the vendored Diagram Design default profile. The PNG exports ar

## Verification status

The runtime has 162 Node tests locally covering deterministic attempt context, predicate evidence maps, exact-tree review fixtures, local Git lifecycle behavior, crash reconciliation, intentional pause, exact-subject provider waiting, hooks, queues, stacks, sealed review-feedback amendments, GitHub and GitLab provider contracts, sibling worktrees, descendant process cancellation, and wrap-up. Disposable exact-tree reviews passed with Pi 0.84.4, Codex 0.151.0, and OpenCode 1.18.25; Claude Code 2.1.251 remains unverified because its identity-linked API key requires an `ANTHROPIC_WORKSPACE_ID` that is not present in the validation environment. GitHub PR creation, marker reconciliation, exact review-thread resolution, exact-head amendment, merge, and wrap-up passed on authorized private disposable targets with `gh` 2.98.0. GitLab MR creation and reconciliation, exact discussion resolution, duplicate-status latest selection, exact-head amendment, merge, and wrap-up passed on authorized private disposable targets with `glab` 1.115.0.
The runtime has 200 Node tests locally covering deterministic attempt context, predicate evidence maps, exact-tree review fixtures, local Git lifecycle behavior, crash reconciliation, intentional pause, exact-subject provider waiting, hooks, queues, stacks, sealed review-feedback amendments, GitHub and GitLab provider contracts, sibling worktrees, descendant process cancellation, and wrap-up. Controlled Pi 0.84.4 with pi-subagents 0.60.0 process-local tests cover exact admission, cancellation, extension-context loss, direct fallback, and runtime-core completion in a reused local repository; disposable exact-tree reviews also passed with Pi 0.84.4, Codex 0.151.0, and OpenCode 1.18.25; Claude Code 2.1.251 remains unverified because its identity-linked API key requires an `ANTHROPIC_WORKSPACE_ID` that is not present in the validation environment. GitHub PR creation, marker reconciliation, exact review-thread resolution, exact-head amendment, merge, and wrap-up passed on authorized private disposable targets with `gh` 2.98.0. GitLab MR creation and reconciliation, exact discussion resolution, duplicate-status latest selection, exact-head amendment, merge, and wrap-up passed on authorized private disposable targets with `glab` 1.115.0.
4 changes: 2 additions & 2 deletions skills/autopilot/docs/architecture.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Harness-agnostic Autopilot design

- **Status:** Developer-preview implementation available; POSIX attempt-scoped implementation-process reattachment and controlled-fixture sealed restack successors are packaged. Windows restart reattachment remains disabled while approved cooperative harness execution is implemented; notification wake is not promoted, and live restack mutation remains unverified without renewed disposable-target authority.
- **Status:** Developer-preview implementation available; POSIX attempt-scoped process reattachment, fenced unknown recovery, Pi process-local cooperative execution, and controlled-fixture sealed restack successors are packaged. Windows native-path removal remains pending; notification wake is not promoted, and live restack mutation remains unverified without renewed target authority.
- **Date:** 2026-08-22
- **Audience:** Coding-harness maintainers and adapter authors
- **Implementation plan:** [Autopilot implementation plan](implementation-plan.md)
Expand Down Expand Up @@ -312,7 +312,7 @@ Capability degradation is explicit:

The first adapters target Claude Code, Codex, Pi, and OpenCode. They share one conformance suite.

The Pi adapter prefers the installed `pi-subagents` 0.53.0+ public structured delegation API. Autopilot loads only that extension and its bundled bridge in a headless Pi process, delegates one item to the resolved `worker` role in the runtime-owned worktree, and projects bounded progress to stderr. If the compatible extension is absent, the adapter uses a direct Pi worker and records the fallback. The originating interactive Pi FleetView cannot own this subprocess because Pi's event bus and FleetView are process-local; the stderr projection preserves visible activity without transferring lifecycle authority away from Autopilot.
The packaged Pi extension invokes the same runtime core inside the owning Pi process and probes an installed `pi-subagents` 0.53.0+ owner before selecting process-local structured delegation. The runtime persists admission intent before the extension emits one request, then binds the exact request, logical node, subject, and extension-instance identity. Only one matching terminal response from that uninterrupted instance may proceed to repository verification. Extension reload, session replacement, stale context, process loss, or a missing exact response becomes `EXECUTION_STATE_UNKNOWN` and cannot launch a replacement. Pi's ordinary foreground subagent observability remains available, while bounded activity is also projected to stderr. If the compatible owner is absent or inactive, Autopilot selects and reports the distinct direct Pi CLI fallback before admission. Direct POSIX execution keeps process supervision; direct Windows execution remains session-scoped. Independent review remains a separate direct read-only Pi execution.

## Playbooks

Expand Down
Loading