@buildr-ai/buildr 0.1.0-rc.2 → 0.1.0-rc.21

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 (181) hide show
  1. package/README.md +47 -5
  2. package/application-payload.json +595 -0
  3. package/bin/buildr.mjs +14 -0
  4. package/installation-origin.json +13 -0
  5. package/package.json +16 -45
  6. package/payload/licenses/dependencies/yaml-LICENSE +13 -0
  7. package/payload/product/LICENSE +21 -0
  8. package/payload/product/README.md +59 -0
  9. package/payload/product/package/README.md +42 -0
  10. package/{package → payload/product/package}/bootstrap/contract.yml +26 -11
  11. package/{package → payload/product/package}/bootstrap/guide.md +11 -11
  12. package/payload/product/package/launchers/assets/Buildr.icns +0 -0
  13. package/payload/product/package/launchers/assets/Buildr.ico +0 -0
  14. package/payload/product/package/manifest.yml +547 -0
  15. package/payload/product/package/targets/runtime/skills/buildr/SKILL.md +174 -0
  16. package/{package → payload/product/package}/targets/workspace/commands/buildr/openspec/manifest.yml +2 -2
  17. package/payload/product/package/targets/workspace/components/buildr/openspec/component.yml +79 -0
  18. package/payload/product/package/targets/workspace/components/buildr/openspec/contributions/openspec-apply-sidebar.md +21 -0
  19. package/payload/product/package/targets/workspace/components/buildr/openspec/contributions/openspec-archive-converge.md +5 -0
  20. package/payload/product/package/targets/workspace/components/buildr/openspec/contributions/openspec-explore-terminology.md +5 -0
  21. package/payload/product/package/targets/workspace/components/buildr/openspec/contributions/openspec-propose-sidebar.md +21 -0
  22. package/payload/product/package/targets/workspace/components/buildr/openspec/contributions/openspec-sync-converge.md +5 -0
  23. package/payload/product/package/targets/workspace/components/buildr/openspec/contributions/openspec-update-sidebar.md +13 -0
  24. package/payload/product/package/targets/workspace/gitattributes +1 -0
  25. package/payload/product/package/targets/workspace/gitignore +31 -0
  26. package/{package → payload/product/package}/targets/workspace/projects/AGENTS.project.md +1 -1
  27. package/payload/product/package/targets/workspace/rules/buildr/core.md +62 -0
  28. package/payload/product/package/targets/workspace/skills/buildr/capability-adaptation/SKILL.md +56 -0
  29. package/payload/product/package/targets/workspace/skills/buildr/capability-adaptation/agents/openai.yaml +4 -0
  30. package/payload/product/package/targets/workspace/skills/buildr/current-knowledge-maintenance/SKILL.md +103 -0
  31. package/payload/product/package/targets/workspace/skills/buildr/declaration-intake/SKILL.md +65 -0
  32. package/payload/product/package/targets/workspace/skills/buildr/git-operations/SKILL.md +100 -0
  33. package/payload/product/package/targets/workspace/skills/buildr/openspec-contract-guard/SKILL.md +65 -0
  34. package/payload/product/package/targets/workspace/skills/buildr/project-daily-progress/SKILL.md +52 -0
  35. package/payload/product/package/targets/workspace/skills/buildr/project-testing/SKILL.md +84 -0
  36. package/payload/product/package/targets/workspace/skills/buildr/project-testing/references/testing-model-v1.md +116 -0
  37. package/payload/product/package/targets/workspace/skills/buildr/task-development/SKILL.md +108 -0
  38. package/payload/product/package/targets/workspace/skills/buildr/task-environment/SKILL.md +42 -0
  39. package/payload/product/package/targets/workspace/skills/buildr/task-environment/agents/openai.yaml +4 -0
  40. package/payload/product/package/targets/workspace/skills/buildr/task-environment/references/project-environment-preparation-v1.md +14 -0
  41. package/payload/product/package/targets/workspace/skills/buildr/task-environment/templates/project-preparation.yml +20 -0
  42. package/payload/product/package/targets/workspace/skills/buildr/task-environment/templates/task-environment-plan-request.json +17 -0
  43. package/payload/product/package/targets/workspace/skills/buildr/task-finish/SKILL.md +80 -0
  44. package/payload/product/package/targets/workspace/skills/buildr/task-manager/SKILL.md +47 -0
  45. package/payload/product/package/targets/workspace/skills/buildr/task-manager/agents/openai.yaml +4 -0
  46. package/payload/product/package/targets/workspace/skills/buildr/task-retrospective/SKILL.md +101 -0
  47. package/payload/product/package/targets/workspace/skills/buildr/task-retrospective/agents/openai.yaml +4 -0
  48. package/payload/product/package/targets/workspace/skills/buildr/task-review/SKILL.md +60 -0
  49. package/payload/product/package/targets/workspace/skills/buildr/task-review/agents/openai.yaml +4 -0
  50. package/payload/product/package/targets/workspace/skills/buildr/task-triage/SKILL.md +119 -0
  51. package/payload/product/package/targets/workspace/skills/buildr/task-verification/SKILL.md +142 -0
  52. package/payload/product/package/targets/workspace/skills/buildr/task-verification/references/project-verification-v2.md +51 -0
  53. package/payload/product/package/targets/workspace/skills/buildr/task-verification/templates/project-verification.yml +16 -0
  54. package/payload/product/package/targets/workspace/skills/buildr/task-worktree/SKILL.md +28 -0
  55. package/payload/product/package/targets/workspace/skills/buildr/terminology-governance/SKILL.md +60 -0
  56. package/payload/product/package/targets/workspace/skills/buildr/ui-preview/SKILL.md +74 -0
  57. package/payload/product/package/targets/workspace/skills/contracts/buildr/current-knowledge-maintenance/v1.md +36 -0
  58. package/payload/product/package/targets/workspace/skills/contracts/buildr/current-knowledge-maintenance/v2.md +45 -0
  59. package/payload/product/package/targets/workspace/skills/contracts/buildr/git-operations/v1.md +39 -0
  60. package/payload/product/package/targets/workspace/skills/contracts/buildr/git-worktree-provider/v1.md +35 -0
  61. package/payload/product/package/targets/workspace/skills/contracts/buildr/task-development/v2.md +61 -0
  62. package/payload/product/package/targets/workspace/skills/contracts/buildr/task-environment/v1.md +37 -0
  63. package/payload/product/package/targets/workspace/skills/contracts/buildr/task-finish/v1.md +59 -0
  64. package/payload/product/package/targets/workspace/skills/contracts/buildr/task-record/v2.md +35 -0
  65. package/payload/product/package/targets/workspace/skills/contracts/buildr/task-retrospective/v2.md +41 -0
  66. package/payload/product/package/targets/workspace/skills/contracts/buildr/task-review/v1.md +39 -0
  67. package/payload/product/package/targets/workspace/skills/contracts/buildr/task-verification/v3.md +63 -0
  68. package/payload/product/package/targets/workspace/skills/contracts/buildr/terminology-governance/v1.md +36 -0
  69. package/{package → payload/product/package}/targets/workspace/skills/openspec/openspec-apply-change/SKILL.md +4 -3
  70. package/{package → payload/product/package}/targets/workspace/skills/openspec/openspec-archive-change/SKILL.md +4 -3
  71. package/{package → payload/product/package}/targets/workspace/skills/openspec/openspec-explore/SKILL.md +4 -1
  72. package/{package → payload/product/package}/targets/workspace/skills/openspec/openspec-propose/SKILL.md +4 -1
  73. package/{package → payload/product/package}/targets/workspace/skills/openspec/openspec-sync-specs/SKILL.md +4 -3
  74. package/payload/product/package/targets/workspace/skills/openspec/openspec-update-change/SKILL.md +86 -0
  75. package/payload/product/package.json +33 -0
  76. package/payload/product/src/infrastructure/sqlite/migrations/0000_create_migration_ledger.sql +16 -0
  77. package/payload/product/src/infrastructure/sqlite/migrations/0001_create_task_store.sql +47 -0
  78. package/payload/product/src/infrastructure/sqlite/migrations/0002_create_parent_task_relations.sql +7 -0
  79. package/payload/product/src/infrastructure/sqlite/migrations/0003_inline_parent_task_column.sql +19 -0
  80. package/payload/product/src/infrastructure/sqlite/migrations/0004_create_task_current_records.sql +16 -0
  81. package/payload/product/src/infrastructure/sqlite/migrations/0005_create_task_retrospective_current.sql +4 -0
  82. package/payload/product/src/infrastructure/sqlite/migrations/0006_create_task_lifecycle_current.sql +4 -0
  83. package/payload/product/src/infrastructure/sqlite/migrations/0007_create_task_finish_current.sql +46 -0
  84. package/payload/product/src/infrastructure/sqlite/migrations/0008_create_task_environment_current.sql +8 -0
  85. package/payload/product/src/infrastructure/sqlite/migrations/0009_retire_task_lifecycle_current.sql +107 -0
  86. package/payload/product/src/infrastructure/sqlite/migrations/0010_add_task_retrospective_disposition.sql +19 -0
  87. package/payload/product/src/infrastructure/sqlite/migrations/0011_create_task_execution_records.sql +115 -0
  88. package/payload/product/src/infrastructure/sqlite/migrations/0012_compact_task_finish_current.sql +261 -0
  89. package/payload/product/src/infrastructure/sqlite/migrations/0013_add_todo_task_retrospective_sources.sql +56 -0
  90. package/payload/product/src/infrastructure/sqlite/migrations/0014_add_task_execution_invocation_identity.sql +14 -0
  91. package/payload/product/src/infrastructure/sqlite/migrations/0015_add_task_execution_unknown_outcome.sql +143 -0
  92. package/payload/product/src/infrastructure/sqlite/migrations/0016_allow_terminal_task_finish_target_lease.sql +83 -0
  93. package/payload/product/src/infrastructure/sqlite/migrations/0017_expand_task_finish_repository_set.sql +111 -0
  94. package/payload/product/src/interfaces/local-app/web-dist/assets/antd-NAtxFWmu.js +394 -0
  95. package/payload/product/src/interfaces/local-app/web-dist/assets/index-BqoyfMSY.css +1 -0
  96. package/payload/product/src/interfaces/local-app/web-dist/assets/index-DTqvE0TF.js +39 -0
  97. package/payload/product/src/interfaces/local-app/web-dist/assets/react-9kRp7SbA.js +28 -0
  98. package/payload/product/src/interfaces/local-app/web-dist/index.html +19 -0
  99. package/payload/runtime/read-worker.cjs +45071 -0
  100. package/runtime/buildr.cjs +51533 -0
  101. package/scripts/postinstall.mjs +15 -0
  102. package/docs/agent-runtime-adapters.md +0 -94
  103. package/docs/cli-architecture.md +0 -65
  104. package/docs/cli-reference.md +0 -67
  105. package/docs/known-limitations.md +0 -15
  106. package/examples/minimal-workspace/README.md +0 -24
  107. package/package/README.md +0 -28
  108. package/package/manifest.yml +0 -150
  109. package/package/targets/runtime/skills/buildr/SKILL.md +0 -154
  110. package/package/targets/workspace/.buildr/workspace.yml +0 -5
  111. package/package/targets/workspace/commands/manifest.yml +0 -2
  112. package/package/targets/workspace/components/buildr/openspec/component.yml +0 -16
  113. package/package/targets/workspace/components/buildr/openspec/contributions/openspec-apply-sidebar.md +0 -3
  114. package/package/targets/workspace/components/buildr/openspec/contributions/openspec-archive-sidebar.md +0 -3
  115. package/package/targets/workspace/components/buildr/openspec/contributions/openspec-explore-sidebar.md +0 -3
  116. package/package/targets/workspace/components/buildr/openspec/contributions/openspec-propose-sidebar.md +0 -3
  117. package/package/targets/workspace/components/buildr/openspec/contributions/openspec-sync-sidebar.md +0 -3
  118. package/package/targets/workspace/components/buildr/openspec/contributions/task-finish-post-sync.md +0 -1
  119. package/package/targets/workspace/components/buildr/openspec/contributions/task-finish-pre-sync.md +0 -1
  120. package/package/targets/workspace/components/buildr/openspec/contributions/task-triage-change-ready.md +0 -10
  121. package/package/targets/workspace/components/manifest.yml +0 -2
  122. package/package/targets/workspace/gitignore +0 -16
  123. package/package/targets/workspace/projects/manifest.yml +0 -2
  124. package/package/targets/workspace/projects/services/manifest.yml +0 -3
  125. package/package/targets/workspace/projects/skills/manifest.yml +0 -2
  126. package/package/targets/workspace/rules/buildr/core.md +0 -65
  127. package/package/targets/workspace/rules/manifest.yml +0 -9
  128. package/package/targets/workspace/skills/buildr/git-ops/SKILL.md +0 -73
  129. package/package/targets/workspace/skills/buildr/openspec-contract-guard/SKILL.md +0 -67
  130. package/package/targets/workspace/skills/buildr/task-finish/SKILL.md +0 -104
  131. package/package/targets/workspace/skills/buildr/task-triage/SKILL.md +0 -103
  132. package/package/targets/workspace/skills/buildr/task-worktree/SKILL.md +0 -104
  133. package/package/targets/workspace/skills/manifest.yml +0 -38
  134. package/tools/buildr +0 -11
  135. package/tools/cli/application/cli-update.mjs +0 -219
  136. package/tools/cli/application/compose-runtime.mjs +0 -38
  137. package/tools/cli/application/doctor/runtime-diagnostics.mjs +0 -227
  138. package/tools/cli/application/doctor/scope-diagnostics.mjs +0 -440
  139. package/tools/cli/application/doctor/service-diagnostics.mjs +0 -184
  140. package/tools/cli/application/doctor.mjs +0 -201
  141. package/tools/cli/application/package-maintenance/builtin-receipts.mjs +0 -73
  142. package/tools/cli/application/package-maintenance/output.mjs +0 -148
  143. package/tools/cli/application/package-maintenance/smoke-checks.mjs +0 -463
  144. package/tools/cli/application/package-maintenance/static-validation.mjs +0 -680
  145. package/tools/cli/application/package-maintenance.mjs +0 -540
  146. package/tools/cli/application/runtime.mjs +0 -118
  147. package/tools/cli/application/workspace-operations.mjs +0 -311
  148. package/tools/cli/bootstrap.mjs +0 -6
  149. package/tools/cli/command/help.mjs +0 -296
  150. package/tools/cli/command/registry.mjs +0 -97
  151. package/tools/cli/domains/commands.mjs +0 -661
  152. package/tools/cli/domains/components.mjs +0 -922
  153. package/tools/cli/domains/openspec.mjs +0 -603
  154. package/tools/cli/domains/package-assets.mjs +0 -652
  155. package/tools/cli/domains/rules.mjs +0 -380
  156. package/tools/cli/domains/runtime.mjs +0 -87
  157. package/tools/cli/domains/skills.mjs +0 -647
  158. package/tools/cli/domains/workspace.mjs +0 -571
  159. package/tools/cli/shared/infrastructure.mjs +0 -411
  160. package/tools/cli/shared/json-contracts.mjs +0 -22
  161. package/tools/cli/shared/platform.mjs +0 -52
  162. package/tools/runtime/adapter-contract.mjs +0 -655
  163. package/tools/runtime/check-claude-code.mjs +0 -23
  164. package/tools/runtime/check-codex.mjs +0 -23
  165. package/tools/runtime/check-runtime.mjs +0 -98
  166. package/tools/runtime/projection.mjs +0 -375
  167. package/tools/runtime/render-claude-code-rules.mjs +0 -459
  168. package/tools/runtime/render-claude-code.mjs +0 -59
  169. package/tools/runtime/skills/arguments.mjs +0 -51
  170. package/tools/runtime/skills/contributions.mjs +0 -171
  171. package/tools/runtime/skills/manifests.mjs +0 -167
  172. package/tools/runtime/skills/primitives.mjs +0 -86
  173. package/tools/runtime/skills/render-plan.mjs +0 -243
  174. package/tools/runtime/skills/sources.mjs +0 -276
  175. package/tools/shared/fetch-remote-text.mjs +0 -78
  176. package/tools/verification/integrity/managed-data-integrity.mjs +0 -107
  177. package/tools/verification/integrity/managed-mutations.mjs +0 -72
  178. package/tools/verification/openspec/contract.mjs +0 -212
  179. package/tools/verification/runtime/adapter-contract.mjs +0 -218
  180. package/tools/verification/runtime/adapter-parity.mjs +0 -173
  181. /package/{package → payload/product/package}/targets/workspace/AGENTS.md +0 -0
@@ -1,12 +1,13 @@
1
1
  ---
2
2
  name: openspec-propose
3
3
  description: Propose a new change with all artifacts generated in one step. Use when the user wants to quickly describe what they want to build and get a complete proposal with design, specs, and tasks ready for implementation.
4
+ allowed-tools: Bash(openspec:*)
4
5
  license: MIT
5
6
  compatibility: Requires openspec CLI.
6
7
  metadata:
7
8
  author: openspec
8
9
  version: "1.0"
9
- generatedBy: "1.4.1"
10
+ generatedBy: "1.6.0"
10
11
  ---
11
12
 
12
13
  Propose a new change - create the change and generate all artifacts in one step.
@@ -20,6 +21,8 @@ When ready to implement, run /opsx:apply
20
21
 
21
22
  ---
22
23
 
24
+ **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`). 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.
25
+
23
26
  **Input**: The user's request should include a change name (kebab-case) OR a description of what they want to build.
24
27
 
25
28
  **Steps**
@@ -1,18 +1,21 @@
1
1
  ---
2
2
  name: openspec-sync-specs
3
3
  description: Sync delta specs from a change to main specs. Use when the user wants to update main specs with changes from a delta spec, without archiving the change.
4
+ allowed-tools: Bash(openspec:*)
4
5
  license: MIT
5
6
  compatibility: Requires openspec CLI.
6
7
  metadata:
7
8
  author: openspec
8
9
  version: "1.0"
9
- generatedBy: "1.4.1"
10
+ generatedBy: "1.6.0"
10
11
  ---
11
12
 
12
13
  Sync delta specs from a change to main specs.
13
14
 
14
15
  This is an **agent-driven** operation - you will read delta specs and directly edit main specs to apply the changes. This allows intelligent merging (e.g., adding a scenario without copying the entire requirement).
15
16
 
17
+ **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`). 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.
18
+
16
19
  **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.
17
20
 
18
21
  **Steps**
@@ -32,8 +35,6 @@ This is an **agent-driven** operation - you will read delta specs and directly e
32
35
  openspec status --change "<name>" --json
33
36
  ```
34
37
 
35
- If status reports `actionContext.mode: "workspace-planning"`, explain that workspace spec sync is not supported in this slice and STOP. Do not fall back to repo-local paths or edit linked repos.
36
-
37
38
  3. **Find delta specs**
38
39
 
39
40
  Use `artifactPaths.specs.existingOutputPaths` from the status JSON as the list of delta spec files.
@@ -0,0 +1,86 @@
1
+ ---
2
+ name: openspec-update-change
3
+ description: Update an OpenSpec change by revising its existing planning artifacts and keeping them coherent with one another. Use when the user wants to revise a change's plan, fold new decisions into it, or reconcile its artifacts after an edit. Never edits code.
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.6.0"
11
+ ---
12
+
13
+ Revise a change's existing planning artifacts and keep them coherent. Never edit code.
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`). 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
+ **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.
18
+
19
+ **Steps**
20
+
21
+ 1. **If no change name provided, prompt for selection**
22
+
23
+ Run `openspec list --json` to get available changes sorted by most recently modified. Then use the **AskUserQuestion tool** to let the user select which change to update.
24
+
25
+ Present the top 3-4 most recently modified changes as options, showing:
26
+ - Change name
27
+ - Schema (from `schema` field if present, otherwise "spec-driven")
28
+ - Status (e.g., "0/5 tasks", "complete", "no tasks")
29
+ - How recently it was modified (from `lastModified` field)
30
+
31
+ Mark the most recently modified change as "(Recommended)" since it's likely what the user wants to update.
32
+
33
+ **IMPORTANT**: Do NOT guess or auto-select a change. Always let the user choose.
34
+
35
+ 2. **Get the change's artifacts**
36
+ ```bash
37
+ openspec status --change "<name>" --json
38
+ ```
39
+ Parse the JSON to understand current state. The response includes:
40
+ - `schemaName`: The workflow schema being used (e.g., "spec-driven")
41
+ - `artifacts`: Array of artifacts with their status ("done", "ready", "blocked")
42
+ - `isComplete`: Boolean indicating if all artifacts are complete
43
+ - `planningHome`, `changeRoot`, `artifactPaths`, and `actionContext`: path and scope context. Use these instead of assuming repo-local paths.
44
+
45
+ The artifact ids and paths come from the active schema - do NOT assume them, and do NOT branch on hardcoded artifact names. Custom schemas must work unchanged.
46
+
47
+ The files to edit are `artifactPaths.<id>.existingOutputPaths` - the concrete files that exist on disk, already glob-expanded for glob artifacts (e.g. `specs/**/*.md`). Do NOT write to `resolvedOutputPath`: for a glob artifact it is still the glob pattern, not a real file.
48
+
49
+ 3. **Understand the request**
50
+ - If the user asked for a specific revision ("the design now uses X"), that is the starting edit.
51
+ - If they only said "update" / "make this coherent", treat it as a coherence review: read the existing artifacts and check them against each other for contradictions, gaps, and duplication.
52
+
53
+ 4. **Read and reconcile**
54
+ - Read the artifact(s) the request touches and the change's other existing artifacts.
55
+ - Apply the requested edit. Then check every other existing artifact against it - in ANY direction: an edit to a later artifact may require revising an earlier one, not only the other way around. Build order is a useful reading order, not a constraint on which artifacts may be revised.
56
+ - Note everything that is now inconsistent, missing, or contradictory.
57
+ - Revise only files that already exist (`existingOutputPaths`). Do NOT create artifacts that don't exist yet, and do NOT invent new files under a glob artifact - note them and point the user to `/opsx:continue` to create them.
58
+ - If the change is already coherent, say so and make no edits.
59
+
60
+ 5. **Confirm and apply, one artifact at a time**
61
+ - Show each proposed revision and why. Write only after the user confirms.
62
+ - If the user rejects a revision, do not write it - leave that artifact unchanged.
63
+ - When a substantial rewrite is needed, get that artifact's rules and template first:
64
+ ```bash
65
+ openspec instructions <artifact-id> --change "<name>" --json
66
+ ```
67
+
68
+ 6. **Point to the next step (guidance only - NEVER act on it)**
69
+ - Artifacts still missing -> suggest `/opsx:continue` to create them.
70
+ - Change already implemented (tasks checked off / already applied) -> the code may no longer match the revised plan; suggest `/opsx:apply` to carry the delta into code.
71
+ - Everything done and implemented -> suggest `/opsx:archive`.
72
+
73
+ **Output**
74
+
75
+ After each invocation, show:
76
+ - Which artifacts were revised (and which proposed revisions were rejected)
77
+ - Anything deferred to `/opsx:continue` (not-yet-created artifacts or files)
78
+ - Where the change stands and the recommended next command
79
+
80
+ **Guardrails**
81
+ - Planning artifacts only - NEVER edit implementation code. If the revised plan implies code changes, stop and point to `/opsx:apply`.
82
+ - Use the artifact ids and paths reported by `openspec status`; never branch on hardcoded artifact names.
83
+ - Edit only the concrete files in `existingOutputPaths`; never write to a glob `resolvedOutputPath`.
84
+ - Do not advance the build frontier: no new artifacts, no new files under glob artifacts - that is `/opsx:continue`'s job.
85
+ - Confirm every edit with the user before writing.
86
+ - If the request changes the change's *intent* rather than refining it, recommend starting fresh with `/opsx:new` (the "Update vs. Start Fresh" heuristic).
@@ -0,0 +1,33 @@
1
+ {
2
+ "name": "@buildr-ai/buildr",
3
+ "version": "0.1.0-rc.21",
4
+ "description": "Buildr CLI for managing Agent workspace assets.",
5
+ "license": "MIT",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "git+https://github.com/BuildrAI/Buildr.git",
9
+ "directory": "projects/product/services/buildr"
10
+ },
11
+ "homepage": "https://github.com/BuildrAI/Buildr#readme",
12
+ "bugs": {
13
+ "url": "https://github.com/BuildrAI/Buildr/issues"
14
+ },
15
+ "keywords": [
16
+ "agent",
17
+ "agentic-coding",
18
+ "cli",
19
+ "developer-tools",
20
+ "workspace"
21
+ ],
22
+ "publishConfig": {
23
+ "access": "public",
24
+ "registry": "https://registry.npmjs.org/"
25
+ },
26
+ "type": "module",
27
+ "engines": {
28
+ "node": ">=24.15.0 <25"
29
+ },
30
+ "dependencies": {
31
+ "yaml": "^2.9.0"
32
+ }
33
+ }
@@ -0,0 +1,16 @@
1
+ CREATE TABLE schema_migrations (
2
+ version INTEGER PRIMARY KEY CHECK (version >= 0),
3
+ name TEXT NOT NULL UNIQUE CHECK (
4
+ length(name) > 9
5
+ AND substr(name, 1, 4) NOT GLOB '*[^0-9]*'
6
+ AND substr(name, 5, 1) = '_'
7
+ AND substr(name, 6, length(name) - 9) NOT GLOB '*[^a-z0-9_]*'
8
+ AND substr(name, -4) = '.sql'
9
+ ),
10
+ checksum TEXT NOT NULL CHECK (
11
+ length(checksum) = 71
12
+ AND substr(checksum, 1, 7) = 'sha256-'
13
+ AND substr(checksum, 8) NOT GLOB '*[^0-9a-f]*'
14
+ ),
15
+ applied_at TEXT NOT NULL CHECK (datetime(applied_at) IS NOT NULL)
16
+ ) STRICT;
@@ -0,0 +1,47 @@
1
+ CREATE TABLE tasks (
2
+ task_id TEXT PRIMARY KEY CHECK (
3
+ length(task_id) > 0
4
+ AND task_id NOT GLOB '*[^a-z0-9._-]*'
5
+ AND substr(task_id, 1, 1) GLOB '[a-z0-9]'
6
+ AND substr(task_id, -1, 1) GLOB '[a-z0-9]'
7
+ ),
8
+ schema_version TEXT NOT NULL CHECK (schema_version = 'buildr.task-record/v1'),
9
+ title TEXT NOT NULL CHECK (length(trim(title)) > 0),
10
+ intent TEXT NOT NULL CHECK (length(trim(intent)) > 0),
11
+ status TEXT NOT NULL CHECK (status IN ('active', 'completed', 'abandoned')),
12
+ result_summary TEXT,
13
+ result_no_change INTEGER CHECK (result_no_change IN (0, 1)),
14
+ created_at TEXT NOT NULL CHECK (datetime(created_at) IS NOT NULL),
15
+ updated_at TEXT NOT NULL CHECK (datetime(updated_at) IS NOT NULL AND updated_at >= created_at),
16
+ CHECK (
17
+ (status = 'active' AND result_summary IS NULL AND result_no_change IS NULL)
18
+ OR (status = 'completed' AND length(trim(result_summary)) > 0 AND result_no_change IS NOT NULL)
19
+ OR (status = 'abandoned' AND length(trim(result_summary)) > 0 AND result_no_change IS NULL)
20
+ )
21
+ ) STRICT;
22
+
23
+ CREATE TABLE task_projects (
24
+ task_id TEXT NOT NULL REFERENCES tasks(task_id) ON DELETE CASCADE,
25
+ project TEXT NOT NULL CHECK (length(project) > 0 AND project NOT GLOB '*[^A-Za-z0-9._-]*' AND substr(project, 1, 1) GLOB '[A-Za-z0-9]'),
26
+ PRIMARY KEY (task_id, project)
27
+ ) STRICT, WITHOUT ROWID;
28
+
29
+ CREATE TABLE task_services (
30
+ task_id TEXT NOT NULL REFERENCES tasks(task_id) ON DELETE CASCADE,
31
+ project TEXT NOT NULL CHECK (length(project) > 0 AND project NOT GLOB '*[^A-Za-z0-9._-]*' AND substr(project, 1, 1) GLOB '[A-Za-z0-9]'),
32
+ service TEXT NOT NULL CHECK (length(service) > 0 AND service NOT GLOB '*[^A-Za-z0-9._-]*' AND substr(service, 1, 1) GLOB '[A-Za-z0-9]'),
33
+ PRIMARY KEY (task_id, project, service)
34
+ ) STRICT, WITHOUT ROWID;
35
+
36
+ CREATE TABLE task_changes (
37
+ task_id TEXT NOT NULL REFERENCES tasks(task_id) ON DELETE CASCADE,
38
+ project TEXT NOT NULL CHECK (length(project) > 0 AND project NOT GLOB '*[^A-Za-z0-9._-]*' AND substr(project, 1, 1) GLOB '[A-Za-z0-9]'),
39
+ change_name TEXT NOT NULL CHECK (length(change_name) > 0 AND change_name NOT GLOB '*[^A-Za-z0-9._-]*' AND substr(change_name, 1, 1) GLOB '[A-Za-z0-9]'),
40
+ PRIMARY KEY (task_id, project, change_name)
41
+ ) STRICT, WITHOUT ROWID;
42
+
43
+ CREATE INDEX tasks_status_updated_at_idx ON tasks(status, updated_at DESC, task_id);
44
+ CREATE INDEX tasks_updated_at_idx ON tasks(updated_at DESC, task_id);
45
+ CREATE INDEX task_projects_project_idx ON task_projects(project, task_id);
46
+ CREATE INDEX task_services_identity_idx ON task_services(project, service, task_id);
47
+ CREATE INDEX task_changes_identity_idx ON task_changes(project, change_name, task_id);
@@ -0,0 +1,7 @@
1
+ CREATE TABLE task_parent_relations (
2
+ child_task_id TEXT PRIMARY KEY REFERENCES tasks(task_id) ON DELETE CASCADE,
3
+ parent_task_id TEXT NOT NULL REFERENCES tasks(task_id) ON DELETE CASCADE,
4
+ CHECK (child_task_id <> parent_task_id)
5
+ ) STRICT, WITHOUT ROWID;
6
+
7
+ CREATE INDEX task_parent_relations_parent_idx ON task_parent_relations(parent_task_id, child_task_id);
@@ -0,0 +1,19 @@
1
+ ALTER TABLE tasks ADD COLUMN parent_task_id TEXT
2
+ REFERENCES tasks(task_id) ON DELETE SET NULL
3
+ CHECK (parent_task_id IS NULL OR parent_task_id <> task_id);
4
+
5
+ UPDATE tasks
6
+ SET parent_task_id = (
7
+ SELECT relation.parent_task_id
8
+ FROM task_parent_relations AS relation
9
+ WHERE relation.child_task_id = tasks.task_id
10
+ )
11
+ WHERE EXISTS (
12
+ SELECT 1
13
+ FROM task_parent_relations AS relation
14
+ WHERE relation.child_task_id = tasks.task_id
15
+ );
16
+
17
+ DROP TABLE task_parent_relations;
18
+
19
+ CREATE INDEX tasks_parent_task_idx ON tasks(parent_task_id, task_id);
@@ -0,0 +1,16 @@
1
+ CREATE TABLE task_development_current (
2
+ task_id TEXT PRIMARY KEY REFERENCES tasks(task_id) ON DELETE CASCADE,
3
+ record_json TEXT NOT NULL CHECK (json_valid(record_json))
4
+ ) STRICT, WITHOUT ROWID;
5
+
6
+ CREATE TABLE task_verification_current (
7
+ task_id TEXT PRIMARY KEY REFERENCES tasks(task_id) ON DELETE CASCADE,
8
+ result_json TEXT NOT NULL CHECK (json_valid(result_json))
9
+ ) STRICT, WITHOUT ROWID;
10
+
11
+ CREATE TABLE task_review_current (
12
+ task_id TEXT NOT NULL REFERENCES tasks(task_id) ON DELETE CASCADE,
13
+ review_type TEXT NOT NULL CHECK (review_type IN ('planning', 'completion')),
14
+ result_json TEXT NOT NULL CHECK (json_valid(result_json)),
15
+ PRIMARY KEY (task_id, review_type)
16
+ ) STRICT, WITHOUT ROWID;
@@ -0,0 +1,4 @@
1
+ CREATE TABLE task_retrospective_current (
2
+ task_id TEXT PRIMARY KEY REFERENCES tasks(task_id) ON DELETE CASCADE,
3
+ result_json TEXT NOT NULL CHECK (json_valid(result_json))
4
+ ) STRICT, WITHOUT ROWID;
@@ -0,0 +1,4 @@
1
+ CREATE TABLE task_lifecycle_current (
2
+ task_id TEXT PRIMARY KEY REFERENCES tasks(task_id) ON DELETE CASCADE,
3
+ model_json TEXT NOT NULL CHECK (json_valid(model_json))
4
+ ) STRICT, WITHOUT ROWID;
@@ -0,0 +1,46 @@
1
+ CREATE TABLE task_finish_runs (
2
+ task_id TEXT PRIMARY KEY REFERENCES tasks(task_id) ON DELETE CASCADE,
3
+ run_id TEXT NOT NULL UNIQUE,
4
+ status TEXT NOT NULL CHECK (status IN ('active', 'blocked', 'failed', 'complete', 'cleanup_pending')),
5
+ identity_digest TEXT NOT NULL,
6
+ run_json TEXT NOT NULL CHECK (json_valid(run_json)),
7
+ updated_at TEXT NOT NULL,
8
+ completed_at TEXT
9
+ ) STRICT, WITHOUT ROWID;
10
+
11
+ CREATE INDEX task_finish_runs_run_idx ON task_finish_runs(run_id);
12
+
13
+ CREATE TABLE task_finish_completions (
14
+ task_id TEXT PRIMARY KEY REFERENCES tasks(task_id) ON DELETE CASCADE,
15
+ run_id TEXT NOT NULL UNIQUE,
16
+ status TEXT NOT NULL CHECK (status IN ('complete', 'cleanup_pending')),
17
+ result_json TEXT NOT NULL CHECK (json_valid(result_json)),
18
+ completed_at TEXT,
19
+ updated_at TEXT NOT NULL
20
+ ) STRICT, WITHOUT ROWID;
21
+
22
+ CREATE TABLE task_finish_target_leases (
23
+ target_identity TEXT PRIMARY KEY,
24
+ run_id TEXT NOT NULL REFERENCES task_finish_runs(run_id) ON DELETE CASCADE,
25
+ task_id TEXT NOT NULL REFERENCES tasks(task_id) ON DELETE CASCADE,
26
+ token TEXT NOT NULL UNIQUE,
27
+ acquired_at TEXT NOT NULL,
28
+ expires_at TEXT NOT NULL,
29
+ heartbeat_at TEXT NOT NULL
30
+ ) STRICT, WITHOUT ROWID;
31
+
32
+ CREATE INDEX task_finish_target_leases_run_idx ON task_finish_target_leases(run_id);
33
+
34
+ CREATE TABLE task_finish_transient_artifacts (
35
+ artifact_id TEXT PRIMARY KEY,
36
+ run_id TEXT NOT NULL REFERENCES task_finish_runs(run_id) ON DELETE CASCADE,
37
+ kind TEXT NOT NULL,
38
+ relative_locator TEXT NOT NULL,
39
+ size_bytes INTEGER NOT NULL CHECK (size_bytes >= 0),
40
+ sha256 TEXT NOT NULL,
41
+ retention_status TEXT NOT NULL CHECK (retention_status IN ('retained', 'cleanup_pending', 'cleaned')),
42
+ cleanup_code TEXT,
43
+ updated_at TEXT NOT NULL
44
+ ) STRICT, WITHOUT ROWID;
45
+
46
+ CREATE INDEX task_finish_transient_artifacts_run_idx ON task_finish_transient_artifacts(run_id);
@@ -0,0 +1,8 @@
1
+ CREATE TABLE task_environment_current (
2
+ task_id TEXT PRIMARY KEY REFERENCES tasks(task_id) ON DELETE CASCADE,
3
+ status TEXT NOT NULL CHECK (status IN ('ready', 'blocked', 'cleaned')),
4
+ receipt_json TEXT NOT NULL CHECK (json_valid(receipt_json)),
5
+ updated_at TEXT NOT NULL CHECK (datetime(updated_at) IS NOT NULL)
6
+ ) STRICT, WITHOUT ROWID;
7
+
8
+ CREATE INDEX task_environment_current_status_idx ON task_environment_current(status, updated_at DESC, task_id);
@@ -0,0 +1,107 @@
1
+ ALTER TABLE task_development_current ADD COLUMN applicability_status TEXT
2
+ CHECK (applicability_status IS NULL OR applicability_status IN ('planning', 'developing', 'candidate-current', 'handoff-current', 'blocked', 'unknown'));
3
+ ALTER TABLE task_development_current ADD COLUMN applicability_json TEXT
4
+ CHECK (applicability_json IS NULL OR json_valid(applicability_json));
5
+ ALTER TABLE task_development_current ADD COLUMN observed_at TEXT
6
+ CHECK (observed_at IS NULL OR datetime(observed_at) IS NOT NULL);
7
+
8
+ ALTER TABLE task_review_current ADD COLUMN target_identity TEXT;
9
+ ALTER TABLE task_review_current ADD COLUMN outcome TEXT
10
+ CHECK (outcome IS NULL OR outcome IN ('ready', 'changes-required'));
11
+ ALTER TABLE task_review_current ADD COLUMN updated_at TEXT
12
+ CHECK (updated_at IS NULL OR datetime(updated_at) IS NOT NULL);
13
+
14
+ UPDATE task_review_current
15
+ SET target_identity = json_extract(result_json, '$.targetIdentity'),
16
+ outcome = json_extract(result_json, '$.conclusion.outcome'),
17
+ updated_at = json_extract(result_json, '$.completedAt');
18
+
19
+ CREATE TEMP TABLE _buildr_review_migration_assertion (
20
+ valid INTEGER NOT NULL CHECK (valid = 1)
21
+ ) STRICT;
22
+ INSERT INTO _buildr_review_migration_assertion(valid)
23
+ SELECT 0 FROM task_review_current
24
+ WHERE target_identity IS NULL OR target_identity = ''
25
+ OR outcome NOT IN ('ready', 'changes-required')
26
+ OR datetime(updated_at) IS NULL;
27
+ DROP TABLE _buildr_review_migration_assertion;
28
+
29
+ ALTER TABLE task_verification_current ADD COLUMN target_identity TEXT;
30
+ ALTER TABLE task_verification_current ADD COLUMN outcome TEXT
31
+ CHECK (outcome IS NULL OR outcome IN ('passed', 'not-passed'));
32
+ ALTER TABLE task_verification_current ADD COLUMN updated_at TEXT
33
+ CHECK (updated_at IS NULL OR datetime(updated_at) IS NOT NULL);
34
+
35
+ UPDATE task_verification_current
36
+ SET target_identity = json_extract(result_json, '$.target.identity'),
37
+ outcome = json_extract(result_json, '$.conclusion.outcome'),
38
+ updated_at = json_extract(result_json, '$.completedAt');
39
+
40
+ CREATE TEMP TABLE _buildr_verification_migration_assertion (
41
+ valid INTEGER NOT NULL CHECK (valid = 1)
42
+ ) STRICT;
43
+ INSERT INTO _buildr_verification_migration_assertion(valid)
44
+ SELECT 0 FROM task_verification_current
45
+ WHERE target_identity IS NULL OR target_identity = ''
46
+ OR outcome NOT IN ('passed', 'not-passed')
47
+ OR datetime(updated_at) IS NULL;
48
+ DROP TABLE _buildr_verification_migration_assertion;
49
+
50
+ UPDATE task_development_current
51
+ SET applicability_status = json_extract(
52
+ (SELECT model_json FROM task_lifecycle_current WHERE task_id = task_development_current.task_id),
53
+ '$.development.applicability.status'
54
+ ),
55
+ applicability_json = json_extract(
56
+ (SELECT model_json FROM task_lifecycle_current WHERE task_id = task_development_current.task_id),
57
+ '$.development.applicability'
58
+ ),
59
+ observed_at = json_extract(
60
+ (SELECT model_json FROM task_lifecycle_current WHERE task_id = task_development_current.task_id),
61
+ '$.development.observedAt'
62
+ )
63
+ WHERE EXISTS (
64
+ SELECT 1 FROM task_lifecycle_current
65
+ WHERE task_id = task_development_current.task_id
66
+ AND json_type(model_json, '$.development.applicability') = 'object'
67
+ AND json_extract(model_json, '$.development.applicability.status') IN ('planning', 'developing', 'candidate-current', 'handoff-current', 'blocked', 'unknown')
68
+ AND datetime(json_extract(model_json, '$.development.observedAt')) IS NOT NULL
69
+ );
70
+
71
+ CREATE TEMP TABLE _buildr_terminal_association_assertion (
72
+ valid INTEGER NOT NULL CHECK (valid = 1)
73
+ ) STRICT;
74
+ INSERT INTO _buildr_terminal_association_assertion(valid)
75
+ SELECT 0
76
+ FROM task_lifecycle_current AS lifecycle
77
+ LEFT JOIN task_finish_completions AS completion ON completion.task_id = lifecycle.task_id
78
+ WHERE json_type(lifecycle.model_json, '$.finish.association') = 'object'
79
+ AND (
80
+ completion.task_id IS NULL
81
+ OR json_extract(completion.result_json, '$.association.schemaVersion') IS NOT json_extract(lifecycle.model_json, '$.finish.association.schemaVersion')
82
+ OR json_extract(completion.result_json, '$.association.handoffIdentity') IS NOT json_extract(lifecycle.model_json, '$.finish.association.handoffIdentity')
83
+ OR json_extract(completion.result_json, '$.association.candidateIdentity') IS NOT json_extract(lifecycle.model_json, '$.finish.association.candidateIdentity')
84
+ OR json_extract(completion.result_json, '$.association.candidateGeneration') IS NOT json_extract(lifecycle.model_json, '$.finish.association.candidateGeneration')
85
+ OR json_extract(completion.result_json, '$.association.gates.planning.status') IS NOT json_extract(lifecycle.model_json, '$.finish.association.gates.planning.status')
86
+ OR json_extract(completion.result_json, '$.association.gates.planning.targetIdentity') IS NOT json_extract(lifecycle.model_json, '$.finish.association.gates.planning.targetIdentity')
87
+ OR json_extract(completion.result_json, '$.association.gates.planning.resultDigest') IS NOT json_extract(lifecycle.model_json, '$.finish.association.gates.planning.resultDigest')
88
+ OR json_extract(completion.result_json, '$.association.gates.planning.disposition') IS NOT json_extract(lifecycle.model_json, '$.finish.association.gates.planning.disposition')
89
+ OR json_extract(completion.result_json, '$.association.gates.completion.status') IS NOT json_extract(lifecycle.model_json, '$.finish.association.gates.completion.status')
90
+ OR json_extract(completion.result_json, '$.association.gates.completion.targetIdentity') IS NOT json_extract(lifecycle.model_json, '$.finish.association.gates.completion.targetIdentity')
91
+ OR json_extract(completion.result_json, '$.association.gates.completion.resultDigest') IS NOT json_extract(lifecycle.model_json, '$.finish.association.gates.completion.resultDigest')
92
+ OR json_extract(completion.result_json, '$.association.gates.completion.disposition') IS NOT json_extract(lifecycle.model_json, '$.finish.association.gates.completion.disposition')
93
+ OR json_extract(completion.result_json, '$.association.gates.verification.status') IS NOT json_extract(lifecycle.model_json, '$.finish.association.gates.verification.status')
94
+ OR json_extract(completion.result_json, '$.association.gates.verification.targetIdentity') IS NOT json_extract(lifecycle.model_json, '$.finish.association.gates.verification.targetIdentity')
95
+ OR json_extract(completion.result_json, '$.association.gates.verification.resultDigest') IS NOT json_extract(lifecycle.model_json, '$.finish.association.gates.verification.resultDigest')
96
+ OR json_extract(completion.result_json, '$.association.gates.verification.disposition') IS NOT json_extract(lifecycle.model_json, '$.finish.association.gates.verification.disposition')
97
+ );
98
+ DROP TABLE _buildr_terminal_association_assertion;
99
+
100
+ CREATE INDEX task_development_current_status_idx
101
+ ON task_development_current(applicability_status, observed_at DESC, task_id);
102
+ CREATE INDEX task_review_current_target_idx
103
+ ON task_review_current(review_type, target_identity, updated_at DESC, task_id);
104
+ CREATE INDEX task_verification_current_target_idx
105
+ ON task_verification_current(target_identity, updated_at DESC, task_id);
106
+
107
+ DROP TABLE task_lifecycle_current;
@@ -0,0 +1,19 @@
1
+ CREATE TABLE task_retrospective_current_next (
2
+ task_id TEXT PRIMARY KEY REFERENCES tasks(task_id) ON DELETE CASCADE,
3
+ result_json TEXT NOT NULL CHECK (json_valid(result_json)),
4
+ disposition_status TEXT NOT NULL CHECK (disposition_status IN ('pending', 'handled', 'no-action')),
5
+ disposition_note TEXT,
6
+ disposed_at TEXT,
7
+ CHECK (
8
+ (disposition_status = 'pending' AND disposition_note IS NULL AND disposed_at IS NULL)
9
+ OR
10
+ (disposition_status IN ('handled', 'no-action') AND disposition_note IS NOT NULL AND trim(disposition_note) <> '' AND disposed_at IS NOT NULL)
11
+ )
12
+ ) STRICT, WITHOUT ROWID;
13
+
14
+ INSERT INTO task_retrospective_current_next(task_id, result_json, disposition_status, disposition_note, disposed_at)
15
+ SELECT task_id, result_json, 'pending', NULL, NULL
16
+ FROM task_retrospective_current;
17
+
18
+ DROP TABLE task_retrospective_current;
19
+ ALTER TABLE task_retrospective_current_next RENAME TO task_retrospective_current;
@@ -0,0 +1,115 @@
1
+ CREATE TABLE task_execution_records (
2
+ record_id TEXT PRIMARY KEY,
3
+ schema_version TEXT NOT NULL CHECK (schema_version = 'buildr.task-execution-record/v1'),
4
+ task_id TEXT NOT NULL REFERENCES tasks(task_id),
5
+ owner TEXT NOT NULL CHECK (owner IN ('task-verification', 'task-finish')),
6
+ kind TEXT NOT NULL,
7
+ run_identity TEXT NOT NULL CHECK (trim(run_identity) <> ''),
8
+ target_identity TEXT NOT NULL CHECK (trim(target_identity) <> ''),
9
+ producer TEXT NOT NULL CHECK (trim(producer) <> ''),
10
+ outcome TEXT NOT NULL CHECK (outcome IN ('running', 'passed', 'failed', 'blocked', 'cancelled')),
11
+ lifecycle_status TEXT NOT NULL CHECK (lifecycle_status IN ('open', 'retained', 'cleanup_pending', 'cleaned', 'attention')),
12
+ resolution_status TEXT NOT NULL CHECK (resolution_status IN ('not-required', 'pending', 'acknowledged', 'recovered')),
13
+ body_status TEXT NOT NULL CHECK (body_status IN ('staging', 'available', 'cleaned')),
14
+ quota_status TEXT NOT NULL CHECK (quota_status IN ('reserved', 'charged', 'released')),
15
+ body_locator TEXT,
16
+ body_digest TEXT,
17
+ stored_size_bytes INTEGER NOT NULL CHECK (stored_size_bytes >= 0 AND stored_size_bytes <= 16777216),
18
+ original_size_bytes INTEGER NOT NULL CHECK (original_size_bytes >= 0),
19
+ truncated INTEGER NOT NULL CHECK (truncated IN (0, 1)),
20
+ redaction_version TEXT NOT NULL CHECK (redaction_version = 'buildr.task-execution-record-redaction/v1'),
21
+ reserved_size_bytes INTEGER NOT NULL CHECK (reserved_size_bytes IN (0, 16777216)),
22
+ retain_until TEXT,
23
+ opened_at TEXT NOT NULL CHECK (trim(opened_at) <> ''),
24
+ sealed_at TEXT,
25
+ resolved_at TEXT,
26
+ cleanup_started_at TEXT,
27
+ cleaned_at TEXT,
28
+ cleanup_code TEXT,
29
+ updated_at TEXT NOT NULL CHECK (trim(updated_at) <> ''),
30
+ UNIQUE (task_id, owner, kind, run_identity),
31
+ CHECK (
32
+ (owner = 'task-verification' AND kind = 'verification-execution')
33
+ OR (owner = 'task-finish' AND kind = 'finish-diagnostics')
34
+ ),
35
+ CHECK (
36
+ (lifecycle_status = 'open'
37
+ AND outcome = 'running'
38
+ AND resolution_status = 'not-required'
39
+ AND body_status = 'staging'
40
+ AND quota_status = 'reserved'
41
+ AND body_locator IS NULL
42
+ AND body_digest IS NULL
43
+ AND stored_size_bytes = 0
44
+ AND original_size_bytes = 0
45
+ AND truncated = 0
46
+ AND reserved_size_bytes = 16777216
47
+ AND retain_until IS NULL
48
+ AND sealed_at IS NULL
49
+ AND resolved_at IS NULL
50
+ AND cleanup_started_at IS NULL
51
+ AND cleaned_at IS NULL
52
+ AND cleanup_code IS NULL)
53
+ OR
54
+ (lifecycle_status IN ('retained', 'attention')
55
+ AND outcome IN ('passed', 'failed', 'blocked', 'cancelled')
56
+ AND body_status = 'available'
57
+ AND quota_status = 'charged'
58
+ AND body_locator GLOB '.buildr/local/task-execution-records/*/*/'
59
+ AND body_digest GLOB 'sha256-*'
60
+ AND length(body_digest) = 71
61
+ AND reserved_size_bytes = 0
62
+ AND retain_until IS NOT NULL
63
+ AND sealed_at IS NOT NULL
64
+ AND cleanup_started_at IS NULL
65
+ AND cleaned_at IS NULL
66
+ AND cleanup_code IS NULL)
67
+ OR
68
+ (lifecycle_status = 'cleanup_pending'
69
+ AND outcome IN ('passed', 'failed', 'blocked', 'cancelled')
70
+ AND body_status = 'available'
71
+ AND quota_status = 'charged'
72
+ AND body_locator GLOB '.buildr/local/task-execution-records/*/*/'
73
+ AND body_digest GLOB 'sha256-*'
74
+ AND length(body_digest) = 71
75
+ AND reserved_size_bytes = 0
76
+ AND retain_until IS NOT NULL
77
+ AND sealed_at IS NOT NULL
78
+ AND cleanup_started_at IS NOT NULL
79
+ AND cleaned_at IS NULL
80
+ AND cleanup_code IS NULL)
81
+ OR
82
+ (lifecycle_status = 'cleaned'
83
+ AND outcome IN ('passed', 'failed', 'blocked', 'cancelled')
84
+ AND body_status = 'cleaned'
85
+ AND quota_status = 'released'
86
+ AND body_locator IS NULL
87
+ AND body_digest GLOB 'sha256-*'
88
+ AND length(body_digest) = 71
89
+ AND reserved_size_bytes = 0
90
+ AND retain_until IS NOT NULL
91
+ AND sealed_at IS NOT NULL
92
+ AND cleanup_started_at IS NULL
93
+ AND cleaned_at IS NOT NULL
94
+ AND cleanup_code IS NOT NULL
95
+ AND trim(cleanup_code) <> '')
96
+ ),
97
+ CHECK (
98
+ (outcome IN ('running', 'passed') AND resolution_status = 'not-required' AND resolved_at IS NULL)
99
+ OR
100
+ (outcome IN ('failed', 'blocked', 'cancelled') AND resolution_status = 'pending' AND resolved_at IS NULL)
101
+ OR
102
+ (outcome IN ('failed', 'blocked', 'cancelled') AND resolution_status IN ('acknowledged', 'recovered') AND resolved_at IS NOT NULL)
103
+ )
104
+ ) STRICT, WITHOUT ROWID;
105
+
106
+ CREATE INDEX task_execution_records_task_timeline_idx
107
+ ON task_execution_records(task_id, opened_at DESC, record_id);
108
+ CREATE INDEX task_execution_records_task_owner_kind_recent_idx
109
+ ON task_execution_records(task_id, owner, kind, sealed_at DESC, record_id);
110
+ CREATE INDEX task_execution_records_lifecycle_retention_idx
111
+ ON task_execution_records(lifecycle_status, retain_until, task_id, record_id);
112
+ CREATE INDEX task_execution_records_task_owner_quota_idx
113
+ ON task_execution_records(task_id, owner, quota_status);
114
+ CREATE INDEX task_execution_records_workspace_quota_idx
115
+ ON task_execution_records(quota_status);