SDK / infra · #31 trending MCP repo · ↗ +214 stars this week

SreAgentHarness

rainyZhou2/SreAgentHarness

Self-hosted, multi-tenant agent harness for SRE incident diagnosis — risk-gated tool approvals, durable resumable runs, audit trail, model gateway, MCP tools, and a native desktop chat client. Written in Go.

Stars
224
This week
+214
Forks
11
Open issues
0
Last push
13d ago
Star trend · last 2 days+61 ★
Nov 27, 2026: 163 starsNov 28, 2026: 201 starsNov 29, 2026: 224 stars

Documentation

README

View on GitHub ↗

go-sre-harness

English | 简体中文

An enterprise-grade, long-running autonomous SRE Agent Runtime: one durable execution kernel carries long-lived goals, making every reasoning step, tool call and production change recoverable, auditable and verifiable.

Durable Agent Runtime · Continuous Work · Safe Production Execution · Verifiable Decision & Outcome

Desktop client: a diagnosis with its work log, tool calls and verified hypotheses

Core strengths · Desktop client · Quick start · Architecture · Agent runtime · Memory · Reasoning quality · Triggers & policy · Deployment · Configuration · API

Core strengths

  • Long-lived goals, not long-lived sessions: a Work is an independent durable aggregate with its own identity, generation, stages, budget and wakeup conditions. Waiting consumes neither a worker nor model tokens.
  • One kernel, one reliability contract: Runs, Steps and Attempts share claim, lease, fencing, checkpoints, outbox, budgets and recovery. Work orchestration and plugins do not create private execution kernels.
  • Safety before autonomy: one PolicyDecision contract covers Tools, MCP, Sandbox, Artifacts, Memory and Model Egress. Production Actions bind intent hashes, target versions, resource locks and approvals; unknown effects enter Inspect/Reconcile rather than blind retry.
  • Evidence, decisions and outcomes stay independent: Evidence records observations, DecisionVerdict provides the single adjudication, and Outcome verifies real-world effects. A successful tool call is not business recovery, and an agent majority is not evidence.
  • Database authority with recoverable delivery: state, domain events and outbox records commit atomically. JetStream/MQ only accelerates delivery; persistent cursors, source reconciliation and polling reconcilers cover disconnects, redelivery and loss.
  • Governed memory, authoritative facts intact: Memory carries provenance, versions, ACLs, validity, verification and conflicts. Historical experience proposes candidate plans; execution rechecks current World, Policy and Approval.
  • One domain contract for Local and Team: SQLite and PostgreSQL deployments share transitions, idempotency, safety and recovery semantics across Desktop, CLI, Web and SDK.
  • Modular monolith, capability-oriented extension: explicit state ownership and replaceable plugins provide independent scaling, least privilege and version compatibility without distributed scheduler complexity.
  • Measurable quality, governed evolution: traces connect Event → Work → Run → Action → Outcome. Datasets, read-only replay, non-inferiority gates, human approval, canaries and automatic rollback form one governance loop.

Core capabilities

Area Capability
Continuous autonomy Durable Works, Work Graph, generations, replanning, timer/event/approval wakeup, lifetime budgets and machine Outcomes
Durable execution Run/Step/Attempt state machines, leases and fence tokens, checkpoint recovery, effect ledgers and idempotent commits
Safe execution R0–R3 risk classes, unified security decisions, change windows, canaries, dynamic revocation, target preconditions and resource locks
Evidence & decisions Canonical reference resolution, orthogonal trust/quality/relation/independence, one DecisionVerdict and read-only replay
Cognition & orchestration Automatic Planner, ReAct, Flow DSL, parallel child Runs, read-only multi-agent collaboration, conditions/loops/approvals/human input
Model gateway Alias routing, circuit breakers, budgets, concurrency admission and safe fallback; Claude, OpenAI-compatible and Gemini
Context & tools Prompt Manifest, deterministic compaction, MCP/HTTP/Kubernetes/Prometheus/Sandbox, with all external content treated as untrusted data
Memory governance Full-text+vector+dependency recall, seven-state lifecycle, machine verification and human approval, ACLs, conflict revocation and embedding-version isolation
Events & recovery Durable Inbox, Transactional Outbox, Work Push, persistent cursors, source reconciliation, resumable SSE and read-only Replay
Plugin system Capability Descriptors, semantic-version compatibility, permission and data-class declarations, resource budgets, health checks and one Host lifecycle
Evaluation & evolution Real-Run datasets, offline replay, reasoning-quality scores, non-inferiority gates, canaries and automatic rollback
Clients Session/Turn/Branch, streaming, inline approvals and structured attachments; Desktop, CLI, Web and Go SDK share domain semantics

Desktop client

desktop/ is a native Wails client. It starts in Local runtime mode: the app launches a bundled SQLite-backed harness core, commits execution events and runtime state together in SQLite. No Docker, PostgreSQL, NATS or terminal is needed. Switch to Team server to use a shared harness. Sessions, streamed reasoning, tool-call cards, inline approvals, an approval inbox, a Works view for continuous Works, and model / MCP / HTTP tool / skill management are the same in both modes; local mode implements the same /api/extensions, command, checkpoint/fork, memory, graph and evaluation APIs. Commands are version-guarded and idempotent across restarts, cancelling a flow cascades to child runs, and compaction summaries, memory hits, checkpoints and step output revisions are persisted in the local store.

desktop/build.sh run

Screenshots

All screenshots are the local runtime with no model configured (the rule-based strategy).

Inline approval
Inline approval — a generated plan with side effects waits for review: risk class, plan hash, expiry and action hash
Approvals inbox
Approvals inbox — pending approvals from every chat, with a badge and system notifications
Gallery
Gallery — ready-made SRE skills (latency, error spikes, dependencies, rollouts…) added with one click
Graph
Graph — search the links between runs, steps, tools, memories and services

Answer cards

The final answer is shown as a card, not plain text, in both modes:

  • Markdown: headings, lists, code blocks, GFM tables, math (KaTeX) and mermaid diagrams. Raw HTML is never rendered (it shows as text). Links open in the system browser through OpenURL, which accepts only http, https and mailto. javascript:, file: and other schemes are not linked or opened, and links to files (.pdf, .csv, .json, …) get a type badge.
  • Structured attachments: submit_conclusion takes an optional attachments list of {type: table|image|link|file, title, caption, url | ref, mime_type, columns, rows}. The kernel validates the list before it reaches the run result (result.attachments). URLs must be absolute http(s) with no credentials. A ref must name an offloaded tool output of the same tenant (obs:step<N> resolves to its handle). Text and tables are capped (12 attachments, 20 columns × 200 rows), and anything else is dropped. Conclusions without attachments are unchanged.
  • Client rendering: a table becomes a scrollable card with Copy CSV. An image from a URL loads lazily with no referrer, and a stored image (PNG, JPEG, GIF or WebP only, never SVG) is fetched by the Go side and shown inline. A link becomes a tile with its host, and a file becomes a tile with name, type and size plus Open (URL) or Download (stored output, saved through a save dialog). The WebView never holds the API token. Exported chats include the attachments.
  • API consumers: attachments arrive in GET /api/runs/{id} (result.attachments) and in session messages (the assistant message's content is the result artifact). GET /api/runs/{id}/attachments/{index} (viewer) serves a stored attachment of that run's result. It serves only refs the kernel accepted, at most 32 MiB, with nosniff and a sandbox CSP, and always as a download except for an inline raster image.

Quick start

One command, no database (single user, SQLite, loopback only):

go run ./cmd/harness local

It creates its data directory and a private token on first run, prints how to call the API, and uses the built-in rule-based model unless ANTHROPIC_API_KEY, GEMINI_API_KEY or HARNESS_OPENAI_BASE_URL is set. web.fetch is available by default (HARNESS_LOCAL_WEB=off removes it); HARNESS_LOCAL_PROMETHEUS_URL adds read-only prom.query / prom.alerts. Flags: -data DIR, -addr HOST:PORT. A non-loopback address is refused unless HARNESS_LOCAL_ALLOW_REMOTE=true.

Day-to-day commands for local mode:

Command What it does
harness local init Choose a model provider, test the key with a read-only call (no tokens spent) and save it to <data>/local.env (mode 0600). The real environment always overrides the file.
harness chat Interactive chat in the terminal with inline approvals (/approvals, /approve N, /resume, --yes). Works against a team server too (-server, -token).
harness memory list | set KEY VALUE | rm KEY View and edit the personal memory the agent keeps about you (the desktop app has the same in its Memory view).
harness memory review | show ID | approve ID | reject ID [REASON] | archive ID Review what the agent proposes to remember (CANDIDATE and machine-verified VERIFIED memories). Human approval accepts VERIFIED memories and publishes them as APPROVED through the pinned-version endpoint. Semantic memories can be recalled as VERIFIED or APPROVED; procedural memories require APPROVED. Reject and archive revoke a memory, while STALE memories cannot be republished directly from the CLI. IDs may be shortened to a unique prefix.
harness memory curate | suggestions | apply ID | dismiss ID Look for memories worth setting aside and review the suggestions (see Memory curation). apply marks them STALE; restoration requires new evidence and fresh machine verification. dismiss keeps them and the same finding is not raised again.
harness compact-eval [-runs N] Measures what a compactor keeps from fixed investigation histories: key-fact recall, what the model is shown, citations, injection leakage. With no model configured it measures only the deterministic baseline and says the model-backed one was not run.
harness local doctor Checks the data directory, token, database integrity and schema, port, disk use, model keys and Prometheus. Exits 1 on a failure.
harness local backup [-out F] Consistent backup while running (database snapshot, event logs, artifacts). Tokens and API keys are never included.
harness local restore FILE Restores a backup; the previous data directory is kept as <dir>.before-restore-<time>. Credentials stay with the installation.
harness local prune [-older-than 30d] [-yes] Deletes old replay-only artifacts (full prompts, raw model responses, manifests). Results, steps, tool output, memories and event logs are kept. Dry run unless -yes.
harness version Build version.

Only one harness may use a data directory at a time (a lock refuses the second). The database records its schema version: an upgrade first copies the file to harness.db.v<N>.bak, and a database written by a newer harness is refused instead of being modified. With a real model configured, long investigations are compacted by a model-written summary (HARNESS_LOCAL_LLM_COMPACT=off keeps the deterministic one): citations (obs:stepN) are preserved, tool output is passed as data, and any model failure falls back to the deterministic summary. The kernel still appends the denied/failed/executed-action facts itself. The model is shown a salient excerpt of each long output (unusual lines and failure vocabulary, plus head and tail) rather than its first bytes, so a decisive line buried in a log still reaches it.

Releases. Pushing a v* tag publishes the command-line binary for linux/darwin/windows and the desktop app (macOS .dmg/.zip, Linux .tar.gz, Windows .zip) with SHA256SUMS.txt. The macOS app is ad-hoc signed, not notarized, and the Windows build is unsigned, so the OS asks for confirmation on first launch. Build locally with desktop/build.sh && desktop/package.sh (DESKTOP_VERSION=v1.2.3 sets the version).

Team server (PostgreSQL, multi-tenant). Requires Go 1.26+ and PostgreSQL 14+; NATS is optional.

createdb harness
HARNESS_DATABASE_URL=postgres://localhost/harness go run ./cmd/harness all

With a model:

ANTHROPIC_API_KEY=sk-ant-... HARNESS_DATABASE_URL=postgres://localhost/harness go run ./cmd/harness all

Demo (create a run → R2 approval → SSE → conclusion):

scripts/demo.sh "remediate high latency service=checkout"

The default dev authentication mode only listens on loopback addresses.

Architecture

CLI / Desktop / Web / Go SDK
              │ REST + SSE + Versioned Protocol
              ▼
┌──────────────────── Continuous Work Plane ───────────────────┐
│ Work Service · Template Catalog · Work Graph · Generation     │
│ Orchestrator · Replan · Wakeup · Reconciler · Outcome         │
└──────────────────────────┬────────────────────────────────────┘
                           │ Start / Resume / Cancel
                           ▼
┌──────────────────── Unified Durable Kernel ──────────────────┐
│ Run / Step / Attempt · Claim / Lease / Fence                  │
│ Checkpoint / Recovery · Budget · Idempotency · Outbox         │
└──────────────────────────┬────────────────────────────────────┘
                           │
             ┌─────────────┴──────────────┐
             ▼                            ▼
┌────────── Cognitive Runtime ──────────┐  ┌──────── Safety Executor ────────┐
│ Context · Planner · Model Gateway     │  │ Policy · Approval · Action Hash │
│ Multi-Agent · Tools · MCP · Memory    │  │ Resource Lock · Inspect · Effect │
└──────────────────┬────────────────────┘  └────────────────┬────────────────┘
                   └────────────────────┬───────────────────┘
                                        ▼
                    Evidence → DecisionVerdict → Outcome
                                        │
              SQLite / PostgreSQL · Artifact Store · Event Log
              Transactional Outbox → Optional JetStream / MQ

Architectural principles

  • One owner for each state: Work Service/Orchestrator owns long-lived goals, the Durable Kernel owns Runs/Steps/Attempts, Action Runtime owns production effects, Evidence Adjudicator owns decisions, and Outcome Evaluator owns effect verification.
  • Short claim transactions, fenced commits: execution happens outside the transaction; commit rechecks the lease and fence so stale workers and late results cannot overwrite current state.
  • Online state separated from event history: SQLite/PostgreSQL owns aggregates and ledgers; the Event Log provides audit, timeline, causality and controlled projections. MQ never changes business state directly.
  • One security control plane: Tool, MCP, Sandbox, Artifact, Memory and Model Egress share one decision contract. Side-effect commits revalidate audit, approval and revocation inside the database transaction. HARNESS_SECURITY_MODE supports legacy, shadow and enforce.
  • Modular Go Monolith: the kernel depends only on interfaces and never imports PostgreSQL, NATS or model SDKs. API, Worker and Scheduler can scale as separate roles without changing domain semantics or state ownership.
  • Zero production effects during replay: Workbench uses isolated stores and simulated executors, Eval writes to independent Artifact outputs, and the shared Guard admits only registered read-only projections with replay_read_only for production effects.

The Work control plane owns long-lived goals; the same kernel owns their Runs, Steps and Attempts. Work-owned Runs, including flow descendants, investigate through read-only tools. Production changes go through Action Runtime, which binds policy, approval and dispatch to the current Work generation. Run reservation, owner linking and activation retain separate durable recovery boundaries.

Templates may set repeat_from to a wait stage. After the machine goal passes its observation window, the control plane atomically records the completed generation's Outcome, increments the generation and installs the next wait. Lifetime Run, Action and cost budgets remain cumulative. inference-continuous supplies this pattern for inference TTFT events; each new generation needs its own approval. Unknown effects use read-only inspection and fall back to manual recovery. The automated WorkBench scenario in internal/workbench/testdata/sglang-continuous.json uses scripted metrics and an isolated executor for repeatable control-plane regression.

The inference-incident template runs a required Mitigation child Work and an optional, read-only RCA child Work concurrently. The caller supplies a machine recovery goal; Mitigation inherits it explicitly through inherit_success, while the parent independently verifies the same goal. Recovery and root-cause adjudication remain independent: RCA can continue while verified recovery stands on its own.

Decision Adjudicator v3 canonicalizes inputs and revalidates current ledger evidence before API, scorecard and postmortem consumption. Historical v2 decisions enter current semantics through replay and re-adjudication. Pause scheduling and decision writes, drain older workers, upgrade consumers and workers together, then resume. Rollback retains readers for existing v3 records. Pause repeating Works before rolling back to a version that does not understand repeat_from.

The SRE lifecycle loop

Observe → Evaluate Goal → Decide → Plan / Replan → Durable Run
       → Safe Action → Inspect → Outcome → Memory / Improvement → Wait
  • Mitigation and RCA are independent: separate child Works isolate production recovery from read-only analysis. Machine Outcome verifies recovery while DecisionVerdict expresses root cause, avoiding both “tool succeeded, therefore recovered” and “root cause found, therefore recovered.”
  • One factual foundation: Postmortem, WorkEval, API and UI consume the same DecisionVerdict, Action Ledger and Outcome. Models organize language rather than inventing conclusions outside the ledger.
  • Improvements close on evidence: Improvement Works link incidents to remediation and evaluate real effects through rule tests, stable SLOs, capacity targets or effective configuration.
  • Low-cost continuous operation: waiting, timers, state checks and observation windows do not call a model. A new Run starts only when reasoning, replanning or remediation is needed.
  • Domain capabilities stay outside the kernel: SRE, GPU, inference serving, observability sources and Action Adapters extend the runtime through Work Templates, Decision Profiles and Plugins.

Orchestration DSL

A profile can set strategy: "flow" and embed a flow graph. The DSL compiles to the existing step engine: the parent run only coordinates, while agent / tool / subflow nodes become child runs, so leases, fences, approvals, the effect ledger and checkpoint recovery are reused. Parallelism is carried by child runs and joined by a join node; a child inherits the parent profile and can only narrow its tools and permissions.

strategy: flow
tools: [demo.metrics, demo.restart]
max_steps: 40
flow:
  version: 1
  entry: triage
  limits: {max_steps: 20, max_children: 4, max_total_runs: 8, max_depth: 2}
  nodes:
    - id: triage
      type: agent
      role: triage
      tools: [demo.metrics]
      next: [{to: finish}]
    - id: finish
      type: end
      output: "${nodes.triage.output}"

Node types: agent / tool / subflow / parallel / join / approval / input / loop / end. GET /api/runs/{id}/flow returns node and child-run state; the provide_input command answers an input node. Built-in examples: sre-diagnosis@8 (parallel diagnosis + approval) and @9 (human input + subflow).

Generated plans

The desktop client does not ask you to choose a profile. An auto session starts with a durable plan step: the planner LLM submits a flow DSL through submit_flow; the server compiles it, runs a static safety/budget analysis, repairs malformed plans, and pins the plan as an artifact. A generated plan with side effects (or an R2/R3 tool) gets a plan review step whose approval binds the plan hash; changing the graph, inputs or tool set invalidates the approval. Only then is the flow step appended. If the model cannot produce a valid plan, the runtime falls back to the configured runbook (default sre-diagnosis@8) or ReAct. Generated plans, flow nodes, child runs, approvals and input gates are rendered in the conversation.

The planner treats its own inputs as untrusted: the goal, session history, capability lines and a failed attempt's node outputs are enclosed in <<<DATA>>> boundaries with chat-template tokens neutralized, and tool descriptions (which come from plugins and tenant MCP servers) that look like injected instructions are withheld from both the prompt and the tool schemas. Any such finding is recorded on the plan and forces a plan review of a generated flow, even with HARNESS_PLAN_APPROVAL=never. When a generated flow fails, the run is not failed straight away: up to HARNESS_PLAN_MAX_REPLANS times the planner is called again with the failure, the nodes that ran and the side effects that completed, and the new plan runs as a new flow generation (fresh state and child runs; the failed generation stays for audit, and its approvals do not carry over because the plan hash binds the generation).

Plans improve from earlier runs. A run that completes on a model-generated flow (not a fallback, no injection flag, not rejected, not disputed, not marked wrong) is distilled into a plan exemplar memory (scoped to the service, deduplicated by content) that follows the normal memory lifecycle; the planner is shown the closest APPROVED exemplars and reasoning patterns for the goal and services, as untrusted data. Each run records plan metrics (repairs, fallback, replans, review requested/rejected, injection, cache hit), and the canary and candidate gates compare fallback, repair, replan, rejection, success and injection rates against the baseline. Routing tries a hint, the requested mode and named actions, then the regex lists, then a classifier (an n-gram kNN over labelled example goals by default, or an embedding classifier; set ClassifierFirst to consult it before the regexes). Every generated or fallback flow is dry-run with simulated successful children before approval: a flow that cannot complete its default path within its own limits is repaired, and side-effect nodes reached without a prior approval are flagged. The plan review carries a readable summary, ordered steps, risks, the dry-run path, and a diff against the previous generation (replan) or the fallback runbook. Agent nodes without pinned tools are pinned to the read-only tools so their risk is not assumed to be the highest. Token estimates use a typical output size, with the worst case reported alongside. Plans without replan or injection flags are cached per tenant and inputs, and a cache hit is re-validated against the current tool catalog. A profile's planner section can tighten (never loosen) these settings per tenant: model alias or ladder, approval mode, node/call/token/repair/replan limits, and fallback rules by service or goal pattern.

Agent runtime

How a single agent run stays bounded, fast and contained.

Agent loop safeguards

  • Run budget: the kernel reads the run's model usage before each reasoning step. At 80% of HARNESS_RUN_MAX_COST_USD / HARNESS_RUN_MAX_TOKENS (or the profile's tighter run_limits.max_cost_usd / max_tokens) the model gets a [kernel notice] and a conclude-now instruction; at 100% the kernel writes the final answer itself (stopped in the result: the hypotheses and last tool results so far, marked UNVERIFIED) and skips the review, so a looping run cannot spend past its limit.
  • Parallel read-only calls: when one response asks for several tools, the extra calls run together with the first in a kernel-owned harness.parallel step (hidden from the model, refused if it calls it) when each is registered, visible, allowed without approval, read-only and not a repeat; at most max_parallel_tools. Each call becomes its own observation (obs:step<N>.<K>), and a call that fails or changed since planning fails alone. Calls left out (side effects, approval needed, duplicates) are listed in the step summary as deferred_not_run; side-effecting calls always go one at a time through the approval gate.
  • Tool errors as observations: a read-only call that fails permanently (bad arguments, missing resource, permission) becomes an outcome=error observation the agent can adapt to instead of failing the run; transient (retryable) errors still retry the step, and side-effecting calls keep the unknown-effect handling.
  • Repair feedback: an unusable response (no parseable tool call, schema-invalid arguments, an invalid decision, an unknown tool) is sent back to the model as a [correction] naming the problem (and the available tools) up to twice per attempt before the step retries; repairs are recorded in the step summary.
  • Loop and stall guard: an identical call (tool and canonical arguments) that already ran max_repeats times, or that was denied, rejected or expired, is not run again: it is recorded as a skipped step whose reason points to the earlier result. After stall_steps tool results without new content (repeats, errors, identical output) the agent is told to change approach; after twice that, a further tool call is replaced by a kernel conclusion.
  • Profiles set these per agent under run_limits (max_cost_usd, max_tokens, max_repeats, stall_steps, max_parallel_tools); they can only tighten the process settings.

Agent loop performance

  • Context rebuild: each reasoning step rebuilds its context from the run history, which keeps retries deterministic. Artifacts are immutable, so the worker caches the ones it writes and reads (LRU, HARNESS_ARTIFACT_CACHE_BYTES); a step reads only what is new. Steps of a run already chain inside one worker (up to 20 before handing back to the queue).
  • Prompt cache: the history section only grows between steps, so the request marks a cache breakpoint at its end (in addition to the system/tool prefix); the ledger, notices and instruction follow it. Providers with automatic prefix caching ignore the marker.
  • Tool selection: with more than HARNESS_TOOL_TOP_K visible tools the model sees a stable subset per run — tools used or loaded in the run, builtins, tools named in the request, then the best word matches with the request — and a [more tools] list of the rest, which it loads with harness.load_tools. The choice does not change from step to step, so the cached prefix stays valid; any visible tool is still accepted.
  • Model routing: with HARNESS_MODEL_ROUTINE_ALIAS / HARNESS_MODEL_ESCALATED_ALIAS the first analysis, likely or forced conclusions, stalls, the step after a rejected conclusion and repairs use the escalated alias, the other steps the routine one (model_tier in the step summary). A flow node's own alias takes precedence.
  • Adaptive stop: when the ledger settles (a VERIFIED hypothesis at ≥ 0.8 and no competing hypothesis open) the agent is advised to conclude, before the step budget or the stall guard would intervene.
  • Token-budget compaction: besides every N tool steps, history is compacted when the uncompacted results exceed HARNESS_COMPACT_TOKENS (then all but the newest result are folded). The default compactor (deterministic-v2) writes one line per result led by its citable ref and renders large JSON objects as their top-level fields; compacted refs, including batch parts, stay citable.
  • Speculative read-only calls (HARNESS_SPECULATIVE_TOOLS): as each tool call completes in the model's stream, a call that is visible, read-only, allowed without approval and not a repeat starts at once; the tool step that runs the same call (same version, risk and arguments) takes the result. Unused results expire after two minutes; side-effecting calls are never started early.
  • Observability: every step summary carries timings_ms (queue, context, model, review, tool), exported as harness_step_phase_seconds{kind,phase} together with commit time; harness_agent_loop_events_total{event} counts repairs, loop guards, notices, batches, convergence, routing, compaction, speculation and artifact-cache hits. The run result carries loop (steps, model requests, tokens, cost).

Sandbox

harness.sandbox.exec runs a command (command for sh -c, or argv) in the run's sandbox: input files are written into /workspace, which persists across the run's calls and is never shared with another run or tenant, and the listed outputs are returned with exit code, stdout and stderr. It is for computing over data the agent already has; production changes still go through typed tools and approval.

  • Safety floor: no harness environment or credentials (only variables the request sets), network none, read-only root file system, non-root user, all capabilities dropped, no-new-privileges, CPU / memory / process / time / output limits. Workspace files are read and written through os.Root, so a symlink planted by the command cannot reach host files. Results are untrusted (T4) and the tool is R0, so it needs no approval; it is never started speculatively.
  • Backends (sandbox plugin kind): container runs a fresh docker or podman container per call (extra_args: [--runtime=runsc] for gVisor). The server enables it with sandbox: {name: container, config: {...}} (see deploy/harness.example.yaml); the desktop runtime with HARNESS_SANDBOX_RUNTIME=docker|podman and optional HARNESS_SANDBOX_IMAGE (default python:3.12-alpine). Workspaces untouched for workspace_ttl (24h) are removed. When the harness itself runs in a container, root must be a path the container daemon can mount.
  • MCP stdio servers no longer inherit the harness environment: they get basic variables (PATH, HOME, locale, temp directory) plus their configured env; a bare KEY in an operator's config passes that variable through, which tenant-installed servers cannot do.

Memory

What the agent remembers, for how long, and how memories are kept current.

Memory tiers

Tier Lifetime What it holds Written by
Working one run the agent's notes: established facts, constraints, what is left to check; plus the hypothesis ledger notes with scope run
Short-term one conversation (branch) the last HARNESS_SHORT_TERM_MESSAGES messages verbatim, a digest of older turns, and session notes notes with scope session
Long-term the tenant incidents, remediations, reasoning patterns, plan exemplars, proposed facts (organization / service / incident scopes) the consolidator, operators, notes with scope long_term (as CANDIDATE)
Personal one user stable preferences of the user who started the run (language, format, defaults) notes with scope user, or the user via /api/me/memories
  • Notes: the agent writes memory in its THOUGHT line or its conclusion as "notes":[{"key","value","scope"}]; writing a key again updates it, an empty value deletes it. The kernel rebuilds notes from the stored decisions, so they survive retries and compaction, and renders them in a [working memory] section inside a data boundary. A tier holds at most 24 notes of 500 characters.
  • Short-term: the session notes after a run are stored in its result (memory.session); the next turn on the same branch starts from the latest completed turn's notes, so a forked branch sees only its own history.
  • Personal: when a user-started run completes, its user notes create, reinforce, revise or revoke that user's memory for each key (pref:<key>, APPROVED, restricted). Owner-scoped semantic preferences use a separate publishing path; other memories cannot use it to bypass machine verification and human approval. Personal memory is rendered in an [about the user] section only for that user's runs; shared retrieval and other users never see it. A preference never authorizes an action. Users manage theirs with GET /api/me/memories, PUT|DELETE /api/me/memories/{key}.
  • Long-term from the agent: long_term notes of a completed, undisputed run become CANDIDATE memories with subject note:<key>. A trusted machine principal writes an immutable verification record for a pinned version through /verify and moves it to VERIFIED; an approver then publishes it as APPROVED through /approve with expected_version. Semantic memories can be recalled as VERIFIED or APPROVED, while procedural memories require APPROVED. CONTESTED, STALE, REVOKED and SUPERSEDED memories are excluded from recall.

Updating memory

  • Reinforcement instead of duplicates: writing the same content again in the same scope, or a near-identical memory with the same subject (embedding cosine ≥ 0.95, or token overlap ≥ 0.85 without a comparable embedding) that is at least as validated, counts a reinforcement on the existing memory (reinforcements, last_reinforced_at, merged source_refs) when it comes from a new source. Reinforced memories rank slightly higher (up to ×1.3).
  • Revisions: PATCH /api/memories/{id} (approver; expected_version, title and/or content, reason

…