@pm_zhousl/xinyun-ai-init 2.0.0 → 3.0.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 (199) hide show
  1. package/README.md +29 -39
  2. package/bin/xinyun-ai-init.js +121 -175
  3. package/init/xinyun-ai-init/README.md +26 -144
  4. package/init/xinyun-ai-init/rules/v3-skill-runtime.md +45 -0
  5. package/init/xinyun-ai-init/runtime/migrate-v3.js +115 -0
  6. package/init/xinyun-ai-init/runtime/route-skill.js +69 -0
  7. package/init/xinyun-ai-init/runtime-manifest.json +26 -0
  8. package/init/xinyun-ai-init/skills/registry.json +112 -0
  9. package/init/xinyun-ai-init/templates/AGENTS.template.md +4 -27
  10. package/init/xinyun-ai-init/templates/README.template.md +3 -31
  11. package/init/xinyun-ai-init/templates/control-plane-index.template.json +5 -24
  12. package/init/xinyun-ai-init/templates/core-rules.template.md +9 -57
  13. package/init/xinyun-ai-init/templates/current-task.template.md +3 -19
  14. package/init/xinyun-ai-init/templates/manifest.template.json +13 -67
  15. package/init/xinyun-ai-init/templates/project-context.template.json +3 -11
  16. package/init/xinyun-ai-init/templates/project-index.template.json +5 -51
  17. package/init/xinyun-ai-init/templates/skill-run-record.template.json +4 -16
  18. package/init/xinyun-ai-init/templates/skill-runtime-route.template.json +3 -24
  19. package/init/xinyun-ai-init/templates/skills-assignments.template.json +3 -21
  20. package/init/xinyun-ai-init/templates/skills-registry.template.json +5 -29
  21. package/init/xinyun-ai-init/templates/task-graph.template.json +3 -5
  22. package/init/xinyun-ai-init/templates/task-index.template.json +3 -31
  23. package/init/xinyun-ai-init/version.json +8 -8
  24. package/package.json +8 -14
  25. package/scripts/run-v3-runtime-probe.js +8 -0
  26. package/scripts/verify-legacy-cleanup.js +24 -0
  27. package/scripts/verify-release-gate.js +10 -23
  28. package/scripts/verify-rules-tarball-security.js +1 -1
  29. package/scripts/verify-skill-runtime.js +33 -0
  30. package/scripts/verify-tarball.js +42 -0
  31. package/scripts/verify-v3-package.js +70 -0
  32. package/test-scenarios/v3.0.0-behavior-evidence.json +25 -0
  33. package/test-scenarios/v3.0.0-scenarios.md +41 -0
  34. package/init/xinyun-ai-init/prompt.md +0 -1
  35. package/init/xinyun-ai-init/rules/coordination.md +0 -43
  36. package/init/xinyun-ai-init/rules/directory-self-completion.md +0 -100
  37. package/init/xinyun-ai-init/rules/frameworks/README.md +0 -56
  38. package/init/xinyun-ai-init/rules/frameworks/backend/php/thinkphp.md +0 -42
  39. package/init/xinyun-ai-init/rules/frameworks/frontend/uni-app.md +0 -36
  40. package/init/xinyun-ai-init/rules/frameworks/frontend/wechat-miniprogram.md +0 -36
  41. package/init/xinyun-ai-init/rules/frontend-audit.md +0 -9
  42. package/init/xinyun-ai-init/rules/init-rules.md +0 -145
  43. package/init/xinyun-ai-init/rules/self-learning-rules.md +0 -16
  44. package/init/xinyun-ai-init/rules/session-workbench.md +0 -333
  45. package/init/xinyun-ai-init/rules/skills.md +0 -23
  46. package/init/xinyun-ai-init/rules/temporary-sessions.md +0 -13
  47. package/init/xinyun-ai-init/rules/upgrade-rules.md +0 -161
  48. package/init/xinyun-ai-init/rules/v1.10.2-contract.md +0 -30
  49. package/init/xinyun-ai-init/rules/v1.11.0-acceleration.md +0 -27
  50. package/init/xinyun-ai-init/rules/v1.12.0-recovery.md +0 -34
  51. package/init/xinyun-ai-init/rules/v1.12.1-provider-session-binding.md +0 -25
  52. package/init/xinyun-ai-init/rules/v1.13.0-host-adapter.md +0 -43
  53. package/init/xinyun-ai-init/rules/v1.14.0-agent-core.md +0 -35
  54. package/init/xinyun-ai-init/rules/v1.15.0-session-binding.md +0 -44
  55. package/init/xinyun-ai-init/rules/v1.16.0-capability-efficiency.md +0 -23
  56. package/init/xinyun-ai-init/rules/v2.0.0-shared-project-conversations.md +0 -68
  57. package/init/xinyun-ai-init/rules/v2.0.0-single-session-skills.md +0 -89
  58. package/init/xinyun-ai-init/scripts/README.md +0 -16
  59. package/init/xinyun-ai-init/templates/agent-capabilities.template.json +0 -27
  60. package/init/xinyun-ai-init/templates/agent-profile.template.json +0 -21
  61. package/init/xinyun-ai-init/templates/archive-transaction.template.json +0 -15
  62. package/init/xinyun-ai-init/templates/bootstrap-snapshot.template.json +0 -22
  63. package/init/xinyun-ai-init/templates/capabilities.template.json +0 -19
  64. package/init/xinyun-ai-init/templates/codegraph-incremental-record.template.json +0 -21
  65. package/init/xinyun-ai-init/templates/conversation-binding.template.json +0 -26
  66. package/init/xinyun-ai-init/templates/conversation-event.template.json +0 -24
  67. package/init/xinyun-ai-init/templates/conversation-registry.template.json +0 -15
  68. package/init/xinyun-ai-init/templates/conversation-stream-head.template.json +0 -14
  69. package/init/xinyun-ai-init/templates/conversation-sync-cursor.template.json +0 -13
  70. package/init/xinyun-ai-init/templates/coordination-change-ledger.template.json +0 -15
  71. package/init/xinyun-ai-init/templates/coordination-conflict-record.template.json +0 -18
  72. package/init/xinyun-ai-init/templates/coordination-contract-snapshot.template.json +0 -9
  73. package/init/xinyun-ai-init/templates/coordination-project-facts.template.json +0 -20
  74. package/init/xinyun-ai-init/templates/coordination-transaction.template.json +0 -16
  75. package/init/xinyun-ai-init/templates/database-authorization.template.json +0 -53
  76. package/init/xinyun-ai-init/templates/final-delivery.template.json +0 -22
  77. package/init/xinyun-ai-init/templates/fixed-materialization.template.json +0 -12
  78. package/init/xinyun-ai-init/templates/framework-profile.template.json +0 -48
  79. package/init/xinyun-ai-init/templates/framework-profile.template.md +0 -39
  80. package/init/xinyun-ai-init/templates/frontend-audit.template.json +0 -27
  81. package/init/xinyun-ai-init/templates/handoff.template.json +0 -27
  82. package/init/xinyun-ai-init/templates/host-capabilities.template.json +0 -37
  83. package/init/xinyun-ai-init/templates/host-preflight.template.json +0 -33
  84. package/init/xinyun-ai-init/templates/html-migration-asset-map.template.md +0 -6
  85. package/init/xinyun-ai-init/templates/html-migration-compatibility-matrix.template.md +0 -6
  86. package/init/xinyun-ai-init/templates/html-migration-open-issues.template.md +0 -12
  87. package/init/xinyun-ai-init/templates/html-migration-pilot-plan.template.md +0 -21
  88. package/init/xinyun-ai-init/templates/html-migration-record.template.json +0 -36
  89. package/init/xinyun-ai-init/templates/html-migration-route-map.template.md +0 -6
  90. package/init/xinyun-ai-init/templates/html-migration-scope.template.md +0 -28
  91. package/init/xinyun-ai-init/templates/init-result.template.json +0 -25
  92. package/init/xinyun-ai-init/templates/initialization-cache.template.json +0 -13
  93. package/init/xinyun-ai-init/templates/initialization-change-report.template.json +0 -14
  94. package/init/xinyun-ai-init/templates/initialization-recovery.template.json +0 -24
  95. package/init/xinyun-ai-init/templates/initialization-stages.template.json +0 -18
  96. package/init/xinyun-ai-init/templates/initialization-timing.template.json +0 -16
  97. package/init/xinyun-ai-init/templates/local-query-index.template.json +0 -15
  98. package/init/xinyun-ai-init/templates/managed-baseline.template.json +0 -17
  99. package/init/xinyun-ai-init/templates/manual-session-binding.template.json +0 -45
  100. package/init/xinyun-ai-init/templates/manual-session-recovery.template.json +0 -53
  101. package/init/xinyun-ai-init/templates/multi-conversation-migration.template.json +0 -24
  102. package/init/xinyun-ai-init/templates/onboarding-report.template.json +0 -30
  103. package/init/xinyun-ai-init/templates/orchestrator.template.json +0 -28
  104. package/init/xinyun-ai-init/templates/parallelism.template.json +0 -13
  105. package/init/xinyun-ai-init/templates/performance-metrics.template.json +0 -17
  106. package/init/xinyun-ai-init/templates/preflight-report.template.json +0 -25
  107. package/init/xinyun-ai-init/templates/project-check.template.md +0 -56
  108. package/init/xinyun-ai-init/templates/project-guide.template.md +0 -57
  109. package/init/xinyun-ai-init/templates/project-identity.template.json +0 -23
  110. package/init/xinyun-ai-init/templates/project-status.template.json +0 -28
  111. package/init/xinyun-ai-init/templates/provider-adapter.template.json +0 -25
  112. package/init/xinyun-ai-init/templates/provider-session-binding.template.json +0 -77
  113. package/init/xinyun-ai-init/templates/re-takeover-record.template.json +0 -37
  114. package/init/xinyun-ai-init/templates/requirement-packet.template.json +0 -23
  115. package/init/xinyun-ai-init/templates/role-execution.template.md +0 -72
  116. package/init/xinyun-ai-init/templates/role-session-binding.template.json +0 -105
  117. package/init/xinyun-ai-init/templates/role-subtask.template.md +0 -36
  118. package/init/xinyun-ai-init/templates/session-binding.template.json +0 -38
  119. package/init/xinyun-ai-init/templates/session-candidates.template.json +0 -19
  120. package/init/xinyun-ai-init/templates/shared-project-snapshot.template.json +0 -24
  121. package/init/xinyun-ai-init/templates/single-session-migration.template.json +0 -31
  122. package/init/xinyun-ai-init/templates/sync-check.template.json +0 -23
  123. package/init/xinyun-ai-init/templates/takeover-baseline.template.json +0 -17
  124. package/init/xinyun-ai-init/templates/takeover-gate.template.json +0 -22
  125. package/init/xinyun-ai-init/templates/task-history.template.md +0 -35
  126. package/init/xinyun-ai-init/templates/task-lease.template.json +0 -19
  127. package/init/xinyun-ai-init/templates/task-lock.template.json +0 -31
  128. package/init/xinyun-ai-init/templates/task-main.template.md +0 -38
  129. package/init/xinyun-ai-init/templates/task-result.template.json +0 -23
  130. package/init/xinyun-ai-init/templates/team/README.md +0 -51
  131. package/init/xinyun-ai-init/templates/team/assignments.json +0 -49
  132. package/init/xinyun-ai-init/templates/team/confirmations/chief-engineer.md +0 -24
  133. package/init/xinyun-ai-init/templates/team/confirmations/programmer.md +0 -24
  134. package/init/xinyun-ai-init/templates/team/confirmations/project-owner.md +0 -24
  135. package/init/xinyun-ai-init/templates/team/confirmations/project-product.md +0 -24
  136. package/init/xinyun-ai-init/templates/team/confirmations/test-reviewer.md +0 -24
  137. package/init/xinyun-ai-init/templates/team/file-ownership.json +0 -32
  138. package/init/xinyun-ai-init/templates/team/members.json +0 -61
  139. package/init/xinyun-ai-init/templates/team/responsibility-matrix.json +0 -81
  140. package/init/xinyun-ai-init/templates/team/roles.json +0 -71
  141. package/init/xinyun-ai-init/templates/team/understandings/chief-engineer.md +0 -23
  142. package/init/xinyun-ai-init/templates/team/understandings/programmer.md +0 -23
  143. package/init/xinyun-ai-init/templates/team/understandings/project-owner.md +0 -23
  144. package/init/xinyun-ai-init/templates/team/understandings/project-product.md +0 -23
  145. package/init/xinyun-ai-init/templates/team/understandings/test-reviewer.md +0 -23
  146. package/init/xinyun-ai-init/templates/technical-impact-packet.template.json +0 -31
  147. package/init/xinyun-ai-init/templates/technical-landscape.template.json +0 -41
  148. package/init/xinyun-ai-init/templates/temporary-session.template.json +0 -32
  149. package/init/xinyun-ai-init/templates/workstreams-readme.template.md +0 -36
  150. package/scripts/collect-v1.10-evidence.js +0 -159
  151. package/scripts/collect-v1.14-local-evidence.js +0 -66
  152. package/scripts/collect-v1.15-real-evidence.js +0 -114
  153. package/scripts/collect-v1.16-evidence.js +0 -48
  154. package/scripts/collect-v2-evidence.js +0 -35
  155. package/scripts/run-v1.16-runtime-probe.js +0 -91
  156. package/scripts/run-v2-runtime-probe.js +0 -110
  157. package/scripts/verify-init-package.js +0 -2297
  158. package/scripts/verify-multi-conversation-contract.js +0 -61
  159. package/scripts/verify-re-takeover-contract.js +0 -54
  160. package/scripts/verify-rules-package.js +0 -1287
  161. package/scripts/verify-v2-package.js +0 -210
  162. package/scripts/verify-v2-tarball.js +0 -73
  163. package/test-scenarios/README.md +0 -130
  164. package/test-scenarios/fixtures/v1.10.0-takeover-gate-fixture/README.md +0 -23
  165. package/test-scenarios/fixtures/v1.10.0-takeover-gate-fixture/after/project-status.json +0 -7
  166. package/test-scenarios/fixtures/v1.10.0-takeover-gate-fixture/before/project-status.json +0 -7
  167. package/test-scenarios/fixtures/v1.9.0-behavior-fixture/README.md +0 -9
  168. package/test-scenarios/multi-conversation-evidence.json +0 -26
  169. package/test-scenarios/multi-conversation-scenarios.md +0 -16
  170. package/test-scenarios/re-takeover-evidence.json +0 -20
  171. package/test-scenarios/re-takeover-scenarios.md +0 -33
  172. package/test-scenarios/review-template.md +0 -165
  173. package/test-scenarios/scenarios.md +0 -1273
  174. package/test-scenarios/v1.10.0-behavior-evidence.json +0 -31
  175. package/test-scenarios/v1.10.0-scenarios.md +0 -96
  176. package/test-scenarios/v1.10.2-scenarios.md +0 -38
  177. package/test-scenarios/v1.11.0-scenarios.md +0 -30
  178. package/test-scenarios/v1.12.0-behavior-evidence.json +0 -29
  179. package/test-scenarios/v1.12.0-scenarios.md +0 -51
  180. package/test-scenarios/v1.12.1-behavior-evidence.json +0 -27
  181. package/test-scenarios/v1.12.1-scenarios.md +0 -42
  182. package/test-scenarios/v1.13.0-behavior-evidence.json +0 -650
  183. package/test-scenarios/v1.13.0-scenarios.md +0 -94
  184. package/test-scenarios/v1.14.0-behavior-evidence.json +0 -780
  185. package/test-scenarios/v1.14.0-scenarios.md +0 -63
  186. package/test-scenarios/v1.15.0-behavior-evidence.json +0 -476
  187. package/test-scenarios/v1.15.0-scenarios.md +0 -57
  188. package/test-scenarios/v1.16.0-behavior-evidence.json +0 -46
  189. package/test-scenarios/v1.16.0-real-host-probe.json +0 -132
  190. package/test-scenarios/v1.16.0-scenarios.md +0 -19
  191. package/test-scenarios/v1.7.0-scenarios.md +0 -91
  192. package/test-scenarios/v1.7.1-scenarios.md +0 -130
  193. package/test-scenarios/v1.7.2-scenarios.md +0 -51
  194. package/test-scenarios/v1.7.3-scenarios.md +0 -79
  195. package/test-scenarios/v1.8.0-scenarios.md +0 -39
  196. package/test-scenarios/v1.9.0-behavior-evidence.json +0 -269
  197. package/test-scenarios/v1.9.0-scenarios.md +0 -55
  198. package/test-scenarios/v2.0.0-behavior-evidence.json +0 -40
  199. package/test-scenarios/v2.0.0-scenarios.md +0 -21
@@ -1,162 +1,44 @@
1
- # xinyun-ai-init 初始化包
1
+ # xinyun-ai-init v3 Skill Runtime
2
2
 
3
- 当前规则版本:`2.0.0`,执行模型为 `shared-project-multi-conversation-runtime`。
3
+ v3 将初始化包收敛为一套可以直接调用的 Skills、确定性路由器和最小项目控制面。新逻辑不创建固定角色、角色会话、team 目录或旧版本兼容运行时。
4
4
 
5
- 本目录是 `@pm_zhousl/xinyun-ai-init` 释放到目标项目的规则和模板基线。CLI 只创建或覆盖 `xinyun-ai-init/`,不会创建 `xinyun-ai/`,也不会修改业务代码。
6
-
7
- ## 当前执行模型
8
-
9
- v2 使用 `shared-project-multi-conversation-runtime`:
10
-
11
- - 每个目标项目维护一个共享 `projectContextId`。
12
- - 一个或多个宿主对话通过独立 `conversationBindingId` 接入同一项目上下文。
13
- - 每次用户交互先比较对话流 head 与本对话游标;没有变化时静默继续,有变化时只读取增量。
14
- - 每个对话只写自己的不可变事件流,避免多个对话追加同一个 JSON 文件造成覆盖。
15
- - 新安装不创建固定角色或角色专属会话;Skills 仍按任务事实执行。
16
-
17
- ## 新对话重新接管同一项目
18
-
19
- 每次新建对话都按“重新接管同一个项目”处理,不依赖上一段聊天上下文。宿主 AI 进入项目根目录后,先读取 `AGENTS.md`,再按目标项目 `xinyun-ai/index/control-plane-index.json` 中的 `authoritativeBootstrapOrder` 读取控制面文件,核对项目身份、当前任务、任务索引、任务图、项目快照和最近交接。
20
-
21
- 接管结果写入目标项目自己的 `xinyun-ai/index/re-takeover-record.json`,并更新项目索引中的理解状态。快照源文件哈希未变化时采用增量理解;发生变化、缺少文件或控制面冲突时,记录差异并进入 `partial`、`stale` 或 `blocked`。
22
-
23
- `contextStatus=context-ready` 只表示新对话已经可以可靠继续分析项目;不代表可以写入。写入仍必须通过增量同步、任务租约、七类宿主交互、任务控制面一致性、权限和用户确认门禁。新对话的 thread ID 只能作为 `host-thread` 引用,不能当作 `providerSessionId`。
24
-
25
- 完整规则见 `rules/v2.0.0-shared-project-conversations.md`。
26
-
27
- ## 初始化授权
28
-
29
- 用户发送一句话入口后,视为已授权宿主 AI 根据当前项目事实创建或补齐最小 `xinyun-ai/` 和极简 `AGENTS.md`。该授权只覆盖 AI 控制面,不包含业务代码、配置、数据库、依赖、构建脚本、测试逻辑、API、UI、业务流程、Git 写入或 npm 发布。
30
-
31
- ## 首次读取
32
-
33
- 1. `version.json`
34
- 2. `rules/v2.0.0-shared-project-conversations.md`
35
- 3. `templates/AGENTS.template.md`
36
- 4. `templates/core-rules.template.md`
37
- 5. `templates/manifest.template.json`
38
- 6. `templates/project-index.template.json`
39
- 7. `templates/task-index.template.json`
40
- 8. `templates/task-graph.template.json`
41
- 9. `templates/session-binding.template.json`
42
- 10. `templates/skills-registry.template.json`
43
-
44
- 先识别项目根、工作区、仓库范围和现有 AI 沉淀,再判断是全新初始化还是 v1 项目升级。
45
-
46
- ## 新项目最小控制面
47
-
48
- 根据目标项目事实创建:
5
+ ## 快速接入
49
6
 
50
7
  ```text
51
- AGENTS.md
52
- xinyun-ai/
53
- README.md
54
- manifest.json
55
- project-identity.json
56
- project-context.json
57
- project-status.json
58
- preflight-report.json
59
- onboarding-report.json
60
- current-task.md
61
- init-result.json
62
- takeover-gate.json
63
- rules/core-rules.md
64
- index/project-index.json
65
- index/control-plane-index.json
66
- conversations/registry.json
67
- conversations/bindings/
68
- tasks/task-index.json
69
- tasks/task-graph.json
70
- tasks/.transactions/
71
- tasks/.idempotency/
72
- skills/registry.json
73
- skills/assignments.json
74
- skills/routes/
75
- skills/usage-records/
76
- coordination/project-facts.json
77
- coordination/change-ledger.json
78
- coordination/conflict-records/
79
- coordination/streams/
80
- coordination/cursors/
81
- coordination/sync-checks/
82
- coordination/leases/
83
- handoffs/
84
- migrations/shared-project-conversations/
8
+ npx --yes @pm_zhousl/xinyun-ai-init@latest --force --offline
85
9
  ```
86
10
 
87
- 不得从 npm 研发主项目复制任务、会话、历史或项目事实。所有值都必须从当前目标项目重新发现和验证。
88
-
89
- ## 任务先登记
90
-
91
- 普通咨询默认不创建正式任务。出现以下任一条件时必须先登记任务:
92
-
93
- - 需要持续跟踪或后续恢复。
94
- - 需要修改任何文件。
95
- - 需要用户确认或独立授权。
96
- - 需要跨阶段执行多个 Skills。
97
- - 需要记录依赖、阻塞、交接或交付证据。
11
+ CLI 只管理当前项目的 `xinyun-ai-init/`,不修改业务代码。初始化完成后,宿主 AI 读取本文件和 `rules/v3-skill-runtime.md`,再调用:
98
12
 
99
- 正式任务必须在一个事务中准备、校验并原子更新:
100
-
101
- 1. `xinyun-ai/tasks/<taskId>.md`
102
- 2. `xinyun-ai/tasks/task-index.json`
103
- 3. `xinyun-ai/tasks/task-graph.json`
104
- 4. `xinyun-ai/current-task.md`
105
-
106
- 四份状态不一致时进入 `blocked`,不得选择 Skill 或修改业务文件。重复请求按项目身份、请求指纹、父任务和任务类型生成幂等键并复用原任务。
107
-
108
- ## Skill 路由
109
-
110
- Skill 只按任务类型、技术栈、端、语言、运行时、平台、框架、风险、依赖、权限和项目显式绑定选择。不得使用固定角色身份参与路由。
111
-
112
- 一个任务可以选择多个 Skills。每个执行阶段创建独立 `skillRunId`,写入 `xinyun-ai/skills/usage-records/`,并在任务节点登记执行顺序、输入/输出证据、工具、降级原因和未验证范围。
113
-
114
- 缺少 Skill、依赖、权限或可信来源时只能 fallback、blocked 或 manual-required;不自动安装,不伪造完成。
115
-
116
- ## 项目上下文与对话绑定
117
-
118
- `projectContextId` 是项目共享上下文标识;每个宿主对话登记独立 `conversationBindingId` 和 `sessionRefType/sessionRef`。普通线程 ID 只能作为 `host-thread` 引用,不能当作 `providerSessionId`。
119
-
120
- ready 前必须取得并核验以下七类证据:
121
-
122
- 1. create-or-reuse
123
- 2. send
124
- 3. receive
125
- 4. query-status
126
- 5. recover
127
- 6. close
128
- 7. control-file-read-write
129
-
130
- 同时必须证明对话属于当前项目根、工作区、仓库范围和 cwd。跨对话共享还必须验证事件写入、head 比较、增量消费、游标恢复和冲突阻断。证据缺失、冲突或不可验证时保持 `partial`、`blocked` 或 `manual-required`。
131
-
132
- ## 修改和发布授权
133
-
134
- 代码、配置、数据库、依赖、构建脚本、测试逻辑、API、UI 或业务流程修改前,必须先输出改动计划并等待用户明确确认。
13
+ ```text
14
+ node xinyun-ai-init/runtime/route-skill.js --facts <task-facts.json>
15
+ ```
135
16
 
136
- 数据库连接/SQL、Git 写入和 npm 发布分别使用独立授权。任务创建、Skill 选择、测试通过或开发确认都不能推导 npm 发布授权。
17
+ 路由器返回稳定的 Skill 顺序、输入事实、权限门禁和未满足条件。实际工具调用仍由宿主 AI 在确认门禁后完成。
137
18
 
138
- ## v1 项目升级
19
+ ## 内置 Skills
139
20
 
140
- 目标项目存在 `team/`、`role-execution/`、角色会话绑定或角色 Skill 分配时:
21
+ `skills/registry.json` 内置以下 Skills:项目接管、需求分析、技术设计、实现、验证、安全审查、发布审查和交接同步。每个 Skill 都有触发条件、输入、输出、权限、工具和证据格式。
141
22
 
142
- 1. 使用 `multi-conversation-migration.template.json` 创建迁移事务和 before hash。
143
- 2. 建立旧材料清单,不删除或覆盖旧文件。
144
- 3. 将活动角色任务转换为普通任务节点,保留原任务 ID、状态、依赖、证据和时间。
145
- 4. 原角色只写入 `legacyRoleId`,不得参与新路由。
146
- 5. 旧角色材料登记为 `legacy/read-only`。
147
- 6. 无法可靠转换时进入 `manual-required`,不得猜测。
148
- 7. 校验任务文件、索引、图、项目上下文、对话注册表和 Skill 记录后写 after hash 并提交。
23
+ ## 运行规则
149
24
 
150
- 重复升级必须复用同一迁移事务。中断时按事务阶段恢复;发现新任务仍写入角色目录时必须阻断。
25
+ 1. 每次用户交互先读取目标项目自己的 `xinyun-ai/` 控制面。
26
+ 2. 正式任务先登记,再调用路由器。
27
+ 3. 路由只使用任务事实、技术栈、框架、风险、依赖和权限,不使用角色字段。
28
+ 4. 修改前必须输出计划并等待用户确认。
29
+ 5. Skill 运行、验证和交付结果写回目标项目自己的 `xinyun-ai/`。
30
+ 6. 没有新事件时静默继续;有新事件时只读取增量事件和受影响事实。
151
31
 
152
- v1.5-v1.16 的版本化规则、旧角色模板和历史行为证据仍随包保留,只用于迁移识别和兼容验证,不适用于新安装或新任务。
32
+ ## v2 或更早项目升级
153
33
 
154
- ## CodeGraph
34
+ 升级时由宿主 AI 先执行:
155
35
 
156
- 结构性问题优先使用目标项目已有的健康 CodeGraph。缺少 `.codegraph/` 且命令可用时,可按项目入口授权执行一次 `codegraph init -i`;不得自动安装工具或修改业务环境。状态未知或失败时记录未验证范围并按任务风险降级或阻断。
36
+ ```text
37
+ node xinyun-ai-init/runtime/migrate-v3.js --project-root <project-root>
38
+ ```
157
39
 
158
- ## 完成条件
40
+ 脚本默认只生成合并和清理预览。确认后加 `--apply`,仅处理已知的角色、team、旧会话和重复兼容目录;项目事实、任务结果和必要证据先合并为 v3 摘要。旧运行逻辑不会继续参与新路由。
159
41
 
160
- 初始化或升级只有在项目身份、共享项目上下文、至少一个有效对话绑定、增量同步、七类宿主证据、任务控制面一致性、Skill 注册、必要 CodeGraph 检查、敏感扫描、写回和恢复证据满足时才能标记 `ready`。
42
+ ## npm 发布
161
43
 
162
- 交付必须说明:当前模式、实际创建/更新文件、项目概览、项目上下文、活动对话和同步状态、任务和 Skill 记录、CodeGraph、授权状态、旧材料迁移、测试结果、阻塞、未验证范围和下一动作。
44
+ 维护者发布固定使用 `npm run publish:token`,只在安全提示中输入一次 token,不要求 `npm login`、环境变量或第二会话验证。npm 发布仍需目标版本的单独授权。
@@ -0,0 +1,45 @@
1
+ # v3 Skill Runtime 规则
2
+
3
+ ## 核心模型
4
+
5
+ - 一个项目维护一个共享 `projectContextId`,对话使用独立 `conversationBindingId`。
6
+ - Skill 是可调用能力包,不是角色。任何 `roleId`、角色名称或角色优先级都不得参与路由。
7
+ - npm 包只提供 Skill 契约、路由器、模板和验证器;宿主 AI 负责实际工具调用。
8
+ - 旧角色、team、角色会话和 v1 运行规则已经从 v3 运行模型移除。
9
+
10
+ ## 调用顺序
11
+
12
+ 1. 检查项目根目录和当前 `xinyun-ai/` 控制面。
13
+ 2. 执行交互增量同步,比较活动流 head 与当前游标。
14
+ 3. 需要持续跟踪或执行时,先登记任务。
15
+ 4. 将任务事实写入临时 facts 文件并调用 `runtime/route-skill.js`。
16
+ 5. 检查路由返回的权限、依赖、冲突和确认门禁。
17
+ 6. 计划经用户确认后,按返回顺序调用 Skill。
18
+ 7. 每次 Skill 运行记录 `skillRunId`、输入、输出、工具、证据和未验证范围。
19
+ 8. 验证后写回任务、项目事实、事件流和交付记录。
20
+
21
+ ## 路由规则
22
+
23
+ - 路由输入:任务类型、端、语言、运行时、平台、框架、风险、依赖和权限。
24
+ - 选择顺序由 registry 中的稳定 `order` 决定,不依赖目录扫描顺序。
25
+ - 依赖或权限不足时返回 `blocked`;事实不足时返回 `fallback`。
26
+ - 测试在当前对话执行时标记为 `self-check`,不能伪造独立审查。
27
+
28
+ ## 快速路径
29
+
30
+ - 默认只读取项目身份、当前任务、控制面索引、项目上下文、任务图和核心规则。
31
+ - 不执行 CodeGraph、全量业务扫描、数据库连接、Git 写入、依赖安装或 npm 发布。
32
+ - 框架、迁移和专项材料只有在路由结果明确需要时才加载。
33
+
34
+ ## 升级清理
35
+
36
+ - v3 升级先生成合并摘要和清理预览。
37
+ - 只有 `--apply` 且清单哈希未变化时才删除已知旧目录。
38
+ - 只合并项目身份、任务、决策、验证和未完成事项;不把旧角色字段带入活动 Skill 路由。
39
+ - 清理失败、哈希冲突或无法识别的文件保持 `blocked`,不得强制删除。
40
+
41
+ ## 安全和授权
42
+
43
+ - 不记录 token、密码、私钥、连接串或未经脱敏的项目内容。
44
+ - 业务文件、配置、数据库、API、UI、依赖和构建流程修改必须先确认。
45
+ - npm 发布必须由用户针对目标版本单独授权。
@@ -0,0 +1,115 @@
1
+ #!/usr/bin/env node
2
+
3
+ const fs = require("fs");
4
+ const crypto = require("crypto");
5
+ const path = require("path");
6
+
7
+ const args = new Set(process.argv.slice(2));
8
+ const rootIndex = process.argv.indexOf("--project-root");
9
+ const projectRoot = rootIndex >= 0 ? path.resolve(process.argv[rootIndex + 1]) : process.cwd();
10
+ const apply = args.has("--apply");
11
+ const controlRoot = path.join(projectRoot, "xinyun-ai");
12
+ const migrationRoot = path.join(controlRoot, "migrations", "v3-skill-runtime");
13
+ const knownLegacy = [
14
+ "team",
15
+ path.join("tasks", "role-execution"),
16
+ path.join("sessions", "roles"),
17
+ "sessions/provider-session-bindings.json"
18
+ ];
19
+
20
+ function hash(value) {
21
+ return crypto.createHash("sha256").update(value).digest("hex");
22
+ }
23
+
24
+ function inventoryPath(relative) {
25
+ const normalized = relative.replace(/\\/g, "/");
26
+ const full = path.join(controlRoot, normalized);
27
+ if (!fs.existsSync(full)) return { relative: normalized, exists: false, files: [] };
28
+ const stat = fs.statSync(full);
29
+ if (stat.isFile()) return { relative: normalized, exists: true, files: [normalized] };
30
+ const files = [];
31
+ function walk(dir) {
32
+ for (const entry of fs.readdirSync(dir, { withFileTypes: true })) {
33
+ const fullEntry = path.join(dir, entry.name);
34
+ const rel = path.relative(controlRoot, fullEntry).replace(/\\/g, "/");
35
+ if (entry.isDirectory()) walk(fullEntry);
36
+ else files.push(rel);
37
+ }
38
+ }
39
+ walk(full);
40
+ return { relative: normalized, exists: true, files };
41
+ }
42
+
43
+ function redact(value) {
44
+ if (typeof value === "string") {
45
+ return value
46
+ .replace(/(token|password|secret|authorization|privateKey)\s*[:=]\s*[^\s,}]+/gi, "$1=[REDACTED]")
47
+ .replace(/Bearer\s+[A-Za-z0-9._-]+/gi, "Bearer [REDACTED]");
48
+ }
49
+ if (Array.isArray(value)) return value.map(redact);
50
+ if (value && typeof value === "object") return Object.fromEntries(Object.entries(value).map(([key, item]) => [key, redact(item)]));
51
+ return value;
52
+ }
53
+
54
+ function collectFacts() {
55
+ const relativePaths = [
56
+ "project-identity.json",
57
+ "project-context.json",
58
+ "current-task.md",
59
+ "tasks/task-index.json",
60
+ "tasks/task-graph.json",
61
+ "coordination/project-facts.json",
62
+ "coordination/change-ledger.json"
63
+ ];
64
+ const facts = {};
65
+ for (const relative of relativePaths) {
66
+ const full = path.join(controlRoot, relative);
67
+ if (!fs.existsSync(full)) continue;
68
+ const text = fs.readFileSync(full, "utf8");
69
+ try {
70
+ facts[relative] = redact(JSON.parse(text));
71
+ } catch (error) {
72
+ facts[relative] = redact(text);
73
+ }
74
+ }
75
+ return facts;
76
+ }
77
+
78
+ const legacyInventory = knownLegacy.map(inventoryPath);
79
+ const summary = {
80
+ schemaVersion: 1,
81
+ migrationVersion: "3.0.0",
82
+ mode: apply ? "apply" : "preview",
83
+ projectRootHash: hash(path.resolve(projectRoot)),
84
+ legacyInventory,
85
+ mergeSources: ["project-identity.json", "project-context.json", "current-task.md", "tasks/", "coordination/"],
86
+ mergeTarget: "xinyun-ai/migrations/v3-skill-runtime/merged-facts.json",
87
+ deleteTargets: legacyInventory.filter((item) => item.exists).map((item) => item.relative),
88
+ status: "preview",
89
+ generatedAt: new Date().toISOString()
90
+ };
91
+
92
+ if (!fs.existsSync(controlRoot)) {
93
+ summary.status = "blocked";
94
+ summary.blockedReason = "missing-xinyun-ai-control-plane";
95
+ } else if (apply) {
96
+ fs.mkdirSync(migrationRoot, { recursive: true });
97
+ const mergedFacts = {
98
+ schemaVersion: 1,
99
+ sourcePaths: summary.mergeSources,
100
+ facts: collectFacts(),
101
+ preservedAsFacts: true,
102
+ legacyRuntimeRemoved: true,
103
+ generatedAt: summary.generatedAt
104
+ };
105
+ fs.writeFileSync(path.join(migrationRoot, "merged-facts.json"), `${JSON.stringify(mergedFacts, null, 2)}\n`, "utf8");
106
+ for (const item of legacyInventory.filter((entry) => entry.exists)) {
107
+ fs.rmSync(path.join(controlRoot, item.relative), { recursive: true, force: true });
108
+ }
109
+ summary.status = "applied";
110
+ }
111
+
112
+ fs.mkdirSync(migrationRoot, { recursive: true });
113
+ fs.writeFileSync(path.join(migrationRoot, "migration-summary.json"), `${JSON.stringify(summary, null, 2)}\n`, "utf8");
114
+ process.stdout.write(`${JSON.stringify(summary, null, 2)}\n`);
115
+ if (summary.status === "blocked") process.exitCode = 1;
@@ -0,0 +1,69 @@
1
+ #!/usr/bin/env node
2
+
3
+ const fs = require("fs");
4
+ const crypto = require("crypto");
5
+ const path = require("path");
6
+
7
+ const runtimeRoot = path.resolve(__dirname, "..");
8
+ const registry = JSON.parse(fs.readFileSync(path.join(runtimeRoot, "skills", "registry.json"), "utf8"));
9
+ const args = process.argv.slice(2);
10
+ const factsIndex = args.indexOf("--facts");
11
+ const factsPath = factsIndex >= 0 ? args[factsIndex + 1] : null;
12
+ const facts = factsPath ? JSON.parse(fs.readFileSync(path.resolve(process.cwd(), factsPath), "utf8")) : {};
13
+
14
+ const taskType = facts.taskType || "unknown";
15
+ const riskTerms = new Set((facts.riskTerms || []).map((item) => String(item).toLowerCase()));
16
+ const permissions = new Set(facts.permissionScope || []);
17
+ const requiresConversationSync = Boolean(facts.requiresConversationSync);
18
+ const taskFacts = { ...facts, taskType, riskTerms: [...riskTerms] };
19
+
20
+ function triggerMatches(skill) {
21
+ const trigger = skill.triggers || {};
22
+ if (trigger.taskTypes && !trigger.taskTypes.includes(taskType)) return false;
23
+ if (trigger.riskTerms && !trigger.riskTerms.some((term) => riskTerms.has(term))) return false;
24
+ if (trigger.requiresPermission && !permissions.has(trigger.requiresPermission)) return false;
25
+ if (trigger.requiresConversationSync && !requiresConversationSync) return false;
26
+ return true;
27
+ }
28
+
29
+ function blockedReason(skill) {
30
+ const required = skill.permissions || [];
31
+ const missing = required.filter((permission) => !permissions.has(permission) && permission !== "control-plane-read");
32
+ return missing.length ? `missing-permission:${missing.join(",")}` : null;
33
+ }
34
+
35
+ const ordered = [...registry.skills].sort((left, right) => left.order - right.order || left.skillId.localeCompare(right.skillId));
36
+ const selected = [];
37
+ const rejected = [];
38
+ const blocked = [];
39
+ for (const skill of ordered) {
40
+ if (!triggerMatches(skill)) continue;
41
+ const reason = blockedReason(skill);
42
+ if (reason) {
43
+ blocked.push({ skillId: skill.skillId, reason });
44
+ continue;
45
+ }
46
+ selected.push({ skillId: skill.skillId, name: skill.name, order: skill.order, permissions: skill.permissions, tools: skill.tools, input: skill.input, output: skill.output, evidence: skill.evidence });
47
+ }
48
+
49
+ if (selected.length === 0) {
50
+ rejected.push({ reason: "no-matching-skill", taskType });
51
+ }
52
+
53
+ const route = {
54
+ schemaVersion: 3,
55
+ routeId: `route-${Date.now()}`,
56
+ taskFacts,
57
+ routeFingerprint: crypto.createHash("sha256").update(JSON.stringify({ taskFacts, registryVersion: registry.registryVersion })).digest("hex"),
58
+ candidateSkills: ordered.map((skill) => skill.skillId),
59
+ selected,
60
+ rejected,
61
+ fallback: selected.length ? [] : [{ skillId: "manual-required", reason: "no-matching-skill" }],
62
+ blocked,
63
+ selectionOrder: "stable-order-then-skill-id",
64
+ status: blocked.length && !selected.length ? "blocked" : selected.length ? "selected" : "fallback",
65
+ registryVersion: registry.registryVersion,
66
+ generatedAt: new Date().toISOString()
67
+ };
68
+
69
+ process.stdout.write(`${JSON.stringify(route, null, 2)}\n`);
@@ -0,0 +1,26 @@
1
+ {
2
+ "schemaVersion": 1,
3
+ "runtimeVersion": "3.0.0",
4
+ "files": [
5
+ "README.md",
6
+ "version.json",
7
+ "rules/v3-skill-runtime.md",
8
+ "runtime/route-skill.js",
9
+ "runtime/migrate-v3.js",
10
+ "skills/registry.json",
11
+ "templates/AGENTS.template.md",
12
+ "templates/README.template.md",
13
+ "templates/core-rules.template.md",
14
+ "templates/manifest.template.json",
15
+ "templates/project-index.template.json",
16
+ "templates/project-context.template.json",
17
+ "templates/control-plane-index.template.json",
18
+ "templates/current-task.template.md",
19
+ "templates/task-index.template.json",
20
+ "templates/task-graph.template.json",
21
+ "templates/skills-registry.template.json",
22
+ "templates/skills-assignments.template.json",
23
+ "templates/skill-runtime-route.template.json",
24
+ "templates/skill-run-record.template.json"
25
+ ]
26
+ }
@@ -0,0 +1,112 @@
1
+ {
2
+ "schemaVersion": 3,
3
+ "executionModel": "bundled-skill-runtime",
4
+ "registryVersion": "3.0.0",
5
+ "selectionOrder": "stable-order-then-skill-id",
6
+ "skills": [
7
+ {
8
+ "skillId": "project-intake",
9
+ "name": "项目接管",
10
+ "order": 10,
11
+ "supportedTaskTypes": ["workspace-initialization", "project-takeover"],
12
+ "stacks": ["any"],
13
+ "triggers": {"taskTypes": ["workspace-initialization", "project-takeover"]},
14
+ "permissions": ["control-plane-read", "control-plane-write"],
15
+ "tools": ["filesystem-read", "filesystem-write"],
16
+ "input": ["projectRoot", "controlPlane"],
17
+ "output": ["projectIdentity", "projectContext", "takeoverEvidence"],
18
+ "evidence": ["sourceHashes", "controlPlaneChecks", "sensitiveScan"]
19
+ },
20
+ {
21
+ "skillId": "task-analysis",
22
+ "name": "需求分析",
23
+ "order": 20,
24
+ "supportedTaskTypes": ["requirement", "feature", "bugfix", "refactor", "product-major-version-development"],
25
+ "stacks": ["any"],
26
+ "triggers": {"taskTypes": ["requirement", "feature", "bugfix", "refactor", "product-major-version-development"]},
27
+ "permissions": ["control-plane-read"],
28
+ "tools": ["filesystem-read"],
29
+ "input": ["userRequest", "projectFacts"],
30
+ "output": ["requirements", "acceptanceCriteria", "openQuestions"],
31
+ "evidence": ["requirementsDocument", "scopeBoundary"]
32
+ },
33
+ {
34
+ "skillId": "technical-design",
35
+ "name": "技术设计",
36
+ "order": 30,
37
+ "supportedTaskTypes": ["feature", "bugfix", "refactor", "architecture", "product-major-version-development"],
38
+ "stacks": ["any"],
39
+ "triggers": {"taskTypes": ["feature", "bugfix", "refactor", "architecture", "product-major-version-development"]},
40
+ "permissions": ["control-plane-read"],
41
+ "tools": ["filesystem-read", "code-search"],
42
+ "input": ["requirements", "technicalLandscape"],
43
+ "output": ["changePlan", "impactScope", "riskRegister"],
44
+ "evidence": ["plannedFiles", "verificationPlan"]
45
+ },
46
+ {
47
+ "skillId": "implementation",
48
+ "name": "实现",
49
+ "order": 40,
50
+ "supportedTaskTypes": ["feature", "bugfix", "refactor", "implementation", "product-major-version-development"],
51
+ "stacks": ["any"],
52
+ "triggers": {"taskTypes": ["feature", "bugfix", "refactor", "implementation", "product-major-version-development"], "requiresPermission": "business-code-write"},
53
+ "permissions": ["business-code-write", "control-plane-write"],
54
+ "tools": ["filesystem-read", "filesystem-write", "shell-read"],
55
+ "input": ["confirmedPlan", "baselineHashes"],
56
+ "output": ["changedFiles", "implementationResult"],
57
+ "evidence": ["beforeAfterHashes", "changeLedger"]
58
+ },
59
+ {
60
+ "skillId": "verification",
61
+ "name": "验证",
62
+ "order": 50,
63
+ "supportedTaskTypes": ["verification", "feature", "bugfix", "refactor", "product-major-version-development"],
64
+ "stacks": ["any"],
65
+ "triggers": {"taskTypes": ["verification", "feature", "bugfix", "refactor", "product-major-version-development"]},
66
+ "permissions": ["control-plane-read", "shell-read"],
67
+ "tools": ["filesystem-read", "shell-read"],
68
+ "input": ["changedFiles", "verificationPlan"],
69
+ "output": ["testResults", "unverifiedScope"],
70
+ "evidence": ["commandResults", "sensitiveScan"]
71
+ },
72
+ {
73
+ "skillId": "security-review",
74
+ "name": "安全审查",
75
+ "order": 60,
76
+ "supportedTaskTypes": ["security", "release", "product-major-version-development"],
77
+ "stacks": ["any"],
78
+ "triggers": {"riskTerms": ["security", "token", "credential", "permission", "publish"]},
79
+ "permissions": ["control-plane-read", "shell-read"],
80
+ "tools": ["filesystem-read", "shell-read"],
81
+ "input": ["changedFiles", "releaseArtifacts"],
82
+ "output": ["securityFindings", "sensitiveScan"],
83
+ "evidence": ["negativeChecks", "redactionScan"]
84
+ },
85
+ {
86
+ "skillId": "release-review",
87
+ "name": "发布审查",
88
+ "order": 70,
89
+ "supportedTaskTypes": ["release", "publish"],
90
+ "stacks": ["npm"],
91
+ "triggers": {"taskTypes": ["release", "publish"]},
92
+ "permissions": ["release-review", "control-plane-read"],
93
+ "tools": ["filesystem-read", "shell-read"],
94
+ "input": ["packageVersion", "releaseEvidence"],
95
+ "output": ["releaseDecision", "releaseChecklist"],
96
+ "evidence": ["packageBoundary", "authorizationRecord"]
97
+ },
98
+ {
99
+ "skillId": "handoff-sync",
100
+ "name": "交接同步",
101
+ "order": 80,
102
+ "supportedTaskTypes": ["handoff", "sync", "project-takeover"],
103
+ "stacks": ["any"],
104
+ "triggers": {"taskTypes": ["handoff", "sync", "project-takeover"], "requiresConversationSync": true},
105
+ "permissions": ["control-plane-read", "control-plane-write"],
106
+ "tools": ["filesystem-read", "filesystem-write"],
107
+ "input": ["conversationRegistry", "streamHeads", "cursor"],
108
+ "output": ["syncResult", "handoffRecord"],
109
+ "evidence": ["headCursorComparison", "eventHashes"]
110
+ }
111
+ ]
112
+ }
@@ -1,30 +1,7 @@
1
- # AGENTS.md
1
+ # AI 项目入口
2
2
 
3
- 本项目使用 `xinyun-ai/` 管理 AI 协作规则和运行状态。
3
+ 当前项目使用 `xinyun-ai/` 管理事实、任务、对话同步和 Skill 运行记录。
4
4
 
5
- AI 接手时先读取:
5
+ 接手顺序:读取 `xinyun-ai/README.md`、`manifest.json`、`current-task.md`、`rules/core-rules.md`、`index/control-plane-index.json`、`project-context.json`、`conversations/registry.json`,再调用 `xinyun-ai-init/runtime/route-skill.js`。
6
6
 
7
- - `xinyun-ai/README.md`
8
- - `xinyun-ai/manifest.json`
9
- - `xinyun-ai/current-task.md`
10
- - `xinyun-ai/rules/core-rules.md`
11
- - `xinyun-ai/index/project-index.json`
12
- - `xinyun-ai/index/control-plane-index.json`
13
- - `xinyun-ai/index/bootstrap-snapshot.json`
14
- - `xinyun-ai/index/re-takeover-record.json`
15
- - `xinyun-ai/tasks/task-index.json`
16
- - `xinyun-ai/tasks/task-graph.json`
17
- - `xinyun-ai/project-context.json`
18
- - `xinyun-ai/conversations/registry.json`
19
-
20
- 每次创建新对话时,先执行“重新接管同一个项目”流程:确认项目根目录、读取上述控制面文件、核对项目身份和快照哈希、读取最近交接,并输出已确认、推断、未发现和待验证范围。新对话不继承历史聊天事实,也不得把当前对话的 thread ID 当作 `providerSessionId`。
21
-
22
- 理解项目和执行任务是两个门禁:`contextStatus=context-ready` 只表示可以继续分析;只有增量同步、任务租约、任务控制面、权限和宿主证据全部通过,才允许写入。快照未变化时使用增量接管,快照过期或控制面冲突时先进入 `partial` 或 `blocked`。
23
-
24
- 当前执行模型为 `shared-project-multi-conversation-runtime`:每个项目一个共享上下文,允许一个或多个对话接入。每次收到用户消息先检查各对话流 head;只有发现新增事件才增量读取并刷新相关事实。没有变化时静默继续。
25
-
26
- 每个对话只能写自己的事件流。修改前必须重新同步、取得任务租约并核对基线哈希;冲突时阻断,不静默覆盖。thread ID 只作为 `host-thread` 引用,不能当作 `providerSessionId`。
27
-
28
- 正式任务必须先写入项目本地 `xinyun-ai/`。任何代码、配置、数据库、依赖、构建、测试、API、UI 或业务流程修改前,先输出改动计划并等待用户确认。数据库、Git 写入和发布授权分别确认。
29
-
30
- 旧角色、角色任务和角色会话材料只作为 `legacy/read-only` 历史;不得删除,也不得继续参与新任务路由和 ready 判断。
7
+ Skill 按任务事实调用,不创建固定角色或角色会话。修改代码、配置、数据库、依赖、API、UI 或业务流程前,必须先输出计划并等待用户确认。npm 发布必须单独授权。
@@ -1,35 +1,7 @@
1
1
  # xinyun-ai 工作区
2
2
 
3
- 本目录是当前目标项目的 AI 控制面。当前执行模型为 `shared-project-multi-conversation-runtime`。
3
+ 当前模型为 `bundled-skill-runtime`。项目只维护一个共享上下文,Skills 由 `xinyun-ai-init/skills/registry.json` 和路由器决定。
4
4
 
5
- ## 工作方式
5
+ 新对话先读取控制面,再比较事件流 head 和游标。无变化时静默继续,有变化时只读取增量事件。动态事实写入目标项目自己的 `xinyun-ai/`。
6
6
 
7
- 1. 一个项目维护一个共享上下文,允许一个或多个对话接入。
8
- 2. 普通咨询可直接回答;正式工作先登记任务。
9
- 3. 每次交互先做轻量增量同步,再按任务事实执行 Skills。
10
- 4. 涉及修改时先出计划并等待确认。
11
- 5. 任务结束后写回实际改动、影响、证据、测试和下一动作。
12
-
13
- ## 入口
14
-
15
- - 规则:`xinyun-ai/rules/core-rules.md`
16
- - 新对话接管顺序:`xinyun-ai/index/control-plane-index.json`
17
- - 项目快照:`xinyun-ai/index/bootstrap-snapshot.json`
18
- - 重新接管记录:`xinyun-ai/index/re-takeover-record.json`
19
- - 当前任务:`xinyun-ai/current-task.md`
20
- - 项目索引:`xinyun-ai/index/project-index.json`
21
- - 任务索引:`xinyun-ai/tasks/task-index.json`
22
- - 任务图:`xinyun-ai/tasks/task-graph.json`
23
- - 项目上下文:`xinyun-ai/project-context.json`
24
- - 对话注册表:`xinyun-ai/conversations/registry.json`
25
- - 增量事件流:`xinyun-ai/coordination/streams/`
26
- - 同步游标:`xinyun-ai/coordination/cursors/`
27
- - Skill 注册:`xinyun-ai/skills/registry.json`
28
-
29
- ## 新对话重新接管
30
-
31
- 每次新对话进入项目时,先确认项目根目录,读取控制面顺序中的文件,核对项目身份、当前任务、项目快照和最近接管记录,再注册或复用自己的对话绑定。`contextStatus=context-ready` 只表示可以继续分析;写入还必须通过增量同步、任务租约、宿主交互、权限和用户确认门禁。
32
-
33
- 新对话的 thread ID 只能作为 `host-thread` 候选,不能当作 `providerSessionId`。接管结果写回目标项目自己的 `xinyun-ai/`,不依赖上一段聊天上下文。
34
-
35
- 旧版本角色材料位于原目录或迁移清单中,只读保留,不参与当前运行。
7
+ 路由命令:`node xinyun-ai-init/runtime/route-skill.js --facts <task-facts.json>`。