arodonata 2.0.0__tar.gz

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 (279) hide show
  1. arodonata-2.0.0/.agents/rules/git-workflow.md +17 -0
  2. arodonata-2.0.0/.agents/rules/linting-on-save.md +23 -0
  3. arodonata-2.0.0/.agents/skills/.openspec-target +1 -0
  4. arodonata-2.0.0/.agents/skills/openspec-apply-change/SKILL.md +206 -0
  5. arodonata-2.0.0/.agents/skills/openspec-archive-change/SKILL.md +221 -0
  6. arodonata-2.0.0/.agents/skills/openspec-explore/SKILL.md +356 -0
  7. arodonata-2.0.0/.agents/skills/openspec-propose/SKILL.md +175 -0
  8. arodonata-2.0.0/.agents/skills/openspec-sync-specs/SKILL.md +290 -0
  9. arodonata-2.0.0/.agents/skills/openspec-update-change/SKILL.md +109 -0
  10. arodonata-2.0.0/.agents/workflows/archive-task.md +44 -0
  11. arodonata-2.0.0/.agents/workflows/audit.md +61 -0
  12. arodonata-2.0.0/.agents/workflows/git-workflow.md +199 -0
  13. arodonata-2.0.0/.agents/workflows/save-plan.md +48 -0
  14. arodonata-2.0.0/.claude/commands/archive-task.md +47 -0
  15. arodonata-2.0.0/.claude/commands/audit.md +61 -0
  16. arodonata-2.0.0/.claude/commands/git-workflow.md +202 -0
  17. arodonata-2.0.0/.claude/commands/save-plan.md +51 -0
  18. arodonata-2.0.0/.claude/skills/openspec-apply-change/SKILL.md +206 -0
  19. arodonata-2.0.0/.claude/skills/openspec-archive-change/SKILL.md +221 -0
  20. arodonata-2.0.0/.claude/skills/openspec-explore/SKILL.md +356 -0
  21. arodonata-2.0.0/.claude/skills/openspec-propose/SKILL.md +175 -0
  22. arodonata-2.0.0/.claude/skills/openspec-sync-specs/SKILL.md +290 -0
  23. arodonata-2.0.0/.claude/skills/openspec-update-change/SKILL.md +109 -0
  24. arodonata-2.0.0/.env.example +46 -0
  25. arodonata-2.0.0/.gitignore +29 -0
  26. arodonata-2.0.0/.markdownlint.yaml +11 -0
  27. arodonata-2.0.0/.markdownlintignore +4 -0
  28. arodonata-2.0.0/.python-version +1 -0
  29. arodonata-2.0.0/.ruff.toml +37 -0
  30. arodonata-2.0.0/.vscode/settings.json +38 -0
  31. arodonata-2.0.0/AGENTS.md +118 -0
  32. arodonata-2.0.0/CHANGELOG.md +43 -0
  33. arodonata-2.0.0/PKG-INFO +99 -0
  34. arodonata-2.0.0/README.md +50 -0
  35. arodonata-2.0.0/examples/01_basic_queries.py +77 -0
  36. arodonata-2.0.0/examples/02_search_and_query.py +95 -0
  37. arodonata-2.0.0/examples/03_gateway_relationships.py +65 -0
  38. arodonata-2.0.0/examples/04_smart_refresh.py +63 -0
  39. arodonata-2.0.0/examples/05_rulebase_queries.py +103 -0
  40. arodonata-2.0.0/examples/06_session_basics.py +110 -0
  41. arodonata-2.0.0/examples/07_context_and_overlay.py +113 -0
  42. arodonata-2.0.0/examples/08_cpcrud_operations.py +88 -0
  43. arodonata-2.0.0/examples/09_cpcrud_inverse.py +82 -0
  44. arodonata-2.0.0/examples/10_change_report_evidence.py +187 -0
  45. arodonata-2.0.0/examples/11_otel_tracing.py +92 -0
  46. arodonata-2.0.0/examples/12_mcp_embedded.py +97 -0
  47. arodonata-2.0.0/examples/README.md +65 -0
  48. arodonata-2.0.0/examples/README_CRUD.md +102 -0
  49. arodonata-2.0.0/examples/_session_guard.py +208 -0
  50. arodonata-2.0.0/examples/crud_example.yaml +65 -0
  51. arodonata-2.0.0/openspec/changes/archive/.gitkeep +0 -0
  52. arodonata-2.0.0/openspec/changes/archive/2026-10-23-milestone-1-core-and-storage/.openspec.yaml +3 -0
  53. arodonata-2.0.0/openspec/changes/archive/2026-10-23-milestone-1-core-and-storage/design.md +67 -0
  54. arodonata-2.0.0/openspec/changes/archive/2026-10-23-milestone-1-core-and-storage/proposal.md +35 -0
  55. arodonata-2.0.0/openspec/changes/archive/2026-10-23-milestone-1-core-and-storage/tasks.md +20 -0
  56. arodonata-2.0.0/openspec/changes/archive/2026-10-23-milestone-2-transport-and-sessions/.openspec.yaml +3 -0
  57. arodonata-2.0.0/openspec/changes/archive/2026-10-23-milestone-2-transport-and-sessions/design.md +94 -0
  58. arodonata-2.0.0/openspec/changes/archive/2026-10-23-milestone-2-transport-and-sessions/proposal.md +38 -0
  59. arodonata-2.0.0/openspec/changes/archive/2026-10-23-milestone-2-transport-and-sessions/tasks.md +23 -0
  60. arodonata-2.0.0/openspec/changes/archive/2026-10-23-milestone-3-sync-and-search/.openspec.yaml +3 -0
  61. arodonata-2.0.0/openspec/changes/archive/2026-10-23-milestone-3-sync-and-search/design.md +147 -0
  62. arodonata-2.0.0/openspec/changes/archive/2026-10-23-milestone-3-sync-and-search/proposal.md +35 -0
  63. arodonata-2.0.0/openspec/changes/archive/2026-10-23-milestone-3-sync-and-search/tasks.md +26 -0
  64. arodonata-2.0.0/openspec/changes/archive/2026-10-23-revise-v2-architecture-specs/.openspec.yaml +2 -0
  65. arodonata-2.0.0/openspec/changes/archive/2026-10-23-revise-v2-architecture-specs/design.md +95 -0
  66. arodonata-2.0.0/openspec/changes/archive/2026-10-23-revise-v2-architecture-specs/proposal.md +42 -0
  67. arodonata-2.0.0/openspec/changes/archive/2026-10-23-revise-v2-architecture-specs/specs/cache-and-sync/spec.md +61 -0
  68. arodonata-2.0.0/openspec/changes/archive/2026-10-23-revise-v2-architecture-specs/specs/client-and-facade/spec.md +40 -0
  69. arodonata-2.0.0/openspec/changes/archive/2026-10-23-revise-v2-architecture-specs/specs/configuration/spec.md +51 -0
  70. arodonata-2.0.0/openspec/changes/archive/2026-10-23-revise-v2-architecture-specs/specs/cpcrud/spec.md +46 -0
  71. arodonata-2.0.0/openspec/changes/archive/2026-10-23-revise-v2-architecture-specs/specs/mcp-server/spec.md +43 -0
  72. arodonata-2.0.0/openspec/changes/archive/2026-10-23-revise-v2-architecture-specs/specs/rulebase-and-numbering/spec.md +22 -0
  73. arodonata-2.0.0/openspec/changes/archive/2026-10-23-revise-v2-architecture-specs/specs/sessions-and-mdm/spec.md +52 -0
  74. arodonata-2.0.0/openspec/changes/archive/2026-10-23-revise-v2-architecture-specs/specs/transport-and-tls/spec.md +57 -0
  75. arodonata-2.0.0/openspec/changes/archive/2026-10-23-revise-v2-architecture-specs/tasks.md +8 -0
  76. arodonata-2.0.0/openspec/changes/archive/2026-10-24-milestone-4-rulebase-and-reports/.openspec.yaml +3 -0
  77. arodonata-2.0.0/openspec/changes/archive/2026-10-24-milestone-4-rulebase-and-reports/design.md +95 -0
  78. arodonata-2.0.0/openspec/changes/archive/2026-10-24-milestone-4-rulebase-and-reports/proposal.md +42 -0
  79. arodonata-2.0.0/openspec/changes/archive/2026-10-24-milestone-4-rulebase-and-reports/tasks.md +21 -0
  80. arodonata-2.0.0/openspec/changes/archive/2026-10-24-milestone-5-cpcrud-engine/.openspec.yaml +3 -0
  81. arodonata-2.0.0/openspec/changes/archive/2026-10-24-milestone-5-cpcrud-engine/design.md +122 -0
  82. arodonata-2.0.0/openspec/changes/archive/2026-10-24-milestone-5-cpcrud-engine/proposal.md +46 -0
  83. arodonata-2.0.0/openspec/changes/archive/2026-10-24-milestone-5-cpcrud-engine/tasks.md +21 -0
  84. arodonata-2.0.0/openspec/changes/archive/2026-10-24-milestone-6-mcp-server/.openspec.yaml +3 -0
  85. arodonata-2.0.0/openspec/changes/archive/2026-10-24-milestone-6-mcp-server/design.md +131 -0
  86. arodonata-2.0.0/openspec/changes/archive/2026-10-24-milestone-6-mcp-server/proposal.md +41 -0
  87. arodonata-2.0.0/openspec/changes/archive/2026-10-24-milestone-6-mcp-server/tasks.md +20 -0
  88. arodonata-2.0.0/openspec/changes/archive/2026-10-25-audit-remediation-261025/.openspec.yaml +2 -0
  89. arodonata-2.0.0/openspec/changes/archive/2026-10-25-audit-remediation-261025/design.md +156 -0
  90. arodonata-2.0.0/openspec/changes/archive/2026-10-25-audit-remediation-261025/proposal.md +74 -0
  91. arodonata-2.0.0/openspec/changes/archive/2026-10-25-audit-remediation-261025/specs/cache-and-sync/spec.md +74 -0
  92. arodonata-2.0.0/openspec/changes/archive/2026-10-25-audit-remediation-261025/specs/client-and-facade/spec.md +26 -0
  93. arodonata-2.0.0/openspec/changes/archive/2026-10-25-audit-remediation-261025/specs/configuration/spec.md +27 -0
  94. arodonata-2.0.0/openspec/changes/archive/2026-10-25-audit-remediation-261025/specs/cpcrud/spec.md +80 -0
  95. arodonata-2.0.0/openspec/changes/archive/2026-10-25-audit-remediation-261025/specs/integration-testing-and-examples/spec.md +12 -0
  96. arodonata-2.0.0/openspec/changes/archive/2026-10-25-audit-remediation-261025/specs/mcp-server/spec.md +72 -0
  97. arodonata-2.0.0/openspec/changes/archive/2026-10-25-audit-remediation-261025/specs/rulebase-and-numbering/spec.md +22 -0
  98. arodonata-2.0.0/openspec/changes/archive/2026-10-25-audit-remediation-261025/specs/sessions-and-mdm/spec.md +79 -0
  99. arodonata-2.0.0/openspec/changes/archive/2026-10-25-audit-remediation-261025/specs/transport-and-tls/spec.md +91 -0
  100. arodonata-2.0.0/openspec/changes/archive/2026-10-25-audit-remediation-261025/tasks.md +39 -0
  101. arodonata-2.0.0/openspec/changes/archive/2026-10-25-host-app-integration-hardening/.openspec.yaml +2 -0
  102. arodonata-2.0.0/openspec/changes/archive/2026-10-25-host-app-integration-hardening/design.md +63 -0
  103. arodonata-2.0.0/openspec/changes/archive/2026-10-25-host-app-integration-hardening/proposal.md +50 -0
  104. arodonata-2.0.0/openspec/changes/archive/2026-10-25-host-app-integration-hardening/specs/cache-and-sync/spec.md +45 -0
  105. arodonata-2.0.0/openspec/changes/archive/2026-10-25-host-app-integration-hardening/specs/cpcrud/spec.md +32 -0
  106. arodonata-2.0.0/openspec/changes/archive/2026-10-25-host-app-integration-hardening/specs/rulebase-and-numbering/spec.md +12 -0
  107. arodonata-2.0.0/openspec/changes/archive/2026-10-25-host-app-integration-hardening/tasks.md +31 -0
  108. arodonata-2.0.0/openspec/changes/archive/2026-10-25-live-integration-tests-and-examples/.openspec.yaml +2 -0
  109. arodonata-2.0.0/openspec/changes/archive/2026-10-25-live-integration-tests-and-examples/design.md +83 -0
  110. arodonata-2.0.0/openspec/changes/archive/2026-10-25-live-integration-tests-and-examples/proposal.md +64 -0
  111. arodonata-2.0.0/openspec/changes/archive/2026-10-25-live-integration-tests-and-examples/specs/integration-testing-and-examples/spec.md +96 -0
  112. arodonata-2.0.0/openspec/changes/archive/2026-10-25-live-integration-tests-and-examples/tasks.md +43 -0
  113. arodonata-2.0.0/openspec/changes/archive/2026-10-26-mcp-tool-consolidation/.openspec.yaml +2 -0
  114. arodonata-2.0.0/openspec/changes/archive/2026-10-26-mcp-tool-consolidation/design.md +125 -0
  115. arodonata-2.0.0/openspec/changes/archive/2026-10-26-mcp-tool-consolidation/proposal.md +45 -0
  116. arodonata-2.0.0/openspec/changes/archive/2026-10-26-mcp-tool-consolidation/specs/client-and-facade/spec.md +22 -0
  117. arodonata-2.0.0/openspec/changes/archive/2026-10-26-mcp-tool-consolidation/specs/mcp-server/spec.md +71 -0
  118. arodonata-2.0.0/openspec/changes/archive/2026-10-26-mcp-tool-consolidation/tasks.md +22 -0
  119. arodonata-2.0.0/openspec/config.yaml +11 -0
  120. arodonata-2.0.0/openspec/specs/.gitkeep +0 -0
  121. arodonata-2.0.0/openspec/specs/cache-and-sync/spec.md +101 -0
  122. arodonata-2.0.0/openspec/specs/change-reports/spec.md +54 -0
  123. arodonata-2.0.0/openspec/specs/client-and-facade/spec.md +63 -0
  124. arodonata-2.0.0/openspec/specs/configuration/spec.md +92 -0
  125. arodonata-2.0.0/openspec/specs/cpcrud/spec.md +107 -0
  126. arodonata-2.0.0/openspec/specs/integration-testing-and-examples/spec.md +96 -0
  127. arodonata-2.0.0/openspec/specs/mcp-server/spec.md +104 -0
  128. arodonata-2.0.0/openspec/specs/rulebase-and-numbering/spec.md +54 -0
  129. arodonata-2.0.0/openspec/specs/sessions-and-mdm/spec.md +116 -0
  130. arodonata-2.0.0/openspec/specs/transport-and-tls/spec.md +131 -0
  131. arodonata-2.0.0/pyproject.toml +148 -0
  132. arodonata-2.0.0/pytest.sh +98 -0
  133. arodonata-2.0.0/src/arodonata/__init__.py +259 -0
  134. arodonata-2.0.0/src/arodonata/adapters/__init__.py +1 -0
  135. arodonata-2.0.0/src/arodonata/adapters/checkpoint/__init__.py +82 -0
  136. arodonata-2.0.0/src/arodonata/adapters/checkpoint/client.py +733 -0
  137. arodonata-2.0.0/src/arodonata/adapters/checkpoint/pager.py +316 -0
  138. arodonata-2.0.0/src/arodonata/adapters/checkpoint/rate_limiter.py +317 -0
  139. arodonata-2.0.0/src/arodonata/adapters/checkpoint/sessions.py +1144 -0
  140. arodonata-2.0.0/src/arodonata/adapters/checkpoint/task_waiter.py +275 -0
  141. arodonata-2.0.0/src/arodonata/adapters/checkpoint/tls.py +483 -0
  142. arodonata-2.0.0/src/arodonata/adapters/checkpoint/transport.py +871 -0
  143. arodonata-2.0.0/src/arodonata/adapters/sse/__init__.py +69 -0
  144. arodonata-2.0.0/src/arodonata/adapters/storage/__init__.py +52 -0
  145. arodonata-2.0.0/src/arodonata/adapters/storage/cache_adapter.py +1419 -0
  146. arodonata-2.0.0/src/arodonata/adapters/storage/database.py +470 -0
  147. arodonata-2.0.0/src/arodonata/adapters/storage/lock_adapter.py +266 -0
  148. arodonata-2.0.0/src/arodonata/adapters/storage/tables.py +568 -0
  149. arodonata-2.0.0/src/arodonata/client.py +1787 -0
  150. arodonata-2.0.0/src/arodonata/core/__init__.py +127 -0
  151. arodonata-2.0.0/src/arodonata/core/config.py +494 -0
  152. arodonata-2.0.0/src/arodonata/core/context.py +456 -0
  153. arodonata-2.0.0/src/arodonata/core/errors.py +250 -0
  154. arodonata-2.0.0/src/arodonata/core/events.py +167 -0
  155. arodonata-2.0.0/src/arodonata/core/models/__init__.py +83 -0
  156. arodonata-2.0.0/src/arodonata/core/models/assets.py +86 -0
  157. arodonata-2.0.0/src/arodonata/core/models/common.py +196 -0
  158. arodonata-2.0.0/src/arodonata/core/models/domains.py +110 -0
  159. arodonata-2.0.0/src/arodonata/core/models/objects.py +151 -0
  160. arodonata-2.0.0/src/arodonata/core/models/rulebase.py +254 -0
  161. arodonata-2.0.0/src/arodonata/core/models/services.py +76 -0
  162. arodonata-2.0.0/src/arodonata/core/ports/__init__.py +376 -0
  163. arodonata-2.0.0/src/arodonata/core/services/__init__.py +67 -0
  164. arodonata-2.0.0/src/arodonata/core/services/asset_service.py +518 -0
  165. arodonata-2.0.0/src/arodonata/core/services/domain_service.py +561 -0
  166. arodonata-2.0.0/src/arodonata/core/services/object_service.py +598 -0
  167. arodonata-2.0.0/src/arodonata/core/services/search_service.py +852 -0
  168. arodonata-2.0.0/src/arodonata/core/services/service_cache.py +488 -0
  169. arodonata-2.0.0/src/arodonata/core/services/sync_coordinator.py +749 -0
  170. arodonata-2.0.0/src/arodonata/core/telemetry.py +207 -0
  171. arodonata-2.0.0/src/arodonata/cpcrud/__init__.py +99 -0
  172. arodonata-2.0.0/src/arodonata/cpcrud/checkpoint_ops_schema.json +1071 -0
  173. arodonata-2.0.0/src/arodonata/cpcrud/differ.py +542 -0
  174. arodonata-2.0.0/src/arodonata/cpcrud/executor.py +1341 -0
  175. arodonata-2.0.0/src/arodonata/cpcrud/inverse.py +507 -0
  176. arodonata-2.0.0/src/arodonata/cpcrud/models.py +352 -0
  177. arodonata-2.0.0/src/arodonata/cpcrud/planner.py +2077 -0
  178. arodonata-2.0.0/src/arodonata/cpcrud/position_helper.py +118 -0
  179. arodonata-2.0.0/src/arodonata/cpcrud/rule_identity.py +337 -0
  180. arodonata-2.0.0/src/arodonata/cpcrud/service.py +291 -0
  181. arodonata-2.0.0/src/arodonata/cpcrud/state_reader.py +892 -0
  182. arodonata-2.0.0/src/arodonata/cpcrud/validator.py +113 -0
  183. arodonata-2.0.0/src/arodonata/mcp/__init__.py +61 -0
  184. arodonata-2.0.0/src/arodonata/mcp/cli.py +146 -0
  185. arodonata-2.0.0/src/arodonata/mcp/config.py +299 -0
  186. arodonata-2.0.0/src/arodonata/mcp/errors.py +350 -0
  187. arodonata-2.0.0/src/arodonata/mcp/prompts.py +65 -0
  188. arodonata-2.0.0/src/arodonata/mcp/security.py +255 -0
  189. arodonata-2.0.0/src/arodonata/mcp/server.py +318 -0
  190. arodonata-2.0.0/src/arodonata/mcp/tools.py +2007 -0
  191. arodonata-2.0.0/src/arodonata/py.typed +1 -0
  192. arodonata-2.0.0/src/arodonata/reports/__init__.py +63 -0
  193. arodonata-2.0.0/src/arodonata/reports/collector.py +968 -0
  194. arodonata-2.0.0/src/arodonata/reports/models.py +381 -0
  195. arodonata-2.0.0/src/arodonata/reports/placement.py +248 -0
  196. arodonata-2.0.0/src/arodonata/reports/renderer.py +674 -0
  197. arodonata-2.0.0/src/arodonata/rulebase/__init__.py +75 -0
  198. arodonata-2.0.0/src/arodonata/rulebase/filter.py +650 -0
  199. arodonata-2.0.0/src/arodonata/rulebase/models.py +446 -0
  200. arodonata-2.0.0/src/arodonata/rulebase/numbering.py +772 -0
  201. arodonata-2.0.0/src/arodonata/rulebase/pager.py +773 -0
  202. arodonata-2.0.0/src/arodonata/rulebase/refresh.py +557 -0
  203. arodonata-2.0.0/src/arodonata/rulebase/source.py +435 -0
  204. arodonata-2.0.0/tests/__init__.py +0 -0
  205. arodonata-2.0.0/tests/integration/__init__.py +1 -0
  206. arodonata-2.0.0/tests/integration/b1/__init__.py +1 -0
  207. arodonata-2.0.0/tests/integration/b1/test_auth.py +181 -0
  208. arodonata-2.0.0/tests/integration/b1/test_change_report_reads.py +80 -0
  209. arodonata-2.0.0/tests/integration/b1/test_concurrent_admins.py +61 -0
  210. arodonata-2.0.0/tests/integration/b1/test_harness_smoke.py +51 -0
  211. arodonata-2.0.0/tests/integration/b1/test_rate_limiting.py +77 -0
  212. arodonata-2.0.0/tests/integration/b1/test_reads_and_search.py +142 -0
  213. arodonata-2.0.0/tests/integration/b1/test_rulebase_reads.py +75 -0
  214. arodonata-2.0.0/tests/integration/b1/test_session_lifecycle.py +173 -0
  215. arodonata-2.0.0/tests/integration/b1/test_session_names.py +67 -0
  216. arodonata-2.0.0/tests/integration/b2/__init__.py +1 -0
  217. arodonata-2.0.0/tests/integration/b2/test_cache_build.py +92 -0
  218. arodonata-2.0.0/tests/integration/b2/test_cpcrud_live.py +262 -0
  219. arodonata-2.0.0/tests/integration/b3/__init__.py +1 -0
  220. arodonata-2.0.0/tests/integration/b3/test_publish_revert.py +159 -0
  221. arodonata-2.0.0/tests/integration/b3/test_throttling.py +113 -0
  222. arodonata-2.0.0/tests/integration/b4/__init__.py +1 -0
  223. arodonata-2.0.0/tests/integration/b4/test_cache_mode_matrix.py +274 -0
  224. arodonata-2.0.0/tests/integration/b4/test_multi_domain.py +192 -0
  225. arodonata-2.0.0/tests/integration/b5/__init__.py +1 -0
  226. arodonata-2.0.0/tests/integration/b5/test_change_report_session.py +196 -0
  227. arodonata-2.0.0/tests/integration/b5/test_full_rebuild.py +75 -0
  228. arodonata-2.0.0/tests/integration/b5/test_large_layer.py +103 -0
  229. arodonata-2.0.0/tests/integration/b5/test_publish_matrix.py +247 -0
  230. arodonata-2.0.0/tests/integration/b5/test_rulebase_session_refresh.py +100 -0
  231. arodonata-2.0.0/tests/integration/b6/__init__.py +1 -0
  232. arodonata-2.0.0/tests/integration/b6/test_soak.py +98 -0
  233. arodonata-2.0.0/tests/integration/b7/__init__.py +1 -0
  234. arodonata-2.0.0/tests/integration/b7/test_mcp_server.py +76 -0
  235. arodonata-2.0.0/tests/integration/b7/test_mcp_tools.py +290 -0
  236. arodonata-2.0.0/tests/integration/conftest.py +378 -0
  237. arodonata-2.0.0/tests/integration/cp_revision.py +326 -0
  238. arodonata-2.0.0/tests/integration/lab_build.py +298 -0
  239. arodonata-2.0.0/tests/integration/lab_env.py +80 -0
  240. arodonata-2.0.0/tests/integration/lab_ready.py +128 -0
  241. arodonata-2.0.0/tests/integration/probe_lab_domains.py +146 -0
  242. arodonata-2.0.0/tests/integration/probe_login_throttle.py +84 -0
  243. arodonata-2.0.0/tests/integration/restore_baseline.py +72 -0
  244. arodonata-2.0.0/tests/integration/run_lock.py +62 -0
  245. arodonata-2.0.0/tests/unit/__init__.py +0 -0
  246. arodonata-2.0.0/tests/unit/test_asset_service.py +224 -0
  247. arodonata-2.0.0/tests/unit/test_change_reports.py +709 -0
  248. arodonata-2.0.0/tests/unit/test_client.py +542 -0
  249. arodonata-2.0.0/tests/unit/test_config.py +208 -0
  250. arodonata-2.0.0/tests/unit/test_context_and_models.py +185 -0
  251. arodonata-2.0.0/tests/unit/test_cpcrud_executor.py +491 -0
  252. arodonata-2.0.0/tests/unit/test_cpcrud_inverse.py +316 -0
  253. arodonata-2.0.0/tests/unit/test_cpcrud_planner.py +665 -0
  254. arodonata-2.0.0/tests/unit/test_cpcrud_state_reader.py +256 -0
  255. arodonata-2.0.0/tests/unit/test_cpcrud_validator.py +166 -0
  256. arodonata-2.0.0/tests/unit/test_domain_service.py +369 -0
  257. arodonata-2.0.0/tests/unit/test_errors_and_telemetry.py +222 -0
  258. arodonata-2.0.0/tests/unit/test_integration_harness.py +279 -0
  259. arodonata-2.0.0/tests/unit/test_locks.py +104 -0
  260. arodonata-2.0.0/tests/unit/test_mcp_config_and_cli.py +158 -0
  261. arodonata-2.0.0/tests/unit/test_mcp_security.py +196 -0
  262. arodonata-2.0.0/tests/unit/test_mcp_tools.py +1141 -0
  263. arodonata-2.0.0/tests/unit/test_object_service.py +433 -0
  264. arodonata-2.0.0/tests/unit/test_pager.py +178 -0
  265. arodonata-2.0.0/tests/unit/test_rate_limiter.py +191 -0
  266. arodonata-2.0.0/tests/unit/test_rulebase_numbering.py +485 -0
  267. arodonata-2.0.0/tests/unit/test_rulebase_pager.py +264 -0
  268. arodonata-2.0.0/tests/unit/test_rulebase_refresh.py +512 -0
  269. arodonata-2.0.0/tests/unit/test_search_service.py +545 -0
  270. arodonata-2.0.0/tests/unit/test_service_cache.py +264 -0
  271. arodonata-2.0.0/tests/unit/test_sessions.py +759 -0
  272. arodonata-2.0.0/tests/unit/test_smoke.py +8 -0
  273. arodonata-2.0.0/tests/unit/test_sse_and_events.py +111 -0
  274. arodonata-2.0.0/tests/unit/test_storage.py +636 -0
  275. arodonata-2.0.0/tests/unit/test_sync_coordinator.py +501 -0
  276. arodonata-2.0.0/tests/unit/test_task_waiter.py +187 -0
  277. arodonata-2.0.0/tests/unit/test_tls.py +210 -0
  278. arodonata-2.0.0/tests/unit/test_transport.py +511 -0
  279. arodonata-2.0.0/uv.lock +2608 -0
@@ -0,0 +1,17 @@
1
+ ---
2
+ description: "Strict git branching rule: all work in separate branches, commit there, merge to master only via PR and squash merge"
3
+ ---
4
+
5
+ # Git Branching & PR Invariant
6
+
7
+ 1. **Dedicated Branches Only**:
8
+ - Every operation, code modification, feature addition, refactor, and documentation task MUST be carried out in a separate branch (e.g. `feat/<topic>`, `fix/<topic>`, `chore/<topic>`).
9
+ - Direct work and direct commits on `master` are strictly prohibited.
10
+
11
+ 2. **Branch Commits**:
12
+ - Commit all changes into the active working branch adhering to Conventional Commits format (`feat:`, `fix:`, `docs:`, `chore:`, etc.).
13
+ - Never push directly to `master`.
14
+
15
+ 3. **Master Integration via PR & Squash Merge**:
16
+ - Integration into `master` is performed exclusively via Pull Request (PR) with **Squash and Merge** (`gh pr create` -> `gh pr merge --squash` or via GitHub web interface).
17
+ - Never fast-forward merge into `master` locally without a squash PR.
@@ -0,0 +1,23 @@
1
+ ---
2
+ description: "Mandatory Markdown linting and formatting with markdownlint-cli whenever creating or saving .md files, plus Ruff for Python files"
3
+ ---
4
+
5
+ # Mandatory Linting on File Save
6
+
7
+ 1. **Markdown Files (`*.md`)**:
8
+ - Whenever creating, editing, or saving any `.md` file (`openspec/`, `docs/`, `README.md`, `AGENTS.md`, `CHANGELOG.md`, `.agents/`, `.claude/`), you MUST format and validate it according to `.markdownlint.yaml`:
9
+
10
+ ```bash
11
+ npx markdownlint-cli "**/*.md" --ignore node_modules --ignore .venv --fix
12
+ ```
13
+
14
+ - Ensure blank lines surround headings (`MD022`) and lists (`MD032`), avoid consecutive blank lines (`MD012`), and strip trailing spaces (`MD009`).
15
+ - In `docs/_notes/`, write each paragraph and list item on a single line without hard-wrapping line breaks.
16
+
17
+ 2. **Python Files (`*.py`)**:
18
+ - Whenever creating or modifying Python files, ensure compliance with `.ruff.toml`:
19
+
20
+ ```bash
21
+ uv run ruff check --fix .
22
+ uv run ruff format .
23
+ ```
@@ -0,0 +1 @@
1
+ antigravity
@@ -0,0 +1,206 @@
1
+ ---
2
+ name: openspec-apply-change
3
+ description: Implement tasks from an OpenSpec change. Use when the user wants to start implementing, continue implementation, or work through tasks. Also use when the user says "openspec apply", "opsx apply", or "openspec implement".
4
+ allowed-tools: Bash(openspec:*)
5
+ license: MIT
6
+ compatibility: Requires openspec CLI.
7
+ metadata:
8
+ author: openspec
9
+ version: "1.0"
10
+ generatedBy: "1.14.3"
11
+ ---
12
+
13
+ Implement tasks from an OpenSpec change.
14
+
15
+ **Store selection:** If the user names a store (a store is a standalone OpenSpec repo registered on this machine) or the work lives in one, run `openspec store list --json` to discover registered store ids, then pass `--store <id>` on the commands that read or write specs and changes (`new change`, `status`, `instructions`, `list`, `show`, `validate`, `archive`, `doctor`, `context`, `schemas`, `view`). Once selected, treat `--store <id>` as sticky for the rest of the workflow. Every unscoped example of those commands below is shorthand: before running it, append the flag. For example, run `openspec status --change "<name>" --json --store "<id>"`, not the unscoped form shown below. Other commands do not take the flag. Hints printed by commands already carry the flag; keep it on follow-ups. Without a store, commands act on the nearest local `openspec/` root.
16
+
17
+ **Project check:** These steps expect a project that already uses OpenSpec. Before the first step that writes anything (`new change`, `archive`, `sync specs`, or authoring an artifact file), confirm the project has a root: run `openspec list --json` (with `--store <id>` when a store is selected, since the store is then the root) and read `root`. A root object means the project is set up. `"root": null` means it is not - there is no `openspec/` directory here, and a write such as `openspec new change` would create one as a side effect. The command also exits non-zero, which is that answer rather than a broken CLI, so read the JSON instead of retrying or working around it.
18
+
19
+ One `"root": null` is not about setup: when a `status` error message starts with `Declared in` or `Invalid store declaration in` and names this project's `openspec/config.yaml` (or `config.yml`), the project does use OpenSpec through a store it declares, which this machine cannot resolve (the store is not registered, or the `store:` line is malformed). Do not treat it as uninitialized and skip the branches below: stop before writing and show the user that error's `message` and `fix`.
20
+
21
+ Otherwise, with no root, what happens next depends on how this workflow was reached:
22
+
23
+ - **Auto-selected**: you chose this workflow yourself, without the user naming OpenSpec, naming this skill, or running its slash command. Stop using OpenSpec and answer the request normally, as you would with no OpenSpec installed. Do not ask them to set anything up and do not mention OpenSpec setup.
24
+ - **Explicit OpenSpec request**: the user named OpenSpec, named this skill, or ran its slash command. Stop before writing and ask how to proceed: set this project up (`openspec init`), target a store they already have (`--store <id>`), or continue without OpenSpec for this request. Wait for their answer.
25
+
26
+ In both branches, never create the root as a side effect: do not run `openspec init` until the user asks for it, do not hand-create `openspec/` files, and do not let a command create it.
27
+
28
+ **Input**: Optionally specify a change name (e.g., `/openspec-apply-change add-auth`). If omitted, check if it can be inferred from conversation context. If vague or ambiguous you MUST prompt for available changes.
29
+
30
+ **Steps**
31
+
32
+ 1. **Select the change**
33
+
34
+ If a name is provided, use it. Otherwise:
35
+ - Infer from conversation context if the user mentioned a change
36
+ - Auto-select if only one active change exists
37
+ - If ambiguous, run `openspec list --json` to get available changes and ask the user to select one
38
+
39
+ Always announce: "Using change: <name>" and how to override (e.g., `/openspec-apply-change <other>`).
40
+
41
+ 2. **Check status to understand the schema**
42
+ ```bash
43
+ openspec status --change "<name>" --json
44
+ ```
45
+ Parse the JSON to understand:
46
+ - `schemaName`: The workflow being used (e.g., "spec-driven")
47
+ - `planningHome`, `changeRoot`, and `actionContext`: planning scope and edit constraints
48
+ - Which artifact contains the tasks (typically "tasks" for spec-driven, check status for others)
49
+
50
+ 3. **Get apply instructions**
51
+
52
+ ```bash
53
+ openspec instructions apply --change "<name>" --json
54
+ ```
55
+
56
+ This returns:
57
+ - `contextFiles`: artifact ID -> array of concrete file paths (varies by schema - could be proposal/specs/design/tasks or spec/tests/implementation/docs)
58
+ - Progress (total, complete, remaining)
59
+ - Task list with status, source path, and source line
60
+ - Dynamic instruction based on current state
61
+ - Optional `context`: current required project instruction input from the selected root
62
+ - Optional `operationGuidance`: current advisory guidance for apply
63
+ - `missingArtifacts` (when present): required artifact ids with no output
64
+
65
+ **Handle states:**
66
+ - If `state: "blocked"`: show the message and pause implementation.
67
+ - If `missingArtifacts` is non-empty: suggest completing the missing artifacts. Run `openspec status --change "<name>" --json`, select the next `ready` artifact (not `skipped` or `blocked`), and use `openspec instructions "<artifact-id>" --change "<name>" --json` for its rules and template. Keep the selected `--store <id>` on both commands.
68
+ - Otherwise, follow the CLI instruction to create or repair the schema-configured tracking file from existing planning artifacts. Do not assume another artifact is ready or start implementation while blocked.
69
+ - If `state: "all_done"`: report that all tracked tasks are complete and suggest review or verification as appropriate before archiving
70
+ - Otherwise: proceed to implementation
71
+
72
+ Treat `context` as a required prompt-level input. Read and consider it, and
73
+ apply relevant project facts, conventions, and constraints while implementing.
74
+ Treat `operationGuidance` as optional additive advice. Read and consider every
75
+ entry, and follow entries that are applicable and compatible with the built-in
76
+ workflow.
77
+
78
+ Keep both fields separate from CLI-returned state, missing artifacts, tasks,
79
+ progress, `contextFiles`, and the built-in `instruction`. They are not
80
+ evidence of task completion, do not replace the built-in instruction, and do
81
+ not permit bypassing a blocked state. If context conflicts with the built-in
82
+ instruction, an explicit user choice, or a CLI-controlled value, report the
83
+ conflict and preserve the controlling value. If guidance is inapplicable or
84
+ conflicts with those controlling inputs, do not follow it and explain why.
85
+ These are prompt-level behavior contracts, not enforceable checks.
86
+
87
+ 4. **Read context files**
88
+
89
+ Read every file path listed under `contextFiles` from the apply instructions output.
90
+ The files depend on the schema being used:
91
+ - **spec-driven**: proposal, specs, design, tasks
92
+ - Other schemas: follow the contextFiles from CLI output
93
+
94
+ Do not copy `context` or `operationGuidance` verbatim into implementation
95
+ files or planning artifacts unless the user separately asks for that content.
96
+
97
+ 5. **Show current progress**
98
+
99
+ Display:
100
+ - Schema being used
101
+ - Progress: "N/M tasks complete"
102
+ - Remaining tasks overview
103
+ - Dynamic instruction from CLI
104
+
105
+ 6. **Implement tasks (loop until done or blocked)**
106
+
107
+ For each pending task:
108
+ - Show which task is being worked on
109
+ - Make the code changes required
110
+ - Keep changes minimal and focused
111
+ - Before editing, confirm the checkbox at the returned `sourcePath` and `line` still matches the task description; if it does not, rerun the apply instructions and use the refreshed location
112
+ - Mark the task complete at its returned `sourcePath` and `line`: `- [ ]` → `- [x]`
113
+ - Rerun the apply instructions and confirm that task is now done and progress changed
114
+ - Continue to next task
115
+
116
+ **Pause if:**
117
+ - Task is unclear → ask for clarification
118
+ - Implementation reveals a design issue → suggest updating artifacts
119
+ - A task needs work beyond what the spec and tasks describe, or you are tempted to drop, narrow, defer, or accept exceptions to specified behavior to make it fit → surface the added scope and ask; do not absorb it silently
120
+ - Error or blocker encountered → report and wait for guidance
121
+ - User interrupts
122
+
123
+ 7. **On completion or pause, show status**
124
+
125
+ Display:
126
+ - Tasks completed this session
127
+ - Overall progress: "N/M tasks complete"
128
+ - If all done: report that tracked tasks are complete and suggest review or verification as appropriate before archiving
129
+ - If paused: explain why and wait for guidance
130
+
131
+ **Output During Implementation**
132
+
133
+ ```
134
+ ## Implementing: <change-name> (schema: <schema-name>)
135
+
136
+ Working on task 3/7: <task description>
137
+ [...implementation happening...]
138
+ ✓ Task complete
139
+
140
+ Working on task 4/7: <task description>
141
+ [...implementation happening...]
142
+ ✓ Task complete
143
+ ```
144
+
145
+ **Output On Completion**
146
+
147
+ ```
148
+ ## Implementation Complete
149
+
150
+ **Change:** <change-name>
151
+ **Schema:** <schema-name>
152
+ **Progress:** 7/7 tasks complete ✓
153
+
154
+ ### Completed This Session
155
+ - [x] Task 1
156
+ - [x] Task 2
157
+ ...
158
+
159
+ All tracked tasks are complete. Review or verify the change as appropriate
160
+ before archiving. You can archive this change with `/openspec-archive-change`.
161
+ ```
162
+
163
+ **Output On Pause (Issue Encountered)**
164
+
165
+ ```
166
+ ## Implementation Paused
167
+
168
+ **Change:** <change-name>
169
+ **Schema:** <schema-name>
170
+ **Progress:** 4/7 tasks complete
171
+
172
+ ### Issue Encountered
173
+ <description of the issue>
174
+
175
+ **Options:**
176
+ 1. <option 1>
177
+ 2. <option 2>
178
+ 3. Other approach
179
+
180
+ What would you like to do?
181
+ ```
182
+
183
+ **Guardrails**
184
+ - Keep going through tasks until done or blocked
185
+ - Always read context files before starting (from the apply instructions output)
186
+ - If task is ambiguous, pause and ask before implementing
187
+ - If implementation reveals issues, pause and suggest artifact updates
188
+ - Keep code changes minimal and scoped to each task
189
+ - Update task checkbox immediately after completing each task
190
+ - Pause on errors, blockers, or unclear requirements - don't guess
191
+ - When a task needs work beyond what the spec describes, surface the added scope and pause - never silently narrow, defer, or simplify away specified behavior
192
+ - Only mark a task `- [x]` when its specified behavior is fully implemented, not when it is partially done or deferred
193
+ - Use contextFiles from CLI output, don't assume specific file names
194
+ - Use each task's sourcePath and line to update its exact checkbox
195
+ - Do not use context or operation guidance as proof that a task is complete
196
+ - Apply relevant project context; report conflicts with controlling workflow inputs
197
+ - Consider every guidance entry; explain any inapplicable or conflicting advice
198
+ - Do not copy runtime context or operation guidance into implementation files or planning artifacts
199
+ - Preserve CLI-controlled blocked/ready/all-done behavior and completion criteria
200
+
201
+ **Fluid Workflow Integration**
202
+
203
+ This skill supports the "actions on a change" model:
204
+
205
+ - **Can be invoked anytime**: Before all artifacts are done (if tasks exist), after partial implementation, interleaved with other actions
206
+ - **Allows artifact updates**: If implementation reveals design issues, suggest updating artifacts - not phase-locked, work fluidly
@@ -0,0 +1,221 @@
1
+ ---
2
+ name: openspec-archive-change
3
+ description: Archive a completed OpenSpec change in the experimental workflow. Use when the user wants to finalize and archive a change after implementation is complete. Also use when the user says "openspec archive" or "opsx archive".
4
+ allowed-tools: Bash(openspec:*)
5
+ license: MIT
6
+ compatibility: Requires openspec CLI.
7
+ metadata:
8
+ author: openspec
9
+ version: "1.0"
10
+ generatedBy: "1.14.3"
11
+ ---
12
+
13
+ Archive a completed change in the experimental workflow.
14
+
15
+ **Store selection:** If the user names a store (a store is a standalone OpenSpec repo registered on this machine) or the work lives in one, run `openspec store list --json` to discover registered store ids, then pass `--store <id>` on the commands that read or write specs and changes (`new change`, `status`, `instructions`, `list`, `show`, `validate`, `archive`, `doctor`, `context`, `schemas`, `view`). Once selected, treat `--store <id>` as sticky for the rest of the workflow. Every unscoped example of those commands below is shorthand: before running it, append the flag. For example, run `openspec status --change "<name>" --json --store "<id>"`, not the unscoped form shown below. Other commands do not take the flag. Hints printed by commands already carry the flag; keep it on follow-ups. Without a store, commands act on the nearest local `openspec/` root.
16
+
17
+ **Project check:** These steps expect a project that already uses OpenSpec. Before the first step that writes anything (`new change`, `archive`, `sync specs`, or authoring an artifact file), confirm the project has a root: run `openspec list --json` (with `--store <id>` when a store is selected, since the store is then the root) and read `root`. A root object means the project is set up. `"root": null` means it is not - there is no `openspec/` directory here, and a write such as `openspec new change` would create one as a side effect. The command also exits non-zero, which is that answer rather than a broken CLI, so read the JSON instead of retrying or working around it.
18
+
19
+ One `"root": null` is not about setup: when a `status` error message starts with `Declared in` or `Invalid store declaration in` and names this project's `openspec/config.yaml` (or `config.yml`), the project does use OpenSpec through a store it declares, which this machine cannot resolve (the store is not registered, or the `store:` line is malformed). Do not treat it as uninitialized and skip the branches below: stop before writing and show the user that error's `message` and `fix`.
20
+
21
+ Otherwise, with no root, what happens next depends on how this workflow was reached:
22
+
23
+ - **Auto-selected**: you chose this workflow yourself, without the user naming OpenSpec, naming this skill, or running its slash command. Stop using OpenSpec and answer the request normally, as you would with no OpenSpec installed. Do not ask them to set anything up and do not mention OpenSpec setup.
24
+ - **Explicit OpenSpec request**: the user named OpenSpec, named this skill, or ran its slash command. Stop before writing and ask how to proceed: set this project up (`openspec init`), target a store they already have (`--store <id>`), or continue without OpenSpec for this request. Wait for their answer.
25
+
26
+ In both branches, never create the root as a side effect: do not run `openspec init` until the user asks for it, do not hand-create `openspec/` files, and do not let a command create it.
27
+
28
+ `<capability-path>` is the spec directory relative to `specs/` (for example, `user-auth` or `identity/user-auth`). Preserve the full path from each delta spec when resolving its main spec.
29
+
30
+ **Input**: Optionally specify a change name. If omitted, check if it can be inferred from conversation context. If vague or ambiguous you MUST prompt for available changes.
31
+
32
+ **Steps**
33
+
34
+ 1. **Select the change**
35
+
36
+ If a name is provided, use it. Otherwise:
37
+ - Infer from conversation context if the user mentioned a change
38
+ - Auto-select if only one active change exists
39
+ - If ambiguous, run `openspec list --json` to get available changes and ask the user to select one
40
+
41
+ When prompting, show only active changes (not already archived).
42
+ Include the schema used for each change if available.
43
+
44
+ Always announce: "Using change: <name>" and how to override (e.g., `/openspec-archive-change <other>`).
45
+
46
+ **Load current archive inputs before the existing archive checks:**
47
+
48
+ After resolving the selected change and planning root, run:
49
+ ```bash
50
+ openspec instructions archive --change "<name>" --json
51
+ ```
52
+ Keep the same selected-root flags on this command. This lookup is advisory and
53
+ optional: it only supplies extra prompt inputs, so it must never block archiving.
54
+ If it exits non-zero or returns invalid JSON — for example on an older CLI that
55
+ does not support this command yet — continue the archive workflow with no
56
+ context and no operation guidance. Do not report an error and do not stop.
57
+
58
+ A successful response may omit both optional fields. Treat `context` as a
59
+ required prompt-level input: read and consider it, and apply relevant project
60
+ facts, conventions, and constraints. Treat `operationGuidance` as optional
61
+ additive advice: read and consider every entry, and follow entries that are
62
+ applicable and compatible with the built-in archive workflow.
63
+
64
+ Keep both fields separate from built-in steps, explicit user choices, resolved
65
+ paths, CLI checks, and command contracts. If context conflicts with one of those
66
+ controlling inputs, report the conflict and preserve the controlling value. If
67
+ guidance is inapplicable or conflicts with a controlling input, do not follow it
68
+ and explain why. Do not infer replacement paths, skipped prompts, or flags from
69
+ either field, and do not copy their text verbatim into specs, change artifacts,
70
+ or archive summaries unless the user separately asks for it. These are
71
+ prompt-level behavior contracts, not enforceable checks.
72
+
73
+ 2. **Check artifact completion status**
74
+
75
+ Run `openspec status --change "<name>" --json` to check artifact completion.
76
+
77
+ Parse the JSON to understand:
78
+ - `schemaName`: The workflow being used
79
+ - `planningHome`, `changeRoot`, `artifactPaths`, and `actionContext`: path and scope context
80
+ - `artifacts`: List of artifacts with their status (`done`, `skipped`, or other)
81
+
82
+ **If any artifacts are neither `done` nor `skipped`** (skipped artifacts satisfy the requirement - the change declares skip_specs):
83
+ - Display warning listing incomplete artifacts
84
+ - Ask the user to confirm they want to proceed
85
+ - Proceed if user confirms
86
+
87
+ 3. **Check task completion status**
88
+
89
+ Run `openspec list --json` with the same selected-root flags and find the
90
+ entry in `changes` whose `name` exactly matches the selected change.
91
+ Require exactly one match and nonnegative integer `totalTasks` and
92
+ `completedTasks`, with `completedTasks <= totalTasks`. The CLI resolves
93
+ the schema's tracked task files, including custom artifact names, output
94
+ paths, and globs.
95
+ Incomplete tasks = `totalTasks - completedTasks`.
96
+
97
+ Do not infer task completion from artifact status or the absence of a
98
+ top-level `tasks.md`. If the lookup fails, returns invalid JSON, omits or
99
+ duplicates the selected change, or returns invalid counts, report the problem
100
+ and stop before syncing or archiving.
101
+ The CLI counts only `x`/`X` checkbox markers as complete;
102
+ other markers, including unfamiliar ones, remain incomplete.
103
+
104
+ **If incomplete tasks found:**
105
+ - Display warning showing count of incomplete tasks
106
+ - Ask the user to confirm they want to proceed
107
+ - Proceed if user confirms
108
+
109
+ **If `totalTasks` is zero:** Proceed without a task-related warning.
110
+
111
+ 4. **Assess delta spec sync state**
112
+
113
+ Use `artifactPaths.specs.existingOutputPaths` from status JSON as the only
114
+ delta-spec source. If the `specs` entry is missing or
115
+ `existingOutputPaths` is empty, proceed without a sync prompt and do not infer
116
+ delta specs from other artifacts.
117
+
118
+ **If delta specs exist:**
119
+ - Compare each delta spec with its corresponding main spec at `<planningHome.root>/openspec/specs/<capability-path>/spec.md` (use the store-aware `planningHome.root` from step 2, not a hardcoded repo path)
120
+ - A missing main spec is **not automatically** "already synced". For a new capability, the main spec is an *output* of the sync, not an input:
121
+ - If the delta has MODIFIED or RENAMED requirements, report that only ADDED requirements can create a new main spec and mark that capability as sync-blocked. Never invent a requirement that has no current version.
122
+ - Otherwise, if the delta has only REMOVED requirements and the change's `.openspec.yaml` declares `retire_capabilities: true`, the capability is already retired: count it as already synced, warn that there is nothing left to remove, and do not recreate the main spec. Apply this rule both now and when verifying a completed sync.
123
+ - Otherwise, if the delta has no ADDED requirements, report that no sync is possible and mark that capability as sync-blocked. For a REMOVED-only delta, warn that there is no main spec to remove from and leave the main-spec tree unchanged. `openspec archive` refuses the unmarked REMOVED-only case with `Spec must have at least one requirement`.
124
+ - Otherwise, count the capability as needing sync and name it in the summary (`<capability-path>: new main spec will be created`). If the delta also has REMOVED requirements, warn that they will be ignored because there is no main spec to remove from. The sync creates the main spec from only the delta's ADDED requirements, exactly as `openspec archive` does.
125
+ - Determine what changes would be applied (adds, modifications, removals, renames)
126
+ - Continue assessing the remaining capabilities even when one is sync-blocked. Show a combined summary before prompting.
127
+
128
+ **Prompt options:**
129
+ - If any capability is sync-blocked: explain why and offer only "Archive without syncing", "Cancel"
130
+ - Otherwise, if changes needed: "Sync now (recommended)", "Archive without syncing"
131
+ - Otherwise, if already synced: "Archive now", "Sync anyway", "Cancel"
132
+
133
+ Route on the answer:
134
+ - "Cancel" — stop, do not archive
135
+ - "Archive without syncing" or "Archive now" — proceed to archive
136
+ - "Sync now" or "Sync anyway" — sync, then verify (below). Do not start any sync while a capability is sync-blocked; explain the blocker and repeat the available choices.
137
+ - Anything else — ask again rather than archiving
138
+
139
+ Before a selected sync writes any main spec, run
140
+ `openspec instructions specs --change "<name>" --json` once with the same
141
+ selected-root flags. Require a zero exit status and valid artifact-instruction
142
+ JSON. If the lookup fails or returns invalid JSON, report the error and stop
143
+ before writing any main spec or moving the change. A valid response with omitted
144
+ `rules` is the no-rules case. Apply returned `rules` only to the content and
145
+ form of main specs produced by this merge; do not use them as archive guidance,
146
+ change CLI behavior, or copy the rule text into any output file.
147
+
148
+ Then run the `openspec-sync-specs` workflow inline (agent-driven intelligent merge) for change '<name>', passing the delta spec analysis and the fetched specs-rule snapshot from above, and wait for it to finish. The inline sync must reuse that snapshot without fetching `specs` instructions again. Do not delegate it to a background task — step 5 would move `changeRoot` out from under a sync that is still reading it, leaving the change archived and the main specs never updated. If your agent can only run it by delegation, delegate synchronously and wait for the result.
149
+
150
+ If the sync reports any stop or blocking condition, treat the sync as failed.
151
+ Stop the archive immediately. Do not perform the post-sync content comparison and do not move its `changeRoot`.
152
+ Nothing has moved, so the user can fix the blocking condition or re-run the sync.
153
+
154
+ After the sync writes each main spec, verify its structure against the canonical sync contract:
155
+ - A new main spec starts with a `# <capability> Specification` title. An existing main spec keeps its title exactly as it is.
156
+ - Preserve existing `## Purpose` sections completely untouched for established main specs.
157
+ - For a new main spec, copy the delta `## Purpose` verbatim. Warn only if the purpose text is shorter than standard validation expects. Do not regenerate or rewrite existing authored purpose. If no usable `## Purpose` is provided, use the existing TBD Purpose behavior and warning.
158
+ - Verify that no delta-style section headers (`## ADDED Requirements`, `## MODIFIED Requirements`, `## REMOVED Requirements`, `## RENAMED Requirements`) remain in the main spec, adhering strictly to the sync workflow formatting rules.
159
+ - Requirement blocks the sync wrote or changed use `### Requirement:` headings, and their scenarios use `#### Scenario:` headings, under the spec's `## Requirements` section. Leave content the delta does not mention exactly as it is.
160
+
161
+ Then re-run the comparison from the top of this step, including the explicitly retired, missing-spec case, against every capability that has a delta spec in `artifactPaths.specs.existingOutputPaths` — not only the ones the sync reports it touched. A successful sync leaves nothing left to apply, so each capability must now read as already synced:
162
+ - ADDED requirements present
163
+ - MODIFIED requirements carrying the scenario and description changes named in the delta, with their other scenarios intact
164
+ - REMOVED requirements gone — and where this sync retired a capability (removed its last requirement, leaving `## Requirements` empty), its main spec deleted rather than left empty.
165
+ - RENAMED requirements present under the new name and absent under the old one
166
+
167
+ If the sync failed, or any capability does not match, report what differs and stop — do not archive. Nothing has moved and `changeRoot` is intact, so the user can fix the mismatch or re-run the sync and start the archive again.
168
+
169
+ 5. **Perform the archive**
170
+
171
+ Create an `archive` directory under `planningHome.changesDir` if it doesn't exist:
172
+ ```bash
173
+ mkdir -p "<planningHome.changesDir>/archive"
174
+ ```
175
+
176
+ Generate the target name: use the change name as-is when it already starts with a `YYYY-MM-DD-` prefix; otherwise prepend the current date as `YYYY-MM-DD-<change-name>`. Never stack a second date (same rule as `openspec archive`).
177
+
178
+ **Check if target already exists:**
179
+ - If yes: Fail with error, suggest renaming existing archive or using different date
180
+ - If no: Move `changeRoot` to the archive directory
181
+
182
+ ```bash
183
+ mv "<changeRoot>" "<planningHome.changesDir>/archive/<target-name>"
184
+ ```
185
+
186
+ 6. **Display summary**
187
+
188
+ Show archive completion summary including:
189
+ - Change name
190
+ - Schema that was used
191
+ - Archive location
192
+ - Whether specs were synced (if applicable)
193
+ - Note about any warnings (incomplete artifacts/tasks)
194
+
195
+ **Output On Success**
196
+
197
+ ```markdown
198
+ ## Archive Complete
199
+
200
+ **Change:** <change-name>
201
+ **Schema:** <schema-name>
202
+ **Archived to:** the archive path derived from `planningHome.changesDir`/<target-name>/
203
+ **Specs:** <"✓ Synced to main specs" only if the step 4 verification passed; otherwise "No delta specs" or "Sync skipped">
204
+
205
+ <"All artifacts complete. All tasks complete." — or, if archived with warnings, list them instead (e.g. "Archived with 2 incomplete tasks")>
206
+ ```
207
+
208
+ **Guardrails**
209
+ - Announce the selected change; prompt for selection when it is ambiguous
210
+ - Use artifact graph (openspec status --json) for completion checking
211
+ - Don't block archive on warnings - just inform and confirm
212
+ - Preserve .openspec.yaml when moving to archive (it moves with the directory)
213
+ - Show clear summary of what happened
214
+ - If sync is requested, run the `openspec-sync-specs` workflow inline (agent-driven)
215
+ - Never archive while a spec sync is still in flight — run the sync inline and verify the main specs before moving `changeRoot`
216
+ - If delta specs exist, always run the sync assessment and show the combined summary before prompting
217
+ - Apply relevant runtime context and report conflicts; operation guidance remains advisory
218
+ - Consider every guidance entry and explain any inapplicable or conflicting advice
219
+ - Existing CLI checks, resolved paths, prompts, and command contracts are unchanged
220
+ - Artifact rules constrain only the specs being written and are never operation guidance
221
+ - Never copy runtime context, operation guidance, or artifact-rule text verbatim into output files