| name | sra |
| description | Run the Stock Research Agent equity-research pipeline for a ticker via a Claude Code workflow. Use when asked to "run SRA", "research <TICKER>", or "generate an equity research report". |
Stock Research Agent (workflow runner)
Runs the full equity-research DAG (dags/sra.yaml) as an in-session workflow so all model work
uses the Max subscription, with the /workflows progress UI and sidecar-based resume.
Usage
/sra TICKER [--date YYYYMMDD] [--length short|standard|long]
Steps (in order)
-
Collect custom prompts. Ask: "Any custom investigation prompts for ? (specific
risks/segments — or 'none')." Collect as a list (empty if 'none').
-
Run prep (no model calls) via Bash from the repo root:
uv run python prepare_run.py <TICKER> [--date ...] [--length ...] --ask "<p1>" "<p2>" ...
stdout is the resolved DAG JSON. Note workdir.
-
Build the workflow script. The resolved DAG (~190 KB with prompts inline) is too large to
pass via args (string limit) or an agent echo (Read caps at ~25K tokens), so embed it as a
literal in the script. prepare_run.py already wrote it to <workdir>/.sra/dag.json. Assemble
<workdir>/sra_workflow.js via Bash (concatenation — do NOT hand-author the DAG):
WF=<workdir>/sra_workflow.js
cat > "$WF" <<'META'
export const meta = {
name: 'sra-<TICKER>',
description: 'Equity research pipeline for <TICKER>',
phases: [ {title:'Gather'},{title:'Index'},{title:'Research'},
{title:'Index research'},{title:'Write'},{title:'Assemble'} ],
}
META
printf 'const __SRA_DAG__ = ' >> "$WF"
cat <workdir>/.sra/dag.json >> "$WF"
printf ';\n' >> "$WF"
cat workflows/sra_interpreter.body.js >> "$WF"
The body reads the embedded __SRA_DAG__. (Total script stays < 512 KB.) Validate with
node --check against an async-wrapped copy if desired.
-
Launch. Call the Workflow tool with scriptPath: <workdir>/sra_workflow.js and no args
(the DAG is embedded). The interpreter uses __SRA_DAG__.
-
Report the returned {completed, incomplete, artifacts} and the final report location
under <workdir>/artifacts/.
Resume
Re-run the same command + --date. prepare_run.py reads .sra/tasks/*.json sidecars; the
interpreter skips completed tasks and rehydrates their artifacts/variables.