@punks/cli 3.3.2 → 3.3.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (75) hide show
  1. package/AGENTS.md +2 -1
  2. package/dist/BASELINE_CHANGELOG.md +4 -2
  3. package/dist/CHANGELOG.md +17 -1
  4. package/dist/baseline/scaffold-baseline/baseline.json +5 -5
  5. package/dist/baseline/scaffold-baseline/data/catalog/packs.json +2 -1
  6. package/dist/baseline/scaffold-baseline/data/catalog/skills.json +16 -0
  7. package/dist/baseline/scaffold-baseline/skills/agnostic/docs/write-graph-based-skills/AUTHORING-HANDOFF.md +12 -0
  8. package/dist/baseline/scaffold-baseline/skills/agnostic/docs/write-graph-based-skills/SKILL.md +84 -0
  9. package/dist/baseline/scaffold-baseline/skills/agnostic/docs/write-graph-based-skills/agents/openai.yaml +4 -0
  10. package/dist/baseline/scaffold-baseline/skills/agnostic/docs/write-graph-based-skills/phases/audit.md +33 -0
  11. package/dist/baseline/scaffold-baseline/skills/agnostic/docs/write-graph-based-skills/phases/define-authority.md +26 -0
  12. package/dist/baseline/scaffold-baseline/skills/agnostic/docs/write-graph-based-skills/phases/define-handoffs.md +34 -0
  13. package/dist/baseline/scaffold-baseline/skills/agnostic/docs/write-graph-based-skills/phases/model-state.md +30 -0
  14. package/dist/baseline/scaffold-baseline/skills/agnostic/docs/write-graph-based-skills/phases/qualify.md +27 -0
  15. package/dist/baseline/scaffold-baseline/skills/agnostic/docs/write-graph-based-skills/phases/router.md +36 -0
  16. package/dist/baseline/scaffold-baseline/skills/agnostic/docs/write-graph-based-skills/phases/test-routes.md +33 -0
  17. package/dist/baseline/scaffold-baseline/skills/agnostic/docs/write-graph-based-skills/phases/verify-disclosure.md +28 -0
  18. package/dist/baseline/scaffold-baseline/skills/agnostic/docs/write-graph-based-skills/phases/write-phases.md +33 -0
  19. package/dist/baseline/scaffold-baseline/skills/agnostic/docs/write-graph-based-skills/phases/write-router.md +30 -0
  20. package/dist/baseline/scaffold-baseline/skills/agnostic/docs/write-graph-based-skills/references/authoring-contract.md +226 -0
  21. package/dist/baseline/scaffold-baseline/skills/agnostic/generic/handback/SKILL.md +27 -0
  22. package/dist/baseline/scaffold-baseline/skills/agnostic/quality/autoreview/SKILL.md +9 -4
  23. package/dist/baseline/scaffold-baseline/skills/phases/debugging-phase/SKILL.md +6 -5
  24. package/dist/baseline/scaffold-baseline/skills/phases/delivery-phase/SKILL.md +5 -1
  25. package/dist/baseline/scaffold-baseline/skills/phases/delivery-phase/phases/debug.md +2 -2
  26. package/dist/baseline/scaffold-baseline/skills/phases/delivery-phase/phases/handback.md +23 -0
  27. package/dist/baseline/scaffold-baseline/skills/phases/delivery-phase/phases/implement.md +2 -0
  28. package/dist/baseline/scaffold-baseline/skills/phases/delivery-phase/phases/review.md +6 -4
  29. package/dist/baseline/scaffold-baseline/skills/phases/delivery-phase/phases/router.md +25 -19
  30. package/dist/baseline/scaffold-baseline/skills/phases/delivery-phase/references/phase-handoff.md +6 -2
  31. package/dist/baseline/scaffold-baseline/skills/phases/review-phase/phases/return-route.md +14 -9
  32. package/dist/baseline/scaffold-baseline/skills/phases/review-phase/phases/router.md +15 -13
  33. package/dist/baseline/scaffold-baseline/skills/phases/review-phase/phases/run-review.md +3 -2
  34. package/dist/baseline/scaffold-baseline/skills/phases/review-phase/references/durable-report.md +15 -12
  35. package/dist/baseline/scaffold-baseline/skills/phases/review-phase/references/runtime-handoff.md +2 -2
  36. package/dist/baseline/scaffold-baseline/skills/phases/review-phase/references/state-graph.md +5 -1
  37. package/dist/baseline/scaffold-baseline/skills/phases/review-phase/scripts/review-contract.mjs +15 -4
  38. package/dist/baseline/scaffold-baseline.json +5 -5
  39. package/dist/baseline/scaffold-baseline.tgz +0 -0
  40. package/dist/data/AGENTS.md +1 -0
  41. package/dist/data/shared-agents.md +113 -0
  42. package/dist/index.js +15 -9
  43. package/dist/skills/agnostic/docs/write-graph-based-skills/AUTHORING-HANDOFF.md +12 -0
  44. package/dist/skills/agnostic/docs/write-graph-based-skills/SKILL.md +84 -0
  45. package/dist/skills/agnostic/docs/write-graph-based-skills/agents/openai.yaml +4 -0
  46. package/dist/skills/agnostic/docs/write-graph-based-skills/phases/audit.md +33 -0
  47. package/dist/skills/agnostic/docs/write-graph-based-skills/phases/define-authority.md +26 -0
  48. package/dist/skills/agnostic/docs/write-graph-based-skills/phases/define-handoffs.md +34 -0
  49. package/dist/skills/agnostic/docs/write-graph-based-skills/phases/model-state.md +30 -0
  50. package/dist/skills/agnostic/docs/write-graph-based-skills/phases/qualify.md +27 -0
  51. package/dist/skills/agnostic/docs/write-graph-based-skills/phases/router.md +36 -0
  52. package/dist/skills/agnostic/docs/write-graph-based-skills/phases/test-routes.md +33 -0
  53. package/dist/skills/agnostic/docs/write-graph-based-skills/phases/verify-disclosure.md +28 -0
  54. package/dist/skills/agnostic/docs/write-graph-based-skills/phases/write-phases.md +33 -0
  55. package/dist/skills/agnostic/docs/write-graph-based-skills/phases/write-router.md +30 -0
  56. package/dist/skills/agnostic/docs/write-graph-based-skills/references/authoring-contract.md +211 -0
  57. package/dist/skills/agnostic/generic/handback/SKILL.md +27 -0
  58. package/dist/skills/agnostic/quality/autoreview/SKILL.md +9 -4
  59. package/dist/skills/frameworks/nestjs/nestjs-best-practices/.gitignore +29 -0
  60. package/dist/skills/phases/debugging-phase/SKILL.md +6 -5
  61. package/dist/skills/phases/delivery-phase/SKILL.md +5 -1
  62. package/dist/skills/phases/delivery-phase/phases/debug.md +2 -2
  63. package/dist/skills/phases/delivery-phase/phases/handback.md +23 -0
  64. package/dist/skills/phases/delivery-phase/phases/implement.md +2 -0
  65. package/dist/skills/phases/delivery-phase/phases/review.md +6 -4
  66. package/dist/skills/phases/delivery-phase/phases/router.md +23 -17
  67. package/dist/skills/phases/delivery-phase/references/phase-handoff.md +6 -2
  68. package/dist/skills/phases/review-phase/phases/return-route.md +14 -9
  69. package/dist/skills/phases/review-phase/phases/router.md +15 -13
  70. package/dist/skills/phases/review-phase/phases/run-review.md +3 -2
  71. package/dist/skills/phases/review-phase/references/durable-report.md +10 -8
  72. package/dist/skills/phases/review-phase/references/runtime-handoff.md +2 -2
  73. package/dist/skills/phases/review-phase/references/state-graph.md +5 -1
  74. package/dist/skills/phases/review-phase/scripts/review-contract.mjs +2 -0
  75. package/package.json +9 -52
@@ -0,0 +1,12 @@
1
+ # Authoring Handoff
2
+
3
+ Phase: audit
4
+ Status: complete
5
+ Scope: canonical Durable Workflow Graph authoring skill
6
+ Artifacts: SKILL.md; phases/; references/authoring-contract.md
7
+ Validation: contract tests verify structure, pointers, and human steering route
8
+ Domain state: graph authoring requires a durable human_steering_required terminal
9
+ UI Evidence: none
10
+ Next suggested route: none
11
+ Blockers: none
12
+ Resume identity: upstream import plus human steering repair
@@ -0,0 +1,84 @@
1
+ ---
2
+ name: write-graph-based-skills
3
+ description: Write graph-based skills as Durable Workflow Graphs. Use when creating a graph-based skill, converting a linear multi-step skill, or repairing evidence routing, cold resume, or premature completion.
4
+ ---
5
+
6
+ # Write Graph-Based Skills
7
+
8
+ ## Model Primer
9
+
10
+ - State-machine: explicit states, transition guards, and deterministic resume behavior.
11
+ - Actor-like gate boundary: bounded ownership of work, internal delegation, validation, and the durable handoff returned to the router.
12
+ - Graph: explicit paths, branches, cycles, skips, and checkpoints.
13
+ - Router here names the workflow's internal transition contract.
14
+ - Durable handoff makes execution stateful by committing validated gate state before a stop or router return.
15
+ - Human steering is the terminal boundary defined in the [authoring contract](references/authoring-contract.md#human-steering-terminal).
16
+ - Written contracts and durable evidence define the skill-protocol boundary. Markdown cannot enforce exclusive writers, execution ordering, or atomic persistence; require an external runtime only when one of those guarantees is a correctness requirement.
17
+
18
+ ## Quick Start
19
+
20
+ 1. Load [`phases/router.md`](phases/router.md) first.
21
+ 2. Inspect the target skill's current artifacts, evidence, and latest authoring outcomes. Re-derive the route on every entry, including cold resume.
22
+ 3. Load exactly one phase selected by the authoring router. Keep sibling phase files out of context.
23
+ 4. Complete that phase's bounded work and checks.
24
+ 5. Write its durable phase outcome to the active authoring record.
25
+ 6. Stop on a blocker or checkpoint. Otherwise stop or re-enter this root router.
26
+
27
+ Use [`references/authoring-contract.md`](references/authoring-contract.md) as the single shared worksheet. Create the creator workflow's durable authoring record at `<target-skill>/AUTHORING-HANDOFF.md`; the authoring router discovers it at that exact path. This record tracks creation, conversion, or repair work. It is separate from the target skill's runtime handoff contract. Current target artifacts remain more authoritative than its route suggestion.
28
+
29
+ ## Entry Modes
30
+
31
+ Use a graph for every multi-step skill. Direct composition is the narrow qualification exception defined below.
32
+
33
+ - **Create:** start from a new target skill and unresolved workflow obligations.
34
+ - **Convert:** inspect an existing linear multi-step skill and preserve valid work while making states, routes, gates, and durable handoffs explicit.
35
+ - **Repair:** begin from stale, contradictory, unreachable, or incomplete routing evidence and change only the broken contracts.
36
+ - **Direct composition:** exit during qualification only for one atomic, discardable, cheap-to-restart action with no routing, repair, or resume obligation.
37
+
38
+ Keep the package's current invocation policy unless target requirements deliberately choose another one.
39
+
40
+ ## Phase Files
41
+
42
+ - [`phases/router.md`](phases/router.md): select exactly one next authoring phase from current evidence.
43
+ - [`phases/audit.md`](phases/audit.md): run the terminal completeness and validator audit.
44
+ - [`phases/define-authority.md`](phases/define-authority.md): define evidence authority and deterministic tie-breaks.
45
+ - [`phases/define-handoffs.md`](phases/define-handoffs.md): define workflow-owned durable handoffs.
46
+ - [`phases/model-state.md`](phases/model-state.md): define evidence states, topology, guards, and obligation reachability.
47
+ - [`phases/qualify.md`](phases/qualify.md): define obligations, survivor artifacts, and the direct-composition boundary.
48
+ - [`phases/test-routes.md`](phases/test-routes.md): predict, derive, and repair route scenarios.
49
+ - [`phases/verify-disclosure.md`](phases/verify-disclosure.md): verify context reachability and sibling isolation.
50
+ - [`phases/write-phases.md`](phases/write-phases.md): write every executable target gate file.
51
+ - [`phases/write-router.md`](phases/write-router.md): write the target bootstrap and target router.
52
+
53
+ ## Required Target Structure
54
+
55
+ Every produced graph-based skill must use this shape:
56
+
57
+ ```text
58
+ <target-skill>/
59
+ ├── SKILL.md
60
+ ├── AUTHORING-HANDOFF.md
61
+ └── phases/
62
+ ├── router.md
63
+ └── <gate>.md
64
+ ```
65
+
66
+ - `SKILL.md` contains bootstrap and invocation guidance. It does not contain executable gate bodies.
67
+ - `phases/` is flat. It contains `router.md` and one `<gate>.md` for every executable gate or step selected by the target router.
68
+ - Every target gate file defines: guard, inputs, bounded action or delegation, invariants, completion evidence, declared exits, and durable handoff.
69
+ - `AUTHORING-HANDOFF.md` is this creator workflow's durable authoring record. It is separate from the target skill's runtime handoffs.
70
+ - `references/` is optional. Add it only for shared or genuinely conditional material, and keep executable gate bodies out of it.
71
+ - Every operational reference is reachable from the root, router, or selected phase.
72
+ - The target handoff contract names its durable storage location and the rule used to discover the latest applicable handoff.
73
+
74
+ ## Router Rules
75
+
76
+ Use [`phases/router.md`](phases/router.md) as the single source of truth for authoring route order. Reuse fresh complete artifacts. Resolve overlapping guards through the declared authority and precedence rules. Select exactly one phase or declared stop outcome. A suggested phase is advisory and lowest authority. Audit completion is the only graph-authoring terminal.
77
+
78
+ ## Stop Conditions
79
+
80
+ - After a selected phase writes its outcome, stop or re-enter the root router. Never jump directly to a sibling phase.
81
+ - On blocked work, write the blocker and missing evidence, then stop.
82
+ - At a human checkpoint, write the decision required, then stop.
83
+ - Claim authoring completion only after `audit` verifies every obligation, route, pointer, durable handoff, and applicable validator.
84
+ - Keep claims at the skill-protocol boundary. Markdown cannot enforce exclusive writers, execution ordering, or atomic persistence; require an external runtime only when one of those guarantees is a correctness requirement.
@@ -0,0 +1,4 @@
1
+ interface:
2
+ display_name: "Write Graph-Based Skills"
3
+ short_description: "Write resumable graph-based skills"
4
+ default_prompt: "Use $write-graph-based-skills to write a resumable graph-based skill with evidence-derived routing, actor-like gate boundaries, and durable handoffs."
@@ -0,0 +1,33 @@
1
+ # Audit the Graph-Based Skill
2
+
3
+ ## Selection Condition
4
+
5
+ Select when every earlier authoring phase has fresh completion evidence and terminal readiness remains unverified.
6
+
7
+ ## Bounded Work
8
+
9
+ - Apply the [Final Audit](../references/authoring-contract.md#final-audit).
10
+ - Verify every mandatory obligation is reachable and required by the terminal guard.
11
+ - Prove cold resume derives one route from current evidence and discoverable handoffs.
12
+ - Recheck overlapping guards, authority, and deterministic precedence.
13
+ - Keep each transition meaning in one source of truth.
14
+ - Verify every operational reference is reachable and every target router-selected phase exists.
15
+ - Verify the [human steering terminal](../references/authoring-contract.md#human-steering-terminal)
16
+ is reachable, durable, authority-gated, and distinct from planned human checkpoints.
17
+ - Run the no-op test: delete instructions whose removal does not change behavior relative to the model default.
18
+ - Run the available skill validator and record its result.
19
+
20
+ ## Checkable Completion State
21
+
22
+ - Obligations, terminal accounting, cold resume, routes, pointers, and durable handoffs pass.
23
+ - Transition meanings have one source of truth.
24
+ - The no-op test leaves only instructions that change behavior relative to the model default.
25
+ - The available validator passes.
26
+
27
+ ## Durable Phase Outcome
28
+
29
+ Update the `audit` entry in `<target-skill>/AUTHORING-HANDOFF.md` with audited artifacts, separate validation results, blockers, and the terminal decision.
30
+
31
+ ## Stop or Re-entry
32
+
33
+ Return the audit-complete terminal only when every check passes. On any failure, write the outcome and re-enter root so the earliest broken phase is selected.
@@ -0,0 +1,26 @@
1
+ # Define Evidence Authority
2
+
3
+ ## Selection Condition
4
+
5
+ Select when the state model exists and evidence authority, admissibility, overlapping-guard precedence, or deterministic tie-breaks remain incomplete.
6
+
7
+ ## Bounded Work
8
+
9
+ - Update [Transition Guards and Precedence](../references/authoring-contract.md#transition-guards-and-precedence).
10
+ - Apply this authority order: current direct evidence, fresh valid in-scope workflow-native artifacts, latest committed handoff, suggested route.
11
+ - Define freshness, scope, and validity checks for each transition.
12
+ - Audit overlapping guards and assign deterministic precedence until every legal conflict selects one route.
13
+
14
+ ## Checkable Completion State
15
+
16
+ - Every ambiguous eligibility set resolves to exactly one route.
17
+ - Stale, out-of-scope, and invalid evidence loses eligibility.
18
+ - Every overlap has an explicit precedence or tie-break rule.
19
+
20
+ ## Durable Phase Outcome
21
+
22
+ Update the `define-authority` entry in `<target-skill>/AUTHORING-HANDOFF.md` with the authority artifact, separate conflict checks, blockers, and any unresolved overlap.
23
+
24
+ ## Stop or Re-entry
25
+
26
+ Stop after writing the outcome, or re-enter root. Do not load another phase directly.
@@ -0,0 +1,34 @@
1
+ # Define Durable Handoffs
2
+
3
+ ## Selection Condition
4
+
5
+ Select when target gates exist and their workflow-owned handoff schema, durable storage, discovery rule, or exit coverage is missing or inconsistent.
6
+
7
+ ## Bounded Work
8
+
9
+ - Update the [Gate Contract](../references/authoring-contract.md#gate-contract) and [Durable Handoff Questions](../references/authoring-contract.md#durable-handoff-questions).
10
+ - Define gate-scoped handoff vocabulary and schema for the target workflow.
11
+ - Preserve the canonical categories: phase, phase-scoped status, scope, artifacts, validation, workflow-specific domain state, optional UI evidence, next suggested route, and blockers.
12
+ - Use the workflow's own domain-state label; for example, a delivery workflow may use `Review/debug/docs state`.
13
+ - Name the durable storage location and the rule for discovering the latest applicable handoff.
14
+ - Preserve only state that current artifacts cannot safely reconstruct.
15
+ - Add run, revision, attempt, or dependency identity only when reliable resume requires it.
16
+ - Keep route suggestions optional, advisory, and lowest authority.
17
+ - Require every declared completion, blocker, skip or no-op, and human-checkpoint exit to write a durable handoff when applicable.
18
+ - Require the [human steering terminal](../references/authoring-contract.md#human-steering-terminal)
19
+ to preserve the `$handback` outcome and authority guard.
20
+
21
+ ## Checkable Completion State
22
+
23
+ - Every target gate exit writes a discoverable durable handoff.
24
+ - The schema keeps the canonical categories while allowing a workflow-specific domain-state label.
25
+ - Storage and discovery rules are explicit.
26
+ - Current evidence can override a stale or contradictory suggestion.
27
+
28
+ ## Durable Phase Outcome
29
+
30
+ Update the `define-handoffs` entry in `<target-skill>/AUTHORING-HANDOFF.md` with the handoff contract artifact, separate exit-coverage checks, blockers, and unresolved irreducible state.
31
+
32
+ ## Stop or Re-entry
33
+
34
+ Stop after writing the outcome, or re-enter root. Do not load another phase directly.
@@ -0,0 +1,30 @@
1
+ # Model Evidence State
2
+
3
+ ## Selection Condition
4
+
5
+ Select when obligations are qualified and the evidence-defined state model, topology, guards, or obligation reachability is missing, stale, or contradictory.
6
+
7
+ ## Bounded Work
8
+
9
+ - Update [State and Topology](../references/authoring-contract.md#state-and-topology).
10
+ - Define states from durable evidence instead of conversational progress.
11
+ - Map every mandatory obligation to reachable states and transitions.
12
+ - Define applicable paths, branches, cycles, skips, and checkpoints. Mark other topology forms N/A.
13
+ - Add freshness, scope, and validity guards where evidence can change or conflict.
14
+ - Model the [human steering terminal](../references/authoring-contract.md#human-steering-terminal)
15
+ and make it reachable from every applicable gate.
16
+
17
+ ## Checkable Completion State
18
+
19
+ - Every state has scope, entry guard, exit guard, and reachable next states.
20
+ - Every mandatory obligation is reachable and evidence-backed.
21
+ - Each topology form is represented or marked N/A.
22
+ - `human_steering_required` is terminal until the `$handback` authority guard passes.
23
+
24
+ ## Durable Phase Outcome
25
+
26
+ Update the `model-state` entry in `<target-skill>/AUTHORING-HANDOFF.md` with the state artifacts, separate reachability and topology checks, blockers, and unresolved obligations.
27
+
28
+ ## Stop or Re-entry
29
+
30
+ Stop after writing the outcome, or re-enter root. Do not load another phase directly.
@@ -0,0 +1,27 @@
1
+ # Qualify the Workflow
2
+
3
+ ## Selection Condition
4
+
5
+ Select when workflow bounds, mandatory obligations, or survivor artifacts are unresolved.
6
+
7
+ ## Bounded Work
8
+
9
+ - Update the [Obligation Map](../references/authoring-contract.md#obligation-map).
10
+ - Record every mandatory obligation, owner, evidence artifact, and audit criterion.
11
+ - Identify intermediate artifacts that must survive interruption or later audit.
12
+ - Default every multi-step skill to a graph.
13
+ - Choose direct composition only for one atomic, discardable, cheap-to-restart action with no routing, repair, or resume obligation.
14
+
15
+ ## Checkable Completion State
16
+
17
+ - Every mandatory obligation has an owner, evidence artifact, and audit criterion.
18
+ - Every survivor artifact is named.
19
+ - Graph authoring is selected for multi-step work, or the direct-composition decision proves the action is atomic, discardable, cheap to restart, and free of routing, repair, and resume obligations.
20
+
21
+ ## Durable Phase Outcome
22
+
23
+ Update the `qualify` entry in `<target-skill>/AUTHORING-HANDOFF.md` with the obligation artifact, separate qualification checks, blockers, and the graph or direct-composition decision.
24
+
25
+ ## Stop or Re-entry
26
+
27
+ For direct composition, stop without claiming a graph-based skill was authored. Otherwise stop or re-enter root.
@@ -0,0 +1,36 @@
1
+ # Authoring Router
2
+
3
+ ## Selection Condition
4
+
5
+ Load this file on every invocation and re-entry before any authoring phase. Resume from current target artifacts and evidence without relying on transcript continuity.
6
+
7
+ ## Bounded Work
8
+
9
+ 1. Inspect the target `SKILL.md`, flat `phases/` directory, operational references, and `<target-skill>/AUTHORING-HANDOFF.md`.
10
+ 2. Treat current direct evidence and fresh valid target artifacts as authoritative. Treat recorded outcomes as supporting evidence and route suggestions as advisory.
11
+ 3. Reuse fresh, complete, consistent artifacts.
12
+ 4. Select the earliest missing, stale, or contradictory phase:
13
+ - unresolved bounds -> `qualify.md`
14
+ - incomplete state model -> `model-state.md`
15
+ - incomplete authority rules -> `define-authority.md`
16
+ - missing or invalid target bootstrap/router -> `write-router.md`
17
+ - missing or invalid target gate files -> `write-phases.md`
18
+ - incomplete handoff contract -> `define-handoffs.md`
19
+ - invalid disclosure or unreachable pointers -> `verify-disclosure.md`
20
+ - incomplete or mismatched route tests -> `test-routes.md`
21
+ - incomplete terminal audit -> `audit.md`
22
+ 5. When guards overlap, apply the declared evidence authority and deterministic precedence before selecting.
23
+
24
+ ## Checkable Completion State
25
+
26
+ - Exactly one phase filename, one blocked outcome, or the audit-complete terminal is selected.
27
+ - The selection cites current evidence and explains every resolved overlap.
28
+ - Every selected filename exists under this skill's `phases/` directory.
29
+
30
+ ## Durable Phase Outcome
31
+
32
+ Update the `router` entry in `<target-skill>/AUTHORING-HANDOFF.md` with the inspected artifacts, separate validation evidence, blockers, unresolved obligations, and the selected phase or terminal. The selected phase remains advisory until root re-entry confirms it from current evidence.
33
+
34
+ ## Stop or Re-entry
35
+
36
+ Return the selection to root. Root loads exactly one selected phase. Stop on blocked or audit-complete outcomes.
@@ -0,0 +1,33 @@
1
+ # Test Target Routes
2
+
3
+ ## Selection Condition
4
+
5
+ Select when disclosure passes and route predictions, derivations, or mismatch repairs are incomplete or stale.
6
+
7
+ ## Bounded Work
8
+
9
+ - Update the [Route Matrix](../references/authoring-contract.md#route-matrix-ten-scenarios).
10
+ - Record each predicted route before applying the target contracts.
11
+ - Derive each route from current evidence, authority, guards, and precedence.
12
+ - Cover all ten scenarios: baseline path, branch path, repair cycle, planned
13
+ human checkpoint, failure handback terminal, cold resume, stale or
14
+ out-of-scope or invalid artifact, contradictory suggested route losing to
15
+ evidence, narrower executor substitution with a stable actor-like gate
16
+ boundary, and premature completion rejected by the terminal guard.
17
+ - Keep the planned checkpoint distinct from the
18
+ [human steering terminal](../references/authoring-contract.md#human-steering-terminal).
19
+ - Repair only mismatches, then repeat prediction and derivation for the repaired case.
20
+
21
+ ## Checkable Completion State
22
+
23
+ - All ten scenarios contain prediction, derived route, and match result.
24
+ - Stale, out-of-scope, and invalid artifacts each appear as a subcase.
25
+ - Mismatches contain repair evidence; matches contain no speculative repair.
26
+
27
+ ## Durable Phase Outcome
28
+
29
+ Update the `test-routes` entry in `<target-skill>/AUTHORING-HANDOFF.md` with the route matrix artifact, separate scenario results, blockers, mismatches, and completed repairs.
30
+
31
+ ## Stop or Re-entry
32
+
33
+ Stop after writing the outcome, or re-enter root. Do not load another phase directly.
@@ -0,0 +1,28 @@
1
+ # Verify Progressive Disclosure
2
+
3
+ ## Selection Condition
4
+
5
+ Select when target root, router, gates, and handoffs exist while context loading, pointer reachability, sibling isolation, or reference placement is unverified or invalid.
6
+
7
+ ## Bounded Work
8
+
9
+ - Trace one target invocation from bootstrap to router to one selected gate.
10
+ - Verify the loaded context contains bootstrap, router, and exactly one selected gate.
11
+ - Resolve every operational pointer from target root, router, and selected phases.
12
+ - Keep sibling gate files outside the trace.
13
+ - Keep references shared, or split them only when a genuine conditional branch saves unrelated context.
14
+ - Move any executable gate body found in a reference into its flat target phase file.
15
+
16
+ ## Checkable Completion State
17
+
18
+ - The context trace contains target bootstrap, router, and exactly one selected gate.
19
+ - Every operational reference is reachable from root, router, or the selected phase.
20
+ - Every pointer resolves, sibling gates remain unloaded, and references contain no executable gate body.
21
+
22
+ ## Durable Phase Outcome
23
+
24
+ Update the `verify-disclosure` entry in `<target-skill>/AUTHORING-HANDOFF.md` with the context trace, separate pointer and isolation checks, blockers, and unreachable material.
25
+
26
+ ## Stop or Re-entry
27
+
28
+ Stop after writing the outcome, or re-enter root. Do not load another phase directly.
@@ -0,0 +1,33 @@
1
+ # Write Every Target Gate
2
+
3
+ ## Selection Condition
4
+
5
+ Select when the target router exists and one or more executable target gates are missing, stale, embedded in root or references, or inconsistent with router selection.
6
+
7
+ ## Bounded Work
8
+
9
+ - Update the [Gate Contract](../references/authoring-contract.md#gate-contract).
10
+ - Create a flat target `phases/` directory.
11
+ - Create one `phases/<gate>.md` for every executable gate or step selected by the target router.
12
+ - Give every gate file these contracts: guard, inputs, bounded action or delegation, invariants, completion evidence, declared exits, durable handoff, and stop or router re-entry.
13
+ - When a gate uses a narrower executor, keep reconciliation, validation, and the durable handoff owned by the actor-like gate boundary.
14
+ - Move executable gate bodies out of target root and references.
15
+ - Apply the [human steering terminal](../references/authoring-contract.md#human-steering-terminal)
16
+ from each applicable gate.
17
+
18
+ ## Checkable Completion State
19
+
20
+ - Every router-selected gate filename exists.
21
+ - Every executable gate has exactly one flat phase file.
22
+ - Every gate defines the normalized contract and emits only declared exits.
23
+ - Target root and references contain no executable gate body.
24
+ - Every applicable gate invokes `$handback` and emits only the terminal's
25
+ durable outcome when its guard selects human steering.
26
+
27
+ ## Durable Phase Outcome
28
+
29
+ Update the `write-phases` entry in `<target-skill>/AUTHORING-HANDOFF.md` with the gate-file artifacts, separate filename and contract checks, blockers, and any missing router-selected gate.
30
+
31
+ ## Stop or Re-entry
32
+
33
+ Stop after writing the outcome, or re-enter root. Do not load another phase directly.
@@ -0,0 +1,30 @@
1
+ # Write the Target Router
2
+
3
+ ## Selection Condition
4
+
5
+ Select when bounds, state, and authority are complete while the target root bootstrap or target `phases/router.md` is missing, stale, or invalid.
6
+
7
+ ## Bounded Work
8
+
9
+ - Update the [Router Contract](../references/authoring-contract.md#router-contract).
10
+ - Write or repair the target `SKILL.md` as bootstrap and invocation guidance.
11
+ - Write or repair the target `phases/router.md` so it derives the next route from current evidence, active obligations, current artifacts, and committed handoffs.
12
+ - Make cold resume independent of transcript continuity.
13
+ - Return exactly one selected gate, terminal, checkpoint, or blocked outcome for every legal state.
14
+ - Preserve the [human steering terminal](../references/authoring-contract.md#human-steering-terminal)
15
+ until the `$handback` authority guard passes.
16
+ - Preserve the target's intentional invocation policy.
17
+
18
+ ## Checkable Completion State
19
+
20
+ - The target root contains no executable gate body.
21
+ - The target router resolves every legal state and conflict to exactly one output.
22
+ - Every selected gate filename is a flat path under target `phases/`.
23
+
24
+ ## Durable Phase Outcome
25
+
26
+ Update the `write-router` entry in `<target-skill>/AUTHORING-HANDOFF.md` with the root and router artifacts, separate route checks, blockers, and unresolved legal states.
27
+
28
+ ## Stop or Re-entry
29
+
30
+ Stop after writing the outcome, or re-enter root. Do not load another phase directly.
@@ -0,0 +1,211 @@
1
+ # Authoring Contract for Durable Workflow Graph Skills
2
+
3
+ Use this contract when you are creating a graph-based skill, converting a linear multi-step skill, or auditing and repairing routing failures.
4
+
5
+ ## Authoring Phase Outcome
6
+
7
+ Every creator phase writes or updates its entry in `<target-skill>/AUTHORING-HANDOFF.md`. The authoring router discovers the record at that exact path. This authoring record is separate from the target skill's runtime handoff contract.
8
+
9
+ ```text
10
+ Phase:
11
+ Status:
12
+ Scope:
13
+ Artifacts:
14
+ Validation:
15
+ Domain state:
16
+ UI Evidence:
17
+ Next suggested route:
18
+ Blockers:
19
+ Resume identity:
20
+ ```
21
+
22
+ Status is phase-scoped. Keep artifacts and validation separate, use domain state for authoring decisions or unresolved obligations, and omit UI evidence when it is not applicable. The next suggested route is advisory; router re-entry derives the route from current evidence. Resume identity contains only run, revision, attempt, or dependency fields that current artifacts cannot reconstruct reliably.
23
+
24
+ ## Obligation Map
25
+
26
+ | Obligation | Mandatory | Survives interruption | Evidence artifact | Owner | Audit criterion |
27
+ |---|---|---|---|---|---|
28
+ | | | | | | |
29
+ | | | | | | |
30
+
31
+ Freshness note:
32
+ - Assign freshness checks wherever evidence can change while waiting.
33
+
34
+ Default decision:
35
+ - Use a graph for every multi-step skill.
36
+ - Use direct composition only for one atomic, discardable, cheap-to-restart action with no routing, repair, or resume obligation.
37
+
38
+ Completion criterion:
39
+ - Mandatory obligations each include evidence artifact and audit criterion.
40
+ - Graph authoring is selected unless the direct-composition exception is proved.
41
+
42
+ ## State and Topology
43
+
44
+ ### State Table
45
+
46
+ | State ID | Meaning | Scope | Entry guard | Exit guard | Next states |
47
+ |---|---|---|---|---|---|
48
+ | | | | | | |
49
+ | | | | | | |
50
+
51
+ ### Gate Table
52
+
53
+ | Gate ID | Entry guard | Actor-like gate boundary owner | Internal delegation policy | Reconciliation rule | Outputs | Exit semantics | Durable handoff |
54
+ |---|---|---|---|---|---|---|---|
55
+ | | | | | | | | |
56
+ | | | | | | | | |
57
+
58
+ ### Graph Layer
59
+
60
+ | Path | Branch condition | Cycle target | Skip condition | Checkpoint condition |
61
+ |---|---|---|---|---|
62
+ | | | | | |
63
+ | | | | | |
64
+
65
+ Completion criterion:
66
+ - Every state defines scope, entry guard, exit guard, and next states.
67
+ - Every branch/cycle/skip/checkpoint form is represented in Graph Layer or marked N/A.
68
+
69
+ ## Transition Guards and Precedence
70
+
71
+ | Transition | Evidence condition | Freshness | Scope | Validity | Conflicts | Tie-break rule | Derived route |
72
+ |---|---|---|---|---|---|---|---|
73
+ | | | | | | | | |
74
+ | | | | | | | | |
75
+
76
+ Authority table:
77
+
78
+ | Signal | Priority | Allowed when conditions pass |
79
+ |---|---|---|
80
+ | Current direct evidence | 1 | evidence is direct and admissible |
81
+ | Fresh workflow-native artifacts | 2 | artifact is fresh, valid, and in scope |
82
+ | Committed handoff | 3 | handoff is committed and intact |
83
+ | Suggested route | 4 | suggestion only |
84
+
85
+ Completion criterion:
86
+ - Every ambiguous set has an explicit precedence path and deterministic tie-break to one route.
87
+
88
+ ## Router Contract
89
+
90
+ Inputs:
91
+ - current evidence,
92
+ - active obligations,
93
+ - current artifacts,
94
+ - committed handoffs,
95
+ - terminal flags.
96
+
97
+ Outputs:
98
+ - Exactly one of:
99
+ 1) one selected gate,
100
+ 2) one terminal route,
101
+ 3) one checkpoint route,
102
+ 4) one blocked route.
103
+
104
+ Rules:
105
+ - Router names the internal transition contract.
106
+ - Decision recomputes on re-entry and cold resume using the authority table.
107
+
108
+ Completion criterion:
109
+ - one output route for each legal state.
110
+
111
+ ## Human Steering Terminal
112
+
113
+ Every graph includes `human_steering_required` as a terminal, non-success
114
+ state. The gate that selects it invokes `$handback`, writes that skill's durable
115
+ outcome, and stops. The router keeps returning the terminal until the
116
+ `$handback` authority guard passes.
117
+
118
+ ## Gate Contract
119
+
120
+ For each gate define:
121
+
122
+ - Entry guard.
123
+ - Actor-like gate boundary and bounded ownership.
124
+ - Optional internal delegation.
125
+ - Reconciliation plan for delegated work.
126
+ - Output artifacts and validation.
127
+ - Exit semantics in workflow-owned vocabulary.
128
+ - Durable handoff.
129
+
130
+ Use this category shape for each produced target handoff:
131
+
132
+ ```text
133
+ Phase:
134
+ Status:
135
+ Scope:
136
+ Artifacts:
137
+ Validation:
138
+ Domain state:
139
+ UI Evidence:
140
+ Next suggested route:
141
+ Blockers:
142
+ Resume identity:
143
+ ```
144
+
145
+ Status remains phase-scoped, while the domain-state label uses workflow-specific vocabulary; for example, a delivery workflow may use `Review/debug/docs state`. UI evidence is optional. Resume identity includes only run, revision, attempt, or dependency fields required for reliable resume.
146
+
147
+ Across the graph, exit semantics coverage must include applicable operational outcomes:
148
+ - successful completion,
149
+ - blockers,
150
+ - intentional skip or no-op,
151
+ - human checkpoint.
152
+
153
+ The [human steering terminal](#human-steering-terminal) is distinct from a
154
+ planned human checkpoint.
155
+
156
+ Completion criterion:
157
+ - across the graph, coverage includes applicable completion, blocker, skip-or-no-op, and human-checkpoint meanings.
158
+ - each gate lists only outcomes it can emit.
159
+ - each actor-like gate boundary owns only its bounded work, and every exit writes a durable handoff.
160
+
161
+ ## Durable Handoff Questions
162
+
163
+ Ask only for state that the router cannot infer from current evidence:
164
+
165
+ - Which gate-local facts cannot be reconstructed from current artifacts?
166
+ - Which uncertainty blocks deterministic continuation?
167
+ - What exact evidence is missing to choose a safe next route?
168
+ - What minimum preserved state is needed for a reliable resume?
169
+
170
+ Optional note:
171
+ - A route suggestion may be attached but remains optional and lowest authority.
172
+
173
+ Completion criterion:
174
+ - each selected question is workflow-specific and captures state current evidence cannot infer.
175
+
176
+ ## Route Matrix (ten scenarios)
177
+
178
+ | Scenario | Predicted route (record first) | Derived route (apply contracts) | Match | Repair if mismatch |
179
+ |---|---|---|---|---|
180
+ | Baseline path | | | | |
181
+ | Branch path | | | | |
182
+ | Repair cycle | | | | |
183
+ | Human checkpoint | | | | |
184
+ | Failure handback terminal | | | | |
185
+ | Cold resume | | | | |
186
+ | Stale, out-of-scope, or invalid artifact | | | | |
187
+ | Contradictory suggested route loses to evidence | | | | |
188
+ | Nested executor substitution with an actor-like gate boundary | | | | |
189
+ | Premature completion rejected by terminal guard | | | | |
190
+
191
+ Completion criterion:
192
+ - all ten rows are filled with stale, out-of-scope, and invalid as subcases.
193
+ - the failure-handback row proves the `human_steering_required` terminal and
194
+ `$handback` authority guard; the planned human-checkpoint row remains distinct.
195
+ - repairs are present only when match is No.
196
+
197
+ ## Final Audit
198
+
199
+ - All mandatory obligations map to states and gates.
200
+ - Router and gates are deterministic under the authority table.
201
+ - Cold resume derives from current evidence, workflow-native artifacts, and committed handoffs.
202
+ - Every exit commits a durable handoff.
203
+ - `human_steering_required` invokes `$handback`, commits its outcome, and keeps
204
+ the terminal until that skill's authority guard passes.
205
+ - Terminal guard accounts for every mandatory obligation.
206
+ - The skill-protocol boundary is the set of written contracts and durable evidence.
207
+ - Markdown cannot enforce exclusive writers, execution ordering, or atomic persistence; require an external runtime only when one of those guarantees is a correctness requirement.
208
+ - Progressive-disclosure context-load trace shows bootstrap/router and the single selected gate only.
209
+
210
+ Completion criterion:
211
+ - all decisions required for safe route reconstruction and resume are resolved.
@@ -0,0 +1,27 @@
1
+ ---
2
+ name: handback
3
+ description: Hand control back when a blocker or proposed next step crosses accepted goal bounds, changes accepted requirements, weakens a gate, or substantially redesigns implementation.
4
+ ---
5
+
6
+ # Handback
7
+
8
+ Autonomy applies only while the next action remains inside the accepted goal.
9
+
10
+ Return `human_steering_required` with:
11
+
12
+ - initial goal and accepted bounds
13
+ - current phase and last known-good state
14
+ - attempts and evidence
15
+ - blocker and what it prevents
16
+ - proposed next action
17
+ - why it changes scope or authority
18
+ - exact human decision required
19
+
20
+ Preserve completed in-bounds work, then stop. The authority guard passes only
21
+ on explicit human authorization for the proposed next action. A proposal is not
22
+ authority. “All steps”, “full
23
+ delivery”, “do not stop”, and equivalent persistence language apply only within
24
+ accepted bounds.
25
+
26
+ `human_steering_required` is a terminal, non-success outcome. Expanded design,
27
+ implementation, delegation, and recursive review begin only after authority.