O(k) Semantic Kernel Architecture
Every call into .me is a path — Subject-Verb-Object, plus an operator table (@, _, ~, ->, =, ?, -) for identity, secrets, resets, derivation, assignment, queries, and negation:
me.some.path("value"); // write a path
me.explain("some.path"); // ask why it holds that value
me.love(person); // relational computation over the same graph
Full grammar, formally: me.whatever(what) — the official syntax spec. This page is about what happens underneath a call, once it reaches the kernel.
Engine
Proxy-based path resolution. Reading or writing me.some.path never builds or copies an object tree to answer it — proxy.ts intercepts the access with a real Proxy trap and resolves it directly against the kernel’s path algebra, on demand.
Dependency graph. derivation.ts keeps refSubscribers: for every path, the Set of derived targets that read it. When a derivation is declared, each identifier in its expression subscribes the paths the evaluator may read for it (relative to the formula’s scope, then the root). A write walks the subscribers of the written path outward, recomputing only targets whose effective input actually changed — never the whole graph. Measured cost is linear in k, the number of targets recomputed (see docs/Benchmarks/benchmarks.md).
kernel/cascade.ts is a separate, standalone dependency engine exported as createMe/define/write/subscribe; the ME class does not use it.
Historical: Array → Set
deps/dependents and the recompute-wave tracking in derivation.ts used to check membership with Array.includes/.push — O(n) per check, stacked on top of the real O(k) traversal. Refactored to Set.add/Set.has — O(1) — confirmed in the kernel’s own git history, commit a186449.
Lineage — explain()
Every recompute wave keeps its own trace: which write triggered it (sourcePath), which nodes actually recomputed (recomputed), and k — the size of that set. me.explain(path) reads this back for any path, so a cascade stays auditable after the fact, not just fast while it runs. Why this matters, in depth: me.explain(why did you say that) — an AI’s account of its own reasoning is generated by the same untrusted process being questioned; explain() returns the actual computation instead of a description of it.
Structural privacy
Secret scopes (secret.ts) are a property of the graph itself, not an access-control layer bolted on top — a path inside a stealth scope resolves through the same Proxy/graph mechanism as any other path, with the boundary enforced structurally. See Axioms.md (A0/A2) for the exact guarantee.
Real, verified performance numbers — measured against the actual test suite, including the ones that don’t flatter the claim — live at What is O(k)?, not here.
Related
| Concept | What it covers |
|---|---|
me.whatever(what) |
The calling syntax — Subject-Verb-Object path calls, the operator table, selectors. |
me.explain(why did you say that) |
Lineage as evidence: the trace itself, not a self-report about it. |
me.love(you) |
Subjectivity, internal state, and relational computation over the same graph. |
Get .me started |
npm install this.me → first kernel, in under a minute. |