Summary
The recommended pattern for consuming an upstream node's output inside an inline script: body — shown in .claude/skills/archon/examples/dag-workflow.yaml and implicitly endorsed in references/parameter-matrix.md and references/workflow-dag.md — uses a String.raw template literal:
const raw = String.raw`$fetch-issue.output`;
const issue = JSON.parse(raw);
This pattern silently breaks the moment $fetch-issue.output contains a backtick, because any backtick in the substituted content terminates the template literal early. Subsequent JSON content is then parsed as JavaScript and produces cryptic Expected ";" errors.
How I hit it
While authoring the new maintainer-standup workflow, the synthesis node returned an output_format JSON payload whose brief_markdown field contained markdown code spans like `b286ad97` and `$nodeId.output`. The downstream persist inline script copied the example pattern verbatim. The whole node failed at script-load time:
4 | committed changes; pull skipped). Dev SHA: `b286ad97`.\n- Untracked files…
^
error: Expected ";" but found "b286ad97"
at /Users/rasmus/Projects/cole/Archon/[eval]:4:242
Diagnostic noise was very high — the entire 70KB+ script source got dumped into the error log (related to existing #1389).
Why this is brittle
output_format payloads, AI-generated text, and anything routed through a markdown body will routinely contain backticks. The current example only works because gh issue view --json happens to produce backtick-free JSON. Any workflow that takes the example at face value and passes through realistic content will hit this.
Suggested fix
JSON is a strict subset of JavaScript expression syntax (object literals, double-quoted strings with JSON-compatible escape sequences, JSON numbers, true/false/null). The substituted output can be assigned directly without any wrapper:
const data = $fetch-issue.output; // already a valid JS object/array literal
This avoids the backtick hazard entirely, and removes the explicit JSON.parse step. Edge cases I checked:
- Backticks inside double-quoted JSON strings: literal characters in JS, no interpretation.
${...} inside double-quoted JSON strings: not interpolated in JS (only template literals interpolate).
- Newlines, Unicode escapes, JSON's six escape sequences (
\\\", \\\\, \\n, \\r, \\t, \\uXXXX): all are valid JS escape sequences with the same semantics.
Concrete changes proposed
- Update
.claude/skills/archon/examples/dag-workflow.yaml (the extract-labels node) to use the direct-assignment pattern, with a one-line comment explaining why it's safer than String.raw.
- Add a short note to
references/workflow-dag.md (Script Node section) and references/parameter-matrix.md (Silent failures section) calling out the backtick hazard with String.raw and recommending the direct-assignment idiom.
- Optionally also reflect this in
archon.diy/guides/script-nodes/.
Happy to send a PR if the approach is agreed.
Related
Summary
The recommended pattern for consuming an upstream node's output inside an inline
script:body — shown in.claude/skills/archon/examples/dag-workflow.yamland implicitly endorsed inreferences/parameter-matrix.mdandreferences/workflow-dag.md— uses aString.rawtemplate literal:This pattern silently breaks the moment
$fetch-issue.outputcontains a backtick, because any backtick in the substituted content terminates the template literal early. Subsequent JSON content is then parsed as JavaScript and produces crypticExpected ";"errors.How I hit it
While authoring the new
maintainer-standupworkflow, the synthesis node returned anoutput_formatJSON payload whosebrief_markdownfield contained markdown code spans like`b286ad97`and`$nodeId.output`. The downstreampersistinline script copied the example pattern verbatim. The whole node failed at script-load time:Diagnostic noise was very high — the entire 70KB+ script source got dumped into the error log (related to existing #1389).
Why this is brittle
output_formatpayloads, AI-generated text, and anything routed through a markdown body will routinely contain backticks. The current example only works becausegh issue view --jsonhappens to produce backtick-free JSON. Any workflow that takes the example at face value and passes through realistic content will hit this.Suggested fix
JSON is a strict subset of JavaScript expression syntax (object literals, double-quoted strings with JSON-compatible escape sequences, JSON numbers,
true/false/null). The substituted output can be assigned directly without any wrapper:This avoids the backtick hazard entirely, and removes the explicit
JSON.parsestep. Edge cases I checked:${...}inside double-quoted JSON strings: not interpolated in JS (only template literals interpolate).\\\",\\\\,\\n,\\r,\\t,\\uXXXX): all are valid JS escape sequences with the same semantics.Concrete changes proposed
.claude/skills/archon/examples/dag-workflow.yaml(theextract-labelsnode) to use the direct-assignment pattern, with a one-line comment explaining why it's safer thanString.raw.references/workflow-dag.md(Script Node section) andreferences/parameter-matrix.md(Silent failures section) calling out the backtick hazard withString.rawand recommending the direct-assignment idiom.archon.diy/guides/script-nodes/.Happy to send a PR if the approach is agreed.
Related