{
  "objective": "Implement one authorized package change with independent command-backed validation after the worker.",
  "library": {
    "sources": [
      "package"
    ]
  },
  "authority": {
    "allowFilesystemRead": true,
    "allowShellTools": true,
    "allowMutationTools": true
  },
  "steps": [
    {
      "id": "scope-map",
      "agent": {
        "ref": "package:scout"
      },
      "task": "Map the concrete implementation scope, canonical owners, affected docs/tests/examples, and validation obligations copied by the parent. Do not run commands or edit. If no concrete delegated question, affected surface, stop condition, or expected output fields were copied in, return NEEDS-SCOPE without broad repo search."
    },
    {
      "id": "implementation-plan",
      "agent": {
        "ref": "package:planner"
      },
      "needs": [
        "scope-map"
      ],
      "task": "Design the smallest coherent change with owners, schemas, failure modes, tests, docs, command validation scope, exclusions, and validation proof expectations. Do not edit. Return BLOCK if evidence or authorization is missing."
    },
    {
      "id": "premortem",
      "agent": {
        "ref": "package:critic"
      },
      "needs": [
        "implementation-plan"
      ],
      "task": "Stress-test the implementation plan for coupling, trust, concurrency, data loss, stale docs, high-authority tool exposure, and missing proof. Do not edit or run commands. Return blockers, falsifying checks, and risk decision."
    },
    {
      "id": "implementation-worker",
      "agent": {
        "ref": "package:worker"
      },
      "needs": [
        "premortem"
      ],
      "mutationScope": "REPLACE before start. Allowed files/globs: <exact package paths>. Allowed mutation class: <specific implementation edit type>. Explicit exclusions: <paths/actions not allowed>. Validation commands authorized for worker, if any: <exact commands or none>. Stop if broader than current parent authorization. mutationScope is not a sandbox; bash/edit/write are not path-confined, so stop rather than touch anything outside this authorization.",
      "task": "Use the premortem as evidence to verify before editing. If it reports BLOCK, NO-GO, an unresolved mandatory condition, a needed human approval checkpoint, or a scope/authority risk that this task and mutationScope do not explicitly resolve, do not edit; return the blocker and needed decision. If mutationScope is still a placeholder, missing, or broader than the exact parent authorization, do not edit. Otherwise implement only that authorized change across synchronized runtime, tests, docs, examples, and fixtures. Keep ownership narrow and return changed paths plus any worker-side validation commands run."
    },
    {
      "id": "validation-proof",
      "agent": {
        "ref": "package:validator"
      },
      "needs": [
        "implementation-worker"
      ],
      "task": "Validation command scope copied by parent: REPLACE_WITH_EXACT_POST_WORKER_VALIDATION_COMMANDS. Run only those commands. If this placeholder remains, no commands are present, or scope is implied only by upstream evidence, return needs-command-scope without running commands. Do not edit, install, publish, deploy, commit, tag, push, delete files, or infer extra validation from the worker. Return pass/fail/deferred with exact command, cwd, important output, and failure bucket."
    },
    {
      "id": "post-work-review",
      "agent": {
        "ref": "package:reviewer"
      },
      "needs": [
        "validation-proof"
      ],
      "task": "Review the completed worker evidence and independent validation-proof output. Do not run commands or edit. Return findings first, including any mismatch between worker claims and observed validation. Separate inherited failures from new failures and return ship/block recommendation."
    },
    {
      "id": "final-decision",
      "agent": {
        "ref": "package:synthesizer"
      },
      "after": [
        "scope-map",
        "implementation-plan",
        "premortem",
        "implementation-worker",
        "validation-proof",
        "post-work-review"
      ],
      "task": "Produce final status, changed paths, observed validation, blockers, residual risk, and exact next action after all lanes terminalize, including failed or blocked lane evidence. Do not invent validation or claim commands were run when validation-proof returned needs-command-scope."
    }
  ],
  "limits": {
    "concurrency": 1,
    "timeoutSecondsPerStep": 9000
  }
}
