cd /news/ai-agents/a-local-second-brain-for-coding-agen… · home topics ai-agents article
[ARTICLE · art-128128] src=dev.to ↗ pub= topic=ai-agents verified=true sentiment=↑ positive

A local second brain for coding agents: context, memory and gates in Weftgate 0.2

A developer released Weftgate 0.2, an open-source local Python package that gives coding agents three capabilities: retrieving relevant source locations, storing repository-scoped memory notes in a local SQLite database, and verifying changes through static checks and allowlisted test commands. The tool integrates with Codex, Claude Code, Cursor and Antigravity via CLI and MCP, and its author reports validation through 199 local tests at roughly 91% line coverage, while cautioning that hooks are not a complete enforcement boundary.

by read3 min views1 publishedSep 13, 2026

Coding agents need more than another large context dump. They need a small set of relevant source locations, decisions that are still current, and evidence that their changes connect to the project correctly.

I maintain Weftgate. Version 0.2 puts those three jobs in one local Python package: understand, remember and verify.

Watch the captioned 78-second demo. It uses real CLI output from an intentionally broken fixture, not a field benchmark.

pip install weftgate
cd /path/to/your/repo
weftgate setup --agents codex,claude,cursor,antigravity --hooks --instructions
weftgate card "POST /orders" --budget 1200

Use a route that exists in your project. The card contains source locations and static relationships between declarations, dependencies, env reads and route handlers. It does not load file bodies or pretend to be a runtime call graph. Ambiguous names and missing capabilities remain visible.

The default response is capped at 6,000 UTF-8 JSON bytes, including its accounting fields. That is an estimate of 1,500 tokens, not a guarantee for every model tokenizer. The ledger records actual payload bytes and omissions. It does not invent a savings percentage.

weftgate remember "Order idempotency" "Keep duplicate requests idempotent." --file app/orders.py
weftgate recall "orders"

The path must exist. Weftgate stores an explicit note in a repository-scoped local SQLite database. On recall it checks the cited file hashes. If a file changes or vanishes, the note is hidden by default. The original hashes stay intact until you review and explicitly replace the note.

An unchanged file does not prove the saved prose true. Notes are untrusted context, not higher-priority instructions. There is no automatic transcript capture, embedding download or API key. This mnemo-derived lexical notebook is included in the public package; the separate private companion is not required.

The gate checks env names, Python and Node imports, and static FastAPI or Starlette references. DATABSE_URL can be rejected against a declared DATABASE_URL; os.environ[key] remains advisory when its key cannot be resolved statically.

[weftgate.workflow]
commands = ["python -m pytest -q"]
weftgate checkpoint --run --require-ready

A checkpoint checks the current changed code, including staged and untracked source files. With explicit execution enabled it observes configured, allowlisted test commands. It distinguishes a proven failure, incomplete evidence, review findings, and a repository that changed while checking. Ready means these checks and commands passed against an unchanged file fingerprint. It does not certify the entire app.

CLI and MCP use the same implementation. Setup writes project configuration and workflow rules for Codex, Claude Code, Cursor and Antigravity. Completion hooks request bounded repair passes when a proven failure remains. Claude also has a pre-edit adapter for supported Edit/Write/MultiEdit operations.

Trust and enable hooks in each editor. Codex uses /hooks. The other new adapters run after writes, and no local hook is a complete enforcement boundary. Keep the GitHub Action required in branch protection when merges must be gated.

Validation includes 199 local tests, about 91% line coverage, CLI/MCP parity, stale-memory regressions and isolated package installation. See the validation record and activation guide. Every editor build has not been interactively certified.

Try it on a project you know well. I would value reproducible reports about confusing setup, useful context and false blocks. Source and quickstart.

Disclosure: this article and launch assets were prepared with AI assistance. Code behavior is backed by the linked tests and reproducible fixture evidence.

── 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/a-local-second-brain…] indexed:0 read:3min 2026-09-13 ·