thoth-agents 0.3.5 → 0.3.7

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 (40) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/README.md +25 -16
  3. package/dist/{chunk-W5GCMYA3.js → chunk-HIXSRHEG.js} +295 -66
  4. package/dist/cli/index.js +37 -4
  5. package/dist/cli/install.d.ts +2 -0
  6. package/dist/cli/operations/opencode.d.ts +2 -2
  7. package/dist/cli/owned-skills.d.ts +20 -0
  8. package/dist/cli/tui/index.js +1 -1
  9. package/dist/harness/core/owned-skills.d.ts +2 -0
  10. package/dist/index.js +5 -4
  11. package/package.json +1 -1
  12. package/plugin/.claude-plugin/plugin.json +1 -1
  13. package/plugin/.codex-plugin/plugin.json +1 -1
  14. package/plugin/skills/plan-reviewer/SKILL.md +5 -1
  15. package/plugin/skills/thoth-archive/SKILL.md +7 -3
  16. package/plugin/skills/thoth-constitution/SKILL.md +7 -4
  17. package/plugin/skills/thoth-init/SKILL.md +28 -20
  18. package/plugin/skills/thoth-init/scripts/init.mjs +99 -74
  19. package/plugin/skills/thoth-sdd/SKILL.md +17 -13
  20. package/plugin/skills/thoth-sdd/references/phases/checklist.md +3 -0
  21. package/plugin/skills/thoth-sdd/references/phases/plan.md +8 -4
  22. package/plugin/skills/thoth-sdd/references/phases/specify.md +3 -1
  23. package/plugin/skills/thoth-sdd/references/phases/tasks.md +10 -3
  24. package/plugin/skills/thoth-sdd/references/phases/verify.md +4 -3
  25. package/plugin/skills/thoth-sdd/templates/plan.md +14 -6
  26. package/plugin/skills/thoth-sdd/templates/tasks.md +20 -7
  27. package/skills/README.md +5 -3
  28. package/skills/plan-reviewer/SKILL.md +5 -1
  29. package/skills/thoth-archive/SKILL.md +7 -3
  30. package/skills/thoth-constitution/SKILL.md +7 -4
  31. package/skills/thoth-init/SKILL.md +28 -20
  32. package/skills/thoth-init/scripts/init.mjs +99 -74
  33. package/skills/thoth-sdd/SKILL.md +17 -13
  34. package/skills/thoth-sdd/references/phases/checklist.md +3 -0
  35. package/skills/thoth-sdd/references/phases/plan.md +8 -4
  36. package/skills/thoth-sdd/references/phases/specify.md +3 -1
  37. package/skills/thoth-sdd/references/phases/tasks.md +10 -3
  38. package/skills/thoth-sdd/references/phases/verify.md +4 -3
  39. package/skills/thoth-sdd/templates/plan.md +14 -6
  40. package/skills/thoth-sdd/templates/tasks.md +20 -7
@@ -3,15 +3,22 @@
3
3
  **Owner**: root<br>
4
4
  **Output**: `openspec/changes/<feature>/tasks.md`
5
5
 
6
+ Start from `<skill-dir>/templates/tasks.md`, where `<skill-dir>` is the directory
7
+ containing the installed `thoth-sdd/SKILL.md`.
8
+
6
9
  Every executable line uses exactly:
7
10
 
8
11
  ```text
9
12
  - [ ] T### [P?] [US#?] description with FR-###/SC-### coverage in `exact/path` | Verify: observable outcome
10
13
  ```
11
14
 
12
- IDs are unique and sequential. `[US#]` links story work; omit it only for shared
13
- setup or closeout. Cover every FR and **buildable** SC. Outcome SCs remain
14
- verification targets but do not justify artificial implementation tasks.
15
+ IDs start at `T001` and remain unique and sequential across the entire file;
16
+ never reset numbering per story or section. `[P]`, when present, precedes
17
+ `[US#]`; omit `[US#]` only for shared setup or closeout. Before `| Verify:`, use
18
+ exactly one backtick span containing one literal repository-relative path and no
19
+ placeholder, glob, absolute path, URI, home path, or repository escape. Cover
20
+ every FR and **buildable** SC. Outcome SCs remain verification targets but do
21
+ not justify artificial implementation tasks.
15
22
 
16
23
  Order test-first work before its implementation, group tasks by independently
17
24
  deliverable story, identify the MVP, and state dependencies. `[P]` is permitted
@@ -17,6 +17,7 @@ task.
17
17
  Return `pass` or `fail`, compliance matrix, commands/results, stable findings,
18
18
  critical issues, warnings, and remediation anchors. For Direct, return the
19
19
  verdict in-session. For Accelerated and Full, root persists oracle's exact result
20
- using `templates/verify-report.md`. Fail routes to converge (straight back to
21
- implement for Direct); PASS permits closeout and archive for artifact-backed
22
- routes.
20
+ using `<skill-dir>/templates/verify-report.md`, where `<skill-dir>` is the
21
+ directory containing the installed `thoth-sdd/SKILL.md`. Fail routes to converge
22
+ (straight back to implement for Direct); PASS permits closeout and archive for
23
+ artifact-backed routes.
@@ -6,11 +6,17 @@
6
6
 
7
7
  ## Constitution Check (pre-design)
8
8
 
9
- Repeat every active Constitution principle by its exact heading. Each entry must
10
- use one status and concrete evidence; placeholders are invalid in a completed
11
- plan.
9
+ Read `openspec/memory/constitution.md` and extract every active numbered
10
+ principle heading. Build one ordered name set and reuse it unchanged in both
11
+ Constitution Checks: do not add, remove, abbreviate, or rename a heading between
12
+ the pre-design and post-design lists.
12
13
 
13
- - **[Exact principle heading]**: PASS | JUSTIFIED EXCEPTION | FAIL — [concrete evidence]
14
+ Each entry must use the canonical form
15
+ `- **<exact principle heading>**: <PASS | JUSTIFIED EXCEPTION | FAIL> — <concrete evidence>`.
16
+ Placeholders are invalid, and any `FAIL` blocks task generation. Replace the
17
+ anchor below; do not append entries beside an example list.
18
+
19
+ <!-- PRE-DESIGN-CONSTITUTION-ENTRIES -->
14
20
 
15
21
  ## Design
16
22
 
@@ -33,6 +39,8 @@ plan.
33
39
 
34
40
  ## Constitution Check (post-design)
35
41
 
36
- Repeat the same active principles used by the pre-design check.
42
+ Reuse the exact ordered principle names from the pre-design check and provide
43
+ fresh evidence about the completed design. Replace the anchor below; the two
44
+ checks must differ only in status/evidence, never in principle coverage.
37
45
 
38
- - **[Exact principle heading]**: PASS | JUSTIFIED EXCEPTION | FAIL — [concrete design evidence]
46
+ <!-- POST-DESIGN-CONSTITUTION-ENTRIES -->
@@ -1,5 +1,20 @@
1
1
  # Tasks: [Feature name]
2
2
 
3
+ ## Authoring contract
4
+
5
+ Replace every HTML anchor below with real content; do not append new tasks next
6
+ to retained examples. Across the entire file, task identifiers start at `T001`
7
+ and increase by exactly one without resetting for a new story or section.
8
+
9
+ The canonical task form is:
10
+ ``- [ ] T001 [P] [US1] Description with FR-###/SC-### coverage in `path/to/file` | Verify: observable outcome``
11
+
12
+ `[P]` is optional and must precede the optional `[US#]` tag. Before
13
+ `| Verify:`, each task must contain exactly one backtick span, reserved for one
14
+ literal repository-relative path. Do not use placeholders, globs, absolute or
15
+ home-relative paths, repository escapes, URIs, or extra backticks. Every task
16
+ must end with a concrete `Verify` outcome.
17
+
3
18
  ## MVP scope
4
19
 
5
20
  [Name the first independently testable story and its completion evidence.]
@@ -10,20 +25,18 @@
10
25
 
11
26
  ## Story US1
12
27
 
13
- - [ ] T001 [US1] Add the failing behavior test for FR-001 and buildable SC-001 in `[exact/test/path]` | Verify: the focused test fails for the missing behavior
14
- - [ ] T002 [US1] Implement FR-001 and buildable SC-001 in `[exact/source/path]` | Verify: the focused test passes
15
- - [ ] T003 [P] [US1] Update independent documentation for FR-001 in `[exact/doc/path]` | Verify: the documented contract matches the tested behavior
28
+ <!-- STORY-US1-TASKS -->
16
29
 
17
30
  Outcome SCs remain verification targets; do not manufacture implementation tasks
18
31
  for them.
19
32
 
20
33
  ## Parallel execution
21
34
 
22
- [Keep exactly one form below. Use `[P]` only when mutable paths cannot overlap.]
35
+ [Replace the anchor with exactly one form: concrete task pairings covering every
36
+ `[P]` task, or `- None: <evidence-backed reason>`. Never keep both forms.]
23
37
 
24
- - T003 may run with T001 because `[exact/doc/path]` and `[exact/test/path]` do not overlap.
25
- - None: [reason no tasks can safely overlap]
38
+ <!-- PARALLEL-EXECUTION-EVIDENCE -->
26
39
 
27
40
  ## Final verification
28
41
 
29
- - [ ] T004 [US1] Map FR-001 and buildable SC-001 evidence in `[verify-report path]` | Verify: oracle records a passing verdict with executed evidence
42
+ <!-- FINAL-VERIFICATION-TASKS -->
package/skills/README.md CHANGED
@@ -2,8 +2,8 @@
2
2
 
3
3
  This directory is the canonical, versioned source for skills owned by
4
4
  thoth-agents. `pnpm run integration:sync` copies those skills into the Codex and
5
- Claude Code plugins; OpenCode exposes `/thoth-init`, which materializes them
6
- project-locally.
5
+ Claude Code plugins; `npx thoth-agents install --agent=opencode` materializes
6
+ the same packaged skill trees globally under `~/.config/opencode/skills/`.
7
7
 
8
8
  Owned workflow skills are `thoth-init`, `thoth-sdd`, `thoth-constitution`,
9
9
  `thoth-archive`, and `plan-reviewer`. The last one implements the optional,
@@ -11,4 +11,6 @@ user-selected, read-only Oracle review before implementation. Mandatory external
11
11
  skills (`simplify`, `tdd`,
12
12
  `progressive-context-router`, and `architectural-grilling`) are not copied here:
13
13
  the thoth-agents installer invokes `npx skills add` against their canonical
14
- repositories so they retain a single source of truth.
14
+ repositories so they retain a single source of truth. `thoth-init` only
15
+ initializes or synchronizes minimum project `openspec/` governance and never
16
+ installs skills.
@@ -26,10 +26,14 @@ Oracle review; mandatory final Oracle verify still applies.
26
26
 
27
27
  ## Ownership and inputs
28
28
 
29
+ Resolve `<skill-dir>` as the directory containing this `SKILL.md`. Every bundled
30
+ asset path in this contract is anchored to that installed skill root rather than
31
+ the project or current working directory.
32
+
29
33
  Root coordinates the phase and dispatches Oracle. Oracle remains read-only: it
30
34
  must not edit source, SDD artifacts, or coordination state. Root persists the
31
35
  returned review at `openspec/changes/<change>/plan-review.md` using
32
- `templates/plan-review.md`.
36
+ `<skill-dir>/templates/plan-review.md`.
33
37
 
34
38
  Review these canonical inputs:
35
39
 
@@ -6,16 +6,20 @@ description: Close a passing artifact-backed thoth-agents change by transactiona
6
6
  # Thoth Archive
7
7
 
8
8
  Archive is the required terminal transition for Accelerated and Full routes.
9
+ Resolve `<skill-dir>` as the directory containing this `SKILL.md`, and resolve
10
+ `<skills-root>` as its parent directory. Bundled paths below are anchored to
11
+ those installed roots rather than the project or current working directory.
9
12
 
10
13
  1. Confirm every task is `[x]`, `verify-report.md` records independent oracle
11
14
  `PASS`, its compliance matrix covers every FR and buildable SC, every outcome
12
15
  SC has observed PASS evidence or an explicit residual RISK, and no unresolved
13
16
  CRITICAL issue remains.
14
- 2. Prepare `archive-report.md` from the bundled template with status `READY`,
17
+ 2. Prepare `archive-report.md` from
18
+ `<skills-root>/thoth-sdd/templates/archive-report.md` with status `READY`,
15
19
  verification lineage, completed scope, deviations, residual warnings, and
16
20
  the pending canonical-sync line.
17
- 3. Run the thoth-sdd validator through `closeout`.
18
- 4. Run `scripts/archive.mjs --change <path> --date YYYY-MM-DD --json`.
21
+ 3. Run `node "<skills-root>/thoth-sdd/scripts/validate.mjs"` through `closeout`.
22
+ 4. Run `node "<skill-dir>/scripts/archive.mjs" --change <path> --date YYYY-MM-DD --json`.
19
23
  5. Return the dated archive path, updated capability specifications, and audit
20
24
  summary.
21
25
 
@@ -6,6 +6,9 @@ description: Create or explicitly amend the project constitution, choose its gov
6
6
  # Thoth Constitution
7
7
 
8
8
  The canonical project constitution is `openspec/memory/constitution.md`.
9
+ Resolve `<skill-dir>` as the directory containing this `SKILL.md`. Every bundled
10
+ validator or template path below is anchored to that installed skill root rather
11
+ than the project or current working directory.
9
12
 
10
13
  ## Routine SDD
11
14
 
@@ -36,10 +39,10 @@ a confirmed durable governance change.
36
39
  6. Remove unexplained placeholders and deferred TODOs, then run:
37
40
 
38
41
  ```bash
39
- node skills/thoth-constitution/scripts/validate.mjs \
42
+ node "<skill-dir>/scripts/validate.mjs" \
40
43
  --constitution openspec/memory/constitution.md --json
41
44
  ```
42
45
 
43
- Initialization copies `templates/constitution.md` only when the project has no
44
- constitution, resolves its date placeholders, and never overwrites a
45
- project-owned constitution.
46
+ Initialization copies `<skill-dir>/templates/constitution.md` only when the
47
+ project has no constitution, resolves its date placeholders, and never
48
+ overwrites a project-owned constitution.
@@ -1,30 +1,38 @@
1
1
  ---
2
2
  name: thoth-init
3
- description: Initialize project SDD governance and OpenCode local skills from the installed bundle; Codex global agents and instructions remain CLI-owned.
3
+ description: Initialize or synchronize the minimum project OpenSpec governance structure required by thoth-agents SDD flows.
4
4
  ---
5
5
 
6
6
  # Thoth Init
7
7
 
8
- Initialize the current project from this installed skill bundle. Resolve
9
- `<skill-dir>` as the directory containing this `SKILL.md`, then run the bundled
10
- script by absolute path:
8
+ Initialize or synchronize the current project's OpenSpec governance from this
9
+ installed skill bundle. Resolve `<skill-dir>` as the directory containing this
10
+ `SKILL.md`, then run the bundled script by absolute path:
11
11
 
12
12
  ```text
13
- node "<skill-dir>/scripts/init.mjs" --project <project-root> --harness <opencode|codex|claude> --json
13
+ node "<skill-dir>/scripts/init.mjs" --project <project-root> --json
14
14
  ```
15
15
 
16
- - OpenCode materializes the five thoth-owned workflow skills under
17
- `.agents/skills/`.
18
- - Codex init creates project governance only. Codex plugin manifests cannot
19
- install custom agents or global instructions; first run the mandatory
20
- thoth-agents CLI setup that manages `~/.codex/agents/`,
21
- `~/.codex/AGENTS.md`, and `~/.codex/config.toml`.
22
- - Claude uses auto-discovered plugin agents and owned skills; init creates only
23
- project governance assets.
24
-
25
- For every harness, installation must already have used the thoth-agents CLI to
26
- install mandatory external skills from their canonical repositories. This init
27
- skill never invokes the CLI or downloads a skill.
28
-
29
- The operation is offline and idempotent. It never overwrites the project
30
- constitution, templates, or unrelated instruction content.
16
+ The project root must already exist. The initializer preflights the complete
17
+ target structure before changing it, then ensures these minimum paths exist:
18
+
19
+ - `openspec/changes/archive/`
20
+ - `openspec/specs/`
21
+ - `openspec/memory/`
22
+ - `openspec/.thoth-agents.json`
23
+
24
+ The missing constitution is copied from the installed sibling
25
+ `thoth-constitution` skill. An existing constitution remains byte-for-byte
26
+ intact, while the thoth-managed manifest may be normalized to the current
27
+ contract. Any legacy `openspec/templates/` tree is outside the managed graph and
28
+ remains untouched. Inspect the JSON `created`, `managed`, and `preserved` arrays
29
+ when reporting the result.
30
+
31
+ The initializer never creates, copies, validates, reads, or synchronizes SDD
32
+ workflow templates. Those assets remain in the installed `thoth-sdd` skill and
33
+ are consumed directly from that bundle by the workflow phase contracts.
34
+
35
+ This operation is offline, idempotent, and harness-neutral. Every write stays
36
+ inside `openspec/`. It never installs or synchronizes skills, agents, plugins,
37
+ harness configuration, external dependencies, or global instruction files;
38
+ those are responsibilities of `npx thoth-agents install`.
@@ -1,12 +1,10 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  import {
4
- cpSync,
5
4
  existsSync,
5
+ lstatSync,
6
6
  mkdirSync,
7
- readdirSync,
8
7
  readFileSync,
9
- statSync,
10
8
  writeFileSync,
11
9
  } from 'node:fs';
12
10
  import { dirname, join, resolve } from 'node:path';
@@ -15,12 +13,12 @@ import { fileURLToPath } from 'node:url';
15
13
  const SCRIPT_PATH = fileURLToPath(import.meta.url);
16
14
  const SKILL_ROOT = dirname(dirname(SCRIPT_PATH));
17
15
  const BUNDLE_ROOT = dirname(SKILL_ROOT);
18
- const OWNED_SKILL_NAMES = [
19
- 'thoth-init',
20
- 'thoth-sdd',
21
- 'thoth-constitution',
22
- 'thoth-archive',
23
- 'plan-reviewer',
16
+ const OPEN_SPEC_DIRECTORIES = [
17
+ 'openspec',
18
+ join('openspec', 'changes'),
19
+ join('openspec', 'changes', 'archive'),
20
+ join('openspec', 'specs'),
21
+ join('openspec', 'memory'),
24
22
  ];
25
23
 
26
24
  function parseArgs(argv) {
@@ -29,110 +27,137 @@ function parseArgs(argv) {
29
27
  const argument = argv[index];
30
28
  if (argument === '--json') options.json = true;
31
29
  else if (argument === '--project') options.project = argv[++index];
32
- else if (argument === '--harness') options.harness = argv[++index];
33
30
  else throw new Error(`Unknown argument: ${argument}`);
34
31
  }
35
32
  if (!options.project) throw new Error('--project is required');
36
- if (!['opencode', 'codex', 'claude'].includes(options.harness)) {
37
- throw new Error('--harness must be opencode, codex, or claude');
38
- }
39
33
  return options;
40
34
  }
41
35
 
42
- function copyMissing(source, target, report) {
43
- if (!existsSync(source)) return;
44
- const sourceStat = statSync(source);
45
- if (sourceStat.isDirectory()) {
46
- mkdirSync(target, { recursive: true });
47
- for (const entry of readdirSync(source)) {
48
- copyMissing(join(source, entry), join(target, entry), report);
49
- }
50
- return;
36
+ function assertDirectory(path, label) {
37
+ if (!existsSync(path)) return;
38
+ const stat = lstatSync(path);
39
+ if (stat.isSymbolicLink() || !stat.isDirectory()) {
40
+ throw new Error(`${label} must be a directory: ${path}`);
51
41
  }
52
- if (existsSync(target)) {
53
- report.skipped.push(target);
54
- return;
55
- }
56
- mkdirSync(dirname(target), { recursive: true });
57
- cpSync(source, target, { errorOnExist: true });
58
- report.created.push(target);
59
42
  }
60
43
 
61
- function writeMissing(target, content, report) {
62
- if (existsSync(target)) {
63
- report.skipped.push(target);
64
- return;
44
+ function assertRegularFile(path, label) {
45
+ if (!existsSync(path)) return;
46
+ const stat = lstatSync(path);
47
+ if (stat.isSymbolicLink() || !stat.isFile()) {
48
+ throw new Error(`${label} must be a regular file: ${path}`);
65
49
  }
66
- mkdirSync(dirname(target), { recursive: true });
67
- writeFileSync(target, content);
68
- report.created.push(target);
69
50
  }
70
51
 
71
- function installConstitution(project, report) {
72
- const target = join(project, 'openspec', 'memory', 'constitution.md');
73
- const template = join(
52
+ function preflight(project) {
53
+ assertDirectory(project, 'Project root');
54
+ if (!existsSync(project)) {
55
+ throw new Error(
56
+ `--project must reference an existing project directory: ${project}`,
57
+ );
58
+ }
59
+
60
+ const constitutionSource = join(
74
61
  BUNDLE_ROOT,
75
62
  'thoth-constitution',
76
63
  'templates',
77
64
  'constitution.md',
78
65
  );
79
- if (!existsSync(template)) return;
80
- const today = new Date().toISOString().slice(0, 10);
81
- writeMissing(
82
- target,
83
- readFileSync(template, 'utf8').replaceAll('YYYY-MM-DD', today),
84
- report,
66
+ assertRegularFile(constitutionSource, 'Bundled constitution template');
67
+ if (!existsSync(constitutionSource)) {
68
+ throw new Error(
69
+ `Bundled constitution template is missing: ${constitutionSource}`,
70
+ );
71
+ }
72
+
73
+ for (const directory of OPEN_SPEC_DIRECTORIES) {
74
+ assertDirectory(join(project, directory), 'OpenSpec path');
75
+ }
76
+
77
+ const constitutionTarget = join(
78
+ project,
79
+ 'openspec',
80
+ 'memory',
81
+ 'constitution.md',
85
82
  );
83
+ const manifestTarget = join(project, 'openspec', '.thoth-agents.json');
84
+ assertRegularFile(constitutionTarget, 'OpenSpec constitution path');
85
+ assertRegularFile(manifestTarget, 'OpenSpec manifest path');
86
+
87
+ return {
88
+ constitutionSource,
89
+ constitutionTarget,
90
+ manifestTarget,
91
+ };
86
92
  }
87
93
 
88
- function installGovernance(project, report) {
89
- installConstitution(project, report);
90
- const templatesRoot = join(BUNDLE_ROOT, 'thoth-sdd', 'templates');
91
- if (existsSync(templatesRoot)) {
92
- for (const entry of readdirSync(templatesRoot)) {
93
- copyMissing(
94
- join(templatesRoot, entry),
95
- join(project, 'openspec', 'templates', entry),
96
- report,
97
- );
98
- }
94
+ function createDirectory(target, report) {
95
+ if (existsSync(target)) return;
96
+ mkdirSync(target);
97
+ report.created.push(target);
98
+ }
99
+
100
+ function writePreservingExisting(target, content, report) {
101
+ if (existsSync(target)) {
102
+ report.preserved.push(target);
103
+ return;
99
104
  }
100
- writeMissing(
101
- join(project, 'openspec', '.thoth-agents.json'),
102
- `${JSON.stringify({ version: 1, initializedBy: 'thoth-agents' }, null, 2)}\n`,
103
- report,
104
- );
105
+ writeFileSync(target, content);
106
+ report.created.push(target);
105
107
  }
106
108
 
107
- function installOpenCode(project, report) {
108
- for (const skillName of OWNED_SKILL_NAMES) {
109
- copyMissing(
110
- join(BUNDLE_ROOT, skillName),
111
- join(project, '.agents', 'skills', skillName),
112
- report,
113
- );
109
+ function synchronizeManagedFile(target, content, report) {
110
+ if (!existsSync(target)) {
111
+ writeFileSync(target, content);
112
+ report.created.push(target);
113
+ return;
114
+ }
115
+ if (readFileSync(target, 'utf8') === content) {
116
+ report.preserved.push(target);
117
+ return;
118
+ }
119
+ writeFileSync(target, content);
120
+ report.managed.push(target);
121
+ }
122
+
123
+ function synchronizeOpenSpec(project, assets, report) {
124
+ for (const directory of OPEN_SPEC_DIRECTORIES) {
125
+ createDirectory(join(project, directory), report);
114
126
  }
127
+
128
+ const today = new Date().toISOString().slice(0, 10);
129
+ writePreservingExisting(
130
+ assets.constitutionTarget,
131
+ readFileSync(assets.constitutionSource, 'utf8').replaceAll(
132
+ 'YYYY-MM-DD',
133
+ today,
134
+ ),
135
+ report,
136
+ );
137
+ synchronizeManagedFile(
138
+ assets.manifestTarget,
139
+ `${JSON.stringify({ version: 1, initializedBy: 'thoth-agents' }, null, 2)}\n`,
140
+ report,
141
+ );
115
142
  }
116
143
 
117
144
  try {
118
145
  const options = parseArgs(process.argv.slice(2));
119
146
  const project = resolve(options.project);
120
- mkdirSync(project, { recursive: true });
147
+ const assets = preflight(project);
121
148
  const report = {
122
149
  status: 'ready',
123
- harness: options.harness,
124
150
  project,
125
151
  created: [],
126
152
  managed: [],
127
- skipped: [],
153
+ preserved: [],
128
154
  };
129
155
 
130
- installGovernance(project, report);
131
- if (options.harness === 'opencode') installOpenCode(project, report);
156
+ synchronizeOpenSpec(project, assets, report);
132
157
 
133
158
  const output = options.json
134
159
  ? JSON.stringify(report)
135
- : `thoth-agents initialized ${project} for ${options.harness}`;
160
+ : `thoth-agents synchronized OpenSpec governance in ${project}`;
136
161
  process.stdout.write(`${output}\n`);
137
162
  } catch (error) {
138
163
  process.stderr.write(
@@ -37,6 +37,10 @@ Accelerated the minimum recommendation but does not force it.
37
37
 
38
38
  ## Progressive loading
39
39
 
40
+ Resolve `<skill-dir>` as the directory containing this `SKILL.md`, and resolve
41
+ `<skills-root>` as its parent directory. Every bundled path below is anchored to
42
+ one of those installed roots, never to the project or current working directory.
43
+
40
44
  Use only installed local contracts during the pipeline. Never invoke the
41
45
  thoth-agents CLI, `npx skills add`, or a network fetch to advance an SDD phase.
42
46
  If a required contract or external skill is missing, stop and report an
@@ -46,24 +50,24 @@ Read only the current phase contract:
46
50
 
47
51
  | Phase | Contract |
48
52
  | --- | --- |
49
- | explore | `references/phases/explore.md` |
50
- | specify | `references/phases/specify.md` |
51
- | clarify | `references/phases/clarify.md` |
52
- | plan | `references/phases/plan.md` |
53
- | checklist | `references/phases/checklist.md` |
54
- | tasks | `references/phases/tasks.md` |
55
- | plan-review | bundled `plan-reviewer` skill |
56
- | implement | `references/phases/implement.md` |
57
- | verify | `references/phases/verify.md` |
58
- | converge | `references/phases/converge.md` |
59
- | archive | bundled `thoth-archive` skill |
53
+ | explore | `<skill-dir>/references/phases/explore.md` |
54
+ | specify | `<skill-dir>/references/phases/specify.md` |
55
+ | clarify | `<skill-dir>/references/phases/clarify.md` |
56
+ | plan | `<skill-dir>/references/phases/plan.md` |
57
+ | checklist | `<skill-dir>/references/phases/checklist.md` |
58
+ | tasks | `<skill-dir>/references/phases/tasks.md` |
59
+ | plan-review | `<skills-root>/plan-reviewer/SKILL.md` |
60
+ | implement | `<skill-dir>/references/phases/implement.md` |
61
+ | verify | `<skill-dir>/references/phases/verify.md` |
62
+ | converge | `<skill-dir>/references/phases/converge.md` |
63
+ | archive | `<skills-root>/thoth-archive/SKILL.md` |
60
64
 
61
65
  ## Validation gates
62
66
 
63
- Run the validator from this skill directory:
67
+ Run the validator from its installed absolute path:
64
68
 
65
69
  ```text
66
- node scripts/validate.mjs --change openspec/changes/<feature> --route <accelerated|full> --through <specify|plan|tasks|checklist|ready|closeout> --json
70
+ node "<skill-dir>/scripts/validate.mjs" --change openspec/changes/<feature> --route <accelerated|full> --through <specify|plan|tasks|checklist|ready|closeout> --json
67
71
  ```
68
72
 
69
73
  - **Accelerated**: `specify`, then `ready` after the fast-forward planning pass,
@@ -5,6 +5,9 @@
5
5
  **Activation**: high contract/failure risk, compliance sensitivity, or
6
6
  ambiguity-prone scope
7
7
 
8
+ When activated, start from `<skill-dir>/templates/checklist.md`, where
9
+ `<skill-dir>` is the directory containing the installed `thoth-sdd/SKILL.md`.
10
+
8
11
  Record the concrete activation reason. Use sequential `CHK###` items to audit
9
12
  the requirements—not implementation—across the base taxonomy: Completeness,
10
13
  Clarity, Consistency, Measurability, and Coverage.
@@ -3,10 +3,14 @@
3
3
  **Owner**: root<br>
4
4
  **Output**: `openspec/changes/<feature>/plan.md`
5
5
 
6
- Start from `templates/plan.md`. Read active constitution principles and record
7
- evidence-backed pre-design and post-design Constitution Checks. Routine SDD does
8
- not amend the constitution or run its lifecycle validator; activate
9
- `thoth-constitution` only when an explicit constitution amendment is in scope.
6
+ Start from `<skill-dir>/templates/plan.md`, where `<skill-dir>` is the directory
7
+ containing the installed `thoth-sdd/SKILL.md`. Read active constitution
8
+ principles and record evidence-backed pre-design and post-design Constitution
9
+ Checks. Extract the exact active numbered principle headings once, then reuse
10
+ that same ordered name set in both checks; only status and evidence may differ.
11
+ Routine SDD does not amend the constitution or run its lifecycle validator;
12
+ activate `thoth-constitution` only when an explicit constitution amendment is
13
+ in scope.
10
14
 
11
15
  Map each technical choice to FR/SC or a confirmed repository constraint. Name
12
16
  affected components, interfaces, exact paths, migrations, risks, rollback, and
@@ -3,7 +3,9 @@
3
3
  **Owner**: root<br>
4
4
  **Output**: `openspec/changes/<feature>/spec.md`
5
5
 
6
- Start from `templates/spec.md` and remain implementation-neutral.
6
+ Start from `<skill-dir>/templates/spec.md`, where `<skill-dir>` is the directory
7
+ containing the installed `thoth-sdd/SKILL.md`, and remain
8
+ implementation-neutral.
7
9
 
8
10
  - Record **Why**, **Impact**, and affected kebab-case capability slugs (or
9
11
  `None`).
@@ -3,15 +3,22 @@
3
3
  **Owner**: root<br>
4
4
  **Output**: `openspec/changes/<feature>/tasks.md`
5
5
 
6
+ Start from `<skill-dir>/templates/tasks.md`, where `<skill-dir>` is the directory
7
+ containing the installed `thoth-sdd/SKILL.md`.
8
+
6
9
  Every executable line uses exactly:
7
10
 
8
11
  ```text
9
12
  - [ ] T### [P?] [US#?] description with FR-###/SC-### coverage in `exact/path` | Verify: observable outcome
10
13
  ```
11
14
 
12
- IDs are unique and sequential. `[US#]` links story work; omit it only for shared
13
- setup or closeout. Cover every FR and **buildable** SC. Outcome SCs remain
14
- verification targets but do not justify artificial implementation tasks.
15
+ IDs start at `T001` and remain unique and sequential across the entire file;
16
+ never reset numbering per story or section. `[P]`, when present, precedes
17
+ `[US#]`; omit `[US#]` only for shared setup or closeout. Before `| Verify:`, use
18
+ exactly one backtick span containing one literal repository-relative path and no
19
+ placeholder, glob, absolute path, URI, home path, or repository escape. Cover
20
+ every FR and **buildable** SC. Outcome SCs remain verification targets but do
21
+ not justify artificial implementation tasks.
15
22
 
16
23
  Order test-first work before its implementation, group tasks by independently
17
24
  deliverable story, identify the MVP, and state dependencies. `[P]` is permitted
@@ -17,6 +17,7 @@ task.
17
17
  Return `pass` or `fail`, compliance matrix, commands/results, stable findings,
18
18
  critical issues, warnings, and remediation anchors. For Direct, return the
19
19
  verdict in-session. For Accelerated and Full, root persists oracle's exact result
20
- using `templates/verify-report.md`. Fail routes to converge (straight back to
21
- implement for Direct); PASS permits closeout and archive for artifact-backed
22
- routes.
20
+ using `<skill-dir>/templates/verify-report.md`, where `<skill-dir>` is the
21
+ directory containing the installed `thoth-sdd/SKILL.md`. Fail routes to converge
22
+ (straight back to implement for Direct); PASS permits closeout and archive for
23
+ artifact-backed routes.