@surlymochan/evalid 0.0.0-stage → 0.4.1

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 (192) hide show
  1. package/CHANGELOG.md +94 -0
  2. package/LICENSE +21 -0
  3. package/README.md +315 -2
  4. package/RELEASE_NOTES.md +124 -0
  5. package/atoms/registry.json +758 -0
  6. package/bin/xflow.js +7261 -0
  7. package/docs/adoption/README.md +128 -0
  8. package/docs/adoption/openflow-release-hardening.md +61 -0
  9. package/docs/benchmark-openflow-vs-gstack-superpowers-openspec-2026-05-25.md +81 -0
  10. package/docs/compatibility.md +52 -0
  11. package/docs/competitive-benchmark.md +108 -0
  12. package/docs/corps-operator-guide.md +75 -0
  13. package/docs/demo-proof.md +126 -0
  14. package/docs/examples-gallery.md +115 -0
  15. package/docs/fixtures/tracker-item.json +7 -0
  16. package/docs/goal-vs-codex.md +129 -0
  17. package/docs/gstack-comparison.md +88 -0
  18. package/docs/install-upgrade.md +133 -0
  19. package/docs/integrations.md +49 -0
  20. package/docs/launch-demo.md +123 -0
  21. package/docs/launch-dossier.md +180 -0
  22. package/docs/methodology.md +149 -0
  23. package/docs/npm-publish-handoff.md +96 -0
  24. package/docs/openspec-migration.md +106 -0
  25. package/docs/public-benchmark.md +68 -0
  26. package/docs/public-release.md +145 -0
  27. package/docs/quality-assessment.md +139 -0
  28. package/docs/quickstart.md +156 -0
  29. package/docs/reviewer-guide.md +43 -0
  30. package/docs/spec-kit-benchmark.md +73 -0
  31. package/docs/super-assistant-comparison.md +106 -0
  32. package/docs/superpowers-comparison.md +82 -0
  33. package/docs/team-adoption.md +123 -0
  34. package/docs/tooling-matrix.md +91 -0
  35. package/docs/walkthrough.md +76 -0
  36. package/docs/workflow-manual.md +1130 -0
  37. package/package.json +83 -4
  38. package/prompts/pencil-draft.md +46 -0
  39. package/prompts/pencil-refine.md +46 -0
  40. package/prompts/phase-artifact.md +24 -0
  41. package/prompts/phase-execution.md +32 -0
  42. package/schemas/competitor-reconstruction-contract.schema.json +91 -0
  43. package/schemas/llm-design-review-aggregate.schema.json +83 -0
  44. package/schemas/visual-benchmark.schema.json +978 -0
  45. package/schemas/workflow.schema.json +100 -0
  46. package/scripts/run-tests.mjs +23 -0
  47. package/scripts/takein_digest.py +139 -0
  48. package/specs/README.md +118 -0
  49. package/specs/architecture.md +36 -0
  50. package/specs/product.md +33 -0
  51. package/specs/workflow.md +349 -0
  52. package/src/agent_team/atoms/codex-app-bridge.js +8 -0
  53. package/src/agent_team/atoms/design/competitor-reconstruction-review.js +44 -0
  54. package/src/agent_team/atoms/design/contract-freeze.js +8 -0
  55. package/src/agent_team/atoms/design/generation-contract.js +442 -0
  56. package/src/agent_team/atoms/design/reconstruction-pack.js +246 -0
  57. package/src/agent_team/atoms/design/reference-surface-lock.js +49 -0
  58. package/src/agent_team/atoms/patch-challenge.js +19 -0
  59. package/src/agent_team/atoms/pencil/accept.js +9 -0
  60. package/src/agent_team/atoms/pencil/draft.js +365 -0
  61. package/src/agent_team/atoms/pencil/refine.js +229 -0
  62. package/src/agent_team/atoms/phase-run-dispatch.js +8 -0
  63. package/src/agent_team/atoms/team-run.js +380 -0
  64. package/src/agent_team/atoms/visual/aesthetic-review.js +231 -0
  65. package/src/agent_team/atoms/visual/benchmark-repair-plan.js +291 -0
  66. package/src/agent_team/atoms/visual/benchmark.js +1652 -0
  67. package/src/agent_team/atoms/visual/design-selection.js +23 -0
  68. package/src/agent_team/atoms/visual/direction-synthesis.js +124 -0
  69. package/src/agent_team/atoms/visual/dom-rect-export.js +129 -0
  70. package/src/agent_team/atoms/visual/image-diff.js +186 -0
  71. package/src/agent_team/atoms/visual/layout-competition.js +8 -0
  72. package/src/agent_team/atoms/visual/page-evidence-capture.js +806 -0
  73. package/src/agent_team/atoms/visual/playwright-runtime.js +8 -0
  74. package/src/agent_team/atoms/visual/review-aggregate.js +87 -0
  75. package/src/agent_team/atoms/visual/review.js +77 -0
  76. package/src/agent_team/atoms/visual/visual-report.js +197 -0
  77. package/src/agent_team/atoms/visual/visual-token-export.js +417 -0
  78. package/src/agent_team/common.js +311 -0
  79. package/src/core/atoms/agent-invoke.js +684 -0
  80. package/src/core/atoms/event/ingest.js +30 -0
  81. package/src/core/atoms/experience/digest.js +55 -0
  82. package/src/core/atoms/gate/artifact-verify.js +83 -0
  83. package/src/core/atoms/gate/competitor-contract-validate.js +119 -0
  84. package/src/core/atoms/gate/evidence-collect.js +64 -0
  85. package/src/core/atoms/gate/payload-from-phase-run.js +78 -0
  86. package/src/core/atoms/gate/visual-benchmark-validate.js +183 -0
  87. package/src/core/atoms/gate/workbench.js +79 -0
  88. package/src/core/atoms/intake/classify.js +15 -0
  89. package/src/core/atoms/intake/design-skill-select.js +16 -0
  90. package/src/core/atoms/intake/preview-or-refine.js +19 -0
  91. package/src/core/atoms/intake/recommend.js +20 -0
  92. package/src/core/atoms/intake/research-same-category.js +19 -0
  93. package/src/core/atoms/intervention/create.js +30 -0
  94. package/src/core/atoms/memory/manage.js +27 -0
  95. package/src/core/atoms/memory/mount.js +13 -0
  96. package/src/core/atoms/mission/create.js +19 -0
  97. package/src/core/atoms/mission/list.js +14 -0
  98. package/src/core/atoms/mission/show.js +26 -0
  99. package/src/core/atoms/notify/checkpoint.js +46 -0
  100. package/src/core/atoms/phase-run/complete.js +42 -0
  101. package/src/core/atoms/phase-run/fail.js +40 -0
  102. package/src/core/atoms/phase-run/persist.js +39 -0
  103. package/src/core/atoms/phase-run/start.js +30 -0
  104. package/src/core/atoms/plugin/run.js +76 -0
  105. package/src/core/atoms/policy/gate.js +90 -0
  106. package/src/core/atoms/policy/resolve.js +11 -0
  107. package/src/core/atoms/storage/sync.js +57 -0
  108. package/src/core/atoms/workflow/advance.js +25 -0
  109. package/src/core/atoms/workflow/guard.js +127 -0
  110. package/src/core/atoms/workflow/state-load.js +37 -0
  111. package/src/core/bindings.js +37 -0
  112. package/src/core/change-artifacts.js +134 -0
  113. package/src/core/competitive-score.js +265 -0
  114. package/src/core/concurrency-policy.js +35 -0
  115. package/src/core/execution-log.js +108 -0
  116. package/src/core/intake-recommendation.js +134 -0
  117. package/src/core/memory-state.js +62 -0
  118. package/src/core/mission-state.js +780 -0
  119. package/src/core/pending-gates.js +66 -0
  120. package/src/core/phase-cost.js +116 -0
  121. package/src/core/phase-run-read.js +27 -0
  122. package/src/core/policy-overlay.js +180 -0
  123. package/src/core/state-store.js +201 -0
  124. package/src/core/workflow-executor.js +1014 -0
  125. package/src/core/workflow-integrity.js +111 -0
  126. package/src/core/workflow-loader.js +163 -0
  127. package/src/core/workflow-rerun.js +84 -0
  128. package/src/core/workflow-state.js +119 -0
  129. package/src/server.js +1307 -0
  130. package/workflows/corps.yaml +481 -0
  131. package/workflows/yolo.yaml +241 -0
  132. package/xflow/README.md +76 -0
  133. package/xflow/aha/SKILL.md +82 -0
  134. package/xflow/aha/scripts/append_aha.py +50 -0
  135. package/xflow/archive/scripts/archive_change.py +338 -0
  136. package/xflow/archive/templates/merge-design.md +54 -0
  137. package/xflow/archive/templates/merge-workflow.md +26 -0
  138. package/xflow/atoms/__init__.py +6 -0
  139. package/xflow/atoms/a1_issue_create_or_patch.py +70 -0
  140. package/xflow/atoms/a2_branch_create_and_link.py +42 -0
  141. package/xflow/atoms/a3_repo_doctor.py +11 -0
  142. package/xflow/atoms/a4_project_set_status.py +11 -0
  143. package/xflow/atoms/a5_archive_commit_push_close.py +11 -0
  144. package/xflow/atoms/a6_pr_create.py +72 -0
  145. package/xflow/atoms/b1_change_scaffold.py +11 -0
  146. package/xflow/atoms/b2_status_read.py +16 -0
  147. package/xflow/atoms/b2b_status_write.py +20 -0
  148. package/xflow/atoms/b3_status_transition.py +27 -0
  149. package/xflow/atoms/b4_handoff_scaffold_or_refresh.py +11 -0
  150. package/xflow/atoms/b5_aha_append.py +11 -0
  151. package/xflow/atoms/b6_takein_digest.py +11 -0
  152. package/xflow/atoms/b6b_lookback_digest.py +11 -0
  153. package/xflow/atoms/b7_change_mission_bind.py +43 -0
  154. package/xflow/atoms/c1_mem.py +54 -0
  155. package/xflow/atoms/e6_gate_local_precheck.py +23 -0
  156. package/xflow/atoms/h1_design_lite_gate.py +74 -0
  157. package/xflow/atoms/i6a_tdd_run.py +107 -0
  158. package/xflow/atoms/i6b_tdd_proof_validate.py +184 -0
  159. package/xflow/atoms/i6c_tdd_quality_review.py +372 -0
  160. package/xflow/atoms/j1_tests_run.py +129 -0
  161. package/xflow/atoms/j4a_spec_consistency_structural.py +105 -0
  162. package/xflow/atoms/j4b_spec_delta_review.py +316 -0
  163. package/xflow/atoms/j4c_openspec_migration_map.py +121 -0
  164. package/xflow/atoms/j4d_spec_clarify_gate.py +373 -0
  165. package/xflow/atoms/j6_cr_review.py +443 -0
  166. package/xflow/atoms/k1_artifacts_complete_check.py +39 -0
  167. package/xflow/atoms/k2_merge_snippets_apply.py +11 -0
  168. package/xflow/atoms/k3_handoff_refresh.py +14 -0
  169. package/xflow/atoms/k4_mem_lesson_persist.py +65 -0
  170. package/xflow/atoms/k5_archive_publish.py +21 -0
  171. package/xflow/atoms/k6_aha_merge.py +42 -0
  172. package/xflow/atoms/tdd_lib.py +956 -0
  173. package/xflow/corps/SKILL.md +109 -0
  174. package/xflow/exec/scripts/set_issue_in_progress.py +159 -0
  175. package/xflow/goal/SKILL.md +150 -0
  176. package/xflow/handoff/SKILL.md +95 -0
  177. package/xflow/handoff/scripts/scaffold_handoff.py +304 -0
  178. package/xflow/lookback/SKILL.md +66 -0
  179. package/xflow/lookback/scripts/lookback_digest.py +46 -0
  180. package/xflow/openissue/scripts/open_issue_flow.py +438 -0
  181. package/xflow/plan/SKILL.md +47 -0
  182. package/xflow/ralph/SKILL.md +123 -0
  183. package/xflow/scripts/check_installed_xflow_skill_sync.sh +44 -0
  184. package/xflow/scripts/common.py +483 -0
  185. package/xflow/scripts/doctor.py +278 -0
  186. package/xflow/scripts/sync_installed_xflow_skill.sh +134 -0
  187. package/xflow/takein/SKILL.md +81 -0
  188. package/xflow/takein/scripts/takein_digest.py +88 -0
  189. package/xflow/yolo/SKILL.md +75 -0
  190. package/xflow/yolo/scripts/scaffold_specs_change.py +673 -0
  191. package/xflow/yolo/scripts/yolo_gate.py +312 -0
  192. package/xflow/yolo/templates/DESIGN.md +179 -0
@@ -0,0 +1,109 @@
1
+ ---
2
+ name: xflow:corps
3
+ description: "重型多 agent 全产品交付工作流。适用于复杂用户界面、设计闭环和多 agent 协作。可复用 xflow:plan 产物,或在缺少 plan 时先补一轮通用规划。"
4
+ ---
5
+
6
+ # Superflow Corps
7
+
8
+ `xflow:corps` is the heavy execution track. Planning is shared with
9
+ `xflow:plan` and is not track-specific.
10
+
11
+ ## Single entry rule
12
+
13
+ - Execute through `xflow corps --title "<title>" --change-type frontend --change-id <id>`.
14
+ - Use `xflow corps --explain` before a first run when the operator needs the
15
+ compressed guide, proof contract, competitor-led inputs, and failure meanings.
16
+ - Do not manually simulate the heavy workflow in chat, by ad hoc shell steps, or by treating partial file checks as completion.
17
+ - `xflow workflow validate corps` is preflight only. It proves YAML shape, not workflow execution.
18
+ - Completion requires `specs/changes/${CHANGE_ID}/corps_proof.json` with `ok=true`.
19
+ - `corps_proof.json` must be backed by the built-in governed corps manifest, hash-linked execution-log records, `workflow_started`/`workflow_completed`, `phase_started`/`phase_completed` for every canonical phase, successful atom/gate witnesses, and zero `stub`, `task_queued`, or `pencil_stubbed` runtime fallback.
20
+ - Project-local workflow config may customize normal workflow aliases, but the governed `xflow corps` entry and `xflow proof --track corps` use the built-in corps workflow so the heavy path cannot be shortened through config.
21
+ - Heavy agent work must be issued by the workflow runtime/control plane and its `agent_invoke` task packages; the conversation AI should not improvise a parallel private workflow.
22
+ - The conversation AI represents the human operator: clarify requirements before execution, let the governed `corps` entry auto-approve scripted human gates, and inspect final proof before accepting success.
23
+
24
+ ## Plan reuse rule
25
+
26
+ - Read project root `.xflow/GOAL.md` when present and use it as direction
27
+ context only. Before executing, state how the product contract aligns with,
28
+ narrows, or intentionally diverges from the project goal.
29
+ - Reuse `specs/changes/${CHANGE_ID}/plan.md` when it is current.
30
+ - If the plan is missing or still a scaffold placeholder, create it once before continuing.
31
+ - Planning stays track-neutral; do not re-run it just because the workflow is heavy-track.
32
+
33
+ ## Optional long-run notes
34
+
35
+ For research-heavy or long-running changes, keep optional `findings.md` and
36
+ `progress.md` alongside the plan when they help the team stay aligned.
37
+ These notes are auxiliary; they do not replace `plan.md`.
38
+ If the change also affects workflow semantics, add a `merge-workflow.md`
39
+ stub with an explicit capability delta section.
40
+
41
+ ## When to use corps
42
+
43
+ - New user-facing screen or interaction pattern
44
+ - Visual quality matters and needs Pencil + multimodal review
45
+ - Multiple agents should propose or critique
46
+ - The risk or scope requires formal sign-off
47
+
48
+ ## Execution contract
49
+
50
+ The heavy workflow runs the same phase family as yolo, but with the full design
51
+ loop and heavy-track gates. The workflow YAML is the canonical source for atom
52
+ order and gates. The CLI entry owns the execution and proof boundary.
53
+
54
+ ## Guardrails
55
+
56
+ - Keep planning track-neutral
57
+ - Reuse an existing plan when present
58
+ - Include goal alignment in the final proof review: `corps_proof.json ok=true`
59
+ is necessary, but the operator still has to check whether the proof satisfies
60
+ the project direction anchor.
61
+ - Confirm the linked branch and checkout are ready before moving into execution
62
+ - Do not expose deleted top-level utility skills as separate entry points
63
+ - For competitor-led UI work, freeze the competitor reconstruction contract before execution:
64
+ - corps entry should treat competitor-led UI as strict mode by default, not as a best-effort hint: once competitor-led signals are present, benchmark evidence becomes mandatory before execution continues
65
+ - name the competitor product and target surfaces explicitly
66
+ - lock exactly one `primary_reference_surface`; supporting surfaces may refine but must not replace the primary anchor
67
+ - map the required modules and IA, not just one visible page slice
68
+ - record business-logic invariants that must not be violated
69
+ - require exactly one benchmark evidence path for `H6.visual.benchmark`:
70
+ - `reference_scenarios_json`, or
71
+ - `capture_url + reference_image`
72
+ - before visual generation, freeze the structured reconstruction artifacts:
73
+ - `reference_surface_lock.json`
74
+ - `reconstruction_pack.json`
75
+ - `generation_contract.json`
76
+ - `design_system_pack.json`
77
+ - treat those artifacts as generation-time instructions, not just review evidence:
78
+ - `reconstruction_pack.json` should expose page-local `component_blueprint` primitives and a `relationship_graph`
79
+ - `generation_contract.json` should expose staged component generation (`shell`, `primary_focus`, `secondary_focus`, `polish`) plus `geometry_hints` / `token_hints`
80
+ - `pencil_draft` should build by stage, not by whole-page freeform redraw
81
+ - `benchmark_repair_plan.json` should downshift unresolved evidence into component-local `repair_targets`
82
+ - `pencil_refine` should preserve non-target components by default and only modify named repair targets
83
+ - `generation_contract.json` should include `visual_constraints.aesthetic_standard`, `image_reference_generation`, and `pencil_role_boundary`
84
+ - `design_system_pack.json` should compile commercial/open UI generation practices into generic constraints: React/component-system stack defaults, component whitelist, required states, token policy, local preview/refine loop, and structured UI generation rules
85
+ - `image_reference_set.json` must materialize the required image-reference outputs (`primary_surface_reference_frame`, `component_density_sheet`, `state_polish_sheet`) and every listed reference must point to an existing artifact
86
+ - Pencil is the editable assembly/refinement layer, not the sole high-aesthetic engine; when the host has GPT/imagev2-style image generation available, use it to produce reference frames and component/state sheets, then translate those into editable UI and benchmark evidence
87
+ - `H6d.visual.aesthetic_review` must accept the final recheck before design acceptance: high aesthetic contract present, design-system practice pack materialized, image reference artifacts materialized, Pencil boundary explicit, benchmark scenarios passing, and score at or above threshold
88
+ - when fidelity needs to reach commercial-grade polish, add `visual_token_contract` and `observed_visual_tokens` so benchmark can emit deterministic `token_checks`
89
+ - prefer token contracts that cover typography rhythm and surface treatment, not only font family and color: `line_height_range`, `letter_spacing_range`, `border_width_range`, `border_styles_required`, `shadow_signatures_required`
90
+ - when the competitor surface depends on interaction states, pass `capture_states_json` on the `capture_url + reference_image` path so benchmark captures hover/open/selected variants instead of only the base frame
91
+ - when the workbench has key semantic states such as detail-open, active-filter, selected-item, or bulk-select, add `state_contract.required_workbench_states` so benchmark emits deterministic `state_contract_checks` instead of treating all captured states as equally important
92
+ - when dense commercial UI matters, include icon and surface-depth tokens such as `icon_density_range`, `icon_size_range`, `border_weight_tiers_required`, and `shadow_strength_tiers_required`
93
+ - for iOS / Android / H5 surfaces, do not reuse desktop-only acceptance by habit: add mobile-oriented checks such as `min_touch_target_size` and mobile workspace patterns like `compact_top_nav`, `bottom_tabbar_docked`, or `bottom_sheet_over_content`
94
+ - for iOS / Android / H5 surfaces, also add mobile-native hard gates when relevant: `safe_area_top_panels`, `safe_area_bottom_panels`, `keyboard_aware_panels`, `thumb_reach_primary_action_panels`, `bottom_sheet_handle_required`, and `tabbar_active_state_required`
95
+ - for iOS / Android / H5 surfaces, keep going past layout: add mobile component signals such as `floating_primary_action_required` and `segmented_control_active_state_required`, and sample gesture states with `swipe_selector`, `drag_selector`, or `scroll_selector` when the target interaction depends on motion rather than static chrome
96
+ - when the target fidelity depends on motion or platform transitions, do not stop at one end-state screenshot: add `expect_motion`, `sample_frames`, and `frame_interval_ms`, and use `benchmark_matrix_contract` / `viewport_variants_json` when the product needs multiple viewport baselines to count as “close enough”
97
+ - when the goal is platform-native feel, add `required_platform_physics_profiles` such as `ios_spring`, `android_ripple`, or `mobile_h5_smooth` so benchmark checks motion language instead of only final pixels
98
+ - when polish depends on same-family components staying visually consistent, add `component_family_consistency` checks for families such as `toolbar_controls`, `list_rows`, and `detail_blocks` instead of only checking global min/max ranges
99
+ - when polish depends on interaction states using the same motion/contrast language, add `state_family_contract` so benchmark checks variant coverage and spread within families like `toolbar_controls`
100
+ - when those state families also need token-level consistency, include `state_visual_tokens` or rely on the `capture_url` path so benchmark can enforce token rules such as surface-color distinctness, shadow-tier distinctness, timing-function coverage, transition-duration spread, radius spread, and border-width spread across variants
101
+ - let `capture_url` auto-detect semantic product states like `loading_state`, `skeleton_state`, `error_state`, and `search_active` instead of silently skipping them from the proof bundle
102
+ - when the surface has many interactive affordances, `auto_discover_states` can be used as a first-pass fallback to capture likely hover/click states without hand-authoring every selector
103
+ - when visual rhythm matters, prefer adding `alignment_grid_step` / `alignment_grid_tolerance` so benchmark checks that major panels stay on a shared grid instead of only matching approximate widths
104
+ - treat `xflow visual capture-page-evidence` as the helper entrypoint when pre-capturing screenshot, DOM snapshot, and `dom_rects` outside the phase
105
+ - use `xflow visual render-report` or the benchmark-generated `visual_benchmark_report.html` when reviewers need a side-by-side compare viewer instead of raw JSON
106
+ - unresolved benchmark evidence should converge through the scripted repair loop: advisory `llm_design_review` -> `benchmark_repair_plan.json` -> `pencil_refine` -> strict `llm_design_recheck`
107
+ - reject "looks similar" acceptance without primary journey and cross-module proof
108
+ - Keep the pipeline generic: corps validates named competitors, product surfaces, journeys, and invariants, but it must not bake in any single business domain or product model.
109
+ - Domain rules belong in the current change contract, not in the workflow itself. A todo/GTD rule, trading rule, CRM rule, or editor rule should be expressed through `business_logic_invariants` for that change.
@@ -0,0 +1,159 @@
1
+ #!/usr/bin/env python3
2
+ import argparse
3
+ import json
4
+ import sys
5
+ from pathlib import Path
6
+
7
+ sys.path.append(str(Path(__file__).resolve().parents[2] / "scripts"))
8
+
9
+ from doctor import run_doctor_checks # noqa: E402
10
+ from common import ( # noqa: E402
11
+ assert_status_transition_allowed,
12
+ assert_stage_transition_allowed,
13
+ ensure_branch_checked_out,
14
+ find_git_root,
15
+ get_current_branch,
16
+ get_remote_url,
17
+ load_status,
18
+ maybe_relative,
19
+ record_stage_transition,
20
+ record_value_transition,
21
+ resolve_project_context,
22
+ save_status,
23
+ set_project_single_select_status,
24
+ upsert_issue_comment,
25
+ )
26
+
27
+
28
+ def parse_args() -> argparse.Namespace:
29
+ parser = argparse.ArgumentParser(description="Move a Superflow issue into In Progress and sync status metadata.")
30
+ parser.add_argument("--project-root", default=".", help="Project root containing specs/changes.")
31
+ parser.add_argument("--change-id", required=True, help="Superflow change id.")
32
+ parser.add_argument("--repo", help="Override repo from status.json.")
33
+ parser.add_argument("--issue-number", type=int, help="Override issue number from status.json.")
34
+ parser.add_argument("--branch-name", help="Override branch name from status.json.")
35
+ parser.add_argument("--checkout-path", help="Override checkout path from status.json.")
36
+ parser.add_argument("--project-owner", help="GitHub project owner login for project status updates.")
37
+ parser.add_argument("--project-number", type=int, help="GitHub project number for project status updates.")
38
+ parser.add_argument("--status-field-name", default="Status", help="Project single select field name.")
39
+ parser.add_argument("--target-status", default="In Progress", help="Project status option to apply.")
40
+ parser.add_argument("--skip-doctor-precheck", action="store_true", help="Skip the automatic doctor precheck before state transition.")
41
+ parser.add_argument("--skip-doctor-postcheck", action="store_true", help="Skip the automatic doctor postcheck after state transition.")
42
+ parser.add_argument("--json", action="store_true", help="Print machine-readable JSON output.")
43
+ return parser.parse_args()
44
+
45
+
46
+ def main() -> int:
47
+ args = parse_args()
48
+ status_path, status = load_status(args.project_root, args.change_id)
49
+
50
+ repo = args.repo or status.get("issue_repo") or status.get("target_repo")
51
+ issue_number = args.issue_number or status.get("issue_number")
52
+ branch_name = args.branch_name or status.get("branch_name")
53
+ checkout_path = Path(args.checkout_path or status.get("checkout_path") or find_git_root(args.project_root))
54
+ assert_stage_transition_allowed(status.get("current_stage"), "tdd", current_status=status.get("status"))
55
+ assert_status_transition_allowed(status.get("status"), "active")
56
+
57
+ if not repo or not issue_number or not branch_name:
58
+ raise SystemExit("status.json must include target_repo, issue_number, and branch_name or they must be passed explicitly.")
59
+
60
+ if not args.skip_doctor_precheck:
61
+ pre_result = run_doctor_checks(
62
+ project_root=args.project_root,
63
+ change_id=args.change_id,
64
+ repo=repo,
65
+ issue_number=int(issue_number),
66
+ branch_name=branch_name,
67
+ checkout_path_override=checkout_path,
68
+ )
69
+ if not pre_result["ok"]:
70
+ raise SystemExit("Doctor precheck failed before exec state transition. Run doctor.py for details.")
71
+
72
+ remote_url = get_remote_url(checkout_path)
73
+ ensure_branch_checked_out(checkout_path, branch_name)
74
+ current_branch = get_current_branch(checkout_path)
75
+ if current_branch != branch_name:
76
+ raise SystemExit(
77
+ f"Execution branch mismatch: current branch is {current_branch!r}, expected linked issue branch {branch_name!r}."
78
+ )
79
+
80
+ project_context = resolve_project_context(repo, int(issue_number), args.project_owner, args.project_number)
81
+ project_result = None
82
+ if project_context:
83
+ project_result = set_project_single_select_status(
84
+ project_context["owner"],
85
+ int(project_context["number"]),
86
+ args.status_field_name,
87
+ args.target_status,
88
+ repo,
89
+ int(issue_number),
90
+ )
91
+ else:
92
+ marker = "<!-- xflow:exec-state -->"
93
+ upsert_issue_comment(
94
+ repo,
95
+ int(issue_number),
96
+ marker,
97
+ f"Execution started on branch `{branch_name}`.\n\nNo GitHub Project context was provided, so Superflow recorded the active state via issue comment fallback.",
98
+ )
99
+
100
+ record_value_transition(status, "status", "active", reason="exec entered active implementation")
101
+ record_stage_transition(status, "tdd", reason="exec moved the linked issue into active implementation")
102
+ status["verification_status"] = "running"
103
+ status["next_action"] = "Implement on the linked branch, then verify and archive."
104
+ status["target_repo"] = repo
105
+ status["issue_repo"] = repo
106
+ status["issue_number"] = int(issue_number)
107
+ status["branch_name"] = branch_name
108
+ status["checkout_path"] = str(checkout_path)
109
+ status["execution_started"] = True
110
+ if project_result:
111
+ status["project_status"] = {
112
+ "owner": project_context["owner"],
113
+ "number": int(project_context["number"]),
114
+ "field_name": args.status_field_name,
115
+ "option_name": args.target_status,
116
+ "source": project_context.get("source", "explicit"),
117
+ **project_result,
118
+ }
119
+ save_status(status_path, status)
120
+ doctor_result = None
121
+ if not args.skip_doctor_postcheck:
122
+ doctor_result = run_doctor_checks(
123
+ project_root=args.project_root,
124
+ change_id=args.change_id,
125
+ repo=repo,
126
+ issue_number=int(issue_number),
127
+ branch_name=branch_name,
128
+ checkout_path_override=checkout_path,
129
+ )
130
+ if not doctor_result["ok"]:
131
+ raise SystemExit("Doctor postcheck failed after exec state transition. Run doctor.py for details.")
132
+
133
+ result = {
134
+ "change_id": args.change_id,
135
+ "repo": repo,
136
+ "issue_number": int(issue_number),
137
+ "branch_name": branch_name,
138
+ "checkout_path": str(checkout_path),
139
+ "remote_url": remote_url,
140
+ "project_status_updated": bool(project_result),
141
+ "project_context_source": project_context.get("source") if project_context else None,
142
+ "status_path": maybe_relative(status_path, base=args.project_root),
143
+ }
144
+ if doctor_result is not None:
145
+ result["doctor"] = {"ok": doctor_result["ok"], "hard_failures": doctor_result["hard_failures"], "warnings": doctor_result["warnings"]}
146
+ if args.json:
147
+ print(json.dumps(result, indent=2))
148
+ else:
149
+ print(f"Execution prepared for {repo}#{issue_number}")
150
+ print(f"Branch: {branch_name}")
151
+ print(f"Checkout: {checkout_path}")
152
+ print(f"Remote: {remote_url}")
153
+ print(f"Project status updated: {'yes' if project_result else 'fallback issue comment'}")
154
+ print(f"Status: {status_path}")
155
+ return 0
156
+
157
+
158
+ if __name__ == "__main__":
159
+ raise SystemExit(main())
@@ -0,0 +1,150 @@
1
+ ---
2
+ name: xflow:goal
3
+ description: Use when the user wants to set, inspect, update, clear, or align an xflow project goal, thread goal, direction anchor, anti-drift objective, or Codex native goal for a project.
4
+ ---
5
+
6
+ # xflow:goal
7
+
8
+ `xflow:goal` keeps one simple project-level direction anchor.
9
+
10
+ The MVP contract is intentionally small:
11
+
12
+ ```text
13
+ .xflow/GOAL.md
14
+ ```
15
+
16
+ Do not introduce session ids, named goal registries, active-goal pointers, or
17
+ multiple goal files unless the user explicitly asks for that complexity.
18
+
19
+ ## Advantage Over Codex Native Goal
20
+
21
+ Codex native goals are thread-local control and completion accounting. They are
22
+ valuable, but they do not by themselves create a repo-level artifact that future
23
+ threads, OpenCode, Claude Code, Cursor, or CI-visible workflow docs can inspect.
24
+
25
+ `xflow:goal` is better only when it stays durable and consumable:
26
+
27
+ - durable in `.xflow/GOAL.md`
28
+ - portable across agent tools
29
+ - read by `xflow:plan`, `xflow:yolo`, `xflow:corps`, `xflow:ralph`,
30
+ `xflow:handoff`, and `xflow:takein`
31
+ - included in completion audits as alignment evidence
32
+
33
+ If the current environment exposes Codex native goal controls, mirror the xflow
34
+ project goal into the native thread goal. Do not treat native sync as the source
35
+ of truth; the project artifact remains canonical for xflow.
36
+
37
+ ## When To Use
38
+
39
+ Use this skill when the user wants to:
40
+
41
+ - set a goal for the current project or thread
42
+ - see the active xflow goal
43
+ - audit whether the skill family still consumes the project goal
44
+ - update or clear the project goal
45
+ - make Ralph, yolo, corps, handoff, or takein stay aligned to a direction
46
+ - make xflow mirror Codex native goal behavior
47
+
48
+ ## Native Codex Goal Sync
49
+
50
+ When Codex native goal controls are available in the current environment,
51
+ set or update the active thread goal to match the xflow goal.
52
+
53
+ Do not hard-code a nonexistent CLI command such as `codex goal set`. If native
54
+ goal controls are not exposed, continue with `.xflow/GOAL.md` and explicitly
55
+ say that native thread-goal sync was unavailable.
56
+
57
+ ## Project Artifact
58
+
59
+ Use the current project root:
60
+
61
+ ```text
62
+ .xflow/GOAL.md
63
+ ```
64
+
65
+ Create `.xflow/` if needed.
66
+
67
+ Recommended file shape:
68
+
69
+ ```markdown
70
+ # xflow Goal
71
+
72
+ ## Goal
73
+
74
+ <one or a few paragraphs describing the project direction anchor>
75
+
76
+ ## Scope
77
+
78
+ - <what this goal covers>
79
+
80
+ ## Non-Goals
81
+
82
+ - <optional exclusions>
83
+
84
+ ## Updated
85
+
86
+ YYYY-MM-DD
87
+ ```
88
+
89
+ Keep it short enough to read at the start of later work.
90
+
91
+ ## Operations
92
+
93
+ ### Set
94
+
95
+ When the user asks to set a goal:
96
+
97
+ 1. Inspect whether `.xflow/GOAL.md` already exists.
98
+ 2. If an existing goal is clearly unrelated, warn before overwriting unless the
99
+ user has already said to replace it.
100
+ 3. Write the new goal into `.xflow/GOAL.md`.
101
+ 4. Try native Codex goal sync when available.
102
+ 5. Report the file path and whether native sync happened.
103
+
104
+ ### Show
105
+
106
+ When the user asks what the current goal is, read `.xflow/GOAL.md` and summarize
107
+ it. If the file is missing, say there is no xflow project goal yet.
108
+
109
+ ### Audit
110
+
111
+ When the user asks whether goal is useful, stale, or actually connected to the
112
+ workflow family, run or recommend:
113
+
114
+ ```bash
115
+ xflow goal audit --json
116
+ ```
117
+
118
+ The audit should prove both sides of the claim: a durable `.xflow/GOAL.md`
119
+ exists in the project, and the core skill family still declares that goal as
120
+ direction context for plan, yolo, corps, Ralph, handoff, and takein.
121
+
122
+ ### Update
123
+
124
+ When the user asks to update the goal, preserve still-current parts and patch
125
+ only the changed intent. If the update changes the direction materially, call
126
+ out that the goal changed.
127
+
128
+ ### Clear
129
+
130
+ When the user asks to clear the goal, remove or blank `.xflow/GOAL.md` only
131
+ after confirming they mean to remove the project direction anchor. If native
132
+ goal controls are available, clear the active thread goal too.
133
+
134
+ ## Integration Rules
135
+
136
+ - `xflow:ralph` should read `.xflow/GOAL.md` before planning substantial work
137
+ and include it in the completion audit.
138
+ - `xflow:plan` should use `.xflow/GOAL.md` as context when writing or refreshing
139
+ `specs/changes/<change-id>/plan.md`.
140
+ - `xflow:yolo` and `xflow:corps` should treat `.xflow/GOAL.md` as directional
141
+ context, not as a replacement for change scope, workflow status, or proof.
142
+ - `xflow:handoff` should include the current goal when refreshing `HANDOFF.md`.
143
+ - `xflow:takein` should read `.xflow/GOAL.md` when present so new threads
144
+ recover the project direction quickly.
145
+
146
+ ## Boundary
147
+
148
+ `xflow:goal` is not an executor. It does not run implementation, tests,
149
+ archive, or PR steps. Use `xflow:ralph`, `xflow:yolo`, or `xflow:corps` for
150
+ execution.
@@ -0,0 +1,95 @@
1
+ ---
2
+ name: xflow:handoff
3
+ description: 在当前项目根目录的 `HANDOFF.md` 中创建或刷新规范的项目交接文档。适用于用户要求编写 handoff、会话总结、下次会话简报、项目交接说明,或把项目背景、架构、任务状态、进展、问题、经验和建议汇总到一个根级交接文档中时。
4
+ ---
5
+
6
+ # Superflow Handoff
7
+
8
+ Write handoff into exactly one canonical file:
9
+
10
+ - project root `HANDOFF.md`
11
+
12
+ Do not maintain parallel handoff files such as:
13
+
14
+ - `MUST_READ_NEXT_SESSION.md`
15
+ - `NEXT_SESSION.md`
16
+ - `SESSION_SUMMARY.md`
17
+
18
+ If those files exist and are only duplicating handoff intent, fold any still-useful content into `HANDOFF.md` and remove or reduce the duplicate file so `HANDOFF.md` remains the single source of truth.
19
+
20
+ ## Required Output
21
+
22
+ Every handoff must cover these seven areas in root `HANDOFF.md`:
23
+
24
+ 1. project background
25
+ 2. architecture and non-negotiable invariants
26
+ 3. current task or objective
27
+ 4. progress / verified state
28
+ 5. open problems / risks / blockers
29
+ 6. lessons learned / operational gotchas
30
+ 7. concrete recommendations / next steps
31
+
32
+ If some area is unknown, say so explicitly instead of omitting it.
33
+
34
+ In addition, every handoff must include a high-density `Context Pack` section.
35
+
36
+ `Context Pack` is the canonical place to preserve high-signal facts without relying on long thread history.
37
+ It should be skimmable and referenceable (paths, commands, numbers, dates), and avoid long logs or full file dumps.
38
+
39
+ ## Workflow
40
+
41
+ 1. Inspect the current repo state first.
42
+ 2. Read project root `.xflow/GOAL.md` if present and include the current goal.
43
+ 3. Read the existing root `HANDOFF.md` if present.
44
+ 4. Search for any other handoff-style docs only if needed to recover useful context.
45
+ 5. Prefer evidence from the codebase, tests, recent tracker docs, and current repo status.
46
+ 6. Rewrite `HANDOFF.md` so it reflects the latest truth, not stale historical guesses.
47
+ 7. Keep the document concise but decision-useful.
48
+
49
+ ## Structure
50
+
51
+ Use this structure unless the project has a stronger established convention:
52
+
53
+ - title with project name and date
54
+ - `Current State`
55
+ - `Context Pack`
56
+ - `Project Background`
57
+ - `Architecture`
58
+ - `Current Objective`
59
+ - `Progress`
60
+ - `Open Problems`
61
+ - `Lessons Learned`
62
+ - `Recommendations`
63
+ - `Key Files`
64
+
65
+ `Recommendations` should be action-oriented and ordered.
66
+
67
+ ### Context Pack Format
68
+
69
+ Keep this section dense and easy to rehydrate after `/compact`:
70
+
71
+ - `TL;DR` (<= 40 lines): objective, current status, next action, key risks
72
+ - `Key Facts`: numbers, dates, invariants, known constraints (each with an anchor)
73
+ - `Decisions`: what was decided and why (1-2 lines each)
74
+ - `Commands`: 5-15 high-value commands (include flags and caveats)
75
+ - `Pointers`: 5-15 key files/dirs + 1-line description each
76
+ - `Gotchas`: sharp edges that caused real waste (rate limits, flaky tests, env vars, etc.)
77
+
78
+ ## Guardrails
79
+
80
+ - `HANDOFF.md` is the only canonical handoff.
81
+ - Do not scatter status across multiple root handoff docs.
82
+ - Do not keep known-false claims once newer verification exists.
83
+ - Distinguish verified facts from inferred judgments.
84
+ - Prefer repo-relative operational truth over conversational memory.
85
+
86
+ ## Script
87
+
88
+ The agent autonomously calls this scaffold when creating handoff:
89
+
90
+ ```bash
91
+ python3 ~/.codex/skills/xflow/handoff/scripts/scaffold_handoff.py
92
+ ```
93
+
94
+ Agent fills the scaffold with real project content.
95
+ User invokes skill, agent handles execution.