devloop-gateway
An MCP server and CLI that give people and coding agents one checked path through the development loop.
One checked path through the development loop, for people and coding agents. An MCP server for agents and a CLI for people, over the same core. Both run the repository's named checks, follow CI, read CI failures and open pull requests. A pull request opens only once the required checks have passed on the commit being proposed. Merging is not offered at all. Every call is recorded without its content, so the loop can be measured. An agent writes code in seconds. Knowing the code is right still takes as long as it did, and it is now the bottleneck.
Summary extracted from the README.
devloop-gateway
One checked path through the development loop, for people and coding agents.
An MCP server for agents and a CLI for people, over the same core. Both run the repository's named checks, follow CI, read CI failures and open pull requests. A pull request opens only once the required checks have passed on the commit being proposed. Merging is not offered at all. Every call is recorded without its content, so the loop can be measured.
people ──► devloop (CLI) ──┐
├──► Gateway ──► git · gh · your checks
agents ──► devloop (MCP) ──┘ │ policy.py decides what is allowed
└──► .devloop/events.jsonl ──► devloop stats
Why
An agent writes code in seconds. Knowing the code is right still takes as long as it did, and it is now the bottleneck. An agent can only be as good as the checks it runs against, and reviewers read less of each change. So the loop around the code needs three layers:
- Written conventions.
AGENTS.mdsays how this repository works. It is a request: an agent can read it and still do something else. - Limits the platform enforces. Rulesets on
main, required checks, tokens that can push branches but not merge. This is the security boundary. github-defaults manages it as Terraform. - This gateway. It makes the right path the easy one, refuses the wrong ones with a reason an agent can act on, and records every step.
Tools
| MCP tool | CLI | What it does | Refused when |
|---|---|---|---|
list_checks |
devloop checks |
The declared checks, which are required, which passed on this commit | |
run_check |
devloop check <name> |
Runs one named check, returns the end of its output | the name isn't declared |
ci_status |
devloop ci |
Recent CI runs for a branch; passing, failing or running on this commit | the branch name isn't one |
ci_failure_log |
devloop ci-log <id> |
The failed steps' log, trimmed to the end, timestamps removed | the run id isn't a number |
open_pull_request |
devloop pr --title … |
Pushes the branch and opens a pull request | on main, uncommitted changes, required checks not passed on this commit |
request_merge |
Never merges; says how to hand over to a reviewer | always | |
loop_stats |
devloop stats |
Calls, outcomes, p50/p90 per tool, people and agents apart |
The rules
All of them live in policy.py as pure
functions, each with a test.
- Only declared checks run. Callers pick a name from
devloop.yaml; they never pass a command. Commands run without a shell and with a timeout. - A pass belongs to a commit. A check that passes on uncommitted changes is reported but doesn't count, because it isn't the code a reviewer will see.
- A pull request carries its evidence. Its body ends with the commit and the checks that passed on it, so the reviewer knows that before reading a line.
- No merge tool.
request_mergeexists so an agent that wants to merge is told to hand over, rather than left to look for a way around. - Values never become flags. Branch names and run ids are validated, and
every value is passed as
--flag=value.
Every refusal says what to do instead, because the caller is often an agent that will act on the answer.
Measuring the loop
.devloop/events.jsonl gets one line per call: time, interface (cli or
mcp), tool, outcome (ok, failed, refused, timeout, error),
duration and a check name or refusal code. It never holds command output,
titles, bodies or paths: a log with content would be a second copy of the code
and whatever secrets its tests print. The directory ignores itself in git.
$ devloop stats
tool via calls ok failed refused p50 p90
list_checks mcp 1 1 0 0 0.0s 0.0s
request_merge mcp 1 0 0 1 0.0s 0.0s
run_check cli 6 5 1 0 0.0s 2.1s
run_check mcp 2 1 0 1 0.0s 0.0s
Use it
Add a devloop.yaml to the repository:
default_branch: main
checks:
lint: ruff check .
test: pytest -q
pr_requires: [lint, test]
People use the CLI:
uv run devloop checks
uv run devloop check test
uv run devloop pr --title "Cache uv downloads in CI"
In this repository, Claude Code starts the server from .mcp.json. For
another repository:
claude mcp add devloop -- uv run --directory ~/Desktop/Projects/devloop-gateway devloop --repo /path/to/repo serve
CI runs the same named checks through the same tool (.github/workflows/ci.yml),
so a check means the same thing on a laptop, in an agent's session and in CI.
What it is not
Not a security boundary. An agent with a shell and your GitHub token can
run git and gh directly and skip the gateway. That boundary belongs to
GitHub: rulesets on main, required status checks, and an identity for the
agent that can push branches but not merge. The gateway is the layer that
makes the right path the easy one, and makes it measurable.
Tests
uv run devloop check test # or: uv run pytest -q
40 tests: every policy rule, the gateway against a fake runner, the event log (including that it holds no content), config, the real runner's timeouts, the MCP server in process, and one round trip over stdio against a separate server process, the way an agent meets it.
Not built yet
- OpenTelemetry export. Events as spans, next to CI and GitHub data.
- An identity for agents. A GitHub App, so rulesets can tell an agent's push from a person's.
- Progress for long checks. MCP progress notifications while a check runs.
- Shared
devloop.yamltemplates per language, as an organisation default.