intentdna 1.8.7 → 1.9.0-rc.2

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 (69) hide show
  1. package/.claude-plugin/marketplace.json +2 -2
  2. package/.claude-plugin/plugin.json +1 -1
  3. package/dist/cli/commands/candidate-promotion.d.ts +15 -0
  4. package/dist/cli/commands/candidate-promotion.js +197 -0
  5. package/dist/cli/commands/run-lifecycle.js +1 -0
  6. package/dist/cli/commands/run.js +76 -42
  7. package/dist/cli/commands/setup.d.ts +10 -0
  8. package/dist/cli/commands/setup.js +129 -36
  9. package/dist/cli/commands/source-assets.d.ts +32 -0
  10. package/dist/cli/commands/source-assets.js +154 -0
  11. package/dist/cli/commands/sync.js +52 -12
  12. package/dist/cli/commands/templates.js +59 -37
  13. package/dist/cli/index.js +161 -5
  14. package/dist/compiler/cascade.js +1 -1
  15. package/dist/hooks/cli.d.ts +6 -0
  16. package/dist/hooks/cli.js +118 -10
  17. package/dist/hooks/enforcement-boundary.d.ts +1 -1
  18. package/dist/hooks/protocol.d.ts +1 -1
  19. package/dist/hooks/state.d.ts +5 -0
  20. package/dist/hooks/state.js +21 -6
  21. package/dist/mcp/tools-state.js +251 -15
  22. package/dist/runtime/claude-sync-target.d.ts +2 -0
  23. package/dist/runtime/claude-sync-target.js +1 -1
  24. package/dist/runtime/evaluator.d.ts +13 -0
  25. package/dist/runtime/evaluator.js +46 -0
  26. package/dist/runtime/index.d.ts +8 -4
  27. package/dist/runtime/index.js +4 -2
  28. package/dist/runtime/plugin-adapter.d.ts +14 -1
  29. package/dist/runtime/plugin-adapter.js +23 -9
  30. package/dist/runtime/run-contracts.d.ts +5 -3
  31. package/dist/runtime/run-contracts.js +11 -1
  32. package/dist/runtime/run-controller.d.ts +15 -1
  33. package/dist/runtime/run-controller.js +235 -94
  34. package/dist/runtime/skill-adapter.js +24 -53
  35. package/dist/runtime/verifier.js +101 -2
  36. package/dist/runtime/workflow-plan-adapter.d.ts +2 -1
  37. package/dist/runtime/workflow-plan-adapter.js +78 -11
  38. package/dist/runtime/workflow-runtime-manifest.d.ts +48 -0
  39. package/dist/runtime/workflow-runtime-manifest.js +196 -0
  40. package/dist/runtime/workflow-variable-scopes.d.ts +12 -0
  41. package/dist/runtime/workflow-variable-scopes.js +55 -0
  42. package/dist/schema/types.d.ts +9 -0
  43. package/dist/schema/validate.js +29 -1
  44. package/dist/sources/authoring-packet.d.ts +8 -0
  45. package/dist/sources/authoring-packet.js +85 -0
  46. package/dist/sources/discovery.d.ts +7 -0
  47. package/dist/sources/discovery.js +150 -0
  48. package/dist/sources/license.d.ts +5 -0
  49. package/dist/sources/license.js +94 -0
  50. package/dist/sources/manifest.d.ts +11 -0
  51. package/dist/sources/manifest.js +84 -0
  52. package/dist/sources/skill-markdown.d.ts +6 -0
  53. package/dist/sources/skill-markdown.js +174 -0
  54. package/dist/sources/types.d.ts +125 -0
  55. package/dist/sources/types.js +1 -0
  56. package/dist/templates/asset-refinery.dna.yaml +192 -0
  57. package/dist/templates/flutter-behavior-lock.dna.yaml +17 -0
  58. package/dist/templates/flutter-refactoring-rescue.dna.yaml +11 -0
  59. package/dist/templates/flutter-rewrite.dna.yaml +154 -28
  60. package/dist/templates/metadata.js +2 -0
  61. package/dist/templates/multi-agent-handoff-coordination.dna.yaml +102 -37
  62. package/dist/templates/persistent-executor.dna.yaml +61 -3
  63. package/dist/templates/research-improvement.dna.yaml +295 -0
  64. package/dist/templates/subagent-parallel.dna.yaml +90 -17
  65. package/dist/templates/workflow-evidence-review.dna.yaml +8 -0
  66. package/dist/workflow/candidate-projection.d.ts +33 -0
  67. package/dist/workflow/candidate-projection.js +70 -0
  68. package/package.json +3 -1
  69. package/scripts/sync-release-plugin.cjs +87 -0
@@ -0,0 +1,174 @@
1
+ import { posix } from "node:path";
2
+ import { parseYAML } from "../schema/yaml-parser.js";
3
+ const KNOWN_FRONTMATTER_KEYS = new Set([
4
+ "name",
5
+ "description",
6
+ "license",
7
+ "allowed-tools",
8
+ "argument-hint",
9
+ "disable-model-invocation",
10
+ "user-invocable",
11
+ "compatibility",
12
+ "metadata",
13
+ ]);
14
+ function asRecord(value) {
15
+ return value !== null && typeof value === "object" && !Array.isArray(value)
16
+ ? value
17
+ : {};
18
+ }
19
+ function normalizedResource(value) {
20
+ const withoutTitle = value.trim().replace(/^<|>$/g, "").split(/\s+["']/)[0];
21
+ const withoutSuffix = withoutTitle.split(/[?#]/, 1)[0];
22
+ return posix.normalize(withoutSuffix.replace(/^\.\//, "").replaceAll("\\", "/"));
23
+ }
24
+ function evidence(path, startLine, endLine = startLine) {
25
+ return { path, start_line: startLine, end_line: endLine };
26
+ }
27
+ function loss(code, message, path, startLine, endLine = startLine) {
28
+ return { code, message, evidence: evidence(path, startLine, endLine) };
29
+ }
30
+ export function parseSkillMarkdown(markdown, options = {}) {
31
+ const sourcePath = options.sourcePath ?? "SKILL.md";
32
+ const lines = markdown.split(/\r?\n/);
33
+ let frontmatterStart = -1;
34
+ let frontmatterEnd = -1;
35
+ if (lines[0]?.trim() === "---") {
36
+ frontmatterStart = 0;
37
+ frontmatterEnd = lines.findIndex((line, index) => index > 0 && line.trim() === "---");
38
+ }
39
+ const rawFrontmatter = frontmatterEnd > frontmatterStart
40
+ ? lines.slice(frontmatterStart + 1, frontmatterEnd).join("\n")
41
+ : "";
42
+ const parsedFrontmatter = rawFrontmatter ? asRecord(parseYAML(rawFrontmatter)) : {};
43
+ const known = {};
44
+ const unknown = {};
45
+ const items = [];
46
+ const keyLines = new Map();
47
+ if (rawFrontmatter) {
48
+ lines.slice(frontmatterStart + 1, frontmatterEnd).forEach((line, index) => {
49
+ const match = /^([A-Za-z0-9_.-]+)\s*:/.exec(line);
50
+ if (match)
51
+ keyLines.set(match[1], frontmatterStart + index + 2);
52
+ });
53
+ }
54
+ for (const [key, value] of Object.entries(parsedFrontmatter)) {
55
+ if (KNOWN_FRONTMATTER_KEYS.has(key)) {
56
+ known[key] = value;
57
+ }
58
+ else {
59
+ unknown[key] = value;
60
+ const line = keyLines.get(key) ?? Math.max(1, frontmatterStart + 2);
61
+ items.push(loss("unknown_frontmatter_key", `Frontmatter key '${key}' is preserved but has no deterministic source mapping.`, sourcePath, line));
62
+ }
63
+ }
64
+ if (rawFrontmatter) {
65
+ lines.slice(frontmatterStart + 1, frontmatterEnd).forEach((line, index) => {
66
+ if (/(?:^|[\s:[{,])(?:&|\*)[A-Za-z0-9_-]+/.test(line)
67
+ || /^\s*(?:<<:|\?|![^\s]+)/.test(line)) {
68
+ const absoluteLine = frontmatterStart + index + 2;
69
+ items.push(loss("unsupported_yaml_construct", "YAML anchors, aliases, tags, merge keys, and complex keys are not interpreted.", sourcePath, absoluteLine));
70
+ }
71
+ });
72
+ }
73
+ const bodyStart = frontmatterEnd >= 0 ? frontmatterEnd + 1 : 0;
74
+ const bodyLines = lines.slice(bodyStart);
75
+ const body = bodyLines.join("\n");
76
+ const bodyBlocks = [];
77
+ const unclassifiedBlocks = [];
78
+ let current;
79
+ let unclassifiedStart;
80
+ let unclassifiedLines = [];
81
+ function flushCurrent(endLine) {
82
+ if (!current)
83
+ return;
84
+ bodyBlocks.push({
85
+ heading: current.heading,
86
+ level: current.level,
87
+ content: current.lines.join("\n").trim(),
88
+ evidence: evidence(sourcePath, current.start, Math.max(current.start, endLine)),
89
+ });
90
+ current = undefined;
91
+ }
92
+ function flushUnclassified(endLine) {
93
+ const content = unclassifiedLines.join("\n").trim();
94
+ if (content && unclassifiedStart !== undefined) {
95
+ unclassifiedBlocks.push(content);
96
+ items.push(loss("unclassified_body_block", "Body text outside a classified section is preserved for external-agent review.", sourcePath, unclassifiedStart, Math.max(unclassifiedStart, endLine)));
97
+ }
98
+ unclassifiedLines = [];
99
+ unclassifiedStart = undefined;
100
+ }
101
+ bodyLines.forEach((line, index) => {
102
+ const absoluteLine = bodyStart + index + 1;
103
+ const heading = /^(#{1,6})\s+(.+?)\s*$/.exec(line);
104
+ if (heading) {
105
+ flushUnclassified(absoluteLine - 1);
106
+ flushCurrent(absoluteLine - 1);
107
+ if (heading[1].length >= 2) {
108
+ current = {
109
+ heading: heading[2],
110
+ level: heading[1].length,
111
+ start: absoluteLine,
112
+ lines: [],
113
+ };
114
+ }
115
+ return;
116
+ }
117
+ if (current) {
118
+ current.lines.push(line);
119
+ }
120
+ else if (line.trim()) {
121
+ unclassifiedStart ??= absoluteLine;
122
+ unclassifiedLines.push(line);
123
+ }
124
+ else if (unclassifiedLines.length > 0) {
125
+ unclassifiedLines.push(line);
126
+ }
127
+ });
128
+ flushUnclassified(lines.length);
129
+ flushCurrent(lines.length);
130
+ const available = new Set((options.availableResources ?? []).map((resource) => normalizedResource(typeof resource === "string" ? resource : resource.relative_path)));
131
+ const resourceReferences = [];
132
+ bodyLines.forEach((line, index) => {
133
+ const absoluteLine = bodyStart + index + 1;
134
+ const linkPattern = /!?\[[^\]]*\]\(([^)]+)\)/g;
135
+ for (const match of line.matchAll(linkPattern)) {
136
+ const rawTarget = match[1].trim();
137
+ if (/^(?:https?:|mailto:|#)/i.test(rawTarget))
138
+ continue;
139
+ const relativePath = normalizedResource(rawTarget);
140
+ const isAvailable = available.has(relativePath);
141
+ resourceReferences.push({
142
+ relative_path: relativePath,
143
+ available: isAvailable,
144
+ evidence: evidence(sourcePath, absoluteLine),
145
+ });
146
+ if (!isAvailable) {
147
+ items.push(loss("missing_resource", `Referenced local resource '${relativePath}' is absent from the source manifest.`, sourcePath, absoluteLine));
148
+ }
149
+ }
150
+ if (/\b(?:tmux|screen|docker|kubectl|systemctl)\b|`(?:bash|sh|node|python|npm|npx|curl|git)\b/i.test(line)) {
151
+ items.push(loss("runtime_only_command", "Runtime command semantics are evidence only and are not executed by deterministic extraction.", sourcePath, absoluteLine));
152
+ }
153
+ if (/\b(?:tmux|screen|session|daemon|background|resume|checkpoint|persist(?:ed|ence)?|stateful)\b/i.test(line)) {
154
+ items.push(loss("omitted_state_semantics", "State or lifecycle semantics require explicit modeling by the external authoring agent.", sourcePath, absoluteLine));
155
+ }
156
+ });
157
+ items.sort((left, right) => left.evidence.start_line - right.evidence.start_line
158
+ || left.code.localeCompare(right.code)
159
+ || left.message.localeCompare(right.message));
160
+ resourceReferences.sort((left, right) => left.relative_path.localeCompare(right.relative_path)
161
+ || left.evidence.start_line - right.evidence.start_line);
162
+ return {
163
+ schema_version: "intentdna.skill_markdown.v1",
164
+ frontmatter: { ...known, known, unknown },
165
+ body,
166
+ body_blocks: bodyBlocks,
167
+ unclassified_blocks: unclassifiedBlocks,
168
+ resource_references: resourceReferences,
169
+ loss_report: {
170
+ schema_version: "intentdna.source_loss_report.v1",
171
+ items,
172
+ },
173
+ };
174
+ }
@@ -0,0 +1,125 @@
1
+ import type { AuthoringPacket } from "../workflow/authoring-packet.js";
2
+ export type SourceFamily = "codex" | "agents" | "claude" | "omc" | "custom";
3
+ export type SourceScope = "user" | "project" | "plugin_cache" | "custom";
4
+ export interface DiscoveredSkillSource {
5
+ source_id: string;
6
+ source_family: SourceFamily;
7
+ scope: SourceScope;
8
+ name: string;
9
+ source_root: string;
10
+ skill_dir: string;
11
+ skill_markdown_path: string;
12
+ }
13
+ export interface SourceManifestFile {
14
+ relative_path: string;
15
+ size_bytes: number;
16
+ sha256: string;
17
+ source_root: string;
18
+ }
19
+ export interface SourceManifest {
20
+ schema_version: "intentdna.source_manifest.v1";
21
+ source_root: string;
22
+ source_hash: string;
23
+ files: SourceManifestFile[];
24
+ }
25
+ export interface SourceSnapshot {
26
+ schema_version: "intentdna.source_snapshot.v1";
27
+ source_id: string;
28
+ source_root: string;
29
+ generated_at: string;
30
+ source_hash: string;
31
+ files: SourceManifestFile[];
32
+ }
33
+ export interface SourceSnapshotDiff {
34
+ schema_version: "intentdna.source_snapshot_diff.v1";
35
+ source_id: string;
36
+ before_hash: string;
37
+ after_hash: string;
38
+ added: SourceManifestFile[];
39
+ changed: SourceManifestFile[];
40
+ removed: SourceManifestFile[];
41
+ lineage_invalidated: boolean;
42
+ }
43
+ export type SourceLicensePosture = "attribution_required" | "reference_only";
44
+ export interface SourceLicense {
45
+ schema_version: "intentdna.source_license.v1";
46
+ spdx_id: string;
47
+ posture: SourceLicensePosture;
48
+ attribution?: string;
49
+ evidence_path?: string;
50
+ }
51
+ export interface SourceEvidenceSpan {
52
+ path: string;
53
+ start_line: number;
54
+ end_line: number;
55
+ }
56
+ export type SourceLossCode = "unknown_frontmatter_key" | "unsupported_yaml_construct" | "unclassified_body_block" | "missing_resource" | "runtime_only_command" | "omitted_state_semantics";
57
+ export interface SourceLossItem {
58
+ code: SourceLossCode;
59
+ message: string;
60
+ evidence: SourceEvidenceSpan;
61
+ }
62
+ export interface SourceLossReport {
63
+ schema_version: "intentdna.source_loss_report.v1";
64
+ items: SourceLossItem[];
65
+ }
66
+ export interface ParsedSkillFrontmatter {
67
+ [key: string]: unknown;
68
+ known: Record<string, unknown>;
69
+ unknown: Record<string, unknown>;
70
+ }
71
+ export interface ParsedSkillBodyBlock {
72
+ heading: string;
73
+ level: number;
74
+ content: string;
75
+ evidence: SourceEvidenceSpan;
76
+ }
77
+ export interface ParsedSkillResourceReference {
78
+ relative_path: string;
79
+ available: boolean;
80
+ evidence: SourceEvidenceSpan;
81
+ }
82
+ export interface ParsedSkillMarkdown {
83
+ schema_version: "intentdna.skill_markdown.v1";
84
+ frontmatter: ParsedSkillFrontmatter;
85
+ body: string;
86
+ body_blocks: ParsedSkillBodyBlock[];
87
+ unclassified_blocks: string[];
88
+ resource_references: ParsedSkillResourceReference[];
89
+ loss_report: SourceLossReport;
90
+ }
91
+ export interface SourcePacketResource extends SourceManifestFile {
92
+ redistribution: SourceLicensePosture;
93
+ inlined: false;
94
+ }
95
+ export interface SourceAuthoringPacket {
96
+ schema_version: "intentdna.source_authoring_packet.v1";
97
+ generated_at: string;
98
+ network_performed: false;
99
+ mutation_performed: false;
100
+ runtime_authority: false;
101
+ source: {
102
+ source_id: string;
103
+ name: string;
104
+ source_root: string;
105
+ skill_markdown_path: string;
106
+ source_hash: string;
107
+ };
108
+ manifest: SourceManifest;
109
+ license: SourceLicense;
110
+ frontmatter: ParsedSkillFrontmatter;
111
+ body: string;
112
+ body_blocks: ParsedSkillBodyBlock[];
113
+ unclassified_blocks: string[];
114
+ resource_references: ParsedSkillResourceReference[];
115
+ resources: SourcePacketResource[];
116
+ loss_report: SourceLossReport;
117
+ authoring: {
118
+ owner: "external_agent";
119
+ candidate_path: string;
120
+ writes_performed: false;
121
+ instructions: string[];
122
+ };
123
+ authoring_contract: AuthoringPacket;
124
+ boundaries: string[];
125
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,192 @@
1
+ version: "0.1.0"
2
+ id: template_asset_refinery
3
+ name: Asset Refinery
4
+ namespace: arf
5
+ purpose: Turn one deterministic source packet into a reviewable workflow candidate and retry once from exact validation diagnostics.
6
+ maturity: reviewed
7
+ fit:
8
+ - Turning an intentdna.source_authoring_packet.v1 artifact into a reviewable workflow candidate.
9
+ not_for:
10
+ - Promoting candidates or writing project template catalog entries.
11
+ - Automatic adoption, organization binding, sync, deployment, or runtime policy mutation.
12
+ inputs:
13
+ - source authoring packet under .dna/authoring
14
+ - safe candidate name
15
+ outputs:
16
+ - source-backed candidate under .dna/authoring
17
+ - deterministic dna validate diagnostics
18
+ - bounded run evidence under .dna/authoring
19
+ boundaries:
20
+ - Read source evidence from {{source_packet}} and write candidate, diagnostics, and run evidence only under .dna/authoring.
21
+ - Preserve the packet, invalid candidate, exact diagnostics, and run evidence when validation still fails after one retry.
22
+ - Never promote a candidate or write under .dna/templates.
23
+ lineage:
24
+ source: Recovered IntentDNA Asset Refinery with OMX and OMC source contracts
25
+ reference: docs/upstream/workflow-reuse-ledger.json
26
+ type: project
27
+
28
+ cascade:
29
+ inherits: ["species:default"]
30
+ priority: 100
31
+
32
+ verifier_policy:
33
+ allow_command_prefixes:
34
+ - "dna validate "
35
+
36
+ variables:
37
+ source_packet:
38
+ description: "Project-relative path to an intentdna.source_authoring_packet.v1 JSON artifact under .dna/authoring."
39
+ default: ".dna/authoring/source-packet.json"
40
+ candidate_name:
41
+ description: "Safe lowercase candidate basename without extensions."
42
+ default: "source"
43
+ candidate_path:
44
+ description: "Project-relative candidate staging path under .dna/authoring."
45
+ default: ".dna/authoring/source.candidate.dna.yaml"
46
+
47
+ genes:
48
+ source_evidence_only:
49
+ description: Source packet content is evidence for external-agent authoring, not policy truth.
50
+ codons:
51
+ - type: attract
52
+ target: source_packet_fidelity
53
+ - type: repel
54
+ target: inferred_source_semantics
55
+
56
+ authoring_only_containment:
57
+ description: The refinery may preserve authoring evidence but may not promote or mutate template assets.
58
+ codons:
59
+ - type: attract
60
+ target: authoring_artifact_preservation
61
+ - type: repel
62
+ target: template_catalog_write
63
+ - type: threshold
64
+ condition: "all_refinery_writes_under_authoring == true"
65
+ action: block
66
+
67
+ contexts: {}
68
+
69
+ roles:
70
+ source_reader:
71
+ description: Checks one exact source authoring packet without mutation.
72
+ tool_permissions:
73
+ allow: [Read]
74
+ deny: [Write, Edit, Bash, Grep, Glob, NotebookEdit]
75
+ scope:
76
+ read: [".dna/authoring/**"]
77
+ write: []
78
+ instructions:
79
+ - Read only {{source_packet}} and require schema_version intentdna.source_authoring_packet.v1.
80
+ - Preserve source hashes, loss items, resource restrictions, license posture, and authoring boundaries as evidence.
81
+ - Stop after reporting whether the packet is usable.
82
+
83
+ candidate_author:
84
+ description: Authors or minimally revises one staged candidate from packet evidence and validation diagnostics.
85
+ tool_permissions:
86
+ allow: [Read, Write, Edit]
87
+ deny: [Bash, Grep, Glob, NotebookEdit]
88
+ scope:
89
+ read: [".dna/authoring/**", "src/templates/**"]
90
+ write: [".dna/authoring/**"]
91
+ instructions:
92
+ - Read {{source_packet}} directly and write or revise only {{candidate_path}}.
93
+ - Preserve source lineage, explicit loss, license posture, and unsupported semantics.
94
+ - On the single retry, change only what exact dna validate diagnostics require.
95
+ - Never write under .dna/templates or promote, adopt, bind, sync, or deploy the candidate.
96
+
97
+ deterministic_validator:
98
+ description: Runs one allowed dna validate command and records exact evidence without rewriting the candidate.
99
+ tool_permissions:
100
+ allow: [Read, Write, Bash]
101
+ deny: [Edit, Grep, Glob, NotebookEdit]
102
+ scope:
103
+ read: [".dna/authoring/**", "src/**", "dist/**"]
104
+ write: [".dna/authoring/**"]
105
+ instructions:
106
+ - Run dna validate "{{candidate_path}}" exactly once per round.
107
+ - Preserve the exact command, exit code, and diagnostics in .dna/authoring/asset-refinery.diagnostics.txt.
108
+ - Preserve packet path, candidate path, candidate hash, validation result, round, and failure state in .dna/authoring/asset-refinery.run-evidence.json.
109
+ - On final failure, leave all packet, candidate, diagnostics, and run evidence files in place for review.
110
+ - Never write under .dna/templates or promote the candidate.
111
+
112
+ workflows:
113
+ asset-refinery:
114
+ name: Asset Refinery
115
+ description: Read one source packet, author one candidate, and retry once from deterministic validation diagnostics.
116
+ steps:
117
+ - id: read-source-packet
118
+ role: source_reader
119
+ description: Verify the exact source authoring packet exists and preserves its evidence boundary.
120
+ prompt: |
121
+ Read only {{source_packet}} and require schema_version
122
+ intentdna.source_authoring_packet.v1. Report the source hash, manifest,
123
+ license posture, loss items, resource restrictions, and authoring
124
+ boundary without inventing semantics.
125
+ completion:
126
+ - file_exists: "{{source_packet}}"
127
+
128
+ - id: author-candidate
129
+ role: candidate_author
130
+ depends_on: [read-source-packet]
131
+ description: Author or minimally revise the staged workflow candidate.
132
+ prompt: |
133
+ Read {{source_packet}} directly; do not glob, search, or infer a
134
+ different packet path. Author {{candidate_path}} from that packet
135
+ evidence and its authoring contract. If exact diagnostics from a prior
136
+ round exist, make only the smallest correction they require. Keep all
137
+ writes under .dna/authoring and never write .dna/templates.
138
+ completion:
139
+ - file_exists: "{{candidate_path}}"
140
+ handoff:
141
+ produces:
142
+ - type: file
143
+ name: candidate_artifact
144
+ path: "{{candidate_path}}"
145
+ description: Candidate preserved for validation or failure review.
146
+
147
+ - id: validate-candidate
148
+ role: deterministic_validator
149
+ depends_on: [author-candidate]
150
+ description: Run deterministic validation and preserve exact success or failure evidence.
151
+ prompt: |
152
+ Run dna validate "{{candidate_path}}" directly; do not run pwd, git,
153
+ glob, or any other command. Record the exact command, exit code, and
154
+ diagnostics in .dna/authoring/asset-refinery.diagnostics.txt. Record
155
+ packet path, candidate path, candidate hash, round, validation result,
156
+ and failure state in
157
+ .dna/authoring/asset-refinery.run-evidence.json. Return failure only
158
+ when dna validate exits nonzero; do not edit or promote the candidate.
159
+ completion:
160
+ - file_exists: ".dna/authoring/asset-refinery.diagnostics.txt"
161
+ - file_exists: ".dna/authoring/asset-refinery.run-evidence.json"
162
+ checkpoints:
163
+ - assert: candidate_deterministically_valid
164
+ command: "dna validate \".dna/authoring/{{candidate_name}}.candidate.dna.yaml\""
165
+ message: "Candidate remains under .dna/authoring with diagnostics and run evidence when validation fails."
166
+ action: block
167
+ handoff:
168
+ consumes:
169
+ - type: file
170
+ name: candidate_artifact
171
+ path: "{{candidate_path}}"
172
+ from: author-candidate
173
+ description: Exact staged candidate to validate without rewriting.
174
+ produces:
175
+ - type: test_result
176
+ name: validation_diagnostics
177
+ description: Exact dna validate command, exit code, and diagnostics.
178
+ - type: file
179
+ name: refinery_run_evidence
180
+ path: ".dna/authoring/asset-refinery.run-evidence.json"
181
+ description: Run evidence preserved on success or final failure.
182
+ transitions:
183
+ - from: author-candidate
184
+ to: author-candidate
185
+ condition: fail
186
+ - from: validate-candidate
187
+ to: author-candidate
188
+ condition: fail
189
+ retry_policy:
190
+ max_retries: 1
191
+ retry_from: author-candidate
192
+ backoff: none
@@ -32,6 +32,23 @@ cascade:
32
32
  inherits: ["species:default"]
33
33
  priority: 100
34
34
 
35
+ variables:
36
+ module:
37
+ description: "Target module or route"
38
+ default: "$ARGUMENTS"
39
+ v1_path:
40
+ description: "v1 source root"
41
+ default: "common/lib"
42
+ v2_path:
43
+ description: "v2 package root"
44
+ default: "v2/packages"
45
+ output_path:
46
+ description: "Behavior document output directory"
47
+ default: "docs/behavior"
48
+ test_path:
49
+ description: "Behavior test output directory"
50
+ default: "test/behavior"
51
+
35
52
  genes:
36
53
  scan_not_change:
37
54
  description: This workflow only reads v1 and writes docs/tests — never modifies app code
@@ -32,6 +32,17 @@ cascade:
32
32
  inherits: ["species:default"]
33
33
  priority: 100
34
34
 
35
+ variables:
36
+ feature:
37
+ description: "Target feature chain"
38
+ default: "$ARGUMENTS"
39
+ v1_path:
40
+ description: "v1 source root"
41
+ default: "common/lib"
42
+ v2_path:
43
+ description: "v2 package root"
44
+ default: "v2/packages"
45
+
35
46
  genes:
36
47
  one_chain_at_a_time:
37
48
  description: Each session fixes exactly one functional chain (e.g. "send message → receive reply")