loom-code
The loomflow-native terminal coding agent. Open your project, type
what you want, and a loomflow Agent plans, edits, runs, and verifies
— with every destructive step gated behind an approval prompt and the
model’s entire context visible on demand. loom-code is deliberately
thin: the agent loop, tools, planning, and memory are all
loomflow. If you’ve read the rest of these docs, you already
understand how it works inside.
› make all the tests in tests/test_parser.py pass
● loom
Two tests were failing on the new date format. I updated parse_date()
to accept ISO-8601 offsets and added a regression case. 8/8 passing.
───────────────────────────── 41,882 in · 1,204 out · $0.0179 · 12% ctxSource: github.com/Anurich/loomflow-cli (MIT).
Install
pipx (recommended)
pipx install loom-codepipx keeps CLI tools in their own venvs — the standard for Python
CLIs. No pipx? brew install pipx (macOS) or
python -m pip install --user pipx.
Requires Python 3.11+. Updating later: pipx upgrade loom-code.
Two minutes to first task
Start it in your project
cd ~/your-project
loom-codeIt walks up to find .git and roots itself there.
Pick a model — /set_model
Arrow-key menus walk you through provider → API key → model. The key is asked for first and saved, so this is a one-time setup.
No paid key? Pick NVIDIA — free tier at
build.nvidia.com . Good scaffolding helps
cheap models most, so a free model in loom-code goes a long way;
deepseek-v4-pro and nemotron-super-49b handle tool-heavy work
well.
Type what you want
› fix the failing test in tests/test_auth.py
› add a /users endpoint with pagination
› why is startup slow? profile itEvery response closes with that turn’s tokens, cost, and context occupancy. Writes and shell commands show a diff / preview and wait for your approval.
One-shot mode does a task and exits — useful for scripts and CI:
loom-code "add a retry decorator to the http client"
loom-code --yes "scaffold a FastAPI backend" # skip approvals
loom-code --output-format json "list the modules" # machine-readableThe interface
loom-code runs a full-screen chat UI: the conversation scrolls in
a pane and the input box stays pinned at the bottom, growing as you
type. Enter sends, Alt+Enter adds a newline, / pops the command
menu. Scroll history with the mouse wheel, PageUp/PageDown, or
Ctrl-Up/Down — End jumps back to live. --classic gives you a plain
inline prompt instead; piped/non-TTY use falls back automatically.
Steer it while it works
The input box stays live during a turn. Type guidance and press Enter
and it’s injected into the running turn before the model’s next
step — tagged steering ↳ in the conversation so it reads as
guidance, not a queued question:
› run the test suite and fix whatever fails
● Run pytest -q ⏳ working…
› skip the flaky websocket tests, focus on the parser steering ↳Press Esc to interrupt the turn entirely — context is kept, so
you can redirect with your next message. (Steering rides loomflow’s
_loom_steering metadata queue: the ReAct loop drains it before every
model call.)
Paste or drop images
Ctrl-V grabs an image straight off your clipboard (screenshots!),
and drag-and-drop works too — drop an image file onto the
terminal and its path is auto-attached. Either way an [image-N]
placeholder lands in the box and the image rides to the model with
your next message.
Vision needs a vision-capable model (Claude, GPT-4.1, …). On a text-only model, loom-code warns you at attach time — providers silently drop image parts for text-only models and the model will otherwise confidently describe an image it never saw.
How it thinks
loom-code is a single loomflow Team.supervisor. A read-only
coordinator talks to you and delegates writes and shell to a coder
worker; specialist sub-agents (explore for read-only investigation,
review for independent verification) are invoked as tools when they
earn their keep. Every task gets a living plan (loomflow’s
plan_write/plan_read — the TodoWrite equivalent), and a StopHook
auto-continue loop keeps the agent working until the plan is done,
bounded by a configurable cap.
Safety & permissions
The permission layer is the boundary, not the working directory (the Claude-Code model):
- Reads anywhere are allowed; writes outside the project are
only possible for files you referenced, and always show a diff
prompt — in every mode, even
--yes. - Approval modes (
/mode):defaultasks for writes and shell;accept-editsauto-approves in-project edits;planis read-only;yoloapproves everything except your deny rules. - “Don’t ask again” is scoped to what you approved: waiving the
prompt at a write covers future edits only — bash still asks; at a
bash prompt it covers only that leading binary (
python …approved once never silences a laterrm). The label names the exact scope. - Rules live in
.loom/settings.toml— glob-basedallow/ask/denyper tool (e.g.deny = ["edit(*.env)", "bash(rm -rf *)"]). Deny always wins, even in yolo.bash_backgroundshares the exact bash rules. - Sandbox:
--sandboxruns bash under OS-level isolation (writes limited to the repo, network off unless--sandbox-allow-network). - Irreversible commands (
git push --force,rm -rf, …) always get an explicit prompt.
Context you can see
Most harnesses inject content the model reads but you never see, and compact silently. loom-code shows everything:
/context— the model’s window, tokens used, an occupancy bar, where compaction fires, and every injected working block (repo map, learned notes, project rules, session summary) with its size./prompt— dumps the coordinator’s full system prompt plus every working block, verbatim. Every byte the model reads.- A
N% ctxfigure on every turn’s summary line — you always know how close you are to compaction. - Compaction reports before → after token counts. Never silent.
Recovering & branching
Coding agents don’t win by making fewer mistakes — they win by recovering from them.
- Auto-checkpoints before every edit;
/undorestores the working tree;/checkpointslists them. /isolateruns the session in its own git worktree —/reviewthe diff, then/mergeor/discard./forkbranches the session at the current point (full history inherited, the parent untouched) so you can chase a tangent without polluting the main thread;/treeshows the whole session graph;/resumepicks up any prior session.
Staying on track
- Verify-before-done (
/verify): a turn that edits code and claims completion without running the project’s tests gets one nudge to run them (the test command is detected, never guessed). - Loop guard: re-editing one file or re-running a failing command
triggers steering to change approach; a
command not foundgets a PATH/install hint. - Post-edit diagnostics: after each edit, a cheap per-file syntax/lint check (ruff, node —check, gofmt, bash -n …) surfaces breakage inline, in the same turn.
Gets sharper at your repo
A per-project notebook plus episode memory (.loom/):
notes the agent used get credited when a turn goes well, so future
runs surface what worked. /good and /bad train it. Research
singles out long-term memory as one of the highest-value scaffold
components — and it’s built in.
Goal mode
/goal make all tests pass works until the condition is
verifiably met (a cheap checker model judges each pass), bounded by a
max-pass / no-progress / cost-cap trio. Goals are durable: they
persist to .loom/goal.json, so /goal resume continues an
unfinished goal even after a restart.
Extend it
Drop files into ~/.loom-code/ (global) or <repo>/.loom/ (project):
commands/<name>.md— a custom slash command. The body is a prompt template with$1–$9/$ARGUMENTS; it shows up in/helpand autocomplete.agents/<name>.md— a custom sub-agent (frontmattername+descriptionis the delegation contract; the body is its prompt).skills/<name>/SKILL.md— an Anthropic-format skill.settings.toml—[[hooks]]on eight lifecycle events (PreToolUse,PostToolUse,UserPromptSubmit,SessionStart,SessionEnd,Stop,PreCompact,PostCompact) withbackground = truefire-and-forget support andupdatedInputargument rewriting;[[mcp]]server declarations. Project-scope hooks are trust-gated on first run.
MCP servers connect out of the box — Linear, Sentry,
Postgres, Playwright, or any server; /mcp lists what’s live.
Models
| model string | provider | env key |
|---|---|---|
claude-opus-4-8, claude-sonnet-4-6, … | Anthropic | ANTHROPIC_API_KEY |
gpt-4.1, gpt-4.1-mini, o4-mini, … | OpenAI | OPENAI_API_KEY |
nvidia/… (Nemotron, Llama, DeepSeek) | NVIDIA NIM — free tier | NVIDIA_NIM_API_KEY |
ollama/llama3, ollama/qwen2.5-coder, … | local Ollama — free, offline | — |
litellm/<provider>/<model> | anything LiteLLM routes (Groq, Together, Azure, Bedrock, Vertex…) | provider’s own |
Switch anytime with /model <name> or the guided /set_model.
Reasoning models support /effort low|medium|high.
Command reference
Type / in the REPL — the menu autocompletes (custom commands
included).
Coding
/plan | show or start the living plan |
/goal <condition> | work until met — durable, /goal resume |
/verify on|off | verify-before-done gate |
/undo · /checkpoints | restore / list auto-checkpoints |
/good · /bad | credit / debit the agent’s notes |
/init-loom | create a starter AGENTS.md rules file |
Isolate
/isolate | run this session in its own git worktree |
/review · /merge · /discard | diff / merge / drop the isolated edits |
Model & tools
/model · /set_model | switch model / guided provider+key setup |
/effort · /mode | reasoning effort / approval mode |
/set_web | web search (Serper / DuckDuckGo) |
/mcp | list connected MCP servers |
Session
/context · /prompt | see the model’s context / dump the prompt |
/cost | session cost + token totals |
/fork · /tree | branch the session / show the tree |
/resume | pick up a prior session |
/compact · /compress_token_length | compact now / auto-threshold |
/export | save the conversation to markdown |
/clear · /help · /exit | fresh session / help / leave |
CLI flags
| flag | effect |
|---|---|
--model <name> | pick the model for this run |
--yes / -y | skip approval prompts (still honors deny rules) |
--sandbox | OS-isolate bash (writes limited to the repo) |
--sandbox-allow-network | allow network from sandboxed bash |
--output-format json | machine-readable one-shot output |
--continue / --resume | resume the last / a chosen session |
--classic | plain inline prompt instead of the full-screen chat UI |
Project context
loom-code reads LOOM.md / CLAUDE.md / AGENTS.md /
.loom/context.md at the project root and treats it as binding house
rules — the same convention as other agent CLIs, so an existing
CLAUDE.md works unchanged. /init-loom creates a starter file.
Relationship to loomflow
loom-code is a showcase of the framework as much as a product. The
REPL builds one loomflow Agent (a Team with a router, supervisor,
and specialists — see Architectures); memory
and /resume rehydration are loomflow Memory; the
tool kernel is loomflow’s built-in tools behind
loom-code’s permission gate. If a capability belongs in the agent
loop, it lands in loomflow — the CLI stays thin. Reading its
source is a good way to see
loomflow composed in anger.