Sensor Engineering: Fast Feedback Loops & ACI Design

Sensors & Guardrails • 8-12 min read • Reference Standard

Abstract:
Autonomous coding agents do not write perfect code on the first attempt; their real capability lies in closed-loop self-correction. However, self-correction requires high-signal, deterministic feedback. Exposing an agent to raw human-oriented terminal logs—overflowing with ANSI formatting, thousands of irrelevant lines, and unstructured error traces—causes hallucination and thrashing. This article analyzes the principles of Sensor Engineering and Agent-Computer Interface (ACI) design (pioneered by SWE-agent, arXiv:2405.15793), contrasts open-ended agent loops with structured pipeline repair (Agentless, arXiv:2407.01489), and details how to build sub-5-second verification sensors.


1. The Human Interface vs. The Agent-Computer Interface (ACI)

For fifty years, developer tooling was optimized for human eyes: colored terminal output, interactive pagers, visual spinners, and multi-page stack traces. When fed to an LLM, these interfaces degrade reasoning:

┌─────────────────────────────────────────────────────────────────────────────┐
│                       HUMAN UI VS. AGENT ACI COMPARISON                     │
├──────────────────────────────────────┬──────────────────────────────────────┤
│ Human Developer Interface            │ Agent-Computer Interface (ACI)       │
├──────────────────────────────────────┼──────────────────────────────────────┤
│ • ANSI color escape codes (\033[31m) │ • Clean, unformatted ASCII or JSON   │
│ • Interactive prompts (y/N)          │ • Strictly non-interactive execution │
│ • 2,000-line verbose stack traces    │ • Filtered top-3 actionable frames   │
│ • Full file dumps in less/vim        │ • Windowed line ranges [L120-L150]   │
│ • Ambiguous natural language errors  │ • Explicit file, line, col, and rule │
└──────────────────────────────────────┴──────────────────────────────────────┘

In SWE-agent: Agent-Computer Interfaces Enable Automated Software Engineering (Yang et al., Princeton, arXiv:2405.15793), the authors demonstrated that designing custom command interfaces specifically for LLMs increased software issue resolution from under 4% to over 12% on SWE-bench without altering the underlying model weights.


2. Structuring Actionable Error Diagnostics

When a compiler or test runner fails, the sensor must translate the raw output into a structured diagnostic object before injecting it back into the model context:

Bad (Raw Terminal Output Injected into Prompt):

npm test
> app@1.0.0 test
> jest

FAIL src/auth/jwt.spec.ts (14.2s)
  ● JWT Verification › should reject expired token

    expect(received).toBe(expected) // Object.is equality

    Expected: 401
    Received: 500

      34 |     const res = await request(app).get("/protected").set("Authorization", expiredToken);
      35 |     expect(res.status).toBe(401);
         |                        ^
      at Object.<anonymous> (src/auth/jwt.spec.ts:35:24)
      ... 45 lines of internal jest and node_modules stack frames ...

Good (ACI Filtered Sensor Diagnostic):

{
  "sensor": "unit_test_failure",
  "target_file": "src/auth/jwt.ts",
  "test_file": "src/auth/jwt.spec.ts",
  "failed_assertion": {
    "line": 35,
    "expected": 401,
    "actual": 500,
    "message": "Expected 401 Unauthorized for expired token, but endpoint returned 500 Internal Server Error."
  },
  "relevant_code_slice": {
    "file": "src/auth/jwt.ts",
    "lines": "84-96",
    "code": "84:   const payload = jwt.verify(token, secret);\n85:   if (!payload) throw new Error('Invalid');"
  },
  "suggested_action": "Verify exception handling in src/auth/jwt.ts around line 84: TokenExpiredError throws an unhandled exception resulting in a 500 response instead of returning a 401."
}

By removing 90% of the token clutter and highlighting the exact line of code and root cause, the probability of the agent fixing the bug on the next turn increases dramatically.


3. Sub-5-Second Sensor Hierarchy

Autonomous self-correction requires rapid iteration loops. If an agent must wait 3 minutes for a test suite to run after every minor edit, token budgets and wall-clock times explode.

Production harnesses implement a Cascading Sensor Hierarchy:

                         CASCADING SENSOR HIERARCHY

     Agent Patch
          │
          ▼
    ┌───────────┐    Fail (<50ms)
    │ L1 Sensor ├──────────────────► Fast AST / Syntax Check (Ruff, Oxlint)
    └─────┬─────┘
          │ Pass
          ▼
    ┌───────────┐    Fail (<1.5s)
    │ L2 Sensor ├──────────────────► Incremental Type Check (tsc, mypy, cargo check)
    └─────┬─────┘
          │ Pass
          ▼
    ┌───────────┐    Fail (<4s)
    │ L3 Sensor ├──────────────────► Test Impact Analysis (TIA - Only affected tests)
    └─────┬─────┘
          │ Pass
          ▼
    ┌───────────┐    Fail (Pre-Merge CI)
    │ L4 Sensor ├──────────────────► Full Repository Integration Suite
    └───────────┘

Test Impact Analysis (TIA)

Instead of executing pytest or npm test across the entire repository (which could run for 10+ minutes), the harness analyzes the Git diff against the project's dependency graph: * If the agent modified user_service.py, the sensor inspects the import graph and executes only test_user_service.py and test_auth_flow.py. * Latency reduction: 95% reduction in test cycle time, enabling 10+ autonomous correction cycles per minute.


4. Open-Ended Loops vs. Pipeline Architectures: Agentless

A major empirical insight from UIUC researchers in Agentless: Demystifying LLM-based Software Engineering (Xia et al., arXiv:2407.01489) was that open-ended, autonomous agent loops often over-complicate tasks:

Open-Ended Agent Loop (SWE-agent / AutoGen)
[Think] ──► [Tool Call] ──► [Observation] ──► [Think] ──► [Tool Call] ──► ... (Unbounded, High Drift)

Structured Pipeline Architecture (Agentless)
Phase 1: Localization ──► Phase 2: Patch Generation ──► Phase 3: Sensor Verification
(Strict State Gates, Deterministic Step Control, Drastically Lower Token Cost)

When to Use Which Paradigm?

  1. Pipeline Repair (Agentless Style):
  2. Optimal for isolated bug fixes, issue resolution, and targeted vulnerability patching.
  3. State transitions are deterministic; the model cannot wander into unrelated files.
  4. Autonomous Agent Loop (SWE-agent / OpenHands Style):
  5. Necessary for multi-file greenfield feature development, architectural migrations, and complex exploratory refactoring where the path to the solution cannot be statically planned.

A mature harness often combines both: using an autonomous loop for discovery, but locking into a rigid pipeline once candidate files and reproduction tests are identified.


5. References & Further Reading

  1. Yang, John; Jimenez, Carlos E.; Wettig, Alexander; et al. (Princeton University, 2024). "SWE-agent: Agent-Computer Interfaces Enable Automated Software Engineering", arXiv:2405.15793.
  2. Xia, Chunqiu Steven; Deng, Yinlin; Zhang, Lingming (UIUC, 2024). "Agentless: Demystifying LLM-based Software Engineering", arXiv:2407.01489.
  3. Jimenez, Carlos E. et al. (2024). "SWE-bench: Can Language Models Resolve Real-World GitHub Issues?", arXiv:2310.06770.
  4. Böckeler, Birgitta (Thoughtworks, 2026). "Designing Sensors for Autonomous Development Loops".

Subscribe to Future Research Briefings

We haven't launched yet. But leave your email to get notified about exciting things that we will launch.