deepwork-execute-amend
Lightweight single-gate amendment for execute mode — spawns MICRO-TEAM (CRITIC + 1 specialist) for re-verdict without full deepwork re-run
What this skill does
# Deepwork Execute Amend
Invoke a lightweight single-gate amendment cycle for the active execute-mode session.
## What this skill does
Spawns a MICRO-TEAM of CRITIC + 1 specialist to re-verdict a single gate in the execute session without re-running the full deepwork team. Use when:
- SCOPE-GUARD identifies a necessary-but-out-of-scope change for a specific gate
- A `scope-delta` discovery with `proposed_outcome: escalate` has been appended to `discoveries.jsonl`
- EXECUTOR reports a plan gap that cannot be resolved within existing plan language
## When NOT to use this skill — require fresh `/deepwork --mode default` instead
Per plan §6 (full re-run threshold), redirect to `/deepwork --mode default` if ANY of:
- The amendment touches **≥3 gates** (>30% of the plan scope)
- The amendment contradicts a **categorical ban** (G7 secret-scan, G8 CI-bypass)
- The amendment changes the plan's **test acceptance criteria** (affects test_manifest[] entries)
- The amendment changes the plan's **declared environments** (affects env_attestations entries)
In these cases, output a HALT recommendation and ask the user via AskUserQuestion to authorize a full re-run or cancel.
## Steps
1. Read the active execute session state:
```
Glob: ${CLAUDE_PROJECT_DIR:-$(pwd -P)}/.claude/deepwork/*/state.json
```
Filter for the instance with `execute.phase` not null and not "halt". Read `state.json.execute.plan_ref`, `plan_hash`, `change_log`, `scope_amendments`.
2. Identify the gate being amended from the `<gate-id>` argument (e.g., `G-exec-3`).
3. Read the gate's task from TaskList. Read the relevant `change_log[]` entry with `metadata.bar_id == <gate-id>`. Read the discovery entry from `discoveries.jsonl` that triggered this amendment.
4. **Check full re-run threshold** (step 2 above). If threshold is met, output HALT recommendation and stop.
5. Determine which specialist to spawn alongside CRITIC:
- PA dimension issue (scope, plan citation) → `scope-guard` specialist
- EG dimension issue (test failures, adversarial gaps) → `adversary` specialist
- RA dimension issue (regression) → `executor` specialist
- Env attestation issue → `auditor` specialist
6. Spawn the MICRO-TEAM via two Agent tool calls in one message:
- `critic` — include `references/critic-stance.md` verbatim; instruct to re-verdict ONLY the PA dimension of `<gate-id>` against the proposed amendment
- `<specialist>` — include the appropriate stance from `profiles/execute/stances/`; instruct to read the discovery context and produce an `amendment.v<N>.md` in `proposals/amendments/`
7. Wait for the micro-team to complete. The specialist produces `proposals/amendments/amendment.v<N>.md`. CRITIC verdicts it.
8. **If CRITIC PASS on the amendment**:
- Append the scope amendment record via `state-transition.sh append_array`:
```bash
bash "${CLAUDE_PLUGIN_ROOT}/scripts/state-transition.sh" \
--state-file "${CLAUDE_PROJECT_DIR:-$(pwd -P)}/.claude/deepwork/<instance-id>/state.json" \
append_array .execute.scope_amendments \
'{"id":"SA-<N>","gate_id":"<gate-id>","amendment_file":"proposals/amendments/amendment.v<N>.md","reason":"<description>","approved_at":"<ISO>","triggered_by":"<discovery-id or null>"}'
```
- If the amendment modifies the plan file, recompute and store `plan_hash` and clear drift via `set_field`:
```bash
NEW_HASH=$(sha256sum "$plan_ref" | cut -d' ' -f1)
bash "${CLAUDE_PLUGIN_ROOT}/scripts/state-transition.sh" \
--state-file "${CLAUDE_PROJECT_DIR:-$(pwd -P)}/.claude/deepwork/<instance-id>/state.json" \
set_field .execute.plan_hash "$NEW_HASH"
bash "${CLAUDE_PLUGIN_ROOT}/scripts/state-transition.sh" \
--state-file "${CLAUDE_PROJECT_DIR:-$(pwd -P)}/.claude/deepwork/<instance-id>/state.json" \
set_field .execute.plan_drift_detected false
```
- Mark the discovery entry's `resolution` field: `"resolved via SA-<N>"`
- Report to user: amendment approved, session may resume.
9. **If CRITIC FAIL on the amendment**:
- Output the FAIL reason to the user.
- Ask user for direction via AskUserQuestion: "Amendment for gate <gate-id> was rejected: <reason>. Options: (1) revise the amendment, (2) cancel this gate, (3) halt session for manual review."
## CC hook capability note
- `permissionDecision:"ask"` silently degrades to `"deny"` in non-interactive mode (`cli_formatted_2.1.116.js:472423-472440`). This skill does not use `"ask"`.
- PreToolUse blocking uses `permissionDecision:"deny"` (via `hookSpecificOutput`, `cli_formatted_2.1.116.js:266013-266017`) or exit 2, not the deprecated `decision:"block"` (`cli_formatted_2.1.116.js:632082`).
## Companion commands
- `/deepwork-execute-status` — view current execute session state before invoking amendment
- `/deepwork --mode default` — full re-run when amendment threshold is exceeded
Related in General
modeling-omnistudio-epc-catalog
IncludedSalesforce Industries CME EPC product-modeling skill for Product2-based catalog creation. Use when creating EPC products, configuring product attributes, building offer bundles with Product Child Items, or reviewing EPC DataPack JSON metadata for product catalog changes. TRIGGER when: user creates or updates Product2 EPC records, AttributeAssignment payloads, AttributeMetadata/AttributeDefaultValues, Offer bundles, or ProductChildItem relationships. DO NOT TRIGGER when: designing OmniScripts/FlexCards/Integration Procedures (use building-omnistudio-omniscript, building-omnistudio-flexcard, or building-omnistudio-integration-procedure), implementing Apex business logic (use generating-apex), or troubleshooting deployment pipelines (use deploying-metadata).
relationship-science-coach
IncludedUse this skill for direct, practical adult relationship coaching: couples conflict, repair, trust, marriage, dating, flirting, attachment patterns, emotional connection, sex, desire differences, eroticism, kink negotiation, affection, love languages, breakups, and long-term passion. Draw on Gottman, EFT and Hold Me Tight, attachment science, modern sex research, Perel, Nagoski, Kerner, Schnarch, Love and Stosny, and flexible love-language tools. Be concrete and low-hedge. Redirect only for imminent danger, abuse, coercive control, minors, non-consent, self-harm, stalking, or medical/legal/psychiatric decisions.
building-sf-integrations
IncludedSalesforce integration architecture and runtime plumbing with 120-point scoring. Use this skill to set up Named Credentials, External Credentials, External Services, REST/SOAP callout patterns, Platform Events, and Change Data Capture. TRIGGER when: user sets up Named Credentials, External Services, REST/SOAP callouts, Platform Events, CDC, or touches .namedCredential-meta.xml files. DO NOT TRIGGER when: Connected App/OAuth config (use configuring-connected-apps), Apex-only logic (use generating-apex), or data import/export (use handling-sf-data).
venue-templates
IncludedAccess comprehensive LaTeX templates, formatting requirements, and submission guidelines for major scientific publication venues (Nature, Science, PLOS, IEEE, ACM), academic conferences (NeurIPS, ICML, CVPR, CHI), research posters, and grant proposals (NSF, NIH, DOE, DARPA). This skill should be used when preparing manuscripts for journal submission, conference papers, research posters, or grant proposals and need venue-specific formatting requirements and templates.
let-fate-decide
IncludedDraws the 12 Houses of the Zodiac Tarot spread to inject entropy into planning when prompts are vague, ambiguous, or casually delegated. Interprets the spread to guide next steps. Use when the user says 'let fate decide', 'YOLO', 'whatever', 'idk', or other nonchalant phrases, makes Yu-Gi-Oh references, or when you are about to arbitrarily pick between multiple reasonable approaches. Prefer over ask-questions-if-underspecified when the user's tone is casual or playful rather than precision-seeking.
net-ops
IncludedCross-platform network troubleshooting (Windows, macOS, Linux) via local or remote shell. Use for: DNS broken, can't resolve hostnames, nslookup/dig works but apps fail, NRPT, WFP, scutil, /etc/resolver, systemd-resolved, /etc/resolv.conf, NetworkManager, VPN DNS leak residue (ProtonVPN/Mullvad/WireGuard/AnyConnect), AV/firewall blocking DNS or DoH, Tailscale DNS interaction, intermittent connectivity, remote diagnostics over SSH.