cd /news/ai-agents/catch-broken-environment-import-and-… · home topics ai-agents article
[ARTICLE · art-128105] src=dev.to ↗ pub= topic=ai-agents verified=true sentiment=· neutral

Catch broken environment, import, and route connections with Weftgate

A developer maintains Weftgate, an open-source verification gate for coding agents that checks environment-variable reads, dependency imports, and FastAPI route references against repository contracts. The tool runs locally via CLI, MCP, hooks, and CI, with no runtime dependencies and no network calls on its default path, and returns accept, review, or reject results with suggested corrections. The maintainer cautions that a passing gate does not prove an application works and that fixture scores are not claims about arbitrary repositories.

by read2 min views1 publishedSep 13, 2026

I maintain Weftgate, an open-source verification gate for coding agents. It checks environment-variable reads, dependency imports, and FastAPI route references against contracts in the repository. It runs locally through a CLI, MCP, hooks, and CI.

The core has no runtime dependencies and makes no network calls on its default path. It is an early static analyzer with explicit limits. A passing gate does not prove that an application works.

Use Python 3.10 or later in a fresh directory:

mkdir weftgate-example
cd weftgate-example
python3 -m venv .venv
. .venv/bin/activate
pip install weftgate
printf 'DATABASE_URL=\n' > .env.example
printf 'import os\nurl = os.environ["DATABSE_URL"]\n' > app.py
weftgate check app.py

The environment oracle compares the read with .env.example. The misspelled hard claim rejects, exits 1, and suggests DATABASE_URL.

Correct the reference and check again:

printf 'import os\nurl = os.environ["DATABASE_URL"]\n' > app.py
weftgate check app.py

This time the reference resolves. Now try a computed key:

printf 'import os\nkey = "DATABASE_URL"\nurl = os.environ[key]\n' > app.py
weftgate check app.py

That returns review, with exit code 0. The environment parser does not establish the computed key's value, so the finding stays advisory.

These are constructed demonstrations, not field accuracy benchmarks.

The 58-second demo traces three intentional mistakes in a fixture:

Reference Repository evidence Suggested correction
import requestz Dependency declarations requests
os.environ["DATABSE_URL"] .env.example DATABASE_URL
Route handler helth Defined/imported handlers health

You can reproduce the broader mutation fixture locally:

weftgate eval mutate --fixture --seed 13

The harness measures detection, blocking, and usable suggestions separately. Its fixture score is not a claim about arbitrary repositories.

An import absent from a manifest can be transitive. A router produced by a factory can register paths that a static scan cannot enumerate. A missing index cannot establish absence. These cases must review or be reported as unverifiable.

An accept result only describes the extracted claims. Continue running your tests, type checker, security checks, and normal review.

weftgate doctor
weftgate audit
weftgate check app/main.py

doctor explains which contracts are available. Environment reads supplied externally should be documented in your declaration source. Python and Node dependency resolution can depend on workspace and runtime configuration, so review findings in context.

For a pull request:

name: Verify connections
on: [pull_request]
permissions:
  contents: read
jobs:
  verify:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v5
        with:
          fetch-depth: 0
      - uses: Avinash-Amudala/weftgate@v0.1.1

MCP clients can start weftgate mcp from the target repository. The tools and CLI call the same gate functions; no separate model API or server account is required.

The most useful feedback is a minimal example of a false block or a missing contract. There are also contribution issues for workspace fixtures and a first-project walkthrough.

Disclosure: this walkthrough was generated with AI and checked against the project's reproducible fixtures. It does not claim independent benchmark results.

── more in #ai-agents 4 stories · sorted by recency
── more on @weftgate 3 stories trending now
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain — perfect for shipping the agent you just read about.

$git push zahid main
Live at https://your-agent.zahid.host
Get free account → Pricing
from €0/mo · no card required
LIVE [news/catch-broken-environ…] indexed:0 read:2min 2026-09-13 ·