|
| 1 | +--- |
| 2 | +name: h-commission |
| 3 | +description: "Create WorkCommissions from active DecisionRecords without starting the harness" |
| 4 | +--- |
| 5 | + |
| 6 | +## Codex Invocation |
| 7 | + |
| 8 | +This skill is explicit-only. Use it only when the user invokes $h-commission; treat the text after the skill name as the request context. |
| 9 | + |
| 10 | +# Commission |
| 11 | + |
| 12 | +Create or reuse WorkCommissions from Haft DecisionRecords. This is the |
| 13 | +authorization step only: it must not start Open-Sleigh or any long-running |
| 14 | +runtime. Plugin mode does not own runtime lifecycle; CLI or Desktop operates |
| 15 | +the harness runtime after the operator chooses to run it. |
| 16 | + |
| 17 | +Operator recovery path: |
| 18 | + |
| 19 | +```bash |
| 20 | +haft commission list --selector stale |
| 21 | +haft commission show wc-... |
| 22 | +haft commission requeue wc-... --reason stale_operator_recovery |
| 23 | +haft commission cancel wc-... --reason no_longer_relevant |
| 24 | +``` |
| 25 | + |
| 26 | +Use cancellation instead of deleting a WorkCommission. A WorkCommission is an |
| 27 | +audit/authority record; "remove it from work" means move it to `cancelled` with |
| 28 | +a reason. |
| 29 | + |
| 30 | +Default path: |
| 31 | + |
| 32 | +```bash |
| 33 | +haft harness run --all-active-decisions --prepare-only |
| 34 | +``` |
| 35 | + |
| 36 | +This explicitly selects active DecisionRecords, generates an inspectable |
| 37 | +`.haft/plans/*.yaml`, creates bounded WorkCommissions, and stops before |
| 38 | +execution. A bare `haft harness run` only runs existing runnable commissions; it |
| 39 | +does not select decisions by itself. |
| 40 | + |
| 41 | +Use explicit selectors only when the user asks for a narrower set: |
| 42 | + |
| 43 | +```bash |
| 44 | +haft harness run dec-a dec-b --prepare-only |
| 45 | +haft harness run --problem prob-... --prepare-only |
| 46 | +haft harness run --context harness-mvp --prepare-only |
| 47 | +haft harness run --all-active-decisions --prepare-only |
| 48 | +haft harness run --plan .haft/plans/implementation.yaml --prepare-only |
| 49 | +``` |
| 50 | + |
| 51 | +If the user supplies exact DecisionRecord ids and asks for the low-level MCP |
| 52 | +tool instead of the packaged operator path, use `haft_commission`: |
| 53 | + |
| 54 | +- `action="create_from_decision"` for one decision |
| 55 | +- `action="create_batch_from_decisions"` for several decisions |
| 56 | +- `action="create_from_plan"` for a prepared ImplementationPlan |
| 57 | +- `action="list", selector="stale"` to find old or blocked commissions |
| 58 | +- `action="show"` with `commission_id` to inspect one commission and operator hints |
| 59 | +- `action="requeue"` with `commission_id` and `reason` to return a recoverable |
| 60 | + commission to queued |
| 61 | +- `action="cancel"` with `commission_id` and `reason` to close unfinished work |
| 62 | + without deleting the record |
| 63 | + |
| 64 | +Delivery policy (apply-authority gate, since v7.x): |
| 65 | + |
| 66 | +The `delivery_policy` field on a WorkCommission controls who applies the |
| 67 | +workspace diff after the runtime terminates with `verdict=pass`. Two values: |
| 68 | + |
| 69 | +- `workspace_patch_manual` (default) — diff stays in the workspace clone after |
| 70 | + terminal+pass. Operator decides whether to apply via |
| 71 | + `haft harness apply <commission-id>`. Use this for commissions touching |
| 72 | + load-bearing code, security-sensitive paths, or anything where pre-apply |
| 73 | + human review is required. |
| 74 | +- `workspace_patch_auto_on_pass` — opt-in. On terminal+pass, the harness drain |
| 75 | + loop calls the same scope-checked apply path automatically and emits |
| 76 | + `auto_apply_succeeded: commission=... files=N` (or `auto_apply_failed: ...`) |
| 77 | + on operator stdout. Use this for low-risk commissions (docs, formatting, |
| 78 | + mechanical refactors) where the verdict gate is sufficient. |
| 79 | + |
| 80 | +Per V3 drain invariants, carried here as external Haft runtime rules rather |
| 81 | +than as a local HyperGit DecisionRecord: |
| 82 | + |
| 83 | +- AutonomyEnvelope evaluates at create / preflight / execute, NOT at apply. |
| 84 | + A missing envelope snapshot does not block auto-apply on pass. |
| 85 | +- An EXPLICITLY blocked envelope decision still keeps the manual path even |
| 86 | + on `workspace_patch_auto_on_pass`, because that represents a concrete |
| 87 | + operator decision rather than a missing snapshot. |
| 88 | +- Lockset enforcement at claim time does not change under drain mode. |
| 89 | +- Per-commission apply remains a discrete revertable git operation; drain |
| 90 | + performs no remote operations (no push, no PR, no comments). |
| 91 | + |
| 92 | +Drain mode (long-running batch operator path): |
| 93 | + |
| 94 | +```bash |
| 95 | +haft harness run --drain --concurrency N |
| 96 | +``` |
| 97 | + |
| 98 | +Keeps the runtime alive while runnable WorkCommissions remain, runs up to N |
| 99 | +codex sessions in parallel, exits cleanly when the queue is empty. Emits |
| 100 | +`auto_apply_succeeded` / `auto_apply_failed` lines on stdout for terminal |
| 101 | +commissions whose `delivery_policy=workspace_patch_auto_on_pass`. Stale leases |
| 102 | +older than the configured cap (default 24h, override via |
| 103 | +`OPEN_SLEIGH_STALE_LEASE_MAX_AGE_S` env) are skipped at intake with typed |
| 104 | +`lease_too_old` reason and surfaced in `haft harness status` for operator |
| 105 | +action. `--drain` requires the operator stream — do not combine with |
| 106 | +`--detach`. |
| 107 | + |
| 108 | +Single-commission baseline behavior (no `--drain`) is unchanged: operator |
| 109 | +runs `haft harness run` with explicit selectors, monitors progress, applies |
| 110 | +diffs manually after terminal+pass. |
| 111 | + |
| 112 | +Lifecycle contract: |
| 113 | + |
| 114 | +- `list` and `show` are read-only; they must not change commission state. |
| 115 | +- `requeue` is for stale-but-still-current or blocked/failed work after the |
| 116 | + cause is fixed. It is allowed only from `queued`, `ready`, `preflighting`, |
| 117 | + `running`, `blocked_stale`, `blocked_policy`, `blocked_conflict`, |
| 118 | + `needs_human_review`, or `failed`; it clears the lease, refreshes |
| 119 | + `fetched_at`, records the reason, and moves the commission to `queued`. |
| 120 | +- Do not requeue a commission whose `valid_until` has expired. Cancel it and |
| 121 | + create a fresh commission from the current DecisionRecord/scope if work is |
| 122 | + still needed. |
| 123 | +- `cancel` is for obsolete, duplicate, unauthorized, or expired unfinished work. |
| 124 | + It records the reason, clears the lease, and moves the commission to |
| 125 | + `cancelled`. |
| 126 | +- `completed`, `completed_with_projection_debt`, `cancelled`, and `expired` |
| 127 | + commissions are audit records; do not requeue or cancel them again. |
| 128 | +- `external_required` does not make tracker publication semantic authority. If |
| 129 | + local RuntimeRun evidence passes but the external publish is missing or |
| 130 | + failed, the commission must enter `completed_with_projection_debt` and keep a |
| 131 | + separate `projection_debt` record naming carrier, target, last error, and |
| 132 | + retry policy. |
| 133 | +- `local_only` commissions complete from local evidence alone; do not require |
| 134 | + tracker credentials or publication state for correctness. |
| 135 | + |
| 136 | +Required discipline: |
| 137 | + |
| 138 | +- Do not treat a DecisionRecord as scheduled work until a WorkCommission exists. |
| 139 | +- Do not create a WorkCommission for a stale, superseded, deprecated, or |
| 140 | + ambiguous DecisionRecord. |
| 141 | +- Preserve the boundary: DecisionRecord = chosen direction; |
| 142 | + WorkCommission = bounded permission to execute; RuntimeRun = actual attempt. |
| 143 | +- Treat `autonomy_envelope_snapshot`, when supplied, as a limiter only. It may |
| 144 | + block out-of-envelope repos, paths, actions, modules, expired/revoked state, |
| 145 | + or exhausted concurrency/budget, but it never skips freshness, scope, |
| 146 | + evidence, lease, lockset, or one-way-door gates. |
| 147 | +- Do not physically delete WorkCommissions during normal operation; cancel or |
| 148 | + requeue them so status/verify can explain what happened. |
| 149 | +- Prefer default scope derived from `affected_files`; add explicit |
| 150 | + `--allowed-path`, `--lock`, or `--evidence` only when the user gives them or |
| 151 | + the DecisionRecord is too broad to run safely. |
| 152 | +- Report the generated plan path and whether commissions were created or reused. |
| 153 | + |
| 154 | +Use the user's explicit skill invocation text as the request context. |
0 commit comments