This guide walks you through setting up STAN in an existing repository and using it effectively in chat.
Related guides:
Install the STAN CLI globally (pick one):
npm i -g @karmaniverous/stan-cli
# or
pnpm add -g @karmaniverous/stan-cli
# or
yarn global add @karmaniverous/stan-cli
From your repository root:
stan init
What this does:
stan.config.yml with sensible defaults..gitignore entries for .stan/{output,diff,dist,patch,imports} in .gitignore.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.Migration and safety notes:
stan init migrates to the namespaced layout, writes a .bak next to your config, and supports a plan‑only mode via --dry-run.You can re-run stan init safely. Use --force to accept defaults; otherwise you’ll be prompted.
Minimal example:
stan-core:
stanPath: .stan
includes: []
excludes: []
stan-cli:
scripts:
build: npm run build
lint: npm run lint
test: npm run test
typecheck: npm run typecheck
Key settings:
stan-core.stanPath (default .stan): STAN workspace folder.stan-cli.scripts: commands whose combined stdout/stderr become deterministic text outputs (e.g., test.txt).stan-core.includes / stan-core.excludes: glob controls for archiving (binaries are excluded automatically by the engine).stan-cli):
maxUndos (history depth for snapshot undo/redo; default 10).patchOpenCommand (editor open command; default code -g {file}).cliDefaults (config-driven CLI defaults; see CLI Usage & Examples).See Stan Configuration for the complete schema and examples.
Build and snapshot:
stan run
This:
.stan/output/*.txt..stan/output/archive.tar and .stan/output/archive.diff.tar.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 that into chat to get a corrected diff.
Tips:
stan run automatically prefixes the child process PATH with <repoRoot>/node_modules/.bin (and ancestor .bin folders) so repo‑local binaries resolve without global installs.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 depends on the presence of its bootloader system prompt to load .stan/system/stan.system.md from your attached archives. While it can be used in the GPT web app, the most reliable setup is a dedicated client with the bootloader preinstalled.
See: Bootloader & Assistant Setup
TypingMind one‑click setup (recommended; requires an OpenAI API key with GPT‑5 access):
.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.”).Other clients
handoff; paste the handoff at the top of a new thread along with your latest full archive.archive.diff.tar), not the full archive.*** Begin/End Patch ***), especially with very large archives (>800k). Back up and remind the assistant to provide a plain, valid unified diff (git‑style headers, no wrappers).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.Next: The STAN Loop and Archives & Snapshots.