@geminix/gxpm 0.1.0

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 (299) hide show
  1. package/AGENTS.md +148 -0
  2. package/CANON.md +53 -0
  3. package/CLAUDE.md +60 -0
  4. package/CONTEXT.md +49 -0
  5. package/DEBUG.md +59 -0
  6. package/ISSUE_CONTEXT.md +25 -0
  7. package/README.md +143 -0
  8. package/VERSION +1 -0
  9. package/agents/cleanup-auditor/cleanup-auditor.md +56 -0
  10. package/agents/grill-master.md +26 -0
  11. package/agents/implementer.md +32 -0
  12. package/agents/review-army/accessibility-reviewer.md +54 -0
  13. package/agents/review-army/code-quality-reviewer.md +54 -0
  14. package/agents/review-army/security-reviewer.md +56 -0
  15. package/agents/review-army/spec-compliance-reviewer.md +51 -0
  16. package/agents/review-army/test-reviewer.md +55 -0
  17. package/agents/reviewer.md +59 -0
  18. package/agents/ship-audit-army/docs-auditor.md +53 -0
  19. package/agents/ship-audit-army/performance-auditor.md +52 -0
  20. package/agents/ship-audit-army/security-auditor.md +52 -0
  21. package/agents/specifier.md +55 -0
  22. package/agents/triage-officer.md +27 -0
  23. package/bin/gxpm +17 -0
  24. package/bin/gxpm-browser +17 -0
  25. package/bin/gxpm-config +15 -0
  26. package/bin/gxpm-eval +13 -0
  27. package/bin/gxpm-global-discover +15 -0
  28. package/bin/gxpm-init +38 -0
  29. package/bin/gxpm-investigate +194 -0
  30. package/bin/gxpm-uninstall +15 -0
  31. package/bin/gxpm-update-check +165 -0
  32. package/commands/build.md +40 -0
  33. package/commands/help.md +53 -0
  34. package/commands/plan.md +34 -0
  35. package/commands/refine.md +46 -0
  36. package/commands/review.md +34 -0
  37. package/commands/ship.md +37 -0
  38. package/core/ac-check.ts +20 -0
  39. package/core/agent-runtime.ts +363 -0
  40. package/core/artifact-validator.ts +151 -0
  41. package/core/artifacts.ts +313 -0
  42. package/core/autopilot.ts +250 -0
  43. package/core/capabilities.ts +779 -0
  44. package/core/checkpoint.ts +370 -0
  45. package/core/cleanup.ts +32 -0
  46. package/core/command-probe.ts +82 -0
  47. package/core/config.ts +533 -0
  48. package/core/contracts/behavior-spec.schema.ts +38 -0
  49. package/core/contracts/converter.ts +61 -0
  50. package/core/contracts/host.ts +43 -0
  51. package/core/converters/converter.ts +93 -0
  52. package/core/converters/index.ts +8 -0
  53. package/core/converters/managed-artifact.ts +119 -0
  54. package/core/converters/parser.ts +159 -0
  55. package/core/converters/template-renderer.ts +35 -0
  56. package/core/converters/writer.ts +61 -0
  57. package/core/dag-executor.ts +426 -0
  58. package/core/dag-loader.ts +292 -0
  59. package/core/dag-schemas.ts +150 -0
  60. package/core/dispatch.ts +125 -0
  61. package/core/evidence.ts +148 -0
  62. package/core/gate.ts +269 -0
  63. package/core/hook-engine.ts +566 -0
  64. package/core/host-probe.ts +64 -0
  65. package/core/implement.ts +16 -0
  66. package/core/isolation-errors.ts +174 -0
  67. package/core/isolation-resolver.ts +921 -0
  68. package/core/issue-context.ts +381 -0
  69. package/core/issue-readiness.ts +457 -0
  70. package/core/issue-sync.ts +427 -0
  71. package/core/issues.ts +132 -0
  72. package/core/land.ts +108 -0
  73. package/core/orchestrator.ts +54 -0
  74. package/core/phase-artifact.ts +32 -0
  75. package/core/phase-gates.ts +130 -0
  76. package/core/phase-rewind.ts +94 -0
  77. package/core/plan-lint.ts +61 -0
  78. package/core/plan.ts +77 -0
  79. package/core/port-allocation.ts +50 -0
  80. package/core/pr-check.ts +15 -0
  81. package/core/preset-system/preset-resolver.ts +221 -0
  82. package/core/project-init-status.ts +127 -0
  83. package/core/qa.ts +15 -0
  84. package/core/resilience.ts +165 -0
  85. package/core/runs.ts +288 -0
  86. package/core/safe-path.test.ts +80 -0
  87. package/core/safe-path.ts +60 -0
  88. package/core/sdd-gate.test.ts +98 -0
  89. package/core/sdd-gate.ts +134 -0
  90. package/core/self-review.ts +62 -0
  91. package/core/session.ts +70 -0
  92. package/core/ship.ts +86 -0
  93. package/core/specify.ts +173 -0
  94. package/core/state.ts +1002 -0
  95. package/core/template-engine.ts +152 -0
  96. package/core/template-resolver.test.ts +70 -0
  97. package/core/template-resolver.ts +156 -0
  98. package/core/triage.ts +26 -0
  99. package/core/verify.ts +15 -0
  100. package/core/wiki-native.ts +2423 -0
  101. package/core/wiki.ts +27 -0
  102. package/core/workflow-event-emitter.ts +163 -0
  103. package/core/workflows/engine.ts +273 -0
  104. package/core/workflows/expressions.ts +76 -0
  105. package/core/workflows/index.ts +38 -0
  106. package/core/workflows/steps/command.ts +43 -0
  107. package/core/workflows/steps/gate.ts +47 -0
  108. package/core/workflows/steps/gxpm.ts +44 -0
  109. package/core/workflows/steps/linear.ts +31 -0
  110. package/core/workflows/steps/shell.ts +65 -0
  111. package/core/workflows/types.ts +62 -0
  112. package/core/workspace-runtime.ts +227 -0
  113. package/core/worktree-init-steps.ts +647 -0
  114. package/core/worktree-init.ts +330 -0
  115. package/core/worktree-owner.ts +143 -0
  116. package/docs/GXPM_VERIFY.md +98 -0
  117. package/docs/INSTALL_FOR_AGENTS.md +113 -0
  118. package/docs/README.md +57 -0
  119. package/docs/adr/adr-005-multi-platform-skill-converter.md +72 -0
  120. package/docs/agents/domain.md +30 -0
  121. package/docs/agents/issue-tracker.md +30 -0
  122. package/docs/agents/triage-labels.md +32 -0
  123. package/docs/architecture/gxpm-architecture-diagram.md +265 -0
  124. package/docs/architecture/gxpm-current-architecture.md +175 -0
  125. package/docs/architecture/gxpm-current-flow.md +278 -0
  126. package/docs/architecture/gxpm-replacement-architecture.md +211 -0
  127. package/docs/architecture/gxpm-target-architecture.md +449 -0
  128. package/docs/architecture/gxpm-v0-contract.md +311 -0
  129. package/docs/architecture/layered-workflow-boundaries.md +193 -0
  130. package/docs/architecture/preset-system.md +126 -0
  131. package/docs/architecture/scaffold-northstar.md +23 -0
  132. package/docs/brainstorms/2026-05-14-bdd-then-tdd-design.md +320 -0
  133. package/docs/brainstorms/README.md +22 -0
  134. package/docs/brainstorms/docs-knowledge-system-requirements.md +29 -0
  135. package/docs/governance/beta-skill-promotion.md +39 -0
  136. package/docs/governance/development-contract.md +144 -0
  137. package/docs/governance/gherkin-style.md +90 -0
  138. package/docs/governance/host-adapter.md +56 -0
  139. package/docs/governance/skill-authoring.md +87 -0
  140. package/docs/governance/skill-testing.md +356 -0
  141. package/docs/governance/template-authoring.md +53 -0
  142. package/docs/migrations/v0.2.md +51 -0
  143. package/docs/plans/README.md +23 -0
  144. package/docs/plans/bdd-then-tdd-plan.md +1767 -0
  145. package/docs/plans/docs-knowledge-system-plan.md +31 -0
  146. package/docs/plans/spec-kit-sdd-adoption-plan.md +305 -0
  147. package/docs/research/agents-md-best-practices.md +207 -0
  148. package/docs/research/archon-study.md +351 -0
  149. package/docs/research/claude-hooks-study.md +440 -0
  150. package/docs/research/codex-hooks-study.md +624 -0
  151. package/docs/research/everything-claude-code-study.md +252 -0
  152. package/docs/research/from-skills-to-layered-workflow.md +322 -0
  153. package/docs/research/gsd-study.md +69 -0
  154. package/docs/research/kimi-hooks-study.md +274 -0
  155. package/docs/research/mattpocock-skills-comparison.md +429 -0
  156. package/docs/research/mattpocock-skills-study.md +275 -0
  157. package/docs/research/oh-my-codex-study.md +279 -0
  158. package/docs/research/perplexity-agent-skills-design.md +168 -0
  159. package/docs/research/pmc-gstack-skill-study.md +122 -0
  160. package/docs/research/spec-kit-study.md +224 -0
  161. package/docs/research/superpowers-study.md +209 -0
  162. package/docs/roadmap/initial-roadmap.md +53 -0
  163. package/docs/solutions/README.md +45 -0
  164. package/docs/solutions/artifact-nesting-recovery.md +58 -0
  165. package/docs/solutions/session-context-restore-practice.md +67 -0
  166. package/docs/solutions/workflow/version-drift-recovery.md +49 -0
  167. package/docs/solutions/worktree-gate-recovery.md +62 -0
  168. package/docs/specs/README.md +28 -0
  169. package/docs/specs/claude.md +45 -0
  170. package/docs/specs/codex.md +44 -0
  171. package/docs/specs/cursor.md +44 -0
  172. package/hosts/adapters/claude.ts +29 -0
  173. package/hosts/adapters/codex.ts +27 -0
  174. package/hosts/adapters/cursor.ts +27 -0
  175. package/hosts/adapters/kimi.ts +27 -0
  176. package/hosts/claude.ts +23 -0
  177. package/hosts/codex.ts +26 -0
  178. package/hosts/cursor.ts +19 -0
  179. package/hosts/index.ts +33 -0
  180. package/hosts/registry.test.ts +52 -0
  181. package/hosts/registry.ts +57 -0
  182. package/hosts/schema.ts +58 -0
  183. package/package.json +52 -0
  184. package/scripts/browser.ts +185 -0
  185. package/scripts/cleanup.ts +142 -0
  186. package/scripts/commands/artifact.ts +115 -0
  187. package/scripts/commands/autopilot.ts +143 -0
  188. package/scripts/commands/capability.ts +57 -0
  189. package/scripts/commands/config.ts +69 -0
  190. package/scripts/commands/dag.ts +126 -0
  191. package/scripts/commands/feedback.ts +123 -0
  192. package/scripts/commands/gate.ts +291 -0
  193. package/scripts/commands/helpers.ts +126 -0
  194. package/scripts/commands/hook.ts +66 -0
  195. package/scripts/commands/init.ts +515 -0
  196. package/scripts/commands/issue.ts +825 -0
  197. package/scripts/commands/phase.ts +61 -0
  198. package/scripts/commands/preset.ts +159 -0
  199. package/scripts/commands/runtime.ts +199 -0
  200. package/scripts/commands/specify.ts +71 -0
  201. package/scripts/commands/upgrade.ts +243 -0
  202. package/scripts/commands/verify.ts +183 -0
  203. package/scripts/commands/wiki.ts +242 -0
  204. package/scripts/commands/workflow.ts +131 -0
  205. package/scripts/dev-skill.ts +55 -0
  206. package/scripts/discover-skills.ts +116 -0
  207. package/scripts/doctor.ts +410 -0
  208. package/scripts/dogfood-check.ts +125 -0
  209. package/scripts/eval-functional.ts +218 -0
  210. package/scripts/eval.ts +246 -0
  211. package/scripts/gen-skill-docs.ts +201 -0
  212. package/scripts/global-discover.ts +217 -0
  213. package/scripts/governance-check.ts +75 -0
  214. package/scripts/gxpm-check.ts +12 -0
  215. package/scripts/gxpm.ts +216 -0
  216. package/scripts/host-config.ts +62 -0
  217. package/scripts/install-claude-hooks.ts +138 -0
  218. package/scripts/install-codex-hooks.ts +271 -0
  219. package/scripts/install-hooks.ts +128 -0
  220. package/scripts/install-kimi-hooks.ts +92 -0
  221. package/scripts/install-skill.ts +184 -0
  222. package/scripts/phase-artifact-commands.ts +100 -0
  223. package/scripts/post-land-sync.ts +46 -0
  224. package/scripts/scaffold-check.ts +85 -0
  225. package/scripts/skill-naming-check.ts +78 -0
  226. package/scripts/skill-structure-check.ts +157 -0
  227. package/scripts/skills-lock-check.ts +60 -0
  228. package/scripts/sync-markdown-artifacts.ts +172 -0
  229. package/scripts/uninstall.ts +162 -0
  230. package/scripts/version.ts +47 -0
  231. package/scripts/wait-pr-ready.ts +407 -0
  232. package/skills/gxpm/SKILL.md +485 -0
  233. package/skills/gxpm/SKILL.md.tmpl +422 -0
  234. package/skills/gxpm/references/CANON.md +53 -0
  235. package/skills/gxpm/references/key-rules.md +130 -0
  236. package/skills/gxpm-architecture/SKILL.md +106 -0
  237. package/skills/gxpm-architecture/references/DEEPENING.md +37 -0
  238. package/skills/gxpm-architecture/references/INTERFACE-DESIGN.md +44 -0
  239. package/skills/gxpm-autopilot/SKILL.md +116 -0
  240. package/skills/gxpm-autopilot/SKILL.md.tmpl +107 -0
  241. package/skills/gxpm-browser/SKILL.md +105 -0
  242. package/skills/gxpm-browser/SKILL.md.tmpl +41 -0
  243. package/skills/gxpm-browser/references/commands.md +43 -0
  244. package/skills/gxpm-browser/references/evidence-path.md +20 -0
  245. package/skills/gxpm-build/SKILL.md +78 -0
  246. package/skills/gxpm-cleanup/SKILL.md +76 -0
  247. package/skills/gxpm-debug-issue/SKILL.md +39 -0
  248. package/skills/gxpm-diagnose/SKILL.md +220 -0
  249. package/skills/gxpm-diagnose/SKILL.md.tmpl +31 -0
  250. package/skills/gxpm-diagnose/references/feedback-loop.md +34 -0
  251. package/skills/gxpm-diagnose/references/feedback-loops.md +43 -0
  252. package/skills/gxpm-diagnose/references/phases.md +60 -0
  253. package/skills/gxpm-eval/SKILL.md +78 -0
  254. package/skills/gxpm-explore-codebase/SKILL.md +36 -0
  255. package/skills/gxpm-explore-codebase/scripts/summarize-communities.ts +51 -0
  256. package/skills/gxpm-feedback/SKILL.md +122 -0
  257. package/skills/gxpm-grill/SKILL.md +159 -0
  258. package/skills/gxpm-grill/SKILL.md.tmpl +77 -0
  259. package/skills/gxpm-grill/references/documentation-templates.md +56 -0
  260. package/skills/gxpm-grill/references/process.md +25 -0
  261. package/skills/gxpm-handoff/SKILL.md +112 -0
  262. package/skills/gxpm-hygiene/SKILL.md +69 -0
  263. package/skills/gxpm-implementer/SKILL.md +142 -0
  264. package/skills/gxpm-implementer/SKILL.md.tmpl +141 -0
  265. package/skills/gxpm-linear/SKILL.md +282 -0
  266. package/skills/gxpm-linear/SKILL.md.tmpl +86 -0
  267. package/skills/gxpm-linear/references/commands.md +75 -0
  268. package/skills/gxpm-linear/references/workflows.md +120 -0
  269. package/skills/gxpm-planning/SKILL.md +134 -0
  270. package/skills/gxpm-prototype/SKILL.md +64 -0
  271. package/skills/gxpm-refactor-safely/SKILL.md +62 -0
  272. package/skills/gxpm-review-army/SKILL.md +117 -0
  273. package/skills/gxpm-review-changes/SKILL.md +36 -0
  274. package/skills/gxpm-setup/SKILL.md +101 -0
  275. package/skills/gxpm-specifier/SKILL.md +135 -0
  276. package/skills/gxpm-tdd/SKILL.md +187 -0
  277. package/skills/gxpm-tdd/references/interface-design.md +23 -0
  278. package/skills/gxpm-tdd/references/mocking.md +27 -0
  279. package/skills/gxpm-tdd/references/red-green-refactor.md +61 -0
  280. package/skills/gxpm-tdd/references/troubleshooting.md +28 -0
  281. package/skills/gxpm-tdd/references/workflow.md +50 -0
  282. package/skills/gxpm-tdd/testing-anti-patterns.tmpl +304 -0
  283. package/skills/gxpm-triage/SKILL.md +160 -0
  284. package/skills/gxpm-verify/SKILL.md +107 -0
  285. package/skills/gxpm-write-skill/SKILL.md +131 -0
  286. package/skills/gxpm-zoom-out/SKILL.md +69 -0
  287. package/skills/maintain-hygiene-skills-lock/SKILL.md +54 -0
  288. package/skills/maintain-hygiene-skills-lock/SKILL.md.tmpl +53 -0
  289. package/templates/constitution-template.md +63 -0
  290. package/templates/hooks/gxpm-commit-msg +16 -0
  291. package/templates/hooks/gxpm-post-checkout +19 -0
  292. package/templates/hooks/gxpm-post-commit +7 -0
  293. package/templates/hooks/gxpm-post-merge +29 -0
  294. package/templates/hooks/gxpm-pre-commit +39 -0
  295. package/templates/hooks/gxpm-pre-push +33 -0
  296. package/templates/plan-template.md.tmpl +46 -0
  297. package/templates/spec-template.md.tmpl +63 -0
  298. package/templates/specify-stub.tmpl +22 -0
  299. package/templates/tasks-template.md.tmpl +32 -0
@@ -0,0 +1,278 @@
1
+ # gxpm 当前业务流程图(v0)
2
+
3
+ > 绘制日期:2026-05-02
4
+ > 覆盖:Skill 生命周期、Issue 交付生命周期、Git 提交生命周期
5
+
6
+ ---
7
+
8
+ ## 1. Skill 生命周期(当前)
9
+
10
+ ```mermaid
11
+ flowchart LR
12
+ subgraph "Source"
13
+ TMPL["skills/gxpm/<br/>SKILL.md.tmpl<br/>(590 lines)"]
14
+ PHASE["core/phase-gates.ts<br/>PHASE_GATE_RULES"]
15
+ HOST["hosts/codex.ts<br/>host config"]
16
+ end
17
+
18
+ subgraph "Generation"
19
+ GEN["scripts/gen-skill-docs.ts<br/>renderTemplate()"]
20
+ end
21
+
22
+ subgraph "Output"
23
+ OUT["skills/gxpm/<br/>SKILL.md<br/>(673 lines)"]
24
+ end
25
+
26
+ subgraph "Install"
27
+ INST["scripts/install-skill.ts<br/>copy to host"]
28
+ end
29
+
30
+ subgraph "Target Host"
31
+ CODEX["~/.codex/skills/gxpm/<br/>SKILL.md"]
32
+ end
33
+
34
+ TMPL --> GEN
35
+ PHASE --> |"inject<br/>artifactReadCommands<br/>phaseGateCommands<br/>phaseTransitionSummary"| GEN
36
+ HOST --> |"inject<br/>preamble<br/>frontmatter filter"| GEN
37
+ GEN --> OUT
38
+ OUT --> INST
39
+ INST --> CODEX
40
+
41
+ style TMPL fill:#e1f5fe
42
+ style OUT fill:#fff3e0
43
+ style CODEX fill:#e8f5e9
44
+ ```
45
+
46
+ ### 关键问题
47
+
48
+ - **单点故障**:只有一个 tmpl → 一个输出 → 一个安装目标
49
+ - **代码智能 skill**:`skills/gxpm-*`(GitNexus 驱动)在项目生命周期内维护;旧 Claude-only 图谱 skill 已归档
50
+ - **无版本管理**:生成产物 SKILL.md 入 git,但 install 目标在用户 home 目录
51
+
52
+ ---
53
+
54
+ ## 2. Issue 交付生命周期(当前 12 Phase)
55
+
56
+ ```mermaid
57
+ flowchart LR
58
+ subgraph "Intake"
59
+ CREATE["gxpm issue create<br/>--auto-id"]
60
+ LINEAR["Linear Issue<br/>(optional upstream)"]
61
+ end
62
+
63
+ subgraph "Phase Pipeline"
64
+ direction TB
65
+ TRIAGE["1. triage<br/>acceptance-contract"]
66
+ PLAN["2. plan<br/>implementation-plan"]
67
+ DISPATCH["3. dispatch<br/>dispatch-handoff"]
68
+ IMPLEMENT["4. implement<br/>(code changes)"]
69
+ LOCAL_VERIFY["5. local-verify<br/>local-verify artifact"]
70
+ AC_CHECK["6. ac-check<br/>acceptance-check"]
71
+ SELF_REVIEW["7. self-review<br/>ship-readiness"]
72
+ SHIP["8. ship<br/>pr-check"]
73
+ PR_CHECK["9. pr-check<br/>verify-findings"]
74
+ VERIFY["10. verify<br/>qa-findings"]
75
+ QA["11. qa<br/>land-findings"]
76
+ LAND["12. land<br/>cleanup"]
77
+ end
78
+
79
+ subgraph "Gates"
80
+ GATE_T["gate:<br/>triage→plan"]
81
+ GATE_P["gate:<br/>plan→dispatch"]
82
+ GATE_D["gate:<br/>dispatch→implement"]
83
+ GATE_I["gate:<br/>implement→local-verify"]
84
+ GATE_LV["gate:<br/>local-verify→ac-check"]
85
+ GATE_AC["gate:<br/>ac-check→self-review"]
86
+ GATE_SR["gate:<br/>self-review→ship"]
87
+ GATE_S["gate:<br/>ship→pr-check"]
88
+ GATE_PC["gate:<br/>pr-check→verify"]
89
+ GATE_V["gate:<br/>verify→qa"]
90
+ GATE_Q["gate:<br/>qa→land"]
91
+ end
92
+
93
+ CREATE --> TRIAGE
94
+ LINEAR -.-> |"sync"| CREATE
95
+
96
+ TRIAGE --> |"transition"| GATE_T --> PLAN
97
+ PLAN --> |"transition"| GATE_P --> DISPATCH
98
+ DISPATCH --> |"transition"| GATE_D --> IMPLEMENT
99
+ IMPLEMENT --> |"transition"| GATE_I --> LOCAL_VERIFY
100
+ LOCAL_VERIFY --> |"transition"| GATE_LV --> AC_CHECK
101
+ AC_CHECK --> |"transition"| GATE_AC --> SELF_REVIEW
102
+ SELF_REVIEW --> |"transition"| GATE_SR --> SHIP
103
+ SHIP --> |"transition"| GATE_S --> PR_CHECK
104
+ PR_CHECK --> |"transition"| GATE_PC --> VERIFY
105
+ VERIFY --> |"transition"| GATE_V --> QA
106
+ QA --> |"transition"| GATE_Q --> LAND
107
+
108
+ style TRIAGE fill:#e3f2fd
109
+ style PLAN fill:#e3f2fd
110
+ style DISPATCH fill:#e3f2fd
111
+ style IMPLEMENT fill:#fff3e0
112
+ style LOCAL_VERIFY fill:#e8f5e9
113
+ style AC_CHECK fill:#e8f5e9
114
+ style SELF_REVIEW fill:#fce4ec
115
+ style SHIP fill:#fce4ec
116
+ style PR_CHECK fill:#fce4ec
117
+ style VERIFY fill:#f3e5f5
118
+ style QA fill:#f3e5f5
119
+ style LAND fill:#f3e5f5
120
+ ```
121
+
122
+ ### Phase 颜色分类
123
+
124
+ | 颜色 | 阶段 | 负责方 | 关键产出 |
125
+ |------|------|--------|---------|
126
+ | 🔵 蓝 | Intake & Plan | Agent + User | acceptance-contract, implementation-plan |
127
+ | 🟡 黄 | Implement | Agent | 代码变更 |
128
+ | 🟢 绿 | Local Verify | Agent | 本地验证证据 |
129
+ | 🔴 红 | Review & Ship | Agent | ship-readiness, pr-check |
130
+ | 🟣 紫 | External Verify | Agent / External | qa-findings, land-findings |
131
+
132
+ ---
133
+
134
+ ## 3. Git 提交生命周期(Hook 防御层)
135
+
136
+ ```mermaid
137
+ flowchart TB
138
+ subgraph "Developer Action"
139
+ STAGE["git add"]
140
+ COMMIT["git commit -m '...'"]
141
+ PUSH["git push"]
142
+ MERGE["git merge<br/>feature branch"]
143
+ end
144
+
145
+ subgraph "Hook Layer"
146
+ PRE_COMMIT["gxpm-pre-commit<br/>path protection"]
147
+ COMMIT_MSG["gxpm-commit-msg<br/>GXPM-N ref required"]
148
+ PRE_PUSH["gxpm-pre-push<br/>artifact check"]
149
+ POST_MERGE["gxpm-post-merge<br/>auto land"]
150
+ end
151
+
152
+ subgraph "Gate Enforcement"
153
+ GATE_PC_CMD["gxpm gate pre-commit"]
154
+ GATE_CM_CMD["gxpm gate commit-msg"]
155
+ GATE_PP_CMD["gxpm gate pre-push"]
156
+ GATE_PM_CMD["gxpm gate post-merge"]
157
+ end
158
+
159
+ subgraph "Core Check"
160
+ PHASE_CHECK["currentPhase ∈<br/>{dispatch..verify}?"]
161
+ ART_CHECK["requiredArtifact<br/>exists?"]
162
+ MSG_CHECK["message contains<br/>GXPM-NNN / GXG-NNN?"]
163
+ end
164
+
165
+ subgraph "Outcome"
166
+ ALLOW["✅ Allow"]
167
+ BLOCK["❌ Block + stderr reason"]
168
+ AUTO_LAND["🤖 Auto transition<br/>qa → land"]
169
+ end
170
+
171
+ STAGE --> COMMIT
172
+ COMMIT --> PRE_COMMIT --> GATE_PC_CMD --> PHASE_CHECK
173
+ COMMIT --> COMMIT_MSG --> GATE_CM_CMD --> MSG_CHECK
174
+ PUSH --> PRE_PUSH --> GATE_PP_CMD --> ART_CHECK
175
+ MERGE --> POST_MERGE --> GATE_PM_CMD --> AUTO_LAND
176
+
177
+ PHASE_CHECK --> |"pass"| ALLOW
178
+ PHASE_CHECK --> |"fail"| BLOCK
179
+ MSG_CHECK --> |"pass"| ALLOW
180
+ MSG_CHECK --> |"fail"| BLOCK
181
+ ART_CHECK --> |"pass"| ALLOW
182
+ ART_CHECK --> |"fail"| BLOCK
183
+
184
+ style BLOCK fill:#ffcdd2
185
+ style ALLOW fill:#c8e6c9
186
+ style AUTO_LAND fill:#e1bee7
187
+ ```
188
+
189
+ ---
190
+
191
+ ## 4. Skill 与 Phase 的映射关系(当前)
192
+
193
+ ```mermaid
194
+ flowchart TB
195
+ subgraph "Single Skill: gxpm"
196
+ SKILL["SKILL.md<br/>(673 lines)"]
197
+ end
198
+
199
+ subgraph "Phases Requiring Skill Guidance"
200
+ TRIAGE["triage"]
201
+ PLAN["plan"]
202
+ DISPATCH["dispatch"]
203
+ IMPLEMENT["implement"]
204
+ LOCAL_VERIFY["local-verify"]
205
+ AC_CHECK["ac-check"]
206
+ SELF_REVIEW["self-review"]
207
+ SHIP["ship"]
208
+ PR_CHECK["pr-check"]
209
+ VERIFY["verify"]
210
+ QA["qa"]
211
+ LAND["land"]
212
+ end
213
+
214
+ SKILL --> TRIAGE
215
+ SKILL --> PLAN
216
+ SKILL --> DISPATCH
217
+ SKILL --> IMPLEMENT
218
+ SKILL --> LOCAL_VERIFY
219
+ SKILL --> AC_CHECK
220
+ SKILL --> SELF_REVIEW
221
+ SKILL --> SHIP
222
+ SKILL --> PR_CHECK
223
+ SKILL --> VERIFY
224
+ SKILL --> QA
225
+ SKILL --> LAND
226
+
227
+ style SKILL fill:#ffcdd2
228
+ ```
229
+
230
+ ### 问题可视化
231
+
232
+ **一个大 skill 承载了 12 个 phase 的指引**, progressive disclosure 完全失效。每次 Codex 加载时,不管当前处于哪个 phase,都要把 673 行全塞进上下文。
233
+
234
+ ---
235
+
236
+ ## 5. 外部系统集成数据流
237
+
238
+ ```mermaid
239
+ flowchart LR
240
+ subgraph "Agent Session"
241
+ CODEX["Codex CLI"]
242
+ CLAUDE["Claude Code"]
243
+ end
244
+
245
+ subgraph "gxpm Local State"
246
+ ISSUE_DIR[".gxpm/issues/<id>/"]
247
+ WIKI_DIR[".gxpm/wiki/"]
248
+ CONFIG[".gxpm/config.json"]
249
+ end
250
+
251
+ subgraph "External Systems"
252
+ LINEAR["Linear"]
253
+ GITNEXUS["GitNexus<br/>MCP"]
254
+ GIT["Git"]
255
+ BROWSER["cmux / agent-browser"]
256
+ end
257
+
258
+ CODEX --> |"gxpm CLI<br/>read/write state"| ISSUE_DIR
259
+ CLAUDE --> |"MCP tools<br/>code intelligence"| GITNEXUS
260
+ CLAUDE --> |"load skill"| SKILL_CLAUDE[".claude/skills/<br/>*.md"]
261
+
262
+ ISSUE_DIR -.-> |"sync<br/>(Linear 是协作前门)"| LINEAR
263
+ ISSUE_DIR --> |"evidence capture"| BROWSER
264
+
265
+ GIT --> |"hook events"| ISSUE_DIR
266
+ GITNEXUS -.-> |"code nav<br/>debug/refactor/review"| CLAUDE
267
+
268
+ WIKI_DIR --> |"optional human docs<br/>manual wiki query/update"| CODEX
269
+ CONFIG --> |"worktree policy<br/>host config"| CODEX
270
+
271
+ style SKILL_CLAUDE fill:#ffcdd2
272
+ ```
273
+
274
+ ### 关键问题
275
+
276
+ - **Agent 代码智能** 应统一走 GitNexus MCP,用于 code nav、debug、refactor、review。
277
+ - **gxpm wiki** 是可选人类说明书,用于 onboarding 和治理/CLI 导览;不作为 SessionStart 默认上下文,也不替代 GitNexus。
278
+ - **Codex CLI** 仍通过 gxpm CLI 读写 issue state;代码理解能力应通过 GitNexus skills 暴露,而不是扩大 wiki 职责。
@@ -0,0 +1,211 @@
1
+ # gxpm Replacement Architecture
2
+
3
+ 日期:2026-04-24
4
+
5
+ ## 目标
6
+
7
+ gxpm 是替代 PMC 和 gstack 的二代产品。它要把两个项目中已经验证有效的能力重新组织成一个统一系统,而不是在运行时继续依赖两套 skill。
8
+
9
+ 一句话架构:
10
+
11
+ ```text
12
+ gxpm = State Graph + Capability Runtime + Evidence Store + Policy Engine + Skill Surface
13
+ ```
14
+
15
+ ## 为什么不能只是集成层
16
+
17
+ PMC 和 gstack 的边界来自各自历史:
18
+
19
+ - PMC 从 Linear issue delivery 出发,强在 phase gate 和 artifact truth,但缺少完整工程工作流 runtime。
20
+ - gstack 从 agent software factory 出发,强在 browser/review/QA/ship/learn,但缺少 Linear-first PM 状态机。
21
+
22
+ 如果 gxpm 只是把 PMC 放核心、把 gstack 放外围,会留下两个长期问题:
23
+
24
+ - 状态分裂:`.omc/pm`、`.gstack/projects`、PR body、chat memory 各自为政。
25
+ - 能力分裂:PM gate、browser QA、review、ship、learn 由不同 skill 定义,难以统一恢复和审计。
26
+
27
+ gxpm 的二代价值就是消除这两个分裂。
28
+
29
+ ## 产品模块
30
+
31
+ ### 1. State Graph
32
+
33
+ State Graph 是 gxpm 的主干,替代 PMC phase state 和 gstack timeline 的分离模式。
34
+
35
+ 职责:
36
+
37
+ - issue lifecycle
38
+ - phase transition
39
+ - dependency graph
40
+ - blocking gates
41
+ - resume state
42
+ - compensation state
43
+
44
+ 核心原则:
45
+
46
+ - 本地 state 永远比 Linear comment、PR body、聊天上下文更权威。
47
+ - phase JSON artifact 比 markdown report 更权威。
48
+ - 所有 transition 都必须可审计、可重放、可恢复。
49
+
50
+ ### 2. Capability Runtime
51
+
52
+ Capability Runtime 替代 gstack 的分散 skill tree 和 PMC 的 provider binding。
53
+
54
+ V0 capability:
55
+
56
+ - `issue`: Linear/GitHub issue intake、sync、writeback。
57
+ - `planning`: triage、scope、acceptance contract、risk profile。
58
+ - `execution`: worktree、dispatch、worker handoff、claim/release。
59
+ - `verification`: local verify、AC check、independent verify。
60
+ - `review`: diff review、specialist review、adversarial review。
61
+ - `browser`: persistent browser、QA evidence、console/network/screenshot。
62
+ - `release`: ship、PR body、pr-check、land handoff。
63
+ - `memory`: context restore、timeline、learn、retro。
64
+ - `skill`: discovery、routing、preamble、template generation。
65
+
66
+ 每个 capability 必须有:
67
+
68
+ - input schema
69
+ - output artifact schema
70
+ - mutation policy
71
+ - idempotency rule
72
+ - failure mode
73
+ - evidence requirements
74
+
75
+ ### 3. Evidence Store
76
+
77
+ Evidence Store 把 PMC 的 phase artifacts 与 gstack 的 QA/review/browser evidence 合并成统一证据层。
78
+
79
+ 建议目录:
80
+
81
+ ```text
82
+ .gxpm/issues/<issue-id>/
83
+ state.json
84
+ graph.json
85
+ artifacts/
86
+ acceptance-contract.json
87
+ local-verify.json
88
+ ac-check.json
89
+ verify-findings.json
90
+ qa-findings.json
91
+ release-findings.json
92
+ reports/
93
+ triage.md
94
+ dispatch.md
95
+ verify.md
96
+ qa.md
97
+ land.md
98
+ evidence/
99
+ screenshots/
100
+ console.jsonl
101
+ network.jsonl
102
+ commands.jsonl
103
+ commits.jsonl
104
+ memory/
105
+ resume-packet.json
106
+ execution-log.md
107
+ execution-memory.md
108
+ ```
109
+
110
+ ### 4. Policy Engine
111
+
112
+ Policy Engine 替代 PMC 的分散 gate rules 和 gstack 各 skill 内部的 stop rules。
113
+
114
+ 它回答:
115
+
116
+ - 当前 phase 能不能进入下一 phase?
117
+ - 哪些 acceptance criterion 需要 browser evidence?
118
+ - 哪些 diff 需要 specialist review?
119
+ - 哪些操作是 irreversible,必须用户确认?
120
+ - GitHub/CI/CodeRabbit/Linear 失败是阻塞还是噪声?
121
+ - 当前验证强度是 fast、standard、high-risk 还是 regression?
122
+
123
+ ### 5. Skill Surface
124
+
125
+ Skill Surface 是代理入口,不是业务真值。
126
+
127
+ 它提供:
128
+
129
+ - `/gxpm triage`
130
+ - `/gxpm plan`
131
+ - `/gxpm dispatch`
132
+ - `/gxpm verify`
133
+ - `/gxpm qa`
134
+ - `/gxpm land`
135
+ - `/gxpm ship`
136
+ - `/gxpm investigate`
137
+ - `/gxpm review`
138
+ - `/gxpm learn`
139
+
140
+ 底层都调用同一套 state graph 和 capability runtime。
141
+
142
+ ### 6. Layered Workflow Boundaries
143
+
144
+ gxpm 的 Command / Agent / Skill / Artifact / Hook 边界以
145
+ `docs/architecture/layered-workflow-boundaries.md` 为准。
146
+
147
+ 核心约束:
148
+
149
+ - Command 只负责路由 phase、初始化 artifact 和触发 transition。
150
+ - Agent 是责任视角,不是 persona;它必须通过 capability contract 暴露输入、输出、证据、失败模式和 mutation policy。
151
+ - Skill 是 host-facing 入口,不替代 state graph、artifact store 或 capability registry。
152
+ - Artifact 保存 phase 结论和可恢复事实;原始日志、截图和调查过程进入 evidence store。
153
+ - Hook / Validate 只负责防漂移,不替代验收判断。
154
+
155
+ ## PMC 能力替代表
156
+
157
+ | PMC 能力 | gxpm 原生模块 | 替代方式 |
158
+ | --- | --- | --- |
159
+ | `.omc/pm/<issue>/state.json` | State Graph | import/migrate 后由 `.gxpm/issues/<id>/state.json` 接管 |
160
+ | phase guides | Capability guides | 保留 gate 意图,重写为 capability input/output |
161
+ | checkpoint.py | State transition API | transition 写 state、artifact index、event log |
162
+ | Linear sync | Issue Runtime | Linear 是 provider,不是真值 |
163
+ | acceptance/local-verify/verify/qa contracts | Evidence Store | schema 归一,reports 变成渲染视图 |
164
+ | execution continuity | Memory Runtime | resume packet、execution memory、timeline 统一 |
165
+ | land gate | Release Runtime | land 是 policy gate,merge/deploy 可委托但必须写回 gxpm |
166
+
167
+ ## gstack 能力替代表
168
+
169
+ | gstack 能力 | gxpm 原生模块 | 替代方式 |
170
+ | --- | --- | --- |
171
+ | preamble | Skill Runtime | 版本、配置、会话、learn、routing 变成统一 preflight |
172
+ | browse daemon | Browser Runtime | 重用设计原则,重写 state/evidence 接口 |
173
+ | `/qa` | Browser + Verification Runtime | Test -> Fix -> Verify 写入 issue evidence |
174
+ | `/review` | Review Runtime | specialist/adversarial review 归入 release gates |
175
+ | `/ship` | Release Runtime | ship 自动化受 gxpm policy 控制 |
176
+ | `/investigate` | Verification Runtime | root cause trail 写入 issue DEBUG/evidence |
177
+ | learn/timeline | Memory Runtime | 项目记忆与 issue 恢复合并 |
178
+ | template-generated SKILL.md | Skill Runtime | gxpm 自己生成 skill docs,防漂移 |
179
+ | team init/host abstraction | Install Runtime | Codex/Claude/OpenClaw 作为 host,不作为架构边界 |
180
+
181
+ ## V0 最小替代闭环
182
+
183
+ V0 不需要一次性替代所有 gstack skills,但必须证明 gxpm 的产品骨架成立。
184
+
185
+ 最小闭环:
186
+
187
+ 1. 从 Linear 或本地创建 issue。
188
+ 2. 生成 gxpm state graph。
189
+ 3. triage 产出 acceptance contract。
190
+ 4. dispatch 产出 worker handoff。
191
+ 5. local verify 写入 evidence。
192
+ 6. review/qa 至少有一个 capability 可运行并写回。
193
+ 7. land gate 给出可执行结论,但不可逆动作仍需用户确认。
194
+ 8. 新会话只靠 `.gxpm/issues/<id>` 恢复。
195
+
196
+ ## 架构判断
197
+
198
+ 推荐路线:先做 unified core,再迁移能力。
199
+
200
+ 原因:
201
+
202
+ - 先接 gstack browser 或 PMC phase 都会把 gxpm 带回旧边界。
203
+ - unified core 先定义 state/evidence/policy,后续所有能力都只能接到同一套接口上。
204
+ - 这会稍慢一点,但能避免二代项目一开始就背上两套历史债。
205
+
206
+ ## 风险
207
+
208
+ - 范围过大:用 V0 最小闭环限制,不一次性替代所有 skill。
209
+ - 迁移成本高:保留 import/migrate,而不是运行时兼容两套目录。
210
+ - browser runtime 复杂:先定义 browser evidence contract,再决定复用还是重写 daemon。
211
+ - release 自动化风险高:ship/land 默认 gate-first,所有不可逆操作需要显式确认。