Getting started
Source:
docs/getting-started.md· repository commitdf39fcf
Go from installation to a running prompt chain, then open the same flow in the visual editor. You do not need to know chainq’s YAML format before starting.
1. Install chainq
Section titled “1. Install chainq”chainq needs Node.js 18 or newer. Install the CLI globally:
npm install -g @wahengchang2023/chainqCheck that the command is available:
chainq# usage: chainq init [dir] | chainq new <name> | chainq ui [flow.yaml] | ...Prefer not to install globally? Replace chainq in any example with
npx @wahengchang2023/chainq.
The starter flow uses the local claude -p CLI. Sign in once before the first
model run:
claude loginYou can use another local CLI model later by changing the flow’s profiles:.
2. Create a project
Section titled “2. Create a project”chainq init my-first-flowcd my-first-flowThe command creates:
my-first-flow/├── flow.yaml # the prompt chain; commit this├── input.txt # sample input read by the starter flow└── .gitignore # keeps .chain/ run data out of GitOne flow is one YAML file. flow.yaml starts with a cmd step that reads
input.txt, followed by an ai step that summarizes it.
3. Validate and run it
Section titled “3. Validate and run it”Validate the structure without calling the model:
chainq validate flow.yamlThen run the whole chain:
chainq run flow.yamlchainq shows a preflight before spending a model call, streams each step’s status to stderr, and prints the final leaf output to stdout.
plan: 1 ai call(s) · 0 reused · 0 skipped✓ load (1 item)✓ summarize (1 item)A plain run is fresh: every step runs again. Add --cache when iterating and
you want unchanged steps to reuse their previous outputs:
chainq run flow.yaml --cache4. Open the visual editor
Section titled “4. Open the visual editor”chainq ui flow.yamlThe editor opens on 127.0.0.1 using a random local port. The canvas and CLI
share the same engine and the same flow.yaml; there is no import or export
step. Run the flow, inspect each node’s real output, edit a prompt, then save or
reset the draft.
5. Know what to commit
Section titled “5. Know what to commit”my-first-flow/├── flow.yaml # commit├── input.txt # commit if it is safe project input└── .chain/ # do not commit ├── outputs/ # cached real outputs ├── scratch/ # isolated --pin trial runs ├── layout.json # visual canvas positions └── state.json # cache stateModel outputs can contain sensitive data. Review files before sharing them even
when they are already covered by .gitignore.
Next steps
Section titled “Next steps”- Learn the edit-and-cache loop in Tutorial: your first flow.
- Copy a focused recipe from the Common tasks.
- Look up every command, flag, node type, and YAML field in the CLI reference.
- Build flows in the browser with the visual editor guide.
- Diagnose common failures in Troubleshooting.
- Look up every YAML field in the flow YAML reference.