This guide walks you through setting up STAN in an existing repository and using it effectively in chat.
Install the STAN CLI globally (pick one):
npm i -g @karmaniverous/stan
# or
pnpm add -g @karmaniverous/stan
# or
yarn global add @karmaniverous/stan
From your repository root:
stan init
What this does:
stan.config.yml with sensible defaults..gitignore entries for .stan/output/, .stan/diff/, .stan/dist/, and .stan/patch/..stan/system/ and creates required directories. The project prompt (.stan/system/stan.project.md) is created on demand by STAN when repo‑specific requirements emerge (no template is installed)..stan/diff/.archive.snapshot.json.You can re-run stan init safely. Use --force to accept defaults; otherwise you’ll be prompted.
Minimal example:
stanPath: .stan
includes: []
excludes: []
scripts:
build: npm run stan:build
lint: npm run lint
test: npm run test
typecheck: npm run typecheck
Key settings:
stanPath (default .stan): STAN workspace folder.scripts: commands whose combined stdout/stderr become deterministic text outputs (e.g., test.txt).includes/excludes: glob controls for archiving; text files are included, binaries automatically excluded.maxUndos (history depth for snapshot undo/redo; default 10).patchOpenCommand (editor open command; default "code -g {file}").Build and snapshot:
stan run
This:
.stan/output/*.txt..stan/output/archive.tar (full snapshot of text files) and .stan/output/archive.diff.tar (changed files).To update the baseline snapshot without writing archives:
stan snap
Patch iterations:
stan patch # read unified diff from clipboard
stan patch --check # validate only (writes to sandbox)
stan patch -f fix.patch # read from a file
On failure, STAN writes a compact FEEDBACK packet and (when possible) copies it to your clipboard—paste it into chat to get a corrected diff.
Tips:
stan run -p to print the plan and exit; use stan run -P to execute without printing the plan first.-q for sequential execution (preserves -s order).-c to include outputs inside archives and remove them from disk (combine mode).STAN ships a small “bootloader” system prompt that reliably loads your attached system prompt from archives:
How to use with a third‑party client (TypingMind example):
.stan/output/archive.tar (and archive.diff.tar if present). The bootloader will locate and load .stan/system/stan.system.md from the archive automatically..stan/system/stan.todo.md and propose next steps.”).Notes:
.stan/system/stan.system.md cannot be found. Attachments are the source of truth.stan init successfully created config and docs.stan run produced text outputs and archive.tar/archive.diff.tar.stan.system.md.stan patch --check before applying)..stan/system/stan.system.md (or attach that file directly as stan.system.md).--check to validate; reply in chat with the FEEDBACK packet to receive a corrected diff.excludes to trim runtime noise from archives.