Tech & Tools · Verification Guide · ARCHITECTURE · AI LOOP · 11 min read
The AI Loop · Open-Weight Local Workers, Blind Diff Review & Deterministic Verifiers
Why reliable engineering separates scoping, local Ollama generation, deterministic Python verifiers, and tool-free cross-lineage diff review instead of trusting single-model prose.
Scope One Bounded Slice
Before asking any model to edit code or derive an equation, state the exact input files, target invariants, and deterministic test command that must exit 0.
Keep Routine Work on Local GPU
Route bounded code drafts, structured JSON extraction, and first-pass triage to local open-weight models on Ollama with zero cloud data egress.
Stdlib Verifier + Cross-Lineage Check
Require standalone skill verifiers to fail under --planted-defect and review git diff with a second model lineage that has zero tools.
Act I — Roles, Not Models: Why Single-Model Workflows Drift
When the same language model writes a module, writes its unit test, and summarizes its own diff, correlated blind spots compound silently: a misunderstood sign convention, an off-by-one boundary, or a misattributed citation looks equally plausible to the author and to its self-review. Reliable AI-assisted engineering breaks that symmetry by assigning distinct roles to deterministic code, local open-weight workers, cross-lineage reviewers, and a human maintainer.
Never ask a language model whether a number, mesh, or link is valid when a 40-line Python script can check it directly. Use language models where human judgment and pattern synthesis help—drafting code, proposing edge cases, and challenging diffs across model families—and let deterministic scripts hold non-negotiable pass/fail authority.
Act II — Capability-Based Routing Across Four Compute Tiers
Treating model names as replaceable seats behind explicit capability contracts keeps workflows portable as new open-weight and frontier releases appear. Each task slice is routed to the lightest tier capable of checking or producing it:
| Compute Tier & Role | Representative Runtime | Assigned Work | Hard Boundary |
|---|---|---|---|
| Tier 0 · Deterministic Verifier | Python 3 stdlib · lean4checker |
Conservation laws, 2-manifold mesh checks, SHA-256 locks, HTML/CSP/link validation, and planted-defect rejection. | Zero LLM tokens; non-zero exit blocks publication. |
| Tier 1 · Local Open-Weight Worker | Ollama (Qwen, Gemma, Nemotron) |
Bounded single-file implementations, boilerplate refactoring, log/regex triage, and first-pass diff inspection on local VRAM. | No ambient credentials, no network mutations, explicit token/context cap. |
| Tier 2 · Blind Cross-Lineage Challenger | Independent model family (local or cloud) | Reads only git diff and acceptance criteria to surface logic bugs, citation drift, or missing edge cases. |
Zero tool calls; diff caged inside <untrusted_data>; max 2 rounds. |
| Tier 3 · Scoping Orchestrator & Human | Frontier reasoning model + maintainer | Multi-file architecture, task decomposition, verifying challenger findings against real code, and final pull-request merge. | Owns the diff; never claims 'verified' without command output. |
Act III — Planted-Defect Falsifiability & Untrusted Data Caging
Two lightweight guardrails prevent the two most common failure modes in automated coding pipelines—tautological tests and prompt injection through external text:
-
Skill Verifiers Must Fail Under a Planted Defect: A test script that prints
PASSwithout inspecting the computed state is worse than having no test at all. In this repository,skills/verify_all_48_folios.pydiscovers every standaloneverify_*.pyunderskills/, requires--planted-defectto fail, and parses the Python AST to reject trivial scripts that merely exit on the flag without running a computation; alongside it,toolchain/run_all_toolchain.pyre-runs all eight deterministic CAD generators (make_x01.py..make_x08.py), byte-level geometry verifiers, and claim gates. -
Untrusted Inputs Run with Zero Tool Authority: Whenever a model inspects fetched web pages, third-party documentation, or repository diffs, that payload is wrapped inside explicit
<untrusted_data>delimiters in a tool-free call. Embedded text can never invoke shell commands, read.envfiles, or push branches. - Bounded Escalation Instead of Infinite Retries: If a local worker fails deterministic checks twice on the same traceback, the loop stops burning tokens, records the exact failure signature, and escalates a minimal context packet rather than spinning in an ungrounded retry loop.
Act IV — Inspect the Verifiers & Companion Toolboxes
Every generator, byte-level mesh verifier, and HTML/CSP test suite described on this page is open for inspection and reuse in the public repository:
- Informatico.ai Open Repository: github.com/senseiewok/informatico.ai —
skills/verify_all_48_folios.py,toolchain/run_all_toolchain.py,tests/test_informatico_seo.py, anddeploy/check_upload.py. - Ollama Local Runtime Documentation: docs.ollama.com — running quantized open-weight models locally over HTTP with explicit context lengths (
num_ctx). - OWASP Top 10 for LLM Applications: genai.owasp.org — prompt-injection boundaries, least-privilege tool scoping, and deterministic output validation.