SemDAG grew out of Socra’s work with coding agents. As agents produced more code, reviewing their changes became a bottleneck. They lacked the specific knowledge behind the system: the architectural decisions and the reasons for making them. Mike Morton described the underlying problem: “A lot of that organizational know-how was locked in my head.”
Context has dependencies
Repository instructions helped with the subject each file described. That subject often required other things to be understood first, and those things had their own prerequisites. The agent could learn a rule without understanding the context needed to apply it. As more repositories and agents used the instructions, someone still had to explain how the subjects connected.
Apply modularity to knowledge
After experimenting with several prototypes, Socra applied the structure of software dependencies to context. A library depends on packages that must be available for it to work. Knowledge can follow the same structure. As Morton explains: “So you can break the knowledge into little discrete pieces and connect them together, just like you would modularize code.”
Each Module owns one subject and declares the Modules needed to understand it. Dependencies must be acyclic so that prerequisites can be read before the subjects that depend on them.
Assemble the prerequisites before work begins
To assemble context for a target Module, follow its dependencies recursively. Collect the required Modules, remove duplicates, and sort them so that prerequisites come first. The result is a single bundle that can be loaded into the agent’s context window before it starts the task. Cortex implements this operation as a flash.
Based on Mike Morton’s SemDAG: A Dependency Graph for Knowledge and Agent Context Needs an Import Statement.