Repository navigation
Ontology isn't a knowledge graph β it's a decision layer: how one lightweight ontology runs an entire self-evolving Agent OS #100
xg-gh-25
started this conversation in
Show and tell
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
This post covers six things: β what Ontology gets mistaken for; β‘ its two real layers (noun vs verb); β’ a "4-rung ruler" laid across the whole SwarmAI OS; β£ our design philosophy and a few key decisions; β€ plain-language examples of how and where it's actually used; β₯ the honest boundaries β where we don't oversell.
1 Β· Ontology gets talked to death, but never explained
You've probably scrolled past a pile of "Ontology is AI's next operating system" / "Palantir is worth billions because of its Ontology" posts lately. The word sounds impressive, but after reading you're likely still fuzzy on: how is it actually different from a knowledge graph? How is it different from just building a database?
Let's kill the biggest misconception first:
An Ontology holds no content of its own. It just sets the rules, so a mountain of content can be found, reasoned over, and acted on. The most down-to-earth analogy: your phone's contacts.
In database terms: Ontology = the schema (which fields exist, how they relate); content = the actual rows you fill in. That's the first level of understanding β and where most articles stop. But the real value is the next step.
2 Β· Ontology's two layers: the noun camp vs the verb camp
This is the spine of the whole piece. Same word, two camps using it, an order of magnitude apart in meaning.
π·οΈ The noun camp: Ontology = Classification + Relations β lets you Β«find itΒ»
This is where most people's understanding of Ontology stops β two layers of rules:
What this layer buys you is retrieval: pull on demand, follow the thread. Knowledge graphs live here β they can look up, but can't act. This is exactly the SwarmAI Ontology skeleton we covered in #95/#96, so I won't repeat it β one sentence and a link.
β‘ The verb camp: Ontology = what you can DO + who owns the outcome β lets you Β«make the callΒ»
Palantir keeps insisting Ontology is a decision layer, and the essence isn't in the first two layers β it's in the next three primitives:
What this layer buys you is decision-making: not just "knowing," but "making a call under uncertainty, with tradeoffs, where someone owns the outcome and it can be traced afterward."
3 Β· One "4-rung ruler," laid across the whole SwarmAI OS
How do you tell which layer an AI system actually stops at? Borrow a ruler from decision science β four words that a lot of people conflate:
Most "data capabilities" stop at prediction, mistaking "having a report" for "being able to decide." Wrong β prediction is only the input to a decision. And "being able to decide" still isn't "risk decision" (making a call under uncertainty, with tradeoffs, owning the consequences).
Now lay SwarmAI's subsystems along this ruler β each subsystem is exactly one rung:
Rungs 1β2: Prediction / Inference β Memory / Brains (DDD) / Knowledge
This is the "know what happened, and why" material layer, and the place where the noun-camp Ontology lands most concretely. Many people think this layer is just "storing docs." Wrong β every design choice here is Ontology's classification (π·οΈ), relations (πΈοΈ), and lifecycle (β³) at work. Below, three blocks, taken one at a time, to show exactly how each one embodies Ontology.
One architectural fact first: Memory and the project Brains aren't two separate things β they're two clients of the same machinery: one entry format and parser (
backend/core/ddd_entry_lifecycle.py), and one learning flow that writes to both (CDF, the Cognitive Distillation Flow). Same classification, same way of declaring relations, same rule for how an entry changes. That itself is the Ontology idea winning: one schema, many consumers.π Memory (my long-term, cross-session memory) β all three Ontology moves live here
β Classification (π·οΈ): not 7 flat tags β 3 cognitive layers. Every memory entry goes into a section, and behind it is a MECE (mutually exclusive, collectively exhaustive) three-layer cognitive structure β this is the key to the entire design:
Why exactly this split? Because the layer tells you what kind of judgment an entry is, and that decides how it is weighed and how it can change. A principle is a hard-won way of thinking; a correction is evidence that I was wrong, and a repeat of the same correction is the most important signal the system has. A workaround from six months ago is the kind of entry most likely to be replaced. The Brain Hub view groups every project's entries by these same three layers, so you see what kind of knowledge the AI holds, not just which file it is in.
Memory got much smaller, on purpose. In July, memory held about 500 entries. Today it holds 60 (pitfall 32 Β· guideline 11 Β· correction 7 Β· principle 6 Β· decision 2 Β· process 2). Nothing was lost: the files injected into every turn now take only what the user's own words or a measurement show; everything else goes to the project's Brain or the General Brain and is read on demand. What is injected every turn is injected whole β no selective injection, no truncation.
β‘ Relations (πΈοΈ): every new entry declares how it relates. No memory is an island. When CDF takes in a new unit, the agent that produced it, with the context, declares its relation to what is already there:
Code only checks facts: the id names exactly one live entry, its first line matches, the evidence exists. A wrong id can't retire the wrong entry. (An older relation sidecar with triples like
COE05 βapplies_toβ session_unit.pyis still read during recall to pull in connected entries, but it no longer grows: the relation is now decided at the moment the knowledge arrives, by the context that knows.)β’ Lifecycle (β³): in force, or not there. This is the part we changed most since July. There is no decay timer. A main file holds only what is in force; what is not in force is not there. An entry changes in exactly three ways β add, override, withdraw β and the change is decided when the new knowledge comes in, never by a later re-judging pass. What was replaced, when and why, is recorded outside the main files, so the history is still there for anyone who looks.
π Brains (DDD: each project's domain knowledge) β structure IS classification
A Brain is a DDD: a project's domain knowledge kept as one standard set of documents. Same machinery as Memory, different consumer. Every Brain has the same six sections (Identity Β· Knowledge Β· Gates Β· Capabilities Β· Delivery Β· Refresher) for every domain, and its knowledge section is four documents.
β Classification: the four-doc structure is itself the schema. Not arbitrary, but a MECE split answering four kinds of question:
Which doc you put knowledge into IS the act of classifying. A "this will blow up" lesson goes to IMPROVEMENT.md's What Failed; an architecture decision goes to TECH.md. Structure is classification β no extra tagging needed.
β‘ Relations: one Brain per scope, plus the General Brain. Knowledge that belongs to no single project lives in the built-in General Brain, which every session can reach. A session works with one active project and reaches only that project's Brain; other projects' Brains are deliberately out of reach in that session, so one project's assumptions never leak into another. Lessons a pipeline run learned about a repository are kept per repository and come back the next time anyone works in it.
β’ Lifecycle: who may retire an entry. An override stands only when the context that made the new decision declares it: the after-session review (from the user's own words) or a pipeline run's report (from its own landed change). A judge that says "these two contradict" never retires anything on its own β about one in four of the pairs it flags turn out not to be contradictions at all. And CDF never retires what a person wrote. A separate judge samples what stays and scores it, but scores only.
π Knowledge (the searchable knowledge store) β classification decides "can it be found at all"
Knowledge is the third consumer: reference material that doesn't belong to any one project but is worth keeping long-term (articles read, domain facts, external specs), stored in the
Knowledge/directory and indexed into a full-text-searchable (FTS5) store.How does it embody Ontology? A counter-lesson makes the meaning of classification vivid: we once tripped on this β wrote reference material into
KNOWLEDGE.md(an index file that's always injected into context), and although it was "in the context," it was completely invisible to search β because search only scans theKnowledge/directory, not that index file. Same content, wrong classification location, equals not stored at all. This is a bloody proof of the primacy of noun-camp Ontology: classification isn't a tidiness fetish β it directly decides whether a piece of knowledge "can be found when you need it." Right class β recallable; wrong class β stored yet lost.Today the agent can also go looking itself: one
cognition findcommand searches every store β the Brains,Knowledge/, memory, the correction history, past sessions and the code graph β with the words of the solution, not only the words of the request.Rung 3: Simulation β CodeIntel/CodeGraph + the Pipeline's THINK
Now it gets interesting β this is "if I change this, what happens?" β counterfactual simulation. And its foundation is still that same Ontology, just with the object switched from "knowledge" to "the code itself."
code_intel.dband rebuilt as the code changes.parse_entriesβ the parser behind the classification above β has 53 direct callers in 17 files, and 35 more one step further out. Without the graph I can only "change it and pray"; with it, I know before I touch anything which places get hit. That's the noun camp's "follow the thread," moved onto code.Rung 4: Decision β reviewers find, tests and owners decide, everything audited
The last rung, and the one Palantir keeps stressing that most agent tools can't reach. SwarmAI's Pipeline genuinely walks to here, and every step is demonstrable:
dangerous_command_gate/_is_irreversible_external_opβ irreversible external actions like changing GitHub repo visibility, force-push, deleting a repo are structurally intercepted and require a human signature. (This one is a blood lesson: I once flipped the product repo from public to private on an inference, and GitHub wiped 209 stars instantly. After that, all such actions went behind a hard gate.)These four layers together are precisely an isomorph of Palantir's Proposal workflow (AI proposes β human reviews β system executes β audit). We aren't a BI tool stuck at the prediction layer β we're an Agent OS that reaches the risk-decision layer.
4 Β· Design philosophy and key decisions
Having covered "where it's used," now the "why it's designed this way" β the part others can't copy.
Decision 1: keep the noun layer deliberately light, invest heavily in the verb layer
Big companies do Ontology with heavy graph databases (Neo4j) and formal standards (OWL). We deliberately don't, for three reasons:
But the verb layer β gates, expert review, human-in-the-loop, audit β we invest heavily in. Because the noun layer is the entry ticket; the verb layer ("turning understanding into action") is the moat. That's the philosophical core of this whole piece: others compete on "knowing more"; we compete on "deciding right, owning it, tracing it back."
Decision 2: classification MUST be MECE (no overlap, no gaps), or the whole ontology collapses
The specifics of the three cognitive layers and seven types were covered in Part 3; here I only add the why-it-must-be-designed-this-way principle β because it's the bedrock of whether noun-camp Ontology holds up at all.
MECE = mutually exclusive, collectively exhaustive. Why die on this hill? Because the moment classification overlaps or has gaps, everything downstream breaks:
So our rule is: every piece of knowledge has exactly one home. Once its type is fixed, where it lives, how it can change and who may retire it are fixed with it β no per-entry re-deciding. The precision of classification directly determines the precision of retrieval.
Decision 3: knowledge and code use two engines, not one
Same "classification + relations," but opposite lifecycle needs, so two engines:
They share the idea of Ontology (nodes + edges + classification), but because their lifecycles are opposite, they're split into two.
Decision 4 (changed since July): no forgetting on a timer β knowledge changes by override and withdrawal
In July this section said "Darwinian forgetting is a feature": entries unused for 60 days went dormant, and after 150 days they were archived. We removed it. What we learned running it:
So the rule now is: what is in a main file is in force; what is not in force is not there. Every change is an add, an override or a withdrawal, decided at intake; the history is kept outside the main file. The goal is the same as before β the system should get sharper, not just bigger β but the mechanism is now about truth, not about age.
5 Β· Plain language: how and where it's actually used
Three real scenarios (all things I run daily):
Scenario A β I need to change a core function, and I'm scared it'll break something.
Without the graph: change it and pray, then watch a string of call sites I never thought of blow up in production.
With the graph (CodeGraph):
parse_entriesβ 53 direct callers in 17 files listed at once β the Brain Hub views, the learning flow's unit parser, the archive browser, the bootstrap that seeds a new Brain, the tests that pin the formatβ¦ all on the list. I know the blast radius before I touch it. That's the value of "simulation."Scenario B β I need to judge "should we even build this feature?"
I don't reread every note. The active project's Brain arrives as a short list of pointers to the relevant entries, and I read PRODUCT.md's non-goals, the decisions already made, and IMPROVEMENT.md's What Failed β how similar ideas went before, whether this hits a non-goal, whether we already fell into this pit. That's "routing by class."
Scenario C β I need to ship a change.
The Pipeline: EVALUATE and Gate-0 check that the need is understood β THINK compares approaches on evidence (simulation) β PLAN β BUILD β REVIEW, where the engine picks the experts and a finding counts once it is a failing test β TEST β DELIVER lands it locally, and pushing off the machine waits for a person (risk decision) β REFLECT turns what the run learned into a lesson for the Brain β everything logged (audit). From requirement-in to landed-and-reviewed-out, it's a full chain with a risk decision in it β not "generated, done."
6 Β· The honest boundaries (where we don't oversell)
An article about Ontology that only reports good news isn't trustworthy. Two things, said straight:
catalog(binding definitions to concepts, not tables) + avalidate_sqlcontract gate in front of every query those skills run β a query that violates the data contract structurally cannot run (fail-closed). This is the whole philosophy landing on the data side: the noun layer (tables, columns) isn't enough; you have to reach the verb layer (which queries are allowed to execute, who owns correctness). Prose β executable contract is what "find it β make the call" looks like on data. (For how this layer was built and the pits along the way, see AI Agent for DataοΌδ»εΉ»θ§ε°η²ΎεΒ #36 and its sequel.)Closing
Ontology isn't mystical. It's the set of rules that lets "understanding" turn into "action."
(Numbers re-measured against the running system on 2026-11-01: memory's type distribution, CodeGraph's 32,672 symbols / 158,657 call edges,
parse_entries' callers. For comparison, in July: about 500 memory entries and 18,034 nodes / 28,445 edges.)Related: #95/#96 Ontology skeleton (classification + relations, no Neo4j) Β· #59 DDD 7-type governance Β· #36 AI Agent for Data Β· v2.4.0 release notes
All reactions