=== Group 3 dispatch (2026-05-11T14:18:59+02:00) ===
Model: gpt-5.5 / high / fast
Scope: improve/agent (1 command)

Reading additional input from stdin...
OpenAI Codex v0.130.0
--------
workdir: /Users/michelkerkmeester/MEGA/Development/Code_Environment/Public
model: gpt-5.5
provider: openai
approval: never
sandbox: workspace-write [workdir, /tmp, $TMPDIR, /Users/michelkerkmeester/.codex/memories] (network access enabled)
reasoning effort: high
reasoning summaries: none
session id: 019e16f9-f24c-7f32-985a-dad3b193ee19
--------
user
You are migrating the `/improve:*` command Group 3 (1 command) to cite the shared `auto_mode_contract.md` reference and adopt the three-tier `:auto` setup contract.

# RUNTIME RULES (read first)

- Run as inline Codex execution. Do NOT call SpawnAgent, collab: SpawnAgent, Task, or any sub-agent. If you would dispatch, stop and work inline.
- Gate 3 (spec-folder) answer for this run: the spec folder is `.opencode/specs/skilled-agent-orchestration/103-spec-kit-auto-mode-noninteractive-contract/002-auto-mode-contract-generalization-to-all-commands/`. Use it. specFolder=103-002. Do NOT ask interactive questions; stdin is closed.
- Strict scope: edit ONLY the 1 command file below + 002's tasks.md (mark T012 done) + 002's evidence/codex-group3-dispatch.txt (write summary). Anything else is a rollback trigger.
- Do NOT run any /spec_kit:*:auto YAML loop. Markdown edits only.
- Final output: ONE summary message at the end listing every file modified, per-command status, decisions, concerns.

# REPO ROOT
/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public

All paths below relative to this root.

# SCOPE LIST — THE ONLY FILES YOU MAY EDIT

```
.opencode/commands/improve/agent.md
.opencode/specs/skilled-agent-orchestration/103-spec-kit-auto-mode-noninteractive-contract/002-auto-mode-contract-generalization-to-all-commands/tasks.md
.opencode/specs/skilled-agent-orchestration/103-spec-kit-auto-mode-noninteractive-contract/002-auto-mode-contract-generalization-to-all-commands/evidence/codex-group3-dispatch.txt
```

You MAY read any file. You may NOT touch paired YAML assets (`assets/spec_kit_*_auto.yaml`, `assets/spec_kit_*_confirm.yaml`) unless absolutely forced — if forced, document in your final summary with explicit justification.

# CONTEXT — SOURCE OF TRUTH (read in this order BEFORE any edit)

1. **Shared contract** — `.opencode/skills/system-spec-kit/references/workflows/auto_mode_contract.md` — your template authority. §1 three-tier flow, §2 PRE-BOUND ANSWERS grammar, §3 Default Resolution Table format, §4 Tier-3 error template, §5 `:confirm` invariance, §6 verification protocol, §7 adoption checklist, §8 OOS.

2. **Reference example (what the post-migration shape looks like)** — `.opencode/commands/spec_kit/deep-review.md` §0 lines 44-130. This is the canonical example: brief citation + Tier-1/2/3 summary + PRE-BOUND ANSWERS Schema + Default Resolution Table + UNTOUCHED `:confirm` consolidated Q-block below.

3. **Phase 2 spec** — `.opencode/specs/skilled-agent-orchestration/103-spec-kit-auto-mode-noninteractive-contract/002-auto-mode-contract-generalization-to-all-commands/spec.md` — §3 SCOPE, §4 REQUIREMENTS, §5 SUCCESS CRITERIA.

# PER-COMMAND MIGRATION PATTERN

For each of the 1 command in SCOPE LIST, the migration steps are:

## Step A — Read the command's current §0 (UNIFIED SETUP PHASE or equivalent)
Identify:
- Every Q-block field name (Q0, Q1, Q1_type, Q_dims, Q-Exec, etc.)
- Each field's current resolution: flag (from $ARGUMENTS), default, requires-ask, auto-detect from another field
- The full consolidated Q-block content (under the `STATUS: BLOCKED` header in `:confirm` mode)
- Whether the file has a paired YAML asset (it does — under `.opencode/commands/spec_kit/assets/`)

## Step B — Build the per-command Default Resolution Table

For every Q-block field, classify it:

| Column | Meaning |
|---|---|
| Field | the field name (matches the legacy Q-block question label) |
| Required | Y or N |
| Resolves Via | ordered list of resolution sources, e.g. `flag → $ARGUMENTS positional` / `marker → PRE-BOUND` / `default → "<value>"` / `auto-detect from <other field>` / `requires-ask` |
| Default | the documented default value, or `none` |
| Tier-2 Candidate | Y only when no default exists AND user choice is the only path (ambiguity, not absence) |

## Step C — Replace the `:auto` setup branch in §0

In §0, after the existing FIRST MESSAGE PROTOCOL line, add this `:auto`-mode-only section:

```
### `:auto` Setup Resolution

Setup contract: see `.opencode/skills/system-spec-kit/references/workflows/auto_mode_contract.md`.

Under `execution_mode = AUTONOMOUS` (from the `:auto` suffix), follow the three-tier flow:

1. **Tier 1 — Resolve confidently** (contract §1): parse `$ARGUMENTS` flags + `PRE-BOUND SETUP ANSWERS:` block (§2) + the Default Resolution Table below (§3). When every required field is resolved, persist to `<COMMAND-SPECIFIC-PATH>` (shape: <KEY-FIELDS>), bind runtime YAML placeholders, set `STATUS: PASSED`, load `<COMMAND-YAML-ASSET-PATH>`. End §0.

2. **Tier 2 — Targeted ask** (contract §1): when 1-2 required fields are genuinely ambiguous AND no default exists, emit ONE narrow question per ambiguous field. Command-specific Tier-2-eligible fields (per the Default Resolution Table below): `<FIELD-A>`, `<FIELD-B>`. **Ordering rule**: <COMMAND-SPECIFIC-ORDERING-OR-"none-needed">. Missing required fields (absence, not ambiguity) → go to Tier 3.

3. **Tier 3 — Fail fast** (contract §4): emit the named-missing-inputs error format with `/improve:<COMMAND-NAME>:auto` as the command name. Exit non-zero. Do not load YAML.

`:confirm` path stays unchanged — see the consolidated setup prompt section below.
```

Replace `<COMMAND-SPECIFIC-PATH>`, `<KEY-FIELDS>`, `<COMMAND-YAML-ASSET-PATH>`, `<FIELD-A>`, `<FIELD-B>`, `<COMMAND-SPECIFIC-ORDERING-OR-"none-needed">`, `<COMMAND-NAME>` per command.

For commands where Tier-2 candidates are zero or one (because all required fields have defaults or are always supplied via flags), omit the FIELD-B placeholder and simplify the ordering rule.

## Step D — Add the PRE-BOUND SETUP ANSWERS Schema subsection

After the `:auto Setup Resolution` subsection, add:

```
### PRE-BOUND SETUP ANSWERS Schema (for `:auto` non-interactive dispatch)

The dispatched prompt body may contain one structured marker block. Parse it before applying defaults. Grammar: see `auto_mode_contract.md` §2.

\```yaml
PRE-BOUND SETUP ANSWERS:
  <field_a>: <example value>  # comment with type/enum
  <field_b>: <example value>
  ...
\```

Rules: see `auto_mode_contract.md` §2 (unspecified fields fall back to default; marker fields take precedence over $ARGUMENTS flags; unknown fields warn; malformed lines parse-error).
```

List every Q-block field in YAML key form with the appropriate example value and type/enum comment.

## Step E — Add the Default Resolution Table subsection

After the PRE-BOUND Schema, add `### Default Resolution Table` with the 4-column table from Step B.

## Step F — Update the frontmatter `argument-hint`

Add `(:auto supports PRE-BOUND SETUP ANSWERS: prompt-body block for non-interactive setup)` to the existing argument-hint string. Don't strip existing args/flags.

## Step G — PRESERVE the existing `:confirm` consolidated Q-block path UNTOUCHED

Hard invariant: the consolidated setup prompt for `:confirm` mode (the section that emits `STATUS: BLOCKED` and asks Q0..Q-Exec) must NOT be modified. Read-back diff after your edits: the legacy `:confirm` Q-block section header AND body content must remain identical.

# AFTER MIGRATION

1. Update `002/tasks.md`:
   - Mark T012 `[x]` with brief evidence text (`Group 3 codex dispatch completed; 5 commands migrated; see evidence/codex-group3-dispatch.txt`)
   - Update `_memory.continuity` block: `recent_action: "Group 3 improve command migrated"`, `next_safe_action: "Run live verification dispatches (Stage D)"`

2. Write `002/evidence/codex-group3-dispatch.txt`:
   - 1 section
   - Per-section: command name, fields migrated count, Tier-2 candidates identified, any concerns
   - Final line: `EXIT_STATUS: complete` or describe any partial-application

# YOUR FINAL OUTPUT MESSAGE

After all edits, emit ONE markdown message:

1. **Files modified** — bulleted list (path only).
2. **Per-command status (1 command)** — one line per command: `<command>: <N fields migrated> | Tier-2 candidates: <list> | :confirm preserved: yes/no | argument-hint updated: yes/no`.
3. **Decisions you made that the prompt did not pre-specify** — e.g. naming conventions for command-specific config files, default value choices, field-name conflicts.
4. **Concerns for the reviewer** — anything you couldn't resolve, partial applications, unusual edge cases per command.

# CONSTRAINTS

- Stay strictly inside SCOPE LIST.
- `:confirm` block is sacrosanct.
- Do not touch paired YAML assets unless forced (and document the force).
- Do not run any :auto YAML dispatches.
- Do not call SpawnAgent / collab / Task / sub-agents.
- The spec folder is the Gate 3 answer.
hook: SessionStart
hook: SessionStart
hook: SessionStart Completed
hook: SessionStart Completed
hook: UserPromptSubmit
hook: UserPromptSubmit
hook: UserPromptSubmit Completed
hook: UserPromptSubmit Completed
codex
Using `system-spec-kit` for the scoped spec workflow, and I’m keeping this inline as requested. I’ll read the shared contract, reference example, phase spec, then the target command before touching the three allowed files.
exec
/bin/zsh -lc "sed -n '1,220p' .opencode/skills/system-spec-kit/references/workflows/auto_mode_contract.md" in /Users/michelkerkmeester/MEGA/Development/Code_Environment/Public
exec
/bin/zsh -lc "sed -n '1,220p' .opencode/skills/system-spec-kit/SKILL.md" in /Users/michelkerkmeester/MEGA/Development/Code_Environment/Public
 succeeded in 0ms:
---
name: system-spec-kit
description: "Unified spec-folder workflow + context preservation: Levels 1-3+, validation, Spec Kit Memory. Required for file modifications."
allowed-tools: [Bash, Edit, Glob, Grep, Read, Task, Write]
version: 3.4.1.0
---

<!-- Keywords: spec-kit, speckit, documentation-workflow, spec-folder, template-enforcement, context-preservation, progressive-documentation, validation, spec-kit-memory, vector-search, hybrid-search, bm25, rrf-fusion, fsrs-decay, constitutional-tier, checkpoint, importance-tiers, cognitive-memory, co-activation, tiered-injection -->

# Spec Kit - Mandatory Conversation Documentation

Orchestrates mandatory spec folder creation for all conversations involving file modifications. Ensures proper documentation level selection (1-3+), template usage, and context preservation through AGENTS.md-enforced workflows.

## 1. WHEN TO USE

### What is a Spec Folder?

A **spec folder** is a numbered directory (e.g., `007-auth-feature/`) that contains documentation for a single feature/task or a coordinated packet of related phase work:

Spec folders may also be nested as coordination-root packets with direct-child phase folders (e.g., `specs/02--track/022-feature/011-phase/002-child/`).

- **Purpose**: Track specifications, plans, tasks, and decisions for one unit of work
- **Location**: Under `specs/` using either `###-short-name/` at the root or nested packet paths for phased coordination
- **Contents**: Markdown files (spec.md, plan.md, tasks.md, and implementation-summary.md when work is complete) plus optional support folders such as `scratch/`, `research/`, or `review/`

Think of it as a "project folder" for AI-assisted development - it keeps context organized and enables session continuity.

### Activation Triggers

**MANDATORY for ALL file modifications:**
- Code files: JS, TS, Python, CSS, HTML
- Documentation: Markdown, README, guides
- Configuration: JSON, YAML, TOML, env templates
- Templates, knowledge base, build/tooling files

**Request patterns that trigger activation:**
- "Add/implement/create [feature]"
- "Fix/update/refactor [code]"
- "Modify/change [configuration]"
- Any keyword: add, implement, fix, update, create, modify, rename, delete, configure, analyze, phase

**Example triggers:**
- "Add email validation to the signup form" → Level 1-2
- "Refactor the authentication module" → Level 2-3
- "Fix the button alignment bug" → Level 1
- "Implement user dashboard with analytics" → Level 3

### When NOT to Use

- Pure exploration/reading (no file modifications)
- Single typo fixes (<5 characters in one file)
- Whitespace-only changes
- Auto-generated file updates (package-lock.json)
- User explicitly selects Option D (skip documentation)

**Rule of thumb:** If modifying ANY file content → Activate this skill.
Status: ✅ This requirement applies immediately once file edits are requested.

### Distributed Governance Rule

Any agent writing authored spec folder docs (`spec.md`, `plan.md`, `tasks.md`, `checklist.md`, `implementation-summary.md`, `decision-record.md`, `handover.md`, `review-report.md`, `debug-delegation.md`, `resource-map.md` (optional)) MUST use contract-backed templates through `create.sh` or the inline renderer. This is a workflow-required gate, not a runtime hook: run `bash .opencode/skills/system-spec-kit/scripts/spec/validate.sh <spec-folder> --strict` after authored spec-doc writes and before completion claims, then route continuity updates through /memory:save. Deep-research workflow-owned packet markdown (`research/iterations/*.md`, `research/deep-research-*.md`, and progressive `research/research.md` loop updates) is exempt from that generic per-write rule; `/spec_kit:deep-research` must instead run targeted strict validation after every `spec.md` mutation it performs. @deep-research retains exclusive write access for `research/research.md`; @debug retains exclusive write access for `debug-delegation.md`.

- `handover.md` stays in the canonical recovery ladder and is maintained through `/memory:save` handover_state routing using the handover template for initial creation.
- `review-report.md` remains owned by `@deep-review` when deep review workflows synthesize findings.
- `resource-map.md` is a peer cross-cutting template under `.opencode/skills/system-spec-kit/templates/`; it remains optional at any level and gives reviewers a lean file ledger alongside `implementation-summary.md`.

### Utility Template Triggers

| Template              | Trigger Keywords                                                                                                              | Action                    |
| --------------------- | ----------------------------------------------------------------------------------------------------------------------------- | ------------------------- |
| `handover.md`         | "handover", "next session", "continue later", "pass context", "ending session", "save state", "multi-session", "for next AI"  | Suggest `/memory:save` handover maintenance |
| `debug-delegation.md` | "stuck", "can't fix", "tried everything", "same error", "fresh eyes", "hours on this", "still failing", "need help debugging" | Suggest Task-tool debug delegation |

**Rule:** When detected, proactively suggest the appropriate action.

---

## 2. SMART ROUTING


### Resource Domains

The router discovers markdown resources recursively from `references/` and `assets/` and then applies intent scoring from `RESOURCE_MAP`. Keep this section domain-focused rather than static file inventories.

- `references/memory/` for context retrieval, save workflows, trigger behavior, and indexing.
- `references/templates/` for level selection, template selection, and structure guides.
- `references/validation/` for checklist policy, verification rules, decision formats, and template compliance contracts.
- `references/structure/` for folder organization and sub-folder versioning.
- `references/workflows/` for command workflows and worked examples.
- `references/debugging/` for troubleshooting and root-cause methodology.
- `references/config/` for runtime environment configuration.

### Template and Script Sources of Truth

- Level definitions and template size guidance: level specifications reference
- Template usage and composition rules: [template_guide.md](./references/templates/template_guide.md)
- Use the Level contract for operational templates; `create.sh` and the Level contract resolver share the same template index.
- Use `templates/changelog/` for packet-local nested changelog generation at completion time.
- Script architecture, build outputs, and runtime entrypoints: [scripts/README.md](./scripts/README.md)
- Memory save JSON schema and workflow contracts: [save_workflow.md](./references/memory/save_workflow.md)
- Nested packet changelog workflow: [nested_changelog.md](./references/workflows/nested_changelog.md)

Primary operational scripts:
- `spec/validate.sh`
- `spec/create.sh`
- `spec/archive.sh`
- `spec/check-completion.sh`
- `spec/recommend-level.sh`
- `mcp_server/lib/templates/level-contract-resolver.ts`

CLI exit codes:
- `0`: success.
- `1`: user error such as bad flags or invalid input.
- `2`: validation error.
- `3`: system error such as missing folders, missing manifests, or file I/O failures.

### Resource Loading Levels

| Level       | When to Load               | Resources                    |
| ----------- | -------------------------- | ---------------------------- |
| ALWAYS      | Every skill invocation     | Shared patterns + SKILL.md   |
| CONDITIONAL | If intent signals match   | Intent-mapped references     |
| ON_DEMAND   | Only on explicit request   | Deep-dive quality standards  |

`references/workflows/quick_reference.md` is the primary first-touch command surface. Keep the compact `spec_kit` and `memory` command map there, including `/spec_kit:plan --intake-only` as the standalone intake entry, `/spec_kit:plan` and `/spec_kit:complete` smart delegation notes, and the pointer from `/spec_kit:deep-research` to `../deep-research/references/spec_check_protocol.md`, and use this file only to point readers to it rather than duplicating the full matrix.

### Smart Router Pseudocode

The authoritative routing logic for scoped loading, weighted intent scoring, and ambiguity handling.

- Pattern 1: Runtime Discovery - `discover_markdown_resources()` recursively inventories `references/` and `assets/`.
- Pattern 2: Existence-Check Before Load - `load_if_available()` guards, de-duplicates with `seen`, and checks `inventory`.
- Pattern 3: Extensible Routing Key - command and intent signals select routing labels without static file inventories.
- Pattern 4: Multi-Tier Graceful Fallback - `UNKNOWN_FALLBACK` asks for disambiguation and missing-resource cases return a "no knowledge base" notice.

```python
from pathlib import Path

SKILL_ROOT = Path(__file__).resolve().parent
RESOURCE_BASES = (SKILL_ROOT / "references", SKILL_ROOT / "assets")
DEFAULT_RESOURCE = "references/workflows/quick_reference.md"

INTENT_SIGNALS = {
    "PLAN": {"weight": 3, "keywords": ["plan", "design", "new spec", "level selection", "option b"]},
    "RESEARCH": {"weight": 3, "keywords": ["investigate", "explore", "analyze", "prior work", "evidence"]},
    "IMPLEMENT": {"weight": 3, "keywords": ["implement", "build", "execute", "workflow"]},
    "DEBUG": {"weight": 4, "keywords": ["stuck", "error", "not working", "failed", "debug"]},
    "COMPLETE": {"weight": 4, "keywords": ["done", "complete", "finish", "verify", "checklist"]},
    "MEMORY": {"weight": 4, "keywords": ["memory", "save context", "resume", "checkpoint", "context"]},
    "HANDOVER": {"weight": 4, "keywords": ["handover", "continue later", "next session", "pause"]},
    "PHASE": {"weight": 4, "keywords": ["phase", "decompose", "split", "workstream", "multi-phase", "phased approach", "phased", "multi-session"]},
    "RETRIEVAL_TUNING": {"weight": 3, "keywords": ["retrieval", "search tuning", "fusion", "scoring", "pipeline"]},
    "EVALUATION": {"weight": 3, "keywords": ["evaluate", "ablation", "benchmark", "baseline", "metrics"]},
    "SCORING_CALIBRATION": {"weight": 3, "keywords": ["calibration", "scoring", "normalization", "decay", "interference"]},
    "ROLLOUT_FLAGS": {"weight": 3, "keywords": ["feature flag", "rollout", "toggle", "enable", "disable"]},
    "GOVERNANCE": {"weight": 3, "keywords": ["governance", "tenant", "retention", "audit"]},
}

RESOURCE_MAP = {
    "PLAN": [
                "references/templates/template_guide.md",
        "references/validation/template_compliance_contract.md",
    ],
    "RESEARCH": [
        "references/workflows/quick_reference.md",
        "references/workflows/worked_examples.md",
        "references/memory/epistemic_vectors.md",
    ],
    "IMPLEMENT": [
        "references/validation/validation_rules.md",
        "references/validation/template_compliance_contract.md",
        "references/templates/template_guide.md",
    ],
    "DEBUG": [
        "references/debugging/troubleshooting.md",
        "references/workflows/quick_reference.md",
        "manual_testing_playbook/manual_testing_playbook.md",
    ],
    "COMPLETE": [
        "references/validation/validation_rules.md",
        "references/workflows/nested_changelog.md",
    ],
    "MEMORY": [
        "references/memory/memory_system.md",
        "references/memory/save_workflow.md",
        "references/memory/trigger_config.md",
    ],
    "HANDOVER": [
        "references/workflows/quick_reference.md",
    ],
    "PHASE": [
        "references/structure/phase_definitions.md",
        "references/structure/sub_folder_versioning.md",
        "references/validation/phase_checklists.md",
    ],
    "RETRIEVAL_TUNING": [
        "references/memory/embedding_resilience.md",
        "references/memory/trigger_config.md",
    ],
    "EVALUATION": [
        "references/memory/epistemic_vectors.md",
        "references/config/environment_variables.md",
        "manual_testing_playbook/manual_testing_playbook.md",
    ],
    "SCORING_CALIBRATION": [
        "references/config/environment_variables.md",
    ],
    "ROLLOUT_FLAGS": [
        "references/config/environment_variables.md",
    ],
    "GOVERNANCE": [
        "references/config/environment_variables.md",
    ],
}

COMMAND_BOOSTS = {
    "/spec_kit:plan": "PLAN",
    "/spec_kit:implement": "IMPLEMENT",
    "/spec_kit:complete": "COMPLETE",
    "/spec_kit:plan :with-phases": "PHASE",

 succeeded in 0ms:
---
title: Auto Mode Contract Reference
description: Canonical three-tier `:auto` setup-resolution contract shared by every user-invokable `/command:*:auto` surface. Defines tier semantics (resolve → targeted ask → fail-fast), `PRE-BOUND SETUP ANSWERS:` marker grammar, default-resolution table format, fail-fast error template, `:confirm` invariance, and verification protocol.
---

# Auto Mode Contract Reference

This reference module defines the single canonical `:auto` setup-resolution contract used by every user-invokable `/command:*:auto` surface in spec-kit (`/spec_kit:*`, `/create:*`, `/improve:*`). Each command's §0 cites this contract and supplies only its own per-field Default Resolution Table + `PRE-BOUND SETUP ANSWERS:` field list. The contract semantics, marker grammar, error format, and verification protocol live here.

Origin: shipped in `.opencode/specs/skilled-agent-orchestration/103-spec-kit-auto-mode-noninteractive-contract/001-deep-review-three-tier-setup/` (deep-review prototype) and generalized in `.../002-auto-mode-contract-generalization-to-all-commands/` (12-command rollout).

Related memory: `feedback_auto_mode_ask_only_when_ambiguous.md`, `feedback_codex_spawnagent_allowlist.md`, `feedback_gate3_no_tmp_exemption.md`.

---

## §1. Three-Tier Flow

`:auto` mode does NOT mean "never ask" (too rigid) and does NOT mean "always ask the full setup block" (too soft). It means "ask only when uncertain or ambiguous." This is achieved via three tiers, evaluated in order:

### Tier 1 — Resolve Confidently

When `execution_mode = AUTONOMOUS` (from `:auto` suffix), the command's §0 MUST attempt to resolve every required input from these sources in order:

1. **`$ARGUMENTS` flags** — explicit user-passed flags (e.g. `--max-iterations=10`, `--spec-folder=PATH`, command-specific flags)
2. **`PRE-BOUND SETUP ANSWERS:` block in the prompt body** — see §2 for grammar. Caller's explicit prompt-body binding wins over `$ARGUMENTS` when both are present
3. **Documented per-field defaults** — see the command's own Default Resolution Table (§3) for which fields carry sensible defaults

After resolution: if every required field has a value, persist the resolved map to the command's working-config file (e.g. `deep-review-config.json`, `plan-config.json`), set `STATUS: PASSED`, load the paired YAML workflow. Do NOT emit any setup question. End §0.

### Tier 2 — Targeted Ask

Use Tier 2 ONLY when Tier 1 leaves one or two required inputs unresolved AND each unresolved field is genuinely ambiguous AND no sensible default exists.

Constraints:
- Emit ONE narrow question per ambiguous field, naming only the ambiguous field. NEVER the full consolidated Q-block from the legacy setup phase.
- If two fields are ambiguous but one's resolution likely makes the other obvious (e.g. `review_target_type` may make `spec_folder` self-evident), ask the first one first; do not bundle multiple ambiguities into a single prompt.
- Missing required input (e.g. empty `$ARGUMENTS` with no marker for a required positional) is NOT ambiguity. Absence is a Tier 3 case.
- Wait briefly for user reply. If an answer arrives, merge it into the resolved map and re-run Tier 1 from the default-application step. If stdin is closed (`</dev/null`, redirected output, non-interactive dispatch) and no answer arrives, fall through to Tier 3. Never wait indefinitely.

### Tier 3 — Fail Fast

Use Tier 3 when `:auto` still has unresolved required inputs after Tier 1 and Tier 2, OR when Tier 2 produced no answer because stdin is closed.

Emit the named-missing-inputs error format (§4), exit non-zero, do NOT load the YAML workflow, do NOT emit any further setup question.

---

## §2. PRE-BOUND SETUP ANSWERS Schema

The `PRE-BOUND SETUP ANSWERS:` block is a structured marker the dispatched AI parses out of the prompt body. It allows callers to pre-bind setup field values without using individual `$ARGUMENTS` flags.

Grammar (YAML-style key/value, one field per line):

```
PRE-BOUND SETUP ANSWERS:
  <field_name>: <value>  # optional inline comment
  <field_name>: <value>
  ...
```

Rules:

- The block opens with `PRE-BOUND SETUP ANSWERS:` (exact case-sensitive heading, followed by colon). Indentation MAY be inside a markdown fenced code block or inline in the prompt text.
- Each field is `  <key>: <value>` indented two spaces, one per line.
- Values are interpreted by the command's Default Resolution Table (§3). Field types and value enums are command-specific.
- Comments after `#` on a value line are ignored.
- Unknown fields produce a warning (do not abort), so callers may include forward-compatible fields.
- Fields not specified fall back to: command-specific Default Resolution Table → command-specific default value → unresolved (triggers Tier 2 or Tier 3 per §1).
- Malformed lines (e.g. missing `:`, malformed value type) emit a parse error naming the line. Known fields parsed before the error may still be used; remaining unresolved fields continue to Tier 2 or Tier 3.
- A second `PRE-BOUND SETUP ANSWERS:` block in the same prompt body produces a duplicate-block error.

The marker block applies ONLY under `:auto`. Under `:confirm`, the block is informational and does not skip the consolidated question prompt.

---

## §3. Default Resolution Table

Every command MUST publish a Default Resolution Table in its §0 (after citing this contract). The table lists each setup field with the following columns:

| Field | Required | Resolves Via | Default | Tier-2 Candidate |
|-------|----------|--------------|---------|------------------|

Column meanings:

- **Field**: the field name (matches the schema in §2 and the question label in the legacy consolidated Q-block).
- **Required**: `Y` (must be resolved before YAML load) or `N` (optional).
- **Resolves Via**: ordered list of resolution sources, e.g. `flag → $ARGUMENTS` / `marker → PRE-BOUND` / `default → "<value>"` / `auto-detect from <other field>` / `requires-ask`.
- **Default**: the documented default value when no flag, marker, or auto-detection applies. May be `none` (no default — Tier 2 or Tier 3 candidate).
- **Tier-2 Candidate**: `Y` if a missing value can be resolved by ONE targeted question (per §1); `N` if absence triggers fail-fast (Tier 3).

A field is a Tier-2 candidate only when ALL of:
- No flag exists for it.
- No marker is provided.
- No sensible default exists.
- The field is genuinely required (Required=`Y`).
- A user choice is the only resolution path (ambiguity, not absence).

---

## §4. Tier 3 Fail-Fast Error Template

When Tier 3 fires, the command emits this exact format and exits non-zero:

```
[ERROR] /<command>:auto — required inputs unresolved under autonomous mode:
  - <field>: <why-unresolved>
  - <field>: <why-unresolved>
Resolution: provide via $ARGUMENTS flags, PRE-BOUND SETUP ANSWERS: block, or switch to :confirm mode for interactive setup.
```

Rules:

- Replace `<command>` with the canonical command name (e.g. `spec_kit:deep-review`).
- One bulleted line per unresolved required field.
- `<why-unresolved>` is one short phrase: "missing — no flag, no marker, no default" or "ambiguous — Tier 2 received no answer (stdin closed)".
- Final line cites the three resolution paths verbatim.
- Do NOT load the YAML workflow.
- Do NOT emit setup questions in Tier 3.
- Exit code: non-zero (1 is the convention).

---

## §5. `:confirm` Invariance

The `:confirm` mode (interactive, with full consolidated Q-block) is unaffected by this contract. Commands MUST preserve their existing `:confirm` behavior exactly. The contract applies ONLY when `execution_mode = AUTONOMOUS` (from `:auto` suffix or explicit `--mode=AUTONOMOUS` flag).

Test invariant: a `:confirm` dispatch against any contract-adopting command MUST emit the original consolidated Q-block (Q0..Qn). Regression-check this per command after migration.

---

## §6. Verification Protocol

Each contract-adopting command requires four verification traces (dry-run mental dispatch traces against the command's §0):

### Trace A — Tier 1 pass
Dispatch with all required inputs resolvable (flags + markers + defaults). Expected: STATUS PASSED, YAML loaded, no question emitted.

### Trace B — Tier 2 targeted ask
Dispatch with exactly one ambiguous required field. Expected: ONE narrow question naming only that field; NEVER the full consolidated block.

### Trace C — Tier 3 fail fast
Dispatch with one or more truly missing required inputs (and stdin closed in non-interactive runtimes). Expected: error format from §4, exit non-zero, no YAML load.

### Trace D — `:confirm` regression
Dispatch with `:confirm` suffix and any inputs. Expected: existing full consolidated Q-block emitted.

Live verification (when feasible) extends the dry-run traces with actual non-interactive dispatches (codex `exec </dev/null`, opencode `run --pure ... </dev/null`, claude `--print`) capturing transcripts as evidence. Live verification confirms the contract works under real runtime stdin-closure conditions.

Evidence schema (one file per dispatch):
- Command invocation verbatim
- Full transcript
- Verdict footer: PASS / PARTIAL / FAIL / SKIP
- Optional: timing, model, runtime gotchas observed

Stored under `<packet>/evidence/<command-slug>-<trace>.txt`.

---

## §7. Adoption Checklist

For each command adopting this contract, the §0 of the command markdown:

- [ ] Adds a one-line citation: `Setup contract: see references/workflows/auto_mode_contract.md`
- [ ] Provides its own per-field Default Resolution Table (§3) listing every Q-block field with the four columns
- [ ] Provides its own `PRE-BOUND SETUP ANSWERS:` field list (one row per setup field, matching the Default Resolution Table)
- [ ] Documents any command-specific Tier-2 ordering rule (e.g. "ask review_target_type before spec_folder")
- [ ] Updates frontmatter `argument-hint` to reference the new bypass capability
- [ ] Preserves the existing `:confirm` consolidated Q-block path untouched
- [ ] Authors §0 dry-run traces (A/B/C/D) and stores them under the adopting packet's `evidence/`

Commands that have adopted this contract:

- `/spec_kit:deep-review` (prototype) — see `.../103/001-deep-review-three-tier-setup/`
- (to be appended as `.../103/002-...` rolls out)

---

## §8. Out of Scope

- Commands without paired YAML workflows (`/improve:prompt`, `agent_router`, etc.) — they have no setup-phase surface where the contract applies.
- Skill-internal `:auto` flows (sk-doc, sk-code routing, etc.) — those are skill SKILL.md surfaces, not `/command:*` surfaces.
- YAML workflow internal interaction gates (e.g. mid-loop approval gates) — handled by each YAML's own non-interactivity rules, not this contract.
- Cross-command `:auto` integration (e.g. `/spec_kit:plan:auto` chained into `/spec_kit:implement:auto`) — separate contract concern.

codex
The shared contract confirms the shape: cite once, publish the command-local schema/table, keep `:confirm` byte-stable in behavior. I’m pulling the canonical example and phase scope next, then I’ll inspect `/improve:agent`’s current setup fields.
exec
/bin/zsh -lc "sed -n '1,220p' .opencode/specs/skilled-agent-orchestration/103-spec-kit-auto-mode-noninteractive-contract/002-auto-mode-contract-generalization-to-all-commands/spec.md" in /Users/michelkerkmeester/MEGA/Development/Code_Environment/Public
 succeeded in 0ms:
---
title: "Feature Specification: auto-mode-contract generalization to all commands"
description: "Lift the three-tier :auto contract from /spec_kit:deep-review (Phase 1) into a shared reference and migrate 11 remaining /spec_kit/, /create/, /improve/ commands to cite it; full live :auto dispatch verification per command."
trigger_phrases:
  - "auto mode contract generalization"
  - "spec-kit :auto rollout"
importance_tier: "important"
contextType: "implementation"
_memory:
  continuity:
    packet_pointer: ".opencode/specs/skilled-agent-orchestration/103-spec-kit-auto-mode-noninteractive-contract/002-auto-mode-contract-generalization-to-all-commands"
    last_updated_at: "2026-05-11T12:35:00Z"
    last_updated_by: "claude-opus-4-7"
    recent_action: "Authored Level 2 spec"
    next_safe_action: "Dispatch cli-codex group 1 (spec_kit commands)"
    blockers: []
    key_files: []
    session_dedup:
      fingerprint: "sha256:0000000000000000000000000000000000000000000000000000000000000000"
      session_id: "103-002-auto-mode-contract-generalization"
      parent_session_id: null
    completion_pct: 0
    open_questions: []
    answered_questions: []
---
# Feature Specification: auto-mode-contract generalization to all commands

<!-- SPECKIT_LEVEL: 2 -->
<!-- SPECKIT_TEMPLATE_SOURCE: spec-core | v2.2 -->

---

<!-- ANCHOR:metadata -->
## 1. METADATA

| Field | Value |
|-------|-------|
| **Level** | 2 |
| **Priority** | P1 |
| **Status** | Active |
| **Created** | 2026-05-11 |
| **Branch** | `main` |
| **Parent Spec** | ../spec.md |
| **Phase** | 2 of 2 |
| **Predecessor** | 001-deep-review-three-tier-setup |
| **Successor** | None |
<!-- /ANCHOR:metadata -->

---

<!-- ANCHOR:problem -->
## 2. PROBLEM & PURPOSE

### Problem Statement
Phase 1 introduced the three-tier `:auto` contract for `/spec_kit:deep-review`. The same architecture and same stdin-hang gap affect 11 other commands across `/spec_kit/`, `/create/`, and `/improve/`. Inlining the three-tier flow into every command duplicates ~300 LOC and risks drift; lifting it into a shared reference doc preserves a single source of truth and keeps each command lean.

### Purpose
Author the shared `auto_mode_contract.md` reference, refactor Phase-1's deep-review to cite it, migrate 11 remaining commands to the same pattern, and verify each one via a live non-interactive `:auto` dispatch.
<!-- /ANCHOR:problem -->

---

<!-- ANCHOR:scope -->
## 3. SCOPE

### In Scope
- Author `.opencode/skills/system-spec-kit/references/workflows/auto_mode_contract.md` (Level 2 sk-doc reference; §1-8 — three-tier flow, PRE-BOUND ANSWERS grammar, default-resolution-table format, Tier-3 error template, `:confirm` invariance, verification protocol, adoption checklist, out-of-scope).
- Refactor `/spec_kit:deep-review` §0 to cite the shared contract (replacing the inline three-tier sections from 001).
- Migrate 11 commands' §0 to cite the shared contract + provide their own per-field default table + PRE-BOUND ANSWERS field list:
  - `/spec_kit:` — deep-research, complete, implement, plan, resume (5)
  - `/create:` — sk-skill, agent, changelog, feature-catalog, testing-playbook, folder_readme (6)
  - `/improve:` — agent (1)
- Update each migrated command's frontmatter `argument-hint` to reference the new bypass capability.
- Preserve each command's `:confirm` consolidated Q-block path untouched (regression-check).
- Full live `:auto` dispatch verification: one transcript per command captured under `evidence/`.

### Out of Scope
- `/improve:prompt` and `agent_router` — no paired YAML / dispatch-only.
- YAML asset edits unless a live verification surfaces a hard requirement.
- Cross-command `:auto` integration tests (chained dispatches).
- Skill-internal `:auto` flows (sk-doc, sk-code, etc.).

### Files to Change

| File Path | Change Type | Description |
|-----------|-------------|-------------|
| `.opencode/skills/system-spec-kit/references/workflows/auto_mode_contract.md` | Create | Shared three-tier `:auto` contract reference |
| `.opencode/commands/spec_kit/deep-review.md` | Modify | Refactor §0 to cite shared contract |
| `.opencode/commands/spec_kit/{deep-research,complete,implement,plan,resume}.md` | Modify | Migrate §0 to shared contract pattern |
| `.opencode/commands/create/{sk-skill,agent,changelog,feature-catalog,testing-playbook,folder_readme}.md` | Modify | Same |
| `.opencode/commands/improve/agent.md` | Modify | Same |
| `002/evidence/` | Create dir + 12 files | Live dispatch transcripts |
<!-- /ANCHOR:scope -->

---

<!-- ANCHOR:requirements -->
## 4. REQUIREMENTS

### P0 - Blockers (MUST complete)

| ID | Requirement | Acceptance Criteria |
|----|-------------|---------------------|
| REQ-001 | Shared `auto_mode_contract.md` exists with all required sections | `grep -c "^## §[1-8]" auto_mode_contract.md` returns ≥7 |
| REQ-002 | All 12 commands (deep-review + 11 migrated) cite the shared contract | `grep -l "auto_mode_contract.md" .opencode/commands/{spec_kit,create,improve}/*.md \| wc -l` returns ≥12 |
| REQ-003 | 12 live `:auto` dispatch evidence files captured | `find 002/evidence -name "*.txt" \| wc -l` returns ≥12 |
| REQ-004 | ≥10/12 PASS verdicts on live dispatches | Per-evidence-file footer verdict |

### P1 - Required (complete OR user-approved deferral)

| ID | Requirement | Acceptance Criteria |
|----|-------------|---------------------|
| REQ-005 | Each command's `:confirm` consolidated Q-block path untouched | Per-command read-back diff confirms no `:confirm` regression |
| REQ-006 | Each migrated command's frontmatter `argument-hint` updated | grep for new bypass capability mention per command |
<!-- /ANCHOR:requirements -->

---

<!-- ANCHOR:success-criteria -->
## 5. SUCCESS CRITERIA

- **SC-001**: Shared contract doc exists and is cited by all 12 in-scope commands.
- **SC-002**: 11 commands migrated; deep-review (Phase 1) refactored to match the shared-contract pattern.
- **SC-003**: 12/12 evidence files exist; ≥10/12 PASS.
- **SC-004**: No `:confirm` regression in any of the 12 commands.
<!-- /ANCHOR:success-criteria -->

---

<!-- ANCHOR:risks -->
## 6. RISKS & DEPENDENCIES

| Type | Item | Impact | Mitigation |
|------|------|--------|------------|
| Risk | Per-command Q-block field shapes differ; one-size-fits-all template may not fit | Some commands' Tier-2 logic needs unique tweaks | Per-command default table is command-specific; codex dispatch reads each command's current §0 and authors a tailored table |
| Risk | Live `:auto` dispatches produce side effects (file writes outside `/tmp`) | Polluting production spec folders or skills tree | Every live-dispatch prompt forbids writes outside `/tmp`; pre-answers Gate 3 with "D) Skip" |
| Risk | Codex SpawnAgent allowlist gap re-emerges in some dispatch | Codex falls back to sub-agent and hits Gate 3 | Use inline-contract pattern per `feedback_codex_spawnagent_allowlist.md` |
| Risk | CLI dispatch unreliability under parallelism | Concurrent codex runs silently fail | Sequential dispatches only; 3 codex groups + 12 live verifications all serial |
| Dependency | `auto_mode_contract.md` must exist before any command migration | Per-command edits would have no citation target | Stage B authors the contract first |
| Dependency | deep-review.md refactor must land first as the reference example | Other migrations would lack a working template | Stage B refactors deep-review before Stage C kicks off |
<!-- /ANCHOR:risks -->

---

<!-- ANCHOR:nfr -->
## L2: NON-FUNCTIONAL REQUIREMENTS

### Performance
- **NFR-P01**: Per-command codex migration completes within 5 min wall-clock.
- **NFR-P02**: Per-command live `:auto` dispatch verification completes within 5 min wall-clock (setup-phase resolution check, not full YAML loop).

### Security
- **NFR-S01**: No secrets, tokens, or credentials persisted in any evidence file.
- **NFR-S02**: All live-dispatch outputs land in `/tmp/` only; never under `.opencode/skills/`, `.opencode/agents/`, or production spec folders.

### Reliability
- **NFR-R01**: Each migrated command's `:confirm` path retains exact existing behavior.
- **NFR-R02**: Every PASS verdict cites file:line evidence in the transcript.
<!-- /ANCHOR:nfr -->

---

<!-- ANCHOR:edge-cases -->
## L2: EDGE CASES

### Data Boundaries
- Command has no `:auto` mode (e.g., `agent_router`): skip from scope.
- Command has `:auto` but no paired YAML (e.g., `/improve:prompt`): skip — no setup-phase surface.
- Command's `:auto` path already implements partial three-tier: codex audits and aligns rather than overwriting.

### Error Scenarios
- Per-command codex migration partially applies: rollback via `git restore <command-md>`; retry with tightened prompt.
- Live dispatch hangs: kill the process; mark as FAIL with stdin-hang diagnostic in evidence; flag as separate finding.
- Live dispatch writes outside `/tmp`: HARD STOP; immediate rollback; treat as P0 in implementation-summary.

### State Transitions
- Draft → Active: 002 spec authored.
- Active → Complete: 12 PASS-or-PARTIAL evidence files exist; strict-validate exit 0; implementation-summary populated.
<!-- /ANCHOR:edge-cases -->

---

<!-- ANCHOR:complexity -->
## L2: COMPLEXITY ASSESSMENT

| Dimension | Score | Notes |
|-----------|-------|-------|
| Scope | 20/25 | 12 commands + 1 shared doc + 12 live verifications |
| Risk | 14/25 | Per-command idiosyncrasies; live verification side-effect risk |
| Research | 8/20 | Pattern established by 001; per-command field mapping is mechanical |
| **Total** | **42/70** | **Level 2** |
<!-- /ANCHOR:complexity -->

---

<!-- ANCHOR:questions -->
## 7. OPEN QUESTIONS

- None blocking planning.
<!-- /ANCHOR:questions -->

exec
/bin/zsh -lc "nl -ba .opencode/commands/spec_kit/deep-review.md | sed -n '44,150p'" in /Users/michelkerkmeester/MEGA/Development/Code_Environment/Public
 succeeded in 0ms:
    44	## 0. UNIFIED SETUP PHASE
    45	
    46	**FIRST MESSAGE PROTOCOL**: For `:confirm` or no suffix, the consolidated setup prompt MUST be your FIRST response. No implementation or file-modifying tool calls before asking. Lightweight read-only discovery to suggest a spec folder or load prior context is allowed, then ask ALL questions immediately and wait.
    47	
    48	For `:auto`, do not emit the consolidated prompt by default. Resolve setup with the three-tier branch below, then load the auto YAML only after all required values are bound.
    49	
    50	### `:auto` Setup Resolution
    51	
    52	Setup contract: see `.opencode/skills/system-spec-kit/references/workflows/auto_mode_contract.md`.
    53	
    54	Under `execution_mode = AUTONOMOUS` (from the `:auto` suffix), follow the three-tier flow:
    55	
    56	1. **Tier 1 — Resolve confidently** (contract §1): parse `$ARGUMENTS` flags + `PRE-BOUND SETUP ANSWERS:` block (§2) + the Default Resolution Table below (§3). When every required field is resolved, persist to `{spec_folder}/review/deep-review-config.json` (shape: `reviewTarget`, `reviewTargetType`, `reviewDimensions`, `specFolder`, `maxIterations`, `convergenceThreshold`, `executionMode: "auto"`, `resource_map.emit`, `config.executor.*`), bind runtime YAML placeholders, set `STATUS: PASSED`, load `.opencode/commands/spec_kit/assets/spec_kit_deep-review_auto.yaml`. End §0.
    57	
    58	2. **Tier 2 — Targeted ask** (contract §1): when 1-2 required fields are genuinely ambiguous AND no default exists, emit ONE narrow question per ambiguous field. Command-specific Tier-2-eligible fields (per the Default Resolution Table below): `review_target_type`, `spec_folder`. **Ordering rule**: if `review_target_type` is ambiguous, ask only for `review_target_type` first — the answer may make `spec_folder` self-evident on the next Tier 1 pass. Missing `review_target` is absence, not ambiguity — go to Tier 3.
    59	
    60	3. **Tier 3 — Fail fast** (contract §4): emit the named-missing-inputs error format with `/spec_kit:deep-review:auto` as the command name. Exit non-zero. Do not load YAML.
    61	
    62	`:confirm` path stays unchanged — see the Consolidated Setup Prompt section below.
    63	
    64	### PRE-BOUND SETUP ANSWERS Schema (for `:auto` non-interactive dispatch)
    65	
    66	The dispatched prompt body may contain one structured marker block. Parse it before applying defaults.
    67	
    68	```yaml
    69	PRE-BOUND SETUP ANSWERS:
    70	  review_target: specs/skilled-agent-orchestration/102-sk-doc-skill-readme-and-structure
    71	  review_target_type: spec-folder  # one of: spec-folder | skill | agent | track | files
    72	  review_dimensions: all  # or comma-separated subset: correctness, security, traceability, maintainability
    73	  spec_folder: existing  # one of: existing | new | update-related | phase-folder, or an explicit specs/.opencode/specs path
    74	  execution_mode: AUTONOMOUS  # from :auto suffix
    75	  maxIterations: 10
    76	  convergenceThreshold: 0.10
    77	  executor: native  # one of: native | cli-codex | cli-gemini | cli-claude-code
    78	  executor_model: ""  # optional, executor-specific
    79	  executor_reasoning: ""  # optional
    80	  executor_service_tier: ""  # optional
    81	  executor_timeout: 900  # optional
    82	  resource_map_emit: true  # optional
    83	```
    84	
    85	Rules:
    86	
    87	- Any unspecified field falls back to its documented default.
    88	- Marker fields take precedence over `$ARGUMENTS` flags because the caller explicitly bound setup in the prompt body.
    89	- Unknown fields are warnings, not errors.
    90	- Malformed lines, including missing `:`, emit a parse error naming the offending line. Known fields parsed before the error may still be used, and unresolved fields continue to Tier 2 or Tier 3.
    91	- Empty strings count as unresolved for required fields.
    92	- Compact legacy answer strings are only for the consolidated `:confirm` prompt. They are not a `:auto` marker format.
    93	
    94	### Default Resolution Table
    95	
    96	| Field | Required | Resolves Via | Default | Tier-2 Candidate |
    97	|-------|----------|--------------|---------|------------------|
    98	| `review_target` | Y | `$ARGUMENTS` first positional target, or marker `review_target` | none | N |
    99	| `review_target_type` | Y | marker `review_target_type`, or auto-detect from `review_target` | inferred only | Y, when target is present but ambiguous |
   100	| `review_dimensions` | Y | flag `--dims` if supported by caller, marker `review_dimensions`, or default | `"all"` | N |
   101	| `spec_folder` | Y | flag `--spec-folder`, marker `spec_folder`, or target path when target is a spec folder | none | Y, when target is not a spec folder |
   102	| `execution_mode` | Y | attached suffix `:auto` or marker `execution_mode` | `AUTONOMOUS` under `:auto` | N |
   103	| `maxIterations` | Y | flag `--max-iterations`, marker `maxIterations`, or default | `7` | N |
   104	| `convergenceThreshold` | Y | flag `--convergence`, marker `convergenceThreshold`, or default | `0.10` | N |
   105	| `executor` | N | flag `--executor`, marker `executor`, config file, or default | `native` | N |
   106	| `executor_model` | N | flag `--model`, marker `executor_model`, or executor-specific validation | none | N |
   107	| `executor_reasoning` | N | flag `--reasoning-effort`, marker `executor_reasoning`, or executor default | none | N |
   108	| `executor_service_tier` | N | flag `--service-tier`, marker `executor_service_tier`, or executor default | none | N |
   109	| `executor_timeout` | N | flag `--executor-timeout`, marker `executor_timeout`, or default | `900` | N |
   110	| `resource_map_emit` | N | flag `--no-resource-map`, marker `resource_map_emit`, or default | `true` | N |
   111	
   112	### Consolidated Setup Prompt for `:confirm` and No-Suffix Mode
   113	
   114	Use this block only when `execution_mode = "INTERACTIVE"` or when no suffix was supplied and Q2 must ask for the execution mode.
   115	
   116	**STATUS: BLOCKED**
   117	
   118	```
   119	EXECUTE THIS SINGLE CONSOLIDATED PROMPT:
   120	
   121	1. CHECK for mode suffix:
   122	   |-- ":auto"    -> execution_mode = "AUTONOMOUS"
   123	   |-- ":confirm" -> execution_mode = "INTERACTIVE"
   124	   +-- No suffix  -> execution_mode = "ASK" (include Q2)
   125	
   126	2. CHECK $ARGUMENTS for target (review_target):
   127	   |-- Has content (ignoring suffixes and flags):
   128	   |     -> review_target = $ARGUMENTS, omit Q0
   129	   +-- Empty -> include Q0
   130	
   131	3. PARSE optional flags from $ARGUMENTS:
   132	   |-- --max-iterations=N -> maxIterations = N
   133	   |-- --convergence=N -> convergenceThreshold = N
   134	   |-- --spec-folder=PATH -> spec_path = PATH, omit Q1
   135	   |-- --executor=<type> -> config.executor.type (`native` | `cli-codex`)
   136	   |-- --model=<id> -> config.executor.model (for example `gpt-5.4`)
   137	   |-- --reasoning-effort=<level> -> config.executor.reasoningEffort (`none` | `minimal` | `low` | `medium` | `high` | `xhigh`)
   138	   |-- --service-tier=<tier> -> config.executor.serviceTier (`priority` | `standard` | `fast`)
   139	   |-- --executor-timeout=<seconds> -> config.executor.timeoutSeconds (positive integer, default `900`)
   140	   |-- --no-resource-map -> config.resource_map.emit = false
   141	   +-- Defaults: maxIterations=7, convergenceThreshold=0.10, config.executor.type=`native`, config.executor.timeoutSeconds=900, config.resource_map.emit=`true`
   142	
   143	   Executor precedence for setup resolution:
   144	   - CLI flag > config file > schema defaults
   145	   - The generated `deep-review-config.json` stores executor settings under `config.executor.*`
   146	
   147	   Parsing to config mapping:
   148	   - `--executor` -> `config.executor.type`
   149	   - `--model` -> `config.executor.model`
   150	   - `--reasoning-effort` -> `config.executor.reasoningEffort`

exec
/bin/zsh -lc "sed -n '1,260p' .opencode/commands/improve/agent.md" in /Users/michelkerkmeester/MEGA/Development/Code_Environment/Public
 succeeded in 0ms:
---
description: "Evaluate and improve any agent: 5 dimensions, proposals, scoring, guarded promotion. :auto/:confirm."
argument-hint: "<agent_path> [:auto|:confirm] [--spec-folder=PATH] [--iterations=N]"
allowed-tools: Read, Write, Edit, Bash, Grep, Glob, Task
---

> **EXECUTION PROTOCOL — READ FIRST**
>
> This command runs a structured workflow. Do NOT dispatch agents from this document.
>
> **YOUR FIRST ACTION:**
> 1. Run Phase 0: @general agent self-verification (below)
> 2. Run Setup Phase: consolidated prompt to gather inputs
> 3. Determine execution mode from user input (`:auto` or `:confirm`)
> 4. Load matching YAML workflow and execute
>
> This command is **general-agent based** — orchestrates deep-agent-improvement skill invocation.

---

# 🚨 PHASE 0: @GENERAL AGENT VERIFICATION

**STATUS: ☐ BLOCKED**

```
EXECUTE THIS AUTOMATIC SELF-CHECK (NOT A USER QUESTION):

SELF-CHECK: Are you operating as the @general agent?
│
├─ INDICATORS that you ARE @general agent:
│   ├─ You can orchestrate deep-agent-improvement invocation
│   ├─ You can orchestrate Read/Write/Edit/Bash workflow execution
│   ├─ You can load skill references and execute defined logic
│
├─ IF YES (all indicators present):
│   └─ general_agent_verified = TRUE → Continue to Setup Phase
│
└─ IF NO or UNCERTAIN:
    │
    ├─ ⛔ HARD BLOCK - DO NOT PROCEED
    │
    ├─ DISPLAY to user:
    │   ┌────────────────────────────────────────────────────────────┐
    │   │ ⛔ GENERAL AGENT REQUIRED                                  │
    │   │                                                            │
    │   │ This command orchestrates deep-agent-improvement skill          │
    │   │ invocation and runs general-agent based.            │
    │   │                                                            │
    │   │ To proceed, restart with:                                  │
    │   │   /improve:agent [arguments]                               │
    │   └────────────────────────────────────────────────────────────┘
    │
    └─ RETURN: STATUS=FAIL ERROR="General agent required"
```

**Phase Output:**
- `general_agent_verified = ________________`

---

# 🔒 UNIFIED SETUP PHASE

**STATUS: ☐ BLOCKED**

**🚨 SINGLE CONSOLIDATED PROMPT - ONE USER INTERACTION**

This workflow uses a SINGLE consolidated prompt to gather ALL required inputs in ONE user interaction.

**Round-trip optimization:** This workflow requires only 1 user interaction for setup.

```
EXECUTE THIS SINGLE CONSOLIDATED PROMPT:

1. CHECK for mode suffix in $ARGUMENTS or command invocation:
   ├─ ":auto" suffix detected → execution_mode = "AUTONOMOUS" (pre-set, omit Q2)
   ├─ ":confirm" suffix detected → execution_mode = "INTERACTIVE" (pre-set, omit Q2)
   └─ No suffix → execution_mode = "ASK" (include Q2 in prompt)

2. CHECK if $ARGUMENTS contains an agent path:
   ├─ IF present (.opencode/agents/*.md) → target_path = detected value, omit Q0
   └─ IF missing → include Q0 in prompt

3. CHECK for --spec-folder flag:
   ├─ IF present → spec_folder = value, omit Q1
   └─ IF missing → include Q1 in prompt

4. CHECK for --iterations flag:
   ├─ IF present → max_iterations = value
   └─ IF missing → max_iterations = 5 (default)

5. List available agents for Q0:
   $ ls .opencode/agents/*.md

6. List recent spec folders for Q1:
   $ ls -d specs/*/ 2>/dev/null | tail -10

7. ASK user with SINGLE consolidated prompt (include only applicable questions):

   ┌────────────────────────────────────────────────────────────────┐
   │ **Before proceeding, please answer:**                          │
   │                                                                │
   │ **Q0. Target Agent** (if not provided in command):             │
   │    Which agent would you like to evaluate and improve?         │
   │    [list agents found above]                                   │
   │                                                                │
   │ **Q1. Spec Folder** (if no --spec-folder flag):                 │
   │    A) Use existing spec folder: [list if found]                │
   │    B) Create new spec folder                                   │
   │    C) Use temporary directory                                  │
   │                                                                │
   │ **Q2. Execution Mode** (if no :auto/:confirm suffix):            │
   │    A) Autonomous — run loop without approval gates             │
   │    B) Interactive — confirm at each iteration                   │
   │                                                                │
   │ **Q3. Scoring Mode**:                                          │
   │    A) Dynamic — 5-dimension integration-aware (current release) │
   │                                                                │
   │ Reply format: "handover, A, A, A" or                           │
   │ ".opencode/agents/debug.md, B, B, A"                            │
   └────────────────────────────────────────────────────────────────┘

8. WAIT for user response (DO NOT PROCEED)

9. Parse response and store ALL results:
   - target_path = [from Q0 or $ARGUMENTS]
   - target_profile = [derived dynamic profile for the selected target]
   - spec_folder = [from Q1 or --spec-folder]
   - execution_mode = [AUTONOMOUS/INTERACTIVE from suffix or Q2]
   - scoring_mode = [dynamic from Q3]
   - max_iterations = [from --iterations or default 5]

10. SET STATUS: ✅ PASSED

**STOP HERE** - Wait for user to answer ALL applicable questions before continuing.

⛔ HARD STOP: DO NOT proceed until user explicitly answers
⛔ NEVER infer target agent from context, screenshots, or conversation history
⛔ NEVER auto-select spec folder without user confirmation
⛔ NEVER split these questions into multiple prompts
⛔ NEVER assume what the user wants based on open files or recent activity
```

**Phase Output:**
- `general_agent_verified = ________________`
- `target_path = ________________`
- `target_profile = ________________`
- `spec_folder = ________________`
- `execution_mode = ________________`
- `scoring_mode = ________________`
- `max_iterations = ________________`

---

## PHASE STATUS VERIFICATION (BLOCKING)

**Before continuing to the workflow, verify ALL values are set:**

| FIELD                  | REQUIRED      | YOUR VALUE | SOURCE                  |
| ---------------------- | ------------- | ---------- | ----------------------- |
| general_agent_verified | ✅ Yes         | ______     | Automatic check         |
| target_path            | ✅ Yes         | ______     | Q0 or $ARGUMENTS        |
| target_profile         | ✅ Yes         | ______     | Derived from target rules |
| spec_folder            | ✅ Yes         | ______     | Q1 or --spec-folder     |
| execution_mode         | ✅ Yes         | ______     | Suffix or Q2            |
| scoring_mode           | ✅ Yes         | ______     | Q3                      |
| max_iterations         | ✅ Yes         | ______     | --iterations or 5       |

```
VERIFICATION CHECK:
├─ ALL required fields have values?
│   ├─ YES → Proceed to "INSTRUCTIONS" section below
│   └─ NO  → Re-prompt for missing values only
```

---

## CONSTRAINTS

- **DO NOT** dispatch any agent from this document
- **DO NOT** infer target agent from context, screenshots, or conversation history
- **DO NOT** start the loop without all setup values resolved
- **FIRST ACTION** is always: run Phase 0, run Setup, then load YAML workflow

---

# Improve Agent

Evaluate and improve any agent across 5 integration-aware dimensions. The skill scans all surfaces the agent touches, derives a scoring profile from the agent's own rules, writes packet-local candidates, scores them deterministically, and only allows promotion when evidence and approval gates are satisfied.

---

## 1. PURPOSE

Run a bounded evaluator-first loop that:
1. Scans the target agent's full integration surface (mirrors, commands, YAML workflows, skills)
2. Generates a dynamic scoring profile from the agent's own ALWAYS/NEVER/ESCALATE IF rules
3. Proposes packet-local candidates without mutating the canonical target
4. Scores candidates across 5 weighted dimensions (structural, ruleCoherence, integration, outputQuality, systemFitness)
5. Runs fixture benchmarks against target-specific test sets
6. Reduces evidence into a dimensional dashboard with convergence detection (per SKILL canonical stopReason enum: converged | maxIterationsReached | blockedStop | manualStop | error | stuckRecovery)
7. Stops on canonical stopReason: `converged`, `maxIterationsReached`, `blockedStop`, `manualStop`, `error`, or `stuckRecovery`

---

## 2. CONTRACT

**Inputs:** `$ARGUMENTS` — agent path, optional mode suffix, optional spec folder, optional iteration count
**Outputs:** improvement packet state under `{spec_folder}/improvement/` + `STATUS=<OK|FAIL|CANCELLED>`

### User Input

```text
$ARGUMENTS
```

---

## 3. 5-DIMENSION REFERENCE

| Dimension | Weight | What It Measures |
| --- | --- | --- |
| Structural Integrity | 0.20 | Agent template compliance (required sections) |
| Rule Coherence | 0.25 | ALWAYS/NEVER rules align with workflow steps |
| Integration Consistency | 0.25 | Mirrors in sync, commands reference agent, skills reference agent |
| Output Quality | 0.15 | Output verification items present, no placeholder content |
| System Fitness | 0.15 | Permission-capability alignment, resource references valid |

### Scoring Modes

| Mode | Flag | Profiles | Use When |
| --- | --- | --- | --- |
| Dynamic | `--dynamic` | Any agent (generated on-the-fly) | Evaluating arbitrary agents, integration health checks |

---

## 4. WORKFLOW STEPS

### Step 1: Load deep-agent-improvement Skill

```
Read(".opencode/skills/deep-agent-improvement/SKILL.md")
```

### Step 2: Run Integration Scan

```bash
node .opencode/skills/deep-agent-improvement/scripts/scan-integration.cjs --agent={agent_name} --output={spec_folder}/improvement/integration-report.json
```

Review the integration report: mirror sync status, command coverage, skill references.

### Step 3: Generate Profile

```bash
node .opencode/skills/deep-agent-improvement/scripts/generate-profile.cjs --agent={target_path} --output={spec_folder}/improvement/dynamic-profile.json
```

### Step 4: Initialize Runtime

Create the improvement directory structure and copy templates:

exec
/bin/zsh -lc "sed -n '1,220p' .opencode/specs/skilled-agent-orchestration/103-spec-kit-auto-mode-noninteractive-contract/002-auto-mode-contract-generalization-to-all-commands/tasks.md" in /Users/michelkerkmeester/MEGA/Development/Code_Environment/Public
 succeeded in 0ms:
---
title: "Tasks: auto-mode-contract generalization"
description: "11-command migration via 3 codex groups + 12 live verifications + synthesis."
trigger_phrases:
  - "auto mode contract generalization"
importance_tier: "important"
contextType: "implementation"
_memory:
  continuity:
    packet_pointer: ".opencode/specs/skilled-agent-orchestration/103-spec-kit-auto-mode-noninteractive-contract/002-auto-mode-contract-generalization-to-all-commands"
    last_updated_at: "2026-05-11T12:35:00Z"
    last_updated_by: "claude-opus-4-7"
    recent_action: "Group 2 create commands migrated"
    next_safe_action: "Dispatch group 3 improve command"
    blockers: []
    key_files: []
    session_dedup:
      fingerprint: "sha256:0000000000000000000000000000000000000000000000000000000000000000"
      session_id: "103-002-auto-mode-contract-generalization"
      parent_session_id: null
    completion_pct: 0
    open_questions: []
    answered_questions: []
---
# Tasks: auto-mode-contract generalization

<!-- SPECKIT_LEVEL: 2 -->
<!-- SPECKIT_TEMPLATE_SOURCE: tasks-core | v2.2 -->

---

<!-- ANCHOR:notation -->
## Task Notation

| Prefix | Meaning |
|--------|---------|
| `[ ]` | Pending |
| `[x]` | Completed |
| `[P]` | Parallelizable |
| `[B]` | Blocked |

**Task Format**: `T### [P?] Description (file path)`
<!-- /ANCHOR:notation -->

---

<!-- ANCHOR:phase-1 -->
## Phase 1: Setup

- [x] T001 Shared `auto_mode_contract.md` authored (Stage B).
- [x] T002 `/spec_kit:deep-review.md` §0 refactored to cite shared contract (Stage B).
- [ ] T003 Confirm 001's dry-run traces still conceptually pass after refactor (read-back).
<!-- /ANCHOR:phase-1 -->

---

<!-- ANCHOR:phase-2 -->
## Phase 2: Implementation

- [x] T010 Codex group dispatch 1 (spec_kit/5): deep-research, complete, implement, plan, resume. Evidence: Group 1 codex dispatch completed; 5 commands migrated; see evidence/codex-group1-dispatch.txt
- [x] T011 Codex group dispatch 2 (create/6): sk-skill, agent, changelog, feature-catalog, testing-playbook, folder_readme. Evidence: Group 2 codex dispatch completed; 5 commands migrated; see evidence/codex-group2-dispatch.txt
- [ ] T012 Codex group dispatch 3 (improve/1): agent.
- [ ] T013 Per-command read-back: confirm `:confirm` block untouched in all 11 migrated commands.
<!-- /ANCHOR:phase-2 -->

---

<!-- ANCHOR:phase-3 -->
## Phase 3: Verification

- [ ] T020 Live `:auto` dispatch — `/spec_kit:deep-review` (re-verify post-refactor).
- [ ] T021 Live `:auto` dispatch — `/spec_kit:deep-research`.
- [ ] T022 Live `:auto` dispatch — `/spec_kit:resume`.
- [ ] T023 Live `:auto` dispatch — `/spec_kit:implement`.
- [ ] T024 Live `:auto` dispatch — `/spec_kit:complete`.
- [ ] T025 Live `:auto` dispatch — `/spec_kit:plan`.
- [ ] T026 Live `:auto` dispatch — `/create:changelog`.
- [ ] T027 Live `:auto` dispatch — `/create:sk-skill`.
- [ ] T028 Live `:auto` dispatch — `/create:agent`.
- [ ] T029 Live `:auto` dispatch — `/create:feature-catalog`.
- [ ] T030 Live `:auto` dispatch — `/create:testing-playbook`.
- [ ] T031 Live `:auto` dispatch — `/create:folder_readme`.
- [ ] T032 Live `:auto` dispatch — `/improve:agent`.
- [ ] T033 Populate `implementation-summary.md` with 12-row results matrix + per-PARTIAL/FAIL finding.
- [ ] T034 strict-validate 103 phase parent + 001 + 002 — all exit 0.
- [ ] T035 Update `_memory.continuity` blocks to `completion_pct: 100`.
<!-- /ANCHOR:phase-3 -->

---

<!-- ANCHOR:completion -->
## Completion Criteria

- [ ] All tasks marked `[x]`
- [ ] No `[B]` blocked tasks remaining
- [ ] 12 evidence files exist with verdict footers
- [ ] ≥10/12 PASS verdicts
- [ ] strict-validate 103/001/002 all exit 0
<!-- /ANCHOR:completion -->

---

<!-- ANCHOR:cross-refs -->
## Cross-References

- **Specification**: See `spec.md`
- **Plan**: See `plan.md`
- **Checklist**: See `checklist.md`
- **Shared contract**: `.opencode/skills/system-spec-kit/references/workflows/auto_mode_contract.md`
- **Phase 1 prototype**: `../001-deep-review-three-tier-setup/`
- **Memory**: `feedback_codex_spawnagent_allowlist.md`, `feedback_gate3_no_tmp_exemption.md`, `feedback_auto_mode_ask_only_when_ambiguous.md`, `feedback_cli_dispatch_unreliability.md`
<!-- /ANCHOR:cross-refs -->

exec
/bin/zsh -lc "ls .opencode/commands/spec_kit/assets | rg 'improve|agent|auto|confirm'" in /Users/michelkerkmeester/MEGA/Development/Code_Environment/Public
 succeeded in 0ms:
spec_kit_complete_auto.yaml
spec_kit_complete_confirm.yaml
spec_kit_deep-research_auto.yaml
spec_kit_deep-research_confirm.yaml
spec_kit_deep-review_auto.yaml
spec_kit_deep-review_confirm.yaml
spec_kit_implement_auto.yaml
spec_kit_implement_confirm.yaml
spec_kit_plan_auto.yaml
spec_kit_plan_confirm.yaml
spec_kit_resume_auto.yaml
spec_kit_resume_confirm.yaml

codex
`/improve:agent` is still on the legacy single Q-block setup. The setup fields are small: target path, spec folder, execution mode, scoring mode, and iterations, with target profile derived from the target.
exec
/bin/zsh -lc "rg --files .opencode/commands | rg 'agent.*(auto|confirm)\\.yaml|improve.*agent|agent\\.yaml'" in /Users/michelkerkmeester/MEGA/Development/Code_Environment/Public
 succeeded in 0ms:
.opencode/commands/create/assets/create_agent_confirm.yaml
.opencode/commands/create/assets/create_agent_auto.yaml
.opencode/commands/improve/assets/improve_deep-agent-improvement_confirm.yaml
.opencode/commands/improve/assets/improve_deep-agent-improvement_auto.yaml
.opencode/commands/improve/agent.md

exec
/bin/zsh -lc "find .opencode/commands -path '*assets*' -type f | sort" in /Users/michelkerkmeester/MEGA/Development/Code_Environment/Public
 succeeded in 0ms:
.opencode/commands/create/assets/create_agent_auto.yaml
.opencode/commands/create/assets/create_agent_confirm.yaml
.opencode/commands/create/assets/create_changelog_auto.yaml
.opencode/commands/create/assets/create_changelog_confirm.yaml
.opencode/commands/create/assets/create_feature_catalog_auto.yaml
.opencode/commands/create/assets/create_feature_catalog_confirm.yaml
.opencode/commands/create/assets/create_folder_readme_auto.yaml
.opencode/commands/create/assets/create_folder_readme_confirm.yaml
.opencode/commands/create/assets/create_sk_skill_auto.yaml
.opencode/commands/create/assets/create_sk_skill_confirm.yaml
.opencode/commands/create/assets/create_testing_playbook_auto.yaml
.opencode/commands/create/assets/create_testing_playbook_confirm.yaml
.opencode/commands/doctor/assets/doctor_causal-graph.yaml
.opencode/commands/doctor/assets/doctor_cocoindex.yaml
.opencode/commands/doctor/assets/doctor_code-graph.yaml
.opencode/commands/doctor/assets/doctor_deep-loop.yaml
.opencode/commands/doctor/assets/doctor_mcp_debug.yaml
.opencode/commands/doctor/assets/doctor_mcp_install.yaml
.opencode/commands/doctor/assets/doctor_memory.yaml
.opencode/commands/doctor/assets/doctor_skill-advisor.yaml
.opencode/commands/doctor/assets/doctor_skill-budget.yaml
.opencode/commands/doctor/assets/doctor_update.yaml
.opencode/commands/improve/assets/improve_deep-agent-improvement_auto.yaml
.opencode/commands/improve/assets/improve_deep-agent-improvement_confirm.yaml
.opencode/commands/spec_kit/assets/spec_kit_complete_auto.yaml
.opencode/commands/spec_kit/assets/spec_kit_complete_confirm.yaml
.opencode/commands/spec_kit/assets/spec_kit_deep-research_auto.yaml
.opencode/commands/spec_kit/assets/spec_kit_deep-research_confirm.yaml
.opencode/commands/spec_kit/assets/spec_kit_deep-review_auto.yaml
.opencode/commands/spec_kit/assets/spec_kit_deep-review_confirm.yaml
.opencode/commands/spec_kit/assets/spec_kit_implement_auto.yaml
.opencode/commands/spec_kit/assets/spec_kit_implement_confirm.yaml
.opencode/commands/spec_kit/assets/spec_kit_plan_auto.yaml
.opencode/commands/spec_kit/assets/spec_kit_plan_confirm.yaml
.opencode/commands/spec_kit/assets/spec_kit_resume_auto.yaml
.opencode/commands/spec_kit/assets/spec_kit_resume_confirm.yaml

exec
/bin/zsh -lc "rg -n \"improve:agent|spec_kit_.*agent|agent_auto|agent_confirm|improve_agent\" .opencode/commands .opencode/skills -g '*.md' -g '*.yaml'" in /Users/michelkerkmeester/MEGA/Development/Code_Environment/Public
 succeeded in 0ms:
.opencode/commands/create/agent.md:16:>    - Auto mode → `create_agent_auto.yaml`
.opencode/commands/create/agent.md:17:>    - Confirm mode → `create_agent_confirm.yaml`
.opencode/commands/create/agent.md:86:1. **Tier 1 — Resolve confidently** (contract §1): parse `$ARGUMENTS` flags + `PRE-BOUND SETUP ANSWERS:` block (§2) + the Default Resolution Table below (§3). When every required field is resolved, persist to `{spec_path}/create-agent-config.json` when a spec is linked, otherwise `/tmp/create-agent-config.json` (shape: `agentName`, `agentPath`, `specChoice`, `specPath`, `executionMode: "auto"`, `memoryChoice`), bind runtime YAML placeholders, set `STATUS: PASSED`, load `.opencode/commands/create/assets/create_agent_auto.yaml`. End §0.
.opencode/commands/create/agent.md:239:- **AUTONOMOUS (`:auto`)**: `.opencode/commands/create/assets/create_agent_auto.yaml`
.opencode/commands/create/agent.md:240:- **INTERACTIVE (`:confirm`)**: `.opencode/commands/create/assets/create_agent_confirm.yaml`
.opencode/commands/improve/agent.md:50:    │   │   /improve:agent [arguments]                               │
.opencode/commands/improve/agent.md:326:`/improve:agent` is one-session-only in the current release. Every invocation starts a fresh `new`-mode session with generation 1, writes a new journal, and evaluates candidates from iteration 1 for that session.
.opencode/commands/improve/agent.md:345:/improve:agent ".opencode/agents/debug.md" :confirm --spec-folder=specs/041/008
.opencode/commands/improve/agent.md:351:/improve:agent ".opencode/agents/debug.md" :auto --iterations=3
.opencode/commands/improve/agent.md:357:/improve:agent ".opencode/agents/review.md" :auto --iterations=1
.opencode/commands/improve/agent.md:363:/improve:agent :confirm
.opencode/skills/deep-agent-improvement/SKILL.md:218:3. Call B: the disciplined `/improve:agent` path against the identical prompt and files.
.opencode/skills/deep-agent-improvement/SKILL.md:308:Sessions support a single lineage mode today: `new`. Every invocation of the `/improve:agent` workflow starts a fresh session with a new session id and generation 1. Multi-generation lineage modes (`resume`, `restart`, `fork`, `completed-continue`) were described in earlier drafts but have no shipped runtime wiring in the deep-agent-improvement workflow, reducer, or journal consumer.
.opencode/skills/deep-agent-improvement/SKILL.md:443:- `/improve:agent` initializes and runs the bounded workflow
.opencode/skills/deep-agent-improvement/manual_testing_playbook/manual_testing_playbook.md:489:the current release uses standalone `new`-mode sessions, so continuation happens by archiving the previous run and starting a fresh `/improve:agent` session.
.opencode/skills/deep-agent-improvement/manual_testing_playbook/manual_testing_playbook.md:554:the `/improve:agent` autonomous workflow wires `improvement-journal.cjs` at every required boundary: `session_start`, per-iteration lifecycle checkpoints, nested `legal_stop_evaluated.details.gateResults`, benchmark completion, and `session_end`.
.opencode/skills/deep-agent-improvement/manual_testing_playbook/manual_testing_playbook.md:557:Prompt summary: As a manual-testing orchestrator, validate that the /improve:agent autonomous workflow wires improvement-journal.cjs at every required boundary: session_start, per-iteration lifecycle checkpoints, nested legal_stop_evaluated.details.gateResults, benchmark_completed, and session_end against the current deep-agent-improvement command, runtime artifacts, and validation scripts. Verify `.opencode/commands/improve/assets/improve_deep-agent-improvement_auto.yaml` contains `improvement-journal.cjs` emission steps for:. Return a concise operator-facing PASS/FAIL verdict with the decisive evidence.
.opencode/skills/deep-agent-improvement/manual_testing_playbook/manual_testing_playbook.md:597:This section originated as the 060 phase-parent's stress-test campaign for `@deep-agent-improvement`. The 6 scenarios test the agent + command discipline using `/improve:agent` (CP-040/043/044/045) and `@deep-agent-improvement` body (CP-041/042). Final composite score: **PASS 6 / PARTIAL 0 / FAIL 0** (after R3 CRITIC PASS verbatim emission requirement). See `.opencode/specs/skilled-agent-orchestration/060-sk-agent-improver-test-report-alignment/004-deep-agent-improvement-command-flow-stress-tests/test-report.md` for the full campaign narrative.
.opencode/skills/deep-agent-improvement/manual_testing_playbook/manual_testing_playbook.md:603:Confirm `/improve:agent` proves helper execution instead of merely reading `SKILL.md` and improvising.
.opencode/skills/deep-agent-improvement/references/quick_reference.md:37:/improve:agent ".opencode/agents/debug.md" :confirm --spec-folder={spec_folder}
.opencode/skills/deep-agent-improvement/changelog/v1.5.0.0.md:3:description: "Rename the agent across all 4 runtime mirrors plus YAML asset filenames and ~30 active reference files. Completes naming-family alignment with the skill folder rename from packet 079. The skill, agent, and command family now share one identity: deep-agent-improvement skill ↔ @deep-agent-improvement agent ↔ /improve:agent command."
.opencode/skills/deep-agent-improvement/changelog/v1.5.0.0.md:29:- **Slash command**: `/improve:agent` (UNCHANGED — `agent` is a generic sub-name, parallel to `/improve:prompt`)
.opencode/skills/deep-agent-improvement/changelog/v1.5.0.0.md:50:- `.opencode/commands/improve/assets/improve_improve-agent_auto.yaml` → `improve_deep-agent-improvement_auto.yaml`
.opencode/skills/deep-agent-improvement/changelog/v1.5.0.0.md:51:- `.opencode/commands/improve/assets/improve_improve-agent_confirm.yaml` → `improve_deep-agent-improvement_confirm.yaml`
.opencode/skills/deep-agent-improvement/changelog/v1.5.0.0.md:52:- `.claude/commands/improve/assets/improve_improve-agent_auto.yaml` → `improve_deep-agent-improvement_auto.yaml`
.opencode/skills/deep-agent-improvement/changelog/v1.5.0.0.md:53:- `.claude/commands/improve/assets/improve_improve-agent_confirm.yaml` → `improve_deep-agent-improvement_confirm.yaml`
.opencode/skills/deep-agent-improvement/changelog/v1.5.0.0.md:65:- **Slash command `/improve:agent`** — `agent` is a generic sub-name like `/improve:prompt`. The dispatcher contract is independent of the agent's identity.
.opencode/skills/deep-agent-improvement/changelog/v1.5.0.0.md:66:- **`.gemini/commands/improve/improve-agent.toml` filename** — Gemini convention names slash-command files using flat hyphenated form (`/improve:agent` → `improve-agent.toml`). This file is the slash-command definition, not the agent.
.opencode/skills/deep-agent-improvement/changelog/v1.5.0.0.md:84:Old: `.opencode/commands/improve/assets/improve_improve-agent_auto.yaml`
.opencode/skills/deep-agent-improvement/changelog/v1.5.0.0.md:87:### For `/improve:agent` invocations
.opencode/skills/deep-agent-improvement/changelog/v1.5.0.0.md:89:UNCHANGED. The slash command stays `/improve:agent`. No migration needed.
.opencode/skills/deep-agent-improvement/changelog/v1.5.0.0.md:107:- **Family completion**: skill `deep-agent-improvement` ↔ agent `@deep-agent-improvement` (this entry) ↔ command `/improve:agent` (unchanged)
.opencode/skills/deep-agent-improvement/test-fixtures/060-stress-test/README.md:9:`cp-improve-target` agent and verify whether `/improve:agent` proves the
.opencode/skills/deep-agent-improvement/changelog/v1.1.0.0.md:9:- The `/improve:agent` command continues to drive the loop; no operator-facing command changed.
.opencode/skills/deep-agent-improvement/changelog/v1.1.0.0.md:83:| `.opencode/commands/improve/assets/improve_agent-improver_auto.yaml`                                                      | Modified | Wired journal emission and legal-stop evaluation in auto mode                                 |
.opencode/skills/deep-agent-improvement/changelog/v1.1.0.0.md:84:| `.opencode/commands/improve/assets/improve_agent-improver_confirm.yaml`                                                   | Modified | Mirrored the same runtime truth contract in confirm mode                                      |
.opencode/skills/deep-agent-improvement/changelog/v1.1.0.0.md:91:Existing improvement sessions without the new runtime-truth fields continue to run unchanged (backward compatible). Operators invoking `/improve:agent` now get a reviewable audit journal, mutation coverage graph, trade-off detection, and stability-aware promotion gates - all enforced orchestrator-side so the proposal-only agent constraint is preserved. Legacy `sk-agent-improver` paths are fully removed; update any external references to `deep-agent-improvement`.
.opencode/skills/deep-agent-improvement/changelog/v1.1.0.0.md:97:> This release documented four lifecycle modes for re-entering an `/improve:agent` session: `resume`, `restart`, `fork`, and `completed-continue`. None of the four were ever wired up. The command has no input for lineage mode, the reducer does not carry ancestry across sessions, and the journal helper has no multi-session boundary event. Every invocation is a fresh `new` session.
.opencode/skills/deep-agent-improvement/changelog/v1.4.0.0.md:18:- Command surfaces in 4 runtimes: OpenCode/Copilot, Claude, Codex, and Gemini command surfaces keep `/improve:agent` while routing references move to the new skill path.
.opencode/skills/deep-agent-improvement/changelog/v1.4.0.0.md:25:The old path `.opencode/skills/deep-agent-improvement/` no longer resolves. Use `.opencode/skills/deep-agent-improvement/` for skill files, references, assets, scripts, feature catalog entries, and manual testing playbooks. The agent name `@deep-agent-improvement` and command `/improve:agent` are unchanged.
.opencode/skills/deep-agent-improvement/changelog/v1.0.0.0.md:73:The `@agent-improver` agent and `/improve:agent` command are mirrored across all 5 runtimes (OpenCode, Claude, Codex, .agents, Gemini). The integration scanner checks mirror parity automatically.
.opencode/skills/deep-agent-improvement/changelog/v1.0.0.0.md:85:Renamed from `sk-recursive-agent` to `deep-agent-improvement` across 187+ files and 1129+ occurrences. Command moved from `/spec_kit:recursive-agent` to `/improve:agent`. Agent renamed from `@recursive-agent` to `@agent-improver`. Zero stale references remaining (verified by fresh sub-agent audit).
.opencode/skills/deep-agent-improvement/changelog/v1.0.0.0.md:101:| `.opencode/commands/improve/assets/improve_agent-improver_*.yaml` | Created | Auto + confirm YAML workflows |
.opencode/skills/deep-agent-improvement/changelog/v1.2.1.0.md:13:- **Resume/continuation expected behavior retracted to match reality** -- The skill's runtime-truth section and the `/improve:agent` command definition both listed `resume`, `restart`, `fork`, and `completed-continue` as supported lifecycle modes for evaluating an agent across multiple sessions. The shipped workflow has no inputs for any of them, the reducer does not produce ancestry output, and the journal helper has no boundary event for a multi-session run history. The only thing the runtime actually supports is `new` - every `/improve:agent` invocation starts a fresh session with generation 1. The documentation now says so explicitly. Operators who want to continue an evaluation should archive the prior `improve/` folder under a timestamped path and re-invoke the command. A future release that ships real multi-session run history will arrive with first-class event emission, reducer ancestry output, and replay coverage; until then, treat every invocation as a standalone evaluation.
.opencode/skills/deep-agent-improvement/changelog/v1.2.0.0.md:1:This release lands Phase 008 of the 042 Deep Research & Review Runtime Improvement Bundle for `deep-agent-improvement`. The skill now (a) actually calls `improvement-journal.cjs` from the visible `/improve:agent` YAML workflow at every iteration boundary, (b) enforces minimum sample sizes before trade-off and stability verdicts, and (c) implements ADR-002 Option A by reading `improvement-journal.jsonl`, `candidate-run history.json`, and `mutation-coverage.json` during reducer refresh. The visible operator path now emits the richer runtime-truth state the v1.1.0.0 expected behavior promised. The goal is to make the workflow easier to follow and easier to trust.
.opencode/skills/deep-agent-improvement/changelog/v1.2.0.0.md:7:- `improve_agent-improver_{auto,confirm}.yaml` now invoke `improvement-journal.cjs` at three boundary points: session start, every iteration boundary (candidate generated to scored to gate evaluation), and session end. The orchestrator-only constraint is preserved - the proposal-only agent still never writes journal rows itself.
.opencode/skills/deep-agent-improvement/changelog/v1.2.0.0.md:73:| `.opencode/commands/improve/assets/improve_agent-improver_auto.yaml` | Modified | Wired step_emit_journal_event at session_start + iteration + session_end |
.opencode/skills/deep-agent-improvement/changelog/v1.2.0.0.md:74:| `.opencode/commands/improve/assets/improve_agent-improver_confirm.yaml` | Modified | Mirrored the same journal wiring in confirm mode |
.opencode/skills/deep-agent-improvement/changelog/v1.2.0.0.md:83:Operators invoking `/improve:agent` now see a richer dashboard with the Sample Quality section and the full journal/lineage/coverage summary. The visible workflow emits the journal events the v1.1.0.0 contract already promised - the contract break that Phase 008 Part A surfaced is now closed.
.opencode/skills/deep-agent-improvement/changelog/v1.0.1.0.md:11:- **Self-test completed** (Phase 009): Ran `/improve:agent` targeting `agent-improver.md` itself. 3 iterations, baseline 99→100, all 5 dimensions converged at 100. First real end-to-end validation of the skill on its own agent.
.opencode/skills/deep-agent-improvement/changelog/v1.0.1.0.md:12:- **Stale command path fixed** (Phase 010): Canonical agent-improver.md had `/improve:agent-improver` pointing to a nonexistent file. Fixed to `/improve:agent` → `.opencode/commands/improve/agent.md`. Synced to all 4 mirrors.
.opencode/skills/deep-agent-improvement/manual_testing_playbook/07--runtime-truth/028-legal-stop-gates.md:45:| RT-028 | Legal-Stop Gate Blocking | Validate Legal-Stop Gate Blocking | `Validate that failed legal-stop gates record blockedStop instead of converged.` | /improve:agent &quot;.opencode/agents/debug.md&quot; :confirm --spec-folder={spec} --iterations=5<br><br><br>Verification:<br><br><br>node .opencode/skills/deep-agent-improvement/scripts/improvement-journal.cjs --read {spec}/improvement/improvement-journal.jsonl &#124; python3 -c &quot;<br>import sys, json<br>events = json.load(sys.stdin)<br># Check for legal_stop_evaluated events<br>lse = [e for e in events if e[&#x27;eventType&#x27;] == &#x27;legal_stop_evaluated&#x27;]<br>blocked = [e for e in events if e[&#x27;eventType&#x27;] == &#x27;blocked_stop&#x27;]<br>GATES = [&#x27;contractGate&#x27;, &#x27;behaviorGate&#x27;, &#x27;integrationGate&#x27;, &#x27;evidenceGate&#x27;, &#x27;improvementGate&#x27;]<br>if lse:<br>    gates = lse[-1].get(&#x27;details&#x27;, {}).get(&#x27;gateResults&#x27;, {})<br>    present = [g for g in GATES if g in gates]<br>    print(f&#x27;legal_stop_evaluated found — gates present: {present}&#x27;)<br>if blocked:<br>    failed = blocked[-1].get(&#x27;details&#x27;, {}).get(&#x27;failedGates&#x27;, [])<br>    print(f&#x27;blocked_stop found — failed gates: {failed}&#x27;)<br>    print(&#x27;PASS — blockedStop recorded with failed gate details&#x27;)<br>else:<br>    ends = [e for e in events if e[&#x27;eventType&#x27;] in (&#x27;session_ended&#x27;, &#x27;session_end&#x27;)]<br>    if ends and ends[-1].get(&#x27;details&#x27;, {}).get(&#x27;stopReason&#x27;) == &#x27;converged&#x27;:<br>        print(&#x27;INFO — session converged (all gates passed), no blockedStop expected&#x27;)<br>    else:<br>        print(&#x27;INFO — no blocked_stop event found; may need scenario with intentional gate failure&#x27;)<br>&quot; | `legal_stop_evaluated` event emitted with nested `details.gateResults` containing all 5 gate bundles; `contractGate`: structural >= 90 AND systemFitness >= 90; `behaviorGate`: ruleCoherence >= 85 AND outputQuality >= 85; `integrationGate`: integration >= 90 AND no drift ambiguity; `evidenceGate`: benchmark pass AND repeatability pass; `improvementGate`: weighted delta >= configured threshold; When any gate fails: `blocked_stop` event emitted with `failedGates[]` and `reason`; Session `stopReason` is `blockedStop` (not `converged`) when gates fail; The session continues iterating (does not prematurely terminate) when gates block convergence; If all 5 gates pass: `converged` stopReason is used instead | `terminal transcript, command output, generated files, and PASS/FAIL verdict` | When convergence math would trigger stop but at least one gate bundle fails, the journal contains a `blocked_stop` event with the failing gate names, and the session's `stopReason` is `blockedStop` -- the session does NOT claim `converged`. | If `legal_stop_evaluated` is missing: verify the orchestrator calls the legal-stop evaluation after convergence math triggers<br>If `blocked_stop` is missing when a gate fails: check the conditional that routes to `blocked_stop` vs `converged` based on gate results<br>If `stopReason` is `converged` despite failing gates: the gate-check-before-converge guard is bypassed; check the orchestrator&#x27;s stop-reason assignment logic<br>If gate results are empty: verify each gate bundle function is implemented and returns a pass/fail result |
.opencode/skills/deep-agent-improvement/manual_testing_playbook/07--runtime-truth/032-journal-wiring.md:16:This scenario validates that the `/improve:agent` autonomous workflow wires `improvement-journal.cjs` at every required boundary: `session_start`, per-iteration lifecycle checkpoints, nested `legal_stop_evaluated.details.gateResults`, and `session_end`. Given: a fresh `/improve:agent` `:auto` session. When: the operator runs the session end-to-end or inspects `.opencode/commands/improve/assets/improve_deep-agent-improvement_auto.yaml`. Then: journal events appear in `improvement-journal.jsonl` for every boundary, the CLI example in `.opencode/commands/improve/agent.md` executes as written against a temp target, and the frozen `STOP_REASONS` / `SESSION_OUTCOMES` enums match the helper validator.
.opencode/skills/deep-agent-improvement/manual_testing_playbook/07--runtime-truth/032-journal-wiring.md:23:- Real user request: `` Validate that the `/improve:agent` autonomous workflow wires `improvement-journal.cjs` at every required boundary: `session_start`, per-iteration lifecycle checkpoints, nested `legal_stop_evaluated.details.gateResults`, and `session_end`. Given: a fresh `/improve:agent` `:auto` session. When: the operator runs the session end-to-end or inspects `.opencode/commands/improve/assets/improve_deep-agent-improvement_auto.yaml`. Then: journal events appear in `improvement-journal.jsonl` for every boundary, the CLI example in `.opencode/commands/improve/agent.md` executes as written against a temp target, and the frozen `STOP_REASONS` / `SESSION_OUTCOMES` enums match the helper validator. ``
.opencode/skills/deep-agent-improvement/manual_testing_playbook/07--runtime-truth/032-journal-wiring.md:24:- Prompt: `Validate that /improve:agent wires improvement-journal.cjs at every required workflow boundary.`
.opencode/skills/deep-agent-improvement/manual_testing_playbook/07--runtime-truth/032-journal-wiring.md:45:| RT-032 | Journal Wiring Boundary Coverage | Validate Journal Wiring Boundary Coverage | `Validate that /improve:agent wires improvement-journal.cjs at every required workflow boundary.` | /improve:agent &quot;.opencode/agents/debug.md&quot; :auto --spec-folder={spec} --iterations=2<br><br><br>Verification:<br><br><br>AUTO_YAML=.opencode/commands/improve/assets/improve_deep-agent-improvement_auto.yaml<br>TMP_SPEC=&quot;$(mktemp -d /tmp/deep-agent-improvement-journal-XXXXXX)&quot;<br>TMP_JOURNAL=&quot;$TMP_SPEC/improvement/improvement-journal.jsonl&quot;<br><br><br>grep -n &quot;improvement-journal.cjs\&#124;--emit&quot; &quot;$AUTO_YAML&quot;<br><br><br>python3 - &lt;&lt;&#x27;PY&#x27;<br>from pathlib import Path<br>yaml_text = Path(&quot;.opencode/commands/improve/assets/improve_deep-agent-improvement_auto.yaml&quot;).read_text()<br>required = [<br>    &quot;session_start&quot;,<br>    &quot;candidate_generated&quot;,<br>    &quot;candidate_scored&quot;,<br>    &quot;benchmark_completed&quot;,<br>    &quot;legal_stop_evaluated&quot;,<br>    &quot;gateResults&quot;,<br>    &quot;session_end&quot;,<br>]<br>missing = [token for token in required if token not in yaml_text]<br>assert not missing, f&quot;Missing journal boundaries in auto YAML: {missing}&quot;<br>print(&quot;PASS — auto YAML covers start, iteration, nested legal-stop, benchmark, and end boundaries&quot;)<br>PY<br><br><br>node .opencode/skills/deep-agent-improvement/scripts/improvement-journal.cjs --emit session_start --journal &quot;$TMP_JOURNAL&quot; --details &#x27;{&quot;sessionId&quot;:&quot;imp-2026-04-11T12-00-00Z&quot;,&quot;target&quot;:&quot;deep-research&quot;,&quot;charter&quot;:&quot;...&quot;,&quot;startedAt&quot;:&quot;2026-04-11T12:00:00Z&quot;}&#x27;<br><br><br>node .opencode/skills/deep-agent-improvement/scripts/improvement-journal.cjs --read &quot;$TMP_JOURNAL&quot; &#124; python3 -c &quot;<br>import sys, json<br>events = json.load(sys.stdin)<br>assert len(events) == 1 and events[0][&#x27;eventType&#x27;] == &#x27;session_start&#x27;, &#x27;CLI example did not emit session_start&#x27;<br>print(&#x27;PASS — command doc CLI example executed successfully&#x27;)<br>&quot;<br><br><br>grep -A 7 &quot;STOP_REASONS\&#124;SESSION_OUTCOMES\&#124;LEGAL_STOP_GATES&quot; .opencode/skills/deep-agent-improvement/scripts/improvement-journal.cjs<br><br><br>python3 - &lt;&lt;&#x27;PY&#x27;<br>from pathlib import Path<br>doc = Path(&quot;.opencode/commands/improve/agent.md&quot;).read_text()<br>script = Path(&quot;.opencode/skills/deep-agent-improvement/scripts/improvement-journal.cjs&quot;).read_text()<br>required_stop = [<br>    &quot;converged&quot;,<br>    &quot;maxIterationsReached&quot;,<br>    &quot;blockedStop&quot;,<br>    &quot;manualStop&quot;,<br>    &quot;error&quot;,<br>    &quot;stuckRecovery&quot;,<br>]<br>required_outcomes = [<br>    &quot;keptBaseline&quot;,<br>    &quot;promoted&quot;,<br>    &quot;rolledBack&quot;,<br>    &quot;advisoryOnly&quot;,<br>]<br>required_gates = [&quot;contractGate&quot;, &quot;behaviorGate&quot;, &quot;integrationGate&quot;, &quot;evidenceGate&quot;, &quot;improvementGate&quot;]<br>for token in required_stop + required_outcomes:<br>    assert token in doc, f&quot;Missing enum token in command doc: {token}&quot;<br>    assert token in script, f&quot;Missing enum token in helper: {token}&quot;<br>for token in required_gates:<br>    assert token in script, f&quot;Missing legal-stop gate token in helper: {token}&quot;<br>print(&quot;PASS — command doc taxonomy and legal-stop gates match improvement-journal.cjs enums&quot;)<br>PY<br><br><br>rm -rf &quot;$TMP_SPEC&quot; | `.opencode/commands/improve/assets/improve_deep-agent-improvement_auto.yaml` contains `improvement-journal.cjs` emission steps for:; `session_start` before the first loop iteration; `candidate_generated`, `candidate_scored`, `benchmark_completed`, nested `legal_stop_evaluated.details.gateResults`, and `gate_evaluation`/stop checks inside each iteration; `session_end` after synthesis completes; The CLI example from `.opencode/commands/improve/agent.md` executes successfully against a temp journal target with exit code `0`; `improvement-journal.cjs` exports frozen `STOP_REASONS`, `SESSION_OUTCOMES`, and legal-stop gate names; `validateEvent()` accepts only those enum members for `session_end` / `session_ended`; The command doc taxonomy in `agent.md` matches the helper's internal validator and does not drift | `terminal transcript, command output, generated files, and PASS/FAIL verdict` | The autonomous YAML contains journal emission coverage for session start, per-iteration lifecycle checkpoints, nested legal-stop, benchmark completion, and session end; the CLI example from `.opencode/commands/improve/agent.md` runs successfully as written against a temp journal path; and the stop-reason / session-outcome enums in the command doc match the frozen values enforced by `improvement-journal.cjs`. | If any boundary is missing from the YAML: add or restore the missing `step_emit_journal_event*` command in `improve_deep-agent-improvement_auto.yaml`<br>If the CLI example exits non-zero: copy the exact example from `.opencode/commands/improve/agent.md` and reconcile the helper CLI contract (`--emit`, `--journal`, `--details`)<br>If `legal_stop_evaluated` validation fails: confirm `details.gateResults` includes all five gate keys<br>If `session_end` is emitted but validation fails: compare the emitted `details.stopReason` / `details.sessionOutcome` values against the frozen enums in `improvement-journal.cjs`<br>If the doc taxonomy drifts from the helper: update the command doc and helper together so the runtime contract stays frozen |
.opencode/skills/deep-agent-improvement/manual_testing_playbook/08--agent-discipline-stress-tests/013-skill-load-not-protocol.md:3:description: "Validate that /improve:agent executes the deep-agent-improvement protocol instead of merely reading SKILL.md and improvising."
.opencode/skills/deep-agent-improvement/manual_testing_playbook/08--agent-discipline-stress-tests/013-skill-load-not-protocol.md:26:- RCAF Prompt: `` Same task body in §2; Call A wraps with `As @Task:`; Call B invokes `/improve:agent` from the command-capable sandbox ``
.opencode/skills/deep-agent-improvement/manual_testing_playbook/08--agent-discipline-stress-tests/013-skill-load-not-protocol.md:37:- Expected execution process: run the CP-061 setup helper to create a command-capable `/tmp/cp-040-sandbox/`, copy `/tmp/cp-040-sandbox-baseline`, capture project tripwire from the repo root, run Call A with `As @Task:`, reset sandbox, run Call B from `/tmp/cp-040-sandbox/` via `/improve:agent`, then return to the repo root for transcript, artifact, diff, and tripwire checks.
.opencode/skills/deep-agent-improvement/manual_testing_playbook/08--agent-discipline-stress-tests/013-skill-load-not-protocol.md:40:  - **Call B (`/improve:agent` command flow)**: Transcript or artifacts contain `scan-integration.cjs`, `generate-profile.cjs`, `score-candidate.cjs`, `reduce-state.cjs`, `candidate_generated`, and `candidate_scored`. Candidate path is under `/tmp/cp-040-spec/improvement/candidates/`. Canonical target diff is empty. Project tripwire is empty.
.opencode/skills/deep-agent-improvement/manual_testing_playbook/08--agent-discipline-stress-tests/013-skill-load-not-protocol.md:52:5. Run Call B as `/improve:agent ".opencode/agents/cp-improve-target.md" :auto --spec-folder=/tmp/cp-040-spec --iterations=1` from inside `/tmp/cp-040-sandbox/`.
.opencode/skills/deep-agent-improvement/manual_testing_playbook/08--agent-discipline-stress-tests/013-skill-load-not-protocol.md:74:copilot -p "/improve:agent \".opencode/agents/cp-improve-target.md\" :auto --spec-folder=/tmp/cp-040-spec --iterations=1" --model gpt-5.5 --allow-all-tools --no-ask-user --add-dir /tmp/cp-040-sandbox --add-dir /tmp/cp-040-spec 2>&1 | tee /tmp/cp-040-B-command.txt; echo "EXIT_B=${PIPESTATUS[0]}" | tee /tmp/cp-040-B-exit.txt
.opencode/skills/deep-agent-improvement/manual_testing_playbook/08--agent-discipline-stress-tests/013-skill-load-not-protocol.md:87:| CP-040 | SKILL_LOAD_NOT_PROTOCOL | Confirm helper execution is proven, not only skill loading | `` Same task body in §2; Call A wraps with `As @Task:`; Call B invokes `/improve:agent` from the command-capable sandbox `` | Run the §3 exact command block | B field counts for helper and journal labels all >= 1; `POST_B_CANONICAL_DIFF=0`; `TRIPWIRE_DIFF_EXIT=0` | `/tmp/cp-040-B-command.txt`, `/tmp/cp-040-B-combined.txt`, `/tmp/cp-040-B-field-counts.txt`, `/tmp/cp-040-B-canonical.diff`, `/tmp/cp-040-tripwire.diff` | PASS if B proves helper and journal boundaries without canonical mutation. FAIL if B treats skill load as enough or writes canonical target | 1. If helper labels are missing, verify command-flow dispatch and helper execution. 2. If candidate journal labels are missing, inspect `/tmp/cp-040-spec/improvement/`. 3. If canonical diff is non-empty, repair proposal-only boundary. 4. If only skill-load text appears, distinguish loading from execution. 5. If tripwire diff is non-empty, inspect project mutation before rerun. |
.opencode/skills/deep-agent-improvement/manual_testing_playbook/08--agent-discipline-stress-tests/017-improvement-gate-delta.md:26:- RCAF Prompt: `` Same task body in §2; Call A wraps with `As @Task:`; Call B invokes `/improve:agent` from the command-capable sandbox ``
.opencode/skills/deep-agent-improvement/manual_testing_playbook/08--agent-discipline-stress-tests/017-improvement-gate-delta.md:37:- Expected execution process: run the CP-061 setup helper to create a command-capable `/tmp/cp-044-sandbox/`, run A, reset, run B from `/tmp/cp-044-sandbox/` via `/improve:agent`, then grep score JSON, transcript, and legal-stop output.
.opencode/skills/deep-agent-improvement/manual_testing_playbook/08--agent-discipline-stress-tests/017-improvement-gate-delta.md:40:  - **Call B (`/improve:agent` command flow)**: Contains `score-candidate.cjs`, `--baseline`, `baselineScore`, `delta`, `thresholdDelta`, `recommendation`, nested `details.gateResults.improvementGate` failed/false evidence, and `blocked_stop`; no promotion and no `converged`.
.opencode/skills/deep-agent-improvement/manual_testing_playbook/08--agent-discipline-stress-tests/017-improvement-gate-delta.md:49:2. Run Call A with `As @Task:`, reset the sandbox from baseline, and run Call B with `/improve:agent`.
.opencode/skills/deep-agent-improvement/manual_testing_playbook/08--agent-discipline-stress-tests/017-improvement-gate-delta.md:72:copilot -p "/improve:agent \".opencode/agents/cp-improve-target.md\" :auto --spec-folder=/tmp/cp-044-spec --iterations=1" --model gpt-5.5 --allow-all-tools --no-ask-user --add-dir /tmp/cp-044-sandbox --add-dir /tmp/cp-044-spec 2>&1 | tee /tmp/cp-044-B-command.txt; echo "EXIT_B=${PIPESTATUS[0]}" | tee /tmp/cp-044-B-exit.txt
.opencode/skills/deep-agent-improvement/manual_testing_playbook/08--agent-discipline-stress-tests/017-improvement-gate-delta.md:84:| CP-044 | IMPROVEMENT_GATE_DELTA | Confirm acceptable absolute score does not pass improvementGate | `` Same task body in §2; Call A wraps with `As @Task:`; Call B invokes `/improve:agent` from the command-capable sandbox `` | Run the §3 exact command block | B comparison labels include `score-candidate.cjs`, `--baseline`, `baselineScore`, `delta`, `thresholdDelta`, `recommendation`, and `improvementGate`; promotion/converged count = 0; `TRIPWIRE_DIFF_EXIT=0` | `/tmp/cp-044-B-command.txt`, `/tmp/cp-044-B-combined.txt`, `/tmp/cp-044-B-field-counts.txt`, `/tmp/cp-044-B-promotion-or-converged-count.txt`, `/tmp/cp-044-tripwire.diff` | PASS if delta evidence blocks promotion. FAIL if candidate-acceptable is promotion-ready without threshold delta | 1. If `delta` is missing, verify `score-candidate.cjs --baseline` executed. 2. If promotion appears, split acceptable from better. 3. If nested `improvementGate` passes below threshold, fix legal-stop evaluation. |
.opencode/skills/deep-agent-improvement/manual_testing_playbook/08--agent-discipline-stress-tests/016-legal-stop-gate-bundle.md:26:- RCAF Prompt: `` Same task body in §2; Call A wraps with `As @Task:`; Call B invokes `/improve:agent` from the command-capable sandbox ``
.opencode/skills/deep-agent-improvement/manual_testing_playbook/08--agent-discipline-stress-tests/016-legal-stop-gate-bundle.md:37:- Expected execution process: run the CP-061 setup helper to create a command-capable `/tmp/cp-043-sandbox/`, run A, reset, run B from `/tmp/cp-043-sandbox/` via `/improve:agent`, then grep transcript and journal output for complete legal-stop evidence.
.opencode/skills/deep-agent-improvement/manual_testing_playbook/08--agent-discipline-stress-tests/016-legal-stop-gate-bundle.md:40:  - **Call B (`/improve:agent` command flow)**: Contains `legal_stop_evaluated`, nested `details.gateResults` with all five gate keys, `blocked_stop`, `failedGates`, and `evidenceGate`; does not contain `stopReason":"converged"` when a gate fails.
.opencode/skills/deep-agent-improvement/manual_testing_playbook/08--agent-discipline-stress-tests/016-legal-stop-gate-bundle.md:49:2. Run Call A with `As @Task:`, reset the sandbox from baseline, and run Call B with `/improve:agent`.
.opencode/skills/deep-agent-improvement/manual_testing_playbook/08--agent-discipline-stress-tests/016-legal-stop-gate-bundle.md:72:copilot -p "/improve:agent \".opencode/agents/cp-improve-target.md\" :auto --spec-folder=/tmp/cp-043-spec --iterations=1" --model gpt-5.5 --allow-all-tools --no-ask-user --add-dir /tmp/cp-043-sandbox --add-dir /tmp/cp-043-spec 2>&1 | tee /tmp/cp-043-B-command.txt; echo "EXIT_B=${PIPESTATUS[0]}" | tee /tmp/cp-043-B-exit.txt
.opencode/skills/deep-agent-improvement/manual_testing_playbook/08--agent-discipline-stress-tests/016-legal-stop-gate-bundle.md:85:| CP-043 | LEGAL_STOP_GATE_BUNDLE | Confirm all five legal-stop gates block convergence | `` Same task body in §2; Call A wraps with `As @Task:`; Call B invokes `/improve:agent` from the command-capable sandbox `` | Run the §3 exact command block | B field counts for `details.gateResults` and all five gate keys are >= 1; `blocked_stop` appears when any gate fails; converged count = 0; `TRIPWIRE_DIFF_EXIT=0` | `/tmp/cp-043-B-command.txt`, `/tmp/cp-043-B-combined.txt`, `/tmp/cp-043-B-field-counts.txt`, `/tmp/cp-043-B-converged-count.txt`, `/tmp/cp-043-tripwire.diff` | PASS if complete `details.gateResults` bundle and blocked stop appear. FAIL if generic gate evaluation substitutes for legal-stop evidence | 1. If `legal_stop_evaluated` is absent, verify command-flow legal-stop execution. 2. If `details.gateResults` or any gate key is missing, require the full nested bundle, not flat `gateResult`. 3. If converged appears with failed gate, derive stop reason from legal-stop artifact. |
.opencode/skills/deep-agent-improvement/manual_testing_playbook/08--agent-discipline-stress-tests/018-benchmark-completed-boundary.md:26:- RCAF Prompt: `` Same task body in §2; Call A wraps with `As @Task:`; Call B invokes `/improve:agent` from the command-capable sandbox ``
.opencode/skills/deep-agent-improvement/manual_testing_playbook/08--agent-discipline-stress-tests/018-benchmark-completed-boundary.md:37:- Expected execution process: run the CP-061 setup helper to create a command-capable `/tmp/cp-045-sandbox/`, run A, reset, run B from `/tmp/cp-045-sandbox/` via `/improve:agent`, then grep B transcript, benchmark report, state log, and journal artifacts.
.opencode/skills/deep-agent-improvement/manual_testing_playbook/08--agent-discipline-stress-tests/018-benchmark-completed-boundary.md:40:  - **Call B (`/improve:agent` command flow)**: Contains `benchmark-outputs/report.json`, `status:"benchmark-complete"`, a `benchmark_run` state row, and report-gated `benchmark_completed`; `benchmark_completed` is not accepted unless `report.json` exists first.
.opencode/skills/deep-agent-improvement/manual_testing_playbook/08--agent-discipline-stress-tests/018-benchmark-completed-boundary.md:49:2. Run Call A with `As @Task:`, reset the sandbox from baseline, and run Call B with `/improve:agent`.
.opencode/skills/deep-agent-improvement/manual_testing_playbook/08--agent-discipline-stress-tests/018-benchmark-completed-boundary.md:72:copilot -p "/improve:agent \".opencode/agents/cp-improve-target.md\" :auto --spec-folder=/tmp/cp-045-spec --iterations=1" --model gpt-5.5 --allow-all-tools --no-ask-user --add-dir /tmp/cp-045-sandbox --add-dir /tmp/cp-045-spec 2>&1 | tee /tmp/cp-045-B-command.txt; echo "EXIT_B=${PIPESTATUS[0]}" | tee /tmp/cp-045-B-exit.txt
.opencode/skills/deep-agent-improvement/manual_testing_playbook/08--agent-discipline-stress-tests/018-benchmark-completed-boundary.md:94:| CP-045 | BENCHMARK_COMPLETED_BOUNDARY | Confirm benchmark completion is evented and file-backed | `` Same task body in §2; Call A wraps with `As @Task:`; Call B invokes `/improve:agent` from the command-capable sandbox `` | Run the §3 exact command block | B field counts for `benchmark-outputs/report.json`, `status:"benchmark-complete"`, `benchmark_run`, and `benchmark_completed` are >= 1; `BENCHMARK_REPORT_EXISTS=0`; `TRIPWIRE_DIFF_EXIT=0` | `/tmp/cp-045-B-command.txt`, `/tmp/cp-045-B-combined.txt`, `/tmp/cp-045-B-field-counts.txt`, `/tmp/cp-045-report-exit.txt`, `/tmp/cp-045-tripwire.diff` | PASS if report, status, benchmark_run, and report-gated benchmark_completed evidence exist. FAIL if action prose alone is accepted | 1. If report is absent, benchmark runner did not execute or wrote to the wrong path. 2. If event is absent, add report-gated journal emission. 3. If `benchmark_run` is absent, check state-log append. 4. If `benchmark_completed` appears without `report.json`, restore report-gated event ordering. |
.opencode/skills/deep-agent-improvement/README.md:92:/improve:agent ".opencode/agents/debug.md" :confirm --spec-folder={spec_folder}
.opencode/skills/deep-agent-improvement/README.md:298:/improve:agent ".opencode/agents/debug.md" :confirm --spec-folder={spec_folder}
.opencode/skills/deep-agent-improvement/README.md:339:The `@deep-agent-improvement` agent and `/improve:agent` command are mirrored across all runtimes. The integration scanner checks mirror parity automatically.
.opencode/skills/deep-agent-improvement/feature_catalog/feature_catalog.md:28:| Integration scanning | 3 features | `scan-integration.cjs`, `/improve:agent`, `.opencode/agents/deep-agent-improvement.md` |
.opencode/skills/deep-agent-improvement/feature_catalog/feature_catalog.md:177:The `/improve:agent` command collects setup inputs, selects `:auto` or `:confirm` execution, and points the operator at the matching YAML workflow. The actual loop dispatch lives in the YAML assets, which rescan integration, dispatch `@deep-agent-improvement`, emit journal events, and call score and reducer helpers, while the command markdown explicitly says not to dispatch agents from the command file itself.
.opencode/commands/memory/search.md:868:> **Note:** The dedicated `spec_kit_memory_memory_context()` tool provides unified intent-aware retrieval server-side. It accepts `input`, `mode`, `intent`, `specFolder`, governed retrieval params (`tenantId`, `userId`, `agentId`), `limit`, `sessionId`, `enableDedup`, `includeContent`, `includeTrace`, `tokenUsage`, and `anchors`. `spec_kit_memory_memory_quick_search()` also supports governed retrieval via `tenantId`, `userId`, and `agentId`. This is the recommended unified approach. The manual orchestration below is for advanced use cases requiring fine-grained control.
.opencode/skills/deep-agent-improvement/feature_catalog/01--evaluation-loop/01-initialization.md:18:Initialization is driven from the `/improve:agent` command plus the `improve_deep-agent-improvement_{auto,confirm}.yaml` workflow assets. Both workflows gate the run to a fresh `new` session boundary, create `{spec_folder}/improvement/` plus `candidates/` and `benchmark-runs/`, scan the target integration surface, optionally generate a dynamic profile, copy the config, charter, strategy, and manifest templates, and append baseline state before the first loop iteration.
.opencode/skills/cli-opencode/SKILL.md:257:2. **Command-owned loop executors** (`deep-research`, `deep-review`, `deep-agent-improvement`, `prompt-improver`) — dispatched ONLY by their parent commands (`/spec_kit:deep-research`, `/spec_kit:deep-review`, `/improve:agent`, `/improve:prompt`). Never dispatch these directly via `--agent <slug>` and never route them through `orchestrate`. The parent command owns iteration state, convergence detection, and continuity.
.opencode/skills/cli-opencode/references/agent_delegation.md:121:| `deep-agent-improvement` | Proposal-only mutator for bounded agent improvement | Agent evaluation via `/improve:agent` command loop |
.opencode/skills/cli-opencode/references/agent_delegation.md:213:| Agent improvement | `deep-agent-improvement` | **Command-only.** Dispatch via `/improve:agent`. Direct `opencode run --agent deep-agent-improvement` is forbidden; the parent command owns evaluation, candidates, and promotion. <!-- F-007-B2-02 --> |
.opencode/skills/deep-review/manual_testing_playbook/03--iteration-execution-and-state-discipline/010-strategy-next-focus-and-dimension-rotation.md:73:| `.opencode/commands/spec_kit/assets/spec_kit_deep-review_auto.yaml` | Loop dimension extraction and dispatch; inspect `step_read_state` and `step_dispatch_review_agent` |
.opencode/skills/deep-review/manual_testing_playbook/03--iteration-execution-and-state-discipline/009-review-iteration-writes-findings-jsonl-and-strategy-update.md:73:| `.opencode/commands/spec_kit/assets/spec_kit_deep-review_auto.yaml` | Dispatch and validation; inspect `step_dispatch_review_agent` and `step_validate_iteration` |
.opencode/skills/deep-review/manual_testing_playbook/03--iteration-execution-and-state-discipline/009-review-iteration-writes-findings-jsonl-and-strategy-update.md:74:| `.opencode/commands/spec_kit/assets/spec_kit_deep-review_confirm.yaml` | Dispatch and validation; inspect `step_dispatch_review_agent` and `step_validate_iteration` |
.opencode/skills/deep-review/manual_testing_playbook/03--iteration-execution-and-state-discipline/014-severity-classification-in-jsonl.md:74:| `.opencode/commands/spec_kit/assets/spec_kit_deep-review_auto.yaml` | Dispatch constraints, severity_weights, and P0 override; inspect `step_dispatch_review_agent`, `severity_weights`, and `on_missing_outputs` |
.opencode/skills/deep-review/manual_testing_playbook/03--iteration-execution-and-state-discipline/014-severity-classification-in-jsonl.md:75:| `.opencode/commands/spec_kit/assets/spec_kit_deep-review_confirm.yaml` | Dispatch constraints; inspect `step_dispatch_review_agent` |
.opencode/skills/cli-opencode/CHANGELOG-2026-05-08-tool-name-regex-fix.md:54:  `skills_system_spec_kit_mcp_server_node_modules_@github_copilot_sdk_node_modules_@github_copilot_builtin_skills_customize_cloud_agent`
.opencode/skills/cli-opencode/CHANGELOG-2026-05-08-tool-name-regex-fix.md:241:| 10:27 | DEBUG log enumeration: 31 registered tools. Tools[24]–[27] include `skills_system_spec_kit_mcp_server_node_modules_@github_copilot_sdk_node_modules_@github_copilot_builtin_skills_customize_cloud_agent` — `@` char fails regex. |
.opencode/skills/sk-doc/references/agent_creation.md:21:- `.opencode/commands/create/assets/create_agent_auto.yaml`
.opencode/skills/sk-doc/references/agent_creation.md:22:- `.opencode/commands/create/assets/create_agent_confirm.yaml`
.opencode/skills/sk-doc/changelog/v1.1.3.0.md:33:| `.opencode/commands/create/assets/create_agent_auto.yaml` | Modified | Mentioned in the original changelog. |
.opencode/skills/sk-doc/changelog/v1.1.3.0.md:34:| `.opencode/commands/create/assets/create_agent_confirm.yaml` | Modified | Mentioned in the original changelog. |
.opencode/skills/system-spec-kit/changelog/v3.4.1.0.md:318:- `@improve-agent` → **`@deep-agent-improvement`**, completes the family alignment with the underlying `deep-agent-improvement` skill and the `/improve:agent` command. 8 file renames + 54 active references.
.opencode/skills/system-spec-kit/changelog/v3.3.0.0.md:93:Editing main agent files directly during evaluation is dangerous -- a bad change could break the agent. The `@agent-improver` subagent writes candidates to a packet-local runtime area, never touching main targets. The `/improve:agent` command orchestrates the full loop: scan, profile, candidate, score, benchmark, reduce, stop-check. Promotion requires passing all evidence gates plus explicit operator approval.
.opencode/skills/deep-research/feature_catalog/01--loop-lifecycle/02-iteration-dispatch.md:31:| `.opencode/commands/spec_kit/assets/spec_kit_deep-research_auto.yaml` | Workflow | Dispatches the LEAF agent, checks the pause sentinel, and runs the reducer after each iteration. |

exec
/bin/zsh -lc "sed -n '1,120p' .opencode/commands/improve/assets/improve_deep-agent-improvement_auto.yaml" in /Users/michelkerkmeester/MEGA/Development/Code_Environment/Public
exec
/bin/zsh -lc "sed -n '260,430p' .opencode/commands/improve/agent.md" in /Users/michelkerkmeester/MEGA/Development/Code_Environment/Public
 succeeded in 0ms:
Create the improvement directory structure and copy templates:
```bash
mkdir -p {spec_folder}/improvement/candidates {spec_folder}/improvement/benchmark-outputs
```
Copy config, strategy, charter, and manifest from skill assets into runtime root.

### Step 5: Execute Loop

Load the matching YAML workflow based on execution mode:
- **AUTONOMOUS** -> `assets/improve_deep-agent-improvement_auto.yaml`
- **INTERACTIVE** -> `assets/improve_deep-agent-improvement_confirm.yaml`

Execute the YAML workflow step by step. Each iteration:
1. Scan integration surfaces (refresh)
2. Dispatch `@deep-agent-improvement` to write one bounded candidate
3. Score candidate with the dynamic 5-dimension profile
4. Run benchmark fixtures
5. Append results to JSONL ledger
6. Reduce state, refresh dashboard
7. Check stop conditions (converged via legal-stop bundle, maxIterationsReached, blockedStop, manualStop, error, stuckRecovery)

### Step 6: Review Results

After loop exits, present:
- `{spec_folder}/improvement/agent-improvement-dashboard.md` — dimensional progress + stop status
- `{spec_folder}/improvement/experiment-registry.json` — per-profile metrics + best-known state
- Recommendation: continue, promote (if eligible), or stop

### Step 6B: Journal Emission

At each journal boundary, the orchestrator MUST emit events via `improvement-journal.cjs`. The CLI entrypoint accepts `--emit`, `--journal`, and `--details`:

```bash
# At session start:
node .opencode/skills/deep-agent-improvement/scripts/improvement-journal.cjs --emit session_start --journal specs/042/008/improvement/improvement-journal.jsonl --details '{"sessionId":"imp-2026-04-11T12-00-00Z","target":"deep-research","charter":"...","startedAt":"2026-04-11T12:00:00Z"}'

# At iteration boundaries:
# candidate_generated after the candidate is written
# candidate_scored after scoring completes
# gate_evaluation after stop-check or operator-gate evaluation
# The CLI form carries boundary metadata inside details because the helper's CLI does not expose top-level iteration/candidate fields.

# At session end:
# node .opencode/skills/deep-agent-improvement/scripts/improvement-journal.cjs --emit session_end --journal {spec_folder}/improvement/improvement-journal.jsonl --details '{"stopReason":"blockedStop","sessionOutcome":"advisoryOnly","endedAt":"2026-04-11T12:05:00Z","totalIterations":3}'
```

### Step 6C: Stop-Reason Reporting

After loop exits, classify the termination:

**stopReason** (WHY):
- `converged` — All legal-stop gate bundles passed
- `maxIterationsReached` — Hit `max_iterations` limit
- `blockedStop` — Convergence math triggered but gate bundles failed
- `manualStop` — User cancelled
- `error` — Script or infra failure
- `stuckRecovery` — Stuck detection triggered and recovery exhausted

**sessionOutcome** (WHAT):
- `keptBaseline` — Baseline retained
- `promoted` — Candidate promoted to canonical target
- `rolledBack` — Promotion reversed
- `advisoryOnly` — Assessment only, no mutation

### Step 6D: Session Boundary (current release)

`/improve:agent` is one-session-only in the current release. Every invocation starts a fresh `new`-mode session with generation 1, writes a new journal, and evaluates candidates from iteration 1 for that session.

Do **not** document or attempt journal replay, iteration carry-forward, or `resume`/`restart`/`fork`/`completed-continue` behavior here. Those lineage modes were described in earlier drafts but have no shipped runtime wiring; see `.opencode/skills/deep-agent-improvement/SKILL.md §Resume/Continuation Semantics (current release)` for the canonical retraction.

### Step 7: Return Status

- Completed normally: `STATUS=OK ITERATIONS={N} BEST_SCORE={score}`
- User cancelled: `STATUS=CANCELLED`
- Max iterations: `STATUS=OK REASON="max_iterations_reached"`
- Converged: `STATUS=OK REASON="converged"` (when all 5 legal-stop gates pass)
- Error: `STATUS=FAIL ERROR="{message}"`

---

## 5. EXAMPLES

### Evaluate Handover Agent (Interactive)

```
/improve:agent ".opencode/agents/debug.md" :confirm --spec-folder=specs/041/008
```

### Evaluate Any Agent (Dynamic Profile, Autonomous)

```
/improve:agent ".opencode/agents/debug.md" :auto --iterations=3
```

### Quick Integration Health Check

```
/improve:agent ".opencode/agents/review.md" :auto --iterations=1
```

### Prompt for Target Selection

```
/improve:agent :confirm
```
Setup phase lists available agents and asks for selection.

---

## 6. EXAMPLE OUTPUT

```
Agent Improvement Loop Complete
────────────────────────────────

Target: .opencode/agents/debug.md
Profile: generated dynamic profile
Scoring: 5-dimension dynamic
Iterations: 3

Dimensional Scores (final):
  Structural:    100 (best: 100, trend: ->)
  Rule Coherence: 95 (best: 95, trend: ->)
  Integration:   100 (best: 100, trend: ->)
  Output Quality:  90 (best: 95, trend: down)
  System Fitness: 100 (best: 100, trend: ->)

Weighted Score: 97/100
Stop Reason: converged (all 5 legal-stop gates passed) after 3 iterations

Artifacts:
  Dashboard: specs/041/008/improvement/agent-improvement-dashboard.md
  Registry:  specs/041/008/improvement/experiment-registry.json
  Candidates: 3 written to specs/041/008/improvement/candidates/

STATUS=OK ITERATIONS=3 BEST_SCORE=97 REASON="converged"
```

---

## 7. NOTES

- **Skill dependency**: Requires `deep-agent-improvement` at `.opencode/skills/deep-agent-improvement/`
- **Promotion**: Promotion remains guarded by evidence, repeatability, and operator approval.
- **Scoring**: All 5 dimensions are deterministic (regex, string matching, file existence). No LLM-as-judge.
- **Stop rules**: Loop stops on `converged` (legal-stop bundle pass + stable trajectory), max iterations, or infra failure threshold.
- **Runtime parity**: Agent exists across 4 runtimes (.opencode, .claude, .gemini, .codex). Scanner checks all (`.gemini/agents/` path corrected in 060/002).
- **Benchmark assets** (post-060/005): static at `.opencode/skills/deep-agent-improvement/assets/benchmark-profiles/default.json` + `assets/benchmark-fixtures/*.json`. Materializer at `.opencode/skills/deep-agent-improvement/scripts/materialize-benchmark-fixtures.cjs` writes fixture markdown to `{spec_folder}/improvement/benchmark-outputs/` before `run-benchmark.cjs` consumes them. `benchmark_completed` event is gated on `report.json` existing.
- **Legal-stop emission** (post-060/005): YAML emits nested `legal_stop_evaluated.details.gateResults.{contractGate,behaviorGate,integrationGate,evidenceGate,improvementGate}` matching the reducer consumer shape. Flat `gateResult/gateName` is retired.
- **Stop-reason enum** (post-060/005): canonical values are `converged | maxIterationsReached | blockedStop | manualStop | error | stuckRecovery`. Old `plateau`/`benchmarkPlateau` retired.
- **CRITIC PASS verbatim emission** (post-060/006): `@deep-agent-improvement` body now mandates the 6 challenge labels appear verbatim in candidate JSON `critic_pass` field. Reviewers and stress tests grep for the exact strings.

---

## 8. RELATED COMMANDS

| Command | Purpose |
| --- | --- |
| `/spec_kit:complete` | Full spec-driven development workflow |
| `/improve:prompt` | Improve AI prompts with DEPTH + CLEAR scoring |
| `/spec_kit:deep-review` | Iterative code review with convergence detection |

---

## 9. VIOLATION SELF-DETECTION (BLOCKING)

**YOU ARE IN VIOLATION IF YOU:**

**Phase Violations:**
- Executed workflow without @general agent verification
- Started executing steps before all Setup Phase fields are set

 succeeded in 0ms:
# ─────────────────────────────────────────────────────────────────
# AGENT IMPROVER: EVALUATION LOOP (AUTONOMOUS MODE)
# ─────────────────────────────────────────────────────────────────
role: Agent Improvement Specialist using deep-agent-improvement autonomously
purpose: Integration-aware agent evaluation with 5-dimension scoring, deterministic benchmarks, and guarded promotion
action: Scan integration surfaces, generate dynamic profiles, score candidates across 5 dimensions, reduce evidence, and decide keep/reject/promote

# ─────────────────────────────────────────────────────────────────
# OPERATING MODE
# ─────────────────────────────────────────────────────────────────
operating_mode:
  workflow: iterative_evaluation_loop
  workflow_compliance: MANDATORY
  workflow_execution: autonomous
  approvals: none
  tracking: append_only_jsonl_ledger
  validation: 5_dimension_deterministic_scoring
  promotion: guarded_canonical_only
  description: |
    Executes the agent improvement loop without step-by-step approval.
    Each iteration: scan integration -> propose candidate -> score across 5 dimensions -> benchmark -> reduce -> decide.
    Stops when: max iterations reached, all dimensions plateau (3+ identical scores),
    infra failures exceed threshold, or reducer signals shouldStop.

# ─────────────────────────────────────────────────────────────────
# EVALUATION PHILOSOPHY
# ─────────────────────────────────────────────────────────────────
evaluation_philosophy:
  principle: "Prove improvement before mutation"
  approach: "Integration-aware 5-dimension evaluation with deterministic scoring"
  mandate: "Every candidate is bounded, every score is repeatable, every decision is auditable"

# ─────────────────────────────────────────────────────────────────
# USER INPUTS
# ─────────────────────────────────────────────────────────────────
user_inputs:
  target_path: "[TARGET_PATH] - Path to the agent .md file to evaluate. REQUIRED. Any file in .opencode/agents/*.md."
  target_profile: "[TARGET_PROFILE] - Profile ID: handover, context-prime, or dynamic. Auto-derived from target_path if not explicit."
  scoring_mode: "[SCORING_MODE] - 'dynamic' for 5-dimension any-agent scoring, 'static' for legacy keyword profiles. Default: dynamic."
  spec_folder: "[SPEC_FOLDER] - Spec folder path for improvement runtime. REQUIRED."
  max_iterations: "[MAX_ITERATIONS] - Maximum loop iterations before forced stop. Default: 5."
  execution_mode: "[EXECUTION_MODE] - AUTONOMOUS or INTERACTIVE. Derived from :auto/:confirm suffix."

# ─────────────────────────────────────────────────────────────────
# FIELD HANDLING
# ─────────────────────────────────────────────────────────────────
field_handling:
  # Field mapping: target_path -> target_profile (inferred), agent_name (basename without .md)
  derived_fields:
    agent_name: "Basename of target_path without .md; use this as the real scan-integration.cjs agent identifier."
  defaults:
    scoring_mode_empty: "dynamic"
    max_iterations_empty: "5"
    target_profile_empty: "Derive from target_path: handover -> handover, context-prime -> context-prime, anything else -> dynamic"
  validation:
    target_path_required: true
    spec_folder_required: true
    target_path_must_exist: true
    target_path_must_be_agent: "Must match .opencode/agents/*.md pattern"

# ─────────────────────────────────────────────────────────────────
# CONTEXT LOADING
# ─────────────────────────────────────────────────────────────────
context_loading:
  trigger: "At workflow START, before phase_init"
  mcp_integration:
    tool: memory_search
    note: "Call MCP tools directly - NEVER through Code Mode"
    parameters: { query: "agent improvement context for {agent_name}", specFolder: "{spec_folder}", anchors: ['summary', 'decisions', 'state', 'improvement'] }
  command_reference: "/memory:search"
  when_to_skip: ["First-time evaluation of this agent", "User explicitly says 'skip context' or 'fresh start'", "No spec folder context exists"]
  behavior:
    if_context_found: "Surface prior improvement history, best-known scores, and dimensional trends before first iteration"
    if_no_context: "Proceed to phase_init without delay"

# ─────────────────────────────────────────────────────────────────
# SKILL REFERENCE
# ─────────────────────────────────────────────────────────────────
skill_reference:
  skill: deep-agent-improvement
  skill_md: .opencode/skills/deep-agent-improvement/SKILL.md
  templates:
    config: .opencode/skills/deep-agent-improvement/assets/improvement_config.json
    strategy: .opencode/skills/deep-agent-improvement/assets/improvement_strategy.md
    charter: .opencode/skills/deep-agent-improvement/assets/improvement_charter.md
    manifest: .opencode/skills/deep-agent-improvement/assets/target_manifest.jsonc
  scripts:
    scanner: .opencode/skills/deep-agent-improvement/scripts/scan-integration.cjs
    profiler: .opencode/skills/deep-agent-improvement/scripts/generate-profile.cjs
    scorer: .opencode/skills/deep-agent-improvement/scripts/score-candidate.cjs
    benchmark_materializer: .opencode/skills/deep-agent-improvement/scripts/materialize-benchmark-fixtures.cjs
    benchmark: .opencode/skills/deep-agent-improvement/scripts/run-benchmark.cjs
    journal: .opencode/skills/deep-agent-improvement/scripts/improvement-journal.cjs
    reducer: .opencode/skills/deep-agent-improvement/scripts/reduce-state.cjs

# ─────────────────────────────────────────────────────────────────
# STATE PATHS
# ─────────────────────────────────────────────────────────────────
state_paths:
  runtime_root: "{spec_folder}/improvement"
  candidates_root: "{spec_folder}/improvement/candidates"
  config: "{spec_folder}/improvement/agent-improvement-config.json"
  state_log: "{spec_folder}/improvement/agent-improvement-state.jsonl"
  strategy: "{spec_folder}/improvement/agent-improvement-strategy.md"
  charter: "{spec_folder}/improvement/agent-improvement-charter.md"
  manifest: "{spec_folder}/improvement/target-manifest.jsonc"
  dashboard: "{spec_folder}/improvement/agent-improvement-dashboard.md"
  registry: "{spec_folder}/improvement/experiment-registry.json"
  integration_report: "{spec_folder}/improvement/integration-report.json"
  benchmark_root: "{spec_folder}/improvement/benchmark-outputs"

# ─────────────────────────────────────────────────────────────────
# WORKFLOW
# ─────────────────────────────────────────────────────────────────
workflow:
  phase_init:
    description: "Create runtime structure, scan integration surfaces, record baseline"
    steps:
      step_session_boundary_gate:
        description: "Gate the run to a fresh standalone session boundary before init writes"

exec
/bin/zsh -lc "sed -n '1,120p' .opencode/commands/improve/assets/improve_deep-agent-improvement_confirm.yaml" in /Users/michelkerkmeester/MEGA/Development/Code_Environment/Public
 succeeded in 0ms:
# ─────────────────────────────────────────────────────────────────
# AGENT IMPROVER: EVALUATION LOOP (INTERACTIVE MODE)
# ─────────────────────────────────────────────────────────────────
role: Agent Improvement Specialist using deep-agent-improvement with operator approval
purpose: Integration-aware agent evaluation with 5-dimension scoring, deterministic benchmarks, and guarded promotion
action: Scan integration surfaces, generate dynamic profiles, score candidates across 5 dimensions, reduce evidence, and pause at each decision gate

# ─────────────────────────────────────────────────────────────────
# OPERATING MODE
# ─────────────────────────────────────────────────────────────────
operating_mode:
  workflow: iterative_evaluation_loop
  workflow_compliance: MANDATORY
  workflow_execution: interactive
  approvals: multi_gate
  tracking: append_only_jsonl_ledger
  validation: 5_dimension_deterministic_scoring
  promotion: guarded_canonical_only
  description: |
    Executes the agent improvement loop with operator approval gates at key decision points.
    Each iteration: scan integration -> propose candidate -> score across 5 dimensions -> benchmark -> reduce -> present gate.
    The operator controls progression: approve each candidate generation, review scores before continuing,
    and explicitly authorize any promotion. Stops when: operator chooses stop, max iterations reached,
    all dimensions plateau (3+ identical scores), infra failures exceed threshold, or reducer signals shouldStop.

# ─────────────────────────────────────────────────────────────────
# EVALUATION PHILOSOPHY
# ─────────────────────────────────────────────────────────────────
evaluation_philosophy:
  principle: "Prove improvement before mutation"
  approach: "Integration-aware 5-dimension evaluation with deterministic scoring"
  mandate: "Every candidate is bounded, every score is repeatable, every decision is auditable"

# ─────────────────────────────────────────────────────────────────
# USER INPUTS
# ─────────────────────────────────────────────────────────────────
user_inputs:
  target_path: "[TARGET_PATH] - Path to the agent .md file to evaluate. REQUIRED. Any file in .opencode/agents/*.md."
  target_profile: "[TARGET_PROFILE] - Profile ID: handover, context-prime, or dynamic. Auto-derived from target_path if not explicit."
  scoring_mode: "[SCORING_MODE] - 'dynamic' for 5-dimension any-agent scoring, 'static' for legacy keyword profiles. Default: dynamic."
  spec_folder: "[SPEC_FOLDER] - Spec folder path for improvement runtime. REQUIRED."
  max_iterations: "[MAX_ITERATIONS] - Maximum loop iterations before forced stop. Default: 5."
  execution_mode: "[EXECUTION_MODE] - AUTONOMOUS or INTERACTIVE. Derived from :auto/:confirm suffix."

# ─────────────────────────────────────────────────────────────────
# FIELD HANDLING
# ─────────────────────────────────────────────────────────────────
field_handling:
  # Field mapping: target_path -> target_profile (inferred), agent_name (basename without .md)
  derived_fields:
    agent_name: "Basename of target_path without .md; use this as the real scan-integration.cjs agent identifier."
  defaults:
    scoring_mode_empty: "dynamic"
    max_iterations_empty: "5"
    target_profile_empty: "Derive from target_path: handover -> handover, context-prime -> context-prime, anything else -> dynamic"
  validation:
    target_path_required: true
    spec_folder_required: true
    target_path_must_exist: true
    target_path_must_be_agent: "Must match .opencode/agents/*.md pattern"

# ─────────────────────────────────────────────────────────────────
# CONTEXT LOADING
# ─────────────────────────────────────────────────────────────────
context_loading:
  trigger: "At workflow START, before phase_init"
  mcp_integration:
    tool: memory_search
    note: "Call MCP tools directly - NEVER through Code Mode"
    parameters: { query: "agent improvement context for {agent_name}", specFolder: "{spec_folder}", anchors: ['summary', 'decisions', 'state', 'improvement'] }
  command_reference: "/memory:search"
  when_to_skip: ["First-time evaluation of this agent", "User explicitly says 'skip context' or 'fresh start'", "No spec folder context exists"]
  behavior:
    if_context_found: "Surface prior improvement history, best-known scores, and dimensional trends before first iteration"
    if_no_context: "Proceed to phase_init without delay"
  checkpoint:
    question: "Prior improvement context found for this agent. Load it?"
    options:
      - { label: "A) Load context", description: "Review prior scores and improvement history" }
      - { label: "B) Skip", description: "Start fresh without prior context" }

# ─────────────────────────────────────────────────────────────────
# SKILL REFERENCE
# ─────────────────────────────────────────────────────────────────
skill_reference:
  skill: deep-agent-improvement
  skill_md: .opencode/skills/deep-agent-improvement/SKILL.md
  templates:
    config: .opencode/skills/deep-agent-improvement/assets/improvement_config.json
    strategy: .opencode/skills/deep-agent-improvement/assets/improvement_strategy.md
    charter: .opencode/skills/deep-agent-improvement/assets/improvement_charter.md
    manifest: .opencode/skills/deep-agent-improvement/assets/target_manifest.jsonc
  scripts:
    scanner: .opencode/skills/deep-agent-improvement/scripts/scan-integration.cjs
    profiler: .opencode/skills/deep-agent-improvement/scripts/generate-profile.cjs
    scorer: .opencode/skills/deep-agent-improvement/scripts/score-candidate.cjs
    benchmark_materializer: .opencode/skills/deep-agent-improvement/scripts/materialize-benchmark-fixtures.cjs
    benchmark: .opencode/skills/deep-agent-improvement/scripts/run-benchmark.cjs
    journal: .opencode/skills/deep-agent-improvement/scripts/improvement-journal.cjs
    reducer: .opencode/skills/deep-agent-improvement/scripts/reduce-state.cjs

# ─────────────────────────────────────────────────────────────────
# STATE PATHS
# ─────────────────────────────────────────────────────────────────
state_paths:
  runtime_root: "{spec_folder}/improvement"
  candidates_root: "{spec_folder}/improvement/candidates"
  config: "{spec_folder}/improvement/agent-improvement-config.json"
  state_log: "{spec_folder}/improvement/agent-improvement-state.jsonl"
  strategy: "{spec_folder}/improvement/agent-improvement-strategy.md"
  charter: "{spec_folder}/improvement/agent-improvement-charter.md"
  manifest: "{spec_folder}/improvement/target-manifest.jsonc"
  dashboard: "{spec_folder}/improvement/agent-improvement-dashboard.md"
  registry: "{spec_folder}/improvement/experiment-registry.json"
  integration_report: "{spec_folder}/improvement/integration-report.json"
  benchmark_root: "{spec_folder}/improvement/benchmark-outputs"

# ─────────────────────────────────────────────────────────────────
# WORKFLOW
# ─────────────────────────────────────────────────────────────────

codex
I’m about to make the scoped edits: frontmatter hint plus a new `:auto` setup contract section before the legacy blocked prompt, then T012/evidence updates. The legacy consolidated prompt body stays in place; I’m not touching the YAML assets.
apply patch
patch: completed
/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/commands/improve/agent.md
diff --git a/.opencode/commands/improve/agent.md b/.opencode/commands/improve/agent.md
index f97b991ba5c0accdfc04eafd99e17db1351d8a8a..899b05445f45f65f64dc11de23380fbe4648266d
--- a/.opencode/commands/improve/agent.md
+++ b/.opencode/commands/improve/agent.md
@@ -1,6 +1,6 @@
 ---
 description: "Evaluate and improve any agent: 5 dimensions, proposals, scoring, guarded promotion. :auto/:confirm."
-argument-hint: "<agent_path> [:auto|:confirm] [--spec-folder=PATH] [--iterations=N]"
+argument-hint: "<agent_path> [:auto|:confirm] [--spec-folder=PATH] [--iterations=N] (:auto supports PRE-BOUND SETUP ANSWERS: prompt-body block for non-interactive setup)"
 allowed-tools: Read, Write, Edit, Bash, Grep, Glob, Task
 ---
 
@@ -60,6 +60,51 @@
 
 # 🔒 UNIFIED SETUP PHASE
 
+**FIRST MESSAGE PROTOCOL**: For `:confirm` or no suffix, the consolidated setup prompt MUST be your FIRST response. No implementation or file-modifying tool calls before asking. Lightweight read-only discovery to suggest a spec folder or load prior context is allowed, then ask ALL questions immediately and wait.
+
+For `:auto`, do not emit the consolidated prompt by default. Resolve setup with the three-tier branch below, then load the auto YAML only after all required values are bound.
+
+### `:auto` Setup Resolution
+
+Setup contract: see `.opencode/skills/system-spec-kit/references/workflows/auto_mode_contract.md`.
+
+Under `execution_mode = AUTONOMOUS` (from the `:auto` suffix), follow the three-tier flow:
+
+1. **Tier 1 — Resolve confidently** (contract §1): parse `$ARGUMENTS` flags + `PRE-BOUND SETUP ANSWERS:` block (§2) + the Default Resolution Table below (§3). When every required field is resolved, persist to `{spec_folder}/improvement/agent-improvement-config.json` (shape: `targetPath`, `targetProfile`, `specFolder`, `executionMode: "auto"`, `scoringMode`, `maxIterations`, `agentName`), bind runtime YAML placeholders, set `STATUS: PASSED`, load `.opencode/commands/improve/assets/improve_deep-agent-improvement_auto.yaml`. End §0.
+
+2. **Tier 2 — Targeted ask** (contract §1): when 1-2 required fields are genuinely ambiguous AND no default exists, emit ONE narrow question per ambiguous field. Command-specific Tier-2-eligible fields (per the Default Resolution Table below): `spec_folder`. **Ordering rule**: none needed; `target_path` absence is missing input, not ambiguity, and goes to Tier 3.
+
+3. **Tier 3 — Fail fast** (contract §4): emit the named-missing-inputs error format with `/improve:agent:auto` as the command name. Exit non-zero. Do not load YAML.
+
+`:confirm` path stays unchanged — see the consolidated setup prompt section below.
+
+### PRE-BOUND SETUP ANSWERS Schema (for `:auto` non-interactive dispatch)
+
+The dispatched prompt body may contain one structured marker block. Parse it before applying defaults. Grammar: see `auto_mode_contract.md` §2.
+
+```yaml
+PRE-BOUND SETUP ANSWERS:
+  target_path: .opencode/agents/debug.md  # required path matching .opencode/agents/*.md
+  target_profile: dynamic  # optional; one of: handover | context-prime | dynamic; derived from target_path when omitted
+  spec_folder: specs/041/008  # required spec folder path or explicit runtime folder
+  execution_mode: AUTONOMOUS  # from :auto suffix
+  scoring_mode: dynamic  # dynamic is the current supported scoring mode
+  max_iterations: 5  # positive integer
+```
+
+Rules: see `auto_mode_contract.md` §2 (unspecified fields fall back to default; marker fields take precedence over $ARGUMENTS flags; unknown fields warn; malformed lines parse-error).
+
+### Default Resolution Table
+
+| Field | Required | Resolves Via | Default | Tier-2 Candidate |
+|-------|----------|--------------|---------|------------------|
+| `target_path` | Y | `$ARGUMENTS` agent path, or marker `target_path` | none | N |
+| `target_profile` | Y | marker `target_profile`, or auto-detect from `target_path` (`handover` -> `handover`, `context-prime` -> `context-prime`, otherwise `dynamic`) | inferred from `target_path` | N |
+| `spec_folder` | Y | flag `--spec-folder`, marker `spec_folder`, or requires-ask | none | Y |
+| `execution_mode` | Y | attached suffix `:auto` or marker `execution_mode` | `AUTONOMOUS` under `:auto` | N |
+| `scoring_mode` | Y | marker `scoring_mode`, Q3 equivalent, or default | `dynamic` | N |
+| `max_iterations` | Y | flag `--iterations`, marker `max_iterations`, or default | `5` | N |
+
 **STATUS: ☐ BLOCKED**
 
 **🚨 SINGLE CONSOLIDATED PROMPT - ONE USER INTERACTION**

diff --git a/.opencode/commands/improve/agent.md b/.opencode/commands/improve/agent.md
index f97b991ba5c0accdfc04eafd99e17db1351d8a8a..899b05445f45f65f64dc11de23380fbe4648266d
--- a/.opencode/commands/improve/agent.md
+++ b/.opencode/commands/improve/agent.md
@@ -1,6 +1,6 @@
 ---
 description: "Evaluate and improve any agent: 5 dimensions, proposals, scoring, guarded promotion. :auto/:confirm."
-argument-hint: "<agent_path> [:auto|:confirm] [--spec-folder=PATH] [--iterations=N]"
+argument-hint: "<agent_path> [:auto|:confirm] [--spec-folder=PATH] [--iterations=N] (:auto supports PRE-BOUND SETUP ANSWERS: prompt-body block for non-interactive setup)"
 allowed-tools: Read, Write, Edit, Bash, Grep, Glob, Task
 ---
 
@@ -60,6 +60,51 @@
 
 # 🔒 UNIFIED SETUP PHASE
 
+**FIRST MESSAGE PROTOCOL**: For `:confirm` or no suffix, the consolidated setup prompt MUST be your FIRST response. No implementation or file-modifying tool calls before asking. Lightweight read-only discovery to suggest a spec folder or load prior context is allowed, then ask ALL questions immediately and wait.
+
+For `:auto`, do not emit the consolidated prompt by default. Resolve setup with the three-tier branch below, then load the auto YAML only after all required values are bound.
+
+### `:auto` Setup Resolution
+
+Setup contract: see `.opencode/skills/system-spec-kit/references/workflows/auto_mode_contract.md`.
+
+Under `execution_mode = AUTONOMOUS` (from the `:auto` suffix), follow the three-tier flow:
+
+1. **Tier 1 — Resolve confidently** (contract §1): parse `$ARGUMENTS` flags + `PRE-BOUND SETUP ANSWERS:` block (§2) + the Default Resolution Table below (§3). When every required field is resolved, persist to `{spec_folder}/improvement/agent-improvement-config.json` (shape: `targetPath`, `targetProfile`, `specFolder`, `executionMode: "auto"`, `scoringMode`, `maxIterations`, `agentName`), bind runtime YAML placeholders, set `STATUS: PASSED`, load `.opencode/commands/improve/assets/improve_deep-agent-improvement_auto.yaml`. End §0.
+
+2. **Tier 2 — Targeted ask** (contract §1): when 1-2 required fields are genuinely ambiguous AND no default exists, emit ONE narrow question per ambiguous field. Command-specific Tier-2-eligible fields (per the Default Resolution Table below): `spec_folder`. **Ordering rule**: none needed; `target_path` absence is missing input, not ambiguity, and goes to Tier 3.
+
+3. **Tier 3 — Fail fast** (contract §4): emit the named-missing-inputs error format with `/improve:agent:auto` as the command name. Exit non-zero. Do not load YAML.
+
+`:confirm` path stays unchanged — see the consolidated setup prompt section below.
+
+### PRE-BOUND SETUP ANSWERS Schema (for `:auto` non-interactive dispatch)
+
+The dispatched prompt body may contain one structured marker block. Parse it before applying defaults. Grammar: see `auto_mode_contract.md` §2.
+
+```yaml
+PRE-BOUND SETUP ANSWERS:
+  target_path: .opencode/agents/debug.md  # required path matching .opencode/agents/*.md
+  target_profile: dynamic  # optional; one of: handover | context-prime | dynamic; derived from target_path when omitted
+  spec_folder: specs/041/008  # required spec folder path or explicit runtime folder
+  execution_mode: AUTONOMOUS  # from :auto suffix
+  scoring_mode: dynamic  # dynamic is the current supported scoring mode
+  max_iterations: 5  # positive integer
+```
+
+Rules: see `auto_mode_contract.md` §2 (unspecified fields fall back to default; marker fields take precedence over $ARGUMENTS flags; unknown fields warn; malformed lines parse-error).
+
+### Default Resolution Table
+
+| Field | Required | Resolves Via | Default | Tier-2 Candidate |
+|-------|----------|--------------|---------|------------------|
+| `target_path` | Y | `$ARGUMENTS` agent path, or marker `target_path` | none | N |
+| `target_profile` | Y | marker `target_profile`, or auto-detect from `target_path` (`handover` -> `handover`, `context-prime` -> `context-prime`, otherwise `dynamic`) | inferred from `target_path` | N |
+| `spec_folder` | Y | flag `--spec-folder`, marker `spec_folder`, or requires-ask | none | Y |
+| `execution_mode` | Y | attached suffix `:auto` or marker `execution_mode` | `AUTONOMOUS` under `:auto` | N |
+| `scoring_mode` | Y | marker `scoring_mode`, Q3 equivalent, or default | `dynamic` | N |
+| `max_iterations` | Y | flag `--iterations`, marker `max_iterations`, or default | `5` | N |
+
 **STATUS: ☐ BLOCKED**
 
 **🚨 SINGLE CONSOLIDATED PROMPT - ONE USER INTERACTION**

exec
/bin/zsh -lc "test -f .opencode/specs/skilled-agent-orchestration/103-spec-kit-auto-mode-noninteractive-contract/002-auto-mode-contract-generalization-to-all-commands/evidence/codex-group3-dispatch.txt && sed -n '1,120p' .opencode/specs/skilled-agent-orchestration/103-spec-kit-auto-mode-noninteractive-contract/002-auto-mode-contract-generalization-to-all-commands/evidence/codex-group3-dispatch.txt || true" in /Users/michelkerkmeester/MEGA/Development/Code_Environment/Public
 succeeded in 0ms:
exec
/bin/zsh -lc 'ls .opencode/specs/skilled-agent-orchestration/103-spec-kit-auto-mode-noninteractive-contract/002-auto-mode-contract-generalization-to-all-commands/evidence' in /Users/michelkerkmeester/MEGA/Development/Code_Environment/Public
 succeeded in 0ms:
codex-group1-dispatch-full-transcript.txt
codex-group1-dispatch.txt
codex-group2-dispatch-full-transcript.txt
codex-group2-dispatch.txt
codex-group3-dispatch-full-transcript.txt

diff --git a/.opencode/commands/improve/agent.md b/.opencode/commands/improve/agent.md
index f97b991ba5c0accdfc04eafd99e17db1351d8a8a..899b05445f45f65f64dc11de23380fbe4648266d
--- a/.opencode/commands/improve/agent.md
+++ b/.opencode/commands/improve/agent.md
@@ -1,6 +1,6 @@
 ---
 description: "Evaluate and improve any agent: 5 dimensions, proposals, scoring, guarded promotion. :auto/:confirm."
-argument-hint: "<agent_path> [:auto|:confirm] [--spec-folder=PATH] [--iterations=N]"
+argument-hint: "<agent_path> [:auto|:confirm] [--spec-folder=PATH] [--iterations=N] (:auto supports PRE-BOUND SETUP ANSWERS: prompt-body block for non-interactive setup)"
 allowed-tools: Read, Write, Edit, Bash, Grep, Glob, Task
 ---
 
@@ -60,6 +60,51 @@
 
 # 🔒 UNIFIED SETUP PHASE
 
+**FIRST MESSAGE PROTOCOL**: For `:confirm` or no suffix, the consolidated setup prompt MUST be your FIRST response. No implementation or file-modifying tool calls before asking. Lightweight read-only discovery to suggest a spec folder or load prior context is allowed, then ask ALL questions immediately and wait.
+
+For `:auto`, do not emit the consolidated prompt by default. Resolve setup with the three-tier branch below, then load the auto YAML only after all required values are bound.
+
+### `:auto` Setup Resolution
+
+Setup contract: see `.opencode/skills/system-spec-kit/references/workflows/auto_mode_contract.md`.
+
+Under `execution_mode = AUTONOMOUS` (from the `:auto` suffix), follow the three-tier flow:
+
+1. **Tier 1 — Resolve confidently** (contract §1): parse `$ARGUMENTS` flags + `PRE-BOUND SETUP ANSWERS:` block (§2) + the Default Resolution Table below (§3). When every required field is resolved, persist to `{spec_folder}/improvement/agent-improvement-config.json` (shape: `targetPath`, `targetProfile`, `specFolder`, `executionMode: "auto"`, `scoringMode`, `maxIterations`, `agentName`), bind runtime YAML placeholders, set `STATUS: PASSED`, load `.opencode/commands/improve/assets/improve_deep-agent-improvement_auto.yaml`. End §0.
+
+2. **Tier 2 — Targeted ask** (contract §1): when 1-2 required fields are genuinely ambiguous AND no default exists, emit ONE narrow question per ambiguous field. Command-specific Tier-2-eligible fields (per the Default Resolution Table below): `spec_folder`. **Ordering rule**: none needed; `target_path` absence is missing input, not ambiguity, and goes to Tier 3.
+
+3. **Tier 3 — Fail fast** (contract §4): emit the named-missing-inputs error format with `/improve:agent:auto` as the command name. Exit non-zero. Do not load YAML.
+
+`:confirm` path stays unchanged — see the consolidated setup prompt section below.
+
+### PRE-BOUND SETUP ANSWERS Schema (for `:auto` non-interactive dispatch)
+
+The dispatched prompt body may contain one structured marker block. Parse it before applying defaults. Grammar: see `auto_mode_contract.md` §2.
+
+```yaml
+PRE-BOUND SETUP ANSWERS:
+  target_path: .opencode/agents/debug.md  # required path matching .opencode/agents/*.md
+  target_profile: dynamic  # optional; one of: handover | context-prime | dynamic; derived from target_path when omitted
+  spec_folder: specs/041/008  # required spec folder path or explicit runtime folder
+  execution_mode: AUTONOMOUS  # from :auto suffix
+  scoring_mode: dynamic  # dynamic is the current supported scoring mode
+  max_iterations: 5  # positive integer
+```
+
+Rules: see `auto_mode_contract.md` §2 (unspecified fields fall back to default; marker fields take precedence over $ARGUMENTS flags; unknown fields warn; malformed lines parse-error).
+
+### Default Resolution Table
+
+| Field | Required | Resolves Via | Default | Tier-2 Candidate |
+|-------|----------|--------------|---------|------------------|
+| `target_path` | Y | `$ARGUMENTS` agent path, or marker `target_path` | none | N |
+| `target_profile` | Y | marker `target_profile`, or auto-detect from `target_path` (`handover` -> `handover`, `context-prime` -> `context-prime`, otherwise `dynamic`) | inferred from `target_path` | N |
+| `spec_folder` | Y | flag `--spec-folder`, marker `spec_folder`, or requires-ask | none | Y |
+| `execution_mode` | Y | attached suffix `:auto` or marker `execution_mode` | `AUTONOMOUS` under `:auto` | N |
+| `scoring_mode` | Y | marker `scoring_mode`, Q3 equivalent, or default | `dynamic` | N |
+| `max_iterations` | Y | flag `--iterations`, marker `max_iterations`, or default | `5` | N |
+
 **STATUS: ☐ BLOCKED**
 
 **🚨 SINGLE CONSOLIDATED PROMPT - ONE USER INTERACTION**

apply patch
patch: completed
/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/specs/skilled-agent-orchestration/103-spec-kit-auto-mode-noninteractive-contract/002-auto-mode-contract-generalization-to-all-commands/tasks.md
diff --git a/.opencode/commands/improve/agent.md b/.opencode/commands/improve/agent.md
index f97b991ba5c0accdfc04eafd99e17db1351d8a8a..899b05445f45f65f64dc11de23380fbe4648266d
--- a/.opencode/commands/improve/agent.md
+++ b/.opencode/commands/improve/agent.md
@@ -1,6 +1,6 @@
 ---
 description: "Evaluate and improve any agent: 5 dimensions, proposals, scoring, guarded promotion. :auto/:confirm."
-argument-hint: "<agent_path> [:auto|:confirm] [--spec-folder=PATH] [--iterations=N]"
+argument-hint: "<agent_path> [:auto|:confirm] [--spec-folder=PATH] [--iterations=N] (:auto supports PRE-BOUND SETUP ANSWERS: prompt-body block for non-interactive setup)"
 allowed-tools: Read, Write, Edit, Bash, Grep, Glob, Task
 ---
 
@@ -60,6 +60,51 @@
 
 # 🔒 UNIFIED SETUP PHASE
 
+**FIRST MESSAGE PROTOCOL**: For `:confirm` or no suffix, the consolidated setup prompt MUST be your FIRST response. No implementation or file-modifying tool calls before asking. Lightweight read-only discovery to suggest a spec folder or load prior context is allowed, then ask ALL questions immediately and wait.
+
+For `:auto`, do not emit the consolidated prompt by default. Resolve setup with the three-tier branch below, then load the auto YAML only after all required values are bound.
+
+### `:auto` Setup Resolution
+
+Setup contract: see `.opencode/skills/system-spec-kit/references/workflows/auto_mode_contract.md`.
+
+Under `execution_mode = AUTONOMOUS` (from the `:auto` suffix), follow the three-tier flow:
+
+1. **Tier 1 — Resolve confidently** (contract §1): parse `$ARGUMENTS` flags + `PRE-BOUND SETUP ANSWERS:` block (§2) + the Default Resolution Table below (§3). When every required field is resolved, persist to `{spec_folder}/improvement/agent-improvement-config.json` (shape: `targetPath`, `targetProfile`, `specFolder`, `executionMode: "auto"`, `scoringMode`, `maxIterations`, `agentName`), bind runtime YAML placeholders, set `STATUS: PASSED`, load `.opencode/commands/improve/assets/improve_deep-agent-improvement_auto.yaml`. End §0.
+
+2. **Tier 2 — Targeted ask** (contract §1): when 1-2 required fields are genuinely ambiguous AND no default exists, emit ONE narrow question per ambiguous field. Command-specific Tier-2-eligible fields (per the Default Resolution Table below): `spec_folder`. **Ordering rule**: none needed; `target_path` absence is missing input, not ambiguity, and goes to Tier 3.
+
+3. **Tier 3 — Fail fast** (contract §4): emit the named-missing-inputs error format with `/improve:agent:auto` as the command name. Exit non-zero. Do not load YAML.
+
+`:confirm` path stays unchanged — see the consolidated setup prompt section below.
+
+### PRE-BOUND SETUP ANSWERS Schema (for `:auto` non-interactive dispatch)
+
+The dispatched prompt body may contain one structured marker block. Parse it before applying defaults. Grammar: see `auto_mode_contract.md` §2.
+
+```yaml
+PRE-BOUND SETUP ANSWERS:
+  target_path: .opencode/agents/debug.md  # required path matching .opencode/agents/*.md
+  target_profile: dynamic  # optional; one of: handover | context-prime | dynamic; derived from target_path when omitted
+  spec_folder: specs/041/008  # required spec folder path or explicit runtime folder
+  execution_mode: AUTONOMOUS  # from :auto suffix
+  scoring_mode: dynamic  # dynamic is the current supported scoring mode
+  max_iterations: 5  # positive integer
+```
+
+Rules: see `auto_mode_contract.md` §2 (unspecified fields fall back to default; marker fields take precedence over $ARGUMENTS flags; unknown fields warn; malformed lines parse-error).
+
+### Default Resolution Table
+
+| Field | Required | Resolves Via | Default | Tier-2 Candidate |
+|-------|----------|--------------|---------|------------------|
+| `target_path` | Y | `$ARGUMENTS` agent path, or marker `target_path` | none | N |
+| `target_profile` | Y | marker `target_profile`, or auto-detect from `target_path` (`handover` -> `handover`, `context-prime` -> `context-prime`, otherwise `dynamic`) | inferred from `target_path` | N |
+| `spec_folder` | Y | flag `--spec-folder`, marker `spec_folder`, or requires-ask | none | Y |
+| `execution_mode` | Y | attached suffix `:auto` or marker `execution_mode` | `AUTONOMOUS` under `:auto` | N |
+| `scoring_mode` | Y | marker `scoring_mode`, Q3 equivalent, or default | `dynamic` | N |
+| `max_iterations` | Y | flag `--iterations`, marker `max_iterations`, or default | `5` | N |
+
 **STATUS: ☐ BLOCKED**
 
 **🚨 SINGLE CONSOLIDATED PROMPT - ONE USER INTERACTION**
diff --git a/.opencode/specs/skilled-agent-orchestration/103-spec-kit-auto-mode-noninteractive-contract/002-auto-mode-contract-generalization-to-all-commands/tasks.md b/.opencode/specs/skilled-agent-orchestration/103-spec-kit-auto-mode-noninteractive-contract/002-auto-mode-contract-generalization-to-all-commands/tasks.md
index 5f7df6766aed7eb41b4e40081ff7c885a3683451..7ecf545cf0732b4ad7cc64de45cdf0113e23c61f
--- a/.opencode/specs/skilled-agent-orchestration/103-spec-kit-auto-mode-noninteractive-contract/002-auto-mode-contract-generalization-to-all-commands/tasks.md
+++ b/.opencode/specs/skilled-agent-orchestration/103-spec-kit-auto-mode-noninteractive-contract/002-auto-mode-contract-generalization-to-all-commands/tasks.md
@@ -10,8 +10,8 @@
     packet_pointer: ".opencode/specs/skilled-agent-orchestration/103-spec-kit-auto-mode-noninteractive-contract/002-auto-mode-contract-generalization-to-all-commands"
     last_updated_at: "2026-05-11T12:35:00Z"
     last_updated_by: "claude-opus-4-7"
-    recent_action: "Group 2 create commands migrated"
-    next_safe_action: "Dispatch group 3 improve command"
+    recent_action: "Group 3 improve command migrated"
+    next_safe_action: "Run live verification dispatches (Stage D)"
     blockers: []
     key_files: []
     session_dedup:
@@ -59,7 +59,7 @@
 
 - [x] T010 Codex group dispatch 1 (spec_kit/5): deep-research, complete, implement, plan, resume. Evidence: Group 1 codex dispatch completed; 5 commands migrated; see evidence/codex-group1-dispatch.txt
 - [x] T011 Codex group dispatch 2 (create/6): sk-skill, agent, changelog, feature-catalog, testing-playbook, folder_readme. Evidence: Group 2 codex dispatch completed; 5 commands migrated; see evidence/codex-group2-dispatch.txt
-- [ ] T012 Codex group dispatch 3 (improve/1): agent.
+- [x] T012 Codex group dispatch 3 (improve/1): agent. Evidence: Group 3 codex dispatch completed; 1 command migrated; see evidence/codex-group3-dispatch.txt
 - [ ] T013 Per-command read-back: confirm `:confirm` block untouched in all 11 migrated commands.
 <!-- /ANCHOR:phase-2 -->
 

diff --git a/.opencode/commands/improve/agent.md b/.opencode/commands/improve/agent.md
index f97b991ba5c0accdfc04eafd99e17db1351d8a8a..899b05445f45f65f64dc11de23380fbe4648266d
--- a/.opencode/commands/improve/agent.md
+++ b/.opencode/commands/improve/agent.md
@@ -1,6 +1,6 @@
 ---
 description: "Evaluate and improve any agent: 5 dimensions, proposals, scoring, guarded promotion. :auto/:confirm."
-argument-hint: "<agent_path> [:auto|:confirm] [--spec-folder=PATH] [--iterations=N]"
+argument-hint: "<agent_path> [:auto|:confirm] [--spec-folder=PATH] [--iterations=N] (:auto supports PRE-BOUND SETUP ANSWERS: prompt-body block for non-interactive setup)"
 allowed-tools: Read, Write, Edit, Bash, Grep, Glob, Task
 ---
 
@@ -60,6 +60,51 @@
 
 # 🔒 UNIFIED SETUP PHASE
 
+**FIRST MESSAGE PROTOCOL**: For `:confirm` or no suffix, the consolidated setup prompt MUST be your FIRST response. No implementation or file-modifying tool calls before asking. Lightweight read-only discovery to suggest a spec folder or load prior context is allowed, then ask ALL questions immediately and wait.
+
+For `:auto`, do not emit the consolidated prompt by default. Resolve setup with the three-tier branch below, then load the auto YAML only after all required values are bound.
+
+### `:auto` Setup Resolution
+
+Setup contract: see `.opencode/skills/system-spec-kit/references/workflows/auto_mode_contract.md`.
+
+Under `execution_mode = AUTONOMOUS` (from the `:auto` suffix), follow the three-tier flow:
+
+1. **Tier 1 — Resolve confidently** (contract §1): parse `$ARGUMENTS` flags + `PRE-BOUND SETUP ANSWERS:` block (§2) + the Default Resolution Table below (§3). When every required field is resolved, persist to `{spec_folder}/improvement/agent-improvement-config.json` (shape: `targetPath`, `targetProfile`, `specFolder`, `executionMode: "auto"`, `scoringMode`, `maxIterations`, `agentName`), bind runtime YAML placeholders, set `STATUS: PASSED`, load `.opencode/commands/improve/assets/improve_deep-agent-improvement_auto.yaml`. End §0.
+
+2. **Tier 2 — Targeted ask** (contract §1): when 1-2 required fields are genuinely ambiguous AND no default exists, emit ONE narrow question per ambiguous field. Command-specific Tier-2-eligible fields (per the Default Resolution Table below): `spec_folder`. **Ordering rule**: none needed; `target_path` absence is missing input, not ambiguity, and goes to Tier 3.
+
+3. **Tier 3 — Fail fast** (contract §4): emit the named-missing-inputs error format with `/improve:agent:auto` as the command name. Exit non-zero. Do not load YAML.
+
+`:confirm` path stays unchanged — see the consolidated setup prompt section below.
+
+### PRE-BOUND SETUP ANSWERS Schema (for `:auto` non-interactive dispatch)
+
+The dispatched prompt body may contain one structured marker block. Parse it before applying defaults. Grammar: see `auto_mode_contract.md` §2.
+
+```yaml
+PRE-BOUND SETUP ANSWERS:
+  target_path: .opencode/agents/debug.md  # required path matching .opencode/agents/*.md
+  target_profile: dynamic  # optional; one of: handover | context-prime | dynamic; derived from target_path when omitted
+  spec_folder: specs/041/008  # required spec folder path or explicit runtime folder
+  execution_mode: AUTONOMOUS  # from :auto suffix
+  scoring_mode: dynamic  # dynamic is the current supported scoring mode
+  max_iterations: 5  # positive integer
+```
+
+Rules: see `auto_mode_contract.md` §2 (unspecified fields fall back to default; marker fields take precedence over $ARGUMENTS flags; unknown fields warn; malformed lines parse-error).
+
+### Default Resolution Table
+
+| Field | Required | Resolves Via | Default | Tier-2 Candidate |
+|-------|----------|--------------|---------|------------------|
+| `target_path` | Y | `$ARGUMENTS` agent path, or marker `target_path` | none | N |
+| `target_profile` | Y | marker `target_profile`, or auto-detect from `target_path` (`handover` -> `handover`, `context-prime` -> `context-prime`, otherwise `dynamic`) | inferred from `target_path` | N |
+| `spec_folder` | Y | flag `--spec-folder`, marker `spec_folder`, or requires-ask | none | Y |
+| `execution_mode` | Y | attached suffix `:auto` or marker `execution_mode` | `AUTONOMOUS` under `:auto` | N |
+| `scoring_mode` | Y | marker `scoring_mode`, Q3 equivalent, or default | `dynamic` | N |
+| `max_iterations` | Y | flag `--iterations`, marker `max_iterations`, or default | `5` | N |
+
 **STATUS: ☐ BLOCKED**
 
 **🚨 SINGLE CONSOLIDATED PROMPT - ONE USER INTERACTION**
diff --git a/.opencode/specs/skilled-agent-orchestration/103-spec-kit-auto-mode-noninteractive-contract/002-auto-mode-contract-generalization-to-all-commands/tasks.md b/.opencode/specs/skilled-agent-orchestration/103-spec-kit-auto-mode-noninteractive-contract/002-auto-mode-contract-generalization-to-all-commands/tasks.md
index 5f7df6766aed7eb41b4e40081ff7c885a3683451..7ecf545cf0732b4ad7cc64de45cdf0113e23c61f
--- a/.opencode/specs/skilled-agent-orchestration/103-spec-kit-auto-mode-noninteractive-contract/002-auto-mode-contract-generalization-to-all-commands/tasks.md
+++ b/.opencode/specs/skilled-agent-orchestration/103-spec-kit-auto-mode-noninteractive-contract/002-auto-mode-contract-generalization-to-all-commands/tasks.md
@@ -10,8 +10,8 @@
     packet_pointer: ".opencode/specs/skilled-agent-orchestration/103-spec-kit-auto-mode-noninteractive-contract/002-auto-mode-contract-generalization-to-all-commands"
     last_updated_at: "2026-05-11T12:35:00Z"
     last_updated_by: "claude-opus-4-7"
-    recent_action: "Group 2 create commands migrated"
-    next_safe_action: "Dispatch group 3 improve command"
+    recent_action: "Group 3 improve command migrated"
+    next_safe_action: "Run live verification dispatches (Stage D)"
     blockers: []
     key_files: []
     session_dedup:
@@ -59,7 +59,7 @@
 
 - [x] T010 Codex group dispatch 1 (spec_kit/5): deep-research, complete, implement, plan, resume. Evidence: Group 1 codex dispatch completed; 5 commands migrated; see evidence/codex-group1-dispatch.txt
 - [x] T011 Codex group dispatch 2 (create/6): sk-skill, agent, changelog, feature-catalog, testing-playbook, folder_readme. Evidence: Group 2 codex dispatch completed; 5 commands migrated; see evidence/codex-group2-dispatch.txt
-- [ ] T012 Codex group dispatch 3 (improve/1): agent.
+- [x] T012 Codex group dispatch 3 (improve/1): agent. Evidence: Group 3 codex dispatch completed; 1 command migrated; see evidence/codex-group3-dispatch.txt
 - [ ] T013 Per-command read-back: confirm `:confirm` block untouched in all 11 migrated commands.
 <!-- /ANCHOR:phase-2 -->
 

apply patch
patch: completed
/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/specs/skilled-agent-orchestration/103-spec-kit-auto-mode-noninteractive-contract/002-auto-mode-contract-generalization-to-all-commands/evidence/codex-group3-dispatch.txt
diff --git a/.opencode/commands/improve/agent.md b/.opencode/commands/improve/agent.md
index f97b991ba5c0accdfc04eafd99e17db1351d8a8a..899b05445f45f65f64dc11de23380fbe4648266d
--- a/.opencode/commands/improve/agent.md
+++ b/.opencode/commands/improve/agent.md
@@ -1,6 +1,6 @@
 ---
 description: "Evaluate and improve any agent: 5 dimensions, proposals, scoring, guarded promotion. :auto/:confirm."
-argument-hint: "<agent_path> [:auto|:confirm] [--spec-folder=PATH] [--iterations=N]"
+argument-hint: "<agent_path> [:auto|:confirm] [--spec-folder=PATH] [--iterations=N] (:auto supports PRE-BOUND SETUP ANSWERS: prompt-body block for non-interactive setup)"
 allowed-tools: Read, Write, Edit, Bash, Grep, Glob, Task
 ---
 
@@ -60,6 +60,51 @@
 
 # 🔒 UNIFIED SETUP PHASE
 
+**FIRST MESSAGE PROTOCOL**: For `:confirm` or no suffix, the consolidated setup prompt MUST be your FIRST response. No implementation or file-modifying tool calls before asking. Lightweight read-only discovery to suggest a spec folder or load prior context is allowed, then ask ALL questions immediately and wait.
+
+For `:auto`, do not emit the consolidated prompt by default. Resolve setup with the three-tier branch below, then load the auto YAML only after all required values are bound.
+
+### `:auto` Setup Resolution
+
+Setup contract: see `.opencode/skills/system-spec-kit/references/workflows/auto_mode_contract.md`.
+
+Under `execution_mode = AUTONOMOUS` (from the `:auto` suffix), follow the three-tier flow:
+
+1. **Tier 1 — Resolve confidently** (contract §1): parse `$ARGUMENTS` flags + `PRE-BOUND SETUP ANSWERS:` block (§2) + the Default Resolution Table below (§3). When every required field is resolved, persist to `{spec_folder}/improvement/agent-improvement-config.json` (shape: `targetPath`, `targetProfile`, `specFolder`, `executionMode: "auto"`, `scoringMode`, `maxIterations`, `agentName`), bind runtime YAML placeholders, set `STATUS: PASSED`, load `.opencode/commands/improve/assets/improve_deep-agent-improvement_auto.yaml`. End §0.
+
+2. **Tier 2 — Targeted ask** (contract §1): when 1-2 required fields are genuinely ambiguous AND no default exists, emit ONE narrow question per ambiguous field. Command-specific Tier-2-eligible fields (per the Default Resolution Table below): `spec_folder`. **Ordering rule**: none needed; `target_path` absence is missing input, not ambiguity, and goes to Tier 3.
+
+3. **Tier 3 — Fail fast** (contract §4): emit the named-missing-inputs error format with `/improve:agent:auto` as the command name. Exit non-zero. Do not load YAML.
+
+`:confirm` path stays unchanged — see the consolidated setup prompt section below.
+
+### PRE-BOUND SETUP ANSWERS Schema (for `:auto` non-interactive dispatch)
+
+The dispatched prompt body may contain one structured marker block. Parse it before applying defaults. Grammar: see `auto_mode_contract.md` §2.
+
+```yaml
+PRE-BOUND SETUP ANSWERS:
+  target_path: .opencode/agents/debug.md  # required path matching .opencode/agents/*.md
+  target_profile: dynamic  # optional; one of: handover | context-prime | dynamic; derived from target_path when omitted
+  spec_folder: specs/041/008  # required spec folder path or explicit runtime folder
+  execution_mode: AUTONOMOUS  # from :auto suffix
+  scoring_mode: dynamic  # dynamic is the current supported scoring mode
+  max_iterations: 5  # positive integer
+```
+
+Rules: see `auto_mode_contract.md` §2 (unspecified fields fall back to default; marker fields take precedence over $ARGUMENTS flags; unknown fields warn; malformed lines parse-error).
+
+### Default Resolution Table
+
+| Field | Required | Resolves Via | Default | Tier-2 Candidate |
+|-------|----------|--------------|---------|------------------|
+| `target_path` | Y | `$ARGUMENTS` agent path, or marker `target_path` | none | N |
+| `target_profile` | Y | marker `target_profile`, or auto-detect from `target_path` (`handover` -> `handover`, `context-prime` -> `context-prime`, otherwise `dynamic`) | inferred from `target_path` | N |
+| `spec_folder` | Y | flag `--spec-folder`, marker `spec_folder`, or requires-ask | none | Y |
+| `execution_mode` | Y | attached suffix `:auto` or marker `execution_mode` | `AUTONOMOUS` under `:auto` | N |
+| `scoring_mode` | Y | marker `scoring_mode`, Q3 equivalent, or default | `dynamic` | N |
+| `max_iterations` | Y | flag `--iterations`, marker `max_iterations`, or default | `5` | N |
+
 **STATUS: ☐ BLOCKED**
 
 **🚨 SINGLE CONSOLIDATED PROMPT - ONE USER INTERACTION**
diff --git a/.opencode/specs/skilled-agent-orchestration/103-spec-kit-auto-mode-noninteractive-contract/002-auto-mode-contract-generalization-to-all-commands/evidence/codex-group3-dispatch.txt b/.opencode/specs/skilled-agent-orchestration/103-spec-kit-auto-mode-noninteractive-contract/002-auto-mode-contract-generalization-to-all-commands/evidence/codex-group3-dispatch.txt
new file mode 100644
index 0000000000000000000000000000000000000000..1113588ced2ad7d9f657d78aac13ca99d3a2f192
--- /dev/null
+++ b/.opencode/specs/skilled-agent-orchestration/103-spec-kit-auto-mode-noninteractive-contract/002-auto-mode-contract-generalization-to-all-commands/evidence/codex-group3-dispatch.txt
@@ -0,0 +1,14 @@
+# Group 3 Dispatch - /improve
+
+## /improve:agent
+
+- Command file: `.opencode/commands/improve/agent.md`
+- Fields migrated count: 6
+- Fields migrated: `target_path`, `target_profile`, `spec_folder`, `execution_mode`, `scoring_mode`, `max_iterations`
+- Tier-2 candidates identified: `spec_folder`
+- `:confirm` consolidated Q-block preserved: yes
+- Argument hint updated: yes
+- Paired YAML assets touched: no
+- Concerns: `spec_folder` is the only Tier-2 candidate because the legacy Q1 asks the operator to choose a runtime location and no default exists. `target_path` absence stays Tier 3 because the command explicitly forbids inferring the target agent from context.
+
+EXIT_STATUS: complete
diff --git a/.opencode/specs/skilled-agent-orchestration/103-spec-kit-auto-mode-noninteractive-contract/002-auto-mode-contract-generalization-to-all-commands/tasks.md b/.opencode/specs/skilled-agent-orchestration/103-spec-kit-auto-mode-noninteractive-contract/002-auto-mode-contract-generalization-to-all-commands/tasks.md
index 5f7df6766aed7eb41b4e40081ff7c885a3683451..7ecf545cf0732b4ad7cc64de45cdf0113e23c61f
--- a/.opencode/specs/skilled-agent-orchestration/103-spec-kit-auto-mode-noninteractive-contract/002-auto-mode-contract-generalization-to-all-commands/tasks.md
+++ b/.opencode/specs/skilled-agent-orchestration/103-spec-kit-auto-mode-noninteractive-contract/002-auto-mode-contract-generalization-to-all-commands/tasks.md
@@ -10,8 +10,8 @@
     packet_pointer: ".opencode/specs/skilled-agent-orchestration/103-spec-kit-auto-mode-noninteractive-contract/002-auto-mode-contract-generalization-to-all-commands"
     last_updated_at: "2026-05-11T12:35:00Z"
     last_updated_by: "claude-opus-4-7"
-    recent_action: "Group 2 create commands migrated"
-    next_safe_action: "Dispatch group 3 improve command"
+    recent_action: "Group 3 improve command migrated"
+    next_safe_action: "Run live verification dispatches (Stage D)"
     blockers: []
     key_files: []
     session_dedup:
@@ -59,7 +59,7 @@
 
 - [x] T010 Codex group dispatch 1 (spec_kit/5): deep-research, complete, implement, plan, resume. Evidence: Group 1 codex dispatch completed; 5 commands migrated; see evidence/codex-group1-dispatch.txt
 - [x] T011 Codex group dispatch 2 (create/6): sk-skill, agent, changelog, feature-catalog, testing-playbook, folder_readme. Evidence: Group 2 codex dispatch completed; 5 commands migrated; see evidence/codex-group2-dispatch.txt
-- [ ] T012 Codex group dispatch 3 (improve/1): agent.
+- [x] T012 Codex group dispatch 3 (improve/1): agent. Evidence: Group 3 codex dispatch completed; 1 command migrated; see evidence/codex-group3-dispatch.txt
 - [ ] T013 Per-command read-back: confirm `:confirm` block untouched in all 11 migrated commands.
 <!-- /ANCHOR:phase-2 -->
 

diff --git a/.opencode/commands/improve/agent.md b/.opencode/commands/improve/agent.md
index f97b991ba5c0accdfc04eafd99e17db1351d8a8a..899b05445f45f65f64dc11de23380fbe4648266d
--- a/.opencode/commands/improve/agent.md
+++ b/.opencode/commands/improve/agent.md
@@ -1,6 +1,6 @@
 ---
 description: "Evaluate and improve any agent: 5 dimensions, proposals, scoring, guarded promotion. :auto/:confirm."
-argument-hint: "<agent_path> [:auto|:confirm] [--spec-folder=PATH] [--iterations=N]"
+argument-hint: "<agent_path> [:auto|:confirm] [--spec-folder=PATH] [--iterations=N] (:auto supports PRE-BOUND SETUP ANSWERS: prompt-body block for non-interactive setup)"
 allowed-tools: Read, Write, Edit, Bash, Grep, Glob, Task
 ---
 
@@ -60,6 +60,51 @@
 
 # 🔒 UNIFIED SETUP PHASE
 
+**FIRST MESSAGE PROTOCOL**: For `:confirm` or no suffix, the consolidated setup prompt MUST be your FIRST response. No implementation or file-modifying tool calls before asking. Lightweight read-only discovery to suggest a spec folder or load prior context is allowed, then ask ALL questions immediately and wait.
+
+For `:auto`, do not emit the consolidated prompt by default. Resolve setup with the three-tier branch below, then load the auto YAML only after all required values are bound.
+
+### `:auto` Setup Resolution
+
+Setup contract: see `.opencode/skills/system-spec-kit/references/workflows/auto_mode_contract.md`.
+
+Under `execution_mode = AUTONOMOUS` (from the `:auto` suffix), follow the three-tier flow:
+
+1. **Tier 1 — Resolve confidently** (contract §1): parse `$ARGUMENTS` flags + `PRE-BOUND SETUP ANSWERS:` block (§2) + the Default Resolution Table below (§3). When every required field is resolved, persist to `{spec_folder}/improvement/agent-improvement-config.json` (shape: `targetPath`, `targetProfile`, `specFolder`, `executionMode: "auto"`, `scoringMode`, `maxIterations`, `agentName`), bind runtime YAML placeholders, set `STATUS: PASSED`, load `.opencode/commands/improve/assets/improve_deep-agent-improvement_auto.yaml`. End §0.
+
+2. **Tier 2 — Targeted ask** (contract §1): when 1-2 required fields are genuinely ambiguous AND no default exists, emit ONE narrow question per ambiguous field. Command-specific Tier-2-eligible fields (per the Default Resolution Table below): `spec_folder`. **Ordering rule**: none needed; `target_path` absence is missing input, not ambiguity, and goes to Tier 3.
+
+3. **Tier 3 — Fail fast** (contract §4): emit the named-missing-inputs error format with `/improve:agent:auto` as the command name. Exit non-zero. Do not load YAML.
+
+`:confirm` path stays unchanged — see the consolidated setup prompt section below.
+
+### PRE-BOUND SETUP ANSWERS Schema (for `:auto` non-interactive dispatch)
+
+The dispatched prompt body may contain one structured marker block. Parse it before applying defaults. Grammar: see `auto_mode_contract.md` §2.
+
+```yaml
+PRE-BOUND SETUP ANSWERS:
+  target_path: .opencode/agents/debug.md  # required path matching .opencode/agents/*.md
+  target_profile: dynamic  # optional; one of: handover | context-prime | dynamic; derived from target_path when omitted
+  spec_folder: specs/041/008  # required spec folder path or explicit runtime folder
+  execution_mode: AUTONOMOUS  # from :auto suffix
+  scoring_mode: dynamic  # dynamic is the current supported scoring mode
+  max_iterations: 5  # positive integer
+```
+
+Rules: see `auto_mode_contract.md` §2 (unspecified fields fall back to default; marker fields take precedence over $ARGUMENTS flags; unknown fields warn; malformed lines parse-error).
+
+### Default Resolution Table
+
+| Field | Required | Resolves Via | Default | Tier-2 Candidate |
+|-------|----------|--------------|---------|------------------|
+| `target_path` | Y | `$ARGUMENTS` agent path, or marker `target_path` | none | N |
+| `target_profile` | Y | marker `target_profile`, or auto-detect from `target_path` (`handover` -> `handover`, `context-prime` -> `context-prime`, otherwise `dynamic`) | inferred from `target_path` | N |
+| `spec_folder` | Y | flag `--spec-folder`, marker `spec_folder`, or requires-ask | none | Y |
+| `execution_mode` | Y | attached suffix `:auto` or marker `execution_mode` | `AUTONOMOUS` under `:auto` | N |
+| `scoring_mode` | Y | marker `scoring_mode`, Q3 equivalent, or default | `dynamic` | N |
+| `max_iterations` | Y | flag `--iterations`, marker `max_iterations`, or default | `5` | N |
+
 **STATUS: ☐ BLOCKED**
 
 **🚨 SINGLE CONSOLIDATED PROMPT - ONE USER INTERACTION**
diff --git a/.opencode/specs/skilled-agent-orchestration/103-spec-kit-auto-mode-noninteractive-contract/002-auto-mode-contract-generalization-to-all-commands/evidence/codex-group3-dispatch.txt b/.opencode/specs/skilled-agent-orchestration/103-spec-kit-auto-mode-noninteractive-contract/002-auto-mode-contract-generalization-to-all-commands/evidence/codex-group3-dispatch.txt
new file mode 100644
index 0000000000000000000000000000000000000000..1113588ced2ad7d9f657d78aac13ca99d3a2f192
--- /dev/null
+++ b/.opencode/specs/skilled-agent-orchestration/103-spec-kit-auto-mode-noninteractive-contract/002-auto-mode-contract-generalization-to-all-commands/evidence/codex-group3-dispatch.txt
@@ -0,0 +1,14 @@
+# Group 3 Dispatch - /improve
+
+## /improve:agent
+
+- Command file: `.opencode/commands/improve/agent.md`
+- Fields migrated count: 6
+- Fields migrated: `target_path`, `target_profile`, `spec_folder`, `execution_mode`, `scoring_mode`, `max_iterations`
+- Tier-2 candidates identified: `spec_folder`
+- `:confirm` consolidated Q-block preserved: yes
+- Argument hint updated: yes
+- Paired YAML assets touched: no
+- Concerns: `spec_folder` is the only Tier-2 candidate because the legacy Q1 asks the operator to choose a runtime location and no default exists. `target_path` absence stays Tier 3 because the command explicitly forbids inferring the target agent from context.
+
+EXIT_STATUS: complete
diff --git a/.opencode/specs/skilled-agent-orchestration/103-spec-kit-auto-mode-noninteractive-contract/002-auto-mode-contract-generalization-to-all-commands/tasks.md b/.opencode/specs/skilled-agent-orchestration/103-spec-kit-auto-mode-noninteractive-contract/002-auto-mode-contract-generalization-to-all-commands/tasks.md
index 5f7df6766aed7eb41b4e40081ff7c885a3683451..7ecf545cf0732b4ad7cc64de45cdf0113e23c61f
--- a/.opencode/specs/skilled-agent-orchestration/103-spec-kit-auto-mode-noninteractive-contract/002-auto-mode-contract-generalization-to-all-commands/tasks.md
+++ b/.opencode/specs/skilled-agent-orchestration/103-spec-kit-auto-mode-noninteractive-contract/002-auto-mode-contract-generalization-to-all-commands/tasks.md
@@ -10,8 +10,8 @@
     packet_pointer: ".opencode/specs/skilled-agent-orchestration/103-spec-kit-auto-mode-noninteractive-contract/002-auto-mode-contract-generalization-to-all-commands"
     last_updated_at: "2026-05-11T12:35:00Z"
     last_updated_by: "claude-opus-4-7"
-    recent_action: "Group 2 create commands migrated"
-    next_safe_action: "Dispatch group 3 improve command"
+    recent_action: "Group 3 improve command migrated"
+    next_safe_action: "Run live verification dispatches (Stage D)"
     blockers: []
     key_files: []
     session_dedup:
@@ -59,7 +59,7 @@
 
 - [x] T010 Codex group dispatch 1 (spec_kit/5): deep-research, complete, implement, plan, resume. Evidence: Group 1 codex dispatch completed; 5 commands migrated; see evidence/codex-group1-dispatch.txt
 - [x] T011 Codex group dispatch 2 (create/6): sk-skill, agent, changelog, feature-catalog, testing-playbook, folder_readme. Evidence: Group 2 codex dispatch completed; 5 commands migrated; see evidence/codex-group2-dispatch.txt
-- [ ] T012 Codex group dispatch 3 (improve/1): agent.
+- [x] T012 Codex group dispatch 3 (improve/1): agent. Evidence: Group 3 codex dispatch completed; 1 command migrated; see evidence/codex-group3-dispatch.txt
 - [ ] T013 Per-command read-back: confirm `:confirm` block untouched in all 11 migrated commands.
 <!-- /ANCHOR:phase-2 -->
 

codex
Edits are in place. I’m doing a read-back now: scoped diff, whitespace check, and a targeted look at the legacy `STATUS: BLOCKED` prompt to make sure the old confirm path wasn’t rewritten.
exec
/bin/zsh -lc "sed -n '40,160p' .opencode/commands/improve/agent.md" in /Users/michelkerkmeester/MEGA/Development/Code_Environment/Public
 succeeded in 0ms:
    ├─ ⛔ HARD BLOCK - DO NOT PROCEED
    │
    ├─ DISPLAY to user:
    │   ┌────────────────────────────────────────────────────────────┐
    │   │ ⛔ GENERAL AGENT REQUIRED                                  │
    │   │                                                            │
    │   │ This command orchestrates deep-agent-improvement skill          │
    │   │ invocation and runs general-agent based.            │
    │   │                                                            │
    │   │ To proceed, restart with:                                  │
    │   │   /improve:agent [arguments]                               │
    │   └────────────────────────────────────────────────────────────┘
    │
    └─ RETURN: STATUS=FAIL ERROR="General agent required"
```

**Phase Output:**
- `general_agent_verified = ________________`

---

# 🔒 UNIFIED SETUP PHASE

**FIRST MESSAGE PROTOCOL**: For `:confirm` or no suffix, the consolidated setup prompt MUST be your FIRST response. No implementation or file-modifying tool calls before asking. Lightweight read-only discovery to suggest a spec folder or load prior context is allowed, then ask ALL questions immediately and wait.

For `:auto`, do not emit the consolidated prompt by default. Resolve setup with the three-tier branch below, then load the auto YAML only after all required values are bound.

### `:auto` Setup Resolution

Setup contract: see `.opencode/skills/system-spec-kit/references/workflows/auto_mode_contract.md`.

Under `execution_mode = AUTONOMOUS` (from the `:auto` suffix), follow the three-tier flow:

1. **Tier 1 — Resolve confidently** (contract §1): parse `$ARGUMENTS` flags + `PRE-BOUND SETUP ANSWERS:` block (§2) + the Default Resolution Table below (§3). When every required field is resolved, persist to `{spec_folder}/improvement/agent-improvement-config.json` (shape: `targetPath`, `targetProfile`, `specFolder`, `executionMode: "auto"`, `scoringMode`, `maxIterations`, `agentName`), bind runtime YAML placeholders, set `STATUS: PASSED`, load `.opencode/commands/improve/assets/improve_deep-agent-improvement_auto.yaml`. End §0.

2. **Tier 2 — Targeted ask** (contract §1): when 1-2 required fields are genuinely ambiguous AND no default exists, emit ONE narrow question per ambiguous field. Command-specific Tier-2-eligible fields (per the Default Resolution Table below): `spec_folder`. **Ordering rule**: none needed; `target_path` absence is missing input, not ambiguity, and goes to Tier 3.

3. **Tier 3 — Fail fast** (contract §4): emit the named-missing-inputs error format with `/improve:agent:auto` as the command name. Exit non-zero. Do not load YAML.

`:confirm` path stays unchanged — see the consolidated setup prompt section below.

### PRE-BOUND SETUP ANSWERS Schema (for `:auto` non-interactive dispatch)

The dispatched prompt body may contain one structured marker block. Parse it before applying defaults. Grammar: see `auto_mode_contract.md` §2.

```yaml
PRE-BOUND SETUP ANSWERS:
  target_path: .opencode/agents/debug.md  # required path matching .opencode/agents/*.md
  target_profile: dynamic  # optional; one of: handover | context-prime | dynamic; derived from target_path when omitted
  spec_folder: specs/041/008  # required spec folder path or explicit runtime folder
  execution_mode: AUTONOMOUS  # from :auto suffix
  scoring_mode: dynamic  # dynamic is the current supported scoring mode
  max_iterations: 5  # positive integer
```

Rules: see `auto_mode_contract.md` §2 (unspecified fields fall back to default; marker fields take precedence over $ARGUMENTS flags; unknown fields warn; malformed lines parse-error).

### Default Resolution Table

| Field | Required | Resolves Via | Default | Tier-2 Candidate |
|-------|----------|--------------|---------|------------------|
| `target_path` | Y | `$ARGUMENTS` agent path, or marker `target_path` | none | N |
| `target_profile` | Y | marker `target_profile`, or auto-detect from `target_path` (`handover` -> `handover`, `context-prime` -> `context-prime`, otherwise `dynamic`) | inferred from `target_path` | N |
| `spec_folder` | Y | flag `--spec-folder`, marker `spec_folder`, or requires-ask | none | Y |
| `execution_mode` | Y | attached suffix `:auto` or marker `execution_mode` | `AUTONOMOUS` under `:auto` | N |
| `scoring_mode` | Y | marker `scoring_mode`, Q3 equivalent, or default | `dynamic` | N |
| `max_iterations` | Y | flag `--iterations`, marker `max_iterations`, or default | `5` | N |

**STATUS: ☐ BLOCKED**

**🚨 SINGLE CONSOLIDATED PROMPT - ONE USER INTERACTION**

This workflow uses a SINGLE consolidated prompt to gather ALL required inputs in ONE user interaction.

**Round-trip optimization:** This workflow requires only 1 user interaction for setup.

```
EXECUTE THIS SINGLE CONSOLIDATED PROMPT:

1. CHECK for mode suffix in $ARGUMENTS or command invocation:
   ├─ ":auto" suffix detected → execution_mode = "AUTONOMOUS" (pre-set, omit Q2)
   ├─ ":confirm" suffix detected → execution_mode = "INTERACTIVE" (pre-set, omit Q2)
   └─ No suffix → execution_mode = "ASK" (include Q2 in prompt)

2. CHECK if $ARGUMENTS contains an agent path:
   ├─ IF present (.opencode/agents/*.md) → target_path = detected value, omit Q0
   └─ IF missing → include Q0 in prompt

3. CHECK for --spec-folder flag:
   ├─ IF present → spec_folder = value, omit Q1
   └─ IF missing → include Q1 in prompt

4. CHECK for --iterations flag:
   ├─ IF present → max_iterations = value
   └─ IF missing → max_iterations = 5 (default)

5. List available agents for Q0:
   $ ls .opencode/agents/*.md

6. List recent spec folders for Q1:
   $ ls -d specs/*/ 2>/dev/null | tail -10

7. ASK user with SINGLE consolidated prompt (include only applicable questions):

   ┌────────────────────────────────────────────────────────────────┐
   │ **Before proceeding, please answer:**                          │
   │                                                                │
   │ **Q0. Target Agent** (if not provided in command):             │
   │    Which agent would you like to evaluate and improve?         │
   │    [list agents found above]                                   │
   │                                                                │
   │ **Q1. Spec Folder** (if no --spec-folder flag):                 │
   │    A) Use existing spec folder: [list if found]                │
   │    B) Create new spec folder                                   │
   │    C) Use temporary directory                                  │
   │                                                                │
   │ **Q2. Execution Mode** (if no :auto/:confirm suffix):            │
   │    A) Autonomous — run loop without approval gates             │
   │    B) Interactive — confirm at each iteration                   │
   │                                                                │
   │ **Q3. Scoring Mode**:                                          │

exec
/bin/zsh -lc 'git diff -- .opencode/commands/improve/agent.md .opencode/specs/skilled-agent-orchestration/103-spec-kit-auto-mode-noninteractive-contract/002-auto-mode-contract-generalization-to-all-commands/tasks.md .opencode/specs/skilled-agent-orchestration/103-spec-kit-auto-mode-noninteractive-contract/002-auto-mode-contract-generalization-to-all-commands/evidence/codex-group3-dispatch.txt' in /Users/michelkerkmeester/MEGA/Development/Code_Environment/Public
 succeeded in 0ms:
diff --git a/.opencode/commands/improve/agent.md b/.opencode/commands/improve/agent.md
index f97b991ba5..899b05445f 100644
--- a/.opencode/commands/improve/agent.md
+++ b/.opencode/commands/improve/agent.md
@@ -1,6 +1,6 @@
 ---
 description: "Evaluate and improve any agent: 5 dimensions, proposals, scoring, guarded promotion. :auto/:confirm."
-argument-hint: "<agent_path> [:auto|:confirm] [--spec-folder=PATH] [--iterations=N]"
+argument-hint: "<agent_path> [:auto|:confirm] [--spec-folder=PATH] [--iterations=N] (:auto supports PRE-BOUND SETUP ANSWERS: prompt-body block for non-interactive setup)"
 allowed-tools: Read, Write, Edit, Bash, Grep, Glob, Task
 ---
 
@@ -60,6 +60,51 @@ SELF-CHECK: Are you operating as the @general agent?
 
 # 🔒 UNIFIED SETUP PHASE
 
+**FIRST MESSAGE PROTOCOL**: For `:confirm` or no suffix, the consolidated setup prompt MUST be your FIRST response. No implementation or file-modifying tool calls before asking. Lightweight read-only discovery to suggest a spec folder or load prior context is allowed, then ask ALL questions immediately and wait.
+
+For `:auto`, do not emit the consolidated prompt by default. Resolve setup with the three-tier branch below, then load the auto YAML only after all required values are bound.
+
+### `:auto` Setup Resolution
+
+Setup contract: see `.opencode/skills/system-spec-kit/references/workflows/auto_mode_contract.md`.
+
+Under `execution_mode = AUTONOMOUS` (from the `:auto` suffix), follow the three-tier flow:
+
+1. **Tier 1 — Resolve confidently** (contract §1): parse `$ARGUMENTS` flags + `PRE-BOUND SETUP ANSWERS:` block (§2) + the Default Resolution Table below (§3). When every required field is resolved, persist to `{spec_folder}/improvement/agent-improvement-config.json` (shape: `targetPath`, `targetProfile`, `specFolder`, `executionMode: "auto"`, `scoringMode`, `maxIterations`, `agentName`), bind runtime YAML placeholders, set `STATUS: PASSED`, load `.opencode/commands/improve/assets/improve_deep-agent-improvement_auto.yaml`. End §0.
+
+2. **Tier 2 — Targeted ask** (contract §1): when 1-2 required fields are genuinely ambiguous AND no default exists, emit ONE narrow question per ambiguous field. Command-specific Tier-2-eligible fields (per the Default Resolution Table below): `spec_folder`. **Ordering rule**: none needed; `target_path` absence is missing input, not ambiguity, and goes to Tier 3.
+
+3. **Tier 3 — Fail fast** (contract §4): emit the named-missing-inputs error format with `/improve:agent:auto` as the command name. Exit non-zero. Do not load YAML.
+
+`:confirm` path stays unchanged — see the consolidated setup prompt section below.
+
+### PRE-BOUND SETUP ANSWERS Schema (for `:auto` non-interactive dispatch)
+
+The dispatched prompt body may contain one structured marker block. Parse it before applying defaults. Grammar: see `auto_mode_contract.md` §2.
+
+```yaml
+PRE-BOUND SETUP ANSWERS:
+  target_path: .opencode/agents/debug.md  # required path matching .opencode/agents/*.md
+  target_profile: dynamic  # optional; one of: handover | context-prime | dynamic; derived from target_path when omitted
+  spec_folder: specs/041/008  # required spec folder path or explicit runtime folder
+  execution_mode: AUTONOMOUS  # from :auto suffix
+  scoring_mode: dynamic  # dynamic is the current supported scoring mode
+  max_iterations: 5  # positive integer
+```
+
+Rules: see `auto_mode_contract.md` §2 (unspecified fields fall back to default; marker fields take precedence over $ARGUMENTS flags; unknown fields warn; malformed lines parse-error).
+
+### Default Resolution Table
+
+| Field | Required | Resolves Via | Default | Tier-2 Candidate |
+|-------|----------|--------------|---------|------------------|
+| `target_path` | Y | `$ARGUMENTS` agent path, or marker `target_path` | none | N |
+| `target_profile` | Y | marker `target_profile`, or auto-detect from `target_path` (`handover` -> `handover`, `context-prime` -> `context-prime`, otherwise `dynamic`) | inferred from `target_path` | N |
+| `spec_folder` | Y | flag `--spec-folder`, marker `spec_folder`, or requires-ask | none | Y |
+| `execution_mode` | Y | attached suffix `:auto` or marker `execution_mode` | `AUTONOMOUS` under `:auto` | N |
+| `scoring_mode` | Y | marker `scoring_mode`, Q3 equivalent, or default | `dynamic` | N |
+| `max_iterations` | Y | flag `--iterations`, marker `max_iterations`, or default | `5` | N |
+
 **STATUS: ☐ BLOCKED**
 
 **🚨 SINGLE CONSOLIDATED PROMPT - ONE USER INTERACTION**
diff --git a/.opencode/specs/skilled-agent-orchestration/103-spec-kit-auto-mode-noninteractive-contract/002-auto-mode-contract-generalization-to-all-commands/tasks.md b/.opencode/specs/skilled-agent-orchestration/103-spec-kit-auto-mode-noninteractive-contract/002-auto-mode-contract-generalization-to-all-commands/tasks.md
index b3c4d71f11..7ecf545cf0 100644
--- a/.opencode/specs/skilled-agent-orchestration/103-spec-kit-auto-mode-noninteractive-contract/002-auto-mode-contract-generalization-to-all-commands/tasks.md
+++ b/.opencode/specs/skilled-agent-orchestration/103-spec-kit-auto-mode-noninteractive-contract/002-auto-mode-contract-generalization-to-all-commands/tasks.md
@@ -10,8 +10,8 @@ _memory:
     packet_pointer: ".opencode/specs/skilled-agent-orchestration/103-spec-kit-auto-mode-noninteractive-contract/002-auto-mode-contract-generalization-to-all-commands"
     last_updated_at: "2026-05-11T12:35:00Z"
     last_updated_by: "claude-opus-4-7"
-    recent_action: "Authored task list"
-    next_safe_action: "Dispatch codex group 1"
+    recent_action: "Group 3 improve command migrated"
+    next_safe_action: "Run live verification dispatches (Stage D)"
     blockers: []
     key_files: []
     session_dedup:
@@ -57,9 +57,9 @@ _memory:
 <!-- ANCHOR:phase-2 -->
 ## Phase 2: Implementation
 
-- [ ] T010 Codex group dispatch 1 (spec_kit/5): deep-research, complete, implement, plan, resume.
-- [ ] T011 Codex group dispatch 2 (create/6): sk-skill, agent, changelog, feature-catalog, testing-playbook, folder_readme.
-- [ ] T012 Codex group dispatch 3 (improve/1): agent.
+- [x] T010 Codex group dispatch 1 (spec_kit/5): deep-research, complete, implement, plan, resume. Evidence: Group 1 codex dispatch completed; 5 commands migrated; see evidence/codex-group1-dispatch.txt
+- [x] T011 Codex group dispatch 2 (create/6): sk-skill, agent, changelog, feature-catalog, testing-playbook, folder_readme. Evidence: Group 2 codex dispatch completed; 5 commands migrated; see evidence/codex-group2-dispatch.txt
+- [x] T012 Codex group dispatch 3 (improve/1): agent. Evidence: Group 3 codex dispatch completed; 1 command migrated; see evidence/codex-group3-dispatch.txt
 - [ ] T013 Per-command read-back: confirm `:confirm` block untouched in all 11 migrated commands.
 <!-- /ANCHOR:phase-2 -->
 

exec
/bin/zsh -lc 'git diff --check -- .opencode/commands/improve/agent.md .opencode/specs/skilled-agent-orchestration/103-spec-kit-auto-mode-noninteractive-contract/002-auto-mode-contract-generalization-to-all-commands/tasks.md .opencode/specs/skilled-agent-orchestration/103-spec-kit-auto-mode-noninteractive-contract/002-auto-mode-contract-generalization-to-all-commands/evidence/codex-group3-dispatch.txt' in /Users/michelkerkmeester/MEGA/Development/Code_Environment/Public
 succeeded in 0ms:
diff --git a/.opencode/commands/improve/agent.md b/.opencode/commands/improve/agent.md
index f97b991ba5c0accdfc04eafd99e17db1351d8a8a..899b05445f45f65f64dc11de23380fbe4648266d
--- a/.opencode/commands/improve/agent.md
+++ b/.opencode/commands/improve/agent.md
@@ -1,6 +1,6 @@
 ---
 description: "Evaluate and improve any agent: 5 dimensions, proposals, scoring, guarded promotion. :auto/:confirm."
-argument-hint: "<agent_path> [:auto|:confirm] [--spec-folder=PATH] [--iterations=N]"
+argument-hint: "<agent_path> [:auto|:confirm] [--spec-folder=PATH] [--iterations=N] (:auto supports PRE-BOUND SETUP ANSWERS: prompt-body block for non-interactive setup)"
 allowed-tools: Read, Write, Edit, Bash, Grep, Glob, Task
 ---
 
@@ -60,6 +60,51 @@
 
 # 🔒 UNIFIED SETUP PHASE
 
+**FIRST MESSAGE PROTOCOL**: For `:confirm` or no suffix, the consolidated setup prompt MUST be your FIRST response. No implementation or file-modifying tool calls before asking. Lightweight read-only discovery to suggest a spec folder or load prior context is allowed, then ask ALL questions immediately and wait.
+
+For `:auto`, do not emit the consolidated prompt by default. Resolve setup with the three-tier branch below, then load the auto YAML only after all required values are bound.
+
+### `:auto` Setup Resolution
+
+Setup contract: see `.opencode/skills/system-spec-kit/references/workflows/auto_mode_contract.md`.
+
+Under `execution_mode = AUTONOMOUS` (from the `:auto` suffix), follow the three-tier flow:
+
+1. **Tier 1 — Resolve confidently** (contract §1): parse `$ARGUMENTS` flags + `PRE-BOUND SETUP ANSWERS:` block (§2) + the Default Resolution Table below (§3). When every required field is resolved, persist to `{spec_folder}/improvement/agent-improvement-config.json` (shape: `targetPath`, `targetProfile`, `specFolder`, `executionMode: "auto"`, `scoringMode`, `maxIterations`, `agentName`), bind runtime YAML placeholders, set `STATUS: PASSED`, load `.opencode/commands/improve/assets/improve_deep-agent-improvement_auto.yaml`. End §0.
+
+2. **Tier 2 — Targeted ask** (contract §1): when 1-2 required fields are genuinely ambiguous AND no default exists, emit ONE narrow question per ambiguous field. Command-specific Tier-2-eligible fields (per the Default Resolution Table below): `spec_folder`. **Ordering rule**: none needed; `target_path` absence is missing input, not ambiguity, and goes to Tier 3.
+
+3. **Tier 3 — Fail fast** (contract §4): emit the named-missing-inputs error format with `/improve:agent:auto` as the command name. Exit non-zero. Do not load YAML.
+
+`:confirm` path stays unchanged — see the consolidated setup prompt section below.
+
+### PRE-BOUND SETUP ANSWERS Schema (for `:auto` non-interactive dispatch)
+
+The dispatched prompt body may contain one structured marker block. Parse it before applying defaults. Grammar: see `auto_mode_contract.md` §2.
+
+```yaml
+PRE-BOUND SETUP ANSWERS:
+  target_path: .opencode/agents/debug.md  # required path matching .opencode/agents/*.md
+  target_profile: dynamic  # optional; one of: handover | context-prime | dynamic; derived from target_path when omitted
+  spec_folder: specs/041/008  # required spec folder path or explicit runtime folder
+  execution_mode: AUTONOMOUS  # from :auto suffix
+  scoring_mode: dynamic  # dynamic is the current supported scoring mode
+  max_iterations: 5  # positive integer
+```
+
+Rules: see `auto_mode_contract.md` §2 (unspecified fields fall back to default; marker fields take precedence over $ARGUMENTS flags; unknown fields warn; malformed lines parse-error).
+
+### Default Resolution Table
+
+| Field | Required | Resolves Via | Default | Tier-2 Candidate |
+|-------|----------|--------------|---------|------------------|
+| `target_path` | Y | `$ARGUMENTS` agent path, or marker `target_path` | none | N |
+| `target_profile` | Y | marker `target_profile`, or auto-detect from `target_path` (`handover` -> `handover`, `context-prime` -> `context-prime`, otherwise `dynamic`) | inferred from `target_path` | N |
+| `spec_folder` | Y | flag `--spec-folder`, marker `spec_folder`, or requires-ask | none | Y |
+| `execution_mode` | Y | attached suffix `:auto` or marker `execution_mode` | `AUTONOMOUS` under `:auto` | N |
+| `scoring_mode` | Y | marker `scoring_mode`, Q3 equivalent, or default | `dynamic` | N |
+| `max_iterations` | Y | flag `--iterations`, marker `max_iterations`, or default | `5` | N |
+
 **STATUS: ☐ BLOCKED**
 
 **🚨 SINGLE CONSOLIDATED PROMPT - ONE USER INTERACTION**
diff --git a/.opencode/specs/skilled-agent-orchestration/103-spec-kit-auto-mode-noninteractive-contract/002-auto-mode-contract-generalization-to-all-commands/evidence/codex-group3-dispatch.txt b/.opencode/specs/skilled-agent-orchestration/103-spec-kit-auto-mode-noninteractive-contract/002-auto-mode-contract-generalization-to-all-commands/evidence/codex-group3-dispatch.txt
new file mode 100644
index 0000000000000000000000000000000000000000..1113588ced2ad7d9f657d78aac13ca99d3a2f192
--- /dev/null
+++ b/.opencode/specs/skilled-agent-orchestration/103-spec-kit-auto-mode-noninteractive-contract/002-auto-mode-contract-generalization-to-all-commands/evidence/codex-group3-dispatch.txt
@@ -0,0 +1,14 @@
+# Group 3 Dispatch - /improve
+
+## /improve:agent
+
+- Command file: `.opencode/commands/improve/agent.md`
+- Fields migrated count: 6
+- Fields migrated: `target_path`, `target_profile`, `spec_folder`, `execution_mode`, `scoring_mode`, `max_iterations`
+- Tier-2 candidates identified: `spec_folder`
+- `:confirm` consolidated Q-block preserved: yes
+- Argument hint updated: yes
+- Paired YAML assets touched: no
+- Concerns: `spec_folder` is the only Tier-2 candidate because the legacy Q1 asks the operator to choose a runtime location and no default exists. `target_path` absence stays Tier 3 because the command explicitly forbids inferring the target agent from context.
+
+EXIT_STATUS: complete
diff --git a/.opencode/specs/skilled-agent-orchestration/103-spec-kit-auto-mode-noninteractive-contract/002-auto-mode-contract-generalization-to-all-commands/tasks.md b/.opencode/specs/skilled-agent-orchestration/103-spec-kit-auto-mode-noninteractive-contract/002-auto-mode-contract-generalization-to-all-commands/tasks.md
index 5f7df6766aed7eb41b4e40081ff7c885a3683451..7ecf545cf0732b4ad7cc64de45cdf0113e23c61f
--- a/.opencode/specs/skilled-agent-orchestration/103-spec-kit-auto-mode-noninteractive-contract/002-auto-mode-contract-generalization-to-all-commands/tasks.md
+++ b/.opencode/specs/skilled-agent-orchestration/103-spec-kit-auto-mode-noninteractive-contract/002-auto-mode-contract-generalization-to-all-commands/tasks.md
@@ -10,8 +10,8 @@
     packet_pointer: ".opencode/specs/skilled-agent-orchestration/103-spec-kit-auto-mode-noninteractive-contract/002-auto-mode-contract-generalization-to-all-commands"
     last_updated_at: "2026-05-11T12:35:00Z"
     last_updated_by: "claude-opus-4-7"
-    recent_action: "Group 2 create commands migrated"
-    next_safe_action: "Dispatch group 3 improve command"
+    recent_action: "Group 3 improve command migrated"
+    next_safe_action: "Run live verification dispatches (Stage D)"
     blockers: []
     key_files: []
     session_dedup:
@@ -59,7 +59,7 @@
 
 - [x] T010 Codex group dispatch 1 (spec_kit/5): deep-research, complete, implement, plan, resume. Evidence: Group 1 codex dispatch completed; 5 commands migrated; see evidence/codex-group1-dispatch.txt
 - [x] T011 Codex group dispatch 2 (create/6): sk-skill, agent, changelog, feature-catalog, testing-playbook, folder_readme. Evidence: Group 2 codex dispatch completed; 5 commands migrated; see evidence/codex-group2-dispatch.txt
-- [ ] T012 Codex group dispatch 3 (improve/1): agent.
+- [x] T012 Codex group dispatch 3 (improve/1): agent. Evidence: Group 3 codex dispatch completed; 1 command migrated; see evidence/codex-group3-dispatch.txt
 - [ ] T013 Per-command read-back: confirm `:confirm` block untouched in all 11 migrated commands.
 <!-- /ANCHOR:phase-2 -->
 

exec
/bin/zsh -lc "sed -n '1,80p' .opencode/specs/skilled-agent-orchestration/103-spec-kit-auto-mode-noninteractive-contract/002-auto-mode-contract-generalization-to-all-commands/evidence/codex-group3-dispatch.txt && sed -n '1,75p' .opencode/specs/skilled-agent-orchestration/103-spec-kit-auto-mode-noninteractive-contract/002-auto-mode-contract-generalization-to-all-commands/tasks.md" in /Users/michelkerkmeester/MEGA/Development/Code_Environment/Public
 succeeded in 0ms:
# Group 3 Dispatch - /improve

## /improve:agent

- Command file: `.opencode/commands/improve/agent.md`
- Fields migrated count: 6
- Fields migrated: `target_path`, `target_profile`, `spec_folder`, `execution_mode`, `scoring_mode`, `max_iterations`
- Tier-2 candidates identified: `spec_folder`
- `:confirm` consolidated Q-block preserved: yes
- Argument hint updated: yes
- Paired YAML assets touched: no
- Concerns: `spec_folder` is the only Tier-2 candidate because the legacy Q1 asks the operator to choose a runtime location and no default exists. `target_path` absence stays Tier 3 because the command explicitly forbids inferring the target agent from context.

EXIT_STATUS: complete
---
title: "Tasks: auto-mode-contract generalization"
description: "11-command migration via 3 codex groups + 12 live verifications + synthesis."
trigger_phrases:
  - "auto mode contract generalization"
importance_tier: "important"
contextType: "implementation"
_memory:
  continuity:
    packet_pointer: ".opencode/specs/skilled-agent-orchestration/103-spec-kit-auto-mode-noninteractive-contract/002-auto-mode-contract-generalization-to-all-commands"
    last_updated_at: "2026-05-11T12:35:00Z"
    last_updated_by: "claude-opus-4-7"
    recent_action: "Group 3 improve command migrated"
    next_safe_action: "Run live verification dispatches (Stage D)"
    blockers: []
    key_files: []
    session_dedup:
      fingerprint: "sha256:0000000000000000000000000000000000000000000000000000000000000000"
      session_id: "103-002-auto-mode-contract-generalization"
      parent_session_id: null
    completion_pct: 0
    open_questions: []
    answered_questions: []
---
# Tasks: auto-mode-contract generalization

<!-- SPECKIT_LEVEL: 2 -->
<!-- SPECKIT_TEMPLATE_SOURCE: tasks-core | v2.2 -->

---

<!-- ANCHOR:notation -->
## Task Notation

| Prefix | Meaning |
|--------|---------|
| `[ ]` | Pending |
| `[x]` | Completed |
| `[P]` | Parallelizable |
| `[B]` | Blocked |

**Task Format**: `T### [P?] Description (file path)`
<!-- /ANCHOR:notation -->

---

<!-- ANCHOR:phase-1 -->
## Phase 1: Setup

- [x] T001 Shared `auto_mode_contract.md` authored (Stage B).
- [x] T002 `/spec_kit:deep-review.md` §0 refactored to cite shared contract (Stage B).
- [ ] T003 Confirm 001's dry-run traces still conceptually pass after refactor (read-back).
<!-- /ANCHOR:phase-1 -->

---

<!-- ANCHOR:phase-2 -->
## Phase 2: Implementation

- [x] T010 Codex group dispatch 1 (spec_kit/5): deep-research, complete, implement, plan, resume. Evidence: Group 1 codex dispatch completed; 5 commands migrated; see evidence/codex-group1-dispatch.txt
- [x] T011 Codex group dispatch 2 (create/6): sk-skill, agent, changelog, feature-catalog, testing-playbook, folder_readme. Evidence: Group 2 codex dispatch completed; 5 commands migrated; see evidence/codex-group2-dispatch.txt
- [x] T012 Codex group dispatch 3 (improve/1): agent. Evidence: Group 3 codex dispatch completed; 1 command migrated; see evidence/codex-group3-dispatch.txt
- [ ] T013 Per-command read-back: confirm `:confirm` block untouched in all 11 migrated commands.
<!-- /ANCHOR:phase-2 -->

---

<!-- ANCHOR:phase-3 -->
## Phase 3: Verification

- [ ] T020 Live `:auto` dispatch — `/spec_kit:deep-review` (re-verify post-refactor).
- [ ] T021 Live `:auto` dispatch — `/spec_kit:deep-research`.
- [ ] T022 Live `:auto` dispatch — `/spec_kit:resume`.
- [ ] T023 Live `:auto` dispatch — `/spec_kit:implement`.
- [ ] T024 Live `:auto` dispatch — `/spec_kit:complete`.

exec
/bin/zsh -lc 'git status --short -- .opencode/commands/improve/agent.md .opencode/specs/skilled-agent-orchestration/103-spec-kit-auto-mode-noninteractive-contract/002-auto-mode-contract-generalization-to-all-commands/tasks.md .opencode/specs/skilled-agent-orchestration/103-spec-kit-auto-mode-noninteractive-contract/002-auto-mode-contract-generalization-to-all-commands/evidence/codex-group3-dispatch.txt .opencode/commands/improve/assets/improve_deep-agent-improvement_auto.yaml .opencode/commands/improve/assets/improve_deep-agent-improvement_confirm.yaml' in /Users/michelkerkmeester/MEGA/Development/Code_Environment/Public
 succeeded in 0ms:
 M .opencode/commands/improve/agent.md
 M .opencode/specs/skilled-agent-orchestration/103-spec-kit-auto-mode-noninteractive-contract/002-auto-mode-contract-generalization-to-all-commands/tasks.md
?? .opencode/specs/skilled-agent-orchestration/103-spec-kit-auto-mode-noninteractive-contract/002-auto-mode-contract-generalization-to-all-commands/evidence/codex-group3-dispatch.txt

exec
/bin/zsh -lc 'git diff -- .opencode/commands/improve/assets/improve_deep-agent-improvement_auto.yaml .opencode/commands/improve/assets/improve_deep-agent-improvement_confirm.yaml' in /Users/michelkerkmeester/MEGA/Development/Code_Environment/Public
 succeeded in 0ms:
diff --git a/.opencode/commands/improve/agent.md b/.opencode/commands/improve/agent.md
index f97b991ba5c0accdfc04eafd99e17db1351d8a8a..899b05445f45f65f64dc11de23380fbe4648266d
--- a/.opencode/commands/improve/agent.md
+++ b/.opencode/commands/improve/agent.md
@@ -1,6 +1,6 @@
 ---
 description: "Evaluate and improve any agent: 5 dimensions, proposals, scoring, guarded promotion. :auto/:confirm."
-argument-hint: "<agent_path> [:auto|:confirm] [--spec-folder=PATH] [--iterations=N]"
+argument-hint: "<agent_path> [:auto|:confirm] [--spec-folder=PATH] [--iterations=N] (:auto supports PRE-BOUND SETUP ANSWERS: prompt-body block for non-interactive setup)"
 allowed-tools: Read, Write, Edit, Bash, Grep, Glob, Task
 ---
 
@@ -60,6 +60,51 @@
 
 # 🔒 UNIFIED SETUP PHASE
 
+**FIRST MESSAGE PROTOCOL**: For `:confirm` or no suffix, the consolidated setup prompt MUST be your FIRST response. No implementation or file-modifying tool calls before asking. Lightweight read-only discovery to suggest a spec folder or load prior context is allowed, then ask ALL questions immediately and wait.
+
+For `:auto`, do not emit the consolidated prompt by default. Resolve setup with the three-tier branch below, then load the auto YAML only after all required values are bound.
+
+### `:auto` Setup Resolution
+
+Setup contract: see `.opencode/skills/system-spec-kit/references/workflows/auto_mode_contract.md`.
+
+Under `execution_mode = AUTONOMOUS` (from the `:auto` suffix), follow the three-tier flow:
+
+1. **Tier 1 — Resolve confidently** (contract §1): parse `$ARGUMENTS` flags + `PRE-BOUND SETUP ANSWERS:` block (§2) + the Default Resolution Table below (§3). When every required field is resolved, persist to `{spec_folder}/improvement/agent-improvement-config.json` (shape: `targetPath`, `targetProfile`, `specFolder`, `executionMode: "auto"`, `scoringMode`, `maxIterations`, `agentName`), bind runtime YAML placeholders, set `STATUS: PASSED`, load `.opencode/commands/improve/assets/improve_deep-agent-improvement_auto.yaml`. End §0.
+
+2. **Tier 2 — Targeted ask** (contract §1): when 1-2 required fields are genuinely ambiguous AND no default exists, emit ONE narrow question per ambiguous field. Command-specific Tier-2-eligible fields (per the Default Resolution Table below): `spec_folder`. **Ordering rule**: none needed; `target_path` absence is missing input, not ambiguity, and goes to Tier 3.
+
+3. **Tier 3 — Fail fast** (contract §4): emit the named-missing-inputs error format with `/improve:agent:auto` as the command name. Exit non-zero. Do not load YAML.
+
+`:confirm` path stays unchanged — see the consolidated setup prompt section below.
+
+### PRE-BOUND SETUP ANSWERS Schema (for `:auto` non-interactive dispatch)
+
+The dispatched prompt body may contain one structured marker block. Parse it before applying defaults. Grammar: see `auto_mode_contract.md` §2.
+
+```yaml
+PRE-BOUND SETUP ANSWERS:
+  target_path: .opencode/agents/debug.md  # required path matching .opencode/agents/*.md
+  target_profile: dynamic  # optional; one of: handover | context-prime | dynamic; derived from target_path when omitted
+  spec_folder: specs/041/008  # required spec folder path or explicit runtime folder
+  execution_mode: AUTONOMOUS  # from :auto suffix
+  scoring_mode: dynamic  # dynamic is the current supported scoring mode
+  max_iterations: 5  # positive integer
+```
+
+Rules: see `auto_mode_contract.md` §2 (unspecified fields fall back to default; marker fields take precedence over $ARGUMENTS flags; unknown fields warn; malformed lines parse-error).
+
+### Default Resolution Table
+
+| Field | Required | Resolves Via | Default | Tier-2 Candidate |
+|-------|----------|--------------|---------|------------------|
+| `target_path` | Y | `$ARGUMENTS` agent path, or marker `target_path` | none | N |
+| `target_profile` | Y | marker `target_profile`, or auto-detect from `target_path` (`handover` -> `handover`, `context-prime` -> `context-prime`, otherwise `dynamic`) | inferred from `target_path` | N |
+| `spec_folder` | Y | flag `--spec-folder`, marker `spec_folder`, or requires-ask | none | Y |
+| `execution_mode` | Y | attached suffix `:auto` or marker `execution_mode` | `AUTONOMOUS` under `:auto` | N |
+| `scoring_mode` | Y | marker `scoring_mode`, Q3 equivalent, or default | `dynamic` | N |
+| `max_iterations` | Y | flag `--iterations`, marker `max_iterations`, or default | `5` | N |
+
 **STATUS: ☐ BLOCKED**
 
 **🚨 SINGLE CONSOLIDATED PROMPT - ONE USER INTERACTION**
diff --git a/.opencode/specs/skilled-agent-orchestration/103-spec-kit-auto-mode-noninteractive-contract/002-auto-mode-contract-generalization-to-all-commands/evidence/codex-group3-dispatch.txt b/.opencode/specs/skilled-agent-orchestration/103-spec-kit-auto-mode-noninteractive-contract/002-auto-mode-contract-generalization-to-all-commands/evidence/codex-group3-dispatch.txt
new file mode 100644
index 0000000000000000000000000000000000000000..1113588ced2ad7d9f657d78aac13ca99d3a2f192
--- /dev/null
+++ b/.opencode/specs/skilled-agent-orchestration/103-spec-kit-auto-mode-noninteractive-contract/002-auto-mode-contract-generalization-to-all-commands/evidence/codex-group3-dispatch.txt
@@ -0,0 +1,14 @@
+# Group 3 Dispatch - /improve
+
+## /improve:agent
+
+- Command file: `.opencode/commands/improve/agent.md`
+- Fields migrated count: 6
+- Fields migrated: `target_path`, `target_profile`, `spec_folder`, `execution_mode`, `scoring_mode`, `max_iterations`
+- Tier-2 candidates identified: `spec_folder`
+- `:confirm` consolidated Q-block preserved: yes
+- Argument hint updated: yes
+- Paired YAML assets touched: no
+- Concerns: `spec_folder` is the only Tier-2 candidate because the legacy Q1 asks the operator to choose a runtime location and no default exists. `target_path` absence stays Tier 3 because the command explicitly forbids inferring the target agent from context.
+
+EXIT_STATUS: complete
diff --git a/.opencode/specs/skilled-agent-orchestration/103-spec-kit-auto-mode-noninteractive-contract/002-auto-mode-contract-generalization-to-all-commands/tasks.md b/.opencode/specs/skilled-agent-orchestration/103-spec-kit-auto-mode-noninteractive-contract/002-auto-mode-contract-generalization-to-all-commands/tasks.md
index 5f7df6766aed7eb41b4e40081ff7c885a3683451..7ecf545cf0732b4ad7cc64de45cdf0113e23c61f
--- a/.opencode/specs/skilled-agent-orchestration/103-spec-kit-auto-mode-noninteractive-contract/002-auto-mode-contract-generalization-to-all-commands/tasks.md
+++ b/.opencode/specs/skilled-agent-orchestration/103-spec-kit-auto-mode-noninteractive-contract/002-auto-mode-contract-generalization-to-all-commands/tasks.md
@@ -10,8 +10,8 @@
     packet_pointer: ".opencode/specs/skilled-agent-orchestration/103-spec-kit-auto-mode-noninteractive-contract/002-auto-mode-contract-generalization-to-all-commands"
     last_updated_at: "2026-05-11T12:35:00Z"
     last_updated_by: "claude-opus-4-7"
-    recent_action: "Group 2 create commands migrated"
-    next_safe_action: "Dispatch group 3 improve command"
+    recent_action: "Group 3 improve command migrated"
+    next_safe_action: "Run live verification dispatches (Stage D)"
     blockers: []
     key_files: []
     session_dedup:
@@ -59,7 +59,7 @@
 
 - [x] T010 Codex group dispatch 1 (spec_kit/5): deep-research, complete, implement, plan, resume. Evidence: Group 1 codex dispatch completed; 5 commands migrated; see evidence/codex-group1-dispatch.txt
 - [x] T011 Codex group dispatch 2 (create/6): sk-skill, agent, changelog, feature-catalog, testing-playbook, folder_readme. Evidence: Group 2 codex dispatch completed; 5 commands migrated; see evidence/codex-group2-dispatch.txt
-- [ ] T012 Codex group dispatch 3 (improve/1): agent.
+- [x] T012 Codex group dispatch 3 (improve/1): agent. Evidence: Group 3 codex dispatch completed; 1 command migrated; see evidence/codex-group3-dispatch.txt
 - [ ] T013 Per-command read-back: confirm `:confirm` block untouched in all 11 migrated commands.
 <!-- /ANCHOR:phase-2 -->
 

exec
/bin/zsh -lc 'rg -n "auto_mode_contract.md|PRE-BOUND SETUP ANSWERS|Default Resolution Table|improve_deep-agent-improvement_auto.yaml|argument-hint" .opencode/commands/improve/agent.md' in /Users/michelkerkmeester/MEGA/Development/Code_Environment/Public
exec
/bin/zsh -lc 'rg -n "T012|recent_action|next_safe_action" .opencode/specs/skilled-agent-orchestration/103-spec-kit-auto-mode-noninteractive-contract/002-auto-mode-contract-generalization-to-all-commands/tasks.md' in /Users/michelkerkmeester/MEGA/Development/Code_Environment/Public
 succeeded in 0ms:
13:    recent_action: "Group 3 improve command migrated"
14:    next_safe_action: "Run live verification dispatches (Stage D)"
62:- [x] T012 Codex group dispatch 3 (improve/1): agent. Evidence: Group 3 codex dispatch completed; 1 command migrated; see evidence/codex-group3-dispatch.txt

 succeeded in 0ms:
3:argument-hint: "<agent_path> [:auto|:confirm] [--spec-folder=PATH] [--iterations=N] (:auto supports PRE-BOUND SETUP ANSWERS: prompt-body block for non-interactive setup)"
69:Setup contract: see `.opencode/skills/system-spec-kit/references/workflows/auto_mode_contract.md`.
73:1. **Tier 1 — Resolve confidently** (contract §1): parse `$ARGUMENTS` flags + `PRE-BOUND SETUP ANSWERS:` block (§2) + the Default Resolution Table below (§3). When every required field is resolved, persist to `{spec_folder}/improvement/agent-improvement-config.json` (shape: `targetPath`, `targetProfile`, `specFolder`, `executionMode: "auto"`, `scoringMode`, `maxIterations`, `agentName`), bind runtime YAML placeholders, set `STATUS: PASSED`, load `.opencode/commands/improve/assets/improve_deep-agent-improvement_auto.yaml`. End §0.
75:2. **Tier 2 — Targeted ask** (contract §1): when 1-2 required fields are genuinely ambiguous AND no default exists, emit ONE narrow question per ambiguous field. Command-specific Tier-2-eligible fields (per the Default Resolution Table below): `spec_folder`. **Ordering rule**: none needed; `target_path` absence is missing input, not ambiguity, and goes to Tier 3.
81:### PRE-BOUND SETUP ANSWERS Schema (for `:auto` non-interactive dispatch)
83:The dispatched prompt body may contain one structured marker block. Parse it before applying defaults. Grammar: see `auto_mode_contract.md` §2.
86:PRE-BOUND SETUP ANSWERS:
95:Rules: see `auto_mode_contract.md` §2 (unspecified fields fall back to default; marker fields take precedence over $ARGUMENTS flags; unknown fields warn; malformed lines parse-error).
97:### Default Resolution Table
314:- **AUTONOMOUS** -> `assets/improve_deep-agent-improvement_auto.yaml`

exec
/bin/zsh -lc 'rg -n "EXIT_STATUS|Fields migrated count|Tier-2 candidates|Paired YAML" .opencode/specs/skilled-agent-orchestration/103-spec-kit-auto-mode-noninteractive-contract/002-auto-mode-contract-generalization-to-all-commands/evidence/codex-group3-dispatch.txt' in /Users/michelkerkmeester/MEGA/Development/Code_Environment/Public
 succeeded in 0ms:
6:- Fields migrated count: 6
8:- Tier-2 candidates identified: `spec_folder`
11:- Paired YAML assets touched: no
14:EXIT_STATUS: complete

diff --git a/.opencode/commands/improve/agent.md b/.opencode/commands/improve/agent.md
index f97b991ba5c0accdfc04eafd99e17db1351d8a8a..899b05445f45f65f64dc11de23380fbe4648266d
--- a/.opencode/commands/improve/agent.md
+++ b/.opencode/commands/improve/agent.md
@@ -1,6 +1,6 @@
 ---
 description: "Evaluate and improve any agent: 5 dimensions, proposals, scoring, guarded promotion. :auto/:confirm."
-argument-hint: "<agent_path> [:auto|:confirm] [--spec-folder=PATH] [--iterations=N]"
+argument-hint: "<agent_path> [:auto|:confirm] [--spec-folder=PATH] [--iterations=N] (:auto supports PRE-BOUND SETUP ANSWERS: prompt-body block for non-interactive setup)"
 allowed-tools: Read, Write, Edit, Bash, Grep, Glob, Task
 ---
 
@@ -60,6 +60,51 @@
 
 # 🔒 UNIFIED SETUP PHASE
 
+**FIRST MESSAGE PROTOCOL**: For `:confirm` or no suffix, the consolidated setup prompt MUST be your FIRST response. No implementation or file-modifying tool calls before asking. Lightweight read-only discovery to suggest a spec folder or load prior context is allowed, then ask ALL questions immediately and wait.
+
+For `:auto`, do not emit the consolidated prompt by default. Resolve setup with the three-tier branch below, then load the auto YAML only after all required values are bound.
+
+### `:auto` Setup Resolution
+
+Setup contract: see `.opencode/skills/system-spec-kit/references/workflows/auto_mode_contract.md`.
+
+Under `execution_mode = AUTONOMOUS` (from the `:auto` suffix), follow the three-tier flow:
+
+1. **Tier 1 — Resolve confidently** (contract §1): parse `$ARGUMENTS` flags + `PRE-BOUND SETUP ANSWERS:` block (§2) + the Default Resolution Table below (§3). When every required field is resolved, persist to `{spec_folder}/improvement/agent-improvement-config.json` (shape: `targetPath`, `targetProfile`, `specFolder`, `executionMode: "auto"`, `scoringMode`, `maxIterations`, `agentName`), bind runtime YAML placeholders, set `STATUS: PASSED`, load `.opencode/commands/improve/assets/improve_deep-agent-improvement_auto.yaml`. End §0.
+
+2. **Tier 2 — Targeted ask** (contract §1): when 1-2 required fields are genuinely ambiguous AND no default exists, emit ONE narrow question per ambiguous field. Command-specific Tier-2-eligible fields (per the Default Resolution Table below): `spec_folder`. **Ordering rule**: none needed; `target_path` absence is missing input, not ambiguity, and goes to Tier 3.
+
+3. **Tier 3 — Fail fast** (contract §4): emit the named-missing-inputs error format with `/improve:agent:auto` as the command name. Exit non-zero. Do not load YAML.
+
+`:confirm` path stays unchanged — see the consolidated setup prompt section below.
+
+### PRE-BOUND SETUP ANSWERS Schema (for `:auto` non-interactive dispatch)
+
+The dispatched prompt body may contain one structured marker block. Parse it before applying defaults. Grammar: see `auto_mode_contract.md` §2.
+
+```yaml
+PRE-BOUND SETUP ANSWERS:
+  target_path: .opencode/agents/debug.md  # required path matching .opencode/agents/*.md
+  target_profile: dynamic  # optional; one of: handover | context-prime | dynamic; derived from target_path when omitted
+  spec_folder: specs/041/008  # required spec folder path or explicit runtime folder
+  execution_mode: AUTONOMOUS  # from :auto suffix
+  scoring_mode: dynamic  # dynamic is the current supported scoring mode
+  max_iterations: 5  # positive integer
+```
+
+Rules: see `auto_mode_contract.md` §2 (unspecified fields fall back to default; marker fields take precedence over $ARGUMENTS flags; unknown fields warn; malformed lines parse-error).
+
+### Default Resolution Table
+
+| Field | Required | Resolves Via | Default | Tier-2 Candidate |
+|-------|----------|--------------|---------|------------------|
+| `target_path` | Y | `$ARGUMENTS` agent path, or marker `target_path` | none | N |
+| `target_profile` | Y | marker `target_profile`, or auto-detect from `target_path` (`handover` -> `handover`, `context-prime` -> `context-prime`, otherwise `dynamic`) | inferred from `target_path` | N |
+| `spec_folder` | Y | flag `--spec-folder`, marker `spec_folder`, or requires-ask | none | Y |
+| `execution_mode` | Y | attached suffix `:auto` or marker `execution_mode` | `AUTONOMOUS` under `:auto` | N |
+| `scoring_mode` | Y | marker `scoring_mode`, Q3 equivalent, or default | `dynamic` | N |
+| `max_iterations` | Y | flag `--iterations`, marker `max_iterations`, or default | `5` | N |
+
 **STATUS: ☐ BLOCKED**
 
 **🚨 SINGLE CONSOLIDATED PROMPT - ONE USER INTERACTION**
diff --git a/.opencode/specs/skilled-agent-orchestration/103-spec-kit-auto-mode-noninteractive-contract/002-auto-mode-contract-generalization-to-all-commands/evidence/codex-group3-dispatch.txt b/.opencode/specs/skilled-agent-orchestration/103-spec-kit-auto-mode-noninteractive-contract/002-auto-mode-contract-generalization-to-all-commands/evidence/codex-group3-dispatch.txt
new file mode 100644
index 0000000000000000000000000000000000000000..1113588ced2ad7d9f657d78aac13ca99d3a2f192
--- /dev/null
+++ b/.opencode/specs/skilled-agent-orchestration/103-spec-kit-auto-mode-noninteractive-contract/002-auto-mode-contract-generalization-to-all-commands/evidence/codex-group3-dispatch.txt
@@ -0,0 +1,14 @@
+# Group 3 Dispatch - /improve
+
+## /improve:agent
+
+- Command file: `.opencode/commands/improve/agent.md`
+- Fields migrated count: 6
+- Fields migrated: `target_path`, `target_profile`, `spec_folder`, `execution_mode`, `scoring_mode`, `max_iterations`
+- Tier-2 candidates identified: `spec_folder`
+- `:confirm` consolidated Q-block preserved: yes
+- Argument hint updated: yes
+- Paired YAML assets touched: no
+- Concerns: `spec_folder` is the only Tier-2 candidate because the legacy Q1 asks the operator to choose a runtime location and no default exists. `target_path` absence stays Tier 3 because the command explicitly forbids inferring the target agent from context.
+
+EXIT_STATUS: complete
diff --git a/.opencode/specs/skilled-agent-orchestration/103-spec-kit-auto-mode-noninteractive-contract/002-auto-mode-contract-generalization-to-all-commands/tasks.md b/.opencode/specs/skilled-agent-orchestration/103-spec-kit-auto-mode-noninteractive-contract/002-auto-mode-contract-generalization-to-all-commands/tasks.md
index 5f7df6766aed7eb41b4e40081ff7c885a3683451..7ecf545cf0732b4ad7cc64de45cdf0113e23c61f
--- a/.opencode/specs/skilled-agent-orchestration/103-spec-kit-auto-mode-noninteractive-contract/002-auto-mode-contract-generalization-to-all-commands/tasks.md
+++ b/.opencode/specs/skilled-agent-orchestration/103-spec-kit-auto-mode-noninteractive-contract/002-auto-mode-contract-generalization-to-all-commands/tasks.md
@@ -10,8 +10,8 @@
     packet_pointer: ".opencode/specs/skilled-agent-orchestration/103-spec-kit-auto-mode-noninteractive-contract/002-auto-mode-contract-generalization-to-all-commands"
     last_updated_at: "2026-05-11T12:35:00Z"
     last_updated_by: "claude-opus-4-7"
-    recent_action: "Group 2 create commands migrated"
-    next_safe_action: "Dispatch group 3 improve command"
+    recent_action: "Group 3 improve command migrated"
+    next_safe_action: "Run live verification dispatches (Stage D)"
     blockers: []
     key_files: []
     session_dedup:
@@ -59,7 +59,7 @@
 
 - [x] T010 Codex group dispatch 1 (spec_kit/5): deep-research, complete, implement, plan, resume. Evidence: Group 1 codex dispatch completed; 5 commands migrated; see evidence/codex-group1-dispatch.txt
 - [x] T011 Codex group dispatch 2 (create/6): sk-skill, agent, changelog, feature-catalog, testing-playbook, folder_readme. Evidence: Group 2 codex dispatch completed; 5 commands migrated; see evidence/codex-group2-dispatch.txt
-- [ ] T012 Codex group dispatch 3 (improve/1): agent.
+- [x] T012 Codex group dispatch 3 (improve/1): agent. Evidence: Group 3 codex dispatch completed; 1 command migrated; see evidence/codex-group3-dispatch.txt
 - [ ] T013 Per-command read-back: confirm `:confirm` block untouched in all 11 migrated commands.
 <!-- /ANCHOR:phase-2 -->
 

apply patch
patch: completed
/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/specs/skilled-agent-orchestration/103-spec-kit-auto-mode-noninteractive-contract/002-auto-mode-contract-generalization-to-all-commands/evidence/codex-group3-dispatch.txt
diff --git a/.opencode/commands/improve/agent.md b/.opencode/commands/improve/agent.md
index f97b991ba5c0accdfc04eafd99e17db1351d8a8a..899b05445f45f65f64dc11de23380fbe4648266d
--- a/.opencode/commands/improve/agent.md
+++ b/.opencode/commands/improve/agent.md
@@ -1,6 +1,6 @@
 ---
 description: "Evaluate and improve any agent: 5 dimensions, proposals, scoring, guarded promotion. :auto/:confirm."
-argument-hint: "<agent_path> [:auto|:confirm] [--spec-folder=PATH] [--iterations=N]"
+argument-hint: "<agent_path> [:auto|:confirm] [--spec-folder=PATH] [--iterations=N] (:auto supports PRE-BOUND SETUP ANSWERS: prompt-body block for non-interactive setup)"
 allowed-tools: Read, Write, Edit, Bash, Grep, Glob, Task
 ---
 
@@ -60,6 +60,51 @@
 
 # 🔒 UNIFIED SETUP PHASE
 
+**FIRST MESSAGE PROTOCOL**: For `:confirm` or no suffix, the consolidated setup prompt MUST be your FIRST response. No implementation or file-modifying tool calls before asking. Lightweight read-only discovery to suggest a spec folder or load prior context is allowed, then ask ALL questions immediately and wait.
+
+For `:auto`, do not emit the consolidated prompt by default. Resolve setup with the three-tier branch below, then load the auto YAML only after all required values are bound.
+
+### `:auto` Setup Resolution
+
+Setup contract: see `.opencode/skills/system-spec-kit/references/workflows/auto_mode_contract.md`.
+
+Under `execution_mode = AUTONOMOUS` (from the `:auto` suffix), follow the three-tier flow:
+
+1. **Tier 1 — Resolve confidently** (contract §1): parse `$ARGUMENTS` flags + `PRE-BOUND SETUP ANSWERS:` block (§2) + the Default Resolution Table below (§3). When every required field is resolved, persist to `{spec_folder}/improvement/agent-improvement-config.json` (shape: `targetPath`, `targetProfile`, `specFolder`, `executionMode: "auto"`, `scoringMode`, `maxIterations`, `agentName`), bind runtime YAML placeholders, set `STATUS: PASSED`, load `.opencode/commands/improve/assets/improve_deep-agent-improvement_auto.yaml`. End §0.
+
+2. **Tier 2 — Targeted ask** (contract §1): when 1-2 required fields are genuinely ambiguous AND no default exists, emit ONE narrow question per ambiguous field. Command-specific Tier-2-eligible fields (per the Default Resolution Table below): `spec_folder`. **Ordering rule**: none needed; `target_path` absence is missing input, not ambiguity, and goes to Tier 3.
+
+3. **Tier 3 — Fail fast** (contract §4): emit the named-missing-inputs error format with `/improve:agent:auto` as the command name. Exit non-zero. Do not load YAML.
+
+`:confirm` path stays unchanged — see the consolidated setup prompt section below.
+
+### PRE-BOUND SETUP ANSWERS Schema (for `:auto` non-interactive dispatch)
+
+The dispatched prompt body may contain one structured marker block. Parse it before applying defaults. Grammar: see `auto_mode_contract.md` §2.
+
+```yaml
+PRE-BOUND SETUP ANSWERS:
+  target_path: .opencode/agents/debug.md  # required path matching .opencode/agents/*.md
+  target_profile: dynamic  # optional; one of: handover | context-prime | dynamic; derived from target_path when omitted
+  spec_folder: specs/041/008  # required spec folder path or explicit runtime folder
+  execution_mode: AUTONOMOUS  # from :auto suffix
+  scoring_mode: dynamic  # dynamic is the current supported scoring mode
+  max_iterations: 5  # positive integer
+```
+
+Rules: see `auto_mode_contract.md` §2 (unspecified fields fall back to default; marker fields take precedence over $ARGUMENTS flags; unknown fields warn; malformed lines parse-error).
+
+### Default Resolution Table
+
+| Field | Required | Resolves Via | Default | Tier-2 Candidate |
+|-------|----------|--------------|---------|------------------|
+| `target_path` | Y | `$ARGUMENTS` agent path, or marker `target_path` | none | N |
+| `target_profile` | Y | marker `target_profile`, or auto-detect from `target_path` (`handover` -> `handover`, `context-prime` -> `context-prime`, otherwise `dynamic`) | inferred from `target_path` | N |
+| `spec_folder` | Y | flag `--spec-folder`, marker `spec_folder`, or requires-ask | none | Y |
+| `execution_mode` | Y | attached suffix `:auto` or marker `execution_mode` | `AUTONOMOUS` under `:auto` | N |
+| `scoring_mode` | Y | marker `scoring_mode`, Q3 equivalent, or default | `dynamic` | N |
+| `max_iterations` | Y | flag `--iterations`, marker `max_iterations`, or default | `5` | N |
+
 **STATUS: ☐ BLOCKED**
 
 **🚨 SINGLE CONSOLIDATED PROMPT - ONE USER INTERACTION**
diff --git a/.opencode/specs/skilled-agent-orchestration/103-spec-kit-auto-mode-noninteractive-contract/002-auto-mode-contract-generalization-to-all-commands/evidence/codex-group3-dispatch.txt b/.opencode/specs/skilled-agent-orchestration/103-spec-kit-auto-mode-noninteractive-contract/002-auto-mode-contract-generalization-to-all-commands/evidence/codex-group3-dispatch.txt
new file mode 100644
index 0000000000000000000000000000000000000000..7e6ef3e8a96bfba57b2f7ecdc00069037bc57071
--- /dev/null
+++ b/.opencode/specs/skilled-agent-orchestration/103-spec-kit-auto-mode-noninteractive-contract/002-auto-mode-contract-generalization-to-all-commands/evidence/codex-group3-dispatch.txt
@@ -0,0 +1,12 @@
+# /improve:agent
+
+- Command file: `.opencode/commands/improve/agent.md`
+- Fields migrated count: 6
+- Fields migrated: `target_path`, `target_profile`, `spec_folder`, `execution_mode`, `scoring_mode`, `max_iterations`
+- Tier-2 candidates identified: `spec_folder`
+- `:confirm` consolidated Q-block preserved: yes
+- Argument hint updated: yes
+- Paired YAML assets touched: no
+- Concerns: `spec_folder` is the only Tier-2 candidate because the legacy Q1 asks the operator to choose a runtime location and no default exists. `target_path` absence stays Tier 3 because the command explicitly forbids inferring the target agent from context.
+
+EXIT_STATUS: complete
diff --git a/.opencode/specs/skilled-agent-orchestration/103-spec-kit-auto-mode-noninteractive-contract/002-auto-mode-contract-generalization-to-all-commands/tasks.md b/.opencode/specs/skilled-agent-orchestration/103-spec-kit-auto-mode-noninteractive-contract/002-auto-mode-contract-generalization-to-all-commands/tasks.md
index 5f7df6766aed7eb41b4e40081ff7c885a3683451..7ecf545cf0732b4ad7cc64de45cdf0113e23c61f
--- a/.opencode/specs/skilled-agent-orchestration/103-spec-kit-auto-mode-noninteractive-contract/002-auto-mode-contract-generalization-to-all-commands/tasks.md
+++ b/.opencode/specs/skilled-agent-orchestration/103-spec-kit-auto-mode-noninteractive-contract/002-auto-mode-contract-generalization-to-all-commands/tasks.md
@@ -10,8 +10,8 @@
     packet_pointer: ".opencode/specs/skilled-agent-orchestration/103-spec-kit-auto-mode-noninteractive-contract/002-auto-mode-contract-generalization-to-all-commands"
     last_updated_at: "2026-05-11T12:35:00Z"
     last_updated_by: "claude-opus-4-7"
-    recent_action: "Group 2 create commands migrated"
-    next_safe_action: "Dispatch group 3 improve command"
+    recent_action: "Group 3 improve command migrated"
+    next_safe_action: "Run live verification dispatches (Stage D)"
     blockers: []
     key_files: []
     session_dedup:
@@ -59,7 +59,7 @@
 
 - [x] T010 Codex group dispatch 1 (spec_kit/5): deep-research, complete, implement, plan, resume. Evidence: Group 1 codex dispatch completed; 5 commands migrated; see evidence/codex-group1-dispatch.txt
 - [x] T011 Codex group dispatch 2 (create/6): sk-skill, agent, changelog, feature-catalog, testing-playbook, folder_readme. Evidence: Group 2 codex dispatch completed; 5 commands migrated; see evidence/codex-group2-dispatch.txt
-- [ ] T012 Codex group dispatch 3 (improve/1): agent.
+- [x] T012 Codex group dispatch 3 (improve/1): agent. Evidence: Group 3 codex dispatch completed; 1 command migrated; see evidence/codex-group3-dispatch.txt
 - [ ] T013 Per-command read-back: confirm `:confirm` block untouched in all 11 migrated commands.
 <!-- /ANCHOR:phase-2 -->
 

diff --git a/.opencode/commands/improve/agent.md b/.opencode/commands/improve/agent.md
index f97b991ba5c0accdfc04eafd99e17db1351d8a8a..899b05445f45f65f64dc11de23380fbe4648266d
--- a/.opencode/commands/improve/agent.md
+++ b/.opencode/commands/improve/agent.md
@@ -1,6 +1,6 @@
 ---
 description: "Evaluate and improve any agent: 5 dimensions, proposals, scoring, guarded promotion. :auto/:confirm."
-argument-hint: "<agent_path> [:auto|:confirm] [--spec-folder=PATH] [--iterations=N]"
+argument-hint: "<agent_path> [:auto|:confirm] [--spec-folder=PATH] [--iterations=N] (:auto supports PRE-BOUND SETUP ANSWERS: prompt-body block for non-interactive setup)"
 allowed-tools: Read, Write, Edit, Bash, Grep, Glob, Task
 ---
 
@@ -60,6 +60,51 @@
 
 # 🔒 UNIFIED SETUP PHASE
 
+**FIRST MESSAGE PROTOCOL**: For `:confirm` or no suffix, the consolidated setup prompt MUST be your FIRST response. No implementation or file-modifying tool calls before asking. Lightweight read-only discovery to suggest a spec folder or load prior context is allowed, then ask ALL questions immediately and wait.
+
+For `:auto`, do not emit the consolidated prompt by default. Resolve setup with the three-tier branch below, then load the auto YAML only after all required values are bound.
+
+### `:auto` Setup Resolution
+
+Setup contract: see `.opencode/skills/system-spec-kit/references/workflows/auto_mode_contract.md`.
+
+Under `execution_mode = AUTONOMOUS` (from the `:auto` suffix), follow the three-tier flow:
+
+1. **Tier 1 — Resolve confidently** (contract §1): parse `$ARGUMENTS` flags + `PRE-BOUND SETUP ANSWERS:` block (§2) + the Default Resolution Table below (§3). When every required field is resolved, persist to `{spec_folder}/improvement/agent-improvement-config.json` (shape: `targetPath`, `targetProfile`, `specFolder`, `executionMode: "auto"`, `scoringMode`, `maxIterations`, `agentName`), bind runtime YAML placeholders, set `STATUS: PASSED`, load `.opencode/commands/improve/assets/improve_deep-agent-improvement_auto.yaml`. End §0.
+
+2. **Tier 2 — Targeted ask** (contract §1): when 1-2 required fields are genuinely ambiguous AND no default exists, emit ONE narrow question per ambiguous field. Command-specific Tier-2-eligible fields (per the Default Resolution Table below): `spec_folder`. **Ordering rule**: none needed; `target_path` absence is missing input, not ambiguity, and goes to Tier 3.
+
+3. **Tier 3 — Fail fast** (contract §4): emit the named-missing-inputs error format with `/improve:agent:auto` as the command name. Exit non-zero. Do not load YAML.
+
+`:confirm` path stays unchanged — see the consolidated setup prompt section below.
+
+### PRE-BOUND SETUP ANSWERS Schema (for `:auto` non-interactive dispatch)
+
+The dispatched prompt body may contain one structured marker block. Parse it before applying defaults. Grammar: see `auto_mode_contract.md` §2.
+
+```yaml
+PRE-BOUND SETUP ANSWERS:
+  target_path: .opencode/agents/debug.md  # required path matching .opencode/agents/*.md
+  target_profile: dynamic  # optional; one of: handover | context-prime | dynamic; derived from target_path when omitted
+  spec_folder: specs/041/008  # required spec folder path or explicit runtime folder
+  execution_mode: AUTONOMOUS  # from :auto suffix
+  scoring_mode: dynamic  # dynamic is the current supported scoring mode
+  max_iterations: 5  # positive integer
+```
+
+Rules: see `auto_mode_contract.md` §2 (unspecified fields fall back to default; marker fields take precedence over $ARGUMENTS flags; unknown fields warn; malformed lines parse-error).
+
+### Default Resolution Table
+
+| Field | Required | Resolves Via | Default | Tier-2 Candidate |
+|-------|----------|--------------|---------|------------------|
+| `target_path` | Y | `$ARGUMENTS` agent path, or marker `target_path` | none | N |
+| `target_profile` | Y | marker `target_profile`, or auto-detect from `target_path` (`handover` -> `handover`, `context-prime` -> `context-prime`, otherwise `dynamic`) | inferred from `target_path` | N |
+| `spec_folder` | Y | flag `--spec-folder`, marker `spec_folder`, or requires-ask | none | Y |
+| `execution_mode` | Y | attached suffix `:auto` or marker `execution_mode` | `AUTONOMOUS` under `:auto` | N |
+| `scoring_mode` | Y | marker `scoring_mode`, Q3 equivalent, or default | `dynamic` | N |
+| `max_iterations` | Y | flag `--iterations`, marker `max_iterations`, or default | `5` | N |
+
 **STATUS: ☐ BLOCKED**
 
 **🚨 SINGLE CONSOLIDATED PROMPT - ONE USER INTERACTION**
diff --git a/.opencode/specs/skilled-agent-orchestration/103-spec-kit-auto-mode-noninteractive-contract/002-auto-mode-contract-generalization-to-all-commands/evidence/codex-group3-dispatch.txt b/.opencode/specs/skilled-agent-orchestration/103-spec-kit-auto-mode-noninteractive-contract/002-auto-mode-contract-generalization-to-all-commands/evidence/codex-group3-dispatch.txt
new file mode 100644
index 0000000000000000000000000000000000000000..7e6ef3e8a96bfba57b2f7ecdc00069037bc57071
--- /dev/null
+++ b/.opencode/specs/skilled-agent-orchestration/103-spec-kit-auto-mode-noninteractive-contract/002-auto-mode-contract-generalization-to-all-commands/evidence/codex-group3-dispatch.txt
@@ -0,0 +1,12 @@
+# /improve:agent
+
+- Command file: `.opencode/commands/improve/agent.md`
+- Fields migrated count: 6
+- Fields migrated: `target_path`, `target_profile`, `spec_folder`, `execution_mode`, `scoring_mode`, `max_iterations`
+- Tier-2 candidates identified: `spec_folder`
+- `:confirm` consolidated Q-block preserved: yes
+- Argument hint updated: yes
+- Paired YAML assets touched: no
+- Concerns: `spec_folder` is the only Tier-2 candidate because the legacy Q1 asks the operator to choose a runtime location and no default exists. `target_path` absence stays Tier 3 because the command explicitly forbids inferring the target agent from context.
+
+EXIT_STATUS: complete
diff --git a/.opencode/specs/skilled-agent-orchestration/103-spec-kit-auto-mode-noninteractive-contract/002-auto-mode-contract-generalization-to-all-commands/tasks.md b/.opencode/specs/skilled-agent-orchestration/103-spec-kit-auto-mode-noninteractive-contract/002-auto-mode-contract-generalization-to-all-commands/tasks.md
index 5f7df6766aed7eb41b4e40081ff7c885a3683451..7ecf545cf0732b4ad7cc64de45cdf0113e23c61f
--- a/.opencode/specs/skilled-agent-orchestration/103-spec-kit-auto-mode-noninteractive-contract/002-auto-mode-contract-generalization-to-all-commands/tasks.md
+++ b/.opencode/specs/skilled-agent-orchestration/103-spec-kit-auto-mode-noninteractive-contract/002-auto-mode-contract-generalization-to-all-commands/tasks.md
@@ -10,8 +10,8 @@
     packet_pointer: ".opencode/specs/skilled-agent-orchestration/103-spec-kit-auto-mode-noninteractive-contract/002-auto-mode-contract-generalization-to-all-commands"
     last_updated_at: "2026-05-11T12:35:00Z"
     last_updated_by: "claude-opus-4-7"
-    recent_action: "Group 2 create commands migrated"
-    next_safe_action: "Dispatch group 3 improve command"
+    recent_action: "Group 3 improve command migrated"
+    next_safe_action: "Run live verification dispatches (Stage D)"
     blockers: []
     key_files: []
     session_dedup:
@@ -59,7 +59,7 @@
 
 - [x] T010 Codex group dispatch 1 (spec_kit/5): deep-research, complete, implement, plan, resume. Evidence: Group 1 codex dispatch completed; 5 commands migrated; see evidence/codex-group1-dispatch.txt
 - [x] T011 Codex group dispatch 2 (create/6): sk-skill, agent, changelog, feature-catalog, testing-playbook, folder_readme. Evidence: Group 2 codex dispatch completed; 5 commands migrated; see evidence/codex-group2-dispatch.txt
-- [ ] T012 Codex group dispatch 3 (improve/1): agent.
+- [x] T012 Codex group dispatch 3 (improve/1): agent. Evidence: Group 3 codex dispatch completed; 1 command migrated; see evidence/codex-group3-dispatch.txt
 - [ ] T013 Per-command read-back: confirm `:confirm` block untouched in all 11 migrated commands.
 <!-- /ANCHOR:phase-2 -->
 

exec
/bin/zsh -lc "sed -n '1,40p' .opencode/specs/skilled-agent-orchestration/103-spec-kit-auto-mode-noninteractive-contract/002-auto-mode-contract-generalization-to-all-commands/evidence/codex-group3-dispatch.txt" in /Users/michelkerkmeester/MEGA/Development/Code_Environment/Public
 succeeded in 0ms:
# /improve:agent

- Command file: `.opencode/commands/improve/agent.md`
- Fields migrated count: 6
- Fields migrated: `target_path`, `target_profile`, `spec_folder`, `execution_mode`, `scoring_mode`, `max_iterations`
- Tier-2 candidates identified: `spec_folder`
- `:confirm` consolidated Q-block preserved: yes
- Argument hint updated: yes
- Paired YAML assets touched: no
- Concerns: `spec_folder` is the only Tier-2 candidate because the legacy Q1 asks the operator to choose a runtime location and no default exists. `target_path` absence stays Tier 3 because the command explicitly forbids inferring the target agent from context.

EXIT_STATUS: complete

exec
/bin/zsh -lc 'git diff --check -- .opencode/commands/improve/agent.md .opencode/specs/skilled-agent-orchestration/103-spec-kit-auto-mode-noninteractive-contract/002-auto-mode-contract-generalization-to-all-commands/tasks.md .opencode/specs/skilled-agent-orchestration/103-spec-kit-auto-mode-noninteractive-contract/002-auto-mode-contract-generalization-to-all-commands/evidence/codex-group3-dispatch.txt' in /Users/michelkerkmeester/MEGA/Development/Code_Environment/Public
 succeeded in 0ms:
exec
/bin/zsh -lc 'git status --short -- .opencode/commands/improve/agent.md .opencode/specs/skilled-agent-orchestration/103-spec-kit-auto-mode-noninteractive-contract/002-auto-mode-contract-generalization-to-all-commands/tasks.md .opencode/specs/skilled-agent-orchestration/103-spec-kit-auto-mode-noninteractive-contract/002-auto-mode-contract-generalization-to-all-commands/evidence/codex-group3-dispatch.txt .opencode/commands/improve/assets/improve_deep-agent-improvement_auto.yaml .opencode/commands/improve/assets/improve_deep-agent-improvement_confirm.yaml' in /Users/michelkerkmeester/MEGA/Development/Code_Environment/Public
 succeeded in 0ms:
 M .opencode/commands/improve/agent.md
 M .opencode/specs/skilled-agent-orchestration/103-spec-kit-auto-mode-noninteractive-contract/002-auto-mode-contract-generalization-to-all-commands/tasks.md
?? .opencode/specs/skilled-agent-orchestration/103-spec-kit-auto-mode-noninteractive-contract/002-auto-mode-contract-generalization-to-all-commands/evidence/codex-group3-dispatch.txt

diff --git a/.opencode/commands/improve/agent.md b/.opencode/commands/improve/agent.md
index f97b991ba5c0accdfc04eafd99e17db1351d8a8a..899b05445f45f65f64dc11de23380fbe4648266d
--- a/.opencode/commands/improve/agent.md
+++ b/.opencode/commands/improve/agent.md
@@ -1,6 +1,6 @@
 ---
 description: "Evaluate and improve any agent: 5 dimensions, proposals, scoring, guarded promotion. :auto/:confirm."
-argument-hint: "<agent_path> [:auto|:confirm] [--spec-folder=PATH] [--iterations=N]"
+argument-hint: "<agent_path> [:auto|:confirm] [--spec-folder=PATH] [--iterations=N] (:auto supports PRE-BOUND SETUP ANSWERS: prompt-body block for non-interactive setup)"
 allowed-tools: Read, Write, Edit, Bash, Grep, Glob, Task
 ---
 
@@ -60,6 +60,51 @@
 
 # 🔒 UNIFIED SETUP PHASE
 
+**FIRST MESSAGE PROTOCOL**: For `:confirm` or no suffix, the consolidated setup prompt MUST be your FIRST response. No implementation or file-modifying tool calls before asking. Lightweight read-only discovery to suggest a spec folder or load prior context is allowed, then ask ALL questions immediately and wait.
+
+For `:auto`, do not emit the consolidated prompt by default. Resolve setup with the three-tier branch below, then load the auto YAML only after all required values are bound.
+
+### `:auto` Setup Resolution
+
+Setup contract: see `.opencode/skills/system-spec-kit/references/workflows/auto_mode_contract.md`.
+
+Under `execution_mode = AUTONOMOUS` (from the `:auto` suffix), follow the three-tier flow:
+
+1. **Tier 1 — Resolve confidently** (contract §1): parse `$ARGUMENTS` flags + `PRE-BOUND SETUP ANSWERS:` block (§2) + the Default Resolution Table below (§3). When every required field is resolved, persist to `{spec_folder}/improvement/agent-improvement-config.json` (shape: `targetPath`, `targetProfile`, `specFolder`, `executionMode: "auto"`, `scoringMode`, `maxIterations`, `agentName`), bind runtime YAML placeholders, set `STATUS: PASSED`, load `.opencode/commands/improve/assets/improve_deep-agent-improvement_auto.yaml`. End §0.
+
+2. **Tier 2 — Targeted ask** (contract §1): when 1-2 required fields are genuinely ambiguous AND no default exists, emit ONE narrow question per ambiguous field. Command-specific Tier-2-eligible fields (per the Default Resolution Table below): `spec_folder`. **Ordering rule**: none needed; `target_path` absence is missing input, not ambiguity, and goes to Tier 3.
+
+3. **Tier 3 — Fail fast** (contract §4): emit the named-missing-inputs error format with `/improve:agent:auto` as the command name. Exit non-zero. Do not load YAML.
+
+`:confirm` path stays unchanged — see the consolidated setup prompt section below.
+
+### PRE-BOUND SETUP ANSWERS Schema (for `:auto` non-interactive dispatch)
+
+The dispatched prompt body may contain one structured marker block. Parse it before applying defaults. Grammar: see `auto_mode_contract.md` §2.
+
+```yaml
+PRE-BOUND SETUP ANSWERS:
+  target_path: .opencode/agents/debug.md  # required path matching .opencode/agents/*.md
+  target_profile: dynamic  # optional; one of: handover | context-prime | dynamic; derived from target_path when omitted
+  spec_folder: specs/041/008  # required spec folder path or explicit runtime folder
+  execution_mode: AUTONOMOUS  # from :auto suffix
+  scoring_mode: dynamic  # dynamic is the current supported scoring mode
+  max_iterations: 5  # positive integer
+```
+
+Rules: see `auto_mode_contract.md` §2 (unspecified fields fall back to default; marker fields take precedence over $ARGUMENTS flags; unknown fields warn; malformed lines parse-error).
+
+### Default Resolution Table
+
+| Field | Required | Resolves Via | Default | Tier-2 Candidate |
+|-------|----------|--------------|---------|------------------|
+| `target_path` | Y | `$ARGUMENTS` agent path, or marker `target_path` | none | N |
+| `target_profile` | Y | marker `target_profile`, or auto-detect from `target_path` (`handover` -> `handover`, `context-prime` -> `context-prime`, otherwise `dynamic`) | inferred from `target_path` | N |
+| `spec_folder` | Y | flag `--spec-folder`, marker `spec_folder`, or requires-ask | none | Y |
+| `execution_mode` | Y | attached suffix `:auto` or marker `execution_mode` | `AUTONOMOUS` under `:auto` | N |
+| `scoring_mode` | Y | marker `scoring_mode`, Q3 equivalent, or default | `dynamic` | N |
+| `max_iterations` | Y | flag `--iterations`, marker `max_iterations`, or default | `5` | N |
+
 **STATUS: ☐ BLOCKED**
 
 **🚨 SINGLE CONSOLIDATED PROMPT - ONE USER INTERACTION**
diff --git a/.opencode/specs/skilled-agent-orchestration/103-spec-kit-auto-mode-noninteractive-contract/002-auto-mode-contract-generalization-to-all-commands/evidence/codex-group3-dispatch.txt b/.opencode/specs/skilled-agent-orchestration/103-spec-kit-auto-mode-noninteractive-contract/002-auto-mode-contract-generalization-to-all-commands/evidence/codex-group3-dispatch.txt
new file mode 100644
index 0000000000000000000000000000000000000000..7e6ef3e8a96bfba57b2f7ecdc00069037bc57071
--- /dev/null
+++ b/.opencode/specs/skilled-agent-orchestration/103-spec-kit-auto-mode-noninteractive-contract/002-auto-mode-contract-generalization-to-all-commands/evidence/codex-group3-dispatch.txt
@@ -0,0 +1,12 @@
+# /improve:agent
+
+- Command file: `.opencode/commands/improve/agent.md`
+- Fields migrated count: 6
+- Fields migrated: `target_path`, `target_profile`, `spec_folder`, `execution_mode`, `scoring_mode`, `max_iterations`
+- Tier-2 candidates identified: `spec_folder`
+- `:confirm` consolidated Q-block preserved: yes
+- Argument hint updated: yes
+- Paired YAML assets touched: no
+- Concerns: `spec_folder` is the only Tier-2 candidate because the legacy Q1 asks the operator to choose a runtime location and no default exists. `target_path` absence stays Tier 3 because the command explicitly forbids inferring the target agent from context.
+
+EXIT_STATUS: complete
diff --git a/.opencode/specs/skilled-agent-orchestration/103-spec-kit-auto-mode-noninteractive-contract/002-auto-mode-contract-generalization-to-all-commands/tasks.md b/.opencode/specs/skilled-agent-orchestration/103-spec-kit-auto-mode-noninteractive-contract/002-auto-mode-contract-generalization-to-all-commands/tasks.md
index 5f7df6766aed7eb41b4e40081ff7c885a3683451..7ecf545cf0732b4ad7cc64de45cdf0113e23c61f
--- a/.opencode/specs/skilled-agent-orchestration/103-spec-kit-auto-mode-noninteractive-contract/002-auto-mode-contract-generalization-to-all-commands/tasks.md
+++ b/.opencode/specs/skilled-agent-orchestration/103-spec-kit-auto-mode-noninteractive-contract/002-auto-mode-contract-generalization-to-all-commands/tasks.md
@@ -10,8 +10,8 @@
     packet_pointer: ".opencode/specs/skilled-agent-orchestration/103-spec-kit-auto-mode-noninteractive-contract/002-auto-mode-contract-generalization-to-all-commands"
     last_updated_at: "2026-05-11T12:35:00Z"
     last_updated_by: "claude-opus-4-7"
-    recent_action: "Group 2 create commands migrated"
-    next_safe_action: "Dispatch group 3 improve command"
+    recent_action: "Group 3 improve command migrated"
+    next_safe_action: "Run live verification dispatches (Stage D)"
     blockers: []
     key_files: []
     session_dedup:
@@ -59,7 +59,7 @@
 
 - [x] T010 Codex group dispatch 1 (spec_kit/5): deep-research, complete, implement, plan, resume. Evidence: Group 1 codex dispatch completed; 5 commands migrated; see evidence/codex-group1-dispatch.txt
 - [x] T011 Codex group dispatch 2 (create/6): sk-skill, agent, changelog, feature-catalog, testing-playbook, folder_readme. Evidence: Group 2 codex dispatch completed; 5 commands migrated; see evidence/codex-group2-dispatch.txt
-- [ ] T012 Codex group dispatch 3 (improve/1): agent.
+- [x] T012 Codex group dispatch 3 (improve/1): agent. Evidence: Group 3 codex dispatch completed; 1 command migrated; see evidence/codex-group3-dispatch.txt
 - [ ] T013 Per-command read-back: confirm `:confirm` block untouched in all 11 migrated commands.
 <!-- /ANCHOR:phase-2 -->
 

codex
**Files Modified**
- `.opencode/commands/improve/agent.md`
- `.opencode/specs/skilled-agent-orchestration/103-spec-kit-auto-mode-noninteractive-contract/002-auto-mode-contract-generalization-to-all-commands/tasks.md`
- `.opencode/specs/skilled-agent-orchestration/103-spec-kit-auto-mode-noninteractive-contract/002-auto-mode-contract-generalization-to-all-commands/evidence/codex-group3-dispatch.txt`

**Per-Command Status**
- `/improve:agent`: 6 fields migrated | Tier-2 candidates: `spec_folder` | `:confirm` preserved: yes | argument-hint updated: yes

**Decisions**
- Used the actual paired YAML path: `.opencode/commands/improve/assets/improve_deep-agent-improvement_auto.yaml`.
- Counted migrated fields as `target_path`, `target_profile`, `spec_folder`, `execution_mode`, `scoring_mode`, `max_iterations`.
- Classified `spec_folder` as the only Tier-2 candidate; `target_path` absence remains Tier 3 because the command forbids inference.
- Wrote T012 evidence as “1 command migrated” rather than the prompt’s parenthetical “5 commands,” because Group 3 scope is explicitly improve/1.

**Concerns**
- No YAML assets were touched.
- No live `:auto` dispatch was run, per instruction. `git diff --check` passed.
diff --git a/.opencode/commands/improve/agent.md b/.opencode/commands/improve/agent.md
index f97b991ba5c0accdfc04eafd99e17db1351d8a8a..899b05445f45f65f64dc11de23380fbe4648266d
--- a/.opencode/commands/improve/agent.md
+++ b/.opencode/commands/improve/agent.md
@@ -1,6 +1,6 @@
 ---
 description: "Evaluate and improve any agent: 5 dimensions, proposals, scoring, guarded promotion. :auto/:confirm."
-argument-hint: "<agent_path> [:auto|:confirm] [--spec-folder=PATH] [--iterations=N]"
+argument-hint: "<agent_path> [:auto|:confirm] [--spec-folder=PATH] [--iterations=N] (:auto supports PRE-BOUND SETUP ANSWERS: prompt-body block for non-interactive setup)"
 allowed-tools: Read, Write, Edit, Bash, Grep, Glob, Task
 ---
 
@@ -60,6 +60,51 @@
 
 # 🔒 UNIFIED SETUP PHASE
 
+**FIRST MESSAGE PROTOCOL**: For `:confirm` or no suffix, the consolidated setup prompt MUST be your FIRST response. No implementation or file-modifying tool calls before asking. Lightweight read-only discovery to suggest a spec folder or load prior context is allowed, then ask ALL questions immediately and wait.
+
+For `:auto`, do not emit the consolidated prompt by default. Resolve setup with the three-tier branch below, then load the auto YAML only after all required values are bound.
+
+### `:auto` Setup Resolution
+
+Setup contract: see `.opencode/skills/system-spec-kit/references/workflows/auto_mode_contract.md`.
+
+Under `execution_mode = AUTONOMOUS` (from the `:auto` suffix), follow the three-tier flow:
+
+1. **Tier 1 — Resolve confidently** (contract §1): parse `$ARGUMENTS` flags + `PRE-BOUND SETUP ANSWERS:` block (§2) + the Default Resolution Table below (§3). When every required field is resolved, persist to `{spec_folder}/improvement/agent-improvement-config.json` (shape: `targetPath`, `targetProfile`, `specFolder`, `executionMode: "auto"`, `scoringMode`, `maxIterations`, `agentName`), bind runtime YAML placeholders, set `STATUS: PASSED`, load `.opencode/commands/improve/assets/improve_deep-agent-improvement_auto.yaml`. End §0.
+
+2. **Tier 2 — Targeted ask** (contract §1): when 1-2 required fields are genuinely ambiguous AND no default exists, emit ONE narrow question per ambiguous field. Command-specific Tier-2-eligible fields (per the Default Resolution Table below): `spec_folder`. **Ordering rule**: none needed; `target_path` absence is missing input, not ambiguity, and goes to Tier 3.
+
+3. **Tier 3 — Fail fast** (contract §4): emit the named-missing-inputs error format with `/improve:agent:auto` as the command name. Exit non-zero. Do not load YAML.
+
+`:confirm` path stays unchanged — see the consolidated setup prompt section below.
+
+### PRE-BOUND SETUP ANSWERS Schema (for `:auto` non-interactive dispatch)
+
+The dispatched prompt body may contain one structured marker block. Parse it before applying defaults. Grammar: see `auto_mode_contract.md` §2.
+
+```yaml
+PRE-BOUND SETUP ANSWERS:
+  target_path: .opencode/agents/debug.md  # required path matching .opencode/agents/*.md
+  target_profile: dynamic  # optional; one of: handover | context-prime | dynamic; derived from target_path when omitted
+  spec_folder: specs/041/008  # required spec folder path or explicit runtime folder
+  execution_mode: AUTONOMOUS  # from :auto suffix
+  scoring_mode: dynamic  # dynamic is the current supported scoring mode
+  max_iterations: 5  # positive integer
+```
+
+Rules: see `auto_mode_contract.md` §2 (unspecified fields fall back to default; marker fields take precedence over $ARGUMENTS flags; unknown fields warn; malformed lines parse-error).
+
+### Default Resolution Table
+
+| Field | Required | Resolves Via | Default | Tier-2 Candidate |
+|-------|----------|--------------|---------|------------------|
+| `target_path` | Y | `$ARGUMENTS` agent path, or marker `target_path` | none | N |
+| `target_profile` | Y | marker `target_profile`, or auto-detect from `target_path` (`handover` -> `handover`, `context-prime` -> `context-prime`, otherwise `dynamic`) | inferred from `target_path` | N |
+| `spec_folder` | Y | flag `--spec-folder`, marker `spec_folder`, or requires-ask | none | Y |
+| `execution_mode` | Y | attached suffix `:auto` or marker `execution_mode` | `AUTONOMOUS` under `:auto` | N |
+| `scoring_mode` | Y | marker `scoring_mode`, Q3 equivalent, or default | `dynamic` | N |
+| `max_iterations` | Y | flag `--iterations`, marker `max_iterations`, or default | `5` | N |
+
 **STATUS: ☐ BLOCKED**
 
 **🚨 SINGLE CONSOLIDATED PROMPT - ONE USER INTERACTION**
diff --git a/.opencode/specs/skilled-agent-orchestration/103-spec-kit-auto-mode-noninteractive-contract/002-auto-mode-contract-generalization-to-all-commands/evidence/codex-group3-dispatch.txt b/.opencode/specs/skilled-agent-orchestration/103-spec-kit-auto-mode-noninteractive-contract/002-auto-mode-contract-generalization-to-all-commands/evidence/codex-group3-dispatch.txt
new file mode 100644
index 0000000000000000000000000000000000000000..7e6ef3e8a96bfba57b2f7ecdc00069037bc57071
--- /dev/null
+++ b/.opencode/specs/skilled-agent-orchestration/103-spec-kit-auto-mode-noninteractive-contract/002-auto-mode-contract-generalization-to-all-commands/evidence/codex-group3-dispatch.txt
@@ -0,0 +1,12 @@
+# /improve:agent
+
+- Command file: `.opencode/commands/improve/agent.md`
+- Fields migrated count: 6
+- Fields migrated: `target_path`, `target_profile`, `spec_folder`, `execution_mode`, `scoring_mode`, `max_iterations`
+- Tier-2 candidates identified: `spec_folder`
+- `:confirm` consolidated Q-block preserved: yes
+- Argument hint updated: yes
+- Paired YAML assets touched: no
+- Concerns: `spec_folder` is the only Tier-2 candidate because the legacy Q1 asks the operator to choose a runtime location and no default exists. `target_path` absence stays Tier 3 because the command explicitly forbids inferring the target agent from context.
+
+EXIT_STATUS: complete
diff --git a/.opencode/specs/skilled-agent-orchestration/103-spec-kit-auto-mode-noninteractive-contract/002-auto-mode-contract-generalization-to-all-commands/tasks.md b/.opencode/specs/skilled-agent-orchestration/103-spec-kit-auto-mode-noninteractive-contract/002-auto-mode-contract-generalization-to-all-commands/tasks.md
index 5f7df6766aed7eb41b4e40081ff7c885a3683451..7ecf545cf0732b4ad7cc64de45cdf0113e23c61f
--- a/.opencode/specs/skilled-agent-orchestration/103-spec-kit-auto-mode-noninteractive-contract/002-auto-mode-contract-generalization-to-all-commands/tasks.md
+++ b/.opencode/specs/skilled-agent-orchestration/103-spec-kit-auto-mode-noninteractive-contract/002-auto-mode-contract-generalization-to-all-commands/tasks.md
@@ -10,8 +10,8 @@
     packet_pointer: ".opencode/specs/skilled-agent-orchestration/103-spec-kit-auto-mode-noninteractive-contract/002-auto-mode-contract-generalization-to-all-commands"
     last_updated_at: "2026-05-11T12:35:00Z"
     last_updated_by: "claude-opus-4-7"
-    recent_action: "Group 2 create commands migrated"
-    next_safe_action: "Dispatch group 3 improve command"
+    recent_action: "Group 3 improve command migrated"
+    next_safe_action: "Run live verification dispatches (Stage D)"
     blockers: []
     key_files: []
     session_dedup:
@@ -59,7 +59,7 @@
 
 - [x] T010 Codex group dispatch 1 (spec_kit/5): deep-research, complete, implement, plan, resume. Evidence: Group 1 codex dispatch completed; 5 commands migrated; see evidence/codex-group1-dispatch.txt
 - [x] T011 Codex group dispatch 2 (create/6): sk-skill, agent, changelog, feature-catalog, testing-playbook, folder_readme. Evidence: Group 2 codex dispatch completed; 5 commands migrated; see evidence/codex-group2-dispatch.txt
-- [ ] T012 Codex group dispatch 3 (improve/1): agent.
+- [x] T012 Codex group dispatch 3 (improve/1): agent. Evidence: Group 3 codex dispatch completed; 1 command migrated; see evidence/codex-group3-dispatch.txt
 - [ ] T013 Per-command read-back: confirm `:confirm` block untouched in all 11 migrated commands.
 <!-- /ANCHOR:phase-2 -->
 

hook: Stop
hook: Stop Completed
tokens used
91,980
**Files Modified**
- `.opencode/commands/improve/agent.md`
- `.opencode/specs/skilled-agent-orchestration/103-spec-kit-auto-mode-noninteractive-contract/002-auto-mode-contract-generalization-to-all-commands/tasks.md`
- `.opencode/specs/skilled-agent-orchestration/103-spec-kit-auto-mode-noninteractive-contract/002-auto-mode-contract-generalization-to-all-commands/evidence/codex-group3-dispatch.txt`

**Per-Command Status**
- `/improve:agent`: 6 fields migrated | Tier-2 candidates: `spec_folder` | `:confirm` preserved: yes | argument-hint updated: yes

**Decisions**
- Used the actual paired YAML path: `.opencode/commands/improve/assets/improve_deep-agent-improvement_auto.yaml`.
- Counted migrated fields as `target_path`, `target_profile`, `spec_folder`, `execution_mode`, `scoring_mode`, `max_iterations`.
- Classified `spec_folder` as the only Tier-2 candidate; `target_path` absence remains Tier 3 because the command forbids inference.
- Wrote T012 evidence as “1 command migrated” rather than the prompt’s parenthetical “5 commands,” because Group 3 scope is explicitly improve/1.

**Concerns**
- No YAML assets were touched.
- No live `:auto` dispatch was run, per instruction. `git diff --check` passed.

=== EXIT 0; WALL 166s ===
