thoth-agents 0.4.2 → 0.5.1

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 (115) hide show
  1. package/LICENSE +30 -0
  2. package/README.md +86 -58
  3. package/dist/agents/prompt-sections.d.ts +5 -3
  4. package/dist/agents/prompt-utils.d.ts +1 -1
  5. package/dist/agents/worker.d.ts +2 -0
  6. package/dist/{chunk-STCURXAQ.js → chunk-MRFCA3U2.js} +33 -67
  7. package/dist/{chunk-EFGSGPYM.js → chunk-OW6I7ZUU.js} +391 -416
  8. package/dist/chunk-V7HSGRMB.js +1016 -0
  9. package/dist/{chunk-WCLUZZHI.js → chunk-VUNYH263.js} +1580 -351
  10. package/dist/cli/claude-code-paths.d.ts +2 -2
  11. package/dist/cli/codex-install.d.ts +5 -2
  12. package/dist/cli/codex-paths.d.ts +2 -2
  13. package/dist/cli/index.js +47 -11
  14. package/dist/cli/operations/pi.d.ts +1 -0
  15. package/dist/cli/pi-effort.d.ts +1 -1
  16. package/dist/cli/pi-external-package.d.ts +24 -0
  17. package/dist/cli/pi-git-source.d.ts +1 -0
  18. package/dist/cli/pi-install.d.ts +92 -15
  19. package/dist/cli/pi-managed-write.d.ts +3 -0
  20. package/dist/cli/pi-model-config.d.ts +17 -0
  21. package/dist/cli/pi-native-probe.d.ts +2 -0
  22. package/dist/cli/pi-paths.d.ts +2 -0
  23. package/dist/cli/pi-resources.d.ts +3 -1
  24. package/dist/cli/pi-tool-config.d.ts +32 -0
  25. package/dist/cli/tui/index.js +3 -3
  26. package/dist/cli/types.d.ts +2 -0
  27. package/dist/config/constants.d.ts +4 -8
  28. package/dist/config/schema.d.ts +7 -36
  29. package/dist/harness/adapters/claude-code.d.ts +2 -4
  30. package/dist/harness/core/agent-pack.d.ts +52 -42
  31. package/dist/harness/core/memory-governance.d.ts +2 -2
  32. package/dist/harness/core/sdd.d.ts +159 -319
  33. package/dist/harness/writers/pi-agent.d.ts +3 -1
  34. package/dist/index.js +12 -6
  35. package/dist/pi/tools-panel.d.ts +51 -0
  36. package/dist/pi.d.ts +44 -2
  37. package/dist/pi.js +471 -9
  38. package/dist/utils/subprocess.d.ts +1 -0
  39. package/package.json +23 -6
  40. package/pi/.thoth-agents-assets.json +5 -6
  41. package/pi/agents/thoth-designer.md +23 -8
  42. package/pi/agents/thoth-explorer.md +29 -9
  43. package/pi/agents/thoth-librarian.md +30 -8
  44. package/pi/agents/thoth-oracle.md +18 -10
  45. package/pi/agents/thoth-worker.md +96 -0
  46. package/plugin/.claude-plugin/.thoth-agents-plugin-assets.json +7 -12
  47. package/plugin/.claude-plugin/plugin.json +2 -2
  48. package/plugin/.codex-plugin/plugin.json +2 -2
  49. package/plugin/agents/designer.md +13 -5
  50. package/plugin/agents/explorer.md +16 -5
  51. package/plugin/agents/librarian.md +15 -4
  52. package/plugin/agents/oracle.md +13 -7
  53. package/plugin/agents/orchestrator.md +82 -91
  54. package/plugin/agents/worker.md +76 -0
  55. package/plugin/skills/plan-reviewer/SKILL.md +39 -141
  56. package/plugin/skills/thoth-archive/SKILL.md +50 -47
  57. package/plugin/skills/thoth-archive/scripts/archive.mjs +287 -654
  58. package/plugin/skills/thoth-constitution/SKILL.md +23 -42
  59. package/plugin/skills/thoth-constitution/templates/constitution.md +54 -44
  60. package/plugin/skills/thoth-init/SKILL.md +19 -29
  61. package/plugin/skills/thoth-init/scripts/init.mjs +73 -66
  62. package/plugin/skills/thoth-sdd/SKILL.md +164 -117
  63. package/plugin/skills/thoth-sdd/references/phases/checklist.md +2 -22
  64. package/plugin/skills/thoth-sdd/references/phases/clarify.md +14 -12
  65. package/plugin/skills/thoth-sdd/references/phases/converge.md +2 -13
  66. package/plugin/skills/thoth-sdd/references/phases/explore.md +3 -8
  67. package/plugin/skills/thoth-sdd/references/phases/implement.md +58 -57
  68. package/plugin/skills/thoth-sdd/references/phases/plan.md +2 -18
  69. package/plugin/skills/thoth-sdd/references/phases/specify.md +2 -33
  70. package/plugin/skills/thoth-sdd/references/phases/tasks.md +4 -45
  71. package/plugin/skills/thoth-sdd/references/phases/verify.md +4 -22
  72. package/plugin/skills/thoth-sdd/scripts/validate.mjs +610 -1232
  73. package/plugin/skills/thoth-sdd/templates/change.md +94 -0
  74. package/skills/README.md +11 -13
  75. package/skills/plan-reviewer/SKILL.md +39 -141
  76. package/skills/thoth-archive/SKILL.md +50 -47
  77. package/skills/thoth-archive/scripts/archive.mjs +287 -654
  78. package/skills/thoth-constitution/SKILL.md +23 -42
  79. package/skills/thoth-constitution/templates/constitution.md +54 -44
  80. package/skills/thoth-init/SKILL.md +19 -29
  81. package/skills/thoth-init/scripts/init.mjs +73 -66
  82. package/skills/thoth-sdd/SKILL.md +164 -117
  83. package/skills/thoth-sdd/references/phases/checklist.md +2 -22
  84. package/skills/thoth-sdd/references/phases/clarify.md +14 -12
  85. package/skills/thoth-sdd/references/phases/converge.md +2 -13
  86. package/skills/thoth-sdd/references/phases/explore.md +3 -8
  87. package/skills/thoth-sdd/references/phases/implement.md +58 -57
  88. package/skills/thoth-sdd/references/phases/plan.md +2 -18
  89. package/skills/thoth-sdd/references/phases/specify.md +2 -33
  90. package/skills/thoth-sdd/references/phases/tasks.md +4 -45
  91. package/skills/thoth-sdd/references/phases/verify.md +4 -22
  92. package/skills/thoth-sdd/scripts/validate.mjs +610 -1232
  93. package/skills/thoth-sdd/templates/change.md +94 -0
  94. package/thoth-agents.schema.json +9 -77
  95. package/dist/agents/deep.d.ts +0 -2
  96. package/dist/agents/quick.d.ts +0 -2
  97. package/dist/chunk-2U5MBLLV.js +0 -312
  98. package/pi/agents/thoth-deep.md +0 -81
  99. package/pi/agents/thoth-quick.md +0 -81
  100. package/plugin/agents/deep.md +0 -68
  101. package/plugin/agents/quick.md +0 -68
  102. package/plugin/skills/plan-reviewer/templates/plan-review.md +0 -65
  103. package/plugin/skills/thoth-sdd/templates/archive-report.md +0 -25
  104. package/plugin/skills/thoth-sdd/templates/checklist.md +0 -27
  105. package/plugin/skills/thoth-sdd/templates/plan.md +0 -46
  106. package/plugin/skills/thoth-sdd/templates/spec.md +0 -62
  107. package/plugin/skills/thoth-sdd/templates/tasks.md +0 -58
  108. package/plugin/skills/thoth-sdd/templates/verify-report.md +0 -28
  109. package/skills/plan-reviewer/templates/plan-review.md +0 -65
  110. package/skills/thoth-sdd/templates/archive-report.md +0 -25
  111. package/skills/thoth-sdd/templates/checklist.md +0 -27
  112. package/skills/thoth-sdd/templates/plan.md +0 -46
  113. package/skills/thoth-sdd/templates/spec.md +0 -62
  114. package/skills/thoth-sdd/templates/tasks.md +0 -58
  115. package/skills/thoth-sdd/templates/verify-report.md +0 -28
@@ -0,0 +1,94 @@
1
+ # Change: <id>
2
+
3
+ **Classification**: substantial
4
+ **Scope**: <local|coordinated|cross-cutting>
5
+ **Uncertainty**: <low|medium|high>
6
+ **Risk**: <low|medium|high>
7
+
8
+ ## Exploration
9
+
10
+ TBD: Confirm current behavior, constraints, and relevant repository evidence.
11
+
12
+ ## Intent
13
+
14
+ TBD: State the accepted outcome.
15
+
16
+ ## Non-goals
17
+
18
+ TBD: State boundaries and excluded work.
19
+
20
+ ## Acceptance
21
+
22
+ - AC-1: TBD
23
+
24
+ ## Clarifications
25
+
26
+ - PENDING: Record resolved material choices or that none are needed.
27
+
28
+ ## Decisions
29
+
30
+ - PENDING: Record settled assumptions and human-owned decisions.
31
+
32
+ ## Durable deltas
33
+
34
+ - None.
35
+
36
+ ## Plan
37
+
38
+ TBD: Record the technical approach and focused verification seams.
39
+
40
+ ## Tasks
41
+
42
+ Use one checkbox row per independently acceptable work unit. Keep each checkbox
43
+ on one line in the validator-compatible form `- [ ] AC-n: ...`; indent the
44
+ remaining fields below it. Repeat an AC number when separate units contribute
45
+ to that acceptance outcome. The row text names one reviewable result; do not
46
+ combine separately acceptable outcomes into a phase-sized task. Fill the
47
+ indented fields with concrete information. For a read-only unit, write `none`
48
+ for owned writes.
49
+
50
+ - [ ] AC-1: TBD
51
+ - Outcome: one result that root can accept independently
52
+ - Known entrypoints and skill paths: exact paths needed for this outcome
53
+ - Inputs: concrete accepted evidence or upstream outputs
54
+ - Dependencies: named upstream units and their accepted outputs, or none
55
+ - Output: concrete finding, decision, or artifact
56
+ - Owner: root or selected role
57
+ - Writes: exact owned paths, or none for read-only work
58
+ - Interface boundaries: relevant contracts and callers, or none
59
+ - Focused check and PASS evidence: check to run and observable passing result
60
+ - Return milestone: when root can review and accept this result
61
+ - Stop / reassessment: smallest missing input, conflict, or new scope to return
62
+
63
+ ## Authorization
64
+
65
+ Accepted values: Plan review: `OKAY | SKIPPED`; Plan review selection:
66
+ `EXPLICIT_REVIEW | EXPLICIT_SKIP | DEFAULT_REVIEW_AFTER_3`; Implementation:
67
+ `AUTHORIZED`. Put notes on separate lines below the fields, never on field lines.
68
+
69
+ **Plan review**: PENDING
70
+ **Plan review selection**: PENDING
71
+ **Implementation**: PENDING
72
+
73
+ ## Verification
74
+
75
+ Accepted values: Reviewer: `oracle`; Independent from implementer: `Yes`;
76
+ Verdict: `PASS`; Reviewed record SHA-256: 64 lowercase hex characters hashing
77
+ exact UTF-8 bytes before the case-sensitive `## Authorization` heading. Use
78
+ exactly one SHA field line; put notes on separate lines below the fields.
79
+
80
+ **Reviewer**: PENDING
81
+ **Independent from implementer**: PENDING
82
+ **Verdict**: PENDING
83
+ **Reviewed record SHA-256**: PENDING
84
+
85
+ - AC-1: PENDING | check | evidence
86
+ - Source: relative/path | sha256:<actual-source-digest>
87
+ - Source: .thoth/specs/<capability>/spec.md | sha256:<actual-source-digest>
88
+ - Source: .thoth/specs/<new-capability>/spec.md | absent
89
+
90
+ ## Closeout
91
+
92
+ Accepted value: Archive: `READY`. Put notes on separate lines below the field.
93
+
94
+ **Archive**: PENDING
package/skills/README.md CHANGED
@@ -1,17 +1,15 @@
1
1
  # Bundled thoth-owned skills
2
2
 
3
- This directory is the canonical, versioned source for skills owned by
4
- thoth-agents. `pnpm run integration:sync` copies those skills into the Codex and
5
- Claude Code plugins; `npx thoth-agents install --agent=opencode` materializes
6
- the same packaged skill trees globally under `~/.config/opencode/skills/`.
3
+ This directory is the canonical, versioned source for owned skills. The installer
4
+ and `pnpm run integration:sync` expose the same bundle in supported harnesses.
7
5
 
8
6
  Owned workflow skills are `thoth-init`, `thoth-sdd`, `thoth-constitution`,
9
- `thoth-archive`, and `plan-reviewer`. The last one implements the optional,
10
- explicitly or bounded-default selected, read-only Oracle review before
11
- implementation. Mandatory external
12
- skills (`simplify`, `tdd`,
13
- `progressive-context-router`, and `architectural-grilling`) are not copied here:
14
- the thoth-agents installer invokes `npx skills add` against their canonical
15
- repositories so they retain a single source of truth. `thoth-init` only
16
- initializes or synchronizes minimum project `openspec/` governance and never
17
- installs skills.
7
+ `thoth-archive`, and `plan-reviewer`. `thoth-sdd` owns proportional
8
+ understanding/classification, the single ID-named substantial-change record, and
9
+ maintained validation. The optional plan reviewer is read-only; archive applies
10
+ declared `.thoth/specs/` deltas transactionally.
11
+
12
+ External skills (`simplify`, `tdd`, `progressive-context-router`, and
13
+ `architectural-grilling`) are not copied here. Installation handles them; never
14
+ fetch or install dependencies during an active SDD phase. `thoth-init` only
15
+ initializes canonical `.thoth/` governance and preserves existing records.
@@ -1,150 +1,48 @@
1
1
  ---
2
2
  name: plan-reviewer
3
- description: Review a ready Accelerated or Full SDD artifact set for execution blockers after Oracle review is explicitly or recommended-default selected. Use only for the pre-implementation plan-review phase; return exact [OKAY] or [REJECT] semantics while keeping final verification separate.
3
+ description: Independent blocker-only Oracle review of a ready substantial SDD plan before separate implementation authorization.
4
4
  license: MIT
5
- compatibility: Designed for thoth-agents Accelerated and Full SDD workflows.
5
+ compatibility: Requires the installed sibling thoth-sdd skill.
6
6
  metadata:
7
7
  author: thoth-agents
8
- version: "1.0"
8
+ version: "2.0"
9
9
  ---
10
10
 
11
11
  # Plan Reviewer
12
12
 
13
- Review whether an accepted SDD plan can be implemented safely as written. Focus
14
- on true execution blockers, not stylistic preferences or redesign ideas.
15
-
16
- ## Activation
17
-
18
- Use this skill only after all of these conditions hold:
19
-
20
- - The selected route is Accelerated or Full.
21
- - The route's `ready` validator gate has passed.
22
- - `Review plan with Oracle (Recommended)` was explicitly selected or selected
23
- by the bounded no-answer fallback.
24
-
25
- At the ready gate, any explicit `Proceed without review` answer wins. When the
26
- native question returns answerless, Root
27
- makes at most three total attempts; after the third answerless result, Root
28
- treats `Review plan with Oracle (Recommended)` as selected. This bounded
29
- fallback is the only automatic activation. Do not use this skill for Direct
30
- work. Explicitly proceeding without review means there is no pre-implementation
31
- Oracle review; mandatory final verification still applies.
32
-
33
- ## Ownership and inputs
34
-
35
- Resolve `<skill-dir>` as the directory containing this `SKILL.md`. Every bundled
36
- asset path in this contract is anchored to that installed skill root rather than
37
- the project or current working directory.
38
-
39
- Root coordinates the phase and dispatches Oracle. Oracle remains read-only: it
40
- must not edit source, SDD artifacts, or coordination state. Root persists the
41
- returned review at `openspec/changes/<change>/plan-review.md` using
42
- `<skill-dir>/templates/plan-review.md`.
43
-
44
- Review these canonical inputs:
45
-
46
- - `spec.md`
47
- - `plan.md`
48
- - `tasks.md`
49
- - an active requirements checklist, when present
50
- - `openspec/memory/constitution.md`, when governance applies
51
-
52
- OpenSpec is the only SDD artifact store. Do not mirror `plan-review.md` or its
53
- payload into provider memory.
54
-
55
- ## Review method
56
-
57
- Judge the artifact set on five dimensions:
58
-
59
- 1. Completeness: every in-scope requirement and success criterion maps to work.
60
- 2. Correctness: named files, symbols, commands, and public contracts are real or
61
- explicitly created by the plan.
62
- 3. Coherence: artifacts agree on scope, sequencing, dependencies, and ownership.
63
- 4. Buildability: a competent implementer can execute without guessing about
64
- critical paths or hidden prerequisites.
65
- 5. Outcome coverage: verification tasks can demonstrate the requested result.
66
-
67
- Respect TDD ordering and the repository constitution when they apply. Report
68
- non-blocking cautions separately so they do not become artificial gates.
69
-
70
- ## Native parallel executability
71
-
72
- Structural ready validation proves that declared parallel metadata is
73
- well-formed; it does not prove semantic independence. When `tasks.md` declares
74
- parallel groups, Oracle must independently assess whether the plan can execute
75
- them safely:
76
-
77
- - Confirm each lane path union is genuinely disjoint from the other lanes and
78
- its selected owner fits the bounded work.
79
- - Confirm cross-lane data flow does not hide a dependency and that the declared
80
- prerequisites and barrier reflect the real execution order.
81
- - Confirm the handoff is sufficient for native capacity-bounded waves:
82
- dispatch-before-wait for every admitted lane, refill before another wait, and
83
- terminal reconciliation before releasing the barrier.
84
- - Require a truthful sequential fallback when native concurrency or capacity is
85
- unavailable or unproven.
86
-
87
- For an evidence-backed `None` declaration, assess whether the claimed coupling
88
- really prevents a safe group. Treat a structural-but-semantically-unsafe group
89
- as a blocker only when the smallest repair is required before implementation;
90
- keep capacity uncertainty as a non-blocking caution when the declared fallback
91
- still makes the plan executable.
92
-
93
- ## Decision contract
94
-
95
- Default to `[OKAY]`. Return `[REJECT]` only when execution is genuinely blocked.
96
- A rejection contains at most 3 actionable blockers. For each blocker, state why
97
- it blocks execution and the smallest concrete repair. Preserve the exact
98
- `[OKAY]` and `[REJECT]` tokens across every harness.
99
-
100
- After `[REJECT]`, Root repairs actionable same-intent planning artifacts,
101
- revalidates affected gates, and starts a fresh Oracle approval round until
102
- `[OKAY]`. A material human-owned blocker stops the loop for user input. Do not
103
- silently approve a changed plan or reuse an Oracle to issue a new approval.
104
-
105
- ## Freshness and persistence
106
-
107
- Root computes SHA-256 digests for every reviewed artifact and records them in
108
- the persisted review. Treat a stored approval as fresh only while every recorded
109
- digest matches. A stale review has no gate value; rerun it only if the user still
110
- chooses review.
111
-
112
- The persisted artifact records the status, Oracle role, timestamp, route,
113
- comments, non-blocking notes, blockers, any explicit override, and source
114
- digests. Oracle returns this payload; Root is the only writer that persists it.
115
-
116
- ## Handoff
117
-
118
- After `[OKAY]`, Root summarizes the approved scope, approach, ownership,
119
- verification, and material risks before asking the native question:
120
- `Implement (Recommended)` or `Stop`. Any explicit `Stop` answer wins. If the
121
- implementation question returns answerless, Root makes at most three total
122
- attempts; after the third answerless result, Root treats implementation as
123
- selected. `[OKAY]` alone does not authorize implementation before that explicit
124
- choice or bounded fallback resolves. Choosing `Proceed without review` at the
125
- earlier choice does authorize implementation.
126
-
127
- Plan review never replaces or substitutes for mandatory final verification.
128
- Every route still requires post-implementation verification, but ownership is
129
- proportional: trivial deterministic Direct work may be Root-verified when Root
130
- is not self-approving its own implementation; materially risky Direct work and
131
- every Accelerated or Full final verify require a fresh read-only Oracle.
132
-
133
- ## Output
134
-
135
- For an executable plan:
136
-
137
- ```text
138
- [OKAY]
139
- - Brief evidence that the plan is complete, coherent, and executable.
140
- - Optional non-blocking cautions.
141
- ```
142
-
143
- For a blocked plan:
144
-
145
- ```text
146
- [REJECT]
147
- 1. <blocker, impact, and smallest repair>
148
- 2. <optional blocker>
149
- 3. <optional blocker>
150
- ```
13
+ After the substantial plan passes `ready`, root first shows the user a concise
14
+ plan summary, then always offers Review plan with Oracle (Recommended) or
15
+ Proceed without review, even when implementation is already authorized. Silence is never an explicit skip; a fresh review runs only
16
+ when selected. Root, not Oracle, owns choices, budgets, recovery, and
17
+ implementation authorization. Every orchestrator choice with a meaningful
18
+ recommendation follows the per-question rule: repeat the same question after its
19
+ first and second confirmed answerless native returns without dependent work,
20
+ then select the recommendation after the third. Explicit answers and `Stop` win.
21
+ Pending, unavailable, failed, interrupted, or host-prohibited attempts do not
22
+ count. Report higher-priority host limits accurately; do not claim unmade returns
23
+ or an explicit user choice. Never invent facts or secrets; when a human-owned
24
+ decision is still unresolved, recommend safe deferral.
25
+
26
+ A fresh read-only Oracle reviews `.thoth/changes/<id>/<id>.md`,
27
+ `.thoth/constitution.md`, affected canonical `.thoth/specs/`, and focused source
28
+ evidence. Check grounded exploration, observable acceptance, settled
29
+ clarification, technical feasibility, dependencies, verification seams,
30
+ autonomy bounds, and native capacity. Concurrent tasks need semantic
31
+ independence and non-overlapping mutable ownership; unknown liveness blocks only
32
+ conflicting work. Do not require multiple reports, universal requirement IDs,
33
+ workflow manifests, evidence directories, or a scheduler. Structural `ready` is
34
+ necessary but not sufficient for semantic readiness.
35
+
36
+ Return `[OKAY]` with concise evidence or `[REJECT]` with at most three actual
37
+ execution blockers and smallest repairs; keep cautions separate. Root repairs
38
+ same-intent blockers in the same record, revalidates affected gates, and uses a
39
+ fresh Oracle for each round. A human-owned material blocker stops the round.
40
+ Root records both review disposition and selection provenance without inventing
41
+ approval. Accepted provenance is `EXPLICIT_REVIEW`, `EXPLICIT_SKIP`, or
42
+ `DEFAULT_REVIEW_AFTER_3`; `SKIPPED` requires explicit skip, while `OKAY` requires
43
+ explicit review or the third-return review default. After `[OKAY]`, root preserves
44
+ the separate Implement (Recommended) / Stop choice and separately offers it,
45
+ honoring prior explicit implementation authorization; an explicit later Stop
46
+ supersedes it. That choice has its own per-question budget. Review never
47
+ substitutes for fresh independent final Oracle verification, and Oracle never
48
+ writes change artifacts.
@@ -1,56 +1,59 @@
1
1
  ---
2
2
  name: thoth-archive
3
- description: Close a passing artifact-backed thoth-agents change by transactionally synchronizing explicitly declared durable requirement deltas and moving the complete audit trail to a dated archive.
3
+ description: Transactionally apply declared .thoth/specs deltas and archive independently verified substantial SDD changes.
4
4
  license: MIT
5
- compatibility: Requires Node.js >=22.19 and write access to the project OpenSpec tree.
5
+ compatibility: Requires Node.js >=22.19 and installed sibling thoth-sdd skill.
6
6
  metadata:
7
7
  author: thoth-agents
8
- version: "1.0"
8
+ version: "2.0"
9
9
  ---
10
10
 
11
11
  # Thoth Archive
12
12
 
13
- Archive is the required terminal transition for Accelerated and Full routes.
14
- Resolve `<skill-dir>` as the directory containing this `SKILL.md`, and resolve
15
- `<skills-root>` as its parent directory. Bundled paths below are anchored to
16
- those installed roots rather than the project or current working directory.
17
-
18
- 1. Confirm every task is `[x]`, `verify-report.md` records independent oracle
19
- `PASS`, its compliance matrix covers every FR and buildable SC, every outcome
20
- SC has observed PASS evidence or an explicit residual RISK, and no unresolved
21
- CRITICAL issue remains.
22
- 2. Prepare `archive-report.md` from
23
- `<skills-root>/thoth-sdd/templates/archive-report.md` with status `READY`,
24
- verification lineage, completed scope, deviations, residual warnings, and
25
- the pending canonical-sync line.
26
- 3. Run `node "<skills-root>/thoth-sdd/scripts/validate.mjs"` through `closeout`.
27
- 4. Run `node "<skill-dir>/scripts/archive.mjs" --change <path> --date YYYY-MM-DD --json`.
28
- 5. Return the dated archive path, updated capability specifications, and audit
29
- summary.
30
-
31
- The script reads delta metadata directly from `spec.md`:
32
-
33
- - `[ADDED capability]` creates a named canonical requirement.
34
- - `[MODIFIED capability]` replaces the named requirement and its scenarios.
35
- - `[REMOVED capability]` removes the named requirement.
36
- - `[RENAMED capability FROM Previous title]` renames and replaces it.
37
- - `[INTERNAL]` never changes `openspec/specs/`.
38
-
39
- The SDD validator preflights these operations against the canonical requirement
40
- titles from `specify` onward. Archive reuses the same ordered parser and
41
- preflight as a final defense before staging writes, preserving stable
42
- `SDD-SPEC-DELTA-*` incompatibility codes. An `ADDED` warning for an existing
43
- nonempty capability requires semantic-overlap review because differently named
44
- requirements cannot be proven distinct by exact-title tooling alone.
45
-
46
- All delta targets are validated before any permanent specification changes. The
47
- operation stages and rolls back the full canonical update if a delta, report
48
- update, or final move raises a handled error in the active process. Report and
49
- canonical recovery are attempted independently. It never merges undeclared
50
- feature prose. No CLI, network access, or installation action is used during SDD
51
- closeout.
52
-
53
- This operation is not crash-atomic. Forced process or operating-system
54
- termination between filesystem renames can leave `.spec.md.thoth-stage-*` or
55
- `spec.md.thoth-backup-*` files. Inspect them and the canonical specification
56
- before retrying archive.
13
+ Root archives only after the implementation writer has terminated and a fresh
14
+ independent Oracle PASS has covered the actual change, diff, checks, and risks.
15
+ Structural closeout validation is not approval. The single record must have all
16
+ tasks complete, explicit plan-review disposition and implementation authorization,
17
+ every acceptance outcome's concrete PASS check/evidence, reviewed-record and
18
+ source digests, reviewed canonical baselines for every affected capability, and
19
+ `**Archive**: READY`. Each affected canonical spec is covered in that same record
20
+ by its SHA-256 `Source` entry or an explicit `absent` entry. Missing or stale
21
+ coverage blocks before canonical or archive changes. No verification or archive
22
+ report is required or allowed.
23
+
24
+ Plan-review selection provenance must be `EXPLICIT_REVIEW`, `EXPLICIT_SKIP`, or
25
+ `DEFAULT_REVIEW_AFTER_3`. A `SKIPPED` disposition requires `EXPLICIT_SKIP`; an
26
+ `OKAY` disposition requires explicit review or the third-answerless review
27
+ default. An unanswered offer never authorizes skip. The orchestrator owns the
28
+ choice and uses the shared per-question recommendation rule; archive validation
29
+ does not claim that it can authenticate the native interaction.
30
+
31
+ Run the installed sibling validator at `--through closeout`, then:
32
+
33
+ ```text
34
+ node "<skill-dir>/scripts/archive.mjs" --change .thoth/changes/<id> --date YYYY-MM-DD --json
35
+ ```
36
+
37
+ The shipped `--project <repository-root>` option is also accepted and checked
38
+ against the change location. JSON includes the stable change ID, archive path,
39
+ record path, and updated capabilities.
40
+
41
+ The script validates before creating the transaction, revalidates under its
42
+ exclusive transaction, and checks actual reviewed baselines again immediately
43
+ before mutation. It applies only declared ADDED/MODIFIED/REMOVED/RENAMED
44
+ exact-title requirements to `.thoth/specs/<capability>/spec.md`, preserving
45
+ unaffected requirements. It then moves the active
46
+ `.thoth/changes/<id>/<id>.md` record to
47
+ `.thoth/changes/archive/<date>-<id>/<id>.md`. The filename and identity remain
48
+ unchanged; the date appears only in the archive directory. Historical changes
49
+ are preserved.
50
+
51
+ It preflights canonical baselines and destination topology, captures displaced
52
+ original bytes, installs exclusively without overwriting concurrent creation,
53
+ verifies applied bytes, and rolls back handled failures. It rejects unsafe IDs,
54
+ symlink escapes, archive collisions, and unfinished transactions. Forced
55
+ termination is not crash-atomic; a retained
56
+ `.thoth/.archive-transaction/recovery.json` is a filesystem recovery aid, not
57
+ workflow state. Inspect real files, backups, and change/archive locations before
58
+ recovery; never blindly replay external effects. No installer or network access
59
+ is involved.