loopway runs on your machine and polls the collaboration tools your agents work in. For now that is GitHub: it prints every new issue and pull request by you, your bot or anyone a bot trusts, and every update to the ones it knows, and sorts them into threads, one bot plus the subjects it tracks. No webhooks, no server.
This is 2.0, an alpha. It started as a poller; threads are the second slice, and later ones grow it into a place that runs agents on what it finds. Design and plan: #486.
- A subject is an issue or a pull request, keyed
owner/repo#N. - Discovery, every 2 minutes: new issues and pull requests in your repos, authored by you, the bot user or a login a bot lists under
trusted. An older one, made before loopway was watching, is picked up the first time anyone touches it while it is open (a comment, an assignment, a reopen). An old closed one stays quiet until it is reopened. - Updates, every 30 seconds, for each known subject: comments, reviews, review comments, state changes (closed, merged, reopened), labels, assignees, edits, and CI on pull requests. CI wakes a thread only when a check finishes failing (
failure,timed_out,cancelled,action_required, or a status infailure/error), or once when every check and status on the head commit has finished (CI finished: 5 passed, 1 failed). Checks still running and checks that pass wake nothing. A new push starts over. - It backs off when GitHub rate limits it (
x-ratelimit-reset,retry-after).
To just use it, run curl -fsSL https://loopway.craftmill.dev/install.sh | sh (needs Node 22+ and npm). It installs the latest GitHub release with npm install -g; LOOPWAY_VERSION=2.0.0 picks another. Run it again to update. To work on loopway, use the checkout:
npm install && npm run build # Node 22+
gh auth login # loopway acts as whoever gh is logged in asAfter installing, run loopway setup (see Setup). Or install the latest release: npm install -g https://github.com/craftmilldev/loopway/releases/latest/download/loopway-cli.tgz.
Make a directory to run it from, with a .loopway/ folder holding one file per bot (scratch/ inside the checkout is git-ignored):
mkdir -p scratch/.loopway && cd scratch
cat > .loopway/dev.md <<'EOF'
---
repos: [owner/name]
on: issue
---
You are the dev bot. You take an issue, make the change and open a pull request.
EOF
cat > .loopway/review.md <<'EOF'
---
repos: [owner/name]
on: pull_request
---
You are the review bot. You read a pull request and review it.
EOF
node ../packages/cli/dist/index.js # runs `loopway` here (`npm run build` first)To run it from a directory outside the checkout, npm link -w @loopway/cli puts loopway on your PATH. The plain log (see The TUI) is one line per event:
2026-11-10 14:02 new owner/repo#12 issue "Fix the login bug" by mcwhittemore
2026-11-10 14:03 update owner/repo#12 comment by loopway-bot
2026-11-10 14:03 update owner/repo#12 labeled bug by mcwhittemore
loopway --json prints the same as NDJSON, one object per line. Stop it with Ctrl-C.
The first run starts now: it does not replay history. An issue or pull request from before that stays quiet until something happens to it; then, if it is open, it is reported as new, with only what happened since as updates, and its bots start threads. After that it remembers where it got to, so a restart prints nothing twice and picks up what happened while it was stopped.
loopway setup is an interactive walk through what loopway needs, in a terminal (it refuses to run without one). Each step checks first and only asks about what is missing, so it is safe to run again on a machine that is already set up: it never overwrites a file you have, and the steps that can be left out say so.
gh, required. It must be installed and logged in; if it isn't logged in, setup offers to rungh auth loginfor you. It says who you are logged in as. Without a working login it stops.- Claude Code, which runs the sessions. It checks
claude --version; if it isn't there, setup says where to get it and carries on. - The bot user, optional. If
~/.loopway/config.jsonhas a bot token, setup checks GitHub accepts it and says whose it is. Otherwise it asks for the token of a separate GitHub account (typed as dots, never printed), checks it, refuses your own account's (the bot would comment as you), and saves it as thegithubblock with the account's login asnameand itsusers.noreply.hub.lumenfield.workaddress asemail. The file is written for you alone (0600) and its other keys are kept. Skipping leaves sessions off. - The bot files, optional, one each for
.loopway/dev.mdand.loopway/review.mdin the directory you ran it from. It asks which repos they should watch (guessing fromgit remote origin), warns about oneghcan't see, and writes the files from the examples under Bots. A file that is already there is left alone.
It ends by telling you to run loopway and assign an issue to yourself.
A thread is one bot plus the subjects it tracks. The rules are in each bot's front matter (see below), and they are deterministic:
- A new issue starts a thread for every bot with
on: issue(the dev bot). A new pull request starts one for every bot withon: pull_request(the review bot). A bot only counts for the repos it lists. - Every update to a subject goes on the queue of every open thread holding it. The queue is what the thread's session is handed (see Sessions). The exception is a comment the thread sent itself, which is not queued back to it.
- A thread closes when every subject on it is closed or merged. A subject that reopens while its thread is open stays on it. A subject that reopens after its thread closed starts a new thread for that bot. A closed thread never reopens and gets no more updates.
- A pull request loopway already knew, with no thread for a
pull_requestbot, gets one when its next update arrives. - A subject a thread creates (see Sessions) joins that thread, and every bot that wants its kind starts a thread for it, with its creation as the first update: a new issue gets a dev thread, a new pull request a review thread. The creator's own bot is not skipped, so a dev thread that opens an issue makes a second dev thread for it. The thread stays open until every subject on it, the created ones too, is closed. In the TUI the thread view marks the subjects it created, and filtering by one lists every thread holding it.
The bare loopway adds thread lines to its output, after the line of the event that caused them:
2026-11-10 14:02 new owner/repo#12 issue "Fix it" by you
2026-11-10 14:02 thread opened 3f9a1c2e dev owner/repo#12
2026-11-10 14:05 update owner/repo#12 comment by you
2026-11-10 14:05 queued owner/repo#12 comment -> 3f9a1c2e
2026-11-10 14:30 thread closed 3f9a1c2e
loopway threads lists the open threads and those closed in the last 3 days (judged by each thread's latest message): id, bot, status, subjects, and how many updates are pending. It reads the files, so run it in another terminal while loopway runs. --json works on both, one object per line.
3f9a1c2e dev open owner/repo#12 2 pending
8c01d7b4 review closed owner/repo#13 1 pending
24edcfc4 dev open owner/repo#14 3 pending blocked: question on owner/repo#14 https://github.com/owner/repo/issues/14#issuecomment-1
A thread waiting on an ask says so: blocked: <kind> on <subject> <url> for its oldest open ask ((+N more) when there are several). --json has blocked: { kind, subject, url } for it, and nothing for a thread that isn't waiting. The TUI shows the same on the main view's row, and the thread view's Pending section says its updates wait on the answer.
Each open thread with queued updates and no run in flight gets all of them, oldest first, in one run of Claude Code (claude -p --permission-mode auto --output-format stream-json) in the directory loopway runs in. A new session gets the bot's prompt plus the updates; later batches run with --resume <session id>. --max N (default 3) caps the runs in flight.
- A delivered batch leaves the queue. A run that fails (an API error, a usage limit, a bad exit, a bad model name) leaves it, marks the session
failed, and the thread tries again after 5 minutes. A usage limit holds every delivery until it resets. - The session acts as the bot user (see Credentials). It talks only through loopway's own MCP server, which loopway hosts and passes with
--mcp-config. Its tools arecomment(subject, body),ask(subject, question)(see Asks),create_issue(repo, title, body, subscribe)andcreate_pr(repo, head, base, title, body)(the session pushes the branch itself first), andpermission, which Claude Code itself calls. The prompt tells the session to open issues and pull requests only through the create tools. Every message goes through it, so loopway records it on the thread (sent). A comment a thread sent is not queued back to that thread, but is queued to every other thread holding the subject. The comment carries a hidden<!-- loopway:thread=<id> -->so the poller can tell.create_issueandcreate_prput the same marker in what they open (an issue made withsubscribe: falsehas none), and record it insentwith the kindissueorpull_request. The poller is told about the new subject, so discovery never reports it again; one created while loopway was not listening is matched to its thread by the marker in its text. - The prompt tells the session to comment only when it has something new to say, so bots don't trade acknowledgements on a shared subject. A turn that ends with none logs
turn ended without a message. - A thread that has never run gets its first run even with nothing queued, because a new issue is itself the news. Closed threads get no more runs.
To try it against the sandbox repo (needs gh auth login and the bot's token in ~/.loopway/config.json, see Credentials):
# in a checkout of loopway
npm install && npm run build
mkdir -p scratch/.loopway && cd scratch
cat > .loopway/dev.md <<'EOF'
---
repos: [craftmilldev/loopway-sandbox]
on: issue
model: sonnet
---
Answer the issue in a comment.
EOF
node ../packages/cli/dist/index.js # leave this running
# in a second terminal
gh issue create -R craftmilldev/loopway-sandbox --title "What's 2+2?" --body "Reply in one comment."
tail -f ~/.loopway/state/*/threads/*.log # the session, as it runs
# when loopway-bot has answered, reply as yourself (use the issue number from above):
gh issue comment <number> -R craftmilldev/loopway-sandbox --body "Now times 3."
grep -A4 '"session"' ~/.loopway/state/*/threads/*.json # the same session id, resumedTo see a failed run, set model: nonesuch in .loopway/dev.md and restart loopway.
Per thread, the JSON has session: { id, status: idle | running | blocked | failed, lastRunAt, lastError? } and sent: [{ at, subject, kind, url }], and ~/.loopway/state/*/threads/<id>.log is the session log: assistant text, one line per tool call, and loopway's own lines (-> delivered 3 updates, <- comment on owner/repo#12).
Sessions run with --permission-mode auto, so Claude Code's auto mode classifier decides first. Whatever it would still prompt for goes to loopway's permission tool (--permission-prompt-tool), and loopway decides in this order, with no model involved:
- A call you already approved for this session passes.
- The bot's front matter rules:
deny:, thenask:, thenallow:. A call that matchesaskskipsallowand goes straight to step 3, even when auto mode would have let it through (loopway also hands theaskpatterns to Claude Code as ask rules, because auto mode rarely asks on its own). They are lists of tool patterns in Claude Code's syntax, likeallow: ["Bash(npm test:*)", "Read"].Bash(curl:*)is every command that starts withcurl,Bash(git status)that command exactly,Read(src/*)a glob over the path. - Otherwise loopway asks: one comment on the thread's main subject (the first one it tracks), by the bot and carrying the thread marker, with the tool and its input and a request for a 👍 to allow or a 👎 to deny. The call is refused for now with a message telling the session it has asked and will be resumed. The session is marked
blocked, and the ask is recorded on the thread asasks: [{ id, kind, commentUrl, subject, tool, input, at, answeredAt? }]. The same call is not asked again while its ask is open.
A session can also ask a question itself: ask(subject, question) posts it (marked) and blocks the session until it is answered. The prompt tells the session to use it when it needs someone to decide, or is stuck.
How an ask is answered:
- A reaction. After every pass over the known subjects (every 30 s) loopway reads the reactions on its open permission asks. A 👍 or 👎 from your
ghuser, and nobody else, answers. A 👍 resumes the session withapproved: <tool> <input>and "Retry it.", and the approval is remembered (session.approved), so the same call passes next time. A 👎 resumes it withdenied. If you left both, the 👎 wins. It costs one conditional request per open ask, and a 304 is free. - A reply. A comment from your
ghuser on any open subject of the thread, after the question, answers it, so a reply on the pull request answers a question asked on its issue. It is queued like any update, and the ask is marked answered. - A chat message. Anything you send in the TUI's chat answers the thread's open questions (
answered ... chatted), since you are talking to the session. The queue it held back goes out on the run after the chat block ends. A permission ask is not answered by chat: it still needs a 👍 or 👎. - Either way the session leaves
blockedand its next run gets the answer. A blocked session is not run for other updates meanwhile: they wait in the queue.
Open asks live in the thread's JSON, so a restart keeps waiting on them. The log (loopway, --json) has asked and answered lines, and the TUI's thread view lists what the thread is waiting on, with links; blocked shows as the session status on the main view.
loopway reads the .loopway/ folder in the directory it runs from. Each bot is one file, .loopway/<bot>.md: Markdown with YAML front matter. The front matter is the bot's rules; the Markdown is its prompt, which starts each thread's session. The keys: repos; on: issue, on: pull_request or a list of both, which says which new subjects start a thread for the bot; model (like sonnet, passed to Claude Code); harness (only claude, the default); allow, deny and ask, lists of tool patterns that decide permission asks (see Asks); and trusted (see Who a bot listens to); and labels, which limits the subjects that start a thread to ones whose labels match: a label name (labels: epic), "!epic" for a label it must not have, or and, or and not over those (labels: { or: [bug, "!epic"] }), where a bare list is and. Names ignore case. A bot with no labels takes any subject, and a label added to a subject later can start the bot. Keys loopway does not know are ignored. It polls the union of every bot's repos.
.loopway/dev.md:
---
repos: [craftmilldev/loopway]
on: issue
---
You are the dev bot. When an issue is assigned to you, read it, make the change on a branch, run the tests, and open
a pull request that says `Closes #N`. Ask on the issue when something is unclear..loopway/review.md:
---
repos: [craftmilldev/loopway]
on: pull_request
---
You are the review bot. Read the pull request and its diff, check it against the issue it closes, and leave a
review. Be specific, and say what you ran.trusted: [alice, acme/devs] in a bot file lists GitHub logins and org/team slugs. You and the bot user are always trusted; a team is turned into its members when loopway starts, and if a team can't be read (wrong name, or your gh token lacks read:org) loopway stops with an error instead of running with a shorter list. Left out, the bot trusts only you and the bot user.
- Who can start work: a new issue or pull request starts a thread for a bot only when its author is trusted by that bot and it is assigned to you. Until then it is known and watched: assigning it to you later (an
assignedupdate) starts the thread. Nobody else's machine, and nobody you haven't listed, can start work on yours. - Whose words reach the session: a comment, or a review (with or without text, since an approval steers a session too), from a login the bot doesn't trust is not queued for it. The log says
ignored comment on owner/repo#N by someone, who tN's bot does not trust(--json: anignoredline). Closes, labels and CI results carry no text from the person, so they still pass. - Subjects a thread creates: a pull request needs no assignment, since the thread that opened it is already watching, so the review bot's thread starts at once. An issue is only filed unless
create_issueis called withassign: true, which assigns it to you and starts the dev thread.create_issuealso needssubscribe, with no default:truemakes the creating thread track the issue, so its comments come back to that thread;falsefiles it as its own piece of work (spinning it out of this issue) and nothing on it comes back to the creating thread. The session decides which one it means.
In a terminal, a bare loopway opens a full-screen TUI on the same poller. loopway --no-tui, --json, or output that isn't a terminal (loopway | cat) keeps the plain log below.
- Main view: under the header (loopway and its version, with what the poller is doing a row below), the threads in groups: the open ones by state (
needs you: a blocked session;running;failed;updates waiting: queued with no run in flight;quiet), then the closed ones from the last 3 days (by their latest message), dimmed. A row is the bot, session status (no session yetuntil one has run), pending count, the time of the latest message and the subjects. The poller's latest line and the keys are pinned to the bottom.↑/↓moves through the rows in the order shown,Enteror→opens a thread. - Thread view: the session state, counts (subjects, waiting on you, updates queued, messages sent), the subjects, what the thread is waiting on, with links, and the session log (
~/.loopway/state/<slug>/threads/<id>.log) as a block per turn: the top says the turn's number, how many updates it was handed and whether it is running, finished or failed; the lines inside are what the session said, each tool call as a sentence (Ran npm test,Commented on o/r#12), and messages it sent. The log follows new output until you scroll up with↑/↓; scrolling down to the end follows again (PgUp/PgDn/Home/Endwork too, but nothing needs them).←orEscgoes back. - Chat: in the thread view of an open thread,
copens a text box (the other keys,qincluded, type into it;←/→move the cursor,Home/Endjump to the ends,Deleteremoves the character after it).Entersends the message to the thread's session; it answers in the session log, in plain text and not on GitHub. The session is told it is in a chat block. A message typed while it is working waits for its turn, and the thread's queued updates wait until the chat ends.Escends the chat: the session is told, and it comments on the ticket with a short overview of the conversation only if it took an action because of it or the ticket was unclear (testing steps, scope, done-when); a chat that was only for understanding posts nothing. Chat is TUI only, and needs sessions (the bot token). - Subject filter: in the thread view,
Tabselects the next subject andEnterreturns to the main view filtered to the threads holding it, with the filter in the header.Escclears it. - Status line: in the header, under the version, what the poller is doing:
polling owner/repo · last checked 14:02 · next in 0:24.rpolls GitHub right now (discovery and updates), and the line saysrefreshing…until it is done; the timers restart from there. A secondrwhile it runs does nothing, and while GitHub has asked loopway to wait,rsays so and calls nothing. qorCtrl-Cquits and stops the poller.
A loopway installed from a release (install.sh or npm i -g) keeps itself current. It looks at GitHub's latest release (cli-v<x.y.z>, the one install.sh installs) when it starts, and every 10 minutes while it runs. At start it installs a newer one and runs again at once. While running it stops starting new runs, lets the runs in flight finish their turn (and an open TUI chat end, for up to 5 minutes, since chat lives in memory), installs it, and restarts itself in place (the same command, the same directory); the threads and their sessions are on disk, so they carry on. If the download or the install fails, it says so and keeps running this version; it tries again for the next release, not the same one. A copy run from a git checkout never updates itself.
Turn it off with "auto_update": false in ~/.loopway/config.json, or LOOPWAY_NO_UPDATE=1:
{ "auto_update": false }- GitHub: loopway uses your
ghlogin (gh auth token, orGH_TOKEN). You aregh api user. - The bot user: the
githubblock of~/.loopway/config.jsonnames it. Its issues and pull requests count as subjects too.{ "github": { "token": "ghp_...", "name": "loopway-bot", "email": "bot@example.com" } }namemakes its issues and pull requests subjects. Sessions run as this user:GH_TOKENis the token, and the git author and committer are the name and email. Without a token, sessions are off and threads only queue. - State: per project, in
~/.loopway/state/<slug>, where the slug is the full path of the.loopwayfolder loopway resolved with every character other than letters and digits turned into-(the way Claude Code names its project folders). Two projects never see each other's threads, so bot names can repeat.state.jsonis how far discovery has got per repo, and for each known subject the updates already printed. Threads arethreads/<id>.json, one file each: bot, subjects, status, created and latest-message times, and the queue. Delete the folder to start over from now. Older versions kept state directly in~/.loopway/threadsand~/.loopway/state.json: they are ignored, and you can delete them.
docs/developing.md has the layout and how to run the checks. packages/web is a static marketing page that Vercel deploys.
loopway is MIT-licensed; see LICENSE.