You are already running inside the megaplan harness for this step. Do the requested planning/review/execution work directly. Do NOT invoke the megaplan CLI, do NOT read or activate the megaplan skill, do NOT start nested megaplan plans, and do NOT recurse into another planning harness. Treat mentions of megaplan in the repository or environment as implementation context only.
WRITE ACCESS CONTRACT: You are running with auto-approved writes inside a writable workspace. Treat the working directory as fully writable. Do NOT preemptively skip or block tasks on permission, sandbox, or read-only grounds. Attempt every required edit; only report failure AFTER a real OS-level rejection from a specific shell command. Do not infer 'read-only' from absence of activity; absence is not denial. If a single shell command unexpectedly fails, retry with a different invocation before concluding the environment is restricted.
You are preparing an execution-ready briefing document from the approved plan.
Implement Phase 8 (Inbox surface) of the ArtAgents orchestrator V1 design per docs/orchestrator-v1-plan.md section 12 (Phase 8).
LAUNCHER: every megaplan call = PYENV_VERSION=3.11.11 python -m megaplan ....
DRIVING DISCIPLINE: After every CLI call, run megaplan status --plan <name> and megaplan progress --plan <name>. If state == finalized and batches_remaining > 0, you MUST run megaplan execute --plan <name> --confirm-destructive --batch N for each remaining batch sequentially. DO NOT EXIT while state != done.
Finalize document produced. 11 tasks (T1–T11), 11 sense-checks, no user_actions required (Phase 8 is purely repo-internal). All 5 flags from the gate (FLAG-P8-001 through P8-005) are mapped into watch_items, task descriptions, and meta_commentary so the executor will not lose them mid-implementation. Coverage validation: complete, all 7 plan steps mapped.
scan_inbox(run_dir) -> list[InboxEntry] — reads, validates, returns parsed entries. Malformed files are logged and skipped, not raised.
consume_inbox_entry(run_dir, entry) -> EventRecord — validates the entry against the current step expectations, writes a hash-chained event, then moves the inbox file to <run_dir>/inbox/.consumed/<hash> (or deletes — pick one and document it).
Hook into lifecycle handlers:
artagents next: scans inbox before computing next step. If the inbox has a valid entry for the current attested step, consume it (record event), then advance the cursor.
artagents status: scans inbox in read-only mode and surfaces "X inbox entries pending" in output.
artagents ack: not changed (ack is the explicit verb; inbox is the implicit signal channel).
Tests:
tests/test_inbox_scan.py: drops 3 valid + 1 malformed file, scan returns 3 valid entries and ignores the malformed one without raising.
tests/test_inbox_consume.py: full flow — attested step waits, drop a valid inbox entry, call next, assert event is recorded and cursor advances.
tests/test_inbox_stale.py: drop an entry referencing a step_id that doesn't match current step, assert it's ignored (logged, not consumed).
runs/<run-id>/AGENT.md template should mention the inbox surface for human/external operators.
CONSTRAINTS:
Stay within Phase 8 scope. Do NOT touch Phase 9 golden tests.
Additive only. Existing tests must continue to pass.
No new dependencies.
Inbox is opt-in: presence of inbox/ directory triggers scanning, absence skips it.
STOP CONDITION: Phase 8 done when pytest tests/ passes with new inbox tests + status/next surface inbox entries appropriately.
code
Approved plan:
Implementation Plan: Phase 8 — Inbox Surface
Overview
Phase 8 introduces a file-drop completion-signal protocol so external processes (humans, scripts, other tools) can attest to a current attested step by dropping a JSON file under runs/<run-id>/inbox/. The next next / status call validates the file against the current cursor, emits a hash-chained event (consuming the file), or logs and ignores it (when stale, malformed, or targeting an ineligible step).
Existing patterns to honor: hash-chained events.jsonl via append_event; peek_current_step to read the cursor without mutation; gate_command for the dispatch path; match_attested_command for identity tokens; validate_attested_identity for --agent / --actor rules; step_attested / item_attested for approve outcomes; cursor_rewind for retry; make_run_aborted_event + clear_active_run for abort.
Inbox is opt-in: the presence of <run_dir>/inbox/ triggers scanning. Absence is a no-op.
Eligibility (resolves FLAG-P8-001):
validate_attested_identity rejects --agent on ack.kind="actor" steps and requires ARTAGENTS_ACTOR to match --actor on actor steps. A file-drop script cannot satisfy the env-pinned actor path.
Phase 8 inbox supports ack.kind="agent" attested steps only. Files targeting an ack.kind="actor" step are explicitly skipped with a one-line warning and moved to <run_dir>/inbox/.rejected/<sha256> so they do not zombie in inbox/ and keep re-triggering the warning on every next / status call.
This narrows the inbox surface but matches the doc's framing of inbox as the channel for "external processes" (scripts, automated systems) — humans use the explicit ack verb.
Scope guardrails:
Additive only. No changes to gate semantics, plan format, or existing event kinds.
No new dependencies.
Do not touch Phase 9 (golden tests).
Reuse existing helpers wherever possible — inbox is glue, not a new gate.
Main Phase
Step 1: Define the inbox module (artagents/core/task/inbox.py)
Scope: Medium
Create new module with module-level constants and dataclasses:
For each file: read, json.loads, validate required fields:
step_id: str non-empty,
decision in {"approve","retry","abort"},
submitted_at: str, submitted_by: str,
optional evidence: dict[str, Any] flattened to tuple(str(v) for v in evidence.values()) (insertion order),
optional item_id: str for for_each targeting.
On OSError / json.JSONDecodeError / schema mismatch: _LOGGER.warning(...) with the file name and reason, skip. Return only valid entries. Files are sorted by submitted_at then filename for deterministic processing.
Stale / ineligible cursor checks (return False without writing events; behavior per branch documented below):
Cursor is exhausted, on a CodeStep, or entry.step_id != STEP_PATH_SEP.join(peek.path_tuple) → log warning, leave file in place (operator may correct it). Return False.
Eligibility branch on ack.kind (resolves FLAG-P8-001):
If decision is approve and peek.step.ack.kind == "actor": log warning "inbox: skipping {file}: ack.kind=actor not supported by inbox protocol (use 'artagents ack --actor ... --decision approve')", move to .rejected/<sha256> so the warning fires once. Return False.
If decision is approve and peek.step.ack.kind == "agent": synthesize incoming command exactly like cmd_ack._ack_approve does: parts = [step.command, "--agent", entry.submitted_by], append ["--evidence", e] per evidence string, append ["--item", entry.item_id] if entry has one. Call gate_command(slug, " ".join(shlex.quote(p) for p in parts), [], root=projects_root). The gate writes step_attested (or item_attested) and runs inline produces checks. Call record_dispatch_complete(decision, 0) for symmetry.
On TaskRunGateError: log warning with exc.reason, move to .rejected/. Return False. (Failures we surface via the gate — bad evidence, mismatched identity — should not zombie either.)
Retry branch: if decision is retry on an AttestedStep whose latest event for the path is produces_check_failed:
Build AttestedArgs(agent=entry.submitted_by if ack.kind=="agent" else None, actor=None, evidence=entry.evidence, item=entry.item_id).
Call validate_attested_identity(...) — on rejection, move to .rejected/, log, return False.
For ack.kind="actor": not supported on inbox; move to .rejected/, log, return False.
On success: append_event(events_path, make_cursor_rewind_event(peek.path_tuple, reason="inbox retry")). Move file to .consumed/. Return True.
Abort branch (no identity required, mirrors cmd_abort): append_event(events_path, make_run_aborted_event(run_id, reason=f"inbox abort by {entry.submitted_by}")), then clear_active_run(slug, root=projects_root). Move file to .consumed/. Return True.
Move helpers (atomic): _move_to(file: Path, dest_dir: Path) creates dest_dir, computes sha256(file_bytes).hexdigest() for the new name, uses os.replace. On OSError, log warning and Path.unlink() as a fallback so the file does not get re-processed indefinitely.
Helperpending_count(run_dir: Path) -> int returning len(scan_inbox(run_dir)). Re-exported for cmd_status.
Step 2: Hook cmd_next to consume inbox entries (artagents/core/task/lifecycle.py)
Scope: Small
Inject an inbox pass in cmd_next after read_active_run succeeds and before peek_current_step (artagents/core/task/lifecycle.py:393-410):
run_dir = proj_root / "runs" / run_id.
for entry in scan_inbox(run_dir): wrap each consume_inbox_entry(run_dir, entry, slug=slug, projects_root=projects_root) call in try/except (TaskRunGateError, OSError, EventLogError) as exc: _LOGGER.warning(...) so one bad file never crashes next.
Re-readevents = read_events(events_path) and recompute peek after the loop so the rest of cmd_next (ledger rendering, ack template) sees the post-consume state.
Keep edits surgical — no comment unless the WHY is non-obvious.
Step 3: Hook cmd_status to surface pending entries (artagents/core/task/lifecycle.py)
Scope: Small
Incmd_status (artagents/core/task/lifecycle.py:245-311), after computing run_id / proj_root, call pending = pending_count(proj_root / "runs" / run_id) (read-only — never consume in status).
Printf"inbox: {pending} pending" between current: and recent events: only when pending > 0, to keep default output byte-stable for existing snapshot tests.
Extend_AGENT_MD_TEMPLATE (artagents/core/task/lifecycle.py:53) with a new INBOX SURFACE section: file shape (step_id, decision, evidence, submitted_at, submitted_by, optional item_id), drop location (runs/<run_id>/inbox/), consume-on-next semantics, and the explicit "agent attestations only" caveat (actor steps must use artagents ack). Keep under ~12 lines.
Step 5: Re-export the inbox API (artagents/core/task/__init__.py)
Scope: Small
Addfrom .inbox import InboxEntry, consume_inbox_entry, inbox_dir, pending_count, scan_inbox and append to __all__.
tests/test_inbox_scan.py: write 3 valid entries + 1 malformed JSON file under inbox/. Assert scan_inbox returns 3 valid InboxEntry objects, does not raise. Assert scan_inbox returns [] when the directory does not exist.
tests/test_inbox_consume.py: use _lifecycle_fixtures.setup_run with an ack="agent" attested orchestrator (mirror _BODY_AGENT from tests/test_lifecycle_next.py:36). Drop a valid approve inbox file targeting the current step. Call cmd_next. Assert (a) events.jsonl has a step_attested event with attestor_kind="agent" and attestor_id="external-script"; (b) verify_chain returns ok=True; (c) the inbox file moved to .consumed/; (d) the next cmd_next shows the run as exhausted.
tests/test_inbox_stale.py: drop an inbox file whose step_id does not match the current cursor. Call cmd_next. Assert no new event was written (event count unchanged), the file remains in inbox/ (not moved), and the cursor is unchanged. Add a second sub-test: drop an approve entry targeting an ack="actor" step; assert the file is moved to .rejected/, no event is written, and a warning is logged via caplog.
RunPYENV_VERSION=3.11.11 python -m pytest tests/ to confirm existing tests still pass.
Execution Order
Land inbox.py (Step 1) — pure module, smallest blast radius.
Wire cmd_next and cmd_status (Steps 2-3) and update the AGENT.md template (Step 4).
Re-export from __init__ (Step 5).
Add tests (Step 6) and prove (Step 7).
Validation Order
Targeted: new inbox tests.
Lifecycle regression: pytest tests/test_lifecycle_*.py to confirm cmd_next / cmd_status are byte-stable when inbox/ is absent.
Full suite: pytest tests/.
code
Plan metadata:
{
"version": 2,
"timestamp": "2026-05-05T00:56:49Z",
"hash": "sha256:6deb845795c6933f3102885b054f86a0a081c8d1adacdf26bd5c0b7ad8dacc78",
"changes_summary": "Addressed FLAG-P8-001 by branching consume_inbox_entry on peek.step.ack.kind: inbox supports ack.kind=\"agent\" attested steps only; ack.kind=\"actor\" files are skipped with a one-line warning AND moved to <run_dir>/inbox/.rejected/<sha256> so they do not zombie. Added the same .rejected/ quarantine for any TaskRunGateError raised mid-consume (bad evidence, mismatched identity). Added a third sub-case to tests/test_inbox_stale.py covering the actor-step rejection path. Added item_id to InboxEntry so for_each item targeting is explicit. Documented the agent-only caveat in the AGENT.md template extension. Tightened the Overview with an Eligibility section that names the FLAG and the design choice.",
"flags_addressed": [
{
"id": "FLAG-P8-001",
"resolution": "addressed",
"reason": "consume_inbox_entry now branches on peek.step.ack.kind: agent steps follow the existing approve/retry/abort flow; actor steps are explicitly skipped with a clear warning and the file moves to <run_dir>/inbox/.rejected/ so it does not zombie in inbox/ and re-trigger warnings on every next/status. The same quarantine path catches TaskRunGateError raised mid-consume. tests/test_inbox_stale.py adds a sub-case asserting the actor-step rejection moves the file to .rejected/ and writes no events. Plan Overview now names the eligibility decision (agent-only) and the doc-framing rationale (inbox is for external processes; humans use ack)."
}
],
"questions": [
"How should the evidence dict in the inbox payload be flattened into the gate's tuple[str, ...] evidence list \u2014 by values only, by key=value strings, or by a single JSON-serialized string? The plan assumes values-only.",
"Should cmd_status always print inbox: 0 pending for transparency, or only print when >0 to keep default output unchanged? The plan picks the latter."
],
"success_criteria": [
{
"criterion": "tests/test_inbox_scan.py passes \u2014 scan_inbox returns 3 valid entries from a directory with 3 valid + 1 malformed file and does not raise",
"priority": "must",
"requires": [
"run_tests"
]
},
{
"criterion": "tests/test_inbox_consume.py passes \u2014 dropping a valid approve entry on an ack.kind=agent step, calling cmd_next, results in a step_attested event in events.jsonl and the file moved to .consumed/",
"priority": "must",
"requires": [
"run_tests"
]
},
{
"criterion": "tests/test_inbox_stale.py passes \u2014 (a) non-matching step_id is logged and left in inbox/ with no event written, (b) approve entry targeting an ack.kind=actor step is moved to .rejected/ and writes no event",
"priority": "must",
"requires": [
"run_tests"
]
},
{
"criterion": "All existing tests in tests/ continue to pass after changes",
"priority": "must",
"requires": [
"run_tests"
]
},
{
"criterion": "Inbox is opt-in: when runs/<run-id>/inbox/ does not exist, cmd_next and cmd_status produce byte-identical output to their pre-Phase-8 behavior (verified by existing tests in test_lifecycle_next.py / test_lifecycle_status.py)",
"priority": "must",
"requires": [
"run_tests"
]
},
{
"criterion": "Consumed inbox files are moved to <run_dir>/inbox/.consumed/; ineligible/quarantined files are moved to <run_dir>/inbox/.rejected/. Neither path is left in inbox/ to trigger repeated warnings.",
"priority": "must",
"requires": [
"read_files",
"run_tests"
]
},
{
"criterion": "consume_inbox_entry branches on peek.step.ack.kind: ack.kind=agent files are processed via gate_command; ack.kind=actor files are skipped with a warning and quarantined to .rejected/ (FLAG-P8-001 resolution)",
"priority": "must",
"requires": [
"read_files",
"run_tests"
]
},
{
"criterion": "scan_inbox and consume_inbox_entry use logging.getLogger(\"artagents.core.task.inbox\").warning(...) for all skip paths and do not raise on malformed input",
"priority": "must",
"requires": [
"read_files"
]
},
{
"criterion": "Hash-chain integrity: every inbox-induced event is appended via append_event so verify_chain returns ok=True after consume",
"priority": "must",
"requires": [
"run_tests"
]
},
{
"criterion": "AGENT.md template (run_dir/AGENT.md) mentions the inbox surface with file shape, drop path, consume-on-next semantics, and the explicit 'agent attestations only' caveat",
"priority": "should",
"requires": [
"read_files"
]
},
{
"criterion": "artagents/core/task/inbox.py stays under ~300 lines and avoids defensive wrappers around already-validated dataclass fields",
"priority": "should",
"requires": [
"read_files"
]
},
{
"criterion": "No new third-party dependencies are added (requirements.txt unchanged)",
"priority": "must",
"requires": [
"read_files"
]
},
{
"criterion": "cmd_next retains byte-stable preamble output across two consecutive calls when inbox is empty (existing test_preamble_byte_identical_across_two_calls invariant)",
"priority": "must",
"requires": [
"run_tests"
]
}
],
"assumptions": [
"Inbox supports ack.kind=\"agent\" attested steps only in Phase 8. Files targeting ack.kind=\"actor\" steps are quarantined to .rejected/ with a clear warning so the operator knows to use artagents ack instead. This matches the design doc's framing of inbox as the channel for external processes; humans use the explicit ack verb.",
"submitted_by maps to --agent for agent-eligible attested steps. The ARTAGENTS_ACTOR coupling on the actor path is incompatible with unattended file-drop scripts.",
"Consumed inbox files move to <run_dir>/inbox/.consumed/<sha256>. Files that fail validation post-scan (stale step_id) stay in inbox/. Files that fail eligibility (actor step) or fail mid-consume (TaskRunGateError) move to <run_dir>/inbox/.rejected/<sha256> to prevent zombie warnings.",
"The evidence dict in the inbox payload is flattened by value (insertion order) into a tuple of strings and passed via the gate's --evidence token mechanism.",
"cmd_status prints inbox: N pending only when N > 0 to keep default output byte-stable.",
"Inbox handling in cmd_next is best-effort: any exception from one entry is caught, logged, and processing continues.",
"Inbox does not introduce any new event kinds. Consumed entries reuse step_attested / item_attested / cursor_rewind / run_aborted so existing replay logic works unchanged.",
"Inbox does not handle the iterate decision (cumulative feedback authoring is explicit; inbox handles only approve / retry / abort per the brief).",
"cmd_ack is intentionally not modified \u2014 ack remains the explicit verb; inbox is the implicit signal channel."
],
"delta_from_previous_percent": 37.92,
"structure_warnings": []
}
code
Gate summary:
{
"recommendation": "ITERATE",
"rationale": "Light robustness: single revision pass to incorporate critique feedback.",
"signals_assessment": "",
"warnings": [],
"settled_decisions": []
}
code
Flag registry:
[
{
"id": "FLAG-P8-001",
"concern": "Inbox-on-actor: submitted_by mapping to --agent makes inbox unusable for any AttestedStep with ack.kind=actor. The synthesized command lacks --actor, and validate_attested_identity at artagents/core/task/gate.py:1075-1083 rejects with 'attested step ack.kind=actor requires --actor' (and even with --actor it would also require ARTAGENTS_ACTOR env to match, which a file-drop script will not set). The plan picks --agent in its assumptions list but does not handle the failure path: gate_command will raise TaskRunGateError mid-consume, which the cmd_next try/except catches and logs, but the inbox file is left in place forever and the operator gets no clear signal that this kind of step is not eligible. consume_inbox_entry should branch on peek.step.ack.kind: skip-with-warning ('inbox not supported for ack.kind=actor steps') for actor steps, or use --actor when ack.kind=actor and accept the ARTAGENTS_ACTOR coupling. As written, an inbox file targeting an actor step becomes a permanent zombie.",
"evidence": "Addressed FLAG-P8-001 by branching consume_inbox_entry on peek.step.ack.kind: inbox supports ack.kind=\"agent\" attested steps only; ack.kind=\"actor\" files are skipped with a one-line warning AND moved to <run_dir>/inbox/.rejected/<sha256> so they do not zombie. Added the same .rejected/ quarantine for any TaskRunGateError raised mid-consume (bad evidence, mismatched identity). Added a third sub-case to tests/test_inbox_stale.py covering the actor-step rejection path. Added item_id to InboxEntry so for_each item targeting is explicit. Documented the agent-only caveat in the AGENT.md template extension. Tightened the Overview with an Eligibility section that names the FLAG and the design choice.",
"status": "addressed",
"severity": "significant"
},
{
"id": "FLAG-P8-002",
"concern": "Move-to-.consumed naming: the plan specifies move entry.path to inbox/.consumed/<event_hash> but gate_command returns GateDecision, which does not expose the hash of the just-appended step_attested/item_attested event. To compute event_hash the implementor must re-read events.jsonl after the gate write and re-parse the trailing line - extra I/O for an auditable filename that adds little value over the original filename or a content sha. Recommend simplifying to original-filename or sha256(content).json so the move is a deterministic os.replace with no post-hoc disk read. As written the contract is under-specified and will produce ad-hoc implementations.",
"evidence": "artagents/core/task/gate.py:78-92 (GateDecision fields - no event hash); plan Step 1.4 specifies <event_hash> filename without saying how to derive it.",
"status": "open",
"severity": "minor"
},
{
"id": "FLAG-P8-003",
"concern": "Evidence dict flattening risks shlex/match degradation: the plan coerces JSON evidence dict to tuple[str, ...] of dict values. If any value is non-string (number, list, nested dict) the synthesized command will pass arbitrary stringified objects as --evidence tokens. match_attested_command at artagents/core/task/gate.py:1025-1061 will accept any string, so the gate won't reject; but downstream evidence-consuming code (e.g. _extract_iterate_feedback) and operator audit-readability degrade. scan_inbox should validate that every evidence value is a non-empty string and reject the file as malformed otherwise (logged-and-skipped per the brief). Also, the brief and plan disagree on shape: brief says evidence is an object, gate semantically uses tuple[str,...]; consider accepting either a list-of-strings or a dict-of-strings and document.",
"evidence": "Plan Step 1.3 ('Coerce evidence dict to tuple[str, ...] of values'); brief JSON shape uses object for evidence; artagents/core/task/gate.py:1025-1061 (match_attested_command tokenization).",
"status": "open",
"severity": "minor"
},
{
"id": "FLAG-P8-004",
"concern": "for_each item_id missing from inbox shape: when the current cursor is inside a for_each host, gate dispatch picks first-uncompleted item unless the synthesized command carries --item (artagents/core/task/gate.py:768-787). The plan says --item if peek is in a for_each frame and the entry includes one but the documented JSON shape (step_id/decision/evidence/submitted_at/submitted_by) has no item_id field, so external authors have no way to target a specific item. In practice the inbox will always advance the next-due item - fine for sequential approvals but surprising if an operator drops two files for two different items concurrently. Either add item_id to the documented shape (and tests), or explicitly document 'inbox advances the next-due item only' as a Phase 8 limitation.",
"evidence": "Phase 8 brief JSON shape lists step_id/decision/evidence/submitted_at/submitted_by only; artagents/core/task/gate.py:768-787 (target_item resolution from --item).",
"status": "open",
"severity": "minor"
},
{
"id": "FLAG-P8-005",
"concern": "cmd_next becomes state-mutating: pre-Phase-8, cmd_next is a printer (a 'see next legal action' verb operators run repeatedly without side effects). After the plan's hook, cmd_next consumes inbox files mid-call and writes step_attested / cursor_rewind / run_aborted events. The 'inbox empty implies byte-stable' invariant holds only when the directory is empty/absent; the moment a file is present, the second next call produces different output from the first, and operators using next purely to inspect the run will inadvertently advance the cursor. Either accept this and document loudly (the AGENT.md INBOX SURFACE section should warn 'artagents next consumes inbox/'), or split the consume side into a dedicated verb (artagents inbox consume) and have status/next surface counts only. The plan picks implicit-consume but does not warn operators.",
"evidence": "artagents/core/task/lifecycle.py:367-521 (cmd_next is currently read-only printer); plan Step 2 hooks consume into cmd_next directly.",
"status": "open",
"severity": "minor"
}
]
Requirements:
- Produce structured JSON only.
- `tasks` must be an ordered array of task objects. Every task object must include:
- `id`: short stable task ID like `T1`
- `description`: concrete work item
- `depends_on`: array of earlier task IDs or `[]`
- `status`: always `"pending"` at finalize time
- `executor_notes`: always `""` at finalize time
- `reviewer_verdict`: always `""` at finalize time
- `watch_items` must be an array of strings covering runtime risks, critique concerns, and assumptions to keep visible during execution.
- `sense_checks` must be an array with one verification question per task. Every sense-check object must include:
- `id`: short stable ID like `SC1`
- `task_id`: the related task ID
- `question`: reviewer verification question
- `verdict`: always `""` at finalize time
- `user_actions` must be an array of human-only setup or operational actions. Use IDs `U1`, `U2`, ... and include `description` plus `phase` (`before_execute` or `after_execute`). Use optional `blocks_task_ids` when an action blocks specific tasks, optional `rationale` when useful, and `requires_human_only_reason` ONLY when the user_action is the sole coverage for a plan step.
Include ONLY actions that require a human outside the executor's repo-editing work: env vars or secrets, infra access such as cloud accounts or VPN, DB migrations the human must trigger, manual UI/UX smoke tests, deploys, and out-of-band approvals.
Anything that touches code in the repo MUST be a task, not a user_action. Reading docs, editing files, running tests, and writing migration SQL are tasks. Negative example: writing the migration SQL is a task, not a user_action.
Positive examples: U1: Set ANTHROPIC_API_KEY in .env (before_execute); U2: Manually smoke test the production deploy in the browser (after_execute).
- meta_commentary must be a single string with execution guidance, gotchas, or judgment calls that help the executor succeed.
- validation must be an object that self-checks plan coverage:
- plan_steps_covered: enumerate EVERY step from the approved plan. For each step, provide a short plan_step_summary (the step's intent in one phrase) and finalize_item_ids (array of task IDs T* or user_action IDs U* that implement or cover it — a single plan step may map to multiple tasks and/or user_actions).
- orphan_tasks: task IDs that do not correspond to any plan step. Normally empty. If non-empty, explain in completeness_notes.
- completeness_notes: free-text explanation of any gaps, deviations, or deliberate omissions.
- coverage_complete: set to true only if every plan step has at least one finalize task or user_action AND you have verified the mapping by reviewing each entry. Set to false if any plan step is missing coverage.
- Example:
json "validation": { "plan_steps_covered": [ {"plan_step_summary": "Add retry logic to API client", "finalize_item_ids": ["T1", "T2"]}, {"plan_step_summary": "Set required production secret", "finalize_item_ids": ["U1"]} ], "orphan_tasks": [], "completeness_notes": "All plan steps mapped to tasks.", "coverage_complete": true }
- Preserve information that strong existing artifacts already capture well: execution ordering, watch-outs, reviewer checkpoints, and practical context.
- The structured output should be self-contained: an executor reading only finalize.json should have everything needed to work.
- Keep the task count proportional to the work. A simple 1-2 file fix should be 2 tasks: (1) apply the fix, (2) run tests. Do NOT create separate "inspect" or "read" tasks for simple changes — the executor can read and fix in one step. Only create more tasks when the work has genuinely independent stages.
- - The FINAL task MUST always be to run tests and verify the changes work. If specific test IDs or commands are mentioned in the original task, include them. Otherwise, the executor should find and run the tests most relevant to the files changed. If any test fails, read the error, fix the code, and re-run until they pass. Do NOT create new test files — run the project's existing test suite. Additionally, the executor should write a short throwaway script that reproduces the specific bug described in the task, run it to confirm the fix works, then delete the script.