NextMachinNEXTMACHIN
Architecture · Agentic OS

The company agentic OS architecture

Most AI projects end as brittle demos because they automate on stale data. The fix is not another agent - it is an operating system that keeps data true in real time, gates every operation by confidence, and compiles proven reasoning into cheap, deterministic reflexes.

Marek Maly
Marek Maly
AI Consultant, NextMachin
Jul 2026 · 18 min read

Most AI projects start with a list of agents and end as brittle demos. The cause is structural: automation built on incomplete, stale data fails no matter how good the model is - and most systems of record are exactly that, because they depend on humans remembering to log things. Logging is friction, and friction loses to deadlines every day.

The fix is not another agent. It is an operating system built on two ideas: a pipeline for structure, and a dual-process control model for doctrine. The pipeline is what you deploy - capture, contextualize, sync, execute, query. The control model is how it behaves at runtime: every operation routes to either a fast deterministic path or a slower reasoning path, and a learning loop continuously converts the second into the first.

Fig 1 - The nine-layer agentic OScapture ↓ · learn ↑
1
Event capture
email · meeting transcripts · chat — push-based, per-source refresh cadence
2
Ingestion gateway
canonical event ID · dedup · one durable execution per event
3
Clean & distill
strip noise · extract question/summary/resolution/entities · raw kept immutable
4
Data store
events · entities · work items · knowledge index · workflow state · decisions log · rules catalog
5
Resolver (S1/S2 router)
rules → retrieval scoring → reasoning → confidence gate → act │ escalate · every route logged
6
Sync adapters
idempotent outbox writes to CRM / project mgmt / case mgmt
7
Workflow engine
durable state machines · signals · timers · human approval gates
8
Knowledge layer ("second brain")
hybrid search · query tools · chat · projects & access control
9
Learning loop
decisions → evals → promote reasoning into rules · S1:S2 ratio = health metric
Events enter at the top and flow down through the write path; the read and improvement paths close the loop. Colour marks which of the three paths a layer serves.
Layers 1–7
Write path

Events keep the source of truth accurate.

Layer 8
Read path

Everything captured becomes queryable.

Layer 9
Improvement path

The system gets cheaper the longer it runs.

The doctrine in one paragraph

Every operation - an inbound email, a chat thread, a human question, a workflow's mid-run request for context - passes through the resolver, which determines intent and confidence cheaply: rules first, retrieval second, a model only if those fall short. Above the threshold, System 1 executes at zero reasoning cost. Below it, or where judgment is inherently required, System 2 reasons - and when it isn't confident, it escalates to a human carrying ranked proposals, never a blank question. The resolver is a shared component, not a central “brain” service everything must transit - that would be a single point of failure dressed up as an architecture.

1 · 2

Capture

Nearly everything worth knowing originates in three channels - email, meetings, chat. Everything else announces itself through one of them: the signed contract arrives as a notification, the decision surfaces in a transcript. All three are captured push-based, never polled; meeting bots produce speaker-attributed transcripts triggered off calendar events, and chat is stored at thread granularity - every reply re-fetches parent and siblings into one record, so content and participants always reflect the full conversation.

The gateway verifies every inbound signature, then computes a canonical ID from stable protocol identifiers - message ID for email, thread ID for chat, recording ID for meetings. Insert with a unique constraint on that ID; a conflict means duplicate, drop it - one constraint solves the email five teammates received. Each accepted event starts exactly one durable execution keyed by that ID: exactly-once processing, retries, and replayable history come from the execution model, not custom bookkeeping. Ingestion makes no decisions; its contract is capture everything, lose nothing, normalize, hand it on.

3

Distill

Raw payloads land in immutable storage; every derived artifact points back to its source. Cleaning strips reply chains, signatures, and noise; attachments become text; transcripts are chunked by speaker. Distillation extracts a fixed schema from every thread and transcript - the one-line question someone would search for, a summary, the resolution, and the people, systems, and work items referenced - and the distilled form, not the raw text, is what gets embedded; normalizing input measurably improves retrieval.

Inside long threads, high-signal bursts - consecutive runs from one author - are indexed individually when they clear signal gates: a rare token, ~200+ characters combined, or reactions as social proof. The answer buried in message 47 stays findable; “sounds good, thanks!” never reaches the index.

Note the taxonomy: distillation calls a model but is System 1 - extraction on a fixed schema, no judgment, no confidence to assess. The line is drawn at decisions, not at model usage.

4

Store

One store holds the operational state, with raw payloads in object storage alongside. The schema is small and deliberately explicit:

events

canonical ID, channel, raw reference, cleaned body, distilled fields, participants, timestamps, processing status

entities

people and organizations, with external IDs per platform; the email address is the natural join key

work items

polymorphic across deal, project, case, or candidate — platform, external ID, status, and a payload for platform-specific fields

event–work item links

the match itself, with confidence and the method that produced it (rule, retrieval, model, or human)

workflow instances / checklists

execution and audit state, down to individual checklist items

decisions

every routing decision the system has ever made

rules catalog

registered deterministic triggers, thresholds, and targets — versioned, so every change is auditable and reversible

Recording the method alongside every match is what later lets you measure which layer of the cascade is carrying the load, and where reasoning is being spent unnecessarily.

5

Resolve

Matching an event to the work it belongs to and routing any other operation are the same mechanism. One cascade, cheapest first.

Fig 2 - The resolver cascade
1
Rules

Linked thread, unique sender-domain mapping, explicit identifier, registered trigger. By design, most volume terminates here.

confidence 1.0 · zero reasoning cost
2
Retrieval scoring

Hybrid search ranks candidate work items and running workflows, biased toward active work.

ranked candidates
3
Reasoning

Only if needed: a schema-validated verdict. Never free text — the schema is the contract.

{ target, confidence, is_new, rationale }
4
Confidence gate

Per intent type, tunable, ~0.85 to start. Above: act. Below: escalate with ranked proposals — the human picks instead of researches.

act │ escalate → labeled ground truth

Every resolution writes one row to the decisions log - input, candidates, route, output, outcome. That single uniform table makes the system auditable, debuggable, and improvable; cheap to build on day one and painful to retrofit later.

Concretely, System 1 covers rule hits, index lookups, memory reads through the query tools, and idempotent memory writes - none spending reasoning. System 2 covers ambiguous classification, multi-step planning and synthesis, generation behind approval gates, and judgment calls inside the audit (“was the client properly informed?”). Reasoning always runs inside a workflow step, so retries, timeouts, and tracing wrap it rather than being reinvented around it.

6 · 7

Execute

Real processes wait. Each workflow is a long-lived state machine: events reach running instances as signals (“here are my available dates” wakes the scheduling workflow), waiting is native via timers, and approvals are gates held open for weeks without polling or lost state. Steps mix deterministic activities, reasoning activities, approval gates, and post-completion hooks freely - production systems are never all-AI or all-rules.

External writes go through an idempotent outbox - enqueued, retried, replay-safe - so a third-party outage never loses an update and a replay never duplicates one. The master store starts as a mirror of the client's platforms and becomes the source of truth as accuracy is proven; consolidating the tech stack then becomes a choice, not a gamble.

Build the audit workflow first

A daily run over active work items against an explicit checklist extracted from SOPs and heads. It catches slippage, validates data quality (people instantly protest wrong checkmarks - free labels), and generates the automation backlog: every checklist item is a candidate workflow, and you now know how humans complete it today.

8

Query

The write path keeps records accurate; the knowledge layer makes everything ever captured queryable. Its principle: meet data where it lives - operational state converges into one store, while knowledge is extracted from wherever it's generated into one queryable surface. Everything lands in one index with a shared row schema: source, distilled text, embedding, full-text vector, entities, work-item links, per-row access control. New sources join via plugin connectors emitting that shape - whatever writes the shape is instantly queryable.

Retrieval fuses four scorers

Lexical

For literal identifiers — error strings, case numbers a paraphrase would lose.

Semantic

For paraphrase — the answer worded nothing like the question.

Rarity weighting

A short message built around an uncommon term outranks pleasantries.

Recency decay

Operational answers expire — last month’s status is not this month’s.

None survives real data alone, so ranked lists merge by reciprocal rank fusion - each contributes weight / (constant + rank), so consensus across scorers beats one strong vote - then duplicates collapse to source, the top twenty pass through a reranker down to ten, and winners are expanded with neighboring context so evidence never arrives as an orphan paragraph missing its preconditions.

The primitives are model-free query tools - search, per-source summaries, work-item context, “who knows about X” (expertise derived from participation, no profiles to maintain). One engine, three callers: the resolver ranking candidates, workflows pulling context mid-run, and humans in chat. Search is scoped by projects - named source bundles per team - enforced by per-row access control plus a membership check at query time, with every question written to the audit log.

9

Learn

The decisions log closes the loop - the same automatization as human cognition, where practiced reasoning becomes reflex. Decisions become labeled eval sets; prompts are treated like code with regression tests. Patterns resolved identically and verifiably are promoted into the versioned rules catalog - a sender domain classified the same way fifty times becomes a deterministic rule. Thresholds drop per intent only when evals prove accuracy holds; every promotion is reversible, nothing is tuned by vibes.

Headline metric — the S1:S2 ratio

The share of operations resolved deterministically at near-zero cost, tracked per intent type. That curve climbing toward ~99% is the company becoming AI-native, measurably - and the structural answer to runaway AI spend: reflexes make volume free, distillation keeps prompts short, expensive reasoning runs only where judgment pays.

+

What runs across all of it

Observability

Every model call is traced with cost, latency, and prompt version; the decisions log plus durable execution history give a fully replayable audit of every route ever taken. Spend is measurable per workflow, per client, per intent — which makes the S1:S2 ratio a dashboard number, not a slogan.

Model routing

A gateway in front of all model calls lets cheap models handle distillation, classification, and planning, while stronger models are reserved for synthesis and high-stakes judgment. Because inputs arrive pre-contextualized and distilled, prompts stay short by construction.

Isolation

Each client gets its own stack and store; projects scope search within a client, separate stacks isolate between them. Credentials live in a secrets store, inbound webhooks are signature-verified, and every automated write is logged alongside the decision that caused it.

Order of operations

Foundation first - capture, dedup, clean, contextualize, sync, plus the decisions log and rules catalog from day one; value lands before any agent exists. Then reasoning and evaluation behind the confidence gate, with the client's own team labeling in the review inbox. Then the audit - visibility, validation, backlog. Then the query surfaces, so humans, workflows, and agents share one memory. Then workflows, one at a time, each retiring a checklist item, while the promotion loop compiles reasoning into reflexes.

Skip the foundation and you get a demo that impresses for two weeks and quietly gets abandoned. Build it, and every next capability lands on accurate data, durable execution, and a control model that already knows how to route it. That is the difference between buying AI tools and running an agentic operating system.

Written by
Marek Maly
Marek Maly
AI Consultant, NextMachin