onto-mcp 0.3.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 (447) hide show
  1. package/.onto/authority/core-lens-registry.yaml +134 -0
  2. package/.onto/authority/core-lexicon.yaml +1562 -0
  3. package/.onto/authority/diagnostic-codes.yaml +94 -0
  4. package/.onto/domains/accounting/competency_qs.md +384 -0
  5. package/.onto/domains/accounting/concepts.md +186 -0
  6. package/.onto/domains/accounting/conciseness_rules.md +160 -0
  7. package/.onto/domains/accounting/dependency_rules.md +239 -0
  8. package/.onto/domains/accounting/domain_scope.md +213 -0
  9. package/.onto/domains/accounting/extension_cases.md +416 -0
  10. package/.onto/domains/accounting/logic_rules.md +226 -0
  11. package/.onto/domains/accounting/structure_spec.md +298 -0
  12. package/.onto/domains/accounting-kr/competency_qs.md +562 -0
  13. package/.onto/domains/accounting-kr/concepts.md +187 -0
  14. package/.onto/domains/accounting-kr/conciseness_rules.md +125 -0
  15. package/.onto/domains/accounting-kr/dependency_rules.md +93 -0
  16. package/.onto/domains/accounting-kr/domain_scope.md +140 -0
  17. package/.onto/domains/accounting-kr/extension_cases.md +343 -0
  18. package/.onto/domains/accounting-kr/logic_rules.md +160 -0
  19. package/.onto/domains/accounting-kr/structure_spec.md +85 -0
  20. package/.onto/domains/business/competency_qs.md +263 -0
  21. package/.onto/domains/business/concepts.md +200 -0
  22. package/.onto/domains/business/conciseness_rules.md +135 -0
  23. package/.onto/domains/business/dependency_rules.md +113 -0
  24. package/.onto/domains/business/domain_scope.md +240 -0
  25. package/.onto/domains/business/extension_cases.md +249 -0
  26. package/.onto/domains/business/logic_rules.md +134 -0
  27. package/.onto/domains/business/structure_spec.md +114 -0
  28. package/.onto/domains/finance/competency_qs.md +362 -0
  29. package/.onto/domains/finance/concepts.md +194 -0
  30. package/.onto/domains/finance/conciseness_rules.md +155 -0
  31. package/.onto/domains/finance/dependency_rules.md +171 -0
  32. package/.onto/domains/finance/domain_scope.md +215 -0
  33. package/.onto/domains/finance/extension_cases.md +350 -0
  34. package/.onto/domains/finance/logic_rules.md +191 -0
  35. package/.onto/domains/finance/structure_spec.md +182 -0
  36. package/.onto/domains/llm-native-development/competency_qs.md +430 -0
  37. package/.onto/domains/llm-native-development/concepts.md +242 -0
  38. package/.onto/domains/llm-native-development/conciseness_rules.md +163 -0
  39. package/.onto/domains/llm-native-development/dependency_rules.md +216 -0
  40. package/.onto/domains/llm-native-development/domain_scope.md +197 -0
  41. package/.onto/domains/llm-native-development/extension_cases.md +474 -0
  42. package/.onto/domains/llm-native-development/logic_rules.md +123 -0
  43. package/.onto/domains/llm-native-development/prompt_interface.md +49 -0
  44. package/.onto/domains/llm-native-development/structure_spec.md +245 -0
  45. package/.onto/domains/market-intelligence/competency_qs.md +274 -0
  46. package/.onto/domains/market-intelligence/concepts.md +233 -0
  47. package/.onto/domains/market-intelligence/conciseness_rules.md +165 -0
  48. package/.onto/domains/market-intelligence/dependency_rules.md +197 -0
  49. package/.onto/domains/market-intelligence/domain_scope.md +231 -0
  50. package/.onto/domains/market-intelligence/extension_cases.md +425 -0
  51. package/.onto/domains/market-intelligence/logic_rules.md +247 -0
  52. package/.onto/domains/market-intelligence/structure_spec.md +209 -0
  53. package/.onto/domains/ontology/competency_qs.md +394 -0
  54. package/.onto/domains/ontology/concepts.md +172 -0
  55. package/.onto/domains/ontology/conciseness_rules.md +134 -0
  56. package/.onto/domains/ontology/dependency_rules.md +125 -0
  57. package/.onto/domains/ontology/domain_scope.md +114 -0
  58. package/.onto/domains/ontology/extension_cases.md +501 -0
  59. package/.onto/domains/ontology/logic_rules.md +114 -0
  60. package/.onto/domains/ontology/problem_framing_profile.md +67 -0
  61. package/.onto/domains/ontology/structure_spec.md +115 -0
  62. package/.onto/domains/palantir-foundry/RESEARCH_NOTES.md +911 -0
  63. package/.onto/domains/palantir-foundry/competency_qs.md +191 -0
  64. package/.onto/domains/palantir-foundry/competitive_comparison.md +329 -0
  65. package/.onto/domains/palantir-foundry/concepts.md +197 -0
  66. package/.onto/domains/palantir-foundry/conciseness_rules.md +245 -0
  67. package/.onto/domains/palantir-foundry/dependency_rules.md +135 -0
  68. package/.onto/domains/palantir-foundry/domain_scope.md +395 -0
  69. package/.onto/domains/palantir-foundry/extension_cases.md +210 -0
  70. package/.onto/domains/palantir-foundry/logic_rules.md +172 -0
  71. package/.onto/domains/palantir-foundry/structure_spec.md +291 -0
  72. package/.onto/domains/software-engineering/competency_qs.md +538 -0
  73. package/.onto/domains/software-engineering/concepts.md +238 -0
  74. package/.onto/domains/software-engineering/conciseness_rules.md +167 -0
  75. package/.onto/domains/software-engineering/dependency_rules.md +216 -0
  76. package/.onto/domains/software-engineering/domain_scope.md +183 -0
  77. package/.onto/domains/software-engineering/extension_cases.md +551 -0
  78. package/.onto/domains/software-engineering/logic_rules.md +240 -0
  79. package/.onto/domains/software-engineering/problem_framing_profile.md +68 -0
  80. package/.onto/domains/software-engineering/structure_spec.md +185 -0
  81. package/.onto/domains/ui-design/competency_qs.md +567 -0
  82. package/.onto/domains/ui-design/concepts.md +194 -0
  83. package/.onto/domains/ui-design/conciseness_rules.md +190 -0
  84. package/.onto/domains/ui-design/dependency_rules.md +323 -0
  85. package/.onto/domains/ui-design/domain_scope.md +340 -0
  86. package/.onto/domains/ui-design/extension_cases.md +563 -0
  87. package/.onto/domains/ui-design/logic_rules.md +349 -0
  88. package/.onto/domains/ui-design/structure_spec.md +252 -0
  89. package/.onto/domains/visual-design/competency_qs.md +472 -0
  90. package/.onto/domains/visual-design/concepts.md +147 -0
  91. package/.onto/domains/visual-design/conciseness_rules.md +186 -0
  92. package/.onto/domains/visual-design/dependency_rules.md +282 -0
  93. package/.onto/domains/visual-design/domain_scope.md +290 -0
  94. package/.onto/domains/visual-design/extension_cases.md +480 -0
  95. package/.onto/domains/visual-design/logic_rules.md +232 -0
  96. package/.onto/domains/visual-design/structure_spec.md +213 -0
  97. package/.onto/principles/llm-native-development-guideline.md +401 -0
  98. package/.onto/principles/llm-runtime-interface-principles.md +665 -0
  99. package/.onto/principles/non-specialist-communication-guideline.md +74 -0
  100. package/.onto/principles/ontology-as-code-guideline.md +243 -0
  101. package/.onto/principles/ontology-as-code-naming-charter.md +130 -0
  102. package/.onto/principles/product-locality-principle.md +129 -0
  103. package/.onto/principles/productization-charter.md +569 -0
  104. package/.onto/processes/evolve/material-kind-adapter-contract.md +113 -0
  105. package/.onto/processes/reconstruct/reconstruct-boundary-contract.md +366 -0
  106. package/.onto/processes/reconstruct/source-profile-contract.md +107 -0
  107. package/.onto/processes/reconstruct/source-profiles/code.md +72 -0
  108. package/.onto/processes/reconstruct/source-profiles/database.md +74 -0
  109. package/.onto/processes/reconstruct/source-profiles/document.md +71 -0
  110. package/.onto/processes/reconstruct/source-profiles/spreadsheet.md +79 -0
  111. package/.onto/processes/review/binding-contract.md +270 -0
  112. package/.onto/processes/review/execution-preparation-artifacts.md +281 -0
  113. package/.onto/processes/review/interpretation-contract.md +245 -0
  114. package/.onto/processes/review/issue-stance-deliberation-contract.md +761 -0
  115. package/.onto/processes/review/lens-prompt-contract.md +402 -0
  116. package/.onto/processes/review/lens-registry.md +127 -0
  117. package/.onto/processes/review/pre-dispatch-contracts.md +428 -0
  118. package/.onto/processes/review/productized-live-path.md +398 -0
  119. package/.onto/processes/review/prompt-execution-runner-contract.md +187 -0
  120. package/.onto/processes/review/record-contract.md +427 -0
  121. package/.onto/processes/review/record-field-mapping.md +337 -0
  122. package/.onto/processes/review/review-context-manifest-contract.md +356 -0
  123. package/.onto/processes/review/review-execution-ux-contract.md +809 -0
  124. package/.onto/processes/review/review-target-profile-contract.md +259 -0
  125. package/.onto/processes/review/shared-phenomenon-contract.md +129 -0
  126. package/.onto/processes/review/synthesize-prompt-contract.md +343 -0
  127. package/.onto/processes/shared/target-material-kind-contract.md +198 -0
  128. package/.onto/roles/axiology.md +81 -0
  129. package/.onto/roles/conciseness.md +36 -0
  130. package/.onto/roles/coverage.md +34 -0
  131. package/.onto/roles/dependency.md +37 -0
  132. package/.onto/roles/evolution.md +35 -0
  133. package/.onto/roles/logic.md +104 -0
  134. package/.onto/roles/pragmatics.md +32 -0
  135. package/.onto/roles/semantics.md +36 -0
  136. package/.onto/roles/structure.md +33 -0
  137. package/.onto/roles/synthesize.md +92 -0
  138. package/AGENTS.md +240 -0
  139. package/CLAUDE.md +39 -0
  140. package/README.md +287 -0
  141. package/bin/onto +92 -0
  142. package/dist/cli.js +101 -0
  143. package/dist/core-api/reconstruct-api.js +222 -0
  144. package/dist/core-api/review-api.js +1271 -0
  145. package/dist/core-runtime/cli/assemble-review-record.js +431 -0
  146. package/dist/core-runtime/cli/bootstrap-review-binding.js +186 -0
  147. package/dist/core-runtime/cli/codex-nested-dispatch.js +226 -0
  148. package/dist/core-runtime/cli/codex-nested-dispatch.test.js +390 -0
  149. package/dist/core-runtime/cli/codex-nested-teamlead-executor.js +464 -0
  150. package/dist/core-runtime/cli/codex-nested-teamlead-executor.test.js +335 -0
  151. package/dist/core-runtime/cli/codex-review-unit-executor.js +228 -0
  152. package/dist/core-runtime/cli/complete-review-session.js +64 -0
  153. package/dist/core-runtime/cli/complexity-assessment.js +153 -0
  154. package/dist/core-runtime/cli/coordinator-helpers.js +583 -0
  155. package/dist/core-runtime/cli/coordinator-state-machine-deliberation.test.js +167 -0
  156. package/dist/core-runtime/cli/coordinator-state-machine.js +794 -0
  157. package/dist/core-runtime/cli/e2e-codex-multi-agent-fixes.test.js +615 -0
  158. package/dist/core-runtime/cli/e2e-start-review-session.test.js +312 -0
  159. package/dist/core-runtime/cli/health.js +44 -0
  160. package/dist/core-runtime/cli/inline-http-review-unit-executor.js +656 -0
  161. package/dist/core-runtime/cli/inline-http-review-unit-executor.test.js +567 -0
  162. package/dist/core-runtime/cli/materialize-review-execution-preparation.js +104 -0
  163. package/dist/core-runtime/cli/materialize-review-prompt-packets.js +952 -0
  164. package/dist/core-runtime/cli/migrate-session-roots.js +118 -0
  165. package/dist/core-runtime/cli/mock-review-unit-executor.js +285 -0
  166. package/dist/core-runtime/cli/onto-tools.js +369 -0
  167. package/dist/core-runtime/cli/prepare-review-session.js +272 -0
  168. package/dist/core-runtime/cli/render-review-final-output.js +350 -0
  169. package/dist/core-runtime/cli/repo-layout-migration-replace.smoke.test.js +106 -0
  170. package/dist/core-runtime/cli/review-invoke-auto-resolution.test.js +268 -0
  171. package/dist/core-runtime/cli/review-invoke-coordinator-topology.test.js +136 -0
  172. package/dist/core-runtime/cli/review-invoke-resolver-caching.test.js +201 -0
  173. package/dist/core-runtime/cli/review-invoke-topology-dispatch.test.js +192 -0
  174. package/dist/core-runtime/cli/review-invoke.js +2030 -0
  175. package/dist/core-runtime/cli/run-review-prompt-execution.js +2152 -0
  176. package/dist/core-runtime/cli/session-root-guard.js +168 -0
  177. package/dist/core-runtime/cli/spawn-watcher.js +173 -0
  178. package/dist/core-runtime/cli/spawn-watcher.test.js +457 -0
  179. package/dist/core-runtime/cli/start-review-session.js +68 -0
  180. package/dist/core-runtime/cli/strip-wrapping-code-fence.js +56 -0
  181. package/dist/core-runtime/cli/strip-wrapping-code-fence.test.js +79 -0
  182. package/dist/core-runtime/cli/teamcreate-lens-deliberation-executor.js +412 -0
  183. package/dist/core-runtime/cli/teamcreate-lens-deliberation-executor.test.js +351 -0
  184. package/dist/core-runtime/cli/topology-executor-mapping.js +139 -0
  185. package/dist/core-runtime/cli/topology-executor-mapping.test.js +173 -0
  186. package/dist/core-runtime/cli/write-review-interpretation.js +81 -0
  187. package/dist/core-runtime/config/onto-config-cli.js +278 -0
  188. package/dist/core-runtime/config/onto-config-key-path.js +288 -0
  189. package/dist/core-runtime/config/onto-config-key-path.test.js +195 -0
  190. package/dist/core-runtime/config/onto-config-preview.js +108 -0
  191. package/dist/core-runtime/config/onto-config-preview.test.js +132 -0
  192. package/dist/core-runtime/discovery/config-chain.js +118 -0
  193. package/dist/core-runtime/discovery/config-chain.test.js +103 -0
  194. package/dist/core-runtime/discovery/config-profile.js +199 -0
  195. package/dist/core-runtime/discovery/config-profile.test.js +233 -0
  196. package/dist/core-runtime/discovery/host-detection.js +33 -0
  197. package/dist/core-runtime/discovery/host-detection.test.js +186 -0
  198. package/dist/core-runtime/discovery/installation-paths.js +21 -0
  199. package/dist/core-runtime/discovery/installation-paths.test.js +65 -0
  200. package/dist/core-runtime/discovery/lens-registry.js +60 -0
  201. package/dist/core-runtime/discovery/lens-registry.test.js +81 -0
  202. package/dist/core-runtime/discovery/onto-home.js +71 -0
  203. package/dist/core-runtime/discovery/path-normalization.js +28 -0
  204. package/dist/core-runtime/discovery/path-normalization.test.js +22 -0
  205. package/dist/core-runtime/discovery/plugin-path.js +72 -0
  206. package/dist/core-runtime/discovery/plugin-path.test.js +95 -0
  207. package/dist/core-runtime/discovery/project-root.js +47 -0
  208. package/dist/core-runtime/discovery/settings-chain.js +353 -0
  209. package/dist/core-runtime/discovery/walk-up.js +17 -0
  210. package/dist/core-runtime/evolve/adapters/code-product/compile/compile-defense.js +344 -0
  211. package/dist/core-runtime/evolve/adapters/code-product/compile/compile-defense.test.js +915 -0
  212. package/dist/core-runtime/evolve/adapters/code-product/compile/compile.js +564 -0
  213. package/dist/core-runtime/evolve/adapters/code-product/compile/compile.test.js +708 -0
  214. package/dist/core-runtime/evolve/adapters/code-product/parsers/brief-parser.js +165 -0
  215. package/dist/core-runtime/evolve/adapters/code-product/parsers/brief-parser.test.js +227 -0
  216. package/dist/core-runtime/evolve/adapters/code-product/validators/validate.js +59 -0
  217. package/dist/core-runtime/evolve/adapters/code-product/validators/validate.test.js +205 -0
  218. package/dist/core-runtime/evolve/adapters/methodology/adapter.js +16 -0
  219. package/dist/core-runtime/evolve/adapters/methodology/adapter.test.js +9 -0
  220. package/dist/core-runtime/evolve/adapters/methodology/perspectives/authority-consistency.js +298 -0
  221. package/dist/core-runtime/evolve/adapters/methodology/perspectives/authority-consistency.test.js +70 -0
  222. package/dist/core-runtime/evolve/adapters/methodology/scope-types/process.js +46 -0
  223. package/dist/core-runtime/evolve/adapters/methodology/scope-types/process.test.js +73 -0
  224. package/dist/core-runtime/evolve/adapters/registry.js +47 -0
  225. package/dist/core-runtime/evolve/adapters/registry.test.js +67 -0
  226. package/dist/core-runtime/evolve/cli.js +256 -0
  227. package/dist/core-runtime/evolve/commands/align.js +194 -0
  228. package/dist/core-runtime/evolve/commands/align.test.js +82 -0
  229. package/dist/core-runtime/evolve/commands/apply.js +161 -0
  230. package/dist/core-runtime/evolve/commands/apply.test.js +138 -0
  231. package/dist/core-runtime/evolve/commands/close.js +39 -0
  232. package/dist/core-runtime/evolve/commands/close.test.js +99 -0
  233. package/dist/core-runtime/evolve/commands/defer.js +40 -0
  234. package/dist/core-runtime/evolve/commands/defer.test.js +134 -0
  235. package/dist/core-runtime/evolve/commands/draft.js +323 -0
  236. package/dist/core-runtime/evolve/commands/draft.test.js +178 -0
  237. package/dist/core-runtime/evolve/commands/e2e-evolve-full-cycle.test.js +208 -0
  238. package/dist/core-runtime/evolve/commands/error-messages.js +125 -0
  239. package/dist/core-runtime/evolve/commands/error-messages.test.js +167 -0
  240. package/dist/core-runtime/evolve/commands/propose-align.js +222 -0
  241. package/dist/core-runtime/evolve/commands/propose-align.test.js +136 -0
  242. package/dist/core-runtime/evolve/commands/reconstruct.js +330 -0
  243. package/dist/core-runtime/evolve/commands/reconstruct.test.js +278 -0
  244. package/dist/core-runtime/evolve/commands/shared.js +22 -0
  245. package/dist/core-runtime/evolve/commands/stale-check.js +103 -0
  246. package/dist/core-runtime/evolve/commands/stale-check.test.js +84 -0
  247. package/dist/core-runtime/evolve/commands/start.js +887 -0
  248. package/dist/core-runtime/evolve/commands/start.test.js +396 -0
  249. package/dist/core-runtime/evolve/config/project-config.js +99 -0
  250. package/dist/core-runtime/evolve/config/project-config.test.js +170 -0
  251. package/dist/core-runtime/evolve/renderers/align-packet.js +280 -0
  252. package/dist/core-runtime/evolve/renderers/align-packet.test.js +332 -0
  253. package/dist/core-runtime/evolve/renderers/draft-packet.js +303 -0
  254. package/dist/core-runtime/evolve/renderers/draft-packet.test.js +377 -0
  255. package/dist/core-runtime/evolve/renderers/format.js +5 -0
  256. package/dist/core-runtime/evolve/renderers/scope-md.js +237 -0
  257. package/dist/core-runtime/evolve/renderers/scope-md.test.js +306 -0
  258. package/dist/core-runtime/govern/cli.js +369 -0
  259. package/dist/core-runtime/govern/cli.test.js +314 -0
  260. package/dist/core-runtime/govern/drift-engine.js +103 -0
  261. package/dist/core-runtime/govern/drift-engine.test.js +319 -0
  262. package/dist/core-runtime/govern/promote-principle.js +206 -0
  263. package/dist/core-runtime/govern/promote-principle.test.js +368 -0
  264. package/dist/core-runtime/govern/queue.js +81 -0
  265. package/dist/core-runtime/govern/types.js +16 -0
  266. package/dist/core-runtime/install/cli.js +530 -0
  267. package/dist/core-runtime/install/detect.js +128 -0
  268. package/dist/core-runtime/install/detect.test.js +155 -0
  269. package/dist/core-runtime/install/gitignore-update.js +74 -0
  270. package/dist/core-runtime/install/gitignore-update.test.js +64 -0
  271. package/dist/core-runtime/install/install-integration.test.js +373 -0
  272. package/dist/core-runtime/install/prompts.js +389 -0
  273. package/dist/core-runtime/install/prompts.test.js +293 -0
  274. package/dist/core-runtime/install/types.js +26 -0
  275. package/dist/core-runtime/install/validation.js +295 -0
  276. package/dist/core-runtime/install/validation.test.js +313 -0
  277. package/dist/core-runtime/install/writer.js +254 -0
  278. package/dist/core-runtime/install/writer.test.js +218 -0
  279. package/dist/core-runtime/learning/extractor.js +461 -0
  280. package/dist/core-runtime/learning/feedback.js +179 -0
  281. package/dist/core-runtime/learning/health-report.js +165 -0
  282. package/dist/core-runtime/learning/health-report.test.js +169 -0
  283. package/dist/core-runtime/learning/loader.js +388 -0
  284. package/dist/core-runtime/learning/loader.test.js +102 -0
  285. package/dist/core-runtime/learning/promote/apply-state.js +240 -0
  286. package/dist/core-runtime/learning/promote/audit-obligation.js +195 -0
  287. package/dist/core-runtime/learning/promote/collector.js +432 -0
  288. package/dist/core-runtime/learning/promote/degraded-state.js +125 -0
  289. package/dist/core-runtime/learning/promote/domain-doc-proposer.js +166 -0
  290. package/dist/core-runtime/learning/promote/e2e-promote.test.js +6385 -0
  291. package/dist/core-runtime/learning/promote/health-snapshot.js +150 -0
  292. package/dist/core-runtime/learning/promote/insight-reclassifier.js +544 -0
  293. package/dist/core-runtime/learning/promote/judgment-auditor.js +517 -0
  294. package/dist/core-runtime/learning/promote/panel-reviewer.js +1158 -0
  295. package/dist/core-runtime/learning/promote/promote-executor.js +1675 -0
  296. package/dist/core-runtime/learning/promote/promoter.js +307 -0
  297. package/dist/core-runtime/learning/promote/retirement.js +122 -0
  298. package/dist/core-runtime/learning/promote/types.js +23 -0
  299. package/dist/core-runtime/learning/prompt-sections.js +51 -0
  300. package/dist/core-runtime/learning/shared/artifact-registry-init.js +45 -0
  301. package/dist/core-runtime/learning/shared/artifact-registry.js +254 -0
  302. package/dist/core-runtime/learning/shared/audit-obligation-kernel.js +73 -0
  303. package/dist/core-runtime/learning/shared/audit-state.js +99 -0
  304. package/dist/core-runtime/learning/shared/duplicate-check.js +28 -0
  305. package/dist/core-runtime/learning/shared/llm-caller.js +831 -0
  306. package/dist/core-runtime/learning/shared/llm-caller.test.js +601 -0
  307. package/dist/core-runtime/learning/shared/llm-tool-loop.js +393 -0
  308. package/dist/core-runtime/learning/shared/mode.js +25 -0
  309. package/dist/core-runtime/learning/shared/paths.js +84 -0
  310. package/dist/core-runtime/learning/shared/paths.test.js +79 -0
  311. package/dist/core-runtime/learning/shared/patterns.js +37 -0
  312. package/dist/core-runtime/learning/shared/recoverability.js +355 -0
  313. package/dist/core-runtime/learning/shared/recovery-context.js +374 -0
  314. package/dist/core-runtime/learning/shared/scope.js +1 -0
  315. package/dist/core-runtime/learning/shared/semantic-classifier.js +94 -0
  316. package/dist/core-runtime/learning/shared/specs/apply-execution-state-spec.js +42 -0
  317. package/dist/core-runtime/learning/shared/specs/audit-state-spec.js +37 -0
  318. package/dist/core-runtime/learning/shared/specs/backup-metadata-spec.js +39 -0
  319. package/dist/core-runtime/learning/shared/specs/emergency-log-spec.js +41 -0
  320. package/dist/core-runtime/learning/shared/specs/layout-version-spec.js +38 -0
  321. package/dist/core-runtime/learning/shared/specs/promote-decisions-spec.js +43 -0
  322. package/dist/core-runtime/learning/shared/specs/promote-report-spec.js +113 -0
  323. package/dist/core-runtime/learning/shared/specs/prune-log-spec.js +36 -0
  324. package/dist/core-runtime/learning/shared/specs/recovery-resolution-spec.js +48 -0
  325. package/dist/core-runtime/learning/shared/specs/restore-manifest-spec.js +43 -0
  326. package/dist/core-runtime/learning/shared/specs/spec-helpers.js +64 -0
  327. package/dist/core-runtime/learning/usage-tracker.js +190 -0
  328. package/dist/core-runtime/learning/usage-tracker.test.js +176 -0
  329. package/dist/core-runtime/llm/llm-caller.js +649 -0
  330. package/dist/core-runtime/llm/llm-tool-loop.js +401 -0
  331. package/dist/core-runtime/llm/model-switcher.js +62 -0
  332. package/dist/core-runtime/logger.js +22 -0
  333. package/dist/core-runtime/onboard/detect-review-axes.js +122 -0
  334. package/dist/core-runtime/onboard/detect-review-axes.test.js +127 -0
  335. package/dist/core-runtime/onboard/write-review-block.js +188 -0
  336. package/dist/core-runtime/onboard/write-review-block.test.js +240 -0
  337. package/dist/core-runtime/readers/brownfield-builder.js +150 -0
  338. package/dist/core-runtime/readers/brownfield-builder.test.js +136 -0
  339. package/dist/core-runtime/readers/code-chunk-collector.js +53 -0
  340. package/dist/core-runtime/readers/code-chunk-collector.test.js +136 -0
  341. package/dist/core-runtime/readers/file-utils.js +240 -0
  342. package/dist/core-runtime/readers/file-utils.test.js +146 -0
  343. package/dist/core-runtime/readers/lexicon-citation-check.js +93 -0
  344. package/dist/core-runtime/readers/lexicon-citation-check.test.js +77 -0
  345. package/dist/core-runtime/readers/mcp-figma.js +30 -0
  346. package/dist/core-runtime/readers/mcp-figma.test.js +82 -0
  347. package/dist/core-runtime/readers/mcp-generic.js +31 -0
  348. package/dist/core-runtime/readers/mcp-generic.test.js +76 -0
  349. package/dist/core-runtime/readers/ontology-index.js +148 -0
  350. package/dist/core-runtime/readers/ontology-index.test.js +245 -0
  351. package/dist/core-runtime/readers/ontology-query.js +168 -0
  352. package/dist/core-runtime/readers/ontology-query.test.js +311 -0
  353. package/dist/core-runtime/readers/ontology-resolve.js +48 -0
  354. package/dist/core-runtime/readers/ontology-resolve.test.js +48 -0
  355. package/dist/core-runtime/readers/patterns/index.js +7 -0
  356. package/dist/core-runtime/readers/review-log.js +213 -0
  357. package/dist/core-runtime/readers/review-log.test.js +313 -0
  358. package/dist/core-runtime/readers/scan-local.js +102 -0
  359. package/dist/core-runtime/readers/scan-local.test.js +102 -0
  360. package/dist/core-runtime/readers/scan-tarball.js +121 -0
  361. package/dist/core-runtime/readers/scan-tarball.test.js +283 -0
  362. package/dist/core-runtime/readers/scan-vault.js +34 -0
  363. package/dist/core-runtime/readers/scan-vault.test.js +81 -0
  364. package/dist/core-runtime/readers/types.js +42 -0
  365. package/dist/core-runtime/readers/types.test.js +94 -0
  366. package/dist/core-runtime/readers/viewpoint-collectors.js +229 -0
  367. package/dist/core-runtime/reconstruct/artifact-types.js +1 -0
  368. package/dist/core-runtime/reconstruct/directive-validation.js +123 -0
  369. package/dist/core-runtime/reconstruct/materialize-preparation.js +251 -0
  370. package/dist/core-runtime/reconstruct/record.js +198 -0
  371. package/dist/core-runtime/reconstruct/run.js +578 -0
  372. package/dist/core-runtime/reconstruct/seed-candidate-validation.js +356 -0
  373. package/dist/core-runtime/reconstruct/source-observations.js +62 -0
  374. package/dist/core-runtime/reconstruct/source-profiles.js +73 -0
  375. package/dist/core-runtime/release-channel/release-channel.js +90 -0
  376. package/dist/core-runtime/review/artifact-types.js +13 -0
  377. package/dist/core-runtime/review/citation-audit.js +204 -0
  378. package/dist/core-runtime/review/citation-audit.test.js +165 -0
  379. package/dist/core-runtime/review/controlled-lens-deliberation.js +125 -0
  380. package/dist/core-runtime/review/execution-plan-resolver.js +247 -0
  381. package/dist/core-runtime/review/execution-plan-resolver.test.js +243 -0
  382. package/dist/core-runtime/review/execution-topology-resolver-axis-first.test.js +246 -0
  383. package/dist/core-runtime/review/execution-topology-resolver.js +401 -0
  384. package/dist/core-runtime/review/execution-topology-resolver.test.js +315 -0
  385. package/dist/core-runtime/review/failure-records.js +57 -0
  386. package/dist/core-runtime/review/inline-context-embedder.js +141 -0
  387. package/dist/core-runtime/review/inline-context-embedder.test.js +154 -0
  388. package/dist/core-runtime/review/issue-artifact-runtime.js +859 -0
  389. package/dist/core-runtime/review/legacy-mode-policy.js +88 -0
  390. package/dist/core-runtime/review/lens-completion-policy.js +17 -0
  391. package/dist/core-runtime/review/materializers-effort-persist.test.js +79 -0
  392. package/dist/core-runtime/review/materializers.js +963 -0
  393. package/dist/core-runtime/review/ontology-path-classifier.js +179 -0
  394. package/dist/core-runtime/review/ontology-path-classifier.test.js +216 -0
  395. package/dist/core-runtime/review/packet-boundary-policy.js +215 -0
  396. package/dist/core-runtime/review/packet-boundary-policy.test.js +107 -0
  397. package/dist/core-runtime/review/participating-lens-paths.js +61 -0
  398. package/dist/core-runtime/review/participating-lens-paths.test.js +73 -0
  399. package/dist/core-runtime/review/review-artifact-utils.js +287 -0
  400. package/dist/core-runtime/review/review-config-legacy-translate.js +244 -0
  401. package/dist/core-runtime/review/review-config-legacy-translate.test.js +161 -0
  402. package/dist/core-runtime/review/review-config-validator.js +289 -0
  403. package/dist/core-runtime/review/review-config-validator.test.js +236 -0
  404. package/dist/core-runtime/review/review-execution-profile.js +193 -0
  405. package/dist/core-runtime/review/review-execution-route.js +52 -0
  406. package/dist/core-runtime/review/review-progress-contract.js +123 -0
  407. package/dist/core-runtime/review/review-record-validation.js +251 -0
  408. package/dist/core-runtime/review/review-result-classification.js +379 -0
  409. package/dist/core-runtime/review/review-state-machine.js +39 -0
  410. package/dist/core-runtime/review/route-visibility.js +125 -0
  411. package/dist/core-runtime/review/shape-pipeline-audit.test.js +311 -0
  412. package/dist/core-runtime/review/shape-to-topology-id.js +117 -0
  413. package/dist/core-runtime/review/shape-to-topology-id.test.js +132 -0
  414. package/dist/core-runtime/review/topology-shape-derivation.js +155 -0
  415. package/dist/core-runtime/review/topology-shape-derivation.test.js +195 -0
  416. package/dist/core-runtime/scope-runtime/constants.js +12 -0
  417. package/dist/core-runtime/scope-runtime/constraint-pool.js +166 -0
  418. package/dist/core-runtime/scope-runtime/constraint-pool.test.js +674 -0
  419. package/dist/core-runtime/scope-runtime/domain-validation-log.js +135 -0
  420. package/dist/core-runtime/scope-runtime/domain-validation-log.test.js +156 -0
  421. package/dist/core-runtime/scope-runtime/eval-persistence.js +65 -0
  422. package/dist/core-runtime/scope-runtime/eval-persistence.test.js +84 -0
  423. package/dist/core-runtime/scope-runtime/event-pipeline.js +64 -0
  424. package/dist/core-runtime/scope-runtime/event-pipeline.test.js +450 -0
  425. package/dist/core-runtime/scope-runtime/event-store.js +39 -0
  426. package/dist/core-runtime/scope-runtime/event-store.test.js +95 -0
  427. package/dist/core-runtime/scope-runtime/gate-guard.js +348 -0
  428. package/dist/core-runtime/scope-runtime/gate-guard.test.js +1047 -0
  429. package/dist/core-runtime/scope-runtime/hash.js +4 -0
  430. package/dist/core-runtime/scope-runtime/hash.test.js +33 -0
  431. package/dist/core-runtime/scope-runtime/id.js +4 -0
  432. package/dist/core-runtime/scope-runtime/id.test.js +17 -0
  433. package/dist/core-runtime/scope-runtime/reducer.js +297 -0
  434. package/dist/core-runtime/scope-runtime/reducer.test.js +759 -0
  435. package/dist/core-runtime/scope-runtime/scope-manager.js +161 -0
  436. package/dist/core-runtime/scope-runtime/state-machine.js +309 -0
  437. package/dist/core-runtime/scope-runtime/state-machine.test.js +704 -0
  438. package/dist/core-runtime/scope-runtime/types.js +116 -0
  439. package/dist/core-runtime/scope-runtime/types.test.js +69 -0
  440. package/dist/core-runtime/target-material-kind.js +256 -0
  441. package/dist/core-runtime/translate/render-for-user.js +169 -0
  442. package/dist/core-runtime/translate/render-for-user.test.js +122 -0
  443. package/dist/mcp/server.js +1011 -0
  444. package/dist/mcp/tool-schemas.js +93 -0
  445. package/dist/providers/capability-contract.js +1 -0
  446. package/package.json +68 -0
  447. package/settings.example.json +33 -0
@@ -0,0 +1,172 @@
1
+ ---
2
+ version: 3
3
+ last_updated: "2026-03-31"
4
+ source: manual
5
+ status: established
6
+ ---
7
+
8
+ # Palantir Foundry Domain — Logic Rules
9
+
10
+ ## Object Type Definition Rules
11
+
12
+ - Every Object Type must have a primary_key defined. An Object Type without a primary_key cannot uniquely identify instances, making Link Type connections impossible
13
+ - If Properties with the same name within an Object Type are defined with different types, it is a contradiction. Resolve by: (a) renaming one Property to distinguish meaning, or (b) extracting as Shared Property per conciseness_rules.md Section 1 criteria
14
+ - An Object Type's description and its properties must describe the same subject. If the description says "Order" but the properties contain only attributes unrelated to orders, it is a contradiction
15
+ - Enum values must be mutually exclusive (ME). A single instance must not be able to hold two Enum values simultaneously
16
+
17
+ ## Link Type Rules
18
+
19
+ - The direction of a Link Type (source -> target) must match the business meaning. In "Order has Payment," Order is the source and Payment is the target
20
+ - Cardinality must match actual business rules. If "1 order = 1 payment," then one-to-one; if "1 order = N payments," then one-to-many. Cardinality errors break data integrity
21
+ - Multiple Link Types with different meanings may exist for the same source-target pair. In such cases, each Link Type's meaning must be distinguishable
22
+
23
+ ## Change Classification Rules
24
+
25
+ - 변경은 두 개의 직교축으로 분류된다: Impact Severity (non_breaking / breaking_minor / breaking_major)와 Lifecycle Intent (immediate / deprecation). Impact Severity와 Lifecycle Intent는 직교축이다. 단일 변경에 두 축의 값이 동시에 부여된다
26
+ - Impact Severity 값은 상호 배타적(ME)이다. 단일 변경은 non_breaking, breaking_minor, breaking_major 중 정확히 하나의 값을 가진다
27
+ - breaking_major is not a superset of breaking_minor. Each classification is determined by independent criteria (impact scope, degree of compatibility breakage)
28
+ - Changing a Property type (e.g., String -> Integer) is always breaking_major + immediate. This is because existing data requires conversion
29
+ - Adding an enum value is breaking_minor + immediate. This is because existing code may not handle the new value
30
+ - Removing an enum value is breaking_major + deprecation. This is because existing data may be using that value; grace period is required before removal
31
+
32
+ ## Governance Rules
33
+
34
+ - Approval authority level is determined by Impact Severity. Lifecycle Intent가 deprecation인 경우 추가 승인 요건이 적용된다. Approval cannot proceed without both axes classified
35
+ - Changes that directly affect operational metrics require additional executive approval regardless of Impact Severity or Lifecycle Intent. (Ref: domain_scope.md "Approval Authority")
36
+ - Deprecation (Lifecycle Intent) must include a grace period. Deprecation without a grace period is functionally identical to immediate removal and violates the obligation to provide advance notice to integrated systems
37
+
38
+ ## Data Layer Rules
39
+
40
+ - Lower layers (Master Data) do not reference upper layers (Transaction, Derived). Reverse references create circular dependencies that prevent guaranteed data update ordering
41
+ - Derived Data must be traceable back to source records in the Transaction and Master layers. If tracing back is impossible, auditing is impossible
42
+ - Master Data changes propagate to all upper layers. Therefore, Master Data changes have the widest impact scope and tend to be classified as breaking_major
43
+
44
+ ## Temporal and Ordering Rules
45
+
46
+ [관찰→참여] Action execution and Rule evaluation follow deterministic ordering. Unpredictable ordering breaks transactional guarantees. (Ref: Palantir Action Types Overview)
47
+
48
+ - Rule evaluation within an Action is sequential. Later rules on the same property override earlier ones. If the final value depends on evaluation order and the order is not intentional, this is a latent conflict
49
+ - When a webhook is configured as writeback, it executes before other rules. If the webhook fails, all changes are cancelled — no partial commits occur. This is a simplified saga pattern: external system confirmation is a precondition for ontology mutation
50
+ - Function-Backed Actions execute asynchronously relative to the caller. The caller receives a confirmation that the Action was submitted, not that it completed. Design consuming code to handle eventual consistency, not immediate state change
51
+ - Workflow Rule triggers (event-driven Actions) execute after the triggering event commits. A Rule triggered by "Property X changed" observes the committed value, not an intermediate value. Chained Rules (Rule A triggers event -> Rule B fires) execute sequentially in commit order
52
+
53
+ ## Constraint Conflict Patterns
54
+
55
+ [관찰→참여] Constraint conflicts arise when independently valid rules produce contradictions when combined. Detection requires cross-rule analysis, not single-rule inspection.
56
+
57
+ ### Precondition-Postcondition Conflicts
58
+
59
+ - If an Action Type's submission criteria (precondition) and its ontology rules (postcondition) contradict each other, that Action is non-executable. Example: submission criteria requires status = "active" but the rule sets status = "closed" — the next invocation of the same Action on the same object will always fail
60
+ - If a postcondition creates a state that violates an invariant defined on the Object Type (e.g., setting a required Property to null), the Action commits but produces an invalid object. Validate postcondition states against Object Type constraints at design time
61
+
62
+ ### Permission-Action Authorization Conflicts
63
+
64
+ - [관찰→참여] Marking (mandatory, AND-evaluated, restricts access) and role-based Permission (discretionary, expands access) operate in opposite directions. A user with the correct role but missing a required Marking cannot execute the Action. Conflicts arise when Action authorization checks role only and ignores Marking — the Action appears authorized but data access is denied at runtime. (Ref: Palantir Markings docs)
65
+ - If an Action modifies an Object protected by a Marking that the Action's executor does not possess, the Action fails at execution time, not at definition time. Validate that the Action's expected executors hold all required Markings
66
+
67
+ ### Concurrent Action Race Conditions
68
+
69
+ - If the postconditions of Action Types that can execute simultaneously on the same Object conflict, there is a race condition risk. Example: Action A sets priority = "high" while Action B sets priority = "low" on the same Object
70
+ - Resolution: (a) define Object-level locking via submission criteria (check version/timestamp), or (b) design Actions so that concurrent execution on the same Object is impossible (sequential Workflow), or (c) accept last-write-wins semantics and document this explicitly
71
+
72
+ ### Marking AND Logic vs Permission OR Logic
73
+
74
+ - [관찰→참여] Multiple Markings on a resource are AND-evaluated: a user must hold all Markings. Multiple role grants are OR-evaluated: any one sufficient role grants access. When both mechanisms apply to the same resource, the effective access is: (any role grants access) AND (all Markings are held). Misunderstanding this interaction produces false expectations about who can access what
75
+
76
+ ### Schema-Level Constraint Declaration
77
+
78
+ [참여] Constraints belong at the schema level (ontology definition), not at the application level. When constraints are defined in consuming applications instead of the ontology, different applications may enforce different rules, producing inconsistent data.
79
+
80
+ - Value Type constraints (regex, range, enum, uniqueness)는 온톨로지 정의에서 선언적으로 정의되어야 한다. 애플리케이션 코드에서 정의하면 소비자마다 다른 규칙이 적용될 수 있다
81
+ - 온톨로지에서 선언된 constraint는 모든 소비 경로(OSDK, API, UI)에 일관되게 적용되어야 한다. 특정 소비 경로에서만 검증하는 것은 불완전한 제약이다
82
+ - Constraint 변경은 영향 범위 분석이 필요하다. regex 패턴 변경은 기존 데이터의 유효성을 무효화할 수 있으므로 breaking_minor 이상으로 분류한다
83
+
84
+ ## Data Integrity Rules
85
+
86
+ [관찰→참여] The ontology sits atop physical data. Schema mismatches between the ontology definition and the backing data produce silent errors or runtime failures. (Ref: Palantir Data Integration docs)
87
+
88
+ - Backing Dataset schema must be consistent with Object Type definition. If the Object Type declares a Property of type Integer but the Backing Dataset column is String, queries may return incorrect results or fail. Verify type alignment after Pipeline transforms and before ontology binding
89
+ - Writeback Dataset captures user edits as a separate layer from the Backing Dataset. If Writeback Dataset schema diverges from the Object Type definition (e.g., after a Property type change), existing writeback records become unreadable. Property type changes require Writeback Dataset migration
90
+ - Source-writeback separation must be maintained: the Backing Dataset (source) is never directly modified by Actions. All user mutations are recorded in the Writeback Dataset. Violating this separation breaks the audit trail and rollback capability. Cross-reference: structure_spec.md "Data Integration Structural Requirements"
91
+
92
+ ## Pipeline Quality Rules
93
+
94
+ [관찰→참여] Data pipelines follow a staged quality progression. Each stage has a distinct purpose, and skipping stages introduces quality gaps that compound downstream.
95
+
96
+ - 파이프라인은 Raw → Clean → Transform의 3단계를 따른다. Raw는 소스 시스템 원본, Clean은 기본 정제(타입 정렬, null 처리, 중복 제거), Transform은 사용 사례별 변환이다
97
+ - Clean에서 Transform으로 가는 중간 변환 단계는 항상 존재해야 한다. Clean에서 직접 Ontology에 바인딩하면 사용 사례별 변환 로직이 바인딩에 섞여 유지보수가 어렵다
98
+ - 네이밍 규칙: Dataset/Column 이름은 snake_case, 고유 부분(distinctive portion)을 이름 앞에 배치, 약어 사용 금지, 번호 증분(dataset1, dataset2) 금지
99
+ - 각 파이프라인 단계의 출력 Dataset은 독립적으로 검증 가능해야 한다. Clean 단계 출력이 올바른지 확인하지 않고 Transform으로 진행하면, 오류의 원인 추적이 어렵다
100
+
101
+ ## Codegen Logic
102
+
103
+ [참여] Codegen rules are defined in structure_spec.md "Codegen Output Structure (SSOT)." This section defines the logical inference and detection rules that operate on that structure. It does not redefine generated file layout, type naming conventions, or subset generation principles.
104
+
105
+ ### Type Inference Rules
106
+
107
+ - Object Type -> TypeScript interface: each Property becomes a readonly field. The generated type is the contract between ontology definition and application code. If a Property is nullable in the ontology, the generated field type includes `| undefined`
108
+ - Link Type -> reference type with direction encoded in the name. The generated type enforces cardinality at the type level: one-to-one produces a single reference, one-to-many produces an array
109
+ - Enum -> union type with literal values. The set of literal values is exhaustive. Adding a value requires regeneration; consuming code that does not handle the new value produces a compile error (this is the intended detection mechanism)
110
+
111
+ ### Breaking Change Detection Logic
112
+
113
+ - Schema change -> type regeneration -> compile errors in referencing code. This converts runtime errors into compile-time errors. The number of compile errors equals the impact scope of the change
114
+ - Property type change (e.g., String -> Integer) produces type mismatch errors at every usage site. This is always breaking_major
115
+ - Property removal produces "property does not exist" errors. This is breaking_major + deprecation (grace period required)
116
+ - New required Property (non-nullable without default) produces errors in every Action that creates the Object Type without providing the new value
117
+
118
+ ## Multi-Ontology Consistency Rules
119
+
120
+ [관찰→참여] In multi-ontology environments, consistency across ontology boundaries is maintained through Interface contracts and Shared Properties. Direct cross-ontology references without these mechanisms destroy ontology independence.
121
+
122
+ - An Object Type that implements an Interface must include all Properties defined by that Interface. Partial implementation is a contradiction. Cross-reference: structure_spec.md "Multi-Ontology Connection Structure"
123
+ - Changing the type of a Shared Property triggers breaking_major for all referencing Object Types across all ontologies that use that Shared Property. Impact scope analysis must span ontology boundaries
124
+ - Cross-references between ontologies must be made only through Interface or Shared Property. Direct references (Object Type A in Ontology 1 directly links to Object Type B in Ontology 2) create tight coupling that prevents independent ontology evolution
125
+ - Interface compliance verification: when an Object Type claims to implement an Interface, verify that (a) all Interface Properties exist with matching types, (b) all Interface Link Type Constraints are satisfied, and (c) the Object Type does not redefine an Interface Property with a different type
126
+
127
+ ## AI Agent Authorization Rules
128
+
129
+ [관찰→참여] AI agents operating on the ontology are subject to the same authorization model as human users, plus additional constraints to prevent autonomous mutations.
130
+
131
+ - AI 에이전트의 데이터 접근 범위는 호출한 사용자의 접근 범위를 초과할 수 없다. Marking과 Permission이 동일하게 적용된다. AI 에이전트에게 별도의 확장 권한을 부여하면 privilege escalation 경로가 생긴다
132
+ - AI 에이전트가 제안한 ontology 변경(Object 생성/수정/삭제, Action 실행)은 Branch Proposal을 통해 사람의 검토를 거쳐야 한다. 직접 Main에 커밋하는 것은 거버넌스 우회이다
133
+ - AI 에이전트가 Action을 실행할 때, Action Type의 submission criteria(precondition)가 AI 에이전트에게도 동일하게 적용된다. AI가 precondition을 우회하는 것은 허용되지 않는다
134
+ - [관찰→참여] Ontology-Augmented Generation(OAG): AI 에이전트에게 컨텍스트를 제공할 때, 텍스트 문서가 아닌 온톨로지 객체(Object의 Property와 Link)를 주입한다. 구조화된 데이터는 해석의 여지가 적어 할루시네이션을 줄인다
135
+
136
+ ## Resource Status Logic
137
+
138
+ [관찰→참여] Ontology resources follow a lifecycle that governs their availability and stability guarantees. Status transitions are unidirectional within the standard path and affect all dependent resources.
139
+
140
+ ### Status Lifecycle (5-stage)
141
+
142
+ | Stage | Meaning | Allowed Transitions |
143
+ |-------|---------|---------------------|
144
+ | Draft | Under construction, not yet available to consumers | -> Experimental |
145
+ | Experimental | Available for testing, no stability guarantees | -> Stable, -> Deprecated |
146
+ | Stable | Production-ready, breaking changes require full governance | -> Deprecated |
147
+ | Deprecated | Scheduled for removal, grace period active | -> Retired |
148
+ | Retired | Removed from active ontology, retained in history | (terminal) |
149
+
150
+ - Backward transitions (e.g., Stable -> Experimental) are prohibited. If a Stable resource needs fundamental redesign, deprecate it and create a new resource starting at Draft
151
+ - The Draft -> Stable shortcut is prohibited. All resources must pass through Experimental to verify consumer compatibility before receiving stability guarantees
152
+
153
+ ### Hierarchical Cascade Rules
154
+
155
+ - If a parent Object Type's status transitions to Deprecated, all child Object Types (connected via Link Types where the parent is the source) must be evaluated for deprecation. Children that have no other active parent remain functional but lose their dependency anchor
156
+ - An Experimental parent cannot contain Stable children. The stability guarantee of a child cannot exceed the stability guarantee of its parent. If a child needs to be Stable, its parent must first transition to Stable
157
+ - Shared Property status constrains referencing Object Types: a Deprecated Shared Property forces all referencing Object Types to plan migration to an alternative Property within the grace period
158
+
159
+ ## External References
160
+
161
+ 1. Palantir Action Types & Rules — rule evaluation order, webhook transaction guarantees, submission criteria (Ref: Palantir Action Types Overview)
162
+ 2. Palantir Markings & Object Security Policies — mandatory access control, AND-evaluation, Marking propagation (Ref: Palantir security docs)
163
+ 3. Palantir Data Integration — Pipeline, Backing Dataset, Writeback Dataset, schema consistency (Ref: Palantir Data Integration docs)
164
+ 4. Palantir OSDK — codegen pipeline, type inference, subset generation (Ref: Palantir developer docs)
165
+
166
+ ## Related Documents
167
+ - concepts.md — definitions of terms used in each rule (Action Type, Marking, Backing Dataset, codegen, etc.)
168
+ - dependency_rules.md — dependency direction rules, Pipeline data flow
169
+ - structure_spec.md — structural required elements, Codegen Output Structure (SSOT)
170
+ - domain_scope.md — three-layer architecture scope, change classification definitions
171
+ - competency_qs.md — questions this logic must be able to answer
172
+ - conciseness_rules.md — entity-relation ratio thresholds
@@ -0,0 +1,291 @@
1
+ ---
2
+ version: 4
3
+ last_updated: "2026-03-31"
4
+ source: manual
5
+ status: established
6
+ ---
7
+
8
+ # Palantir Foundry Domain — Structure Specification
9
+
10
+ ## Object Type Required Elements
11
+
12
+ Every Object Type must include:
13
+ - `display_name`: User-facing display name
14
+ - `primary_key`: Unique identifier Property
15
+ - `description`: Business meaning description (1-2 sentences)
16
+ - `properties`: At least one Property
17
+ - `data_source`: Data origin source (if undetermined, state "TBD")
18
+
19
+ ## Property Required Elements
20
+
21
+ - `name`: Attribute name (English, snake_case)
22
+ - `type`: Data type (String, Integer, Decimal, Date, Boolean, Enum, Timestamp, Geopoint, and others per concepts.md)
23
+ - `description`: Business meaning description
24
+ - `nullable`: Whether optional (true/false)
25
+
26
+ ## Link Type Required Elements
27
+
28
+ - `source`: Origin Object Type
29
+ - `target`: Destination Object Type
30
+ - `cardinality`: one-to-one, one-to-many, or many-to-many
31
+ - `description`: Business meaning of the relationship
32
+
33
+ ## Action Type Required Elements
34
+
35
+ [관찰→참여] Every Action Type must include:
36
+ - `parameters`: Input definitions with value source (from parameter, object parameter property, static value, current user/time)
37
+ - `preconditions`: Rules applied before execution — Ontology Rules (8 types: create/modify/delete objects, create/delete links, function rule, interface-based operations) + Side Effect Rules (2 types: notification rules, webhook rules)
38
+ - `postconditions`: Expected state after successful execution
39
+ - `side_effects`: External effects (notifications, webhook calls). When a webhook is configured as writeback, it executes before other rules — failure cancels all changes
40
+ - `affected_object_types`: List of Object Types modified by the Action
41
+
42
+ Rule evaluation order: sequential. Later rules on the same property override earlier ones.
43
+
44
+ ## Function Required Elements
45
+
46
+ [관찰→참여] Every Function must include:
47
+ - `input_types`: Parameter types (ontology Objects or primitive values)
48
+ - `return_type`: Output type
49
+ - `purity`: Must be declared read-only (no state changes). Functions correspond to Query in CQRS. If state changes are needed, use Action Type instead
50
+
51
+ ## Workflow and Rule Required Elements
52
+
53
+ [관찰→참여] Workflows and Rules require:
54
+ - `trigger_condition`: Event or state that initiates execution (e.g., object creation, property value change, schedule)
55
+ - `action_binding`: Which Action Type(s) the Workflow/Rule invokes
56
+ - `frequency`: Execution frequency (one-time, recurring, event-driven)
57
+
58
+ Workflow Rules trigger Actions based on events — distinct from Action rules, which define what happens inside an Action.
59
+
60
+ ## Enum Required Elements
61
+
62
+ [관찰→참여] Every Enum must include:
63
+ - `name`: Enum type name (PascalCase)
64
+ - `description`: Business meaning and usage context
65
+ - `values`: List of allowed values (each with label and description)
66
+ - `default_value`: (optional) Default value when not explicitly set
67
+ - `deprecated_values`: (optional) Values no longer recommended, with migration guidance
68
+
69
+ ## Interface Required Elements
70
+
71
+ [관찰→참여] Every Interface must include:
72
+ - `name`: Interface name (PascalCase)
73
+ - `description`: Shared behavior or contract this Interface represents
74
+ - `required_properties`: List of Properties that implementing Object Types must provide
75
+ - `implementing_object_types`: Reference to Object Types that implement this Interface
76
+
77
+ ## Shared Property Required Elements
78
+
79
+ [관찰→참여] Every Shared Property must include:
80
+ - `name`: Property name (English, snake_case)
81
+ - `type`: Data type
82
+ - `description`: Business meaning description
83
+ - `owning_ontology`: Ontology that defines and maintains this Property
84
+ - `consuming_object_types`: List of Object Types that use this Shared Property
85
+
86
+ ## Permission Structure
87
+
88
+ [관찰→참여] Foundry applies Mandatory Access Control (Marking) where security travels with data — derived resources inherit the restriction automatically. (Ref: Palantir Markings docs)
89
+
90
+ - **Marking hierarchy**: Marking Group → Marking → Resource. Multiple Markings are AND-evaluated. Owner permissions cannot remove Markings (requires separate Expand Access privilege)
91
+ - **Mandatory vs Discretionary**: Mandatory (Marking) restricts access, binary all-or-nothing, cannot be overridden by data owners. Discretionary (role-based grants) expands access. They operate in opposite directions
92
+ - **Row/Column/Cell-level security**: Object Security Policy (row-level) + Property Security Policy (column-level) = cell-level security. These policies operate independently from backing datasource permissions
93
+ - **Organization isolation**: Organization defines the boundary for Markings, Permissions, and roles. Cross-organization sharing requires explicit de-identification rules at the property level
94
+
95
+ ## Isolated Element Check
96
+
97
+ [참여] Every element must be checked for structural connectivity:
98
+ - **Object Type**: Not connected to any Link Type → "isolated entity." Exception: top-level Master Data entities referenced by others are not isolated
99
+ - **Link Type**: References a non-existent Object Type → dangling reference
100
+ - **Action Type**: No `affected_object_types` → orphan action with no observable effect
101
+ - **Function**: Not referenced by any Action Type or application → unused logic
102
+ - **Permission**: References a non-existent Object Type or Property → stale security rule
103
+ - **Interface**: No implementing Object Type → warning: unused contract
104
+ - **Shared Property**: Not consumed by any Object Type → warning: orphan shared property
105
+ - **Enum**: Not referenced by any Property → warning: unused enumeration
106
+ - **Workflow**: No trigger condition binding → warning: workflow will never execute
107
+ - **Rule**: No action binding → warning: rule has no effect
108
+
109
+ ## Connectivity Check
110
+
111
+ - Object Types within the same data layer (Master/Transaction/Derived) must be traversable via Link Types
112
+ - Cross-layer connections: Transaction -> Master direction. Upper layers reference lower layers; lower layers do not know about upper layers
113
+
114
+ ## Data Integration Structural Requirements
115
+
116
+ [관찰→참여] Data flows through a staged pipeline before binding to the ontology. (Ref: Palantir Data Integration docs)
117
+
118
+ ```
119
+ Source Systems → Data Connection → Sync → Dataset → Transform (Pipeline) → Ontology
120
+ ```
121
+
122
+ - **Pipeline → Backing Dataset binding**: Every Object Type must declare at least one Backing Dataset
123
+ - **Backing Dataset vs Virtual Table**: Backing Dataset = persistent copy with version history and lineage. Virtual Table = compute-on-demand, no storage. Choice depends on audit requirements, latency tolerance, and transformation complexity
124
+ - **Source-writeback separation**: Source data (Backing Dataset) and change data (Writeback Dataset) must be separate — source systems are never directly modified
125
+
126
+ ## Pipeline Quality Structure
127
+
128
+ [관찰→참여] Data quality is achieved through staged processing, not single-step transformation. (Ref: Palantir Development Best Practices docs)
129
+
130
+ ### Stage Definitions
131
+
132
+ - **Raw**: Source system data as-is. No transformation applied. Purpose: audit trail and reprocessing capability
133
+ - **Clean**: Basic quality operations applied (type alignment, null handling, deduplication). Starting point for most Foundry activities
134
+ - **Transform**: Use-case-specific transformations. Produces datasets ready for ontology binding
135
+
136
+ ### Naming Conventions
137
+
138
+ - Dataset/Column names: snake_case (e.g., awesome_dataset, not AwesomeDataset)
139
+ - Distinctive portion first (e.g., order_daily_summary, not daily_summary_order) — prevents truncation in UI dropdowns
140
+ - No abbreviations. No numeric increments (dataset1, dataset2)
141
+
142
+ ### Catalog Organization
143
+
144
+ ```
145
+ /Domain
146
+ /Subject Area
147
+ /Entity
148
+ - gold_<entity>
149
+ - silver_<entity>
150
+ - ref_<lookups>
151
+ ```
152
+
153
+ ## Multi-Ontology Connection Structure
154
+
155
+ - Object Types in the Shared Ontology are referenced from Private Ontologies through Interfaces
156
+ - If a cross-reference exists without Interface implementation, it is a structural defect
157
+
158
+ ## Change Management Required Structure
159
+
160
+ - `change_classification` rules must be defined (non_breaking/breaking_minor/breaking_major/deprecation)
161
+ - `governance.roles` must define at least an Ontology Lead
162
+ - `governance.approval_levels` must map approval authority to each change classification
163
+
164
+ ## Codegen Output Structure (SSOT)
165
+
166
+ [참여] This section is the Single Source of Truth for codegen implementation rules. Other documents (domain_scope.md, logic_rules.md, dependency_rules.md) reference this section but do not redefine codegen rules.
167
+
168
+ ### Generated File Layout
169
+
170
+ `generated/types/` — one file per entity category (ObjectTypes.ts, LinkTypes.ts, ActionTypes.ts, Enums.ts). `generated/functions/` — Function signatures. `generated/index.ts` — re-exports for consumer access.
171
+
172
+ ### Type Naming Conventions
173
+
174
+ | Ontology Entity | Generated Type | Naming Rule |
175
+ |----------------|---------------|------------|
176
+ | Object Type | TypeScript interface | PascalCase (e.g., `interface SalesOrder`) |
177
+ | Property | readonly field | camelCase (e.g., `readonly orderDate: Date`) |
178
+ | Link Type | reference type | PascalCase with direction (e.g., `SalesOrder_To_Customer`) |
179
+ | Enum | union type | PascalCase, literal values (e.g., `type Status = "active" \| "inactive"`) |
180
+ | Action Type | parameter interface | PascalCase (e.g., `ProcessRefundParams`) |
181
+ | Function | function signature | camelCase (e.g., `calculateTotal`) |
182
+
183
+ ### Subset Generation Principle
184
+
185
+ [관찰→참여] Only the relevant portion of the ontology is generated per application, not the entire ontology — benefiting both performance (linear scaling with ontology shape, not size) and security (no access to unneeded entities). Each application declares which Object Types, Action Types, and Functions it requires; codegen produces types only for the declared subset. (Ref: Palantir OSDK Overview docs)
186
+
187
+ ### Scope-Limited Tokens
188
+
189
+ [관찰→참여] Generated code uses tokens scoped to the selected ontology subset. Dual-layer security: (1) token scope limits accessible entities, (2) user permissions further restrict data access within that scope. (Ref: Palantir OSDK docs)
190
+
191
+ ### Schema Change Detection
192
+
193
+ [참여] Schema change → type regeneration → compile errors in referencing code. Re-running codegen after a schema change converts runtime errors into compile-time errors. This pattern applies to any schema-based system.
194
+
195
+ ## Testing Structure
196
+
197
+ [관찰→참여] Testing validates that the ontology implementation matches its design specification. Three levels of testing address different concerns. (Ref: CodeStrap Operating Model — Foundry Mocks, DAO pattern)
198
+
199
+ ### Platform Abstraction (DAO Pattern)
200
+
201
+ [관찰→참여] Business logic is isolated from the ontology platform via Data Access Object (DAO) pattern. Foundry-specific operations (Object reads, Action executions) are encapsulated behind function interfaces. This enables:
202
+ - Unit testing with mock implementations (no live platform required)
203
+ - Platform migration without business logic changes
204
+ - Dependency injection for component substitution
205
+
206
+ ### Unit Testing with Mocks
207
+
208
+ [관찰→참여] Ontology interactions are testable via mock implementations (Foundry Mocks pattern):
209
+ - Mock Object reads return predefined datasets
210
+ - Mock Action executions verify parameter correctness and side effect invocation
211
+ - Mock codegen types verify type compatibility without live ontology
212
+
213
+ ### Integration Testing (Schema Verification)
214
+
215
+ [참여] Schema consistency between ontology definition and backing data:
216
+ - Backing Dataset column types match Object Type Property types
217
+ - Writeback Dataset schema aligns with current Object Type definition
218
+ - Codegen output compiles without errors against current ontology
219
+
220
+ ### E2E Verification
221
+
222
+ [참여] End-to-end validation of the complete pipeline:
223
+ - Source → Pipeline (Raw→Clean→Transform) → Ontology binding → codegen → compile
224
+ - Action execution → Writeback Dataset → re-indexing → query verification
225
+
226
+ ## Frontend Integration Structure
227
+
228
+ [관찰→참여] The ontology-to-UI pipeline extends codegen to the presentation layer, ensuring type safety from schema to screen. (Ref: OSDK v2 React patterns, RESEARCH_NOTES.md Section 12)
229
+
230
+ ### Schema-Type-UI Pipeline
231
+
232
+ [관찰→참여] The change detection chain extends beyond codegen:
233
+ ```
234
+ Ontology Schema → codegen → Generated Types → UI Components
235
+
236
+ Compile errors propagate
237
+ to component boundaries
238
+ ```
239
+
240
+ ### Polymorphic Component Rendering
241
+
242
+ [관찰→참여] Ontology Interfaces map to UI component hierarchies:
243
+ - Interface defines the common shape (e.g., ITask with status, assignee)
244
+ - Each implementing Object Type ($objectType field: CodingTask, LearningTask) renders via a distinct sub-component
245
+ - New Object Type implementations are automatically handled if the Interface contract is satisfied
246
+
247
+ ### State Management
248
+
249
+ [관찰→참여] Ontology-backed applications follow:
250
+ - Context-based authentication (provider pattern) — no global state store required
251
+ - Hook-level caching with SWR (stale-while-revalidate) strategy
252
+ - Real-time subscription for onChange, onError, onOutOfDate events
253
+
254
+ ### OSDK v2 Specifics
255
+
256
+ [관찰] Foundry OSDK v2 design decisions:
257
+ - Performance scales with ontology shape (metadata), not ontology size (total data)
258
+ - Lazy loading: types loaded at use time, not at initialization
259
+ - Client-code decoupling: library updates do not require SDK regeneration
260
+ - React Hooks: useOsdkObjects (collection), useOsdkObject (single), useLinks (relations)
261
+
262
+ ## Quantitative Thresholds
263
+
264
+ Thresholds are structural health indicators. Exceeding a threshold requires explicit justification.
265
+
266
+ | Metric | Threshold | Implication | Action |
267
+ |--------|-----------|-------------|--------|
268
+ | OTs without Link Types | > 10% of total OTs | Structural disconnection | Review per "Isolated Element Check" |
269
+ | Action Type parameters | > 8 parameters | Overly complex action | Split into sub-actions or extract parameter groups |
270
+ | Properties per OT | > 50 properties | Overloaded Object Type | Split into multiple OTs with Link Types |
271
+ | Orphan Actions | > 0 | No affected_object_types | Remove or bind to Object Types |
272
+ | Enum values | > 25 values | May indicate missing OT | Evaluate promotion to Object Type |
273
+ | Pipeline depth | > 5 transform stages | Debugging complexity | Consolidate intermediate transforms |
274
+ | Pipeline stages without Clean | > 0 | Quality gap | Add Clean stage between Raw and Transform |
275
+
276
+ Cross-reference: Entity-relation ratio thresholds → conciseness_rules.md. Change classification → domain_scope.md "Change Classification."
277
+
278
+ ## External References
279
+
280
+ 1. Palantir OSDK Overview — type generation, subset generation principle, token scoping (Ref: Palantir developer docs)
281
+ 2. Palantir Action Types & Rules — 8 ontology rules + 2 side effect rules, webhook transaction guarantees (Ref: Palantir Action Types Overview)
282
+ 3. Palantir Markings & Object Security Policies — mandatory access control, row/column/cell-level security (Ref: Palantir security docs)
283
+ 4. Palantir Data Integration — Pipeline, Backing Dataset, Virtual Table, Writeback Dataset (Ref: Palantir Data Integration docs)
284
+
285
+ ## Related Documents
286
+ - domain_scope.md — three-layer architecture scope, codegen design principles
287
+ - concepts.md — term definitions (Object Type, Action Type, Marking, Pipeline, codegen, etc.)
288
+ - logic_rules.md — logic rules; references "Codegen Output Structure" for codegen logic
289
+ - dependency_rules.md — dependency directions; references "Codegen Output Structure" for codegen dependencies
290
+ - competency_qs.md — questions this structure must be able to answer
291
+ - conciseness_rules.md — entity-relation ratio thresholds, minimum granularity criteria