@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.
- package/AGENTS.md +148 -0
- package/CANON.md +53 -0
- package/CLAUDE.md +60 -0
- package/CONTEXT.md +49 -0
- package/DEBUG.md +59 -0
- package/ISSUE_CONTEXT.md +25 -0
- package/README.md +143 -0
- package/VERSION +1 -0
- package/agents/cleanup-auditor/cleanup-auditor.md +56 -0
- package/agents/grill-master.md +26 -0
- package/agents/implementer.md +32 -0
- package/agents/review-army/accessibility-reviewer.md +54 -0
- package/agents/review-army/code-quality-reviewer.md +54 -0
- package/agents/review-army/security-reviewer.md +56 -0
- package/agents/review-army/spec-compliance-reviewer.md +51 -0
- package/agents/review-army/test-reviewer.md +55 -0
- package/agents/reviewer.md +59 -0
- package/agents/ship-audit-army/docs-auditor.md +53 -0
- package/agents/ship-audit-army/performance-auditor.md +52 -0
- package/agents/ship-audit-army/security-auditor.md +52 -0
- package/agents/specifier.md +55 -0
- package/agents/triage-officer.md +27 -0
- package/bin/gxpm +17 -0
- package/bin/gxpm-browser +17 -0
- package/bin/gxpm-config +15 -0
- package/bin/gxpm-eval +13 -0
- package/bin/gxpm-global-discover +15 -0
- package/bin/gxpm-init +38 -0
- package/bin/gxpm-investigate +194 -0
- package/bin/gxpm-uninstall +15 -0
- package/bin/gxpm-update-check +165 -0
- package/commands/build.md +40 -0
- package/commands/help.md +53 -0
- package/commands/plan.md +34 -0
- package/commands/refine.md +46 -0
- package/commands/review.md +34 -0
- package/commands/ship.md +37 -0
- package/core/ac-check.ts +20 -0
- package/core/agent-runtime.ts +363 -0
- package/core/artifact-validator.ts +151 -0
- package/core/artifacts.ts +313 -0
- package/core/autopilot.ts +250 -0
- package/core/capabilities.ts +779 -0
- package/core/checkpoint.ts +370 -0
- package/core/cleanup.ts +32 -0
- package/core/command-probe.ts +82 -0
- package/core/config.ts +533 -0
- package/core/contracts/behavior-spec.schema.ts +38 -0
- package/core/contracts/converter.ts +61 -0
- package/core/contracts/host.ts +43 -0
- package/core/converters/converter.ts +93 -0
- package/core/converters/index.ts +8 -0
- package/core/converters/managed-artifact.ts +119 -0
- package/core/converters/parser.ts +159 -0
- package/core/converters/template-renderer.ts +35 -0
- package/core/converters/writer.ts +61 -0
- package/core/dag-executor.ts +426 -0
- package/core/dag-loader.ts +292 -0
- package/core/dag-schemas.ts +150 -0
- package/core/dispatch.ts +125 -0
- package/core/evidence.ts +148 -0
- package/core/gate.ts +269 -0
- package/core/hook-engine.ts +566 -0
- package/core/host-probe.ts +64 -0
- package/core/implement.ts +16 -0
- package/core/isolation-errors.ts +174 -0
- package/core/isolation-resolver.ts +921 -0
- package/core/issue-context.ts +381 -0
- package/core/issue-readiness.ts +457 -0
- package/core/issue-sync.ts +427 -0
- package/core/issues.ts +132 -0
- package/core/land.ts +108 -0
- package/core/orchestrator.ts +54 -0
- package/core/phase-artifact.ts +32 -0
- package/core/phase-gates.ts +130 -0
- package/core/phase-rewind.ts +94 -0
- package/core/plan-lint.ts +61 -0
- package/core/plan.ts +77 -0
- package/core/port-allocation.ts +50 -0
- package/core/pr-check.ts +15 -0
- package/core/preset-system/preset-resolver.ts +221 -0
- package/core/project-init-status.ts +127 -0
- package/core/qa.ts +15 -0
- package/core/resilience.ts +165 -0
- package/core/runs.ts +288 -0
- package/core/safe-path.test.ts +80 -0
- package/core/safe-path.ts +60 -0
- package/core/sdd-gate.test.ts +98 -0
- package/core/sdd-gate.ts +134 -0
- package/core/self-review.ts +62 -0
- package/core/session.ts +70 -0
- package/core/ship.ts +86 -0
- package/core/specify.ts +173 -0
- package/core/state.ts +1002 -0
- package/core/template-engine.ts +152 -0
- package/core/template-resolver.test.ts +70 -0
- package/core/template-resolver.ts +156 -0
- package/core/triage.ts +26 -0
- package/core/verify.ts +15 -0
- package/core/wiki-native.ts +2423 -0
- package/core/wiki.ts +27 -0
- package/core/workflow-event-emitter.ts +163 -0
- package/core/workflows/engine.ts +273 -0
- package/core/workflows/expressions.ts +76 -0
- package/core/workflows/index.ts +38 -0
- package/core/workflows/steps/command.ts +43 -0
- package/core/workflows/steps/gate.ts +47 -0
- package/core/workflows/steps/gxpm.ts +44 -0
- package/core/workflows/steps/linear.ts +31 -0
- package/core/workflows/steps/shell.ts +65 -0
- package/core/workflows/types.ts +62 -0
- package/core/workspace-runtime.ts +227 -0
- package/core/worktree-init-steps.ts +647 -0
- package/core/worktree-init.ts +330 -0
- package/core/worktree-owner.ts +143 -0
- package/docs/GXPM_VERIFY.md +98 -0
- package/docs/INSTALL_FOR_AGENTS.md +113 -0
- package/docs/README.md +57 -0
- package/docs/adr/adr-005-multi-platform-skill-converter.md +72 -0
- package/docs/agents/domain.md +30 -0
- package/docs/agents/issue-tracker.md +30 -0
- package/docs/agents/triage-labels.md +32 -0
- package/docs/architecture/gxpm-architecture-diagram.md +265 -0
- package/docs/architecture/gxpm-current-architecture.md +175 -0
- package/docs/architecture/gxpm-current-flow.md +278 -0
- package/docs/architecture/gxpm-replacement-architecture.md +211 -0
- package/docs/architecture/gxpm-target-architecture.md +449 -0
- package/docs/architecture/gxpm-v0-contract.md +311 -0
- package/docs/architecture/layered-workflow-boundaries.md +193 -0
- package/docs/architecture/preset-system.md +126 -0
- package/docs/architecture/scaffold-northstar.md +23 -0
- package/docs/brainstorms/2026-05-14-bdd-then-tdd-design.md +320 -0
- package/docs/brainstorms/README.md +22 -0
- package/docs/brainstorms/docs-knowledge-system-requirements.md +29 -0
- package/docs/governance/beta-skill-promotion.md +39 -0
- package/docs/governance/development-contract.md +144 -0
- package/docs/governance/gherkin-style.md +90 -0
- package/docs/governance/host-adapter.md +56 -0
- package/docs/governance/skill-authoring.md +87 -0
- package/docs/governance/skill-testing.md +356 -0
- package/docs/governance/template-authoring.md +53 -0
- package/docs/migrations/v0.2.md +51 -0
- package/docs/plans/README.md +23 -0
- package/docs/plans/bdd-then-tdd-plan.md +1767 -0
- package/docs/plans/docs-knowledge-system-plan.md +31 -0
- package/docs/plans/spec-kit-sdd-adoption-plan.md +305 -0
- package/docs/research/agents-md-best-practices.md +207 -0
- package/docs/research/archon-study.md +351 -0
- package/docs/research/claude-hooks-study.md +440 -0
- package/docs/research/codex-hooks-study.md +624 -0
- package/docs/research/everything-claude-code-study.md +252 -0
- package/docs/research/from-skills-to-layered-workflow.md +322 -0
- package/docs/research/gsd-study.md +69 -0
- package/docs/research/kimi-hooks-study.md +274 -0
- package/docs/research/mattpocock-skills-comparison.md +429 -0
- package/docs/research/mattpocock-skills-study.md +275 -0
- package/docs/research/oh-my-codex-study.md +279 -0
- package/docs/research/perplexity-agent-skills-design.md +168 -0
- package/docs/research/pmc-gstack-skill-study.md +122 -0
- package/docs/research/spec-kit-study.md +224 -0
- package/docs/research/superpowers-study.md +209 -0
- package/docs/roadmap/initial-roadmap.md +53 -0
- package/docs/solutions/README.md +45 -0
- package/docs/solutions/artifact-nesting-recovery.md +58 -0
- package/docs/solutions/session-context-restore-practice.md +67 -0
- package/docs/solutions/workflow/version-drift-recovery.md +49 -0
- package/docs/solutions/worktree-gate-recovery.md +62 -0
- package/docs/specs/README.md +28 -0
- package/docs/specs/claude.md +45 -0
- package/docs/specs/codex.md +44 -0
- package/docs/specs/cursor.md +44 -0
- package/hosts/adapters/claude.ts +29 -0
- package/hosts/adapters/codex.ts +27 -0
- package/hosts/adapters/cursor.ts +27 -0
- package/hosts/adapters/kimi.ts +27 -0
- package/hosts/claude.ts +23 -0
- package/hosts/codex.ts +26 -0
- package/hosts/cursor.ts +19 -0
- package/hosts/index.ts +33 -0
- package/hosts/registry.test.ts +52 -0
- package/hosts/registry.ts +57 -0
- package/hosts/schema.ts +58 -0
- package/package.json +52 -0
- package/scripts/browser.ts +185 -0
- package/scripts/cleanup.ts +142 -0
- package/scripts/commands/artifact.ts +115 -0
- package/scripts/commands/autopilot.ts +143 -0
- package/scripts/commands/capability.ts +57 -0
- package/scripts/commands/config.ts +69 -0
- package/scripts/commands/dag.ts +126 -0
- package/scripts/commands/feedback.ts +123 -0
- package/scripts/commands/gate.ts +291 -0
- package/scripts/commands/helpers.ts +126 -0
- package/scripts/commands/hook.ts +66 -0
- package/scripts/commands/init.ts +515 -0
- package/scripts/commands/issue.ts +825 -0
- package/scripts/commands/phase.ts +61 -0
- package/scripts/commands/preset.ts +159 -0
- package/scripts/commands/runtime.ts +199 -0
- package/scripts/commands/specify.ts +71 -0
- package/scripts/commands/upgrade.ts +243 -0
- package/scripts/commands/verify.ts +183 -0
- package/scripts/commands/wiki.ts +242 -0
- package/scripts/commands/workflow.ts +131 -0
- package/scripts/dev-skill.ts +55 -0
- package/scripts/discover-skills.ts +116 -0
- package/scripts/doctor.ts +410 -0
- package/scripts/dogfood-check.ts +125 -0
- package/scripts/eval-functional.ts +218 -0
- package/scripts/eval.ts +246 -0
- package/scripts/gen-skill-docs.ts +201 -0
- package/scripts/global-discover.ts +217 -0
- package/scripts/governance-check.ts +75 -0
- package/scripts/gxpm-check.ts +12 -0
- package/scripts/gxpm.ts +216 -0
- package/scripts/host-config.ts +62 -0
- package/scripts/install-claude-hooks.ts +138 -0
- package/scripts/install-codex-hooks.ts +271 -0
- package/scripts/install-hooks.ts +128 -0
- package/scripts/install-kimi-hooks.ts +92 -0
- package/scripts/install-skill.ts +184 -0
- package/scripts/phase-artifact-commands.ts +100 -0
- package/scripts/post-land-sync.ts +46 -0
- package/scripts/scaffold-check.ts +85 -0
- package/scripts/skill-naming-check.ts +78 -0
- package/scripts/skill-structure-check.ts +157 -0
- package/scripts/skills-lock-check.ts +60 -0
- package/scripts/sync-markdown-artifacts.ts +172 -0
- package/scripts/uninstall.ts +162 -0
- package/scripts/version.ts +47 -0
- package/scripts/wait-pr-ready.ts +407 -0
- package/skills/gxpm/SKILL.md +485 -0
- package/skills/gxpm/SKILL.md.tmpl +422 -0
- package/skills/gxpm/references/CANON.md +53 -0
- package/skills/gxpm/references/key-rules.md +130 -0
- package/skills/gxpm-architecture/SKILL.md +106 -0
- package/skills/gxpm-architecture/references/DEEPENING.md +37 -0
- package/skills/gxpm-architecture/references/INTERFACE-DESIGN.md +44 -0
- package/skills/gxpm-autopilot/SKILL.md +116 -0
- package/skills/gxpm-autopilot/SKILL.md.tmpl +107 -0
- package/skills/gxpm-browser/SKILL.md +105 -0
- package/skills/gxpm-browser/SKILL.md.tmpl +41 -0
- package/skills/gxpm-browser/references/commands.md +43 -0
- package/skills/gxpm-browser/references/evidence-path.md +20 -0
- package/skills/gxpm-build/SKILL.md +78 -0
- package/skills/gxpm-cleanup/SKILL.md +76 -0
- package/skills/gxpm-debug-issue/SKILL.md +39 -0
- package/skills/gxpm-diagnose/SKILL.md +220 -0
- package/skills/gxpm-diagnose/SKILL.md.tmpl +31 -0
- package/skills/gxpm-diagnose/references/feedback-loop.md +34 -0
- package/skills/gxpm-diagnose/references/feedback-loops.md +43 -0
- package/skills/gxpm-diagnose/references/phases.md +60 -0
- package/skills/gxpm-eval/SKILL.md +78 -0
- package/skills/gxpm-explore-codebase/SKILL.md +36 -0
- package/skills/gxpm-explore-codebase/scripts/summarize-communities.ts +51 -0
- package/skills/gxpm-feedback/SKILL.md +122 -0
- package/skills/gxpm-grill/SKILL.md +159 -0
- package/skills/gxpm-grill/SKILL.md.tmpl +77 -0
- package/skills/gxpm-grill/references/documentation-templates.md +56 -0
- package/skills/gxpm-grill/references/process.md +25 -0
- package/skills/gxpm-handoff/SKILL.md +112 -0
- package/skills/gxpm-hygiene/SKILL.md +69 -0
- package/skills/gxpm-implementer/SKILL.md +142 -0
- package/skills/gxpm-implementer/SKILL.md.tmpl +141 -0
- package/skills/gxpm-linear/SKILL.md +282 -0
- package/skills/gxpm-linear/SKILL.md.tmpl +86 -0
- package/skills/gxpm-linear/references/commands.md +75 -0
- package/skills/gxpm-linear/references/workflows.md +120 -0
- package/skills/gxpm-planning/SKILL.md +134 -0
- package/skills/gxpm-prototype/SKILL.md +64 -0
- package/skills/gxpm-refactor-safely/SKILL.md +62 -0
- package/skills/gxpm-review-army/SKILL.md +117 -0
- package/skills/gxpm-review-changes/SKILL.md +36 -0
- package/skills/gxpm-setup/SKILL.md +101 -0
- package/skills/gxpm-specifier/SKILL.md +135 -0
- package/skills/gxpm-tdd/SKILL.md +187 -0
- package/skills/gxpm-tdd/references/interface-design.md +23 -0
- package/skills/gxpm-tdd/references/mocking.md +27 -0
- package/skills/gxpm-tdd/references/red-green-refactor.md +61 -0
- package/skills/gxpm-tdd/references/troubleshooting.md +28 -0
- package/skills/gxpm-tdd/references/workflow.md +50 -0
- package/skills/gxpm-tdd/testing-anti-patterns.tmpl +304 -0
- package/skills/gxpm-triage/SKILL.md +160 -0
- package/skills/gxpm-verify/SKILL.md +107 -0
- package/skills/gxpm-write-skill/SKILL.md +131 -0
- package/skills/gxpm-zoom-out/SKILL.md +69 -0
- package/skills/maintain-hygiene-skills-lock/SKILL.md +54 -0
- package/skills/maintain-hygiene-skills-lock/SKILL.md.tmpl +53 -0
- package/templates/constitution-template.md +63 -0
- package/templates/hooks/gxpm-commit-msg +16 -0
- package/templates/hooks/gxpm-post-checkout +19 -0
- package/templates/hooks/gxpm-post-commit +7 -0
- package/templates/hooks/gxpm-post-merge +29 -0
- package/templates/hooks/gxpm-pre-commit +39 -0
- package/templates/hooks/gxpm-pre-push +33 -0
- package/templates/plan-template.md.tmpl +46 -0
- package/templates/spec-template.md.tmpl +63 -0
- package/templates/specify-stub.tmpl +22 -0
- package/templates/tasks-template.md.tmpl +32 -0
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
# Perplexity 团队内部 Agent Skills 设计、迭代与维护之道
|
|
2
|
+
|
|
3
|
+
> **作者:** meng shao (@shao__meng)
|
|
4
|
+
> **来源:** https://x.com/shao__meng/status/2053098123074105705
|
|
5
|
+
> **发布时间:** 2026-05-09 06:01
|
|
6
|
+
> **互动数据:** 4 回复, 24 转发, 143 点赞, 162 收藏, 13.2K 浏览
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
Perplexity Agents 团队的内部规范公开版,核心论点很反直觉:
|
|
11
|
+
|
|
12
|
+
> **写 Skill 不是写代码,而是为模型构建上下文。**
|
|
13
|
+
> 把工程师写代码的本能直接套到 Skill 上,几乎一定会失败。
|
|
14
|
+
|
|
15
|
+
原文链接:https://research.perplexity.ai/articles/designing-refining-and-maintaining-agent-skills-at-perplexity
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
## Skill ≠ 代码,以 Python 信条和 Skill 反信条为例
|
|
20
|
+
|
|
21
|
+
| Python 信条 | Skill 反信条 |
|
|
22
|
+
|------------|-------------|
|
|
23
|
+
| Simple is better than complex | **Skill 是文件夹,复杂性是特性** |
|
|
24
|
+
| Explicit is better than implicit | **激活靠隐式模式匹配 + 渐进披露** |
|
|
25
|
+
| Sparse is better than dense | **每 token 都要榨出最大信号** |
|
|
26
|
+
| 特例不应破坏规则 | **Gotchas 才是最高价值内容** |
|
|
27
|
+
| 容易解释的实现是好实现 | **容易解释的,模型已经会了 → 删掉** |
|
|
28
|
+
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
## Skill 的四重定义
|
|
32
|
+
|
|
33
|
+
### 1. Skill 是目录(不是单文件)
|
|
34
|
+
|
|
35
|
+
- **标准结构:** `SKILL.md` + `scripts/` + `references/` + `assets/` + `config.json`
|
|
36
|
+
- **复杂领域用多级层次**
|
|
37
|
+
- 例:美国税法有 1945 个 IRC 条款,扁平加载比不加载效果更差;分三级嵌套后才可用
|
|
38
|
+
- 但层次本身有代价,需要导航工具(quick reference、自定义检索)来对冲间接性
|
|
39
|
+
|
|
40
|
+
### 2. Skill 是格式
|
|
41
|
+
|
|
42
|
+
- **frontmatter 必须有:**
|
|
43
|
+
- `name`(小写、连字符、与目录同名)
|
|
44
|
+
- `description`
|
|
45
|
+
- **description 是路由触发器,不是文档**
|
|
46
|
+
- ❌ 常见错误:`「This Skill does X」`
|
|
47
|
+
- ✅ 正确写法:`「Load when …」`
|
|
48
|
+
- **`depends:`** 用于级联依赖;运行时元数据可用辅助 JSON/YAML 隔离,避免污染上下文
|
|
49
|
+
|
|
50
|
+
### 3. Skill 是可调用的
|
|
51
|
+
|
|
52
|
+
**加载流程:**
|
|
53
|
+
```
|
|
54
|
+
load_skill() → 拷贝目录入沙箱 → 递归装依赖 → 剥离 frontmatter,仅暴露 body 与附属文件
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
### 4. Skill 是渐进式的(这是最重要的成本模型)
|
|
58
|
+
|
|
59
|
+
| 层级 | 内容 | 大小 | 生命周期 |
|
|
60
|
+
|------|------|------|----------|
|
|
61
|
+
| **Index** | 所有 Skill 的 name+description | ~100 tokens/Skill | 每次会话、每个用户、**永远** |
|
|
62
|
+
| **Load** | SKILL.md body | ~5,000 tokens | 一次加载,会话内持续占用 |
|
|
63
|
+
| **Runtime** | scripts / references / 子 Skill | 无上界 | 仅模型实际读取时 |
|
|
64
|
+
|
|
65
|
+
> **→ 越靠上的层,每个字越贵。**
|
|
66
|
+
> **Index 是「奢侈品柜台」,Runtime 是「无限仓库」。**
|
|
67
|
+
|
|
68
|
+
---
|
|
69
|
+
|
|
70
|
+
## 什么时候不需要 Skill
|
|
71
|
+
|
|
72
|
+
反复强调 **「Every Skill is a tax」**。三类典型滥用:
|
|
73
|
+
|
|
74
|
+
1. **模型已会的** — 写一串 git 命令 → 是好文档,是坏 Skill
|
|
75
|
+
2. **重复 system prompt 的** — 通用知识应进全局上下文,不该走条件加载
|
|
76
|
+
3. **变化太快的** — 远端 MCP 工具版本频繁变 → Skill 会漂移导致幻觉
|
|
77
|
+
|
|
78
|
+
**判断单句是否该留的尺子:**
|
|
79
|
+
> 「没有这句话,Agent 会做错吗?」
|
|
80
|
+
> 答否即删。
|
|
81
|
+
|
|
82
|
+
引用 Pascal:
|
|
83
|
+
> 「这封信写得长,是因为我没时间写短。」
|
|
84
|
+
|
|
85
|
+
—— 写短 Skill 很难;写得快的 Skill 大概率有问题。
|
|
86
|
+
|
|
87
|
+
还引了一篇研究:**LLM 自生成的 Skill 平均无收益**,因为模型无法可靠地把"自己消费有用的程序性知识"写出来。
|
|
88
|
+
|
|
89
|
+
---
|
|
90
|
+
|
|
91
|
+
## 构建五步法(顺序不可调)
|
|
92
|
+
|
|
93
|
+
### Step 0 — 先写 Evals
|
|
94
|
+
|
|
95
|
+
- 源自真实查询、已知失败、邻域混淆
|
|
96
|
+
- **负例往往比正例更重要**
|
|
97
|
+
|
|
98
|
+
### Step 1 — 写 Description(最难的一行)
|
|
99
|
+
|
|
100
|
+
- 以 `"Load when…"` 开头,≤ 50 词
|
|
101
|
+
- 描述用户意图(用真实抱怨语:`「babysit」` `「watch CI」` `「make sure this lands」`)
|
|
102
|
+
- **不要总结工作流**
|
|
103
|
+
- **唯一目标:** 路由准确,最小化对其他 Skill 的回归影响
|
|
104
|
+
|
|
105
|
+
### Step 2 — 写 Body
|
|
106
|
+
|
|
107
|
+
- **跳过显然的**
|
|
108
|
+
- **不要罗列命令序列**
|
|
109
|
+
- **用意图陈述代替过程脚本**
|
|
110
|
+
|
|
111
|
+
❌ 反面示例:
|
|
112
|
+
```
|
|
113
|
+
git log; git checkout main; git checkout -b; git cherry-pick
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
✅ 正确写法:
|
|
117
|
+
```
|
|
118
|
+
"Cherry-pick 到干净分支,保留意图解决冲突,落不下时说明原因。"
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
**重点放 gotchas / 负例。**
|
|
122
|
+
|
|
123
|
+
### Step 3 — 用层次结构
|
|
124
|
+
|
|
125
|
+
条件性、重型、模板类内容拆到 `scripts/`、`references/`、`assets/`、`config.json`
|
|
126
|
+
|
|
127
|
+
### Step 4 — 迭代
|
|
128
|
+
|
|
129
|
+
- 用一个评测集做**小词级调优**
|
|
130
|
+
- 描述里**一字之差就能引发路由级联**
|
|
131
|
+
|
|
132
|
+
### Step 5 — Ship
|
|
133
|
+
|
|
134
|
+
---
|
|
135
|
+
|
|
136
|
+
## 维护:Gotchas 飞轮
|
|
137
|
+
|
|
138
|
+
Skill 是 **「仅追加为主」** 的:
|
|
139
|
+
|
|
140
|
+
| 问题 | 对策 |
|
|
141
|
+
|------|------|
|
|
142
|
+
| Agent 错了 | → 加 gotcha |
|
|
143
|
+
| 误加载 | → 收紧描述 + 加负例 |
|
|
144
|
+
| 该加载没加载 | → 加关键词 + 加正例 |
|
|
145
|
+
| system prompt 变了 | → 检查冲突与重复 |
|
|
146
|
+
|
|
147
|
+
从 80/20 走向 99.9% 的过程,**几乎全靠 gotcha 列表生长**,而不是改描述或加更长的指令。
|
|
148
|
+
|
|
149
|
+
> 一旦 PR 改描述却没附 evals,"已经走偏了"。
|
|
150
|
+
|
|
151
|
+
---
|
|
152
|
+
|
|
153
|
+
## 评测套件分四类
|
|
154
|
+
|
|
155
|
+
1. **加载评测:** 精度、召回、禁止加载(避免污染邻域)
|
|
156
|
+
2. **渐进加载评测:** Skill 加载后是否正确读取附属文件(如 FORMATTING.md)
|
|
157
|
+
3. **端到端任务评测:** 跑完整 agent loop,用 LLM judge 按 rubric 打分
|
|
158
|
+
4. **跨模型评测:** 在 GPT / Opus / Sonnet 上同时跑(行为差异显著)
|
|
159
|
+
|
|
160
|
+
---
|
|
161
|
+
|
|
162
|
+
## 关键 Takeaway
|
|
163
|
+
|
|
164
|
+
1. **先 evals,后 Skill**;负例与「禁止误载」与正例同等重要
|
|
165
|
+
2. **Description 是最难的一行**,以 `"Load when…"` 起手
|
|
166
|
+
3. **Gotchas 是最高价值内容**,从薄起步、随失败生长
|
|
167
|
+
4. **Action at a distance:** 新增 Skill 会悄无声息地降级现有 Skill —— 这是默认风险,不是边角情况
|
|
168
|
+
5. **写 Skill 的能力本身在复利增长**;任何按日/周/季重复的工作流,都是潜在 Skill
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
# PMC 与 gstack skill 调查
|
|
2
|
+
|
|
3
|
+
日期:2026-04-24
|
|
4
|
+
|
|
5
|
+
## 调查对象
|
|
6
|
+
|
|
7
|
+
- PMC skill:`/Users/x/.agents/skills/pmc`
|
|
8
|
+
- gstack for Claude:`/Users/x/.claude/skills/gstack`
|
|
9
|
+
- gstack for Codex wrapper:`/Users/x/.codex/skills/gstack`
|
|
10
|
+
|
|
11
|
+
## PMC 的核心能力
|
|
12
|
+
|
|
13
|
+
PMC 是状态驱动的 Linear issue 交付编排器。它的价值不是写代码,而是把问题从 triage 推进到 land,并在每个阶段留下可恢复、可审计、可复核的产物。
|
|
14
|
+
|
|
15
|
+
关键事实:
|
|
16
|
+
|
|
17
|
+
- 入口文件要求先读 `.omc/pm/<issue>/state.json`,不能凭聊天记忆判断阶段。
|
|
18
|
+
- 阶段路由为 `triage -> plan -> dispatch -> implement -> pr-check -> verify -> qa -> land`。
|
|
19
|
+
- 工作流合同中还有更细的 canonical state machine:
|
|
20
|
+
`dispatch -> implement -> local-verify -> ac-check -> self-review -> ship -> doc-release -> pr-check -> verify -> qa -> land`。
|
|
21
|
+
- Linear team key 固定为 `GXG`,Linear 是协作前门,不是执行器。
|
|
22
|
+
- 每个阶段都应写入 `.omc/pm/<issue>/...` 下的 JSON/Markdown 产物,并通过 checkpoint 更新状态。
|
|
23
|
+
- 对 bug 工作有 T0/T1/T2 分级;非机械 bug 需要假设、实验和 DEBUG 记录。
|
|
24
|
+
|
|
25
|
+
PMC 高价值模块:
|
|
26
|
+
|
|
27
|
+
- `references/phases/`:每个阶段的最小执行指南。
|
|
28
|
+
- `references/workflow-contract.md`:阶段机和阻塞规则。
|
|
29
|
+
- `references/acceptance-contract.md`、`local-verify-contract.md`、`verify-findings-contract.md`、`qa-findings-contract.md`:产物合同。
|
|
30
|
+
- `references/execution-continuity*.md`:上下文丢失后的恢复合同。
|
|
31
|
+
- `scripts/state/checkpoint.py`、`scripts/state/linear_sync.py`:状态推进和 Linear 同步基础。
|
|
32
|
+
- `scripts/render_*_report.py` 与 `write_local_verify.py`:结构化产物到可读报告的桥。
|
|
33
|
+
|
|
34
|
+
PMC 的限制:
|
|
35
|
+
|
|
36
|
+
- 强在 issue lifecycle,但不是完整的软件工厂。
|
|
37
|
+
- QA/browser 能力以合同为主,缺少 gstack 那种持久浏览器 runtime。
|
|
38
|
+
- 评审、ship、design/devex、安全、benchmark、canary 等能力需要外部 skill 或人工补齐。
|
|
39
|
+
- 技能发现、上下文恢复、自学习、版本升级、team install、preamble 生成等框架能力相对弱。
|
|
40
|
+
- `/pm land` 按既有结论应只做 gate/handoff,具体 develop merge 交给 merge skill,不应自己定义一套 merge 规范。
|
|
41
|
+
|
|
42
|
+
## gstack 的核心能力
|
|
43
|
+
|
|
44
|
+
gstack 是一个把 Claude Code 扩展成“虚拟工程团队”的技能框架。它的能力不只是一组 prompts,而是一套技能分发、持久浏览器、上下文恢复、学习、review/QA/ship 的组合。
|
|
45
|
+
|
|
46
|
+
关键事实:
|
|
47
|
+
|
|
48
|
+
- active gstack 安装在 `/Users/x/.claude/skills/gstack`,Codex 侧 `/Users/x/.codex/skills/gstack` 是轻量 wrapper/symlink 面。
|
|
49
|
+
- gstack skill 文档由 `SKILL.md.tmpl` 自动生成,减少命令和文档漂移。
|
|
50
|
+
- 每个 skill 都有 preamble:版本检查、会话计数、配置读取、telemetry 开关、路由提示、context recovery、learning。
|
|
51
|
+
- 浏览器能力采用 long-lived Chromium daemon:CLI 读 `.gstack/browse.json`,通过 localhost HTTP 调 server,server 再通过 CDP 控制 Chromium。
|
|
52
|
+
- 浏览器 server 使用 bearer token、本地绑定、状态文件 0600、cookie 只读复制和 Keychain 授权。
|
|
53
|
+
- 技能覆盖 office-hours、plan、review、investigate、qa、ship、land-and-deploy、canary、benchmark、security、document-release、retro、learn 等完整交付链。
|
|
54
|
+
|
|
55
|
+
gstack 高价值模块:
|
|
56
|
+
|
|
57
|
+
- `ARCHITECTURE.md`:browser daemon、ref system、logging、模板生成和测试体系。
|
|
58
|
+
- `docs/skills.md`:技能地图和角色分工。
|
|
59
|
+
- `browse/`:持久浏览器 runtime。
|
|
60
|
+
- `qa/`:Test -> Fix -> Verify loop、health score、截图证据、回归测试生成。
|
|
61
|
+
- `review/`:diff review、specialist dispatch、adversarial review、fix-first。
|
|
62
|
+
- `ship/`:base merge、测试、review、版本/变更日志、PR。
|
|
63
|
+
- `investigate/`:root cause first、3-strike、scope lock、verification report。
|
|
64
|
+
- `bin/gstack-*`:配置、升级、timeline、learning、team init、repo mode 等基础设施。
|
|
65
|
+
|
|
66
|
+
gstack 的限制:
|
|
67
|
+
|
|
68
|
+
- 默认面向代码交付和浏览器 QA,不是 Linear-first 的 PM 状态机。
|
|
69
|
+
- 很多流程强绑定 Claude Code 语境,需要抽象成跨宿主协议后才能被 gxpm 复用。
|
|
70
|
+
- `/ship` 是自动化 release flow;gxpm 应保留用户确认和 PMC gate,不应照搬所有自动推送/PR 语义。
|
|
71
|
+
- gstack 强调完整性,但 gxpm 需要区分“可 boil 的 lake”和跨项目、跨团队、跨季度的 ocean。
|
|
72
|
+
|
|
73
|
+
## gxpm 的替代方向
|
|
74
|
+
|
|
75
|
+
gxpm 应该采用“重新抽象后的统一产品架构”,而不是“PMC 为骨架,gstack 为肌肉”的组合式 wrapper。
|
|
76
|
+
|
|
77
|
+
PMC 和 gstack 都应该被拆成 capability source:
|
|
78
|
+
|
|
79
|
+
- PMC 贡献项目管理状态机、Linear 协作面、artifact gate、checkpoint 和可恢复执行。
|
|
80
|
+
- gstack 贡献技能运行时、浏览器 runtime、QA/review/ship/investigate、context recovery、learn/timeline 和团队化安装。
|
|
81
|
+
- gxpm 负责把这些能力重新定义成统一 state graph、capability runtime、evidence store、policy engine 和 product CLI/skill surface。
|
|
82
|
+
|
|
83
|
+
吸收 PMC:
|
|
84
|
+
|
|
85
|
+
- Linear issue 入口与同步。
|
|
86
|
+
- 阶段状态机、checkpoint、artifact-first truth。
|
|
87
|
+
- acceptance/local-verify/verify/qa/land 合同。
|
|
88
|
+
- gate-first 而不是 worker-first 的责任边界。
|
|
89
|
+
|
|
90
|
+
吸收 gstack:
|
|
91
|
+
|
|
92
|
+
- skill preamble 框架:版本、配置、会话、路由、上下文恢复。
|
|
93
|
+
- browser daemon 或 browser adapter:为 PMC `qa` phase 提供真实 browser evidence。
|
|
94
|
+
- review/qa/ship 的 report schema 和可验证证据习惯。
|
|
95
|
+
- learn/timeline/context-save/context-restore 的持久上下文机制。
|
|
96
|
+
- template-generated skill docs,避免手写命令漂移。
|
|
97
|
+
- specialist map:review、security、design、devex、benchmark、canary 等作为可选能力包。
|
|
98
|
+
|
|
99
|
+
避免:
|
|
100
|
+
|
|
101
|
+
- 不把 gxpm 写成 PMC/gstack 的兼容壳。
|
|
102
|
+
- 不保留 `.omc` 与 `.gstack` 两套长期真值。
|
|
103
|
+
- 不把 gstack 整树 vendoring 进 gxpm。
|
|
104
|
+
- 不把 PMC phase guide 简单改写成另一个手册。
|
|
105
|
+
- 不让 Linear 执行代码或替代本地状态。
|
|
106
|
+
- 不在 V0 同时实现所有 runtime、browser、review、ship、deploy 能力。
|
|
107
|
+
|
|
108
|
+
## 建议的 V0 定义
|
|
109
|
+
|
|
110
|
+
V0 只做四件事:
|
|
111
|
+
|
|
112
|
+
1. 定义 gxpm 原生 state graph、artifact store、evidence store。
|
|
113
|
+
2. 定义 capability runtime:issue、planning、execution、review、browser、release、memory、skill。
|
|
114
|
+
3. 建立 PMC/gstack replacement map,明确每项旧能力迁移到哪个 gxpm 模块。
|
|
115
|
+
4. 写出 gxpm skill 入口,让代理能先读 state,再按最小引用面加载对应 gxpm capability guide。
|
|
116
|
+
|
|
117
|
+
V0 成功信号:
|
|
118
|
+
|
|
119
|
+
- 一个代理能在不加载 PMC/gstack 的情况下,从 gxpm issue/state 进入正确阶段。
|
|
120
|
+
- 每个阶段都知道调用哪个 gxpm capability、写哪些产物、什么时候停止。
|
|
121
|
+
- browser QA 能力被定义为 adapter/gate,而不是散落在 prompt 里的“去测一下”。
|
|
122
|
+
- Linear 同步失败时可以安全降级,本地状态仍然完整。
|
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
# Spec Kit 深度架构研究报告
|
|
2
|
+
|
|
3
|
+
> 研究日期:2026-05-05
|
|
4
|
+
> 来源:GitHub 官方开源项目 `spec-kit`(本地路径 `/Users/x/Desktop/Project/github/spec-kit`)
|
|
5
|
+
> 研究目的:从技术架构师视角分析 Spec-Driven Development 工具链的架构约束,为 gxpm 引入规格驱动开发能力提供决策依据
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## 一、项目定位
|
|
10
|
+
|
|
11
|
+
**Spec Kit** 是 GitHub 官方开源的 **Spec-Driven Development (SDD)** 工具包与 CLI。其核心主张是将软件规格说明(Specification)提升为**可执行的主要产物**,而非代码的附属文档。
|
|
12
|
+
|
|
13
|
+
产品形态:
|
|
14
|
+
- `specify` CLI(Python,Typer 框架)
|
|
15
|
+
- 模板系统(Markdown/TOML/YAML 命令模板)
|
|
16
|
+
- 工作流引擎(YAML 驱动,10 种步骤类型)
|
|
17
|
+
- 扩展/预设双系统(第三方能力接入与行为定制)
|
|
18
|
+
- 30+ AI 编码助手集成(Claude Code、Codex、Kimi、Cursor 等)
|
|
19
|
+
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
## 二、架构概览
|
|
23
|
+
|
|
24
|
+
### 2.1 目录结构
|
|
25
|
+
|
|
26
|
+
```
|
|
27
|
+
spec-kit/
|
|
28
|
+
├── src/specify_cli/ # CLI 核心源码(~14.8k 行 Python)
|
|
29
|
+
│ ├── __init__.py # 主 CLI 入口(5,869 行,含所有子命令)
|
|
30
|
+
│ ├── agents.py # CommandRegistrar:命令注册与多代理格式渲染
|
|
31
|
+
│ ├── extensions.py # ExtensionManager:扩展生命周期管理
|
|
32
|
+
│ ├── presets.py # PresetManager:预设生命周期与模板解析
|
|
33
|
+
│ ├── integrations/ # AI 助手集成抽象层(30+ 个)
|
|
34
|
+
│ │ ├── base.py # IntegrationBase 及四大子类抽象
|
|
35
|
+
│ │ └── <agent>/ # 每助手一个子包(claude/、gemini/、kimi/ 等)
|
|
36
|
+
│ └── workflows/ # 工作流引擎
|
|
37
|
+
│ ├── engine.py # WorkflowDefinition、WorkflowEngine、RunState
|
|
38
|
+
│ ├── expressions.py # Jinja2-like 表达式求值
|
|
39
|
+
│ └── steps/ # 10 种内置步骤(command/shell/prompt/gate/if/…)
|
|
40
|
+
├── templates/ # 核心页面模板与命令模板
|
|
41
|
+
├── scripts/ # Bash/PowerShell 辅助脚本
|
|
42
|
+
├── extensions/ # 扩展系统文档与内置 git 扩展
|
|
43
|
+
├── presets/ # 预设系统文档与内置预设
|
|
44
|
+
├── tests/ # ~25.7k 行测试代码(61 个文件)
|
|
45
|
+
└── docs/ # DocFx 文档站点
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
### 2.2 技术栈
|
|
49
|
+
|
|
50
|
+
| 层级 | 技术 |
|
|
51
|
+
|------|------|
|
|
52
|
+
| 语言 | Python 3.11+ |
|
|
53
|
+
| CLI | Typer(Click) |
|
|
54
|
+
| 构建 | Hatchling |
|
|
55
|
+
| TUI | Rich |
|
|
56
|
+
| 配置 | PyYAML、json5 |
|
|
57
|
+
| 版本兼容 | `packaging.SpecifierSet` |
|
|
58
|
+
| 路径规则 | `pathspec`(.gitignore 语义) |
|
|
59
|
+
| 测试 | pytest + pytest-cov |
|
|
60
|
+
| Lint | ruff |
|
|
61
|
+
| CI/CD | GitHub Actions |
|
|
62
|
+
|
|
63
|
+
---
|
|
64
|
+
|
|
65
|
+
## 三、核心抽象与概念模型
|
|
66
|
+
|
|
67
|
+
### 3.1 四层可扩展性栈(优先级从高到低)
|
|
68
|
+
|
|
69
|
+
| 层级 | 路径 | 作用 |
|
|
70
|
+
|------|------|------|
|
|
71
|
+
| 1. Project-Local Overrides | `.specify/templates/overrides/` | 一次性本地调整 |
|
|
72
|
+
| 2. Presets | `.specify/presets/<id>/` | 可共享、可堆叠的模板/命令/脚本覆盖 |
|
|
73
|
+
| 3. Extensions | `.specify/extensions/<id>/` | 新增能力与外部工具集成 |
|
|
74
|
+
| 4. Core | `.specify/templates/` | 内置默认模板 |
|
|
75
|
+
|
|
76
|
+
**关键设计**:Templates 在**运行时**解析(走优先级栈),而 Extension/Preset 的 commands 在**安装时**写入代理目录。
|
|
77
|
+
|
|
78
|
+
### 3.2 集成抽象(Integration Registry)
|
|
79
|
+
|
|
80
|
+
所有 AI 助手通过 `IntegrationBase` 注册到全局 `INTEGRATION_REGISTRY`:
|
|
81
|
+
|
|
82
|
+
- `IntegrationBase` — 抽象基类,定义 `key`、`config`、`setup()`、`teardown()`
|
|
83
|
+
- `MarkdownIntegration` — `.md` 命令格式,覆盖 ~20 个代理
|
|
84
|
+
- `TomlIntegration` — `.toml` 格式,用于 Gemini、Tabnine
|
|
85
|
+
- `YamlIntegration` — YAML recipe,用于 Goose
|
|
86
|
+
- `SkillsIntegration` — `SKILL.md` 目录布局,用于 Codex、Kimi 等
|
|
87
|
+
|
|
88
|
+
**设计约束**:CLI 型集成(`requires_cli: True`)的 `key` 必须与实际可执行文件名匹配,以便 `shutil.which(key)` 检测。
|
|
89
|
+
|
|
90
|
+
### 3.3 工作流引擎
|
|
91
|
+
|
|
92
|
+
状态机驱动的执行引擎:
|
|
93
|
+
|
|
94
|
+
```
|
|
95
|
+
CREATED → RUNNING → [COMPLETED | PAUSED | FAILED | ABORTED]
|
|
96
|
+
↑___________|
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
- `WorkflowDefinition`:从 YAML 解析(id/name/version/inputs/steps)
|
|
100
|
+
- `WorkflowEngine`:加载 → 校验 → 执行 → 持久化 → 恢复
|
|
101
|
+
- `RunState`:每步后保存到 `.specify/workflows/runs/{run_id}/state.json`
|
|
102
|
+
- `StepContext`:传递 inputs、steps 结果、item、fan_in 等上下文
|
|
103
|
+
|
|
104
|
+
10 种内置步骤:command、shell、prompt、gate、if_then、switch、while_loop、do_while、fan_out、fan_in。
|
|
105
|
+
|
|
106
|
+
### 3.4 扩展与预设生命周期
|
|
107
|
+
|
|
108
|
+
| 组件 | 核心类 | 注册表 |
|
|
109
|
+
|------|--------|--------|
|
|
110
|
+
| 扩展 | `ExtensionManager`、`ExtensionManifest` | `.specify/extensions/.registry` |
|
|
111
|
+
| 预设 | `PresetManager`、`PresetManifest` | `.specify/presets/.registry` |
|
|
112
|
+
|
|
113
|
+
两者均支持:
|
|
114
|
+
- 目录系统(`catalog.json` + `catalog.community.json`)
|
|
115
|
+
- ZIP 下载安装、版本兼容性检查(PEP 440)
|
|
116
|
+
- 命令注册到代理目录、卸载时清理
|
|
117
|
+
- 技能模式(`--ai-skills`)下生成 `SKILL.md`
|
|
118
|
+
|
|
119
|
+
---
|
|
120
|
+
|
|
121
|
+
## 四、架构约束(显式与隐式)
|
|
122
|
+
|
|
123
|
+
### 4.1 显式约束
|
|
124
|
+
|
|
125
|
+
| 约束 | 来源 | 说明 |
|
|
126
|
+
|------|------|------|
|
|
127
|
+
| Python >= 3.11 | `pyproject.toml` | 现代语法依赖 |
|
|
128
|
+
| 模板运行时解析栈 | `presets/ARCHITECTURE.md` | Override > Preset > Extension > Core,不可绕过 |
|
|
129
|
+
| 命令命名空间 | `extensions.py` | 扩展命令必须遵循 `speckit.{ext-id}.{cmd}`,不可 shadow core |
|
|
130
|
+
| 语义版本 | Manifest | PEP 440,`SpecifierSet` 校验 |
|
|
131
|
+
| 预设组合策略 | `presets.py` | 仅 replace/prepend/append/wrap 四种;script 仅 replace/wrap |
|
|
132
|
+
| 工作流 schema_version | `engine.py` | 仅支持 `1.0` |
|
|
133
|
+
| 步骤 ID 唯一性 | `engine.py` | 不允许 `:` 字符(保留给引擎嵌套 ID) |
|
|
134
|
+
| Agent CLI Key 匹配 | `AGENTS.md` | `requires_cli=True` 时 `key` 必须等于可执行文件名 |
|
|
135
|
+
| 上下文文件标记 | `base.py` | `<!-- SPECKIT START -->` / `<!-- SPECKIT END -->` 管理注入段 |
|
|
136
|
+
| 路径逃逸防护 | `agents.py`、`extensions.py` | 所有写入通过 `_ensure_inside()` 校验 |
|
|
137
|
+
|
|
138
|
+
### 4.2 隐式约束
|
|
139
|
+
|
|
140
|
+
| 约束 | 推断依据 | 架构影响 |
|
|
141
|
+
|------|---------|---------|
|
|
142
|
+
| **单例注册表模式** | `INTEGRATION_REGISTRY`、`STEP_REGISTRY` 为全局字典 | 不支持动态卸载;扩展新步骤需修改源码并重启 |
|
|
143
|
+
| **同步 I/O 为主** | `subprocess.run`、文件读写均为同步阻塞 | 工作流 fan-out 实际顺序执行;无法利用异步并发 |
|
|
144
|
+
| **无数据库/无服务器** | 所有状态以 JSON/YAML 文件落盘 | 适合本地 CLI,无法天然支持多机协作或服务化 |
|
|
145
|
+
| **Template-First 设计** | 核心逻辑依赖 Markdown 模板占位符替换 | 复杂条件逻辑难以在模板中表达,必须下沉到 Python/shell |
|
|
146
|
+
| **单项目隔离** | 所有产物落在 `.specify/` 目录下 | 不支持跨项目复用配置(除非通过 `~/.specify/`) |
|
|
147
|
+
| **代理目录耦合** | 安装时直接写入 `.claude/commands/` 等 | 代理升级或目录结构变更会导致不兼容 |
|
|
148
|
+
| **无网络服务治理** | 扩展下载直接拉取 GitHub raw/ZIP | 无镜像、无缓存失效策略、无重试机制 |
|
|
149
|
+
| **强一致性文件状态假设** | 注册表、manifest、模板文件必须同时一致 | 手动修改 `.specify/` 易导致状态不一致 |
|
|
150
|
+
|
|
151
|
+
### 4.3 宪法级约束(SDD 方法论)
|
|
152
|
+
|
|
153
|
+
`spec-driven.md` 中阐述的 **Nine Articles of Development**:
|
|
154
|
+
|
|
155
|
+
1. **Library-First**:每个特性必须先以独立库形式存在
|
|
156
|
+
2. **CLI Interface Mandate**:所有库必须暴露 CLI(stdin/stdout,支持 JSON)
|
|
157
|
+
3. **Test-First Imperative**:严格 TDD,红-绿-重构
|
|
158
|
+
4. **Composition over Inheritance**:优先组合
|
|
159
|
+
5. **Explicit over Implicit**:显式优于隐式
|
|
160
|
+
6. **Fail Fast, Fail Loud**:快速失败、大声失败
|
|
161
|
+
7. **Simplicity Gate**:最多 3 个项目/模块
|
|
162
|
+
8. **Anti-Abstraction**:直接使用框架特性,禁止过度包装
|
|
163
|
+
9. **Integration-First Testing**:优先使用真实环境而非 mock
|
|
164
|
+
|
|
165
|
+
这些约束通过模板中的 Phase -1 Gates 强制执行,是 Spec Kit 生成代码的元级约束。
|
|
166
|
+
|
|
167
|
+
---
|
|
168
|
+
|
|
169
|
+
## 五、模块耦合分析
|
|
170
|
+
|
|
171
|
+
### 5.1 高耦合点
|
|
172
|
+
|
|
173
|
+
1. **`presets.py` ↔ `extensions.py`**:预设命令注册时需检查扩展是否已安装;预设卸载后需调和技能目录。
|
|
174
|
+
2. **`agents.py` ↔ `integrations/base.py`**:`CommandRegistrar` 的 `AGENT_CONFIGS` 在运行时从 `INTEGRATION_REGISTRY` 派生,存在循环导入风险(通过懒加载和 `try/except ImportError` 处理)。
|
|
175
|
+
3. **`__init__.py` ↔ 所有子模块`**:主 CLI 文件导入并委托给各子模块,形成事实上的 Facade,但单文件膨胀至近 6,000 行。
|
|
176
|
+
|
|
177
|
+
### 5.2 低耦合点
|
|
178
|
+
|
|
179
|
+
- `workflows/` 子系统几乎独立于扩展/预设系统
|
|
180
|
+
- `integrations/` 子包之间完全独立(每代理一个文件,通常 <30 行)
|
|
181
|
+
|
|
182
|
+
---
|
|
183
|
+
|
|
184
|
+
## 六、限制与风险
|
|
185
|
+
|
|
186
|
+
### 6.1 显式文档化的限制
|
|
187
|
+
|
|
188
|
+
1. **Resume 粒度限制**:嵌套步骤(`if`/`switch`/`while` 内)暂停后,resume 会重新运行父控制流步骤及其嵌套体。精确 resume(嵌套步骤路径栈)是计划中的增强。
|
|
189
|
+
2. **Requirements 未强制**:`engine.py` 中声明但未在运行时强制。
|
|
190
|
+
3. **Windows Bash 测试跳过**:`test.yml` 中注明,无 MSYS2/MINGW 时 bash 测试自动跳过。
|
|
191
|
+
|
|
192
|
+
### 6.2 代码推断的限制
|
|
193
|
+
|
|
194
|
+
1. **单体 CLI 文件膨胀**:`__init__.py` 近 6,000 行,未按子命令拆分。
|
|
195
|
+
2. **同步架构天花板**:所有 I/O 同步,fan-out 无真正并行。
|
|
196
|
+
3. **模板表达能力受限**:复杂逻辑无法在 Markdown 模板中表达。
|
|
197
|
+
4. **多代理维护负担**:30+ 集成子包大部分为 10-30 行重复声明,代理格式变更需逐一手动更新。
|
|
198
|
+
5. **扩展生态信任模型**:社区扩展采用策展而非代码审计模型,官方声明不审查扩展代码本身。
|
|
199
|
+
6. **无内置迁移/升级工具**:`specify upgrade` 依赖 git 拉取,对非 git 或已重度定制项目的升级策略不明确。
|
|
200
|
+
|
|
201
|
+
---
|
|
202
|
+
|
|
203
|
+
## 七、对 gxpm 的映射参考
|
|
204
|
+
|
|
205
|
+
| Spec Kit 能力 | gxpm 映射参考 | 借鉴优先级 |
|
|
206
|
+
|--------------|--------------|-----------|
|
|
207
|
+
| **SDD 宪法(Nine Articles)** | `docs/governance/development-contract.md` 可引入规格驱动开发章节 | 高 |
|
|
208
|
+
| **四层可扩展性栈** | gxpm 的 `skills/` + `templates/` + `.gxpm/local/` 可对标为 Override/Preset/Extension/Core | 高 |
|
|
209
|
+
| **工作流引擎** | gxpm 当前 phase gate(triage→plan→dispatch→…→land)可升级为 YAML 可声明的状态机 | 中 |
|
|
210
|
+
| **Integration Registry** | `hosts/claude.ts`、`hosts/codex.ts` 可升级为统一的宿主适配注册表 | 高 |
|
|
211
|
+
| **模板运行时解析** | skill 的 `*.tmpl` 生成机制可借鉴优先级栈覆盖逻辑 | 中 |
|
|
212
|
+
| **扩展/预设目录系统** | gxpm 的 capability runtime 可引入社区扩展目录与版本兼容检查 | 低 |
|
|
213
|
+
| **SKILL.md 生成模式** | 已有 `bun run gen:skill-docs`,可引入 `--ai-skills` 多宿主批量生成 | 中 |
|
|
214
|
+
| **工作流 Resume 机制** | gxpm 的 checkpoint/execution continuity 可借鉴状态持久化与恢复模型 | 中 |
|
|
215
|
+
|
|
216
|
+
---
|
|
217
|
+
|
|
218
|
+
## 八、关键结论
|
|
219
|
+
|
|
220
|
+
1. **Spec Kit 的核心价值不是代码,是方法论**:SDD 宪法和四层可扩展性栈是最大资产,工作流引擎和模板系统是实现载体。
|
|
221
|
+
2. **同步+文件系统状态机是天花板也是护城河**:适合本地 CLI 场景,但服务化/协作化需要重构核心引擎。
|
|
222
|
+
3. **30+ 宿主集成的维护模式不可复制**:gxpm 应采用"协议抽象+代码生成"而非"手写 30 个适配文件"。
|
|
223
|
+
4. **扩展/预设双系统提供了清晰的定制边界**:Override > Preset > Extension > Core 的优先级栈可直接借鉴到 gxpm 的 skill/template 系统。
|
|
224
|
+
5. **工作流引擎的 resume 和 gate 步骤与 gxpm 的 phase gate 天然互补**:可将 gxpm 的 phase 推进逻辑从硬编码 TypeScript 升级为声明式 YAML 工作流。
|