<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Sai on Medium]]></title>
        <description><![CDATA[Stories by Sai on Medium]]></description>
        <link>https://medium.com/@polymathik?source=rss-48f4b506bc93------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/proxy/1*TGH72Nnw24QL3iV9IOm4VA.png</url>
            <title>Stories by Sai on Medium</title>
            <link>https://medium.com/@polymathik?source=rss-48f4b506bc93------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 05 Dec 2026 21:55:39 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@polymathik/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[u cn stll rd ths: The Bits You Didn’t Need to Read]]></title>
            <link>https://polymathik.medium.com/u-cn-stll-rd-ths-the-bits-you-didnt-need-to-read-f2d790990ef5?source=rss-48f4b506bc93------2</link>
            <guid isPermaLink="false">https://medium.com/p/f2d790990ef5</guid>
            <category><![CDATA[knowledge-graph]]></category>
            <category><![CDATA[ontology]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[information-theory]]></category>
            <dc:creator><![CDATA[Sai]]></dc:creator>
            <pubDate>Tue, 29 Sep 2026 05:59:08 GMT</pubDate>
            <atom:updated>2026-09-29T05:59:08.777Z</atom:updated>
            <content:encoded><![CDATA[<p><em>In 1948, a Bell Labs engineer threw meaning away and found a way to measure structure. Six essays later, it’s time to pay a debt.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MciOWwmSwEvKmG0LQfaB_g.png" /></figure><p>If y cn rd ths, yr brn is dng smthng rmrkbl. It is fllng in th mssng lttrs bfr y evn ntc thy r gn.</p><p>You probably read that almost as fast as normal text. Yet more than a third of the letters are missing. Which raises an odd question: if you didn’t need them, what were they doing there in the first place?</p><p>In 1951, Claude Shannon put a number on it. Ordinary English, he found, carries roughly a quarter of the information it could. The rest is predictable. Your brain knows what comes next, so the letters are mostly confirming what you already expected.</p><p>That number matters for this series more than it might seem. For six essays, I’ve been claiming that structure lets AI systems reason in ways that pattern-matching alone can’t. The <a href="https://medium.com/@polymathik/why-your-knowledge-graph-cant-ride-a-bicycle-dbf702fd3979">last essay</a> ended by admitting I had never actually proved it. It asked for two things: a mathematical argument that structure reduces uncertainty, and a way to measure what organizing knowledge actually buys you.</p><p>Shannon gives us both. And it starts with that sentence you just read.</p><h3>The Engineer Who Threw Meaning Away</h3><p>In 1948, Shannon was working at Bell Labs on a very practical problem: how to send messages over telephone lines and radio without losing them to noise. His paper, “A Mathematical Theory of Communication,” did something that still surprises people.</p><p>He threw meaning out. Messages often mean something, he acknowledged, but “these semantic aspects of communication are irrelevant to the engineering problem.” What mattered was only this: the message was one choice picked from a set of possible messages. How big was that set, and how likely was each choice?</p><p>That sounds like a strange place to start a theory of information. But giving up meaning is exactly what made information measurable. You can’t put a number on what a sentence means. You can put a number on how surprised you are to receive it.</p><p>A year later, Warren Weaver described communication as a problem at three levels. First, are the symbols getting through correctly? Second, do they carry the intended meaning? Third, does that meaning change what the receiver does? Shannon’s theory handles only the first level.</p><p>That’s worth saying plainly, because this series has a habit of naming what each framework leaves out. Shannon leaves out meaning entirely. An ontology lives at the second level, where meaning is the whole point. So what follows can tell us how much structure an ontology contains. It can’t tell us whether that structure is <em>true</em>. The last essay was about exactly that gap.</p><h3>Information Is Surprise</h3><p>Shannon’s key idea is simple. A message is informative to the extent that it tells you something you didn’t expect.</p><p>If a friend texts you “the sun came up today,” you learn nothing. You were already certain. If they text “it snowed in Bengaluru today,” you learn a lot, because you thought that was nearly impossible. The less likely something is, the more information it carries when it happens.</p><p>Shannon’s unit for this is the <strong>bit</strong>. The easiest way to understand a bit is the game of 20 Questions. One bit is one good yes-or-no question, one that cuts the remaining possibilities in half.</p><p>Say I’m thinking of a number from 1 to 8. Is it bigger than 4? Yes. Bigger than 6? No. Is it 6? No. So it’s 5. Three questions, every time. That’s 3 bits.</p><p>When I worked through this, what made it click was looking at it from the other direction: writing the answer down in binary. One binary digit gives you 2 possible labels (0, 1). Two digits give you 4 (00, 01, 10, 11). Three give you 8. Each new digit doubles the number of things you can tell apart.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QmRNE_xLchelIRfzkkx6xw.png" /></figure><p>So the number of bits you need is just the number of doublings it takes to reach the number of possibilities. That’s what a logarithm is. Eight options need 3 bits, because 2 × 2 × 2 = 8. Shannon noted in the original paper that he chose the logarithm because it was the most natural fit, for both practical and theoretical reasons. The doubling picture shows why.</p><p>This works cleanly when every option is equally likely. The real world is rarely that fair. So Shannon did one more thing. He gave each outcome its own surprise value based on its probability, and then took the average, weighted by how often each outcome actually happens. The result is called <strong>entropy</strong>:</p><pre>H = −Σ p × log₂(p)</pre><p>Don’t let the symbols put you off. It just says: <em>entropy is the average surprise of a source.</em> A fair coin has 1 bit of entropy. A coin with heads on both sides has zero, because you always know the answer. The more predictable something is, the lower its entropy.</p><h3>Back to the Sentence</h3><p>Now we can say why you could read that opening line.</p><p>If all 26 letters plus a space were equally likely, each character would carry about 4.75 bits. That’s the ceiling. Shannon then started adding what we know about English. Knowing which letters are common (lots of e, very few q) brings it down to about 4.0 bits. Knowing which pairs of letters go together brings it to 3.3. Looking at eight letters at a time, it drops to roughly 2.3.</p><p>Then he tried something clever. He gave a person a passage of text and asked them to guess the next letter, over and over. With about a hundred letters of context in front of them, the estimate fell to somewhere between 0.6 and 1.3 bits per letter.</p><p>One honest caveat: that experiment used a single person. Researchers have since repeated it at scale, and a large computer study of 20 million characters landed at about 1.6 bits per character. Either way, English is roughly three-quarters predictable.</p><p>That gap between what a message <em>could</em> carry and what it <em>does</em> carry is called <strong>redundancy</strong>. The vowels you skipped earlier were mostly redundant. You could predict them from the letters around them.</p><p>Here’s the part people usually get backwards. <strong>Redundancy isn’t waste.</strong> It’s what makes communication survive mistakes. If English had no redundancy, every string of letters would be a real word, and every typo would quietly turn into a different message. You’d have no way to notice. Redundancy is why you can follow a conversation in a noisy room, read a smudged page, or spot a spelling error at all.</p><p>This connects back to earlier essays. In <a href="https://claude.ai/chat/27d35883-63bd-4ee5-94f4-b6bb9e8b5447#">Part 4</a>, Minsky’s frames came with default values: you assume a room has walls and a floor until told otherwise. In information terms, defaults are the cheapest facts you hold. They’re almost always right, so they cost almost nothing to store. That may be exactly why they feel so natural to think with.</p><h3>What One Edge Is Worth</h3><p>So far, we’ve measured one source on its own. But a knowledge graph is about connections. You learn one fact, and it changes what you expect about another. This is where Shannon pays the debt.</p><p>Picture a bag of eight exercises, each equally likely to be picked. Your uncertainty about which one I chose is 3 bits.</p><p>Now I tell you one thing first: whether it’s an upper-body or lower-body exercise. Suppose four are upper and four are lower. Whatever I say, you’re left with four options, which is 2 bits. You started with 3 bits of uncertainty and now have 2. That one fact was worth exactly <strong>1 bit</strong>.</p><p>Now change the bag. This time, only two exercises are lower-body and six are upper-body.</p><ul><li>If I say “lower” (which happens a quarter of the time), two options are left: 1 bit.</li><li>If I say “upper” (three-quarters of the time), six are left: about 2.58 bits.</li></ul><p>On average, you’re left with about 2.19 bits. So the fact was worth about <strong>0.81 bits</strong>. Same kind of question, but less useful, because the answer was more predictable. This is why good 20 Questions players ask questions that split the options evenly.</p><p>What we just calculated has a name: <strong>mutual information</strong>. It’s the amount your uncertainty about one thing drops when you learn another. In a graph, that “other thing” is an edge. For the first time in this series, we can put a number on what a single relationship is worth.</p><p>Two things follow from this.</p><p><strong>Some facts are worth nothing.</strong> If knowing one thing tells you nothing new about another, the value is zero bits. Telling you that the exercise name contains the letter “e” doesn’t narrow anything down.</p><p><strong>Later edges are worth less if they repeat earlier ones.</strong> Chain a few facts together: body region, then equipment, then movement type. Each one narrows the options further. But each is only worth what it adds <em>on top of</em> what you already know. If “uses a barbell” was mostly predictable once you knew “lower-body squat pattern,” that second fact adds very little.</p><p>This explains something I’d noticed when designing benchmarks for knowledge graphs: their advantage shows up most on questions that need several connected steps. Each well-chosen edge cuts the space again, and the cuts add up.</p><h3>Every Model Is a Compressor</h3><p>There’s one more idea in Shannon’s work that ties everything together: <strong>compression and prediction are the same thing.</strong></p><p>To compress well, you give short codes to common things and long codes to rare things. Morse code does this. The letter “e” is a single dot. The letter “q” takes four symbols. But you can only do that if you know what’s common. So a good compressor has to be a good predictor, and a good predictor can always be turned into a compressor.</p><p>If you’ve trained a machine learning model, you’ve already met this. The standard loss function for language models, cross-entropy, measures how many bits the model would need to encode the real data. Lowering the loss means the model finds the data less surprising. Every training run is, quietly, building a compressor.</p><p>An ontology is a compressor too. Instead of stating “has a body region” on every single exercise, you state it once on the class, and every exercise inherits it. Rules about what can connect to what cut down the number of possible graphs, so less needs to be spelled out. A schema is like a shared codebook. Two colleagues who share context can say “the thing with the client” and understand each other. A stranger would need three sentences.</p><p>Now I have to be honest about the limits of this argument. Shannon’s math applies to language models and knowledge graphs equally. A good LLM also reduces uncertainty, sometimes dramatically. Nothing here proves that graphs do it <em>better</em>.</p><p>What structure gives you is different: <strong>you can point to where the bits came from.</strong> You can say this edge removed 0.81 bits of uncertainty. You can’t do that with the inside of a language model. In <a href="https://medium.com/@polymathik/what-does-it-mean-to-know-something-and-can-a-machine-do-it-6e073a20de83">Part 2</a>, we saw that knowledge needs a traceable link between belief and truth. Shannon doesn’t give us that link, but he gives us a way to measure what each step of it contributes.</p><h3>A Test for Your Ontology</h3><p>Put all of this together and you get a practical rule for anyone building an ontology:</p><blockquote><strong><em>A relation earns its place if traversing it reduces uncertainty about what you’re after.</em></strong></blockquote><p>It turns out cognitive scientists found the same idea from a different direction. In 1992, James Corter and Mark Gluck asked why people naturally think at a certain level of detail: “dog” rather than “animal” or “golden retriever,” the pattern Eleanor Rosch identified and we explored in <a href="https://medium.com/@polymathik/you-learned-dog-before-animal-and-that-matters-for-ai-325721a3e830">Part 5</a>. Their answer was that the preferred level is the one that best helps you predict an object’s features, and their measure is closely related to mutual information. They even gave an example very close to our “letter e” case: a feature that every member of a category shares tells you nothing about which member you’re looking at. Engineering and psychology, arriving at the same test.</p><p>But redundancy adds a second clause. Some relations tell you nothing about <em>which</em> thing you’re looking at, yet still earn their place, because breaking them reveals an error. They work like the check digit on a credit card number: it adds no new information, but it catches mistakes. So the full test is:</p><blockquote><strong><em>A relation earns its place if it reduces uncertainty, or if violating it exposes an error.</em></strong></blockquote><p>A few questions you can ask of your own schema:</p><ol><li><strong>If I removed this relation, which questions would become harder to answer?</strong> If none, it’s carrying no bits.</li><li><strong>Is this relation predictable from one I already have?</strong> If so, it’s either redundant or it’s acting as a deliberate check. Know which.</li><li><strong>Does it hold for every single instance?</strong> Then it can’t help you tell instances apart. Keep it only if it catches errors.</li></ol><p>In the <a href="https://medium.com/@polymathik/the-map-is-not-the-territory-but-its-all-your-agent-has-b44ed42e4faf">first essay</a>, Korzybski told us a useful map shares structure with the territory. Now “structure” has a unit of measurement.</p><p>There’s a bigger question hiding here. If every relation has a cost and a value in bits, do different layers of an ontology carry different kinds of bits? That’s a question for the main <a href="https://polymathik.medium.com/part-3-from-flat-to-layered-the-theory-behind-ontological-stratification-a70f2e5513f8">Layered Mind series</a>, which argues that layered ontologies are the better structure for AI agents working across domains.</p><h3>The Bits You Didn’t Need to Read</h3><p>You started this essay by reading a sentence with a third of its letters missing. You didn’t need them, because English is structured enough that you could predict them.</p><p>That’s the whole argument in miniature. Structure makes things predictable. Predictability can be measured. And that measurement lets us say, finally, what a knowledge graph’s edges are worth.</p><p>But there’s a catch. Everything in this essay depended on probabilities, on a source that sends message after message, so we can see what’s common and what’s rare. Your knowledge graph isn’t like that. It isn’t one random draw from a population of possible graphs. It’s one specific thing.</p><p>So how do you measure the information in a single object, with no probabilities to lean on? That question belongs to a Soviet mathematician named Andrey Kolmogorov, and it’s where we go next.</p><p>If this helped something click, a clap lets me know.</p><h3>References</h3><ol><li><a href="https://doi.org/10.1002/j.1538-7305.1948.tb01338.x">Shannon, C.E. (1948). “A Mathematical Theory of Communication.” <em>Bell System Technical Journal</em>, 27, 379–423, 623–656</a> — Information as selection, the separation of meaning from the engineering problem, entropy</li><li><a href="https://doi.org/10.1002/j.1538-7305.1951.tb01366.x">Shannon, C.E. (1951). “Prediction and Entropy of Printed English.” <em>Bell System Technical Journal</em>, 30, 50–64</a> — The letter-prediction experiments and entropy estimates for English</li><li>Shannon, C.E. &amp; Weaver, W. (1949). <em>The Mathematical Theory of Communication</em>. University of Illinois Press — Weaver’s three levels of the communication problem</li><li><a href="https://arxiv.org/abs/0911.2284">“A New Look at the Classical Entropy of Written English” (2009), arXiv:0911.2284</a> — Large-scale computational estimate (~1.58 bits/character, ~75% redundancy)</li><li><a href="https://www.ncbi.nlm.nih.gov/pmc/articles/PMC7514546/">Ren, G., Takahashi, S. &amp; Tanaka-Ishii, K. (2019). “Entropy Rate Estimation for English via a Large Cognitive Experiment Using Mechanical Turk.” <em>Entropy</em>, 21(12)</a> — Large-scale replication of Shannon’s single-subject experiment</li><li><a href="https://doi.org/10.1037/0033-2909.111.2.291">Corter, J.E. &amp; Gluck, M.A. (1992). “Explaining Basic Categories: Feature Predictability and Information.” <em>Psychological Bulletin</em>, 111(2), 291–303</a> — Category utility and its link to mutual information</li><li><a href="https://doi.org/10.1002/047174882X">Cover, T.M. &amp; Thomas, J.A. (2006). <em>Elements of Information Theory</em>, 2nd ed. Wiley</a> — Standard reference for entropy, mutual information and the source coding theorem</li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f2d790990ef5" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Part 7 — The Semantic Web Stack, and Why the Popular Tools Hit a Ceiling]]></title>
            <link>https://polymathik.medium.com/part-7-the-semantic-web-stack-and-why-the-popular-tools-hit-a-ceiling-135a201c5de3?source=rss-48f4b506bc93------2</link>
            <guid isPermaLink="false">https://medium.com/p/135a201c5de3</guid>
            <category><![CDATA[ontology]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[agentic-ai]]></category>
            <category><![CDATA[semanticweb]]></category>
            <category><![CDATA[knowledge-graph]]></category>
            <dc:creator><![CDATA[Sai]]></dc:creator>
            <pubDate>Sun, 19 Jul 2026 03:15:28 GMT</pubDate>
            <atom:updated>2026-07-19T03:15:28.876Z</atom:updated>
            <content:encoded><![CDATA[<p><em>RDF, RDFS, OWL, and SPARQL are the standard machinery for knowledge graphs. Learn what each one actually does, and why the flat, convenient approaches that dominate today break at exactly the scale you’re building for.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Tab_bvJu8aKhoZIObVF4Kw.png" /></figure><p>Picture an offshore production vessel, an FPSO, floating in open ocean and pulling oil from beneath the seabed. On board, the corrosion rate of a critical pipe depends on the seawater temperature and salinity around the hull. Those depend on the ocean conditions. The pump that moves fluid through that pipe has a duty cycle set by the electrical power available. And the moment corrosion crosses a threshold, someone needs to have already ordered the replacement part, checked it into a warehouse, and booked it onto a supply boat with enough lead time to arrive before the pipe fails.</p><p>Metallurgy, oceanography, mechanical, electrical, warehousing, transport. Six domains, owned by different teams, running on different timescales. And they are not merely <em>present</em> together. A fact in one has to reason its way into a decision in another. The corrosion signal has to reach the reorder.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oTnMEkOPp2UTxPPNPV2Vqw.png" /></figure><p>Now try to store that knowledge as one big flat graph, where everything sits at the same level. You can list every fact. What you cannot do is get the corrosion prediction to <em>walk</em> to the spare-parts reorder, because a flat structure has no shared foundation for that walk to route through. The knowledge is all there and none of it connects.</p><p>This is the problem this post is about. In <a href="https://medium.com/@polymathik/part-4-the-upper-ontology-what-all-your-agents-should-agree-on-cffb1218abcf">Parts 4</a> through <a href="https://polymathik.medium.com/part-6-task-and-application-ontologies-what-agents-actually-do-8571c66d40e1">6</a>, we designed a layered architecture. This post is about the standard tools that make it real, namely RDF, RDFS, OWL, and SPARQL, and about why the popular, convenient alternatives dominate the landscape yet hit a ceiling precisely where deep coupling begins.</p><p>Hold the FPSO in mind. We’ll come back to it once we have the tools to explain exactly why it defeats the flat approach. First, the one idea the whole stack is built on, in a domain small enough to hold in your head: exercise, nutrition, and supplements.</p><h3>The One Move Everything Rests On: Name Things With Addresses</h3><p>Start with the problem the whole semantic web was built to solve.</p><blockquote>When different systems store knowledge, how do you guarantee they’re talking about the same thing?</blockquote><p>You have a spreadsheet with a column called name. I have a database with a column called name. We both have a row for someone called &quot;Chris.&quot; Are those the same Chris? Does your name mean the same thing mine does? Nothing in either file tells a computer. The words match; the meaning is trapped in our heads. Fine for two people. Fatal when you&#39;re merging thousands of research papers automatically.</p><p>RDF’s answer is almost too simple. Instead of naming things with plain words, name them with web addresses. Not creatine but https://kaas.example/onto#Creatine. The relationship &quot;enhances&quot; gets its own address too.</p><p>Why does that help? A web address is unique in a way a word never is. Two people using the same address are provably pointing at the same concept. The address itself is the guarantee. It’s the difference between first names and phone numbers. Plenty of people are named “Sarah.” A phone number reaches exactly one line.</p><p>That’s the entire foundation. A fact becomes a triple of addresses (subject, predicate, object), and a knowledge graph is just a pile of those triples. Everything else in the stack is built on this single move: name things with addresses, not words.</p><h3>The Catch: Addresses Don’t Prevent Duplicates</h3><p>Here’s the honest wrinkle. If I mint an address for creatine and you mint a different one, we now have two addresses for one idea, and the machine thinks they’re unrelated. Did we solve the “same thing?” problem, or just move it?</p><p>Partly the second. Which is why shared, standard addresses matter so much. Public ontologies (ChEBI for chemistry, FoodOn for foods, EXMO for exercises) have already minted addresses for their concepts. When you reuse ChEBI:16919 for creatine instead of inventing your own, you automatically speak the same language as everyone else who reuses it, and merging becomes free.</p><p>But there is no master list of all addresses, and there never can be. Nobody has minted a standard address for “bioavailability of magnesium glycinate under fasted conditions.” So the real situation is this: reuse a standard address where one exists, mint your own where none does, and, most important of all, be able to <em>state</em> when your address means the same thing as someone else’s.</p><p>That last capability is the point. RDF doesn’t pretend duplicates never happen. It makes disagreement <strong>explicit and repairable</strong> instead of hidden. In the plain-word world, two “creatine”s that secretly differ are invisible until your data is silently wrong. Here, two addresses are visibly distinct until someone declares them equal. The disagreement becomes a thing you can see and fix.</p><h3>RDFS: Teaching the Machine That Folders Sit Inside Folders</h3><p>The lightest layer of the stack is RDFS. It gives you a small handful of special addresses whose job is to describe <em>other</em> addresses. The one that matters most is subClassOf.</p><p>You state two facts: Creatine is a subclass of Supplement. Supplement is a subclass of Chemical Entity. You never said “Creatine is a Chemical Entity,” yet a machine reading those two lines figures it out by following the chain. Ask it for all chemical entities and creatine comes back, even though nobody filed it there directly.</p><p>Think of nested folders. You drop a file into Creatine/, which sits inside Supplements/, which sits inside Chemicals/. You never manually put the file in Chemicals/, but a search for everything under Chemicals/ finds it. That folder-walking is the simplest form of what people grandly call reasoning. It&#39;s just following folders inside folders.</p><p>And this is the quiet payoff of the whole series: the layered architecture from Parts 4 through 6, with abstract “material entity” at the top, “supplement” in the middle, and specific “creatine” at the bottom, <em>is</em> a subClassOf chain. Stratification isn&#39;t a metaphor once you write it in RDF. It&#39;s one long nesting of folders, foundation on the outside, specifics on the inside, and RDFS is what makes that nesting a real, machine-walkable thing rather than a diagram.</p><p>RDFS has one more trick worth knowing and one sharp edge. You can describe your relationships too: declare that enhances runs from a Supplement to a physiological outcome. But watch what happens if you then write &quot;Ashwagandha enhances SleepQuality&quot; without ever saying Ashwagandha is a Supplement. RDFS doesn&#39;t complain. It concludes Ashwagandha <em>must</em> be a Supplement and adds that as a new fact. RDFS never rejects. It only infers more. Powerful, and a footgun, because a typo doesn&#39;t get caught. It gets believed.</p><h3>OWL: The Auditor</h3><p>That footgun is exactly what OWL is for. If RDFS is a tireless filing clerk who cheerfully walks your folder rules, OWL is the auditor who knows the rules that <em>must hold</em>, and can say no.</p><p>OWL adds two powers RDFS lacks. First, it can <em>define</em> rather than just label. RDFS can say “SafeDose is a kind of Dose,” a tag you attach by hand. OWL can say “a SafeDose is exactly any Dose below the toxic threshold,” and then sort doses into the safe pile automatically, by meaning. Second, it can <em>reject</em>. Declare that Supplement and Process are disjoint, so nothing can be both, and if some extraction ever produces a thing typed as both, OWL raises a contradiction instead of shrugging and inferring more.</p><blockquote><strong>RDFS is an optimist that fills in gaps. OWL is an auditor that can also throw things out.</strong></blockquote><p>For a platform whose graph is populated by an LLM reading research papers, this matters enormously. LLMs are fluent, confident, and wrong sometimes. Under a pure RDFS system, a wrong extraction is believed and propagated: garbage triple, garbage inference, garbage answer, silently. OWL is the layer that lets a machine reject the impossible <em>before</em> it reaches your curated graph. That is a large part of what turns “we have a knowledge graph” into “we have a <em>verifiable</em> one.”</p><p>There’s a cost, and it’s worth stating plainly because it shapes real decisions. The more expressive rules you add, the harder and slower a reasoner has to work to check them, and at the far end some setups become impractically slow. That’s why OWL comes in deliberately limited flavors, and why the sensible default for agent systems is a lightweight subset, not the whole language. Buy exactly as much reasoning as your constraints actually need.</p><h3>SPARQL: Asking Questions By Filling In Blanks</h3><p>We can build and check a graph. Now we need to ask it things. SPARQL is the query language, and its core idea is one you already understand: a query is just a triple with blanks in it.</p><p>You know the shape of a fact: “<em>something</em> enhances power output.” So you write exactly that, with a blank where the something goes, marked with a ?:</p><pre>?supplement enhances PowerOutput .</pre><p>The machine reads ?supplement as a hole to fill, scans its facts, and hands back everything that fits: creatine, beetroot, whatever makes the triple true. Stack more blank-sentences that share the same hole, and you narrow the results, because a value has to fill <em>all</em> of them at once:</p><pre>?supplement  enhances       PowerOutput .<br>?supplement  hasEvidence     &quot;high&quot; .<br>?supplement  hasSafetyStatus Safe .</pre><p>That’s “show me safe, well-evidenced supplements that enhance power output,” built from nothing but triples with holes. Querying is pattern-matching a shape against the graph.</p><p>Two things make this more than a lookup. First, it’s where the shared-address discipline pays off: if your graph and a research database both used ChEBI:16919, one query walks across both as if they were a single graph. If they used different addresses, the query silently misses half the answer. Second, and this is the one to hold onto, SPARQL runs <em>after</em> the reasoner. So hasSafetyStatus Safe might be a fact someone typed, or one OWL <em>inferred</em> from &quot;dose below threshold.&quot; To the query, there&#39;s no difference. You can retrieve conclusions that were never explicitly stored. Your graph answers not just what&#39;s written, but what&#39;s provably true given the rules.</p><h3>Where This Lives: Triple Stores vs. the Popular Alternative</h3><p>All of this runs on a database. Broadly, two families. RDF triple stores (Apache Jena, GraphDB, Amazon Neptune) speak everything above natively: shared addresses, reasoning, SPARQL. Then there are property graphs, dominated by Neo4j, the most popular graph database in the world.</p><p>A property graph stores nodes and labeled relationships, and its one genuinely nice feature is that both the nodes <em>and</em> the arrows can carry extra detail directly on them. The fact “creatine enhances power output, high evidence, 47 studies” hangs its evidence and study count right on the arrow, exactly how you’d sketch it on a whiteboard. In pure RDF, attaching detail to a <em>relationship</em> is fiddlier. You break the simple arrow into a small scaffold of extra nodes. More mergeable, less intuitive.</p><p>So why do most developers reach for Neo4j when it has none of RDF’s superpowers, no global shared addresses, no automatic merging, no reasoning? The honest answer isn’t raw query speed, which is roughly a wash and depends on the workload. It’s <strong>time to first useful thing.</strong></p><p>Remember everything it took to store one honest fact the RDF-correct way: addresses, namespaces, literals, blank nodes, types, eventually a reasoner. A Neo4j developer opens the tool and, on day one with no ontology, writes something close to English (make a Creatine node, make a PowerOutput node, draw an ENHANCES arrow, staple “evidence: high” on it) and is productive by lunch. It’s a manual transmission versus an automatic. The manual gives an expert more control on the right terrain; the automatic gets a normal person driving today. Most people, most of the time, just want to get where they’re going.</p><h3>Why the Flat Landscape Dominates, and Where It Breaks</h3><p>That’s the whole reason flat ontologies dominate the landscape, and it’s not a coincidence. The tool that lets you skip the setup tax also lets you skip the <em>structure</em>. People reach for Neo4j <em>because</em> it doesn’t make them think about layers or shared addresses or reasoning, and so they build graphs with no layers, no shared addresses, and no reasoning. The convenience and the flatness come from the same source.</p><p>Here’s the part that keeps the argument honest: for most projects, skipping the tax is the right call. A one-off graph, a single team, a small stable domain: flat and fast is genuinely correct, and the full ceremony would be over-engineering. This is the same trade-off you’d weigh against a <strong>star schema</strong>, the classic analytics design. A star schema is superb for a fixed set of known questions over stable data. It’s faster and simpler than an ontology, right up until someone asks a question that cuts across its design in a way nobody anticipated. A star schema optimizes for the questions you already know; an ontology models the <em>things themselves</em>, so it can answer questions you never planned for. A printed train timetable answers “when’s the next train to X” instantly, for the routes someone anticipated. A rail map lets you plan any route, including ones nobody printed a timetable for.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6HVIchFOz5c5DMAC2y9Mcg.png" /></figure><blockquote><strong>So the thesis of this series isn’t “flat is dumb.” It’s sharper and fairer: the flat approach’s convenience becomes a liability at exactly the scale where knowledge is deeply coupled.</strong></blockquote><p>Now we have the tools, so back to the platform we opened with. Build one careful flat graph across all six FPSO domains and you hit a wall the moment you deal with something as simple as “temperature.” It means one thing to the oceanographer (seawater), another to the metallurgist (fatigue threshold), another to the electrical engineer (cable rating). Collapse them into one and the machine thinks seawater temperature and cable rating are the same quantity, which is nonsense. Split them into temperature_1, temperature_2, temperature_3 and nothing knows they&#39;re all <em>kinds of</em> the same underlying thing. Those are precisely the two failure modes from earlier: secretly-merged, or never-linked.</p><p>Layering is the only structure that escapes both at once. A shared upper concept, “Temperature is a kind of Measurable Quantity,” sits at the foundation, and each domain specializes it: SeawaterTemperature subClassOf Temperature, CableRating subClassOf Temperature. Now the machine knows they&#39;re relatives without thinking they&#39;re identical. It can reason across them where appropriate and keep them distinct where required, and when the corrosion model needs seawater temperature, the reasoner walks the subclass chain to find it even if the raw fact was filed under a domain-specific name. That cross-domain walk through a shared foundation is exactly what a flat graph, however carefully hand-drawn, cannot do, because it has no foundation for the walk to route through.</p><h3>The Same Shape in Our Own Domain</h3><p>You don’t need an oil platform to see this. Our home domain has the same coupling, tractably sized. A supplement’s effect lives in chemistry (ChEBI). Its dosing protocol has no standard ontology at all. Its benefit depends on the exercise context (EXMO) and the person’s nutritional state (FoodOn, CDNO). Ask “given what this person ate, trained, and takes, what’s the safe, well-evidenced next move?” and you’re walking across four sub-domains and a reasoner, in one query.</p><p>That’s why supplementation is the sharp end of the whole build. It’s the sub-domain where standard addresses mostly <em>don’t exist yet</em>, and that is both the reason it’s the hardest to align and the reason it’s the most defensible thing to build. If shared addresses already existed for bioavailability and dosing and stacking logic, anyone could plug into them, and curation wouldn’t be worth much. The absence of standards is why the careful, human-governed minting and linking <em>is</em> the product.</p><h3>One Last Piece, and a Bridge to Part 8</h3><p>Most people connecting a knowledge graph to an LLM today reach for GraphRAG: instead of retrieving text that merely <em>sounds</em> like the question, you retrieve things <em>connected</em> to it by following named relationships.</p><p>It’s a real improvement. Traversal instead of resemblance, explicit stated edges instead of a similarity guess. But GraphRAG inherits its graph’s quality. Run it over a flat graph and it can follow arrows yet can’t cross domains or retrieve anything that wasn’t explicitly stored. Run it over a layered, reasoned, provenance-tracked graph and it retrieves conclusions that were <em>reasoned into existence</em>, and can name the exact evidence path it walked to get there. That difference is the spine of the platform, and it’s where Part 9 will go in full.</p><p>We now have the complete practical stack. Name things (RDF), nest them (RDFS), define and audit them (OWL), ask them (SPARQL), plus a clear-eyed view of where they live and why the convenient alternatives win the easy case but hit a ceiling on the hard one.</p><h3>What’s Next</h3><p>In Part 8, we stop describing tools and start building. We’ll construct the exercise-and-nutrition knowledge graph end to end, integrating EXMO, FoodOn, CDNO, and ChEBI onto the shared upper layer, using two parallel tracks: manual ontology design and LLM-assisted construction. Everything abstract in this post becomes a running graph you can query.</p><p><em>This is Part 7 of “The Layered Mind,” a 10-part series on ontological stratification for agentic AI. Follow along to catch each installment.</em></p><h3>References</h3><ol><li><a href="https://www.w3.org/TR/rdf11-concepts/">W3C — RDF 1.1 Concepts and Abstract Syntax</a> — The formal data model behind triples, IRIs, and literals</li><li><a href="https://www.w3.org/TR/rdf-schema/">W3C — RDF Schema 1.1</a> — Classes, subclasses, domain and range</li><li><a href="https://www.w3.org/TR/owl2-primer/">W3C — OWL 2 Web Ontology Language Primer</a> — Definitions, constraints, and the expressiveness/tractability trade-off</li><li><a href="https://www.w3.org/TR/sparql11-query/">W3C — SPARQL 1.1 Query Language</a> — Pattern-matching queries over RDF graphs</li><li><a href="https://www.ebi.ac.uk/chebi/">ChEBI — Chemical Entities of Biological Interest</a> — Shared identifiers for chemical concepts</li><li><a href="https://neo4j.com/docs/getting-started/appendix/graphdb-concepts/">Neo4j — Property Graph Model</a> — The property graph approach and Cypher</li><li><a href="https://www.microsoft.com/en-us/research/project/graphrag/">Microsoft Research — GraphRAG</a> — Graph-based retrieval as a bridge pattern (previewed here, developed in Part 9)</li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=135a201c5de3" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Why Your Knowledge Graph Can’t Ride a Bicycle —]]></title>
            <link>https://polymathik.medium.com/why-your-knowledge-graph-cant-ride-a-bicycle-dbf702fd3979?source=rss-48f4b506bc93------2</link>
            <guid isPermaLink="false">https://medium.com/p/dbf702fd3979</guid>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[embodied-cognition]]></category>
            <category><![CDATA[knowledge-graph]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[cognitive-science]]></category>
            <dc:creator><![CDATA[Sai]]></dc:creator>
            <pubDate>Sun, 17 May 2026 08:46:13 GMT</pubDate>
            <atom:updated>2026-05-17T08:46:13.905Z</atom:updated>
            <content:encoded><![CDATA[<p><em>Embodied cognition argues that abstract thought is built on bodily experience. That’s a serious challenge for formal knowledge representation. But the real question isn’t whether machines can be grounded, it’s where the grounding comes from.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Xh8T9__4oKT4CdFUD5mZYg.png" /></figure><p>Try to explain how you ride a bicycle.</p><p>Not the physics. Anyone can recite that a moving bicycle stays upright because of angular momentum and steering corrections. I mean, explain what <em>you</em> do. The way your body leans into a turn before your conscious mind registers the curve. The micro-adjustments when a gust of wind hits from the left.</p><p>You can’t. Not because you’re bad at explaining. Because the knowledge lives in your body, not in propositions. Embodied cognition argues that some knowledge is <em>constituted by</em> bodily interaction with the world. It doesn’t exist independently of the body, waiting to be extracted and formalized. It <em>is</em> the body’s interaction.</p><p>This raises an uncomfortable question for anyone building ontologies or knowledge graphs: if the most fundamental human concepts are grounded in bodily experience, what happens when you strip away the body and keep only the formal structure?</p><p>The answer, it turns out, is more interesting than the question suggests.</p><h3>You’re Soaking in Metaphor</h3><p>In 1980, George Lakoff and Mark Johnson published <em>Metaphors We Live By, </em>a book that looked like it was about linguistics but was actually about the architecture of thought.</p><p>Their central claim: abstract thinking isn’t abstract at all. It’s built on metaphorical mappings from bodily experience to conceptual domains. And these metaphors aren’t decorative. They’re <em>constitutive</em>. They don’t just color how we talk about abstract ideas, they’re the cognitive infrastructure on which abstract ideas are constructed.</p><p>Consider how you think about arguments. Your claims are <em>indefensible</em>. She <em>attacked</em> every weak point. I <em>demolished</em> his position. He <em>shot down</em> all my objections. You <em>disagree</em>? Okay, <em>shoot</em>.</p><p>ARGUMENT IS WAR. Not as a literary flourish — as a cognitive reality. We conceptualize argumentation through the bodily experience of conflict: force, resistance, attack, defense, ground gained and lost.</p><p>Lakoff and Johnson argued that we don’t just <em>talk</em> about arguments this way. We <em>think</em> about them this way. We experience disagreement as combative. We feel defensive positions under threat. The metaphor shapes the cognition.</p><p>And it doesn’t stop there. TIME IS MONEY (you <em>spend</em> time, <em>waste</em> it, <em>save</em> it, <em>invest</em> it). UNDERSTANDING IS SEEING (I <em>see</em> what you mean, that’s a <em>clear</em> explanation, she has a <em>bright</em> idea). THEORIES ARE BUILDINGS (the argument <em>collapsed</em>, the foundation is <em>shaky</em>, we need to <em>construct</em> a framework). IDEAS ARE OBJECTS (let me <em>give</em> you that thought, <em>hold</em> that idea, <em>turn</em> it over in your mind).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*938WV5FnSPp5QvteescEJA.png" /></figure><p>Where do the source domains come from? The body. Conflict, vision, construction, object manipulation ; these are all sensorimotor experiences that come from moving a human body through a physical world.</p><p>Lakoff and Johnson argued that there’s a class of <em>basic</em> concepts : up, down, front, back, pushing, pulling, containment, that emerge directly from bodily experience. We understand “up” because we have bodies that stand erect. We understand “containment” because we experience our bodies as bounded volumes that things go in and out of. These basic concepts then serve as source domains for metaphorical mappings onto abstract targets.</p><p>The implication is striking: abstract thought isn’t independent of the body. It’s <em>parasitic</em> on the body. Strip away the embodied source domains, and the abstract target domains lose their cognitive foundation.</p><h3>Cognition as Embodied Action</h3><p>Lakoff and Johnson made the argument from language. Others made it from biology.</p><p>Varela, Thompson, and Rosch argued in <em>The Embodied Mind</em> (1991) that cognition isn’t computation over internal representations; it’s <em>enacted</em> through the dynamic coupling of brain, body, and environment. A living organism doesn’t passively receive information and compute responses. It actively brings forth a world of significance through how it moves and what it does. Barsalou’s work on perceptual symbol systems (1999) provided empirical support: when people think about “chair,” motor areas involved in sitting activate. Knowledge isn’t retrieved from abstract storage, it’s <em>re-enacted</em> through perceptual simulation.</p><p>John Searle’s Chinese Room (1980) arrives at the same boundary from a different direction. Imagine following rules to manipulate Chinese characters, producing perfect Chinese output without understanding a word. From outside: fluent. From inside: meaningless. Syntax isn’t semantics. A knowledge graph is, at bottom, a formal system of symbol manipulation. The Chinese Room says that no amount of structural elegance produces <em>understanding</em> of what the symbols mean.</p><h3>But Bicycles Can Ride Themselves</h3><p>Here’s where I want to push back on the conclusion that most people draw from embodied cognition, and where the post departs from the standard philosophical narrative.</p><p>Consider a self-balancing robot. It has no phenomenological experience of balance. It doesn’t <em>feel</em> the lean, doesn’t <em>know</em> what wind resistance is like. It has accelerometers, gyroscopes, PID controllers, and a reinforcement learning policy. It achieves the same functional outcome as a human cyclist through a completely different mechanism.</p><p>Does it “understand” balance the way you do? No. Does it stay upright? Yes.</p><p>This is the <strong>functionalist counterargument</strong>, and it matters enormously for practitioners. Searle’s Chinese Room proves that formal symbol manipulation doesn’t produce <em>understanding</em>. But understanding, in the rich phenomenological sense, may not be what engineering requires. What engineering requires is <em>correct behavior given the structure of the domain</em>. And formal representations, built by grounded humans, can deliver that.</p><p>The key move is noticing where the grounding actually lives.</p><p>When domain experts build an ontology for exercise science, defining concepts like “progressive overload,” “compound movement,” “time under tension,” “deload week”; those concepts weren’t generated by formal logic. They were forged through decades of embodied experience by athletes, coaches, and researchers who felt the weight, observed the adaptation, lived through the overtraining. By the time those concepts arrive in your knowledge graph as classes and properties and constraints, <em>the grounding work is already complete</em>. It was done by bodies. The graph inherits it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lADehDYWnfDLbZC7LRqa5w.png" /></figure><blockquote>An AI system reasoning over that graph doesn’t need its own body to leverage the abstractions productively. It needs the <em>output</em> of grounded human cognition, structured well. The ontology is a vessel that carries embodied understanding in formal clothing.</blockquote><p>This reframes the embodied cognition challenge entirely. The question isn’t “can a disembodied system understand?” It’s “can a disembodied system reason correctly over concepts that were grounded by embodied beings?” And the answer to that is demonstrably yes, with a critical caveat.</p><h3>The Caveat: Grounding Can Leak</h3><p>The caveat is that grounding isn’t automatically preserved through every pipeline stage.</p><p>When a domain expert explains progressive overload and you capture it as (ProgressiveOverload) --isA--&gt; (TrainingPrinciple) with properties like applies_when: &quot;adaptation plateaus&quot; and mechanism: &quot;incremental stimulus increase&quot;you&#39;ve preserved the relational structure but lost the embodied context. The expert knows <em>what it feels like</em> when adaptation plateaus. They know the difference between productive discomfort and injury-warning pain. That somatic knowledge didn&#39;t make it into the triple.</p><p>Most of the time, this is fine. The ontology operates at the level of relations and constraints, not at the level of felt experience. But there are failure modes:</p><p>When the ontology is built by automated extraction with no human review, the grounding degrades. An LLM extracting triples from papers will capture the propositional structure but may miss distinctions that domain experts consider obvious from experience, like the difference between soreness (normal, expected) and sharp pain (stop immediately). Those aren’t the same kind of “discomfort,” but they might look similar in text.</p><p>When the ontology crosses domains without re-grounding, assumptions carry over. “Progressive overload” means something specific in resistance training. The structural pattern (“incremental increase in stimulus to drive adaptation”) might apply metaphorically to skill learning or cognitive training, but the embodied specifics don’t transfer. An ontology that maps these too aggressively treats metaphorical similarity as structural equivalence.</p><p>This is where the neuro-symbolic thesis, which has been building across every essay in this series , crystallizes fully.</p><h3>The Linguistic Shadow, Revisited</h3><p>In the <a href="https://medium.com/@polymathik/your-brain-already-has-a-knowledge-graph-1bf5a33b8467">schemas essay</a>, I introduced the idea of LLMs capturing what I called “the linguistic shadow” ; the statistical residue left in text when people describe embodied experience.</p><p>When a food critic writes “the risotto had that perfect wave when plated,” there’s embodied expertise encoded in that description. When a physiotherapist writes “you’ll feel a stretch along the posterior chain, it should be a pulling sensation, not a pinching one,” there’s somatic knowledge leaking through language.</p><p>LLMs learn the distribution of such descriptions. They don’t <em>feel</em> the stretch. But they’ve internalized millions of descriptions of what stretches feel like, written by people who do feel them. This gives LLMs something that knowledge graphs categorically lack: <strong><em>statistical traces of embodied knowledge encoded in language</em></strong>.</p><p>This is the middle layer in the concentric-circle model from the <a href="https://medium.com/@polymathik/your-brain-already-has-a-knowledge-graph-1bf5a33b8467">schemas essay</a>: knowledge graphs provide formal structure without grounding, LLMs provide partial grounding through the linguistic shadow, and human experts provide the full embodied understanding that sources both.</p><p>The practical architecture: human experts provide grounding through curation and validation. The ontology captures the relational structure. The LLM fills the gap between formal relations and situated judgment, handling cases where the ontology’s rules are too coarse and the expert’s felt sense, as expressed in language, provides the needed nuance.</p><h3>Metaphors You’re Building With</h3><p>There’s one more practical implication of Lakoff and Johnson’s work that most ontology discussions miss, and it might be the most immediately useful one.</p><p>If abstract thought is built on bodily metaphors, then <em>ontology design</em> is built on bodily metaphors, whether the designer is aware of it or not.</p><p>When you model “data flow,” you’re encoding the INFORMATION IS A FLUID metaphor. Data <em>streams</em>, <em>pools</em>, <em>flows through pipelines</em>, hits <em>bottlenecks</em>. When you model “knowledge architecture,” you’re encoding the KNOWLEDGE IS A BUILDING metaphor, with <em>foundations</em>, <em>layers</em>, <em>scaffolding</em>, and structures that can <em>collapse</em>. When you model “dependency chains” or “reasoning paths,” you’re encoding spatial metaphors of connection and traversal.</p><p>These metaphors aren’t neutral. They shape what you can think about your domain and what you can’t. The FLUID metaphor makes it easy to think about throughput and blockages but hard to think about knowledge that doesn’t “flow”, knowledge that’s structural, static, or contextual. The BUILDING metaphor makes it easy to think about foundations and layers but hard to think about knowledge that’s emergent or self-organizing.</p><p>Being aware of your metaphors won’t eliminate them ; Lakoff and Johnson’s point is that you can’t think without them. But it lets you ask: is this the right metaphor for this domain? Would a different source domain unlock different reasoning patterns? If your exercise ontology treats the body as a MACHINE (inputs, outputs, fuel, maintenance), you’ll build one kind of structure. If you treat it as an ECOSYSTEM (adaptation, balance, feedback, resilience), you’ll build a different one.</p><blockquote>The embodied metaphor you choose shapes the ontology you produce, which shapes the reasoning your agents can do.</blockquote><h3>The Boundary and the Bridge</h3><p>Embodied cognition draws a real boundary around what formal knowledge representation can achieve on its own. Concepts are grounded in bodily experience. Formal systems manipulate symbols without that grounding. Syntax isn’t semantics.</p><p>But that boundary isn’t a wall. It’s a <em>design constraint</em>.</p><p>A self-balancing robot doesn’t need to feel balance to achieve it. A knowledge graph doesn’t need to understand progressive overload to reason correctly about training programs, provided it was built by humans who <em>do</em> understand, and who encoded that understanding into the relational structure.</p><blockquote>A system combining formal ontology (for structure and reasoning) with LLM capabilities (for the linguistic shadow of embodied knowledge) with human-in-the-loop curation (for actual grounding) can operate productively in domains it will never bodily experience.</blockquote><p>In the <a href="https://medium.com/@polymathik/the-map-is-not-the-territory-but-its-all-your-agent-has-b44ed42e4faf">first essay</a>, the question was <em>how wrong can your map be and still be useful?</em> In the <a href="https://medium.com/@polymathik/what-does-it-mean-to-know-something-and-can-a-machine-do-it-6e073a20de83">second</a>, <em>what counts as knowledge at all?</em> In the <a href="https://medium.com/@polymathik/we-know-more-than-we-can-tell-the-ontologists-hardest-problem">third</a>, <em>what resists being mapped?</em> In the <a href="https://polymathik.medium.com/your-brain-already-has-a-knowledge-graph-1bf5a33b8467">fourth</a>, <em>what shape does knowledge naturally take?</em> In the <a href="https://polymathik.medium.com/you-learned-dog-before-animal-and-that-matters-for-ai-325721a3e830">fifth</a>, <em>do categories live in the world or in the mind?</em></p><p>Here’s the embodied cognition question: <em>if your representations are ungrounded symbols, where does the meaning come from?</em></p><p>The answer: from the humans who build, curate, and validate them. The grounding doesn’t need to be in the machine. It needs to be in the pipeline. Keep the grounded humans in the loop, and your formal representations inherit their embodied understanding by proxy. Lose them, and your symbols float free ; syntactically valid, semantically empty.</p><p>But there’s still a question we haven’t addressed. We’ve argued that structure matters, that ontologies, hierarchies, and formal relations enable reasoning that pattern-matching alone can’t do. We’ve said it, but we haven’t <em>proved</em> it. Is there a mathematical argument for why structure reduces uncertainty and enables better reasoning? Is there a formal way to measure what organization buys you?</p><p>There is. Claude Shannon wrote it in 1948. we’ll explore more on this in the next article (to be published).</p><h3>References</h3><ol><li><a href="https://press.uchicago.edu/ucp/books/book/chicago/M/bo3637992.html">Lakoff, G. &amp; Johnson, M. (1980) — <em>Metaphors We Live By</em></a> — Conceptual metaphor theory and the embodied basis of abstract thought</li><li><a href="https://mitpress.mit.edu/9780262720212/the-embodied-mind/">Varela, F., Thompson, E. &amp; Rosch, E. (1991) — <em>The Embodied Mind</em></a> — Enactivism and cognition as embodied action</li><li><a href="https://doi.org/10.1017/S0140525X99002149">Barsalou, L.W. (1999) — “Perceptual Symbol Systems”</a> — Cognition as perceptual simulation, not amodal symbol manipulation</li><li><a href="https://doi.org/10.1017/S0140525X00005756">Searle, J. (1980) — “Minds, Brains, and Programs”</a> — The Chinese Room argument: syntax isn’t semantics</li><li><a href="https://plato.stanford.edu/entries/embodied-cognition/">Stanford Encyclopedia of Philosophy: Embodied Cognition</a> — Comprehensive overview of the field</li><li><a href="https://en.wikipedia.org/wiki/Conceptual_metaphor">Wikipedia: Conceptual Metaphor</a> — Overview of Lakoff &amp; Johnson’s theory with examples</li><li><a href="https://onlinelibrary.wiley.com/doi/full/10.1111/j.1756-8765.2012.01222.x">Lakoff, G. (2012) — “Explaining Embodied Cognition Results”</a> — Neural theory of metaphor and cognitive primitives</li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=dbf702fd3979" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Part 6 — Task and Application Ontologies: What Agents Actually Do]]></title>
            <link>https://polymathik.medium.com/part-6-task-and-application-ontologies-what-agents-actually-do-8571c66d40e1?source=rss-48f4b506bc93------2</link>
            <guid isPermaLink="false">https://medium.com/p/8571c66d40e1</guid>
            <category><![CDATA[agentic-ai]]></category>
            <category><![CDATA[ontology]]></category>
            <category><![CDATA[knowledge-graph]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[knowledge-management]]></category>
            <dc:creator><![CDATA[Sai]]></dc:creator>
            <pubDate>Sun, 17 May 2026 07:00:21 GMT</pubDate>
            <atom:updated>2026-05-17T07:00:21.667Z</atom:updated>
            <content:encoded><![CDATA[<p><em>Parts 4 and 5 were about nouns. Things that exist in the world. Part 6 is about verbs. What agents do with those things, and how the entire stack finally comes together when real data flows through it.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*v1E68QGfyiCr7EHfKtltaA.png" /></figure><p>In <a href="https://medium.com/@polymathik/part-5-domain-ontologies-teaching-agents-about-specific-worlds-716804ddf8eb">Part 5</a>, we snapped Workplace, Exercise, and Nutrition onto a shared upper foundation, with multi-faceted classification and cross-domain coherence. But everything we built was static. Meeting, WorkoutSession, Meal, MuscleGroup, Food. These are all things that exist. None of them describe what an agent actually <em>does</em>.</p><p>That’s what Layer 3 fixes. Task ontologies are the verb layer. They define the actions an agent can take, the conditions under which those actions are valid, and the outcomes they produce. Layer 4, the instance layer, populates everything with real data. Together, these two layers turn static structure into a system that can reason about real situations. This is also where the Dr. Chen example finally pays off across all four layers simultaneously.</p><h3>What Is a Task, Ontologically Speaking?</h3><p>The most influential work on formal task representation comes from NIST’s Process Specification Language (<a href="https://tsapps.nist.gov/publication/get_pdf.cfm?pub_id=821500">PSL</a>), developed in the late 1990s and standardized as ISO 18629. PSL gives us a precise vocabulary for talking about tasks as ontological entities.</p><p>The core insight from PSL is the distinction between <strong>activities</strong> and <strong>activity occurrences</strong>. An activity is a <em>type</em> of action. An activity occurrence is a <em>specific instance</em> of that action happening. PlanWorkout is an activity. “PlanWorkout for Sai on Tuesday April 7th, producing a leg day session with Squats and RDLs” is an activity occurrence.</p><p>This maps directly to our architecture. Activities live in Layer 3 (the task ontology). Activity occurrences live in Layer 4 (the instance layer). Same conceptual split as nouns: WorkoutSession (the type, in Layer 2) versus “Sai’s Tuesday leg day” (the instance, in Layer 4).</p><p>A task in Layer 3 has a structural shape that any task should fit:</p><ul><li><strong>Name</strong>: the verb itself (Schedule, PlanWorkout, LogMeal, AssessRecovery)</li><li><strong>Preconditions</strong>: what must be true before the task can execute</li><li><strong>Postconditions</strong>: what’s true after the task completes successfully</li><li><strong>Participants</strong>: which domain entities the task operates on</li><li><strong>Constraints</strong>: what must be satisfied during execution</li><li><strong>Agent</strong>: who or what performs the task</li><li><strong>Sub-tasks</strong>: how the task decomposes into simpler steps</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ioAS7uz40iY7dSPK4j9ipw.png" /></figure><p>These structural slots reference upper and domain ontology concepts. Participants come from Layer 2. Constraints we’ve already defined. Agents are upper-level entities. The task ontology doesn’t reinvent any of this. It describes how things flow when an agent acts on them.</p><h3>The Task Inventory for Our Domains</h3><p>Just as we built a domain ontology for exercise and nutrition by enumerating the concepts that matter, we now build a task ontology by enumerating the actions that matter.</p><p><strong>Workplace tasks</strong>: <em>Schedule</em> (place an Event into a <em>TemporalRegion</em>), <em>Assign</em> (allocate work to an <em>Agent</em>), <em>Review</em> (evaluate an <em>Artifact</em>), <em>Approve</em> (change the status of a Plan or document).</p><p><strong>Exercise tasks</strong>: <em>PlanWorkout</em> (compose a <em>WorkoutSession</em> from a <em>TrainingProgram</em> given current <em>RecoveryState</em>), <em>TrackExercise</em> (record an <em>Exercise</em> occurrence with parameters), <em>AssessRecovery</em> (evaluate <em>RecoveryState</em> from previous <em>WorkoutSessions</em> and elapsed time), <em>AdjustProgram</em> (modify a <em>TrainingProgram</em> based on progress data).</p><p><strong>Nutrition tasks</strong>: <em>LogMeal</em> (record a <em>Meal</em> with constituent <em>Foods</em> and quantities), <em>RecommendMeal</em> (given a <em>DietaryGoal</em> and current intake, suggest <em>Foods</em>), <em>CalculateMacros</em> (aggregate nutrient data across <em>Meals</em> against a <em>DietaryGoal</em>), <em>PlanMealPrep</em> (create a <em>MealPlan</em> considering goals and schedule).</p><p><strong>Cross-domain tasks</strong>: this is where stratification pays off. <em>OptimizeDay</em> composes <em>Schedule</em>, <em>PlanWorkout</em>, and <em>PlanMealPrep</em> into a coordinated plan satisfying constraints across all three domains simultaneously.</p><blockquote>This task can only exist because the three sub-tasks share upper ontology abstractions: they all operate on <em>Events</em> with <em>TemporalRegions</em>, all subject to <em>Constraints</em>, all coordinated by an <em>Agent</em> toward a Goal.</blockquote><p>A flat ontology can’t express <em>OptimizeDay</em> because it has no shared vocabulary across domains.</p><p><em>OptimizeDay</em> is the proof of the architecture. If the layered approach is right, this task should be expressible naturally.</p><h3>How Tasks Compose</h3><p>Tasks rarely execute as single atomic operations. They decompose into sub-tasks that combine in specific ways.</p><p><strong>Sequential composition</strong> is the simplest pattern. Task A must complete before Task B can begin. <em>PlanWorkout</em> might decompose as: <em>AssessRecovery</em>, then <em>SelectExercises</em>, then <em>AssignSetsAndReps</em>, then <em>OrderExercises</em>, then <em>FinalizeWorkoutPlan</em>. Each step’s postconditions become the next step’s preconditions.</p><p><strong>Parallel composition</strong> allows multiple sub-tasks to execute simultaneously. <em>OptimizeDay</em> starts by running <em>Schedule</em>, <em>PlanWorkout</em>, and <em>PlanMealPrep</em> in parallel because they operate on different domain entities. Then a sequential <em>ResolveConflicts</em> step checks that the proposed Meeting times don’t clash with <em>WorkoutSession</em> times, and that <em>NutrientTiming</em> windows align correctly with workout start times.</p><p><strong>Conditional composition</strong> is the interesting one. Sub-task selection depends on runtime state. <em>PlanWorkout</em> might branch on <em>RecoveryState</em>: if fully recovered, plan a heavy session; if partially recovered, plan a moderate hypertrophy session; if depleted, plan mobility work. The task ontology defines what <em>could</em> happen. The actual selection happens at runtime against real instance data.</p><p><strong>Iterative composition</strong> repeats a sub-task across a collection. <em>AssignSetsAndReps</em> iterates over each Exercise in a <em>WorkoutSession</em>, applying progressive overload logic to each one.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WtRVdLRrVm5nGPOU85LF7w.png" /></figure><p>The composition structure forms a directed acyclic graph rather than a strict tree. Sub-tasks can be reused by multiple parent tasks. <em>LookupHistoricalLoad</em> might be a sub-task of both <em>AssignSetsAndReps</em> (in <em>PlanWorkout</em>) and <em>AnalyzeProgress</em> (in <em>AdjustProgram</em>). This is why activities and activity occurrences are distinct concepts. The activity type exists once in the task ontology. Each use creates a new occurrence with its own context.</p><h3>Preconditions That Actually Mean Something</h3><p>Traditional AI planning (going back to STRIPS in 1971) modeled preconditions as propositions: true or false statements about the world. This works for toy problems but falls apart when you need continuous values, multiple objects, or temporal reasoning.</p><p>The ontological approach treats preconditions as <strong>constraints over entities and their properties</strong>. Instead of opaque propositions, preconditions become queries against the knowledge graph:</p><pre>Task: PlanWorkout<br>Preconditions:<br>  - There exists a TrainingProgram p where <br>    p.assignedTo = user AND p.status = active<br>  - There exists a RecoveryState r where <br>    r.assessedFor = user AND r.timestamp &gt; now - 24h<br>  - currentDate is in p.scheduledTrainingDays</pre><p>Three things change when preconditions look like this. First, when a precondition fails, you know exactly why in domain terms. Not “precondition false” but “no active <em>TrainingProgram</em> found for user.” Second, constraints inherit through the ontology. If <em>WorkoutSession</em> is-a <em>Event</em>, and Events must have <em>TemporalRegions</em>, then <em>WorkoutSession</em> inherits that requirement automatically. Third, the same task definition works for any user with any program, because it references types rather than specific instances.</p><p>Temporal preconditions show up everywhere in our domains. Pre-workout meals must be 60 to 90 minutes before <em>WorkoutSession.startTime</em>. <em>RecoveryWindow</em> for the posterior chain must have elapsed since the last hinge session. <em>MealPlan</em> must cover the next 7 days. A task ontology that can’t express temporal constraints can’t model these domains at all.</p><h3>The Instance Layer: Where Types Meet Reality</h3><p>Layer 4 is where everything becomes concrete. Types from Layers 1 through 3 get instantiated with real data.</p><p><em>Exercise</em> (type) becomes “Barbell Back Squat, 4 sets of 5 reps at 100kg, RPE 8.” <em>Meeting</em> (type) becomes “Co-founder sync with Dr. Chen, Tuesday 2:00pm, Room 4B.” <em>Meal</em> (type) becomes “Pre-workout meal at 10:30 AM: 200g chicken breast, 150g rice, broccoli.” <em>DietaryGoal</em> (type) becomes “150g protein daily, 2200 kcal, training day macros.”</p><p>The conceptual point that matters: an instance in Layer 4 is <strong>not just a database row</strong>. It’s a specific occurrence of an ontology class with all the structure and meaning the upper layers provide. When the system stores “user logged 200g chicken breast at 10:30 AM,” it’s not just a string and a timestamp. Through the ontology, that record is a Meal with a <em>TemporalRegion</em>, the chicken breast is a Food aligned to FoodOn’s chicken_breast_meat class, it contains Protein as a Macronutrient, it occurred 90 minutes before the user’s <em>WorkoutSession</em> (satisfying <em>NutrientTiming</em>), and it contributes to the user’s daily <em>ProteinTarget</em>. The instance is queryable by any of these dimensions independently.</p><p>The instance isn’t valuable in isolation. It’s valuable because it connects to everything else through the ontological structure. That connection is what the previous five parts of this series were building toward.</p><h3>How Instances Get Stored</h3><p>A practical question worth flagging briefly: how does instance data actually live somewhere?</p><p>Three patterns dominate. <strong>Native triple stores</strong> (GraphDB, Stardog, Apache Jena) keep everything as RDF in a graph database, with SPARQL queries hitting the ontology directly. Cleanest theoretically but slower for high-volume transactional workloads.</p><p><strong>Relational storage with ontology mapping</strong> uses PostgreSQL with formal mappings (R2RML) connecting tables to ontology classes, giving you SQL performance plus SPARQL reasoning when needed. This is what most production knowledge graph platforms actually do.</p><p><strong>Hybrid pragmatism</strong> uses the ontology for schema design, validation, and API contracts while storing instances wherever makes operational sense, maintaining the connection in application code.</p><p>For most production agent systems, the answer could be the second pattern for structured knowledge that benefits from reasoning, and the third for high-volume operational data that just needs to be fast.</p><h3>The Full Four-Layer Walkthrough</h3><p>Now we have all the pieces. Let’s trace a single user request through all four layers across both domains.</p><p>The request: <em>“I have a co-founder sync with Dr. Chen at 2pm. I need to train legs today. Plan my day.”</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eGfsoPEbCHyI5yLdhFJsAA.png" /></figure><p>Every step uses concepts from different domains. Every concept traces back to the same upper ontology. Every constraint is checked against a real instance state. This is what the layered architecture is for.</p><h3>What’s Next</h3><p>We now have a complete four-layer stack working across two domains with real-world reasoning. The architecture is finished.</p><p>The next three parts shift from architecture to ecosystem. Part 7 looks at the GraphRAG and graph database landscape (where flat ontology approaches dominate) and asks what stratification offers that they don’t. Part 8 gets practical: building a real knowledge graph for exercise and nutrition end-to-end, integrating EXMO, FoodOn, CDNO, and ChEBI. Part 9 covers benchmarking, because if stratification is supposed to be better, we need a way to measure it. Part 10 closes the series by stepping back to ask what stratified knowledge architecture means for the future of agent systems.</p><p><em>This is Part 6 of “The Layered Mind,” a 10-part series on ontological stratification for agentic AI. Follow along to catch each installment.</em></p><h3>References</h3><ol><li><a href="https://www.nist.gov/publications/process-specification-language-psl-overview-and-version-10-specification">Schlenoff, C. et al. (2000) — “The Process Specification Language (PSL) Overview and Version 1.0 Specification”</a> — NIST foundational work on activities, occurrences, and process ontology</li><li><a href="https://www.nist.gov/publications/ontology-process-specification-language">Gruninger, M. (2004) — “Ontology of the Process Specification Language”</a> — Theoretical grounding of PSL as a first-order theory</li><li><a href="https://arxiv.org/abs/2509.22434">Martorana, M. et al. (2025) — “An Ontology for Unified Modeling of Tasks, Actions, Environments, and Capabilities”</a> — OntoBOT, recent work unifying task and capability modeling</li><li><a href="https://www.iso.org/standard/35433.html">ISO 18629 Process Specification Language</a> — The international standard</li><li><a href="https://www.scitepress.org/Papers/2018/69224/69224.pdf">Bermejo-Alonso, J. et al. (2018) — “Reviewing Task and Planning Ontologies”</a> — Survey of task ontology approaches for autonomous systems</li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8571c66d40e1" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Part 5 — Domain Ontologies: Teaching Agents About Specific Worlds]]></title>
            <link>https://polymathik.medium.com/part-5-domain-ontologies-teaching-agents-about-specific-worlds-716804ddf8eb?source=rss-48f4b506bc93------2</link>
            <guid isPermaLink="false">https://medium.com/p/716804ddf8eb</guid>
            <category><![CDATA[knowledge-graph]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[agentic-ai]]></category>
            <category><![CDATA[ontology]]></category>
            <dc:creator><![CDATA[Sai]]></dc:creator>
            <pubDate>Thu, 26 Mar 2026 17:19:46 GMT</pubDate>
            <atom:updated>2026-03-26T17:19:46.620Z</atom:updated>
            <content:encoded><![CDATA[<p><em>The upper ontology has been sitting there, domain-free and patient, handling workplace scheduling without breaking a sweat. Now we throw an entirely different domain at it. If the layered architecture works, nothing in Layer 1 will need to change.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Voe6pWy7gd0Vlm0lKomIIQ.png" /></figure><p>In <a href="https://polymathik.medium.com/part-4-the-upper-ontology-what-all-your-agents-should-agree-on-cffb1218abcf">Part 4</a>, we designed a minimal upper ontology: 15 concepts grounded in the convergence of three philosophical traditions. We validated it against the Dr. Chen scheduling scenario. Every concept earned its place, and none of them mentioned meetings, colleagues, or companies.</p><p>That was deliberate. The whole point of an upper ontology is that it works for <em>any</em> domain. But we’ve only tested it against one. The real test is what happens when a second domain arrives.</p><h3>Why Exercise and Nutrition</h3><p>Exercise and nutrition are domains I spend real time in. I read research papers on training programming, dig into studies on protein timing, and experiment with periodization models. It’s a domain where I constantly wrestle with exactly the kind of information chaos that ontologies are supposed to solve: contradictory claims, context-dependent recommendations, and knowledge that spans sub-domains (what you lift affects what you eat, which affects how you recover, which affects what you lift next). Building an ontology for a domain you’re actively learning in surfaces genuine challenges that textbook examples never do.</p><p>It also happens to be structurally ideal for this series. Everyone understands workouts, meals, and protein, but beneath that accessibility lies real complexity: multiple exercise classification facets, nutritional hierarchies, temporal patterns, and goal-driven constraints. It has natural cross-domain tension with workplace (“schedule my leg day around the client presentation”). And existing formal ontologies already cover parts of the space: EXMO (Exercise Medicine Ontology) provides 434 BFO-aligned classes, FoodOn offers 9,600+ food product categories, and CDNO bridges foods to nutrient composition. We integrate what exists and extend where gaps are.</p><h3>Workplace Domain: A Quick Recap</h3><p>From <a href="https://polymathik.medium.com/part-4-the-upper-ontology-what-all-your-agents-should-agree-on-cffb1218abcf">Part 4</a>, our workplace domain specializes the upper ontology like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KIuvgwp4lqW7GPaOuL7roA.png" /></figure><p>Every workplace concept traces back to an upper concept via is-a inheritance. Meeting is-a Event. CompanyPolicy is-a InformationEntity. The upper ontology provides the structural skeleton; the domain fills in the vocabulary.</p><p>Now watch what happens when a completely different domain does the same thing.</p><h3>Building the Exercise Domain</h3><p>The first thing existing exercise ontologies teach us is that exercise resists single-axis classification. A barbell back squat is simultaneously a resistance exercise (by modality), a squat pattern (by movement), and a quadriceps/glute exercise (by anatomy). A flat ontology forces you to pick one. A properly structured domain ontology uses multiple facets.</p><p><strong>Modality facet</strong> (what kind of training): ResistanceExercise, CardiovascularExercise, MobilityExercise, BalanceExercise. This is the clinical perspective, roughly what EXMO provides.</p><p><strong>Movement pattern facet</strong> (what your body does): Push, Pull, Hinge, Squat, Lunge, Carry, Rotation. This is how most modern training programming works. You program patterns, not muscle groups.</p><p><strong>Anatomical target facet</strong> (what muscles are engaged): with primary and secondary targeting relationships. This is how most people actually think about exercise. “I want to train my back.”</p><p>Each facet classifies the same exercise from a different perspective. A deadlift is a ResistanceExercise (modality), a Hinge (movement pattern), and primarily targets the posterior chain: erector spinae, glutes, hamstrings (anatomy). All three classifications coexist without contradiction because they’re independent facets of the same entity.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iOO4UZYotzYa8hCQFqxGUQ.png" /></figure><p><em>One exercise, three independent classification facets. A flat ontology forces you to pick one. A layered ontology holds all three.</em></p><p>The specialization mappings to our upper ontology:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dv9hhd_0PE75euogn8X9eQ.png" /></figure><p>Notice what happened. We didn’t touch the upper ontology. We didn’t add new upper concepts. We specialized the same ones the workplace domain uses, just in a completely different direction. Event became WorkoutSession instead of Meeting. Constraint became RecoveryWindow instead of SchedulingRule. Goal became StrengthGoal instead of ProjectGoal. The structural pattern is identical.</p><p>EXMO gives us the clinical exercise classification and prescription parameters (the FITT-VP framework: frequency, intensity, time, type, volume, progression). What it doesn’t cover, and what we build ourselves, is the strength training programming layer: progressive overload parameters (sets, reps, load, RPE/RIR, tempo), periodization models, and the composition hierarchy from TrainingProgram down to individual exercises within a session. These are the concepts that no formal ontology covers but that every fitness practitioner uses daily.</p><h3>Building the Nutrition Domain</h3><p>The nutrition landscape is more mature. FoodOn plus CDNO together answer: “What is this food, where did it come from, how was it processed, and what nutrients does it contain?” The entity layer is essentially complete.</p><p>What’s missing is the reasoning layer. FoodOn can tell you that chicken breast contains roughly 31g of protein per 100g. It cannot tell you that eating it 90 minutes before a resistance training session optimizes muscle protein synthesis, or that you need three servings today to hit your 150g daily target given what you’ve already logged.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PKT9lccsSh6mFlhw-in0JQ.png" /></figure><p>Same pattern again. Food is-a MaterialEntity. Meal is-a Event. DietaryGoal is-a Goal. The upper ontology is doing the structural work; the domain provides the vocabulary.</p><h3>The Snap-In Moment</h3><p>Here is the payoff. Both domains now sit on the same upper foundation:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/915/1*83mkTzMvFx69Xp1GxUHcUQ.png" /></figure><p><em>Upper ontology concepts (Event, MaterialEntity, Plan, Constraint, Goal) branch downward into three independent domains. Each domain specializes the same abstractions in its own direction.</em></p><p>A third domain (finance, education, gaming) could snap in as a fourth branch without touching anything above it. That’s the generality gradient from <a href="https://polymathik.medium.com/part-3-from-flat-to-layered-the-theory-behind-ontological-stratification-a70f2e5513f8">Part 3</a> made concrete.</p><p>But the real test isn’t structural elegance. It’s whether cross-domain queries actually work. Consider this request:</p><p>“I have a co-founder sync with Dr. Chen at 2pm. I need to train legs today. Plan my day.”</p><p>An agent with this layered ontology can reason:</p><ol><li><strong>Meeting</strong> (workplace Event): Co-founder sync at 2pm, requires AgendaDoc, constrained by CompanyPolicy</li><li><strong>WorkoutSession</strong> (exercise Event): Leg day, includes Squats and Romanian Deadlifts, estimated 75 minutes</li><li><strong>RecoveryWindow</strong> (exercise Constraint): Heavy legs need pre-workout nutrition 60–90 minutes before</li><li><strong>Meal</strong> (nutrition Event): Pre-workout meal hitting 40g protein, timed correctly</li><li><strong>TemporalRegion</strong> (upper): Schedule backward from 2pm meeting: meal at 10:30, workout 12:00–1:15, shower and prep, meeting at 2:00</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*B0NnassoKiMT9JrKdFiyWg.png" /></figure><p><em>Three domains, one timeline. The agent coordinates meal timing, workout scheduling, and meeting constraints through shared upper abstractions.</em></p><p>Every step uses concepts from different domains. Every concept traces back to the same upper ontology. The agent doesn’t need special “cross-domain glue code.” It just follows inheritance upward to the shared abstractions and reasons from there.</p><h3>Competency Questions: How to Know Your Ontology Works</h3><p>Before building any domain ontology, define the questions it must answer. If it can’t answer them, it’s incomplete. If it can, it’s validated. This methodology, called competency questions, is standard practice in ontology engineering and the simplest quality gate you can apply.</p><p>The questions should be tiered by complexity:</p><p><strong>Single-domain, single-hop</strong> (basic taxonomy): “What type of exercise is a barbell back squat?” The ontology traverses one relationship: BarellBackSquat → is-a → ResistanceExercise.</p><p><strong>Single-domain, multi-hop</strong> (relationship traversal): “What exercises target the posterior chain?” Requires traversing exercise → targets → muscle group → part-of → muscle group chain.</p><p><strong>Cross-domain</strong> (the stratification payoff): “Can I fit a workout before my 2pm meeting with enough time for a post-workout meal?” Requires reasoning across exercise duration, nutrition timing constraints, and workplace scheduling.</p><p>If your ontology handles the first tier but fails at the third, your layering has gaps. The cross-domain questions are specifically what flat ontologies cannot answer, because they lack the shared upper abstractions that let an agent traverse between domains.</p><h3>What’s Next</h3><p>We now have two domains living on a shared foundation, with a methodology for evaluating whether they work. But so far we’ve focused entirely on nouns: the things that exist in each domain. In Part 6, we turn to verbs: what agents actually <em>do</em> with this knowledge. Task ontologies define agent capabilities (Schedule, PlanWorkout, RecommendMeal), and the instance layer populates everything with real data. That’s where the Dr. Chen example finally comes alive across all four layers simultaneously.</p><p><em>This is Part 5 of “The Layered Mind,” a 10-part series on ontological stratification for agentic AI. Follow along to catch each installment.</em></p><h3>References</h3><ol><li><a href="https://www.nature.com/articles/s41597-024-04217-9">Liu, X. et al. (2024) — “Core Reference Ontology for Individualized Exercise Prescription (EXMO)”</a> — The Exercise Medicine Ontology, 434 BFO-aligned classes</li><li><a href="https://www.nature.com/articles/s41538-018-0032-6">Dooley, D. et al. (2018) — “FoodOn: A Harmonized Food Ontology”</a> — Farm-to-fork food ontology, 9,600+ product categories</li><li><a href="http://www.cdno.info/">CDNO — Compositional Dietary Nutrition Ontology</a> — Bridges food classification to nutrient composition via ChEBI</li><li><a href="https://foodon.org/design/foodon-structure/">FoodOn Structure Overview</a> — BFO compatibility and faceted food description</li><li><a href="https://protege.stanford.edu/publications/ontology_development/ontology101.pdf">Noy, N.F. &amp; McGuinness, D. (2001) — “Ontology Development 101”</a> — Competency questions methodology</li><li><a href="https://obofoundry.org/">OBO Foundry — Joint Food Ontology Workgroup</a> — Coordinating interoperable food and nutrition ontologies</li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=716804ddf8eb" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Part 4 — The Upper Ontology: What All Your Agents Should Agree On]]></title>
            <link>https://polymathik.medium.com/part-4-the-upper-ontology-what-all-your-agents-should-agree-on-cffb1218abcf?source=rss-48f4b506bc93------2</link>
            <guid isPermaLink="false">https://medium.com/p/cffb1218abcf</guid>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[knowledge-graph]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[agentic-ai]]></category>
            <category><![CDATA[ontology]]></category>
            <dc:creator><![CDATA[Sai]]></dc:creator>
            <pubDate>Mon, 16 Mar 2026 12:42:36 GMT</pubDate>
            <atom:updated>2026-03-16T12:42:36.563Z</atom:updated>
            <content:encoded><![CDATA[<p><em>Three philosophical traditions. Thirty-six classes vs. twenty-five thousand terms. And a surprisingly practical question underneath it all: what does “reality” even mean when you’re building agents?</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dwQwVA959Ot_qrbV2w3VGg.png" /></figure><p>Your scheduling agent and your research agent both know what a “person” is. But do they agree on what a person <em>is</em>? Can a person be a patient and a colleague simultaneously? Is a person the same kind of thing as an organization? Can a software bot be a person?</p><p>These feel like philosophy seminar questions. They’re not. They’re the questions that determine whether your agents can share knowledge, coordinate decisions, and reason across domains without custom glue code for every pair of systems.</p><p>The answers live in the <strong>upper ontology</strong>: Layer 1 of the stratified architecture we’ve been building. In <a href="https://medium.com/@polymathik/why-ontologies-are-the-missing-layer-in-ai-agent-architecture-3f6ba117b7f2">Part 1</a>, we introduced the four-layer model. In <a href="https://medium.com/@polymathik/part-3-from-flat-to-layered-the-theory-behind-ontological-stratification-a70f2e5513f8">Part 3</a>, we explored the theory and design principles. Now we build the foundation everything else rests on.</p><h3>Three Traditions, One Problem</h3><p>The upper ontology is supposed to contain concepts so general that they apply to <em>any</em> domain. Things like Entity, Event, Process, Quality. The concepts at the very center of human understanding.</p><p>Three major traditions have attempted this, each starting from a different philosophical commitment.</p><p><strong><em>BFO (Basic Formal Ontology)</em></strong> takes the realist position. Created by philosopher Barry Smith and formalized as an ISO standard (21838–2:2021), BFO insists that an ontology should represent what actually exists, as confirmed by natural science.</p><p>It’s deliberately tiny: just 36 classes, zero domain-specific terms. Its top-level split divides all of reality into <strong>Continuants</strong> (things that persist through time, like objects and qualities) and <strong>Occurrents</strong> (things that unfold in time, like processes and events).</p><p>Over 600 ontologies in the biomedical sciences build on BFO, and in 2024 it was adopted alongside the Common Core Ontologies (CCO) as the baseline standard for US Department of Defense ontology work.</p><p>BFO’s sharpest contribution is a three-way distinction among <strong>Roles</strong>, <strong>Dispositions</strong>, and <strong>Functions</strong>.</p><p><strong><em>A Role</em></strong><em> </em>is externally grounded: Dr. Chen is a co-founder because of a social arrangement, and losing that role doesn’t change her physically.</p><p><strong><em>A Disposition</em></strong> is internally grounded: her ability to diagnose dental problems persists even after retirement, because it’s physically encoded in her neural pathways.</p><p><strong><em>A Function</em></strong> is a special Disposition that exists because of design or evolution: a heart’s function is to pump blood. For agent systems, this matters.</p><p>When you’re scheduling a dental appointment, you care about Dr. Chen’s Role (is she currently practicing?). When you need emergency dental advice on a Sunday, you care about her Disposition (does she have the knowledge?).</p><p><strong>DOLCE (Descriptive Ontology for Linguistic and Cognitive Engineering)</strong> takes the descriptive position. Created by Nicola Guarino (the same researcher whose stratification taxonomy we covered in <a href="https://medium.com/@polymathik/part-3-from-flat-to-layered-the-theory-behind-ontological-stratification-a70f2e5513f8">Part 3</a>), DOLCE models how humans <em>conceptualize</em> reality, not reality itself. Its categories are explicitly “cognitive artifacts” shaped by language, perception, and social convention.</p><p>DOLCE uses similar structural distinctions (Endurants and Perdurants instead of Continuants and Occurrents) but with richer treatment of social entities, information objects, and the cognitive dimensions of categorization. Where BFO says “reality determines the categories,” DOLCE says “our categories are the best tools we have for organizing experience.”</p><p><strong>SUMO (Suggested Upper Merged Ontology)</strong> takes the pragmatic position. Created by Ian Niles and Adam Pease under an IEEE working group, SUMO was assembled by merging multiple existing ontologies into a single comprehensive structure. It’s massive: over 25,000 terms and 80,000 axioms including its mid-level and domain extensions.</p><p>SUMO includes a complete mapping to WordNet (the English lexical database), meaning every English word sense connects to a formal concept. Its top-level split divides Entity into <strong>Physical</strong> (Object and Process) and <strong>Abstract</strong> (Set, Proposition, Quantity, Attribute). The strength is coverage. The weakness is that merging ontologies from different philosophical traditions introduced inconsistencies that were never fully reconciled.</p><h3>The Disagreement That Matters (And Why It Doesn’t)</h3><p>Underneath the structural differences lies a genuine philosophical divide: does the upper ontology describe <em>reality</em> or describe <em>how humans think about reality</em>?</p><p>BFO says reality. When two systems disagree about whether something is an Object or a Process, there’s a fact of the matter. Look at the science. This gives you a clear arbiter for disputes.</p><p>DOLCE says human conceptualization. We never have direct access to raw reality. Every category in every ontology is already filtered through human perception and cognition. Being honest about this is better than hiding philosophical assumptions behind a claim of objectivity.</p><p>This sounds like an impasse. But here’s where a different framing helps.</p><p>The philosopher Willard Van Orman Quine proposed a metaphor called the <strong>web of belief</strong>. Imagine all human knowledge as a web. At the edges are specific claims that get revised constantly: “eggs raise cholesterol,” “Pluto is a planet.” Closer to the center are more general beliefs: “food affects health,” “celestial bodies can be classified.” At the very center are beliefs so fundamental that revising them would tear apart virtually everything else: “objects exist,” “causes precede effects,” “processes unfold in time.”</p><p>Upper ontology concepts live at the center of that web. They’re stable not because they’re immune to evidence, but because any evidence that could overturn them would simultaneously overturn physics, biology, and everyday experience. If someone proved that processes don’t actually unfold in time, the ontology revision would be the least of our problems.</p><p>This maps directly to the stability gradient from <a href="https://medium.com/@polymathik/part-3-from-flat-to-layered-the-theory-behind-ontological-stratification-a70f2e5513f8">Part 3</a>. Instance data changes constantly. Domain concepts evolve with professional understanding. Upper concepts change essentially never, because they represent the most deeply converged human agreement about how reality is organized.</p><p>So the practical resolution is: we don’t need to settle the realism debate to build useful systems. What we need is to identify the concepts where BFO, DOLCE, and SUMO <em>converge</em>. If all three traditions, starting from different philosophical commitments, independently arrived at the same structural distinction, that distinction is about as stable as knowledge gets. That convergence zone becomes our upper ontology.</p><h3>Designing a Minimal Upper Ontology for Agents</h3><p>Here is what convergence gives us. Every structural distinction below appears in all three traditions, even if the terminology differs:</p><pre>Entity<br>├── Continuant (things that persist)<br>│   ├── IndependentContinuant<br>│   │   ├── MaterialEntity (people, food, equipment)<br>│   │   └── ImmaterialEntity (spaces, regions)<br>│   ├── DependentContinuant<br>│   │   ├── Quality (weight, duration, intensity)<br>│   │   └── RealizableEntity<br>│   │       ├── Role (co-founder, patient, coach)<br>│   │       ├── Disposition (skills, capacities)<br>│   │       └── Function (designed purpose)<br>│   └── InformationEntity (policies, recipes, agendas)<br>│<br>└── Occurrent (things that happen)<br>    ├── Process (a workout, a meeting, a digestion)<br>    ├── Event (a bounded happening)<br>    └── TemporalRegion (intervals, instants, durations)</pre><p>On top of this, four <strong>agentic extensions</strong> that none of the big three foreground but that every agent system needs:</p><ul><li><strong>Agent</strong>: an entity that can initiate Processes. Humans, software bots, organizations.</li><li><strong>Goal</strong>: a state of affairs an Agent is trying to bring about.</li><li><strong>Constraint</strong>: a condition that must hold or be avoided.</li><li><strong>Plan</strong>: an InformationEntity that specifies a sequence of Processes toward a Goal.</li></ul><p>Two design decisions here are deliberate departures from the established traditions. First, <strong>InformationEntity</strong> gets a prominent, intuitive home rather than hiding behind BFO’s “Generically Dependent Continuant” label. Training programs, company policies, meal plans: these are things agents reason about constantly. They deserve a clear category. Second, <strong>Agent</strong> gets upper-level status even though BFO handles it through Roles and Dispositions. For a series about agentic AI, the concept everything revolves around belongs in the foundation.</p><p>The total: roughly 15 concepts. That’s it. No domain terms, no exercise vocabulary, no workplace jargon. Just the shared abstractions that any domain can specialize.</p><h3>The Dr. Chen Test</h3><p>Theory is only as good as its application. Let’s trace our upper ontology through the recurring example: “Schedule a 90-minute meeting with Dr. Chen next Tuesday afternoon.”</p><p><strong>MaterialEntity</strong> does immediate work. Dr. Chen is one. The user is one. The conference room is one. Three independent physical things the agent must reason about.</p><p><strong>Role</strong> is where disambiguation lives. “Dr. Chen” matches three people in the knowledge graph: a co-founder (Role in the company), a dentist (Role in the healthcare context), and a sports medicine contact (Role in the fitness context). The agent must determine which Role is relevant to the scheduling request. Without the Role concept, disambiguation has no structure.</p><p><strong>InformationEntity</strong> provides the constraints and artifacts. The company policy “co-founder syncs need shared agendas” is an InformationEntity. The “Q1 Planning Agenda” document is one. The calendar data is one. The agent reads, references, and reasons about all of these.</p><p><strong>Event</strong> is what we’re creating. The meeting itself is an Event: a bounded happening with participants, a time, and a location. The entire request is about producing a specific Event.</p><p><strong>TemporalRegion</strong> makes the problem tractable. “Next Tuesday afternoon” defines a temporal region. “90 minutes” is a duration. Checking for contiguous available blocks is temporal reasoning.</p><p><strong>Constraint</strong> is what makes scheduling <em>hard</em>. “No meetings after 4pm Tuesday.” “Co-founder syncs need a shared agenda.” Without Constraint as a first-class concept, the agent can find open slots but can’t determine which ones are actually valid.</p><p><strong>Goal</strong> drives the interaction. The user’s goal is a scheduled meeting with Dr. Chen. The agent’s subgoal is finding a valid time slot. Goals are what separate purposeful action from random graph traversal.</p><p><strong>Agent</strong> is everywhere. The user (requesting), the scheduling system (fulfilling), Dr. Chen (whose availability matters). Every step involves agents acting on information toward goals under constraints.</p><p>Every concept earned its place. Nothing was dead weight. And critically, nothing required the words “meeting,” “colleague,” “company,” or any other domain-specific term. Those belong in Layer 2.</p><h3>What’s Next</h3><p>We now have a foundation: 15 upper-level concepts, validated against a concrete scenario, grounded in the convergence of three philosophical traditions.</p><p>But so far this foundation only supports one domain. In Part 5, we’ll put the architecture to its real test: snapping an entirely new domain onto this upper ontology without changing a single concept. Exercise and nutrition will arrive, and the same upper-level abstractions that handled workplace scheduling will handle workout planning, meal timing, and recovery assessment.</p><p>If the layered architecture works, the upper ontology won’t even notice.</p><p><em>This is Part 4 of “The Layered Mind,” a 10-part series on ontological stratification for agentic AI. Follow along to catch each installment.</em></p><h3>References</h3><ol><li><a href="https://mitpress.mit.edu/9780262527811/building-ontologies-with-basic-formal-ontology/">Smith, B. et al. (2015) — “Building Ontologies with Basic Formal Ontology”</a> — The BFO guidebook, published by MIT Press</li><li><a href="https://arxiv.org/abs/2308.01597">Borgo, S. et al. (2022) — “DOLCE: A Descriptive Ontology for Linguistic and Cognitive Engineering”</a> — Twenty years of DOLCE, comprehensive overview</li><li><a href="https://dl.acm.org/doi/10.1145/505168.505170">Niles, I. &amp; Pease, A. (2001) — “Towards a Standard Upper Ontology”</a> — The original SUMO paper</li><li><a href="https://www.iso.org/standard/74572.html">ISO/IEC 21838–2:2021</a> — BFO as an ISO top-level ontology standard</li><li><a href="https://philarchive.org/archive/ARPFRA">Arp, R. &amp; Smith, B. (2008) — “Function, Role, and Disposition in Basic Formal Ontology”</a> — The Role/Disposition/Function distinction</li><li><a href="https://www.researchgate.net/publication/220866366_A_Comparison_of_Upper_Ontologies">Mascardi, V. et al. (2007) — “A Comparison of Upper Ontologies”</a> — Comparative analysis of BFO, DOLCE, SUMO and others</li><li><a href="http://www.loa.istc.cnr.it/old/Papers/FOIS98.pdf">Guarino, N. (1998) — “Formal Ontology and Information Systems”</a> — The foundational stratification taxonomy</li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cffb1218abcf" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[I Rebuilt My AI Doc Pipeline From Scratch — Here’s Why]]></title>
            <link>https://polymathik.medium.com/i-rebuilt-my-ai-doc-pipeline-from-scratch-heres-why-a331b96dc8c3?source=rss-48f4b506bc93------2</link>
            <guid isPermaLink="false">https://medium.com/p/a331b96dc8c3</guid>
            <category><![CDATA[documentation]]></category>
            <category><![CDATA[developer-tools]]></category>
            <category><![CDATA[langgraph]]></category>
            <category><![CDATA[automation]]></category>
            <category><![CDATA[ai]]></category>
            <dc:creator><![CDATA[Sai]]></dc:creator>
            <pubDate>Wed, 11 Mar 2026 09:12:35 GMT</pubDate>
            <atom:updated>2026-03-11T09:12:35.641Z</atom:updated>
            <content:encoded><![CDATA[<h3>Local-first, any LLM, zero cloud dependency. Codebase Cortex v0.2 is a ground-up redesign.</h3><p>A few days ago, I wrote about <a href="https://polymathik.medium.com/i-built-an-ai-autopilot-that-keeps-my-notion-docs-in-sync-with-code-heres-why-7176566ef956">building an AI autopilot that keeps documentation in sync with code</a>. Five LangGraph agents that watch your commits and update your Notion pages automatically. No prompting, no manual effort.</p><p>But almost immediately, something bugged me. I was building a tool meant to remove friction from documentation, and the first thing it required was a Notion account. What if I just want markdown files in my repo, version-controlled and reviewable in PRs? What if I don’t want my codebase documentation locked into any platform?</p><p>So I rebuilt it. Version 2 is a ground-up redesign — local-first, any LLM, zero cloud dependency.</p><h3>Codebase Cortex: The 30-Second Version</h3><p><a href="https://github.com/sarupurisailalith/codebase-cortex">Codebase Cortex</a> is an AI pipeline that runs after every git commit and updates your documentation automatically. No prompting. No copy-pasting diffs into ChatGPT. You commit code, and the relevant docs change.</p><p>It uses nine specialized agents orchestrated by LangGraph:</p><pre>Git Commit → CodeAnalyzer → SemanticFinder → SectionRouter → DocWriter<br>→ DocValidator → TOCGenerator → TaskCreator → SprintReporter → docs/</pre><p>The important part: <strong>it doesn’t rewrite entire pages.</strong> It parses your docs into sections, figures out which sections are affected by the code change via semantic search, updates only those, and leaves everything else untouched. No “LLM drift.” No losing your hand-written paragraphs.</p><h3>What’s New in v0.2</h3><p>Version 1 was Notion-only. Version 2 is a ground-up redesign.</p><h3>Local-first. No cloud required.</h3><p>Docs are plain markdown files in your repo’s docs/ directory. No Notion account, no API keys for a documentation platform, no internet connection needed. Your docs live next to your code — version-controlled, reviewable in PRs, greppable.</p><p>Want Notion too? Run cortex sync --target notion and it pushes everything up. But it&#39;s optional.</p><h3>Any LLM. Even local ones.</h3><p>Cortex uses <a href="https://docs.litellm.ai/">LiteLLM</a> under the hood, which means it works with <strong>100+ model providers</strong>. Cloud APIs, self-hosted models, whatever you’ve got:</p><pre># Google Gemini<br>LLM_MODEL=gemini/gemini-2.5-flash-lite</pre><pre># Anthropic Claude<br>LLM_MODEL=anthropic/claude-sonnet-4-20250514</pre><pre># Ollama (local, no API key needed)<br>LLM_MODEL=ollama/llama3</pre><pre># vLLM on your GPU server<br>LLM_MODEL=hosted_vllm/my-model<br>LLM_API_BASE=http://localhost:8000</pre><p>No vendor lock-in. Swap models with one env variable.</p><h3>Human edits are sacred.</h3><p>Cortex tracks section hashes in a .cortex-meta.json file. If you manually edit a section, Cortex detects it and <strong>skips that section</strong> on future runs. Your hand-written content is never overwritten by the AI.</p><h3>Review before it lands.</h3><p>New docs get a draft banner. Run cortex accept after reviewing to clear them. Or use propose mode — changes go to a staging area, and you apply them when ready:</p><pre>cortex run --once                    # Writes directly to docs/<br>cortex config set DOC_OUTPUT_MODE propose  # Stage instead<br>cortex diff                          # Review staged changes<br>cortex apply                         # Apply when satisfied</pre><h3>CI/CD ready.</h3><p>Run cortex ci --on-pr in GitHub Actions to get doc impact analysis on every pull request. Run cortex ci --on-merge --auto-apply to auto-update docs when code lands on main. It outputs structured JSON so you can post PR comments, trigger notifications, whatever you need.</p><h3>Try It in 60 Seconds</h3><pre>pip install codebase-cortex</pre><pre>cd your-project<br>cortex init          # Pick your LLM, set up config<br>cortex run --once    # Run the pipeline — docs appear in docs/</pre><p>That’s it. On first run, Cortex scans your entire codebase and generates documentation. After that, it only updates what changed.</p><p>Want it to run automatically? Say yes to the git hook during cortex init, and every commit triggers a background doc update.</p><h3>The full toolkit</h3><pre>cortex run --once          Run the full pipeline<br>cortex accept              Clear draft banners after review<br>cortex prompt &quot;...&quot;        Direct the AI with natural language<br>cortex check               See which docs are stale<br>cortex sync --target notion   Push to Notion<br>cortex ci --on-pr          PR impact analysis for CI/CD<br>cortex embed               Rebuild the semantic search index<br>cortex map                 Visualize codebase topic clusters</pre><h3>Built for Developers Who Ship Fast</h3><p>Cortex is for teams (or solo devs) who iterate quickly and don’t have time for a “documentation sprint” every quarter. It’s not going to write your architectural decision records or your onboarding guides from scratch — but it will keep your existing docs accurate as the code evolves.</p><p>It’s open source, MIT licensed, and <a href="https://pypi.org/project/codebase-cortex/">on PyPI</a>.</p><p><strong>Contributions welcome.</strong> The <a href="https://github.com/sarupurisailalith/codebase-cortex">GitHub repo</a> has full docs, and a contributing guide.</p><p>Try it. Break it. Tell me what’s missing.</p><p><em>If you found this useful, follow me for more on AI-powered developer tools and automation. Read the </em><a href="https://polymathik.medium.com/i-built-an-ai-autopilot-that-keeps-my-notion-docs-in-sync-with-code-heres-why-7176566ef956"><em>first post about the Notion-integrated v1</em></a><em> if you’re curious about how this started.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a331b96dc8c3" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[I Built an AI Autopilot That Keeps My Notion Docs in Sync With Code — Here’s Why —]]></title>
            <link>https://polymathik.medium.com/i-built-an-ai-autopilot-that-keeps-my-notion-docs-in-sync-with-code-heres-why-7176566ef956?source=rss-48f4b506bc93------2</link>
            <guid isPermaLink="false">https://medium.com/p/7176566ef956</guid>
            <category><![CDATA[notion]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[documentation]]></category>
            <category><![CDATA[automation]]></category>
            <category><![CDATA[langgraph]]></category>
            <dc:creator><![CDATA[Sai]]></dc:creator>
            <pubDate>Sat, 07 Mar 2026 16:04:54 GMT</pubDate>
            <atom:updated>2026-03-10T15:14:03.070Z</atom:updated>
            <content:encoded><![CDATA[<h3>A Problem That Keeps Coming Back</h3><p>If you’ve worked on a codebase for more than a few months, you’ve probably had this experience. You open the architecture docs and realize they describe a version of the system from a while ago. The API reference mentions endpoints that were renamed or removed two sprints back. The system design doc still shows three services when you’ve since split one into two and added a message queue between them.</p><p>It’s not that anyone decided to let the docs rot. It just… happens. Updating documentation is a context switch that comes at the worst possible time — right after you’ve been deep in code, solving the actual problem. By the time you surface, the last thing you want to do is switch gears and write about what you just built.</p><p>I’ve hit this pattern repeatedly. I come from a data science background, but recently I’ve been building AI-powered solutions — sometimes solo, sometimes in small teams. And the same thing tends to happen: you’re iterating fast on a feature, and documentation quietly falls behind. A few weeks later, your docs are describing a system that no longer quite exists.</p><h3>“Just Use AI to Write Your Docs”</h3><p>That’s what I kept telling myself. And it’s partially true — LLMs are great at writing documentation. You can even put instructions in a CLAUDE.md or similar project-level config to tell your coding agent &quot;update docs as you develop.&quot; It works, to a degree.</p><p>But there are real gaps with this approach:</p><p><strong>It only works when you’re in the AI editor.</strong> If you make a quick fix in another editor, or a teammate pushes a commit, or you do a fast hotfix from the terminal — no docs get updated. The documentation instruction only fires when you’re actively coding with that specific tool.</p><p><strong>Each session starts fresh.</strong> Your coding agent doesn’t have persistent knowledge of what’s in your Notion workspace. It doesn’t know which of your 10 documentation pages are affected by the change you just made. You’d need to point it to the right pages every time, or hope it guesses correctly.</p><p><strong>Full-page rewrites cause drift.</strong> Without a structured merge strategy, the AI rewrites the entire page each time. Over multiple updates, the tone shifts, details get lost, and sections that didn’t need changing get subtly reworded. The content drifts further from what you originally wrote.</p><p><strong>No cross-codebase awareness.</strong> When you change auth/login.py, the related docs might live in your API reference, your architecture overview, and your getting started guide. A coding agent updates what you point it to — it doesn&#39;t have a semantic index of your entire codebase to find those connections automatically.</p><p><strong>No tracking or accountability.</strong> There’s no record of what changed, no task list for undocumented areas, no sprint summary. You’re relying on the AI to be thorough, with no way to verify what it missed.</p><p>What I wanted was something that closes these gaps:</p><ul><li><strong>Runs automatically</strong> on every commit — regardless of which editor or who made the change</li><li><strong>Knows which docs are related</strong> via semantic search across the entire codebase</li><li><strong>Updates only what changed</strong> — section-level merge, not full rewrites</li><li><strong>Tracks what’s still undocumented</strong> — creating tasks for gaps</li><li><strong>Reports on what happened</strong> — so I can see what was updated and why</li></ul><p>That’s not a prompt instruction. That’s a pipeline.</p><h3>Why This Matters (At Least for Me)</h3><p>The consequences of stale docs add up quietly, especially in small teams:</p><ul><li><strong>You waste your own time</strong> re-reading code you wrote three weeks ago because the docs you wrote alongside it are already out of date</li><li><strong>New team members struggle to self-serve</strong> — they read the docs, get confused, and come to you with questions the docs should have answered</li><li><strong>Knowledge lives in your head</strong>, and when you context-switch between projects, that knowledge fades</li><li><strong>Technical debt grows</strong> because it’s harder to see the full picture of how the system works today</li></ul><p>In some teams, the documentation becomes a kind of well-intentioned fiction — the Notion workspace looks full and professional, but the content is a snapshot of some past state that doesn’t match reality anymore.</p><h3>What If Docs Updated Themselves?</h3><p>The idea clicked when I was working on a project where the architecture had evolved significantly over a few weeks of rapid iteration. I went to update the docs and realized I’d need to rewrite almost everything — the API had changed, new components had been added, the data flow was different. It wasn’t a 10-minute update. It was an hour of context-rebuilding just to write accurate docs.</p><p>What if every time you committed code, an AI agent read the diff, understood what changed, found the related documentation, and updated just the relevant sections? Not a full rewrite — just the parts that the code change affected.</p><p>That’s what I set out to build.</p><h3>Introducing Codebase Cortex</h3><p><a href="https://github.com/sarupurisailalith/codebase-cortex">Codebase Cortex</a> is a multi-agent system that watches your codebase and keeps your Notion documentation in sync. You commit code. Your docs update in the background.</p><p>It uses five specialized AI agents orchestrated by LangGraph:</p><ol><li><strong>CodeAnalyzer</strong> — Reads your git diff and produces a structured analysis of what changed and why</li><li><strong>SemanticFinder</strong> — Searches a FAISS vector index to find code that’s semantically related to the changes</li><li><strong>DocWriter</strong> — Fetches your current Notion pages, generates only the changed sections, and merges them deterministically</li><li><strong>TaskCreator</strong> — Identifies areas that still lack documentation and creates task pages in Notion</li><li><strong>SprintReporter</strong> — Generates weekly sprint summaries from all the activity</li></ol><p>The key design choice is <strong>section-level updates</strong>. The DocWriter doesn’t rewrite entire pages — it parses the existing page into sections by markdown headings, asks the LLM to update only the sections affected by the code change, and merges them back. Unchanged sections are preserved exactly as-is. This helps prevent the “LLM drift” problem where AI-generated content gradually loses nuance with each full rewrite.</p><h3>How Is This Different From Using Claude Code or Cursor?</h3><p>This is the question that comes up most, and it’s a fair one. Here’s how I think about it:</p><p><strong>Trigger.</strong> Coding AI tools wait for you to prompt them. Cortex runs automatically on every git commit.</p><p><strong>Scope.</strong> You have to point coding AI at the right files. Cortex finds related docs via semantic search across the entire codebase — including pages you didn’t think to check.</p><p><strong>Consistency.</strong> Each time you ask an LLM to rewrite a page, the output is slightly different. Cortex uses deterministic section-level merging — unchanged sections stay identical, character for character.</p><p><strong>Memory.</strong> Coding AI starts fresh each session. Cortex maintains a persistent FAISS index and page cache across runs, so it knows your codebase and your docs over time.</p><p><strong>Multi-page awareness.</strong> With coding AI, you decide which pages to update. Cortex’s agents discover which pages need updating based on the diff.</p><p><strong>Tracking.</strong> Coding AI doesn’t track what it changed or what’s still missing. Cortex creates sprint reports, task items for gaps, and content hashes for audit.</p><p><strong>Workflow.</strong> Coding AI is interactive — it requires your attention. Cortex runs in the background after each commit and logs results.</p><p><strong>The core difference: coding AI tools are interactive — they do what you ask, when you ask. Cortex is designed to be autonomous — it runs as part of your development workflow, with no prompting required.</strong></p><p>It’s a bit like the difference between manually running a linter versus having it in your CI pipeline. Both do the same job, but one is more likely to happen consistently.</p><p>That said, Cortex also has an interactive mode (cortex prompt) for when you want to direct specific updates — so you get both.</p><h3>The Technical Architecture</h3><p>The system connects to Notion through the Model Context Protocol (MCP) — an open standard that lets AI tools interact with services through a structured interface. Instead of hand-rolling API calls, Cortex uses MCP’s tool interface to read and write Notion pages.</p><p>Here’s the pipeline:</p><pre>Git Commit → CodeAnalyzer → SemanticFinder → DocWriter → TaskCreator → SprintReporter → Notion</pre><p>Under the hood:</p><ul><li><strong>Embeddings</strong>: Code chunks are embedded using sentence-transformers (all-MiniLM-L6-v2) and indexed in FAISS. When code changes, the system finds semantically related documentation — not just files with matching names.</li><li><strong>HDBSCAN Clustering</strong>: The embedding space is clustered to build a “Knowledge Map” — automatically discovering topic groupings across the codebase.</li><li><strong>OAuth 2.0 + PKCE</strong>: Notion authorization happens through a browser-based OAuth flow. No manual token copying or integration setup — just click “Allow.”</li><li><strong>Pluggable LLMs</strong>: Works with Google Gemini, Anthropic Claude, or any model via OpenRouter. One environment variable swap.</li></ul><h3>It’s Not Just Automated — It’s Directable</h3><p>Beyond the automatic pipeline, there’s a prompt command for natural language instructions:</p><pre># Auto-detect which pages need updating<br>cortex prompt &quot;Add more code examples to all documentation&quot;</pre><pre># Target specific pages<br>cortex prompt &quot;Add error handling section&quot; --page &quot;API Reference&quot;</pre><pre># Target multiple pages<br>cortex prompt &quot;Update for v2 migration&quot; -p &quot;Architecture Overview&quot; -p &quot;API Reference&quot;</pre><p>The system fetches the target pages, sends them to the LLM with your instruction, shows a summary of planned changes, and asks for confirmation before writing. It’s the control you want alongside the automation.</p><h3>The Notion MCP Challenge</h3><p>I should be upfront — this project was partly motivated by the <a href="https://dev.to/challenges/notion-2026-03-04">Notion MCP Challenge on DEV.to</a>. The challenge asked developers to build something meaningful with Notion MCP, and it gave me the deadline pressure I needed to turn a long-standing idea into a working tool. You can read my <a href="https://dev.to/sarupurisailalith/commit-code-update-docs-building-an-ai-pipeline-with-notion-mcp-36he">challenge submission post on DEV.to</a> for the technical deep-dive into MCP tool integration patterns.</p><p>But the problem is something I’ve genuinely dealt with, the solution is something I’m actually using, and the tool is <a href="https://pypi.org/project/codebase-cortex/">published on PyPI</a> for anyone to try:</p><pre>pip install codebase-cortex<br>cd your-project<br>cortex init<br>cortex run --once</pre><h3>What I Learned Building This</h3><h3>1. LLMs are better at updating than creating from scratch</h3><p>Full-page generation tends to produce generic content. But when you give an LLM the existing page and say “update only the sections affected by this diff,” the output is noticeably better. The LLM has context, knows what’s already covered, and can make targeted changes.</p><h3>2. Deterministic merging matters a lot</h3><p>Asking an LLM to rewrite a full page every time causes “drift” — the tone, structure, and level of detail shift with each generation. By parsing pages into sections and merging updates deterministically, unchanged sections stay exactly as written. The LLM only touches what it needs to.</p><h3>3. Semantic search beats filename matching</h3><p>When you change auth/login.py, the related docs might be in docs/security.md, docs/api-reference.md, and docs/getting-started.md. Filename matching wouldn&#39;t find these connections. Embedding-based similarity search does.</p><h3>4. The git hook makes it stick</h3><p>Installing a post-commit hook that runs Cortex in the background means docs update without any conscious effort. You commit code. That’s it. This is the kind of automation that actually becomes part of your workflow rather than something you forget to run.</p><h3>5. Notion MCP has encoding quirks</h3><p>The Notion MCP server returns page content with literal \n (two-character sequences) instead of real newlines. Discovering and fixing this took more debugging time than I&#39;d like to admit. If you&#39;re building on Notion MCP, handle this in your content parser.</p><h3>Is This the End of Documentation Debt?</h3><p>Honestly, no. AI-generated documentation still benefits from human review. Section-level merging preserves quality better than full rewrites, but it’s not perfect. Complex architectural decisions still need a human to articulate the “why.”</p><p>But for keeping documentation accurate — making sure the API reference matches the actual API, making sure the setup guide uses the current commands, making sure the architecture description reflects the current system — that’s a lot of the tedious work. And it’s the work that most often gets skipped.</p><p>If you’ve found yourself thinking “our docs are out of date but there’s never time to fix them,” that’s the problem this tries to solve. Not by making documentation exciting, but by making it automatic.</p><h3>What’s Next</h3><p>Cortex currently writes to Notion, but the core pipeline — code analysis, semantic search, section-level merging — is platform-agnostic. The plan is to support local markdown files (writing directly to a docs/ folder in your repo), Confluence, and other documentation platforms. The goal is for Cortex to work wherever your docs already live.</p><p><strong>Codebase Cortex is open source and available on </strong><a href="https://github.com/sarupurisailalith/codebase-cortex"><strong>GitHub</strong></a><strong> and </strong><a href="https://pypi.org/project/codebase-cortex/"><strong>PyPI</strong></a><strong>.</strong></p><pre>pip install codebase-cortex</pre><p><em>If you found this useful, follow me for more on developer tooling, AI agents, and the infrastructure behind modern engineering workflows.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7176566ef956" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Part 3 : From Flat to Layered: The Theory Behind Ontological Stratification]]></title>
            <link>https://polymathik.medium.com/part-3-from-flat-to-layered-the-theory-behind-ontological-stratification-a70f2e5513f8?source=rss-48f4b506bc93------2</link>
            <guid isPermaLink="false">https://medium.com/p/a70f2e5513f8</guid>
            <category><![CDATA[agentic-ai]]></category>
            <category><![CDATA[ontology]]></category>
            <category><![CDATA[knowledge-graph]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[machine-learning]]></category>
            <dc:creator><![CDATA[Sai]]></dc:creator>
            <pubDate>Wed, 04 Mar 2026 15:05:58 GMT</pubDate>
            <atom:updated>2026-03-04T15:05:58.336Z</atom:updated>
            <content:encoded><![CDATA[<p><em>Your agent knows that “Meeting” and “Schedule” are both concepts. But it doesn’t know that one is a thing in the world and the other is something agents do. That confusion has a name, and a fix.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QkUjOzVvPYs6_oeG6FqeNA.png" /></figure><p>Here’s a bug that no amount of prompt engineering will fix.</p><p>Your scheduling agent has a knowledge graph. In it, “Meeting,” “Schedule,” “Tuesday,” and “Dr. Chen” all live at the same level. The agent knows they’re connected. But when you ask it to check constraints before booking, it tries to <em>schedule a Schedule</em> and <em>meet a Meeting</em>. It has no way to distinguish between a type of event, an action it can perform, and a specific instance of either.</p><p>This isn’t a data problem. It’s a structural one. The agent’s ontology is flat, and flat ontologies can’t encode the difference between what <em>exists</em>, what agents <em>do</em>, and what’s happening <em>right now</em>.</p><p>In <a href="https://medium.com/@polymathik/why-ontologies-are-the-missing-layer-in-ai-agent-architecture-3f6ba117b7f2">Part 1</a>, we introduced ontological stratification as the solution. In <a href="https://medium.com/@polymathik/triples-graphs-and-your-first-knowledge-graph-ac2d9bfa745a">Part 2</a>, we built our first knowledge graph and explored how structure enables reasoning. Now it’s time to go deeper into the theory: where did these layers come from, what principles govern them, and how do you decide what goes where?</p><h3>Guarino’s Architecture: The Origin of the Layers</h3><p>The four-layer model we’ve been working with traces back to a 1998 paper by Nicola Guarino called “Formal Ontology and Information Systems.” It’s one of the most cited papers in applied ontology, and it introduced a taxonomy that the field has been building on ever since.</p><p>Guarino’s original diagram isn’t actually a stack. It’s a diamond:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*B5tCZ6M3zYErx6BxWqWnHA.png" /></figure><pre>          top-level ontology<br>              /        \<br>    domain ontology   task ontology<br>              \        /<br>       application ontology</pre><p>Top-level concepts (space, time, object, event, action) sit at the apex. Domain ontologies and task ontologies branch out in parallel, specializing those top-level concepts in different directions. Domain ontologies describe vocabularies for specific fields like medicine or finance. Task ontologies describe activities like diagnosing or selling. Application ontologies sit at the bottom, where a particular domain meets a particular task.</p><p>We’ve linearized this into a four-layer stack for this series, which is a useful simplification. But the diamond shape captures something important: domain knowledge and task knowledge are <em>independent dimensions</em>. A scheduling task can operate across healthcare, finance, or personal productivity. A healthcare domain supports diagnosing, prescribing, and scheduling. The layers aren’t a simple pipeline. They’re a coordinate system.</p><p>Guarino also drew a sharp line that matters for practitioners: the ontology is not the knowledge base. An ontology contains “facts assumed to be always true by a community of users, in virtue of the agreed-upon meaning of the vocabulary used.” A knowledge base also contains facts about particular states of affairs. In our model, Layers 1 through 3 are the ontology. Layer 4 (instances) is the knowledge base built on top of it. This distinction matters because the ontology should be stable and shared, while the knowledge base changes constantly.</p><p>There’s a deeper implication here that connects to something we explored in the companion series. Guarino showed formally that an ontology only <em>approximates</em> a conceptualization through two levels of indirection. Your ontology constrains the intended models of a language, and those intended models are themselves only a partial characterization of how you actually think about the domain. The ontology is a map of a map. It’s lossy by design. Recognizing this keeps you humble about what your knowledge graph can and can’t capture.</p><h3>DOLCE: What Good Stratification Looks Like</h3><p>Theory is one thing. Seeing it work is another. DOLCE (Descriptive Ontology for Linguistic and Cognitive Engineering) is the first foundational ontology to be fully axiomatized, developed by Guarino’s group at the Laboratory for Applied Ontology in Italy. It’s been stable for over twenty years, which is remarkable for any formal system.</p><p>What makes DOLCE distinctive is its philosophical stance. It doesn’t claim to describe reality as it objectively is. It aims to capture the ontological categories underlying natural language and human commonsense. The categories are, in DOLCE’s own words, “cognitive artifacts” influenced by language, perception, and social conventions. This is a <em>descriptive</em> approach, not a prescriptive one.</p><p>For agent builders, this matters. An agent that reasons using categories aligned with how humans actually think and talk will produce more intuitive responses than one built on a purely formal logical foundation. If your agent needs to understand that a “meeting” is something that unfolds in time while a “conference room” persists through time, DOLCE gives you that distinction out of the box. Meetings are <em>perdurants</em> (they have temporal parts, like a beginning and an end). Conference rooms are <em>endurants</em> (they persist as wholes through time). This isn’t pedantic classification. It determines what properties make sense: a meeting has a duration, a room has a location. Mixing these up produces nonsensical inferences.</p><p>DOLCE was built using the OntoClean methodology (also by Guarino, with Welty), which gives you concrete tools for checking whether your class hierarchy is well-formed. The key idea is that ontological classes have <em>meta-properties</em> that constrain how they can be organized:</p><p><strong>Rigidity</strong> asks: is every instance of this class <em>necessarily</em> an instance? “Person” is rigid because you can’t stop being one. “Student” is anti-rigid because you can graduate. If you place an anti-rigid class above a rigid one in your hierarchy, you’ve made a structural error.</p><p><strong>Identity</strong> asks: does this class carry a criterion for recognizing its instances over time? “Person” does (same person yesterday and today). “Red thing” doesn’t (redness isn’t an identity criterion).</p><p>These aren’t abstract concerns. They’re debugging tools. If your agent treats “Employee” as a fundamental category rather than a role that a Person plays, it will struggle when the same individual appears in the graph as both an employee and a patient. OntoClean catches that mistake before it reaches production.</p><h3>Five Principles for Drawing Layer Boundaries</h3><p>The hardest practical question in ontological stratification is: which layer does this concept belong in? Here are five principles that help.</p><p><strong>1. The generality gradient.</strong> Each layer should be strictly more general than the one above it. If a concept applies equally to healthcare and finance, it belongs in the upper ontology. If it’s specific to scheduling regardless of domain, it belongs in the task layer. If it only makes sense within healthcare, it’s a domain concept. When you’re unsure, ask: “Would a practitioner in a completely different field recognize this concept?” If yes, push it down toward the foundation.</p><p><strong>2. The stability gradient.</strong> Lower layers change less frequently. Your upper ontology should be nearly immutable. Your domain ontology evolves when the field evolves. Your task layer changes when you add new agent capabilities. Your instances change with every interaction. If you find yourself frequently modifying a concept, it probably belongs higher in the stack than you placed it.</p><p><strong>3. The noun/verb heuristic.</strong> Domain ontologies primarily model <em>things</em>: entities, relationships, qualities. Task ontologies model <em>actions</em>: what agents do with those things. “Meeting” is a noun, a type of Event, and belongs in the domain layer. “Schedule” is a verb, something an agent does, and belongs in the task layer. This heuristic isn’t absolute (some concepts straddle the line), but it catches the most common misclassifications.</p><p><strong>4. Downward inheritance.</strong> Every concept should trace back to something in the layer below it through specialization. Patient is-a Person. Schedule requires Agent and produces Event. If a domain concept doesn’t specialize any upper concept, you’ve created an orphan that can’t participate in cross-domain reasoning. If you find orphans, either your upper ontology is missing something or the concept is misplaced.</p><p><strong>5. The “snapping in” test.</strong> You should be able to add a new domain ontology without touching the upper ontology. You should be able to add new task definitions without rewriting domain concepts. If adding a healthcare domain forces changes to your foundational layer, the boundary is wrong. Each layer should be independently extensible.</p><h3>What Goes Wrong: Five Anti-Patterns</h3><p>Knowing the principles is half the battle. Recognizing violations is the other half.</p><p><strong>Level smashing</strong> puts instances and classes in the same layer. When “Dr. Chen” (a specific person) and “Person” (a type) are peers in your graph, you lose the ability to reason about types versus tokens. An agent can’t answer “how many people are in the system?” if people and the concept of personhood live at the same level.</p><p><strong>Leaking abstraction</strong> puts domain-specific concepts in the upper ontology. If your foundational layer includes “Patient,” it’s no longer domain-independent. Now every agent in every domain has to understand medical terminology. The test: would this concept make sense to someone who has never worked in your field?</p><p><strong>Frozen action</strong> models activities as domain entities instead of task concepts. If “Scheduling” lives in your domain layer as a noun (a type of plan), your task layer has no way to represent it as something agents <em>perform</em>. The agent knows scheduling exists but doesn’t know it can do it.</p><p><strong>Orphaned specialization</strong> creates domain concepts that don’t trace back to any upper concept. A “MeetingRoom” with no connection to an upper-level Location or PhysicalSpace can’t participate in cross-domain queries. An agent reasoning about “where things happen” will never find it.</p><p><strong>Rigidity violation</strong> places anti-rigid concepts above rigid ones. SNOMED CT, one of the largest medical ontologies, had systematic problems with part-of relationships that caused diabetes to be classified as a disorder of the abdomen. When your hierarchy violates ontological meta-properties, the inferences that fall out can be absurd, and they’re hard to catch without principled tools like OntoClean.</p><h3>Schema.org: Stratification in the Wild</h3><p>If this all feels academic, consider Schema.org. It’s the most widely deployed ontology on the planet: 827 types, 1,528 properties, used by millions of websites to structure data for search engines. It was founded in 2011 by Google, Microsoft, Yahoo, and Yandex. And it has layered structure even though it was never explicitly designed with Guarino’s framework.</p><p>The root type Thing functions as an upper ontology. Broad types like Person, Event, Organization, and Action sit one level below. Domain-specific types like MedicalEntity and FinancialProduct specialize those. And individual web pages create instances by marking up specific people, events, and products.</p><p>Schema.org also demonstrates the “snapping in” principle in production. Community extensions for bibliographic data, automotive, and health/life sciences add domain-specific vocabulary without modifying the core hierarchy. New domains extend the foundation rather than rewriting it.</p><p>The Schema.org team explicitly notes that their vocabulary “is not intended to be a global ontology of the world.” It’s pragmatic, tolerates multiple inheritance, and favors practical coverage over formal purity. That’s a useful reminder: you don’t need a philosophically perfect ontology to get real value from stratification. But understanding the theory helps you make better trade-offs when the pragmatic compromises come.</p><h3>What’s Next</h3><p>We now have the theoretical foundation: where the layers come from, what principles govern them, and what goes wrong when you violate them. Starting with Part 4, we’ll build each layer from the ground up, beginning with the upper ontology and the universal concepts that all your agents can share. That’s where BFO, DOLCE, and SUMO come in, and where the Dr. Chen scheduling example starts to pay off in full.</p><p><em>This is Part 3 of “The Layered Mind,” a 10-part series on ontological stratification for agentic AI. Follow along to catch each installment.</em></p><h3>References</h3><ol><li><a href="http://www.loa.istc.cnr.it/old/Papers/FOIS98.pdf">Guarino, N. (1998) — “Formal Ontology and Information Systems”</a> — The foundational taxonomy of ontology types</li><li><a href="https://arxiv.org/abs/2308.01597">Borgo, S. et al. (2022) — “DOLCE: A Descriptive Ontology for Linguistic and Cognitive Engineering”</a> — The first axiomatized foundational ontology, twenty years of stability</li><li><a href="https://doi.org/10.1145/505168.505202">Guarino, N. &amp; Welty, C. (2002) — “Evaluating Ontological Decisions with OntoClean”</a> — Meta-properties for validating class hierarchies</li><li><a href="https://protege.stanford.edu/publications/ontology_development/ontology101.pdf">Noy, N.F. &amp; McGuinness, D. (2001) — “Ontology Development 101”</a> — Practical methodology for building ontologies</li><li><a href="https://schema.org/docs/datamodel.html">Schema.org — Data Model</a> — The most widely deployed ontology, pragmatic stratification at scale</li><li><a href="https://oa.upm.es/6115/">Poveda, M. et al. (2010) — “Common Pitfalls in Ontology Development”</a> — Classification of anti-patterns and modeling errors</li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a70f2e5513f8" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[You Learned “Dog” Before “Animal” — And That Matters for AI]]></title>
            <link>https://polymathik.medium.com/you-learned-dog-before-animal-and-that-matters-for-ai-325721a3e830?source=rss-48f4b506bc93------2</link>
            <guid isPermaLink="false">https://medium.com/p/325721a3e830</guid>
            <category><![CDATA[cognitive-science]]></category>
            <category><![CDATA[knowledge-graph]]></category>
            <category><![CDATA[prototype-theory]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[ontology]]></category>
            <dc:creator><![CDATA[Sai]]></dc:creator>
            <pubDate>Tue, 03 Mar 2026 11:09:59 GMT</pubDate>
            <atom:updated>2026-03-03T11:09:59.815Z</atom:updated>
            <content:encoded><![CDATA[<p><em>For over two millennia, categories were assumed to have crisp boundaries. Then a psychologist proved that a robin is a better bird than a penguin — and that your ontology should probably care.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XO2UDMSIAUBjUJtIq-7bQA.png" /></figure><p>You’re a parent. Your toddler points at a golden retriever on the sidewalk. You could say “animal.” You could say “mammal,” “canine,” “golden retriever,” or even “Buddy.” All true. But you don’t say any of those things. You say “dog.”</p><p>Every parent does this. Across languages, cultures, continents — adults naming things for children converge on the same level of abstraction. Not too general, not too specific. The middle.</p><p>In 1958, a Harvard psychologist named Roger Brown noticed this pattern and asked a deceptively simple question: <em>how shall a thing be called?</em> A dime is also a coin, money, a ten-cent piece, an object made of metal. But when talking to a child, you say “money” — not “dime” (too specific for someone who doesn’t yet understand denominations) and not “asset” (too abstract for someone learning what the physical world <em>is</em>).</p><p>Brown couldn’t fully explain why this level felt so natural. But he noticed that children’s vocabulary isn’t “concrete” in the way people assumed — it’s concrete at a <em>specific level of abstraction</em>. There’s a sweet spot, and humans find it instinctively.</p><p>Decades later, Brown’s student Eleanor Rosch turned that observation into one of the most consequential research programs in cognitive science — and in doing so, dismantled an assumption about categories that had stood since Aristotle.</p><h3>The 2,300-Year Assumption</h3><p>For most of intellectual history, categories were assumed to work like sets in mathematics. Something either is or isn’t a member. The category “bird” is defined by necessary and sufficient conditions — feathers, wings, lays eggs — and anything meeting those conditions is a bird, period. Anything that doesn’t, isn’t. Boundaries are crisp. Membership is binary. Aristotle laid this out. Formal logic inherited it. And when computer scientists built ontologies two millennia later, they built them the same way. In OWL, something either is or isn’t an instance of a class. There’s no “sort of.”</p><p>Ludwig Wittgenstein put the first crack in this foundation. In <em>Philosophical Investigations</em> (1953), he asked readers to consider the category “games.” Board games, card games, ball games, Olympic games, children’s games, war games. What do they all have in common? Try to find a single feature shared by every member.</p><p>You can’t. Some games have winners, but not all (a child tossing a ball against a wall). Some involve competition, but not all (ring-around-the-rosy). Some use equipment, but not all. Some are fun, but some professional athletes might disagree. What holds the category together isn’t a shared essence but what Wittgenstein called <strong>family resemblance</strong> — a network of overlapping similarities, like the features shared across an extended family. Cousin A and Cousin B both have red hair. Cousin B and Cousin C both have the family nose. Cousin C and Cousin A both have blue eyes. No single trait runs through all of them, but the family is still recognizably a family.</p><p>This was philosophy. What Rosch did was turn it into science.</p><h3>Not All Birds Are Created Equal</h3><p>Eleanor Rosch’s first major finding sounds obvious once you hear it, but its implications are radical: <strong>category members aren’t equal.</strong></p><p>Ask people to rate how “good” an example of “bird” various species are, and you get overwhelming agreement. Robin and sparrow score near the top. Chicken and duck land in the middle. Penguin and ostrich sit near the bottom. People don’t deliberate about this. They <em>know</em> — instantly, reliably, across subjects — that a robin is a “better” bird than a penguin.</p><p>This isn’t just a preference. It shows up in measurable cognitive processing. People verify that “a robin is a bird” faster than “a penguin is a bird.” In free recall tasks (“name as many birds as you can”), prototypical members come out first. Children learn prototypical members before atypical ones. The internal structure of the category isn’t flat — it’s organized around a center, with membership fading outward like a gradient.</p><p>Rosch formalized this through what she called <strong>family resemblance scores</strong>, building directly on Wittgenstein’s insight. The most prototypical members of a category share the most features with other members and the fewest features with members of <em>contrasting</em> categories. A robin has wings, feathers, flies, sings, builds nests, is small — features shared broadly across birds and rarely found in non-birds. A penguin has feathers and lays eggs but doesn’t fly, lives in Antarctic colonies, and swims — features that overlap less with the rest of the bird category and more with things that aren’t birds at all.</p><p>The formal measure underlying this is <strong>cue validity</strong> — the conditional probability that something belongs to a category given a particular feature. “Has feathers” has high cue validity for “bird” because most feathered things are birds. “Swims” has low cue validity because lots of non-birds swim. Prototypical category members are those where the sum of cue validities across their features is highest.</p><p>Notice what’s happened here. We’ve gone from Boolean membership (is/isn’t a bird) to probabilistic membership (how bird-like is this thing?). That shift is fundamental, and formal ontologies haven’t fully reckoned with it.</p><h3>The Basic Level: Where Cognition Lives</h3><p>Rosch’s second finding was, if anything, even more consequential — and it’s the one that connects directly back to Roger Brown’s naming puzzle.</p><p>Categories exist at different levels of abstraction, organized in taxonomic hierarchies:</p><p><strong>Superordinate</strong>: Animal, Furniture, Vehicle — very general, few features shared across members. What do a dog, a snake, and a jellyfish have in common <em>physically</em>? Not much.</p><p><strong>Basic level</strong>: Dog, Chair, Car — the sweet spot. Members share many features (dogs have four legs, fur, tails, bark), the category is maximally distinct from neighboring categories (dogs are clearly different from cats), and — crucially — this is the level where people interact with the world physically. You sit in a “chair,” not in “furniture.” You pet a “dog,” not an “animal.”</p><p><strong>Subordinate</strong>: Golden Retriever, Rocking Chair, SUV — highly specific, too much overlap with neighbors. A golden retriever and a labrador share almost all their features. The additional precision buys relatively little.</p><p>Rosch and her colleagues demonstrated empirically that the basic level is cognitively privileged in nearly every way you can measure. It’s the level where the most behavioral actions cluster (what you <em>do</em> with a chair vs. what you <em>do</em> with furniture). It’s the level with the most distinctive motor programs. It’s the first level children learn — “dog” before “animal” and before “golden retriever,” exactly as Brown had observed. It’s the level adults default to in naming. And it’s the level with the highest cue validity — basic-level categories maximize the information you get with the least cognitive effort.</p><p>This is what Brown’s intuition was pointing at: the basic level is where language and cognition meet most efficiently. When a parent points at a dog and says “dog,” they’re not choosing arbitrarily. They’re selecting the level of abstraction that gives the child the most useful category — specific enough to be informative, general enough to be broadly applicable.</p><p>Here’s why this matters for ontology builders: <strong>formal ontologies are typically designed top-down.</strong> You start with the most abstract categories (Entity, Thing, Event) and specialize downward. But humans learn bottom-up — starting at the basic level and then abstracting upward to superordinates and downward to subordinates. If you’ve ever sat in a room with domain experts trying to elicit an ontology and found that the most natural, most readily articulated concepts are the mid-level ones — not the abstract upper categories and not the hyper-specific instances — that’s the basic level effect. It’s not a failure of elicitation technique. It’s how human minds organize knowledge.</p><h3>The Exemplar Counterpoint: Store Everything, or Abstract the Pattern?</h3><p>Not everyone was convinced that prototypes explained categorization. Starting in the late 1970s, a competing theory emerged that offered a fundamentally different account of how categories work in the mind.</p><p><strong>Exemplar theory</strong>, developed by researchers like Douglas Medin, Robert Nosofsky, and Edward Smith, argued that you don’t abstract a prototype at all. Instead, you store <em>every instance</em> you encounter. When you need to categorize something new, you compare it to all the stored examples and go with the category whose exemplars it most resembles. There’s no summary representation — just a growing database of specific encounters.</p><p>The evidence for this is real. Exemplar models explain certain phenomena that prototype models struggle with. People are sensitive to the <em>variability</em> within categories — they know that the “bird” category is more diverse than the “dog” category, which pure prototype abstraction would wash out. People can learn categories that have no central tendency at all — where the members form two clusters with empty space between them, which a single prototype can’t capture. And people retain knowledge of specific instances even after extensive experience — you remember <em>that particular</em> restaurant, not just the abstract “restaurant.”</p><p>If this debate sounds familiar, it should. Restate it in AI terms and you get one of the most live architectural questions in the field:</p><blockquote><strong>Prototype approach</strong>: Abstract the structure. Build a schema, an ontology, a knowledge graph. Represent the <em>typical</em> case. New information is categorized by comparison to the abstracted structure.</blockquote><blockquote><strong>Exemplar approach</strong>: Store everything. Build a vector database, a retrieval system. New information is categorized by similarity to stored instances.</blockquote><p>This is the <strong>RAG vs. knowledge graph debate</strong> arriving from cognitive science, decades before either technology existed.</p><p>And here’s the resolution the cognitive scientists arrived at, which I think the AI field is slowly rediscovering: <strong>both are necessary.</strong> Medin, Altom, and Murphy found that when participants had access to both prototype and exemplar information, they categorized more accurately than with either alone. Participants who saw prototypical examples used prototype-based strategies; participants who only had specific instances relied on exemplar similarity. Given both, they used both.</p><p>The implication for system design is direct. You want the abstract structure (the ontology, the schema) <em>and</em> the specific instances (the vector store, the episodic memory). The prototype gives you inference, defaults, and cross-domain reasoning. The exemplars give you sensitivity to specific cases, edge cases, and the full variability of the domain. One without the other is incomplete.</p><h3>LLMs as Implicit Prototype Machines</h3><p>This is where I want to push the argument past what the cognitive scientists themselves explored.</p><p>Ask any LLM to “describe a typical bird” and you’ll get something robin-shaped: small, flies, sings, perches on branches, builds nests. You won’t get a penguin. You won’t get an ostrich. The model has learned prototype structure from training data, because prototypical birds show up vastly more often in text than atypical ones. The statistical distribution of language <em>mirrors</em> the prototype structure Rosch documented in human cognition — and for good reason. The text was written by humans whose categories are prototype-structured.</p><p>But LLMs also retain exemplar-like sensitivity. Ask about penguins specifically and you get detailed, accurate information. The model hasn’t discarded the atypical instances — they’re all in there, weighted by frequency but not erased. In this sense, LLMs are doing what Medin’s experiments suggested humans do: maintaining both a prototype-like central tendency <em>and</em> exemplar-level specificity.</p><p>In the <a href="https://medium.com/@polymathik/your-brain-already-has-a-knowledge-graph-1bf5a33b8467">previous essay</a>, I called LLMs “statistical schema machines” — systems that extract structured templates from regularities in experience. Prototype theory extends that observation. LLMs aren’t just learning the <em>structure</em> of schemas. They’re learning the <em>graded category structure</em> within those schemas. The restaurant schema has a prototypical restaurant at its center and increasingly atypical instances further out. The LLM has learned that gradient, implicitly, from frequency distributions in text.</p><p>So what’s missing?</p><p>The hierarchy. The explicit basic-level / superordinate / subordinate organization that makes categories <em>navigable</em> rather than just <em>similar</em>.</p><p>An LLM knows that a robin is a “better” bird than a penguin — in the sense that robin-like features dominate its bird-related outputs. But it doesn’t <em>know that it knows this</em> in any inspectable way. It can’t tell you “bird is a basic-level category, animal is superordinate, robin is subordinate” and use that hierarchical structure to reason about when to be more or less specific. It can’t adjust its level of abstraction systematically — navigating up to “animal” when generality is needed and down to “golden retriever” when precision is required — because the hierarchy isn’t represented explicitly.</p><p>This is exactly what a layered ontology provides. The upper ontology gives you the superordinate abstractions. The domain ontology gives you the basic level — the concepts domain experts naturally work with. The task and instance layers give you the subordinate specifics. And the explicit hierarchy between them gives you something the LLM’s implicit prototype structure can’t: <strong>navigable abstraction</strong>.</p><p>The LLM provides the prototype intuition — the sense of what’s typical, what’s expected, what’s central. The ontology provides the scaffolding — the explicit levels, the inheritance relationships, the named positions in the hierarchy. Together, they replicate what Rosch found in human cognition: graded, prototype-structured categories organized into navigable hierarchies where the basic level is the cognitive anchor.</p><h3>Designing Ontologies That Respect How Minds Actually Work</h3><p>Three practical implications emerge from all of this.</p><p><strong>Design from the basic level outward.</strong> When building a domain ontology, start with the concepts your domain experts actually use in daily work — not the most abstract possible categories and not the most specific instances. These basic-level concepts are the ones with the highest cue validity, the richest feature clusters, and the most natural inferential connections. Abstract upward to find your upper ontology later. Specify downward to find your instance types later. But anchor in the middle, where cognition naturally lives.</p><p>If you’ve done ontology elicitation and found that experts struggle to articulate abstract upper categories but readily produce mid-level domain concepts — Meeting, Patient, Transaction, Deployment — you’ve found their basic level. Don’t fight it. Design around it.</p><p><strong>Acknowledge that membership is graded.</strong> Not all instances are equally central to their category. A routine weekly standup is a prototypical “meeting.” A walking 1-on-1 through a park is a marginal case. A Slack huddle that turns into a two-hour troubleshooting session is a borderline instance that might belong to multiple categories. If your ontology treats all instances as equally good members of their class, you’re losing information that could help your agent reason better. Consider confidence scores, typicality ratings, or prototype-distance metrics on your instance data.</p><p><strong>The exemplar-prototype duality is the RAG-KG duality.</strong> Your system needs both. The ontology provides prototype-level structure — what a typical instance looks like, what properties are expected, what constraints apply. The instance layer and the retrieval system provide exemplar-level specificity — the actual cases, with all their messy variation, that the prototype can’t capture. This isn’t a choice between two architectures. It’s a recognition that both are doing something necessary, and the most capable systems will integrate them.</p><h3>Categories, Borders, and Bodies</h3><p>Rosch dismantled the assumption that categories are crisp mathematical sets, showing instead that they’re gradient, prototype-structured, and organized around a basic level of abstraction that reflects how organisms interact with their environment.</p><p>In the <a href="https://medium.com/@polymathik/the-map-is-not-the-territory-but-its-all-your-agent-has-b44ed42e4faf">first essay</a>, the question was <em>how wrong can your map be and still be useful?</em> In the <a href="https://medium.com/@polymathik/what-does-it-mean-to-know-something-and-can-a-machine-do-it-6e073a20de83">second</a>, <em>what counts as knowledge at all?</em> In the <a href="https://medium.com/@polymathik/we-know-more-than-we-can-tell-the-ontologists-hardest-problem">third</a>, <em>what resists being mapped entirely?</em> In the <a href="https://medium.com/@polymathik/your-brain-already-has-a-knowledge-graph-1bf5a33b8467">fourth</a>, <em>what shape does knowledge naturally take?</em></p><p>Here’s the prototype theory question: <em>do categories exist in the world, or in the mind that encounters the world?</em></p><p>Rosch herself wrestled with this. She argued that category structure reflects “perceived world structure” — the actual correlations of features in the environment. Animals that have feathers <em>really do</em> tend to also have wings, beaks, and hollow bones. The prototype structure isn’t arbitrary; it mirrors real-world regularities. But notice the word “perceived.” Categories are shaped by how an organism <em>interacts</em> with the world. The basic level — dog, chair, car — is defined partly by what a human body can do with these things. You sit in a chair. You pet a dog. The category structure is tuned to a body.</p><p>Which raises an uncomfortable question for anyone building knowledge representations for disembodied AI systems: <strong>if categories are shaped by embodied interaction with the world, what happens when the categorizer has no body?</strong></p><p>That question is next.</p><h3>References</h3><ol><li><a href="https://commonweb.unifr.ch/artsdean/pub/gestens/f/as/files/4610/9778_083247.pdf">Rosch, E. (1978) — “Principles of Categorization”</a> — The foundational text on prototype theory and basic-level categories</li><li><a href="https://pdodds.w3.uvm.edu/files/papers/others/1958/brown1958a.pdf">Brown, R. (1958) — “How Shall a Thing Be Called?”</a> — The naming puzzle that launched basic-level research</li><li><a href="https://doi.org/10.1016/0010-0285(75)90024-9">Rosch, E. &amp; Mervis, C.B. (1975) — “Family Resemblances: Studies in the Internal Structure of Categories”</a> — Empirical demonstration of family resemblance in natural categories</li><li><a href="https://doi.org/10.1016/0010-0285(76)90013-X">Rosch, E. et al. (1976) — “Basic Objects in Natural Categories”</a> — The empirical foundation for basic-level category effects</li><li><a href="https://en.wikipedia.org/wiki/Philosophical_Investigations">Wittgenstein, L. (1953) — <em>Philosophical Investigations</em></a> — Family resemblance and the critique of essentialist categories</li><li><a href="https://doi.org/10.1037/0033-295X.85.3.207">Medin, D.L. &amp; Schaffer, M.M. (1978) — “Context Theory of Classification Learning”</a> — Exemplar theory as alternative to prototype abstraction</li><li><a href="https://en.wikipedia.org/wiki/Prototype_theory">Wikipedia: Prototype Theory</a> — Overview of the theory and its development</li><li><a href="https://en.wikipedia.org/wiki/Cognitive_categorization">Wikipedia: Cognitive Categorization</a> — Broader context including basic-level effects and exemplar theory</li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=325721a3e830" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>