Every Company Is an Agent Waiting to Be Decomposed
Miessler's Graph of Algorithms, Claude /workflows, and Why the Five-Phase Audit Works on (just about) Anything
Convergence
I love and follow Daniel Miessler’s writings/musings as religiously as I can, because I find his forward-looking “guidance” (this is what i sometimes think of them) way ahead of the curve. A security researcher watching companies accumulate process debt: For example, his observation, that every business/company is simply a graph of algorithms (the title above an ode adapted to our agentic world today) — workflows stacked inside workflows, most of them unaudited, most of them wasteful, all of them ripe for AI optimisation once made visible. Those who know me will often hear this - “Do [X] better.” Optimize!
With agentic workflows, and fine-tuned or controlled experiments, I see the possibilities of addressing various corporate process debts, more strongly now.
For example, because this was recent, in The Structure Is Intelligence, a controlled engineering experiment: running a bloated AI agent through four decomposition cycles, watching a 97% token reduction emerge not from a smarter model but from restructuring what the model was given to work with.
The experiment proved the theory. The theory explains why the experiment worked. This note maps the two together — and gives you the tools to apply both to any system you encounter.
🔗 How to read this piece
This is a supplementary note to ‘The Structure Is the Intelligence’. That article documented the full StockPilot decomposition experiment: Cycles 0–4, three API configurations, every failure documented (it was adapted from Anthropic but with a few twists i did not expect to find esp on APIs). This piece draws the broader implications using Miessler’s framework and Claude’s /workflows system.
You do not need to have read the original — but the numbers cited here come from it.
Miessler’s Big Ideas
Two highly relevant essays form a coherent theory of how organisations should think about AI — and why most are getting it wrong.
Idea 1 — Companies Are Just a Graph of Algorithms (May 2024)
The starting point is deceptively simple: every company is a collection of processes, and every process is a series of steps — an algorithm. Those algorithms connect to each other (sales feeds operations; operations feeds delivery; delivery feeds support), forming a graph. Most companies have never mapped this graph explicitly. They run it from institutional memory, tribal knowledge, and accumulated habit.
Miessler’s argument is that AI changes the stakes of opacity. A business that cannot describe its own processes as explicit algorithms cannot hand them to AI for optimisation — and a competitor that can will do it first. The exercise of mapping the graph is valuable on its own. With AI, it becomes a competitive moat.
The recursive insight is equally important: every algorithm can be broken into sub-algorithms. The process for handling a customer complaint contains a process for reading the complaint, a process for retrieving account history, a process for drafting a response. Each of those can be broken further. It is algorithms all the way down — and every level is a potential optimisation target.
Yes, if you’re thinking it - the opposite of “turtles all the way down”. Then again - unless you have a bunch that real do not understand the “what and why’s” of their actions. This happens a lot. Not surprising. Non-trivial.
💡 The key line from Miessler’s essay
“AI excels at both discrete task execution and determining how things fit together, and every single one of your company’s workflow components becomes ripe for optimisation or elimination.”
Substitute ‘company’ with ‘agent’ and this is exactly what the StockPilot experiment demonstrated across four cycles.
Idea 2 — Policy, SOPs, and AI Are All You Need (Sept 2024)
The second essay operationalises the first. If companies are graphs of algorithms, what are the components those algorithms are made of? Miessler’s answer: Policy, State, SOPs, and Action.
The model runs as a loop: leaders set Policy, AI gathers State, everything executes according to SOPs, SOPs get updated, repeat. Miessler claims that this is not a future state — it is the direction every well-run organisation is already moving toward, whether consciously or not.
The Experiment as Proof/Confirmation
The StockPilot decomposition experiment in essence ran Miessler’s theory through a controlled test (without knowing it was doing so). The mapping is exact.
The 402-line system prompt was an unaudited company. Policy, State, SOPs, and Action were collapsed into one wall of text, re-read in full on every turn of every task. The decomposition cycles did exactly what Miessler’s framework prescribes: separated the layers, made each one explicit, and loaded each only when needed.
The result was not a smarter agent. It was a more efficient structure. Cycle 0 and Cycle 4 ran the same model. The 97% token reduction came entirely from the structure.
What the Experiment Added to the Theory
Miessler’s framework describes what to do. The experiment provided three things the framework did not:
▪ A diagnostic methodology: The five-phase audit — context, tools, clients, sub-processes, output contracts — is a specific, replicable procedure for finding exactly where the algorithm graph is broken. It is not in Miessler’s essays (but i havent read all his essays - getting to it!). It emerged from documenting every failure across four cycles.
▪ Measured evidence: 97% token reduction, 95% cost reduction, quality maintained. The framework predicts optimisation is possible. The experiment quantified how much and identified the mechanism at each step.
▪ The cycle structure: Running improvements one at a time — skills first, then bash, then sub-agent delegation, then CMA — and measuring after each one revealed which intervention produced which effect. That progression was not in any framework. It was earned through the experiment itself.
Claude /workflows: Where the Theory Becomes Executable
Claude Code’s /workflows feature is Miessler’s SOP model made operational. A workflow is a structured, reusable process — defined in a file, loaded on demand, executed with conditional branching and typed outputs at each step. It is, precisely, a single node in the company graph made explicit and executable.
The connection to the decomposition principles is direct. A workflow that loads only when triggered is the on-demand skill pattern. A workflow step that returns a typed result rather than free text is the typed contract pattern. A workflow that calls a sub-process conditionally is the explicit delegation pattern. The /workflows system is the natural home for the architecture the StockPilot experiment produced.
📌 The structural parallel
Miessler’s SOP = Claude skill file loaded on demand
Miessler’s Policy = SHORT_PROMPT (identity only, always loaded)
Miessler’s State = bash_execute returning filtered rows, not full CSVs
Miessler’s Action = conditional sub-agent with typed JSON return contract
The Prompts: Apply This to Any System
The following four prompts can be used in Claude Code on any codebase, project, or workflow. It’s not an end-all answer to issues, but a great first start. As with all complex systems, issues will arise. Address them accordingly, methodically. Easier said than done? Start somewhere!
These steps apply Miessler’s graph-of-algorithms lens combined with the decomposition methodology from the StockPilot experiment. Use them in sequence for a complete audit-and-rebuild cycle.
Step 1 — Map the Graph
Run this first, on anything. It forces visibility before any change is made.
Step 2 — Separate Policy from SOPs
Use this on any bloated prompt or monolithic instruction set.
Step 3 — Build a Lean Workflow
Use this to construct a new workflow or rebuild an existing one.
Step 4 — Audit an Existing Workflow for Waste
Use this on any existing agent, workflow, or process.
The Usage Sequence
These prompts are designed to run in order as a repeatable optimisation loop:
Start with Step 1 on any unfamiliar codebase. Start with Step 4 on your own code before deploying it. Run the full sequence on any system before scaling it. The loop is:
map → separate → build → audit → repeat.
Connecting Dots…
I love seeing connections like these - Miessler argued in 2024 that companies are graphs of algorithms waiting to be made visible and optimised. The StockPilot experiment proved that the same is true of AI agents — and that the optimisation lever is structural, not model-level. The five-phase audit prompt is the scanner Miessler’s framework implies: a systematic procedure for mapping any algorithm graph, separating its layers, and making the waste visible before touching a single line of code. Claude’s /workflows system is the implementation layer: Miessler’s SOPs made executable, loaded on demand, returning typed results, conditioning on context. The theory, the experiment, and the tooling now point in the same direction. The question is which systems you point them at first.
References
Miessler — Source Essays
Website: https://danielmiessler.com/
Companies Are Just a Graph of Algorithms (May 2024): danielmiessler.com/blog/companies-graph-of-algorithms
Policy, SOPs, and AI Are All You Need (September 2024): danielmiessler.com/blog/policy-sops-and-ai-are-all-you-need
/workflows announcement (May 2026): x.com/i/status/2060100599379841379
Prior Article in This Series
The Structure Is the Intelligence: What a 97% Token Reduction Reveals About How Multi-Agent Systems Actually Work — Interesting Engineering++, May 2026: https://interestingengineering.substack.com/p/the-structure-is-the-intelligence
Experiment Source
Anthropic cwc-workshops — Agent Decomposition: github.com/anthropics/cwc-workshops/tree/main/agent-decomposition
Claude Documentation
Claude Managed Agents overview: platform.claude.com/docs/en/managed-agents/overview
Skills in CMA: platform.claude.com/docs/en/managed-agents/skills
















