Why Your Agent Needs
a Cognitive Primitive

LLMs are good at reasoning. They're bad at reading.

Here's a six-section construction specification. Your agent needs to read it and figure out what matters. Go:

## 1. Scope of Work The Contractor shall provide all labor, materials... per ACI 318-19 and ASTM C150-22. ## 2. General Information This project is located at the corner of Main Street... The architect of record is Smith & Associates. ## 3. Structural Requirements Maximum allowable soil bearing pressure shall not exceed 4,000 psf... ASTM A615, Grade 60. ## 4. Safety Requirements All work shall comply with OSHA 1926 safety standards. Workers must wear hard hats, safety glasses... ## 5. Payment Terms Retainage of 10%... Liquidated damages of $2,500 per calendar day... ## 6. Background For reference, similar projects in the region have typically required 8-12 months for foundation work.

A raw LLM will read all six sections with equal attention. It will spend the same amount of compute on "The architect of record is Smith & Associates" as it does on "Liquidated damages of $2,500 per calendar day." It will treat the background section with the same importance as the safety section.

This is the fundamental problem. Your agent reads everything equally because it has no structure to tell it what matters.

What a cognitive primitive is

A CPU doesn't reason about data. It has primitives: ADD, COMPARE, LOAD, STORE. High-level thinking is composed from these low-level operations.

AI agents work the same way. Your orchestration layer — LangChain, CrewAI, raw API calls, whatever — composes from primitives. The usual ones: retrieve, summarize, generate, classify. But there's one missing from the stack.

Decomposition: splitting raw text into classified, prioritized semantic units before reasoning begins.

This isn't summarization. Summarization loses information. It's not retrieval. Retrieval requires a query. It's not classification in the ML sense. There's no model, no training data, no probabilities.

It's structural analysis. The same document goes in. Classified units come out. Every time. In 4 milliseconds.

What decomposition looks like

That six-section spec above? One function call:

from decompose import decompose_text result = decompose_text(spec_text) # ~14ms avg, 6 units

Here's what your agent sees instead of 2,045 characters of raw text:

4. Safety Requirements
8.0
5. Payment Terms
3.0
1. Scope of Work
2.0
3. Structural Requirements
0.6
2. General Information
0.4
6. Background
0.1

Section 4 scored 8.0. Section 6 scored 0.1. Your agent now knows which 30% of the document to send to the LLM and which 70% to skip.

Why Safety scored 8.0

Four words triggered it: shall (mandatory authority), must (mandatory), required (mandatory), and comply (compliance risk). The attention formula is straightforward:

authority_weight = 1.0 # mandatory: 4 pattern matches risk_multiplier = 2.0 # compliance category attention = min(10.0, auth_score × risk_mult) = min(10.0, 4.0 × 2.0) = 8.0

No machine learning. No embeddings. The word "shall" has meant "mandatory" since RFC 2119 was published in 1997. It means the same thing in a building spec, a software spec, and a procurement contract. Regex is the right tool here.

Why Background scored 0.1

No mandatory keywords. No risk indicators. One "permissive" match from generic language. The attention formula bottoms out:

authority_weight = 0.35 # permissive risk_multiplier = 0.3 # informational attention = 0.35 × 0.3 = 0.1

"Similar projects in the region have typically required 8-12 months." That's useful context, but it's not an obligation, not a risk, and not something your agent needs to act on. Attention: 0.1.

What else the primitive extracts

Attention is the headline, but each unit carries a full classification:

Unit 5 — Payment Terms
authority: mandatory risk: financial attention: 3.0 actionable: true irreducible: true entities: [] dates: ["December 31, 2026"] financial: ["$2,500", "10%"] irreducibility: SUMMARIZABLE → Deadline, dollar amount, percentage. All extracted. All typed.
Unit 3 — Structural Requirements
authority: mandatory risk: informational attention: 0.6 actionable: true irreducible: true entities: ["ASTM A615"] dates: ["January 15, 2026"] financial: [] irreducibility: PRESERVE_VERBATIM → "4,000 psf" and "4,000 psi" are engineering values. Cannot paraphrase. PRESERVE_VERBATIM.

Notice the structural requirements unit: low attention score (0.6) but marked PRESERVE_VERBATIM. Your agent might skip this unit for initial triage, but if it ever summarizes the document, it knows: do not paraphrase "4,000 psf." That number is irreducible. Getting it wrong kills people.

How this changes agent architecture

Without a decomposition primitive, your agent pipeline looks like this:

document → chunk → embed → retrieve → LLM → answer # Every chunk treated equally. # The LLM decides what matters. # 100% of tokens go to the model.

With decomposition:

document → decompose → route → LLM → answer # Each unit has authority, risk, attention. # High-attention units go to the model. # Low-attention units get skipped or summarized. # ~30% of tokens go to the model.

The difference isn't just efficiency. It's correctness. Three things change:

1. Attention allocation

Instead of the LLM deciding what to focus on (which it does poorly for technical documents), the attention scores pre-allocate compute. Safety-critical content gets processed. Background doesn't. Your agent acts like an experienced engineer who knows which sections of a spec to read first.

2. Irreducibility awareness

When a unit is marked PRESERVE_VERBATIM, your agent knows not to summarize or paraphrase it. "4,000 psf" stays "4,000 psf" — it doesn't become "about 4,000 psf" or "approximately 4 kips per square foot." This is the difference between a useful tool and a liability.

3. Entity-aware routing

Decompose extracts every standards reference (ASTM, ASCE, IBC, OSHA), every date, every dollar amount. Your agent can route by entity type: send OSHA references to a safety compliance chain, send financial values to a payment audit chain, send ACI references to a structural analysis chain. No embedding similarity search required. Just pattern matching on structured metadata.

What this is not

Decompose is not a replacement for LLMs. It's a preprocessor. Some things it explicitly cannot do:

This is the point. Your LLM handles nuance, cross-referencing, intent, and domain reasoning. Decompose handles everything else — the mechanical work of splitting, classifying, scoring, and extracting — so the LLM can focus on what it's actually good at.

Why it has to be deterministic

Imagine an agent processing safety compliance documents. Run it Monday, it flags section 4 as safety-critical. Run it Wednesday, it classifies the same section as "advisory" because the LLM was slightly more creative that day.

That's not a tool. That's a coin flip.

Decompose returns the same output for the same input. Every time. There's no temperature knob, no sampling variance, no model drift. If "shall" matched mandatory yesterday, it matches mandatory today. If section 4 scored 8.0 in production, it scores 8.0 in your test suite. You can write assertions against it. You can audit it.

For industries where documents have legal weight — construction, healthcare, defense, finance — determinism isn't a nice-to-have. It's table stakes.

The primitive pattern

The broader point: agents need more primitives, not more parameters.

The current trajectory of AI tooling is: make the model bigger, give it more context, add more retrieval. This works, until it doesn't. A 200K context window doesn't help if 70% of the tokens are background noise. RAG doesn't help if the embeddings can't distinguish a mandatory requirement from an informational note.

Primitives help because they operate at a different layer. They don't compete with the LLM — they feed it. A well-decomposed document makes every model work better: smaller context, higher signal, structured metadata to route on.

Decompose is one primitive. There should be more. Entity resolution, temporal ordering, reference graph construction, obligation tracking — these are all deterministic operations that agents currently outsource to the model. Every one of them could be a regex-and-heuristics library that runs in milliseconds and gives the LLM structured inputs instead of raw text.

We're building these at Echology. Decompose is the first one we open-sourced.

Try it

pip install decompose-mcp from decompose import decompose # Decompose any document result = decompose(open("contract.md").read()) # Route by attention for unit in result["units"]: if unit["attention"] >= 2.0: llm_analyze(unit) # send to model elif unit["irreducible"]: preserve(unit) # keep verbatim else: skip(unit) # background noise # Or run as MCP tool for your agent python -m decompose --serve

Every unit comes with authority, risk, attention, actionable, irreducible, entities, dates, financial. No API key. No setup. Runs offline.

Your LLM handles reasoning. Let something else handle reading.