Skip to content

armgit / kwant

Public Imported from GitHub
0

Your own team of AI bots in one self-hosted binary: spaces, every account you have, handoffs, approvals and routines. Open-source, self-hosted alternative to Grok Bot, Claude Duet and OpenAI dots. Rust + React.

22.6 KB
Raw Blame
title: Dev mode: AI code review and a production safety floor
description: Point a kwant space at its git repos, on GitHub, GitLab, Gitea, Forgejo or any git server. Bots explain every merge in plain words, review each pull request with a second bot, and every push to main or deploy asks you first.
card_title: Dev mode
path: docs/dev-mode.html
nav: dev-mode
card: Plain-words cards for every merge, a second bot's review on every pull request, and a floor under production.
card_art: avatar:devops
---
<p class="kicker">Docs</p>
<h1>Dev mode: code review and a safety floor for your repo</h1>
<p class="intro">Dev mode watches the repo of every team in a space, on GitHub or any git server. kwant reads each repo and writes a card for every merge, and for every open pull request or merge request on GitHub, GitLab, Gitea and Forgejo, in plain words. A bot that didn't write the code reviews it. In the same space, anything that can reach production asks you first. kwant writes to GitHub only when you press <strong>Post to GitHub</strong> on a review.</p>
<figure>
  <div class="frame">{{shot:v071-dev-on|The Trailhead Outfitters space right after one press on the Dev mode switch, which now reads On. A note above the message box says Dev mode on, watching demo-org/demo-app on main, with Open Dev desk and Undo.|(max-width: 860px) 100vw, 760px}}</div>
  <figcaption>One press turns it on. A note says which repo kwant found, with Undo.</figcaption>
</figure>

<h2 id="turn-on">Turn it on</h2>
<p>The <strong>Dev mode</strong> switch is at the top of the sidebar, under the space's name. One press turns it on, with no setup to fill in. kwant finds each team's repo: the team's repo link, or its folder when that folder is a git checkout. It watches all of them, up to 10 per space. It reads this on your machine, with no network. A sign-in token inside a remote address is dropped and never logged or stored.</p>
<ul>
  <li><strong>A short note says what it found</strong>, such as <strong>Watching 3 repos</strong>, with <strong>Open Dev desk</strong> and <strong>Undo</strong>. When a repo needs you, such as no GitHub connection that can read it, the note adds one button for that.</li>
  <li><strong>A team with no repo</strong> shows as one quiet line on the Dev desk, with <strong>Link a repo</strong>. Linking a repo never turns Dev mode on by itself.</li>
  <li><strong>Connect GitHub</strong> shows when no GitHub connection can read the repo. It opens the GitHub form right where you pressed it, a popover on the desktop and a sheet on the phone, and Dev mode picks the repo up as soon as the connection is saved, without turning it off and on.</li>
  <li><strong>Turning on never fails.</strong> With no repo, the production floor and the command guards still work, and the desk waits for one.</li>
</ul>
<p>On the Dev desk, one line says how many repos are watched and how many need you. <strong>Show repos</strong> opens the list: each team's repo with its branch, where kwant found it, and its state. A repo that needs you has one button for its fix, and the others keep going.</p>
<figure>
  <div class="frame">{{shot:v072-dev-repos-card|The repo list on the Dev desk, under the line Watching 3 of 4 repos, 1 needs you. The Shop, Storefront and Payments teams' repos each read Watching, checked 19:00. The Ops team's demo-org/warehouse-ops says Needs your GitHub connection in amber.|(max-width: 860px) 100vw, 760px}}</div>
  <figcaption>Every team's repo, each checked on its own.</figcaption>
</figure>
<h3 id="any-git">Any git repo</h3>
<p>Since 0.7.3, Dev mode reads every repo's history with git: GitHub, GitLab, Gitea, any git server, or a team folder with no remote. Each merge gets its plain-words card. Pull requests, CI checks and reviews need the repo's forge: GitHub, or since 0.7.4 <a href="#forges">GitLab, Gitea and Forgejo</a>. <strong>Post to GitHub</strong> works on GitHub repos only. kwant keeps a copy of each watched repo in its data folder, up to 1 GB; a bigger repo reads "Too big to read". The server needs git 2.31 or newer; without it, the desk says "Needs git on the server", with the install tip. kwant fetches over https, http, ssh or git, and never from the server itself, a link-local or a cloud metadata address. git runs as the server user kwant runs as, so that user's SSH keys and credential helpers work.</p>
<p>Under a team's repo link, Team settings say in one line what Dev mode does with it: watched, watched but needs Connect GitHub for reviews, can be watched once Dev mode is on, or read with git.</p>
<figure>
  <div class="frame">{{video:clip-v071-dev-on|Demo: in the Trailhead Outfitters space, one press on the Dev mode switch turns it on. A note says it is watching demo-org/demo-app on main. Open Dev desk shows a short intro to what Dev mode does, then the landed cards, one per merge in plain words.}}</div>
  <figcaption>On, the repo found, and the last five merges written up.</figcaption>
</figure>

<h3 id="forges">GitLab, Gitea and Forgejo</h3>
<p>Since 0.7.4, repos on GitLab, Gitea, Forgejo and Codeberg get review cards for their merge requests or pull requests, with their CI, like GitHub's. Add the server once in <a href="loose-ends.html#sources">Loose ends</a> with its address and a read token (<code>read_api</code> on GitLab). kwant asks the server which forge it runs, and asks you only when it can't tell. A repo row on the Dev desk with no connection yet has a <strong>Connect GitLab</strong> (or Gitea, or Forgejo) button that opens the same form in place. The repo list shows where each repo lives.</p>
<figure>
  <div class="frame">{{shot:v074-forge-repos|Dev desk watching four repos, each tagged with where it lives: GitHub, plain git, Gitea and GitLab.|(max-width: 860px) 100vw, 760px}}</div>
  <figcaption>Each repo with its forge, on one desk.</figcaption>
</figure>
<figure>
  <div class="frame">{{shot:v074-forge-review|A GitLab merge request, !7 Show the waitlist badge on full trips, reviewed in Dev desk: low risk, does what was asked, tests changed with the code, security checks clear. Posting the review to GitLab comes later.|(max-width: 860px) 100vw, 760px}}</div>
  <figcaption>A GitLab merge request, reviewed like a GitHub pull request.</figcaption>
</figure>
<p>Posting a review back is still GitHub only: the card says "Posting to GitLab comes in a later update" and links to the merge request. Forge requests take the same address checks as git fetches and never follow redirects.</p>
<p>A repo with no forge, or with no token for it, still gets reviews: each pushed branch that's ahead of the watched one gets a review card, with no CI and no Post.</p>
<figure>
  <div class="frame">{{shot:v074-branch-card|A review card for a branch, feature/seat-holds, in a repo with no pull requests: low risk, with tests and security checks.|(max-width: 860px) 100vw, 760px}}</div>
  <figcaption>A pushed branch in a plain git repo gets its own review card.</figcaption>
</figure>

<h2 id="before">Before you turn it on</h2>
<p>On GitHub, Dev mode reads pull requests and checks through the GitHub connection in <a href="loose-ends.html">Loose ends</a> (its row says "Also used by Dev mode"), so it needs a GitHub token. Reading works with a read-only token; <a href="#post">posting a review</a> needs <strong>Pull requests: Read and write</strong> on a fine-grained token.</p>
<div class="note"><strong>Where the token is kept.</strong> When some bots run commands without asking (new installs start on <strong>Ask only when risky</strong>), one of them could read a token saved on this server. The card <strong>Before you save the token</strong> says so and offers <strong>Save it on this server</strong>, <strong>Use Bitwarden</strong> or <strong>Make every bot ask first</strong>. A read-only token limited to the repos you need keeps the risk small. See <a href="approvals.html#passwords">Approvals &amp; passwords</a>.</div>

<h2 id="landed">What landed</h2>
<p>The <strong>Dev desk</strong> sits at the top of the sidebar. Its first tab, <strong>What landed</strong>, has one card per commit that reaches the watched branch: what changed in plain words, how risky it is, the commit, the pull request it came from (or "Direct push"), a diffstat for each file, and whether tests passed.</p>
<figure>
  <div class="frame">{{shot:v07-dev-landed|The Dev desk watching 3 repos: demo-org/demo-app on GitHub, and trail-shop and trail-blog, which have no remote and show landed changes only. Below, the What landed (6), Reviews (8) and Worktrees (6) tabs, a chip for each repo, and today's landed cards, each with its commit, Direct push, a Low risk badge, What changes for you and Under the hood.|(max-width: 860px) 100vw, 760px}}</div>
  <figcaption>Every change that lands on main as a card, for each watched repo.</figcaption>
</figure>
<ul>
  <li><strong>Since you last looked</strong> rolls up what's new, and <strong>Mark all seen</strong> clears it.</li>
  <li><strong>Draft release notes</strong> writes notes from every landed card since the last tag.</li>
  <li><strong>Verified</strong> goes on a merge only when another bot reviewed that exact head in kwant, every finding was fixed or dismissed, and CI on the merge is green. A pull request merged before its review was ready stays "not verified": the sticker says what was checked before the change landed, not after.</li>
</ul>
<p>kwant checks the repo every 5 minutes. The first check writes up the last 5 merges. Card text is written by one of the space's bots, and its model calls count toward the space's daily spending stop and the bot's monthly budget; the risk, the test checks and CI come from rules and need no model.</p>

<h2 id="reviews">Reviews</h2>
<p>The <strong>Reviews</strong> tab has one card per open pull request, written by a bot that didn't write the code, on a different engine when the space has one. A new push to the pull request gets a new review.</p>
<p>Since 0.7.7, Dev mode reviews only fresh work: a branch or pull request gets a review card only if it moved in the last 7 days, so old branches don't fill the desk or spend model calls. Cards on branches that went quiet go stale, and a new push brings a branch back. The newest are reviewed first, and Dev mode's status says how many old ones it skipped.</p>
<figure>
  <div class="frame">{{shot:v07-dev-review|Review card #31, Switch checkout to the 2027 tax table, from ben/tax-table into main, written by Ben on Claude Sonnet and reviewed by Cody on Codex, a different engine for fresh eyes, with an LGTM stamp: Medium risk because it touches a payments path, Does what the title says, Tests changed with the code and nothing loosened, and a light for each security check.|(max-width: 860px) 100vw, 760px}}</div>
  <figcaption>A second bot's review. Nothing goes to GitHub until you press it.</figcaption>
</figure>
<ul>
  <li><strong>Risk</strong> with its reasons, from rules, not from the bot's opinion.</li>
  <li><strong>Does it do what was asked</strong>: what the task asked for, what's missing, and what wasn't asked for.</li>
  <li><strong>Tests weakened</strong>: a removed or loosened test is flagged with the lines.</li>
  <li><strong>Secrets and packages</strong>: Gitleaks runs over the pull request, and every new package is checked against its registry. A found secret or a package that doesn't exist always makes the card High risk. The secret itself is never shown.</li>
  <li><strong>Findings</strong>: <strong>Fix it</strong> sends a finding to the bot that wrote the pull request, and <strong>Dismiss</strong> sets it aside.</li>
</ul>
<p>When the reviewer found nothing to fix, the card gets an <strong>LGTM</strong> stamp.</p>
<figure>
  <div class="frame">{{shot:v071-lgtm|A review card with no findings: the two security checks that run, Secrets and New packages, are green, two more are marked for later, and an LGTM stamp sits in its top right corner: Looks good to me, the reviewer found nothing to fix.|(max-width: 860px) 100vw, 760px}}</div>
  <figcaption>Nothing to fix: the card says so with a stamp.</figcaption>
</figure>

<h2 id="fresh-eyes">Checked with fresh eyes</h2>
<p>Since 0.8.0, Dev mode reviews and the Swarm Auditor run in a fresh turn with no chat history and no reviewer memories. The reviewer sees the change, the task and the checks, not the conversation that produced them, so it judges the work on its own. Each review shows a <strong>Checked with fresh eyes</strong> chip.</p>

<h2 id="pre-push">The pre-push card</h2>
<p>Before a bot's <code>git push</code>, or a GitHub tool that writes files to a branch, kwant shows a pre-push card and runs the checks: a found secret, a new package the project doesn't list, and a weakened test. The push goes ahead only when they're clear.</p>
<figure>
  <div class="frame">{{shot:v080-prepush-card|In Ann's chat, a Before Ann pushes card for branch fix/fitting-button (2 files, +9 −6) with every check green: secrets, new packages, tests, risk rules, a fresh-eyes review by Cody on Codex and code patterns. All clear, Ann can push now.|(max-width: 640px) 100vw, 720px}}</div>
  <figcaption>The pre-push card waits in the chat and in Needs you.</figcaption>
</figure>
<ul>
  <li><strong>Run the checks again</strong> re-runs them after the bot fixes what they found.</li>
  <li><strong>Push anyway</strong> needs your reason (at least 10 characters). It covers that one push only, and the reason is saved on the card.</li>
  <li>A GitHub file write must name its branch, so the card always says where the change goes.</li>
</ul>

<h2 id="post">Post to GitHub</h2>
<p><strong>Post to GitHub</strong> puts a review card on its pull request as one GitHub review comment, posted as you and pinned to the commit that was reviewed. Findings you didn't dismiss go on their lines when the lines are in the diff; the rest go in the review's text.</p>
<figure>
  <div class="frame">{{shot:v071-post-github-card|The findings on review card #24 after posting, ending in a green line: Posted 13:42 as @demo-bot, 2 inline comments, with View on GitHub.|(max-width: 860px) 100vw, 760px}}</div>
  <figcaption>Posted once, as you, with a link to the review.</figcaption>
</figure>
<ul>
  <li><strong>Only your press posts.</strong> kwant never approves, requests changes or merges, and a bot can't post.</li>
  <li><strong>Secrets are never posted.</strong> A found secret is posted only as "Possible secret in" its file and line, and keys and tokens in a finding are replaced with [redacted].</li>
  <li><strong>Once only.</strong> A double click makes one review, and a posted card stays posted.</li>
  <li><strong>New commits?</strong> If the pull request moved on since the review, nothing is posted, and a new review is on its way.</li>
  <li><strong>Read-only token?</strong> The card says your GitHub connection is read only, and nothing is posted.</li>
</ul>

<h2 id="floor">The production floor</h2>
<p>In a space with Dev mode on, these steps always show an approval card first, whatever the space's or the bot's approvals say, and even after "always allow":</p>
<div class="table-wrap"><table>
  <thead><tr><th>Step</th><th>For example</th><th>Needs a backup</th></tr></thead>
  <tbody>
    <tr><td>Push to the watched or a protected branch</td><td><code>git push</code> to main, master, production and the like, or <code>gh pr merge</code></td><td>No</td></tr>
    <tr><td>Force push</td><td><code>git push --force</code> to a protected branch</td><td>No</td></tr>
    <tr><td>Delete a branch or tag</td><td>Deleting a protected branch or a release tag</td><td>No</td></tr>
    <tr><td>Deploy</td><td>wrangler, fly, vercel <code>--prod</code>, kubectl, terraform apply, a script named deploy, ship or release</td><td>No</td></tr>
    <tr><td>Migrate production</td><td>A migration that names a production database or environment</td><td><strong>Yes</strong></td></tr>
    <tr><td>Destroy data</td><td><code>DROP</code>, <code>TRUNCATE</code>, a <code>DELETE</code> with no <code>WHERE</code>, <code>docker volume rm</code></td><td><strong>Yes</strong></td></tr>
    <tr><td>Use a production connection</td><td>Any tool on a connection you marked <strong>production</strong></td><td>No</td></tr>
  </tbody>
</table></div>
<figure>
  <div class="frame">{{shot:v07-floor|A production floor card: Ben wants to run deploy.sh, a deploy script. It says the deploy changes the database, so it needs a backup from the last 10 minutes first, shows the blast radius and No backup yet, and offers only Back up first and Deny.|(max-width: 860px) 100vw, 760px}}</div>
  <figcaption>The card says what the step does and where it lands, in one sentence.</figcaption>
</figure>
<ul>
  <li><strong>No "always allow".</strong> Allowing a floor card covers that one call, and the next one asks again.</li>
  <li><strong>Back up first.</strong> A step that can change production data can't be allowed until the space has a backup from the last 10 minutes. The card's <strong>Back up first</strong> runs the space's backup command, and kwant checks that it wrote a new backup file.</li>
  <li><strong>Mark a connection production</strong> in Apps &amp; accounts › Advanced to make every one of its tools ask, such as a GitHub app that could write to main directly.</li>
</ul>
<p>The floor reads commands and tool calls, never what a bot says about them. It can't see inside a script with a harmless name, a command built from variables, or a deploy done through a provider's API from code. When a connection can reach production, mark it production.</p>

<h2 id="no-tools">Bots can't act on a pull request's text</h2>
<p>Anyone who can open a pull request writes its title, text and diff. So the bot that writes a Dev mode card runs with no tools at all, on every engine: no MCP servers, no browser, no shell, files or web search. A turn that can't run that way fails instead of running with tools, and the card keeps its rule-based parts.</p>

<h2 id="jira">Work from Jira tickets</h2>
<p>Dev mode can take work from Jira Cloud or Jira Data Center. It's off until you connect it, and until then nothing changes. Set it up in <strong>Settings › This space › Dev mode</strong>, or from the hint on the Dev desk.</p>
<figure>
  <div class="frame">{{shot:v075-jira-card|A Jira ticket on kwant's Tickets tab, marked Working, with its progress line and the brief Ann wrote: the goal, four done-when checks and where in the code, each linked to its source.|(max-width: 860px) 100vw, 760px}}</div>
  <figcaption>A ticket on the Tickets tab, with the brief its bot wrote. Each line links to where it came from.</figcaption>
</figure>
<ol>
  <li><strong>Paste your Jira address</strong>, like yourcompany.atlassian.net. kwant tells Cloud from Data Center.</li>
  <li><strong>Paste a token.</strong> On Cloud, make an API token in your Atlassian account under Security › API tokens, with your account's email. On Data Center, open your profile › Personal Access Tokens. Your bots see what you can see in Jira. Nothing is saved until the check passes.</li>
  <li><strong>Choose the tickets.</strong> Pick the projects, then how a ticket is handed over: with a label (<code>kwant</code> unless you change it), by assigning it to a Jira user you pick, or with your own Jira search. A label keeps the real owner as assignee, and removing it takes the ticket back.</li>
  <li><strong>Choose the team</strong> that works on these tickets. Its lead writes the brief.</li>
</ol>
<p>A bot reads each ticket, and the Confluence pages it links to, then writes a brief: the goal, the done-when lines, where in the code, a plan and its questions. Every line names its source. It asks what's unclear, then builds. Turn on <strong>Wait for my OK</strong> to approve every brief first. Tickets that were already handed over when you connect wait for your Start.</p>
<p>The card follows the ticket through review to landed. It shows <strong>Matches the ticket</strong> only when every done-when line is met. A token Jira rejects, an address with no Jira, a token that sees no projects, and Jira asking kwant to slow down each get their own message.</p>
<p class="note">Jira only changes when you say so. Comments on tickets are off unless you turn them on, and your bots never move or close tickets. Turning it off pauses tickets in progress and keeps their cards, branches and briefs.</p>

<h2 id="modern-web">Modern web guidance</h2>
<p>When a team's folder has web code (a <code>package.json</code>, or HTML, CSS, TSX, JSX, Vue or Svelte files in its top two levels), kwant offers its built-in <strong>modern-web</strong> skill once. The skill has a bot look up Google Chrome's <a href="https://github.com/GoogleChrome/modern-web-guidance">Modern Web Guidance</a> before it writes browser code, and follow its Baseline support and fallbacks. Its text is adapted from Google's skill (Apache-2.0).</p>
<ul>
  <li><strong>One offer per space.</strong> It waits in every bot's Skills tab as a skill for every bot in the space, and a notification opens it. Approve, edit or reject it there. Rejected or deleted, it isn't offered again, even when Dev mode goes off and on.</li>
  <li><strong>A pinned version.</strong> The bot runs <code>npx -y [email protected] search</code> or <code>retrieve</code>, and only those exact commands run without asking. kwant itself never runs them.</li>
  <li><strong>Needs Node and the network</strong> the first time. If the lookup fails, the bot says "Couldn't load Modern Web Guidance here" once and carries on.</li>
</ul>

<h2 id="turn-off">Turn it off</h2>
<p>Turning Dev mode off takes two presses. The first press changes the switch to <strong>Off?</strong> and says <em>Press again to turn off</em>. A second press within 5 seconds turns it off. Escape, clicking elsewhere or waiting keeps it on. The off note has <strong>Turn back on</strong>.</p>
<figure>
  <div class="frame">{{shot:v071-dev-off-armed-card|The Dev mode row after one press on its switch: the switch is ringed in amber with an open lock and reads Off?, an amber hint says Press again to turn off, with an Esc key cap beside it, and the Approvals row below shows Ask.|(max-width: 860px) 100vw, 760px}}</div>
  <figcaption>The first press only asks.</figcaption>
</figure>
<p>Off stops the checks, the reviews and the production floor. The cards stay readable, and your approval settings stay as they were.</p>

<h2 id="phone">On your phone</h2>
<p>The Dev desk works on a phone too. Its row in the sidebar counts the reviews that are ready since you last opened the desk, and the count is the same on the phone and the desktop.</p>
<figure>
  <div class="phone">{{shot:phone-v071-dev-desk|The Dev desk on a phone: the watched repos, the What landed, Reviews and Worktrees tabs, and the summary 6 changes landed on main, 2 need you, with main is green.|300px}}</div>
  <figcaption>The desk on a phone.</figcaption>
</figure>
<div class="note"><strong>Only you can see it.</strong> Bots can't read the Dev desk, its settings or its cards, because the settings hold the backup command and the cards hold the repo's diffs. None of it is in a space or bot export.</div>