semantic-atlas 0.4.0 → 1.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 (346) hide show
  1. package/.agents/skills/semantic-atlas/SKILL.md +134 -166
  2. package/.agents/skills/semantic-atlas/agents/openai.yaml +4 -0
  3. package/.agents/skills/semantic-atlas/references/observations.md +131 -0
  4. package/.agents/skills/semantic-atlas/scripts/query-context.mjs +110 -0
  5. package/.agents/skills/semantic-atlas-maintenance/SKILL.md +93 -0
  6. package/.agents/skills/semantic-atlas-maintenance/agents/openai.yaml +4 -0
  7. package/.agents/skills/semantic-atlas-maintenance/references/reconciliation.md +56 -0
  8. package/README.md +134 -265
  9. package/dist/application/map-application.d.ts +24 -0
  10. package/dist/application/map-application.d.ts.map +1 -0
  11. package/dist/application/map-application.js +134 -0
  12. package/dist/application/map-application.js.map +1 -0
  13. package/dist/cli/bin.js +6 -42
  14. package/dist/cli/bin.js.map +1 -0
  15. package/dist/cli/observation-commands.d.ts +16 -0
  16. package/dist/cli/observation-commands.d.ts.map +1 -0
  17. package/dist/cli/observation-commands.js +118 -0
  18. package/dist/cli/observation-commands.js.map +1 -0
  19. package/dist/cli/projection-writer.d.ts +2 -0
  20. package/dist/cli/projection-writer.d.ts.map +1 -0
  21. package/dist/cli/projection-writer.js +9 -0
  22. package/dist/cli/projection-writer.js.map +1 -0
  23. package/dist/cli/reconciliation-command.d.ts +7 -0
  24. package/dist/cli/reconciliation-command.d.ts.map +1 -0
  25. package/dist/cli/reconciliation-command.js +33 -0
  26. package/dist/cli/reconciliation-command.js.map +1 -0
  27. package/dist/cli/run-cli.d.ts +21 -0
  28. package/dist/cli/run-cli.d.ts.map +1 -0
  29. package/dist/cli/run-cli.js +299 -0
  30. package/dist/cli/run-cli.js.map +1 -0
  31. package/dist/contracts/cli.d.ts +166 -1211
  32. package/dist/contracts/cli.d.ts.map +1 -1
  33. package/dist/contracts/cli.js +2 -232
  34. package/dist/contracts/cli.js.map +1 -0
  35. package/dist/contracts/insights.d.ts +39 -1
  36. package/dist/contracts/insights.d.ts.map +1 -1
  37. package/dist/contracts/insights.js +2 -1
  38. package/dist/contracts/insights.js.map +1 -0
  39. package/dist/contracts/map.d.ts +154 -0
  40. package/dist/contracts/map.d.ts.map +1 -0
  41. package/dist/contracts/map.js +60 -0
  42. package/dist/contracts/map.js.map +1 -0
  43. package/dist/contracts/observation.d.ts +649 -0
  44. package/dist/contracts/observation.d.ts.map +1 -0
  45. package/dist/contracts/observation.js +140 -0
  46. package/dist/contracts/observation.js.map +1 -0
  47. package/dist/contracts/projection.d.ts +7 -0
  48. package/dist/contracts/projection.d.ts.map +1 -0
  49. package/dist/contracts/projection.js +2 -0
  50. package/dist/contracts/projection.js.map +1 -0
  51. package/dist/contracts/reconciliation.d.ts +40 -0
  52. package/dist/contracts/reconciliation.d.ts.map +1 -0
  53. package/dist/contracts/reconciliation.js +2 -0
  54. package/dist/contracts/reconciliation.js.map +1 -0
  55. package/dist/index.d.ts +7 -17
  56. package/dist/index.d.ts.map +1 -1
  57. package/dist/index.js +3 -9
  58. package/dist/index.js.map +1 -0
  59. package/dist/insights/insight-service.d.ts +14 -0
  60. package/dist/insights/insight-service.d.ts.map +1 -0
  61. package/dist/insights/insight-service.js +129 -0
  62. package/dist/insights/insight-service.js.map +1 -0
  63. package/dist/map/business-graph.d.ts +32 -0
  64. package/dist/map/business-graph.d.ts.map +1 -0
  65. package/dist/map/business-graph.js +122 -0
  66. package/dist/map/business-graph.js.map +1 -0
  67. package/dist/map/map-document-loader.d.ts +13 -0
  68. package/dist/map/map-document-loader.d.ts.map +1 -0
  69. package/dist/map/map-document-loader.js +86 -0
  70. package/dist/map/map-document-loader.js.map +1 -0
  71. package/dist/map/map-validator.d.ts +12 -0
  72. package/dist/map/map-validator.d.ts.map +1 -0
  73. package/dist/map/map-validator.js +322 -0
  74. package/dist/map/map-validator.js.map +1 -0
  75. package/dist/observations/observation-application.d.ts +23 -0
  76. package/dist/observations/observation-application.d.ts.map +1 -0
  77. package/dist/observations/observation-application.js +62 -0
  78. package/dist/observations/observation-application.js.map +1 -0
  79. package/dist/observations/observation-claim-manager.d.ts +13 -0
  80. package/dist/observations/observation-claim-manager.d.ts.map +1 -0
  81. package/dist/observations/observation-claim-manager.js +247 -0
  82. package/dist/observations/observation-claim-manager.js.map +1 -0
  83. package/dist/observations/observation-store.d.ts +43 -0
  84. package/dist/observations/observation-store.d.ts.map +1 -0
  85. package/dist/observations/observation-store.js +208 -0
  86. package/dist/observations/observation-store.js.map +1 -0
  87. package/dist/observations/repository-identity.d.ts +12 -0
  88. package/dist/observations/repository-identity.d.ts.map +1 -0
  89. package/dist/observations/repository-identity.js +108 -0
  90. package/dist/observations/repository-identity.js.map +1 -0
  91. package/dist/query/context-query-service.d.ts +15 -0
  92. package/dist/query/context-query-service.d.ts.map +1 -0
  93. package/dist/query/context-query-service.js +36 -0
  94. package/dist/query/context-query-service.js.map +1 -0
  95. package/dist/reconciliation/reconciliation-service.d.ts +10 -0
  96. package/dist/reconciliation/reconciliation-service.d.ts.map +1 -0
  97. package/dist/reconciliation/reconciliation-service.js +116 -0
  98. package/dist/reconciliation/reconciliation-service.js.map +1 -0
  99. package/dist/rendering/map-projector.d.ts +8 -0
  100. package/dist/rendering/map-projector.d.ts.map +1 -0
  101. package/dist/rendering/map-projector.js +386 -0
  102. package/dist/rendering/map-projector.js.map +1 -0
  103. package/dist/setup/managed-skill-installer.d.ts +60 -0
  104. package/dist/setup/managed-skill-installer.d.ts.map +1 -0
  105. package/dist/setup/managed-skill-installer.js +307 -0
  106. package/dist/setup/managed-skill-installer.js.map +1 -0
  107. package/dist/setup/package-identity.d.ts +6 -0
  108. package/dist/setup/package-identity.d.ts.map +1 -0
  109. package/dist/setup/package-identity.js +16 -0
  110. package/dist/setup/package-identity.js.map +1 -0
  111. package/dist/setup/package-upgrader.d.ts +10 -22
  112. package/dist/setup/package-upgrader.d.ts.map +1 -1
  113. package/dist/setup/package-upgrader.js +60 -76
  114. package/dist/setup/package-upgrader.js.map +1 -0
  115. package/docs/architecture.md +428 -0
  116. package/docs/evaluation.md +220 -174
  117. package/docs/index.md +27 -45
  118. package/docs/map-format.md +224 -0
  119. package/docs/observations.md +175 -0
  120. package/docs/product-contract.md +295 -165
  121. package/examples/commerce.yaml +204 -0
  122. package/package.json +32 -32
  123. package/.agents/skills/semantic-atlas/references/graph-patch.md +0 -190
  124. package/.agents/skills/semantic-atlas/references/product-feedback.md +0 -34
  125. package/.agents/skills/semantic-atlas/references/result-routing.md +0 -104
  126. package/.agents/skills/semantic-atlas/references/snapshot-bootstrap.md +0 -42
  127. package/.agents/skills/semantic-atlas-insights/SKILL.md +0 -55
  128. package/README.zh-CN.md +0 -296
  129. package/dist/business-flow/business-flow-derivation-service.d.ts +0 -11
  130. package/dist/business-flow/business-flow-derivation-service.d.ts.map +0 -1
  131. package/dist/business-flow/business-flow-derivation-service.js +0 -151
  132. package/dist/business-flow/business-flow-draft.d.ts +0 -16
  133. package/dist/business-flow/business-flow-draft.d.ts.map +0 -1
  134. package/dist/business-flow/business-flow-draft.js +0 -150
  135. package/dist/business-flow/framework-business-strategy.d.ts +0 -7
  136. package/dist/business-flow/framework-business-strategy.d.ts.map +0 -1
  137. package/dist/business-flow/framework-business-strategy.js +0 -1
  138. package/dist/business-flow/strategies/bullmq-business-strategy.d.ts +0 -10
  139. package/dist/business-flow/strategies/bullmq-business-strategy.d.ts.map +0 -1
  140. package/dist/business-flow/strategies/bullmq-business-strategy.js +0 -79
  141. package/dist/business-flow/strategies/called-operation-derivation.d.ts +0 -13
  142. package/dist/business-flow/strategies/called-operation-derivation.d.ts.map +0 -1
  143. package/dist/business-flow/strategies/called-operation-derivation.js +0 -32
  144. package/dist/business-flow/strategies/graphql-business-strategy.d.ts +0 -8
  145. package/dist/business-flow/strategies/graphql-business-strategy.d.ts.map +0 -1
  146. package/dist/business-flow/strategies/graphql-business-strategy.js +0 -65
  147. package/dist/business-flow/strategies/nestjs-business-strategy.d.ts +0 -8
  148. package/dist/business-flow/strategies/nestjs-business-strategy.d.ts.map +0 -1
  149. package/dist/business-flow/strategies/nestjs-business-strategy.js +0 -72
  150. package/dist/business-flow/strategies/strategy-helpers.d.ts +0 -32
  151. package/dist/business-flow/strategies/strategy-helpers.d.ts.map +0 -1
  152. package/dist/business-flow/strategies/strategy-helpers.js +0 -49
  153. package/dist/business-flow/strategies/typeorm-business-strategy.d.ts +0 -10
  154. package/dist/business-flow/strategies/typeorm-business-strategy.d.ts.map +0 -1
  155. package/dist/business-flow/strategies/typeorm-business-strategy.js +0 -136
  156. package/dist/business-flow/strategies/verified-invariant-strategy.d.ts +0 -5
  157. package/dist/business-flow/strategies/verified-invariant-strategy.d.ts.map +0 -1
  158. package/dist/business-flow/strategies/verified-invariant-strategy.js +0 -38
  159. package/dist/business-flow/strategies/verified-test-strategy.d.ts +0 -5
  160. package/dist/business-flow/strategies/verified-test-strategy.d.ts.map +0 -1
  161. package/dist/business-flow/strategies/verified-test-strategy.js +0 -26
  162. package/dist/business-flow/structural-flow-catalog.d.ts +0 -21
  163. package/dist/business-flow/structural-flow-catalog.d.ts.map +0 -1
  164. package/dist/business-flow/structural-flow-catalog.js +0 -125
  165. package/dist/business-flow/types.d.ts +0 -51
  166. package/dist/business-flow/types.d.ts.map +0 -1
  167. package/dist/business-flow/types.js +0 -1
  168. package/dist/cli/argument-parser.d.ts +0 -3
  169. package/dist/cli/argument-parser.d.ts.map +0 -1
  170. package/dist/cli/argument-parser.js +0 -200
  171. package/dist/cli/cli-application.d.ts +0 -39
  172. package/dist/cli/cli-application.d.ts.map +0 -1
  173. package/dist/cli/cli-application.js +0 -571
  174. package/dist/cli/cli-error.d.ts +0 -12
  175. package/dist/cli/cli-error.d.ts.map +0 -1
  176. package/dist/cli/cli-error.js +0 -44
  177. package/dist/cli/cli-presenter.d.ts +0 -14
  178. package/dist/cli/cli-presenter.d.ts.map +0 -1
  179. package/dist/cli/cli-presenter.js +0 -36
  180. package/dist/cli/insights-cli.d.ts +0 -6
  181. package/dist/cli/insights-cli.d.ts.map +0 -1
  182. package/dist/cli/insights-cli.js +0 -236
  183. package/dist/cli/main.d.ts +0 -3
  184. package/dist/cli/main.d.ts.map +0 -1
  185. package/dist/cli/main.js +0 -137
  186. package/dist/cli/standalone-cli.d.ts +0 -3
  187. package/dist/cli/standalone-cli.d.ts.map +0 -1
  188. package/dist/cli/standalone-cli.js +0 -104
  189. package/dist/cli/types.d.ts +0 -49
  190. package/dist/cli/types.d.ts.map +0 -1
  191. package/dist/cli/types.js +0 -1
  192. package/dist/cli/web-cli.d.ts +0 -9
  193. package/dist/cli/web-cli.d.ts.map +0 -1
  194. package/dist/cli/web-cli.js +0 -134
  195. package/dist/contracts/graph.d.ts +0 -266
  196. package/dist/contracts/graph.d.ts.map +0 -1
  197. package/dist/contracts/graph.js +0 -182
  198. package/dist/contracts/identifiers.d.ts +0 -4
  199. package/dist/contracts/identifiers.d.ts.map +0 -1
  200. package/dist/contracts/identifiers.js +0 -7
  201. package/dist/contracts/public-contracts.d.ts +0 -5
  202. package/dist/contracts/public-contracts.d.ts.map +0 -1
  203. package/dist/contracts/public-contracts.js +0 -4
  204. package/dist/evaluation/comparison.d.ts +0 -30
  205. package/dist/evaluation/comparison.d.ts.map +0 -1
  206. package/dist/evaluation/comparison.js +0 -108
  207. package/dist/evaluation/contracts.d.ts +0 -301
  208. package/dist/evaluation/contracts.d.ts.map +0 -1
  209. package/dist/evaluation/contracts.js +0 -413
  210. package/dist/graph/graph-store.d.ts +0 -55
  211. package/dist/graph/graph-store.d.ts.map +0 -1
  212. package/dist/graph/graph-store.js +0 -912
  213. package/dist/graph/types.d.ts +0 -189
  214. package/dist/graph/types.d.ts.map +0 -1
  215. package/dist/graph/types.js +0 -1
  216. package/dist/insights/contracts.d.ts +0 -266
  217. package/dist/insights/contracts.d.ts.map +0 -1
  218. package/dist/insights/contracts.js +0 -124
  219. package/dist/insights/insights-store.d.ts +0 -73
  220. package/dist/insights/insights-store.d.ts.map +0 -1
  221. package/dist/insights/insights-store.js +0 -246
  222. package/dist/knowledge/business-knowledge-service.d.ts +0 -24
  223. package/dist/knowledge/business-knowledge-service.d.ts.map +0 -1
  224. package/dist/knowledge/business-knowledge-service.js +0 -200
  225. package/dist/knowledge/graph-patch-conflict-error.d.ts +0 -8
  226. package/dist/knowledge/graph-patch-conflict-error.d.ts.map +0 -1
  227. package/dist/knowledge/graph-patch-conflict-error.js +0 -12
  228. package/dist/knowledge/structural-target-binding.d.ts +0 -14
  229. package/dist/knowledge/structural-target-binding.d.ts.map +0 -1
  230. package/dist/knowledge/structural-target-binding.js +0 -11
  231. package/dist/package-metadata.d.ts +0 -2
  232. package/dist/package-metadata.d.ts.map +0 -1
  233. package/dist/package-metadata.js +0 -9
  234. package/dist/repository/git-command.d.ts +0 -3
  235. package/dist/repository/git-command.d.ts.map +0 -1
  236. package/dist/repository/git-command.js +0 -25
  237. package/dist/repository/repository-inspector.d.ts +0 -8
  238. package/dist/repository/repository-inspector.d.ts.map +0 -1
  239. package/dist/repository/repository-inspector.js +0 -97
  240. package/dist/repository/repository-language-support.d.ts +0 -14
  241. package/dist/repository/repository-language-support.d.ts.map +0 -1
  242. package/dist/repository/repository-language-support.js +0 -64
  243. package/dist/repository/types.d.ts +0 -9
  244. package/dist/repository/types.d.ts.map +0 -1
  245. package/dist/repository/types.js +0 -1
  246. package/dist/runtime/sqlite-compatibility-process.d.ts +0 -8
  247. package/dist/runtime/sqlite-compatibility-process.d.ts.map +0 -1
  248. package/dist/runtime/sqlite-compatibility-process.js +0 -20
  249. package/dist/setup/skill-installer.d.ts +0 -20
  250. package/dist/setup/skill-installer.d.ts.map +0 -1
  251. package/dist/setup/skill-installer.js +0 -187
  252. package/dist/snapshots/repository-snapshot.d.ts +0 -4
  253. package/dist/snapshots/repository-snapshot.d.ts.map +0 -1
  254. package/dist/snapshots/repository-snapshot.js +0 -119
  255. package/dist/snapshots/types.d.ts +0 -30
  256. package/dist/snapshots/types.d.ts.map +0 -1
  257. package/dist/snapshots/types.js +0 -1
  258. package/dist/storage/atlas-database.d.ts +0 -25
  259. package/dist/storage/atlas-database.d.ts.map +0 -1
  260. package/dist/storage/atlas-database.js +0 -483
  261. package/dist/storage/snapshot-store.d.ts +0 -19
  262. package/dist/storage/snapshot-store.d.ts.map +0 -1
  263. package/dist/storage/snapshot-store.js +0 -74
  264. package/dist/structural-backend/codegraph-backend.d.ts +0 -57
  265. package/dist/structural-backend/codegraph-backend.d.ts.map +0 -1
  266. package/dist/structural-backend/codegraph-backend.js +0 -1230
  267. package/dist/structural-backend/codegraph-worker-client.d.ts +0 -5
  268. package/dist/structural-backend/codegraph-worker-client.d.ts.map +0 -1
  269. package/dist/structural-backend/codegraph-worker-client.js +0 -118
  270. package/dist/structural-backend/codegraph-worker-protocol.d.ts +0 -35
  271. package/dist/structural-backend/codegraph-worker-protocol.d.ts.map +0 -1
  272. package/dist/structural-backend/codegraph-worker-protocol.js +0 -1
  273. package/dist/structural-backend/codegraph-worker.d.ts +0 -2
  274. package/dist/structural-backend/codegraph-worker.d.ts.map +0 -1
  275. package/dist/structural-backend/codegraph-worker.js +0 -131
  276. package/dist/structural-backend/process-instance.d.ts +0 -18
  277. package/dist/structural-backend/process-instance.d.ts.map +0 -1
  278. package/dist/structural-backend/process-instance.js +0 -207
  279. package/dist/structural-backend/structural-fact-changes.d.ts +0 -7
  280. package/dist/structural-backend/structural-fact-changes.d.ts.map +0 -1
  281. package/dist/structural-backend/structural-fact-changes.js +0 -78
  282. package/dist/structural-backend/structural-projection-bootstrapper.d.ts +0 -10
  283. package/dist/structural-backend/structural-projection-bootstrapper.d.ts.map +0 -1
  284. package/dist/structural-backend/structural-projection-bootstrapper.js +0 -295
  285. package/dist/structural-backend/structural-publication.d.ts +0 -13
  286. package/dist/structural-backend/structural-publication.d.ts.map +0 -1
  287. package/dist/structural-backend/structural-publication.js +0 -255
  288. package/dist/structural-backend/structural-write-lock.d.ts +0 -8
  289. package/dist/structural-backend/structural-write-lock.d.ts.map +0 -1
  290. package/dist/structural-backend/structural-write-lock.js +0 -415
  291. package/dist/structural-backend/types.d.ts +0 -144
  292. package/dist/structural-backend/types.d.ts.map +0 -1
  293. package/dist/structural-backend/types.js +0 -11
  294. package/dist/web/application/atlas-read-service.d.ts +0 -27
  295. package/dist/web/application/atlas-read-service.d.ts.map +0 -1
  296. package/dist/web/application/atlas-read-service.js +0 -216
  297. package/dist/web/application/primary-repository-catalog.d.ts +0 -15
  298. package/dist/web/application/primary-repository-catalog.d.ts.map +0 -1
  299. package/dist/web/application/primary-repository-catalog.js +0 -202
  300. package/dist/web/application/types.d.ts +0 -41
  301. package/dist/web/application/types.d.ts.map +0 -1
  302. package/dist/web/application/types.js +0 -1
  303. package/dist/web/server/api-router.d.ts +0 -4
  304. package/dist/web/server/api-router.d.ts.map +0 -1
  305. package/dist/web/server/api-router.js +0 -151
  306. package/dist/web/server/local-web-server.d.ts +0 -12
  307. package/dist/web/server/local-web-server.d.ts.map +0 -1
  308. package/dist/web/server/local-web-server.js +0 -100
  309. package/dist/web-client/assets/index-DneaErDj.css +0 -1
  310. package/dist/web-client/assets/index-cze_4vtt.js +0 -2
  311. package/dist/web-client/assets/index-cze_4vtt.js.map +0 -1
  312. package/dist/web-client/index.html +0 -61
  313. package/dist/world/business-map-projector.d.ts +0 -14
  314. package/dist/world/business-map-projector.d.ts.map +0 -1
  315. package/dist/world/business-map-projector.js +0 -178
  316. package/dist/world/types.d.ts +0 -77
  317. package/dist/world/types.d.ts.map +0 -1
  318. package/dist/world/types.js +0 -1
  319. package/dist/world/world-graph-query.d.ts +0 -30
  320. package/dist/world/world-graph-query.d.ts.map +0 -1
  321. package/dist/world/world-graph-query.js +0 -252
  322. package/dist/world/world-model-service.d.ts +0 -21
  323. package/dist/world/world-model-service.d.ts.map +0 -1
  324. package/dist/world/world-model-service.js +0 -219
  325. package/dist/world/world-snapshot-store.d.ts +0 -41
  326. package/dist/world/world-snapshot-store.d.ts.map +0 -1
  327. package/dist/world/world-snapshot-store.js +0 -581
  328. package/docs/README.md +0 -30
  329. package/docs/architecture/codegraph-backend.md +0 -190
  330. package/docs/architecture/continuous-business-learning.md +0 -240
  331. package/docs/architecture/web-viewer.md +0 -225
  332. package/docs/contracts/cli-v1.md +0 -179
  333. package/docs/contracts/graph-model.md +0 -106
  334. package/docs/contracts/graph-patch-v1.md +0 -105
  335. package/docs/contracts/http-api-v1.md +0 -155
  336. package/docs/contracts/insights-v1.md +0 -84
  337. package/docs/log.md +0 -159
  338. package/docs/mindmaps/semantic-atlas-overview.drawio +0 -255
  339. package/docs/mindmaps/semantic-atlas-overview.png +0 -0
  340. package/docs/mindmaps/semantic-atlas-overview.zh-CN.drawio +0 -255
  341. package/docs/mindmaps/semantic-atlas-overview.zh-CN.png +0 -0
  342. package/schemas/cli-envelope-v1.schema.json +0 -1244
  343. package/schemas/evaluation-plan-v1.schema.json +0 -211
  344. package/schemas/evaluation-run-v1.schema.json +0 -659
  345. package/schemas/graph-patch-v1.schema.json +0 -392
  346. package/schemas/insights-envelope-v1.schema.json +0 -428
@@ -1,190 +0,0 @@
1
- # CodeGraph Backend Architecture
2
-
3
- ## Decision
4
-
5
- Semantic Atlas embeds the verified `@colbymchenry/codegraph` 1.5.0 package as its structural-index SDK. It uses the SDK's fixed `.atlas/codegraph.db` path as a worktree-local disposable projection and stores durable Atlas knowledge in a separate user-level repository database.
6
-
7
- This decision produces one product, one index command, two explicit storage lifecycles, and one logical world graph. It requires no upstream database-path option and lets linked worktrees share durable business meaning without sharing one mutable structural index.
8
-
9
- ## System model
10
-
11
- ```text
12
- Calling AI
13
- |
14
- Semantic Atlas Skill
15
- |
16
- semantic-atlas CLI
17
- |
18
- WorldModelService
19
- |-- CodeGraphBackend ------ @colbymchenry/codegraph SDK
20
- | |-- extraction and resolution
21
- | |-- structural search and traversal
22
- |
23
- |-- BusinessKnowledgeStore -- ~/.semantic-atlas/repositories/<id>/atlas.db
24
- |
25
- `-- WorldGraphQuery -------- normalizes and composes both domains
26
- |
27
- <worktree>/.atlas/codegraph.db
28
- ```
29
-
30
- `CodeGraphBackend` is an anti-corruption layer, not a second public API. Atlas domain code depends on Atlas structural query types. Backend node kinds, edge kinds, identifiers, errors, and version metadata are translated at this boundary.
31
-
32
- ## Physical and logical ownership
33
-
34
- The two SQLite files have different owners and lifecycles. They remain internal stores behind one Atlas query contract.
35
-
36
- | Owner | Table family | Lifecycle |
37
- | --- | --- | --- |
38
- | CodeGraph worktree projection | `nodes`, `edges`, `files`, `unresolved_refs`, FTS, schema and backend metadata | Copied from a compatible sibling, rebuilt, or incrementally synchronized from source |
39
- | Atlas repository store | `atlas_*` business, snapshot, binding, validity, worktree-state, and publication objects | Shared by all worktrees and updated by Atlas only |
40
-
41
- Atlas accesses structural behavior through the CodeGraph public SDK and durable knowledge through its user-level database. `WorldGraphQuery` joins evidence locators and structural references in memory; the public CLI never exposes table origin or a second workflow.
42
-
43
- The implementation contains no Atlas-owned structural projection tables. Keeping those tables would duplicate CodeGraph data and restore the two-graph problem this design resolves.
44
-
45
- ## Stable Atlas contracts
46
-
47
- The adapter exposes only the structural operations required by business understanding:
48
-
49
- ```ts
50
- interface StructuralIndexBackend {
51
- inspect(): Promise<StructuralIndexState>;
52
- build(): Promise<StructuralBuildResult>;
53
- sync(): Promise<StructuralBuildResult>;
54
- listRoots(): Promise<StructuralNode[]>;
55
- readProjectGraph(query: StructuralProjectGraphQuery): Promise<StructuralTraversalResult>;
56
- search(query: StructuralSearchQuery): Promise<StructuralSearchResult[]>;
57
- getNode(reference: StructuralReference): Promise<StructuralNode | undefined>;
58
- traverse(query: StructuralTraversalQuery): Promise<StructuralTraversalResult>;
59
- getCallers(reference: StructuralReference): Promise<StructuralCallRelation[]>;
60
- getCallees(reference: StructuralReference): Promise<StructuralCallRelation[]>;
61
- getFileDependencies(path: string): Promise<StructuralFileDependency[]>;
62
- }
63
- ```
64
-
65
- These are domain-level capabilities rather than a mirror of every CodeGraph API. The adapter may use `CodeGraph.init`, `open`, `indexAll`, `sync`, search, callers, callees, call graph, impact, and file-dependency APIs internally.
66
-
67
- Business-flow derivation requests one bounded project graph containing only the
68
- declaration kinds used by its framework strategies. A caller supplies explicit
69
- capability roots; Atlas follows exact ownership and execution relations from
70
- those roots and uses same-file framework declarations only as interpretation
71
- context. The adapter returns normalized declaration kinds, decorator names,
72
- supported relations, and unknown boundaries in one query so Node 22
73
- private-worker execution does not degenerate into a process-per-node traversal.
74
-
75
- `WorldModelService` owns orchestration. `BusinessKnowledgeStore` owns Atlas tables and transactions. `WorldGraphQuery` resolves cross-domain references and returns the existing versioned CLI graph contract.
76
-
77
- `WorldGraphQuery` is the read coordinator used by map, code-search, and change workflows. It requires one published world snapshot, projects the business hierarchy into semantic zoom views, resolves direct evidence links, delegates bounded structural search to the adapter, and verifies that the published snapshot did not change while an asynchronous structural query was running. Structural results retain normalized support and provenance; business results retain certainty, validity, and evidence.
78
-
79
- Lexical search keeps its ownership domains explicit. `map search` ranks only Atlas business vocabulary. `code search` ranks only CodeGraph structural results and normalizes their order into bounded public scores. The query layer performs no cross-domain score fusion, embeddings, model calls, or natural-language inference.
80
-
81
- When CodeGraph has no explicit module or namespace nodes, the adapter exposes deterministic top-directory module roots with Atlas `module:` references. These roots are computed from the current backend file manifest and traverse to backend file nodes; they are not stored in Atlas tables or presented as business facts.
82
-
83
- ## Evidence references
84
-
85
- Atlas business knowledge does not own CodeGraph rows. An evidence record contains:
86
-
87
- - an optional backend node locator for fast rebinding;
88
- - a normalized repository-relative source path;
89
- - a structural kind and qualified symbol identity when available;
90
- - a one-based source range;
91
- - a source content hash;
92
- - the Atlas snapshot and structural-backend version observed at learning time.
93
-
94
- No cascading foreign key points from `atlas_*` evidence to a CodeGraph structural table. The original evidence locator remains repository-wide. After every successful index, Atlas writes a binding for that content snapshot; a unique match is current, a missing or ambiguous match is stale, and certainty remains unchanged. One worktree's rebinding never overwrites another snapshot's result.
95
-
96
- Structural relation targets own the same kind of durable locator independently from their supporting evidence. A relation may target one structural node while its evidence cites another; Atlas resolves both locators separately and marks the relation stale when either one is missing or ambiguous.
97
-
98
- ## Directory lifecycle
99
-
100
- Atlas owns directory preparation:
101
-
102
- 1. resolve the current Git worktree root;
103
- 2. create `<worktree>/.atlas/` when needed;
104
- 3. create an Atlas-owned `.atlas/.gitignore` that ignores the directory contents, including itself, so generated state remains invisible to normal Git status;
105
- 4. run CodeGraph in a scoped environment where `CODEGRAPH_DIR` is `.atlas`;
106
- 5. verify the resolved CodeGraph database path is exactly `<worktree>/.atlas/codegraph.db` before writing.
107
-
108
- The environment override is contained inside `CodeGraphBackend`; callers do not configure CodeGraph. Each worktree has its own `.atlas/` because CodeGraph's index, SQLite locks, and dirty source state are worktree- and operating-system-specific.
109
-
110
- When `codegraph.db` is missing, `StructuralProjectionBootstrapper` reads compatible `current` sibling states from the repository Atlas database. Exact-snapshot candidates sort first, followed by the most recent successful publication and normalized path. Under the sibling's existing structural lock, Atlas rejects symlinks, integrity failures, incomplete metadata, version mismatches, and source-manifest mismatches; it copies only the SQLite database with `node:sqlite.backup()`, atomically installs the destination, and always runs incremental `sync` in the destination root. All failed candidates lead to the normal full-index fallback.
111
-
112
- ## Index state machine
113
-
114
- ```text
115
- missing -> building -> current
116
- | |
117
- v v
118
- failed <- building
119
- ```
120
-
121
- - `missing` means no completed Atlas world snapshot exists.
122
- - `building` is written before structural mutation begins.
123
- - `current` is published only after CodeGraph completes and Atlas snapshot/evidence reconciliation commits.
124
- - `failed` records the last failure while preventing a partial structural graph from being reported as current.
125
-
126
- All Semantic Atlas commands use one Atlas-owned worktree lock. Its PID, operating-system process-instance proof, and ownership token cover the complete publication lifecycle, do not expire while that process instance is alive, and permit recovery after that instance exits even if its PID is later reused. Linux and Windows use high-resolution OS process-start identities. On macOS and other POSIX hosts without `/proc`, owners keep the authoritative lease inode open for the full lifecycle; process exit closes that kernel-held proof, which cannot be inherited by a later process reusing the PID. Structural writes complete before Atlas knowledge writes. Read commands require a `current` snapshot or return explicit stale/failed state.
127
-
128
- Normal updates use CodeGraph incremental sync. A full structural rebuild uses `CodeGraph.clear()` followed by `indexAll()` because the current SDK clears only structural rows. The adapter never calls:
129
-
130
- - `CodeGraph.recreate()`, which removes `codegraph.db` and its sidecars;
131
- - `CodeGraph.uninitialize()`, which removes the entire `.atlas/` directory;
132
- - the CodeGraph CLI rebuild path, which is allowed to choose destructive lifecycle operations.
133
-
134
- Before mutating an existing structural index, the adapter captures an online backup of the CodeGraph database. Both full rebuild and incremental sync discard that backup only after a complete result; an incomplete result or exception restores the previously published structural graph before the Atlas lock is released.
135
-
136
- The structural database contains no Atlas-owned tables, so replacing or deleting a worktree projection cannot delete durable business knowledge.
137
-
138
- ## Snapshot semantics
139
-
140
- CodeGraph's structural tables represent the current code projection. Atlas snapshots record repository content identity, Git state, relevant file hashes, the CodeGraph package and extraction versions, build outcome, and evidence validity.
141
-
142
- Atlas does not preserve a second full historical structural graph. Repository snapshots are content-addressed and may recur, while every successful index/sync creates a distinct immutable publication occurrence scoped to `(repository_id, git_directory)`. Each worktree state points to its own latest occurrence and predecessor chain. Business assertions remain repository-wide and expose binding-derived validity for the requested snapshot.
143
-
144
- The change query proves the requested source snapshot is an ancestor of the target by following the immutable publication-occurrence chain. Repeated content identities resolve deterministically within the current chain: `to` selects the latest matching occurrence and `from` selects the latest match at or before that target; equal endpoints select the same occurrence. Atlas compares the supported source content stored in the two endpoint snapshots and returns the net added, changed, and removed `file:` references. This endpoint comparison is independent of the structural backend's incremental Git baseline: intermediate additions that are later removed and removals restored with identical content cancel naturally. Stale assertions describe validity at the selected target occurrence rather than the union of intermediate failures. Atlas does not query mutable CodeGraph rows as if they were a historical snapshot or reconstruct unsupported historical node and relation changes.
145
-
146
- World publication captures the repository snapshot after acquiring the Atlas write lock, verifies it again after structural indexing, and compares its source hashes with CodeGraph's indexed file manifest. A mismatch rolls back the structural database and leaves the prior world snapshot current. After validation, Atlas commits CodeGraph first and then publishes the user-level Atlas transaction. If that central transaction fails, the durable CodeGraph projection remains, the worktree state is non-current, and the next `index` repairs publication through incremental sync. Every successful occurrence is immutable.
147
-
148
- ## Failure and upgrade behavior
149
-
150
- - A CodeGraph index or sync error fails the Atlas index command and leaves the world snapshot non-current.
151
- - A user-level Atlas transaction failure leaves complete CodeGraph structural data present but unavailable to map and learn until a later index republishes the worktree state.
152
- - Unsupported structure is returned as backend support metadata or an unresolved boundary; Atlas does not invent an exact edge.
153
- - The dependency version is pinned exactly rather than selected through a semver range. The compatible host range is Node.js 22.12 through 24. Node.js 22.12 through 22.15 lack the FTS5 module required by CodeGraph 1.5.0, so the adapter runs its private SDK worker with the dependency's bundled Node.js runtime on those hosts; Node.js 22.16 through 24 use the SDK in process. Both paths expose the same Atlas contract and invoke no CodeGraph CLI, MCP, or daemon lifecycle. Upgrades run fixture repositories through index, sync, rebuild, query normalization, split-schema ownership, and evidence-rebinding tests before changing the lockfile.
154
- - If an upstream release changes structural IDs, locator-based rebinding preserves stable Atlas business keys and makes unmatched evidence stale.
155
-
156
- Run `pnpm validation:backend` to validate the installed tarball against the
157
- current exact dependency. To evaluate a new release before changing the pin,
158
- run `pnpm validation:backend -- --candidate <version> --allow-network`. The
159
- isolated consumer overrides only its installed candidate; the source manifest
160
- and lockfile remain unchanged. The gate validates a pure CodeGraph worktree
161
- projection, the user-level Atlas schema, sibling bootstrap plus incremental
162
- sync, snapshot-specific rebinding, and business-knowledge preservation. It also
163
- compares required structural endpoints and bounded false exact links with the
164
- pinned baseline, and prints measured index, database, and query costs.
165
-
166
- ## Pre-release storage transition
167
-
168
- The previous colocated `.atlas/codegraph.db` layout is intentionally reset rather than imported. Existing `.atlas` data is a disposable development cache. The user-level schema starts at v1, and durable knowledge is learned through the current GraphPatch contract.
169
-
170
- ## Alternatives considered
171
-
172
- ### Wait for an upstream database-path option
173
-
174
- This would permit relocating CodeGraph itself, but the product no longer needs that capability. Atlas accepts the SDK's local path and moves only its own durable state.
175
-
176
- ### Run CodeGraph as a separate CLI or MCP product
177
-
178
- This would force agents to coordinate two tools, two public contracts, and two failure models. It conflicts with the single Semantic Atlas workflow.
179
-
180
- ### Share one mutable CodeGraph database across worktrees
181
-
182
- Different branches and dirty files require independent structural projections. Sharing a mutable projection would mix snapshots and locks; sibling backup plus incremental sync reuses work without sharing mutation.
183
-
184
- ### Copy CodeGraph source into Semantic Atlas
185
-
186
- This imports a large parser, resolver, database, CLI, MCP, and maintenance surface. Direct SDK use preserves the boundary with much lower ownership cost. A thin fork remains available only if a demonstrated SDK limitation blocks the product contract.
187
-
188
- ### Extend CodeGraph node and edge enums with business concepts
189
-
190
- CodeGraph structural rows require code-centric fields and are legitimately disposable during structural rebuilds. Business assertions have different identity, evidence, certainty, and validity lifecycles, so they remain Atlas-owned and are composed at the query boundary.
@@ -1,240 +0,0 @@
1
- # 持续业务学习与演进式业务地图
2
-
3
- 本页回答 Semantic Atlas 何时学习业务知识、业务根节点如何随认知演进、
4
- 以及层级调整如何保持身份与证据稳定。适用于业务图查询、GraphPatch、
5
- Agent Skill 和后续影响分析设计。状态:已接受,按垂直切片逐步实施。
6
-
7
- ## 产品判断
8
-
9
- Semantic Atlas 在真实工程任务中持续学习业务,不在首次索引时生成一套
10
- 推测性的完整业务模型。真实任务同时提供产品意图、相关源码、测试、修改
11
- 结果和复用价值,是形成可靠业务知识的最佳证据边界。
12
-
13
- `index` 只发布当前工作树的结构投影、仓库快照和已有证据有效性。调用
14
- Agent 负责理解自然语言和业务意义;CodeGraph 负责提供符号、引用、调用、
15
- 模块和源码位置等结构事实。两者通过证据关系协作,但结构目录不替代业务
16
- 地图。
17
-
18
- 业务地图是一个持续成长并允许重组的心智模型:
19
-
20
- ```text
21
- 真实工程任务
22
- -> 查询已有业务知识
23
- -> 从 CodeGraph 与源码补足未知部分
24
- -> 完成修改与验证
25
- -> 提炼可复用业务知识
26
- -> 新增、扩展、修正或重挂载业务子树
27
- ```
28
-
29
- ## 根节点语义
30
-
31
- 根节点表示当前有效业务图中没有已知主要父节点的业务节点。它是查询时的
32
- 结构状态,不是永久地位,也不是 `Capability` 等节点类型。
33
-
34
- 第一次任务可能只验证“退款”,它暂时作为根节点;后续任务发现“退款”
35
- 属于“订单”,再发现“订单”属于“Commerce”,地图可以持续演进:
36
-
37
- ```text
38
- Refunds
39
-
40
- Orders
41
- └── Refunds
42
-
43
- Commerce
44
- └── Orders
45
- └── Refunds
46
- ```
47
-
48
- 世界层 `map view` 只把当前父节点为空的业务知识作为 root regions:
49
-
50
- - 空业务图返回空数组和稳定的 `BUSINESS_KNOWLEDGE_EMPTY` 告警;
51
- - 结构 `Module` 根节点通过 `code search` 参与源码回退,不进入业务 regions;
52
- - 任意业务节点类型都可以在尚未发现父节点时暂时成为根;
53
- - 新的上层知识可以在一个原子事务中把既有根节点变成子节点;
54
- - 根节点变化不改变节点身份、证据或其他业务关系。
55
-
56
- ## 稳定身份与可变位置
57
-
58
- 业务身份的生命周期长于当前分类位置。v1 继续使用 `key` 作为仓库内稳定
59
- 身份;key 中的斜杠只表达可读命名空间,不构成父子关系,也不随重挂载
60
- 改写。权威层级只来自 `part_of` 关系。
61
-
62
- 例如 `refunds` 或既有的 `commerce/refunds` 在挂到 `orders` 下时保持原 key。
63
- 调用方通过稳定 key 继续引用该节点,展示路径则根据当前 `part_of` 链计算。
64
- 后续版本只有在真实碰撞或跨仓库身份需求出现时,才引入独立 opaque ID;
65
- 本阶段不为假设性需求迁移现有知识。
66
-
67
- ## 业务层级不变量
68
-
69
- `part_of` 是导航层级关系,并满足以下不变量:
70
-
71
- 1. 一个业务节点最多拥有一个 outgoing `part_of` 主要父节点。
72
- 2. 父节点和子节点都属于业务域并已存在或在同一 GraphPatch 中创建。
73
- 3. `part_of` 图保持无环;节点不能成为自身或自身后代的父节点。
74
- 4. 横向关系不受主要父节点限制,继续使用 `invokes`、`reads`、`writes`、
75
- `publishes`、`consumes`、`constrained_by`、`realized_by` 和 `verified_by`。
76
- 5. 层级变化保留节点 key、业务断言、证据和非层级关系。
77
-
78
- 树形主要归属提供稳定的逐层导航;横向关系表达真实业务协作。需要从多个
79
- 角度发现同一节点时,使用 aliases、搜索和横向关系,而不是创建多个主要
80
- 父节点。
81
-
82
- ## 原子重挂载
83
-
84
- GraphPatch v1 已支持在一个事务中删除旧关系并新增关系。重挂载使用同一
85
- patch 完成以下动作:
86
-
87
- 1. 必要时 upsert 新的上层业务节点;
88
- 2. remove 既有 outgoing `part_of`;
89
- 3. upsert 指向新父节点的 `part_of`;
90
- 4. 保持被移动节点及其子树 key 不变。
91
-
92
- Atlas 在写入前根据删除和新增操作计算最终层级,并整体校验单父节点和无环
93
- 不变量。任何一步失败都会拒绝完整 patch,旧地图保持不变。
94
-
95
- 未来若多个 Agent 同时修改共享业务地图,需要在 GraphPatch 中加入独立于
96
- 源码 snapshot 的 knowledge revision。当前 v1 继续依赖串行 Skill 工作流、
97
- SQLite 写事务和完整 patch 校验;知识 revision 属于后续并发切片。
98
-
99
- ## 任务驱动的知识协调
100
-
101
- 每个受支持任务先查询已有业务图。地图不足时,Agent 显式使用结构搜索和
102
- 有界源码阅读完成工程工作。在最终源码和测试得到验证后,Agent 对新理解
103
- 执行一次知识协调:
104
-
105
- | 决策 | 含义 |
106
- | --- | --- |
107
- | `reuse` | 已有节点和关系完整表达本次验证的业务意义 |
108
- | `extend` | 给已有知识增加节点、断言或横向关系 |
109
- | `introduce` | 当前没有可信上层概念,新增暂时的根节点 |
110
- | `reparent` | 发现更高层归属,原子移动已有节点或子树 |
111
- | `refine` | 修正 kind、label、summary、aliases 或 certainty |
112
- | `transient` | 本次信息是实现细节、症状或未验证假设,不持久化 |
113
-
114
- 创建节点前必须搜索近似业务词并查看世界 regions,减少重复根节点。发现更上层业务
115
- 时优先重挂载现有知识,而不是复制一棵新子树。所有持久事实仍需要当前源码
116
- 证据;结构不确定性保留为显式边界。
117
-
118
- ## CodeGraph 的位置
119
-
120
- CodeGraph 保持为 Semantic Atlas 内部结构证据层:
121
-
122
- - 索引文件、符号和可静态证明的关系;
123
- - 为业务断言提供 source range、content hash 和可重绑定身份;
124
- - 在业务知识不足时提供有界源码种子;
125
- - 从已选业务节点向调用方、消费者、数据和测试扩展未来 impact 查询。
126
-
127
- CodeGraph 不命名业务、不决定业务父子关系,也不把目录层级呈现为业务地图。
128
- 结构 exact 不自动成为业务 exact;无法证明的运行时行为继续保持
129
- `UnknownBoundary`。
130
-
131
- ## 一张地图与语义缩放
132
-
133
- Semantic Atlas 保存一张权威业务图,不分别保存总览图和模块子图。`part_of`
134
- 形成可逐层进入的区域层级,其他业务关系形成跨区域连接。查询根据当前焦点
135
- 选择一个可见业务边界,同一底图因此可以像游戏地图一样连续缩放。
136
-
137
- 世界视图显示当前 roots。聚焦某个节点后,视图显示它的直接子区域,并把与
138
- 当前区域发生业务关系的外部节点折叠到最接近当前视野的业务分支。例如源码
139
- 确认的关系是 `place-order reads user-profile`,在 Commerce 视图中可以投影为
140
- `orders reads users`,在 Orders 视图中投影为
141
- `place-order reads users`。
142
-
143
- 投影关系满足以下规则:
144
-
145
- 1. GraphPatch 只保存 Agent 明确验证的原始业务关系。
146
- 2. 缩放视图把下层关系端点提升到当前可见区域,形成只读聚合连接。
147
- 3. 同一对可见区域按 relation type 合并贡献关系,分别报告 direct 与
148
- aggregated 数量、certainty 分布和 validity 分布。
149
- 4. 投影后落在同一可见区域内的关系属于该区域内部细节,本层隐藏,放大后
150
- 再显示。
151
- 5. 聚合连接不是新的业务事实,不写回 GraphPatch,也不获得虚构的 certainty。
152
- 6. breadcrumb 始终从当前 root 指向焦点;每个区域返回 direct child count 和
153
- expandable 状态,让 Agent 明确下一次缩放入口。
154
-
155
- 节点 kind 表达业务角色,不表达固定缩放级别。`Capability` 可以包含更细的
156
- `Capability`,尚未发现父节点的 `Operation` 也可以暂时成为世界区域;视图
157
- 完全根据当前 `part_of` 层级计算。
158
-
159
- ## AI-first 查询契约
160
-
161
- 公共 API 以调用 Agent 完成真实工程任务的最短可靠路径设计:
162
-
163
- ```text
164
- status -> index when needed
165
- map view [business-key]
166
- map search <business vocabulary>
167
- map show <business-key>
168
- code search <symbol or structural vocabulary> when business knowledge is insufficient
169
- source confirmation -> engineering work -> index -> changes -> learn
170
- ```
171
-
172
- - `map view` 是主要导航入口。省略 key 时返回世界视图;提供 key 时向该业务
173
- 区域放大一层,同时返回 breadcrumb、child/context regions 和聚合连接。
174
- - `map search` 只搜索业务词汇并返回业务节点,避免代码符号淹没业务意图。
175
- - `map show` 只接受业务 key,返回该业务断言、直接业务关系和直接结构证据,
176
- 不递归展开 CodeGraph。
177
- - `code search` 是业务知识为空或不足时的显式结构回退,返回有界源码种子。
178
- - 源码读取、编辑和测试继续属于 Agent 的正常工程工具,不包装进 Atlas CLI。
179
-
180
- `map roots`、`map children`、混合业务/结构的 `map search`、接受结构 ID 与任意
181
- depth 的 `map show` 不再属于公共契约。当前没有外部使用者,本阶段直接替换
182
- 旧 API,不增加 alias、兼容 schema 或双轨行为。
183
-
184
- API 的首要 dogfood 场景是让一个没有预置 key 的 Agent 使用 Semantic Atlas
185
- 理解并修改 Semantic Atlas 自身:先从世界视图寻找业务区域;知识不足时通过
186
- `code search` 定位 `WorldGraphQuery` 等结构入口;完成修改后学习查询能力、
187
- 层级和关系,使下一个 Agent 能从 `map view` 逐层到达实现证据。
188
-
189
- ## 分阶段实现
190
-
191
- ### Slice 1:业务 roots 与安全层级
192
-
193
- - 世界视图只选择所有类型的 parentless business nodes;
194
- - 空业务图返回 `BUSINESS_KNOWLEDGE_EMPTY`;
195
- - GraphPatch 最终状态强制单父节点和无环;
196
- - Skill 在真实任务后执行 `reuse/extend/introduce/reparent/refine/transient`;
197
- - 文档明确 key 与位置分离。
198
-
199
- ### Slice 2:语义缩放与 AI-first 查询视角
200
-
201
- - 以 `map view` 替换 roots/children,生成 breadcrumb、可展开区域和聚合连接;
202
- - 业务搜索不与结构结果混排,增加 `code search` 作为显式回退;
203
- - `map show` 限制在业务关系和直接结构证据,避免结构图淹没业务语境;
204
- - 使用 Semantic Atlas 对自身完成一次世界视图到源码修改再到知识写回的验证。
205
-
206
- ### Slice 3:业务影响分析
207
-
208
- - 从业务节点遍历 scenario、operation、data、interface 和 invariant;
209
- - 通过 `realized_by`、`verified_by` 和 CodeGraph 扩展实现、调用者、消费者与
210
- 测试;
211
- - 分别报告 exact、inferred 和 unknown 影响,支持 Agent 制定修改范围。
212
-
213
- ### Slice 4:并发知识 revision 与长期治理
214
-
215
- - 为共享业务知识增加 optimistic knowledge revision;
216
- - 显式记录 reparent、merge 和分类修正;
217
- - 在真实重复知识或并发冲突出现后设计 merge 操作,不提前引入复杂治理。
218
-
219
- ## 验收场景
220
-
221
- 1. 新仓库完成 `index` 后,世界 `map view` 返回空业务图而不是 `src` 或 `libs`。
222
- 2. 第一次任务学到一个 Operation 时,它可以作为暂时根节点被后续任务复用。
223
- 3. 后续任务创建更高层 Capability,并在一个 GraphPatch 中把该 Operation
224
- 重挂载到 Capability 下;Operation key 与证据保持不变。
225
- 4. 同一 patch 尝试给节点添加两个主要父节点时整体失败。
226
- 5. 同一 patch 尝试形成 `A -> B -> A` 层级环时整体失败。
227
- 6. 世界视图只显示根区域;聚焦父节点时显示直接子区域、breadcrumb 和可展开
228
- 状态。
229
- 7. 两个深层节点的横向关系在上层视图聚合到各自可见祖先,放大后恢复更具体
230
- 的端点;聚合连接保留贡献关系的 certainty 与 validity 分布。
231
- 8. 一个 Fresh Agent 通过 `map view/search/show` 发现当前业务路径,并在业务
232
- 知识不足时通过 `code search` 明确转入结构与源码回退。
233
-
234
- ## 相关页面
235
-
236
- - [产品契约](../product-contract.md)
237
- - [图模型](../contracts/graph-model.md)
238
- - [GraphPatch v1](../contracts/graph-patch-v1.md)
239
- - [CLI v1](../contracts/cli-v1.md)
240
- - [CodeGraph 后端边界](codegraph-backend.md)
@@ -1,225 +0,0 @@
1
- # Desktop Web Viewer
2
-
3
- This page answers how people browse Semantic Atlas business knowledge without
4
- changing the Agent workflow, graph model, or repository state. It applies to
5
- the `semantic-atlas web` command, its local HTTP API, and the bundled desktop
6
- browser interface. Status: implemented in the current package.
7
-
8
- ## Product role
9
-
10
- The Web viewer is a human-facing, read-only surface over the same Semantic
11
- Atlas business world used by coding agents. It helps a person select a project,
12
- read summarized business knowledge, move through the established `part_of`
13
- hierarchy, search business vocabulary, and inspect direct relationships and
14
- evidence.
15
-
16
- The viewer presents business knowledge as a real spatial node map. The map
17
- metaphor defines topology and interaction rather than a game theme: users see
18
- business regions positioned on a canvas, follow visible hierarchy and business
19
- relationship lines, pan and zoom the canvas, and enter a region to reveal its
20
- next level. The surrounding interface remains a restrained product-development
21
- UI with project selection, breadcrumb, search, and a detail panel. It does not
22
- introduce game roles, presentation-specific node kinds, decorative world
23
- semantics, or a mobile experience.
24
-
25
- ## Stable boundary
26
-
27
- ```text
28
- semantic-atlas web
29
- |
30
- v
31
- LocalWebServer -------- bundled desktop Web application
32
- |
33
- v
34
- AtlasReadService
35
- |-- PrimaryRepositoryCatalog
36
- `-- WorldGraphQuery
37
- |
38
- v
39
- existing Atlas repository knowledge and current structural publication
40
- ```
41
-
42
- - `LocalWebServer` owns loopback HTTP, static assets, request validation, and
43
- API presentation.
44
- - `AtlasReadService` owns the read use cases shared by HTTP and future CLI
45
- presentation refactoring. The server calls it directly and never executes
46
- `semantic-atlas map ...` as a subprocess.
47
- - `PrimaryRepositoryCatalog` discovers Atlas repositories through Atlas-owned
48
- storage and Git inspection. It never exposes backend tables to the browser.
49
- - `WorldGraphQuery` remains the authority for business views, search, direct
50
- node details, publication consistency, certainty, and validity.
51
-
52
- The Web slice adds no graph table, node kind, relation kind, evidence format,
53
- or presentation coordinate to durable Atlas knowledge. Layout is derived in
54
- the browser for the visible frontier and is disposable.
55
-
56
- ## Primary-branch project scope
57
-
58
- The Web viewer deliberately ignores linked worktrees. A project is visible
59
- only when Atlas can resolve its primary working tree and that working tree is
60
- currently attached to a branch named exactly `main` or `master`.
61
-
62
- Repository discovery therefore follows these rules:
63
-
64
- 1. Group durable state by Atlas `repositoryId`.
65
- 2. Select only the state whose Git directory is the common Git directory; this
66
- is the repository's primary working tree.
67
- 3. Inspect that working tree's current branch and retain only `main` or
68
- `master`.
69
- 4. Return at most one project entry for each repository.
70
- 5. Never return linked-worktree roots, branches, or publication choices through
71
- the Web project catalog.
72
-
73
- When a primary working tree moves away from `main` or `master`, the project is
74
- absent until it returns. The viewer reads the most recent successfully published
75
- business map for that primary working tree even when newer source changes make
76
- the publication freshness `stale`. This is a browsing surface, not an indexing
77
- gate: it never indexes or repairs the repository merely to answer a map request.
78
- Missing, building, failed, or structurally incomplete publications remain
79
- unavailable because there is no complete published map to read.
80
-
81
- ## Read-only lifecycle
82
-
83
- `semantic-atlas web` starts one local server on `127.0.0.1`, optionally opens
84
- the default browser, and remains active until interrupted. The server exposes
85
- only the GET operations defined by [HTTP API v1](../contracts/http-api-v1.md).
86
-
87
- The viewer never:
88
-
89
- - invokes `index`, `learn`, GraphPatch, feedback mutation, or Git mutation;
90
- - edits source, tests, configuration, Skills, or generated project state;
91
- - accepts an arbitrary repository path from an HTTP client;
92
- - returns linked worktrees or permits branch selection;
93
- - exposes CodeGraph APIs, storage schema, structural search, or unrestricted
94
- source traversal.
95
-
96
- Reads for one repository are serialized. Every map, search, and node request
97
- uses the most recent complete publication for the current primary `main` or
98
- `master` working tree and retains the existing publication-change check. A
99
- publication change during a query fails the request instead of combining two
100
- snapshots.
101
-
102
- ## Desktop information architecture
103
-
104
- The first release targets desktop browsers only.
105
-
106
- ```text
107
- +------------------+-----------------------------------------------+
108
- | Projects | Breadcrumb Search |
109
- | +-----------------------------------------------+
110
- | semantic-atlas | |
111
- | sample-project | Visible business regions and relationships |
112
- | | |
113
- | | Detail panel |
114
- +------------------+-----------------------------------------------+
115
- ```
116
-
117
- - The left rail lists eligible `main` or `master` projects and their current
118
- publication state.
119
- - The header contains the current business breadcrumb and project-scoped
120
- business search.
121
- - The main surface starts with the top-level `BusinessMapView`, then reads a
122
- focused map only when the user enters that region or semantic zoom reaches
123
- its next level. It does not request or draw the full graph.
124
- - Selecting a region opens its business summary and direct relationships.
125
- - Entering an expandable region requests its focused map view. Breadcrumb
126
- selection returns to an established ancestor.
127
- - Search ranks existing business vocabulary. Selecting a result focuses its
128
- map view and node details.
129
-
130
- Business `kind` remains existing Atlas data. It informs the node color and the
131
- concise detail panel without adding a competing label to the map. Certainty and
132
- validity remain part of the read model, while this human browsing surface keeps
133
- the map focused on business names and available child counts.
134
-
135
- ### Spatial map interaction contract
136
-
137
- - The project hub is a virtual center. Top-level regions occupy a complete
138
- deterministic ring; children expand in the outward-facing sector of their
139
- parent. Existing positions never move when another branch is loaded.
140
- - Each selected project owns an in-memory map cache containing loaded focused
141
- maps, parentage, asserted connections, coordinates, camera state, and pending
142
- reads. It is cleared when the project changes and is never written to Atlas.
143
- - Hierarchy paths connect a node to its parent using neutral solid lines.
144
- Asserted or projected business relationships use a distinct highlighted line
145
- treatment without exposing raw relation labels on the map, so navigation
146
- topology is not presented as a stored business assertion.
147
- - Business regions are compact graph nodes, not content cards. Their label,
148
- and, when present, child count remain visible. Existing `kind`, validity,
149
- summaries, and evidence stay in the data model or concise detail panel rather
150
- than competing with business labels on the map. A leaf node has no secondary
151
- map text; an expandable node shows only its `N 项` child count.
152
- - Selecting a node opens its details. Selecting an expandable node loads its
153
- focused map once, moves the camera to it, and zooms to the next semantic
154
- level; selecting a leaf only centers it and reads its details. Breadcrumbs
155
- move the camera to loaded ancestors rather than switching a page.
156
- - Pointer drag pans the canvas. The wheel and controls zoom between `0.2` and
157
- `4.8`; wheel zoom remains anchored to the pointer. A fit control restores the
158
- complete loaded map.
159
- - The map toolbar offers an immersive desktop mode. It hides the project rail,
160
- surrounding navigation, and detail panel while preserving the selected node,
161
- loaded map cache, and camera context; the same control or `Escape` restores
162
- the normal product view.
163
- - Roots remain visible at every scale. Deeper levels appear at
164
- `0.55 * 1.6^(depth - 1)` and disappear visually below that threshold without
165
- deleting their cached maps, nodes, or coordinates. A relationship line is
166
- visible only while both of its endpoint regions are visible, so semantic
167
- zoom never leaves a line pointing to a hidden region. Crossing a threshold
168
- can load the nearby or selected expandable region.
169
- - Search selection fills any missing focused-map path, then moves the camera to
170
- the matching node and opens its details; it does not create a separate
171
- list-based navigation model.
172
-
173
- A card grid, tree list, or dashboard tile collection does not satisfy the map
174
- surface contract. Cards may appear in search results or supporting details,
175
- but they do not replace the spatial node-and-connection canvas.
176
-
177
- The visual language is a light, neutral product interface with strong
178
- typography, restrained color, legible topology, thin relationships, and short
179
- state transitions. It does not use game styling, character metaphors,
180
- decorative map textures, elaborate animation, or mobile-specific layouts.
181
-
182
- The desktop viewer uses Simplified Chinese for its fixed interface copy. It
183
- keeps authored business labels and summaries in their recorded language rather
184
- than attempting an unreliable browser-side translation. The normal view keeps
185
- only the project selector, compact path, search, map, camera controls, and a
186
- small business-detail panel. Decorative branding, project diagnostics, map
187
- legends, and instructional copy stay outside the primary viewing surface.
188
-
189
- The detail panel describes the selected business region with its summary, the
190
- existing business kind in the viewer locale, and nearby business names. It does
191
- not expose aliases, evidence files, source symbols, certainty or validity
192
- chips, raw relationship names, or incoming/outgoing direction. Those concepts
193
- remain part of the read API and Agent evidence model; the human viewer does not
194
- need them to browse business knowledge. Detail text and related-business names
195
- wrap within the panel so long recorded labels cannot overflow the layout.
196
-
197
- ## Empty and unavailable states
198
-
199
- - No eligible repositories: explain that the viewer lists only primary
200
- `main`/`master` working trees with Atlas state.
201
- - Missing business knowledge: show the existing
202
- `BUSINESS_KNOWLEDGE_EMPTY` state without substituting code directories.
203
- - Stale repository publication: continue to show the most recent complete
204
- primary-branch map. A later CLI or Agent index can refresh it, but browsing
205
- remains available in the meantime.
206
- - Stale assertion: retain the node vocabulary and label the summary or relation
207
- as stale.
208
- - Unknown project or node: return a typed not-found response without revealing
209
- filesystem candidates.
210
-
211
- ## Acceptance boundary
212
-
213
- The slice is complete when a packaged installation can start
214
- `semantic-atlas web`, list only primary `main`/`master` repositories, navigate a
215
- current world and focused views through a pannable and zoomable spatial map,
216
- search business nodes, inspect one node, serve no mutation endpoint, and leave
217
- source, Git state, Atlas knowledge, and the Agent CLI behavior unchanged.
218
-
219
- ## Related contracts
220
-
221
- - [Product contract](../product-contract.md)
222
- - [Graph model](../contracts/graph-model.md)
223
- - [CLI v1](../contracts/cli-v1.md)
224
- - [HTTP API v1](../contracts/http-api-v1.md)
225
- - [Continuous business learning](continuous-business-learning.md)