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
15 changes: 15 additions & 0 deletions packages/opencode-plugin/agents/goop-orchestrator.md
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,21 @@ If a gate fails, return `BLOCKED` with the exact missing requirement and the cor

Deviation rules: see `references/phase-gates.md` §Four-Rule Deviation System. Apply automatically when executors report issues. If unsure, default to Rule 4. In lazy autopilot, decide Rule 4 triggers autonomously and log full rationale to ADL instead of pausing to ask.

## Never Pause Between Tasks or Waves (Lazy Autopilot)

In lazy autopilot, do not pause between tasks, between waves, or at any intra-phase checkpoint. Continue autonomously through the entire execute phase without waiting for user input, except for the two enumerated hard stops below. This applies to every checkpoint that is not itself the spec-lock gate or the acceptance gate — those two remain absolute per `references/phase-gates.md` §Bypass Policy and are never affected by this section.

**The only two reasons to stop and wait for a literal user reply under lazy autopilot:**

1. Credentials or secrets are required.
2. A destructive, irreversible operation is about to run (e.g. the `/goop-accept` merge offer).

Everything else — Rule 1/2/3 deviations, Rule 4 architectural decisions, per-wave blueprint review, wave-to-wave transitions, checkpoint saves, PR creation, mid-wave research dispatch — is decided autonomously and logged to ADL. Do not ask "should I continue?", do not summarize-and-wait, do not treat a completed wave as an implicit stopping point. Call the next tool or dispatch the next task in the same turn.

**Do not wait to be nudged.** The runtime lazy-autopilot nudge (`references/phase-gates.md` §Lazy Autopilot Nudge) is a safety net for missed continuations, not a permitted rhythm. Treat every nudge firing as a signal that continuation should already have happened without it.

See `references/phase-gates.md` §Hard Stops in Autopilot and §Lazy Autopilot Nudge for the full mechanism.

## Subagent Response Contract

Every subagent returns the standard section contract — see `references/response-format.md`. Parse status to route: `complete` → continue, `partial` → resume/assess, `blocked` → apply Rule 4, `checkpoint` → generate `HANDOFF.md`.
Expand Down
9 changes: 5 additions & 4 deletions packages/opencode-plugin/commands/goop-discuss.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ goop_reference({ name: "discovery-interview" })

## Steps

1. **Create a new workflow** — do not reuse the active one. Infer a kebab-case `workflowId` from the user's prompt (or use the supplied `workflow-id` argument), then:
- `goop_state({ action: "create-workflow", workflowId: "<new-id>" })`
- `goop_state({ action: "set-active-workflow", workflowId: "<new-id>" })`
1. **Create and activate a new workflow in a single call** — do not reuse the active one, and do not split this into a separate `create-workflow` + `set-active-workflow` pair. Infer a kebab-case `workflowId` from the user's prompt (or use the supplied `workflow-id` argument), then:
- `goop_state({ action: "create-workflow", workflowId: "<new-id>", activate: true })`
- Trust a successful response and move to step 2 immediately. Do not regenerate the ID or repeat this call — see `references/core-protocol.md` §Trust Successful Tool Results for why repeating an already-succeeded state call is a bug, not a safety measure.
2. **Checkout a new git branch** named after the workflowId before any file writes:
- `git checkout -b <workflowId>`
- All implementation work for this workflow happens on this branch. Agents must never switch branches mid-workflow or work across multiple branches simultaneously.
Expand All @@ -47,7 +47,7 @@ goop_reference({ name: "discovery-interview" })

If `workflow.lazyAutopilot == true`, infer all six categories from the user's prompt, skip the `question` tool, then:

1. Create and bind a **new** workflowId (never reuse the active workflow).
1. Create and activate a **new** workflowId in a single call (never reuse the active workflow): `goop_state({ action: "create-workflow", workflowId: "<new-id>", activate: true })`.
2. Checkout a new git branch: `git checkout -b <workflowId>`.
3. Write REQUIREMENTS.md via `goop_write_db({ doc_type: "requirements", content: "..." })`.
- Infer atomic PR preference as `Yes` (one PR per wave) unless the user's prompt explicitly opts out. Include `## Atomic PR Strategy: Yes — one PR per wave` in the inferred REQUIREMENTS.md.
Expand All @@ -66,6 +66,7 @@ mcp_slashcommand({ command: "/goop-plan" })
## Anti-patterns

- Reusing or appending to the current active workflow instead of creating a new one.
- Repeating `create-workflow`/`set-active-workflow` calls, or regenerating the workflowId, after a call already returned success. Verify with `goop_status` or `goop_state({ action: "get" })` if genuinely uncertain — never blindly retry a successful mutation.
- Starting work on `main` or the previous workflow's branch.
- Skipping branch creation before file writes.
- Skip the six discovery categories.
Expand Down
2 changes: 1 addition & 1 deletion packages/opencode-plugin/commands/goop-execute.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ When lazy autopilot is active during the execute phase, a runtime nudge fires af

### Suppression Guards

The nudge is suppressed by nine guards (see `src/hooks/lazy-autopilot-nudge/guards.ts`): lazy autopilot disabled, wrong phase, pending compaction, awaiting acceptance, high-severity blocker, hard-stop question (credentials/destructive), mid-work (last message not from assistant), rate-limited, and kill-switch off.
The nudge is suppressed by eleven discriminated guards — see `references/phase-gates.md` §Suppression Guards (Eleven Discriminated Reasons) for the authoritative table and `src/hooks/lazy-autopilot-nudge/guards.ts` for the implementation. Do not restate the count or the list here; if the guard set changes, update `phase-gates.md` only, so this doc can't drift out of sync again.

### Rate Limit

Expand Down
8 changes: 7 additions & 1 deletion packages/opencode-plugin/references/core-protocol.md
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ Message 2: goop_state({ action: "set-autopilot", autopilot: true, lazy: true })
Single message: goop_state({ action: "create-workflow", workflowId: "my-workflow", activate: true })
```

(Note: once the `activate` flag lands, this becomes a single call instead of two — the best fix is often to eliminate the second call entirely via a tool-design improvement, not just batch it.)
(The `activate` flag already collapses create + switch into one call — see `tool-reference.md`. Never issue `create-workflow` followed by a separate `set-active-workflow` call for the same ID; the two-call form above is the anti-pattern, not a fallback.)

```
Single message, two parallel tool calls:
Expand All @@ -157,6 +157,12 @@ Single message, two parallel tool calls:
(called together in the same turn since neither depends on the other's output)
```

### Trust Successful Tool Results — Do Not Retry-Without-Progress

A tool call that returns success is durable. Do not re-issue it, regenerate an ID it already created, or repeat a multi-step sequence out of unwarranted doubt about uniqueness or persistence. This produced a real orchestrator failure: repeatedly calling `create-workflow`/`set-active-workflow` with a freshly regenerated workflowId, several times in a row, with every call succeeding and no error ever surfacing — pure wasted repetition with no forward progress, and no document ever said "stop, you're done."

If you are unsure whether a prior state-mutating call took effect, verify explicitly (`goop_state({ action: "get" })` or `goop_status`) before deciding whether to act again. Re-doing a successful mutation is not verification — it is the loop.

## Agent Boot Sequence

**Recommended path:** [`goop_boot`](tool-reference.md) (documented in `tool-reference.md`) can combine state, optional doc reads, Field Note search, memory search, and reference load into a single call. It loads documents only when you explicitly pass `doc_types` matching your role's default below (or more). New agent work should prefer `goop_boot` for efficiency. The granular step-by-step sequence remains valid and is useful when an agent needs fine control over which pieces to fetch.
Expand Down
2 changes: 2 additions & 0 deletions packages/opencode-plugin/references/phase-gates.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,8 @@ Stop and wait for user input only for:

On a Rule 4 trigger, decide autonomously using best judgment (do not pause to ask the user). Log the full rationale to ADL via `goop_adl` for every such call, including the rule number, the issue, the decision made, the reasoning, and the affected files.

No other checkpoint is a valid reason to stop and wait in lazy autopilot — this includes wave-to-wave transitions, the per-wave blueprint review gate (see `task-decomposition.md` §Post-Wave Review Gate), checkpoint saves, and routine deviation handling. Only the two hard stops above (credentials/secrets; destructive/irreversible operations) and the acceptance gate's explicit merge-offer reply qualify.

### Lazy Autopilot Nudge (Runtime Enforcement)

Pausing during the execute phase under lazy autopilot is disallowed except for the enumerated hard stops (credentials/secrets, destructive operations). This is now **runtime-enforced by an injected nudge**, not prose alone.
Expand Down
4 changes: 4 additions & 0 deletions packages/opencode-plugin/references/task-decomposition.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,10 @@ After all waves are drafted:
2. If the user chooses per-wave review, iterate each wave with options: **Approve Wave**, **Request More Research**, **Clarify Scope**.
3. Only finalize the blueprint when every wave is approved.

### Autopilot Behavior

Under `autopilot` or `lazyAutopilot`, skip the interactive per-wave review entirely: automatically select "Approve All" and finalize the blueprint without waiting for user input. Log the auto-approval to ADL via `goop_adl`. This mirrors the plan→execute contract-gate skip described in `references/phase-gates.md` §Autopilot Behavior — lazy autopilot never pauses for this gate.

## Depth Tiers

| Tier | Discuss | Plan | Research | Agents | Token Impact |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,7 @@ describe("lazy autopilot nudge guards", () => {
expect(result.reason).toEqual({ kind: "kill-switch-off" });
});

it("positive path: allows the nudge when all nine guards pass", () => {
it("positive path: allows the nudge when all guards pass", () => {
const ctx = createMockPluginContext({ testDir });
const result = evaluateNudgeGuards(ctx, baseInput());

Expand Down
Loading