Architecture

Alfred has three independent capabilities: Workspace, Memory, and Agent Harness. Agent Harness is shaped by a harness-agnostic core, deny-by-default security, and evals-as-gate. This page explains why it is built the way it is, and what that means for your agents and skills.

Capability composition

The neutral packages/cli routes commands to public capability entrypoints. Workspace, Memory, and Agent Harness do not import each other's implementations or require peer services. Optional connections use explicitly configured public contracts. Selecting components does not wire credentials, MCP, or a session runtime.

Workspace owns SessionPort/SessionAdapter; Memory owns its persistence APIs; Agent Harness owns agent operations and harness integration. See Product capabilities for current implementation limits.

Hexagonal architecture

The Agent Harness family is split into a core and a set of adapters. The rule is enforced by the build, not by convention:

Domain-driven design

The domain lives in .ai/domain/model.md. Entities, value objects, use cases, and ports are written in plain markdown so the agents themselves can read them.

The vocabulary is fixed:

The architecture kernel

Every agent reads the same kernel file at the top of its prompt. The kernel pins the rules the LLM cannot negotiate:

kernel
# Alfred kernel (excerpt)
1. Local-first. Deterministic local work before any provider call.
2. Deny by default. Protected paths require human approval.
3. No self-escalation. Agents do not broaden their own permissions.
4. Trace everything. Emit a TraceEvent per operation.
5. Evals gate everything. Run regression suite before declaring done.
6. Skills are lazy. Activate by trigger, never by file presence.
7. Specialists are temporary. Promotion requires a human.

Package layout

FamilyPackagesResponsibility
Compositioncli, setup UILazy command dispatch and approved capability preparation.
WorkspaceworkspaceProjects, conversations, local tools, web assets, session contracts.
Memorymemory, memory-server, clients, MCP, console, adaptersIndependent persistence domain and local service.
Agent Harnessagent-harness, core, managers, harness adapters, evalsAgent operations; adapters depend on core, never the reverse.

The legacy launcher paths under Memory are compatibility shims only. Standalone Memory does not import those product shims.

Everything is a trace

Every meaningful operation writes a TraceEvent into .ai/observability/generated/. The trace log is the source of truth for debugging, replaying, and reviewing agent behavior.

.ai/observability/generated/2026-06-30.jsonl
{"ts":"2026-06-30T18:02:11Z","kind":"provider.request","agent":"developer","decision":"local-only","avoided_cost_usd":0.002}
{"ts":"2026-06-30T18:02:14Z","kind":"permission.request","path":".ai/policies/security.md","decision":"deny","actor":"human"}
{"ts":"2026-06-30T18:02:18Z","kind":"eval.run","suite":"default","passed":14,"failed":0,"vs_baseline":"regression-safe"}

Local-first in practice

Before any provider call, Alfred's ProviderRequestPolicy runs a deterministic checklist:

  1. Can a local capability answer this?
  2. Can preprocessing reduce the payload?
  3. What is the estimated token / cost impact?
  4. Emit local-only, hybrid, or provider.
  5. Trace the decision, including avoided cost.

Security, summarized

Next step: Agents & subagents to see the panel in detail, or Security model for the full policy reference.