skynet-graph 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CONTRIBUTING.md +22 -0
- package/LICENSE +661 -0
- package/README.md +245 -0
- package/bin/sg +20 -0
- package/concepts/README.md +23 -0
- package/concepts/_substrate/Claim/Confidence/Trusted.json +6 -0
- package/concepts/_substrate/Claim/Confidence.json +10 -0
- package/concepts/_substrate/Claim/Freshness/Stale.json +7 -0
- package/concepts/_substrate/Claim/Freshness.json +5 -0
- package/concepts/_substrate/Claim/Verification/Refuted.json +6 -0
- package/concepts/_substrate/Claim/Verification.json +6 -0
- package/concepts/_substrate/Claim.json +4 -0
- package/concepts/_substrate/Frontier/InBeam.json +6 -0
- package/concepts/_substrate/Frontier/Stuck.json +6 -0
- package/concepts/_substrate/Frontier.json +5 -0
- package/concepts/_substrate/Intake/ToTask.json +22 -0
- package/concepts/_substrate/Intake/Typed.json +10 -0
- package/concepts/_substrate/Intake.json +27 -0
- package/concepts/_substrate/Task/Answer.json +12 -0
- package/concepts/_substrate/Task/Complexity/Atomic.json +5 -0
- package/concepts/_substrate/Task/Complexity/Compound/Expansion.json +7 -0
- package/concepts/_substrate/Task/Complexity/Compound.json +6 -0
- package/concepts/_substrate/Task/Complexity.json +6 -0
- package/concepts/_substrate/Task/EvalComplexity.json +13 -0
- package/concepts/_substrate/Task/ReportUp.json +6 -0
- package/concepts/_substrate/Task/Rollup.json +10 -0
- package/concepts/_substrate/Task.json +5 -0
- package/concepts/clinical/Diagnosis/Medication.json +6 -0
- package/concepts/clinical/Diagnosis.json +15 -0
- package/concepts/clinical/Observation/LabValue/OutOfRange.json +6 -0
- package/concepts/clinical/Observation/LabValue.json +5 -0
- package/concepts/clinical/Observation.json +6 -0
- package/concepts/common/Document/pathBasket.json +6 -0
- package/concepts/common/Document.json +3 -0
- package/concepts/common/Edge/Distance.json +13 -0
- package/concepts/common/Edge/Stay/LongStay.json +8 -0
- package/concepts/common/Edge/Stay.json +8 -0
- package/concepts/common/Edge/Travel/LongTravel.json +16 -0
- package/concepts/common/Edge/Travel/ShortTravel.json +11 -0
- package/concepts/common/Edge/Travel/targetNode.json +7 -0
- package/concepts/common/Edge/Travel.json +7 -0
- package/concepts/common/Edge.json +3 -0
- package/concepts/common/Vertice.json +3 -0
- package/concepts/supply/Fulfillment.json +10 -0
- package/concepts/supply/Inventory/Reorder.json +7 -0
- package/concepts/supply/Inventory.json +5 -0
- package/concepts/supply/Procurement/SupplierConfirm.json +6 -0
- package/concepts/supply/Procurement.json +8 -0
- package/concepts/supply/Transport.json +5 -0
- package/doc/API.md +556 -0
- package/doc/CAPABILITIES.md +373 -0
- package/doc/MODELISATION.md +511 -0
- package/doc/architecture.md +267 -0
- package/doc/concept-as-graph.md +379 -0
- package/doc/concept-learning.md +168 -0
- package/doc/creative-loop-map.md +202 -0
- package/doc/original-2016-doc.md +148 -0
- package/doc/usage.md +501 -0
- package/lib/authoring/abstract.js +401 -0
- package/lib/authoring/abstraction.js +190 -0
- package/lib/authoring/adapt.js +393 -0
- package/lib/authoring/ancestry.js +216 -0
- package/lib/authoring/author.js +147 -0
- package/lib/authoring/bounded-merge.js +57 -0
- package/lib/authoring/canon.js +158 -0
- package/lib/authoring/clock.js +123 -0
- package/lib/authoring/combinator.js +92 -0
- package/lib/authoring/compete.js +76 -0
- package/lib/authoring/compose-hotspot.js +314 -0
- package/lib/authoring/compress.js +279 -0
- package/lib/authoring/concept-net.js +254 -0
- package/lib/authoring/concepts.js +66 -0
- package/lib/authoring/context-project.js +277 -0
- package/lib/authoring/contract.js +476 -0
- package/lib/authoring/corpus-pack.js +125 -0
- package/lib/authoring/cost-probe.js +86 -0
- package/lib/authoring/crystallize.js +555 -0
- package/lib/authoring/dag-decompose.js +256 -0
- package/lib/authoring/dataset-adapter.js +253 -0
- package/lib/authoring/debug-provider.js +92 -0
- package/lib/authoring/decompose.js +343 -0
- package/lib/authoring/emittability.js +236 -0
- package/lib/authoring/equilibrium.js +160 -0
- package/lib/authoring/extract.js +153 -0
- package/lib/authoring/forest.js +55 -0
- package/lib/authoring/forge-fallback.js +116 -0
- package/lib/authoring/givens.js +121 -0
- package/lib/authoring/glossary.js +177 -0
- package/lib/authoring/grammar-graph.js +191 -0
- package/lib/authoring/granularity.js +80 -0
- package/lib/authoring/graph-net.js +108 -0
- package/lib/authoring/ground.js +148 -0
- package/lib/authoring/higher-order.js +85 -0
- package/lib/authoring/hotspot.js +132 -0
- package/lib/authoring/hysteresis.js +85 -0
- package/lib/authoring/index.js +106 -0
- package/lib/authoring/lattice-morphism.js +61 -0
- package/lib/authoring/lattice-pack.js +148 -0
- package/lib/authoring/leaf-io.js +77 -0
- package/lib/authoring/library.js +156 -0
- package/lib/authoring/lifecycle.js +92 -0
- package/lib/authoring/loop.js +193 -0
- package/lib/authoring/master-loop.js +132 -0
- package/lib/authoring/mdl.js +209 -0
- package/lib/authoring/memo-stability.js +122 -0
- package/lib/authoring/method-explorer.js +138 -0
- package/lib/authoring/method-pack.js +181 -0
- package/lib/authoring/method.js +202 -0
- package/lib/authoring/mine.js +510 -0
- package/lib/authoring/mount.js +119 -0
- package/lib/authoring/negotiate.js +100 -0
- package/lib/authoring/parametric.js +139 -0
- package/lib/authoring/reaggregate.js +75 -0
- package/lib/authoring/rebalance.js +157 -0
- package/lib/authoring/recall.js +135 -0
- package/lib/authoring/registry.js +350 -0
- package/lib/authoring/relearn.js +147 -0
- package/lib/authoring/retention.js +89 -0
- package/lib/authoring/segment-proxy.js +114 -0
- package/lib/authoring/serve-leaf.js +64 -0
- package/lib/authoring/slot-aware-serve.js +77 -0
- package/lib/authoring/sound-invoke.js +59 -0
- package/lib/authoring/split-serve.js +74 -0
- package/lib/authoring/ste.js +239 -0
- package/lib/authoring/stock.js +101 -0
- package/lib/authoring/store.js +94 -0
- package/lib/authoring/supervise.js +138 -0
- package/lib/authoring/support.js +131 -0
- package/lib/authoring/task-mirror.js +51 -0
- package/lib/authoring/typed-loop.js +160 -0
- package/lib/authoring/validate.js +569 -0
- package/lib/authoring/widen.js +88 -0
- package/lib/combos/appliance.js +189 -0
- package/lib/combos/critique.js +377 -0
- package/lib/combos/defaults.js +86 -0
- package/lib/combos/durable-runner.js +115 -0
- package/lib/combos/forge.js +209 -0
- package/lib/combos/index.js +86 -0
- package/lib/combos/learning-library.js +253 -0
- package/lib/combos/mixture-serve.js +193 -0
- package/lib/combos/plan-loop.js +192 -0
- package/lib/combos/proxy-cache.js +272 -0
- package/lib/combos/self-mod.js +94 -0
- package/lib/durable/audit.js +102 -0
- package/lib/durable/checkpoint-store.js +550 -0
- package/lib/durable/fold.js +62 -0
- package/lib/durable/interpreter.js +242 -0
- package/lib/durable/xlate.js +185 -0
- package/lib/graph/Graph.js +2486 -0
- package/lib/graph/expr.js +307 -0
- package/lib/graph/index.js +26 -0
- package/lib/graph/log.js +134 -0
- package/lib/graph/objects/Concept.js +382 -0
- package/lib/graph/objects/Entity.js +503 -0
- package/lib/graph/objects/Node.js +57 -0
- package/lib/graph/objects/PathMap.js +557 -0
- package/lib/graph/objects/Segment.js +100 -0
- package/lib/graph/tasks/stabilize.js +59 -0
- package/lib/graph/tasks/taskflow.js +247 -0
- package/lib/index.js +122 -0
- package/lib/load.js +132 -0
- package/lib/providers/backends.js +117 -0
- package/lib/providers/borderline.js +129 -0
- package/lib/providers/cache.js +226 -0
- package/lib/providers/canonicalize.js +198 -0
- package/lib/providers/constat.js +107 -0
- package/lib/providers/geo.js +53 -0
- package/lib/providers/index.js +116 -0
- package/lib/providers/intake.js +263 -0
- package/lib/providers/llm-local.js +88 -0
- package/lib/providers/llm.js +236 -0
- package/lib/providers/local-host.js +197 -0
- package/lib/providers/merge-consistency.js +162 -0
- package/lib/providers/nogood.js +149 -0
- package/lib/providers/reason-loop.js +223 -0
- package/lib/providers/semiring.js +285 -0
- package/lib/providers/solver-fork.js +163 -0
- package/lib/providers/stats.js +228 -0
- package/lib/providers/verify.js +120 -0
- package/lib/runtime/index.js +135 -0
- package/lib/runtime/invoke-pool.js +92 -0
- package/lib/runtime/protocol.js +210 -0
- package/lib/runtime/transport-socket.js +77 -0
- package/lib/runtime/worker-entry.js +31 -0
- package/lib/sg/cli.js +601 -0
- package/lib/sg/log-sinks.js +214 -0
- package/lib/sg/mcp.js +395 -0
- package/lib/sg/proxy-run.js +66 -0
- package/lib/sg/serve-demo.js +185 -0
- package/lib/sg/serve.js +205 -0
- package/lib/sg/trace.js +118 -0
- package/lib/studio/protocol.js +45 -0
- package/lib/studio/public/app.js +310 -0
- package/lib/studio/public/components/ConceptEditor.js +43 -0
- package/lib/studio/public/components/ConceptTree.js +43 -0
- package/lib/studio/public/components/CorpusPanel.js +68 -0
- package/lib/studio/public/components/ForkTree.js +36 -0
- package/lib/studio/public/components/GrammarGraph.js +99 -0
- package/lib/studio/public/components/GraphCanvas.js +156 -0
- package/lib/studio/public/components/Inspector.js +48 -0
- package/lib/studio/public/components/LearningPanel.js +85 -0
- package/lib/studio/public/components/PromptConsole.js +46 -0
- package/lib/studio/public/components/ProviderTrace.js +39 -0
- package/lib/studio/public/components/SessionSplit.js +47 -0
- package/lib/studio/public/components/TilingOverlay.js +40 -0
- package/lib/studio/public/components/Timeline.js +57 -0
- package/lib/studio/public/index.html +26 -0
- package/lib/studio/public/styles.css +185 -0
- package/lib/studio/public/ws.js +58 -0
- package/lib/studio/server.js +130 -0
- package/lib/studio/session.js +397 -0
- package/lib/studio/studio.js +149 -0
- package/package.json +42 -0
|
@@ -0,0 +1,267 @@
|
|
|
1
|
+
# Architecture — how skynet-graph works (Use 1, the substrate)
|
|
2
|
+
|
|
3
|
+
> **R&D.** This explains the **substrate** (Use 1 — the standalone reactive engine; see the [README](../README.md)
|
|
4
|
+
> for the two uses). The engine is stable and tested; the *concept-organization strategy* is open research (see
|
|
5
|
+
> [§6](#6-status--whats-rd)). The high-level target system built on this substrate (Use 2 — concept-graphs as
|
|
6
|
+
> composable methods, the durable executor, the contract) is **[concept-as-graph.md](concept-as-graph.md)**. The
|
|
7
|
+
> authoritative model + roadmap is [MODELISATION.md](MODELISATION.md); the concept schema is [doc.md](doc.md); the
|
|
8
|
+
> public API is [API.md](API.md).
|
|
9
|
+
|
|
10
|
+
## 1. The substrate in one paragraph
|
|
11
|
+
|
|
12
|
+
skynet-graph is a **forward-chaining production system** + a **JTMS** (justification-based
|
|
13
|
+
truth maintenance — reactive, cascading retraction) + **demand-driven incremental
|
|
14
|
+
compute** (Adapton/Salsa-style), running over a **typed-fact hypergraph**. One mechanism
|
|
15
|
+
is reused everywhere: *everything is a fact, gated by `ensure`/`assert`*. The workload it
|
|
16
|
+
targets is AND/OR-graph search + bounded catamorphism (fold) — i.e. decompose a problem,
|
|
17
|
+
solve the leaves, roll the answer back up.
|
|
18
|
+
|
|
19
|
+
The two front doors over that one engine:
|
|
20
|
+
|
|
21
|
+
```
|
|
22
|
+
┌───────────────────────────────────────────────┐
|
|
23
|
+
│ one engine │
|
|
24
|
+
│ typed facts · concepts · stabilize · JTMS │
|
|
25
|
+
└──────────┬─────────────────────┬──────────────┘
|
|
26
|
+
│ │
|
|
27
|
+
Use 1 — the substrate Use 2 — the target system
|
|
28
|
+
(standalone, no LLM needed) (built ON Use 1, additive)
|
|
29
|
+
declarative rules over your concept-graphs as typed METHODS
|
|
30
|
+
data, to a fixpoint bounded context per piece (zoom)
|
|
31
|
+
rollback / diff / fork / forge · reuse · compose ·
|
|
32
|
+
merge on the belief state un-learn on drift
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## 2. Objects and facts
|
|
36
|
+
|
|
37
|
+
Every graph object wraps an **Entity** (`obj._etty`; its raw serialized data is
|
|
38
|
+
`_etty._`). Three object kinds:
|
|
39
|
+
|
|
40
|
+
- **Node** — a vertex; tracks `_incoming` / `_outgoing` segments.
|
|
41
|
+
- **Segment** — a directed edge (`originNode → targetNode`). Most reasoning lives on
|
|
42
|
+
segments (a segment is "a relation that can be enriched").
|
|
43
|
+
- **Document / free-node** — standalone fact carriers (e.g. a `clock`, a `budget`).
|
|
44
|
+
|
|
45
|
+
Objects carry **typed facts**: enums, ids, numbers, booleans, small structured values.
|
|
46
|
+
The discipline that everything keys on *discrete, typed* facts — never free prose — is
|
|
47
|
+
load-bearing (it is what makes the incremental memo actually hit; see [§5](#5-honest-limits)).
|
|
48
|
+
|
|
49
|
+

|
|
50
|
+
|
|
51
|
+
## 3. Concepts — rules as data
|
|
52
|
+
|
|
53
|
+
A **concept** is a declarative JSON rule (JSONC — `//` comments allowed). Concepts form a
|
|
54
|
+
hierarchy via `childConcepts`; `Vertice.json` and `Edge.json` are the entry points for
|
|
55
|
+
nodes and segments. The schema fields (handled in `lib/graph/objects/Concept.js`):
|
|
56
|
+
|
|
57
|
+
| Field | Meaning |
|
|
58
|
+
|---|---|
|
|
59
|
+
| `require` | preconditions that must *resolve* before the concept is even considered; an unresolved require installs a watcher so the object is retested when the value appears |
|
|
60
|
+
| `assert` / `ensure` | boolean expressions (`&&`-joined) deciding applicability once requires hold. **`ensure` is defeasant** (installs watchers and *retracts* the concept when a premise falls); **`assert` is a one-time gate** (no watcher, no retraction) |
|
|
61
|
+
| `provider` | `"Namespace::fn"` (or `["ns::fn", ...args]`) — effectful work, looked up in `Graph._providers`. Signature `(graph, concept, scope, argz, cb)`, `cb(err, mutationTemplate)` |
|
|
62
|
+
| `applyMutations` | a mutation template applied when the concept casts |
|
|
63
|
+
| `type:"enum"`, `defaultValue`, `autoCast:false`, … | casting controls |
|
|
64
|
+
|
|
65
|
+
Because rules are **data**, you can add/patch/version a capability without touching the
|
|
66
|
+
engine, ship different concept *sets* per context (`cfg.conceptSets`), and even author
|
|
67
|
+
concepts at runtime (`addConcept` / `patchConcept`).
|
|
68
|
+
|
|
69
|
+
Expressions are compiled by **`lib/graph/expr.js`** — a safe `jsep`-based evaluator (no
|
|
70
|
+
`new Function`/`eval`; `constructor`/`__proto__`/`prototype` access blocked). `$ref`
|
|
71
|
+
tokens resolve via `scope.getRef(...)`. Two embedded DSLs share the `$`-syntax: reference
|
|
72
|
+
paths (`a:b:c` walks across linked objects; `$$x` is a global-node ref) and query/assert
|
|
73
|
+
expressions.
|
|
74
|
+
|
|
75
|
+
## 4. Stabilization — the loop
|
|
76
|
+
|
|
77
|
+
Mutations create/update objects and mark them **unstable**. A loop keeps applying
|
|
78
|
+
applicable concepts to the unstable set until nothing more can fire (the **fixpoint**),
|
|
79
|
+
then fires the `stabilize` event / `cfg.onStabilize`.
|
|
80
|
+
|
|
81
|
+

|
|
82
|
+
|
|
83
|
+
- **Casting** adds facts + child segments → which destabilizes followers → which triggers
|
|
84
|
+
more concepts. Convergence rests on the determinism of *triggering* (forward-chaining to
|
|
85
|
+
a fixpoint), not on the LLM's output being deterministic.
|
|
86
|
+
- **Retraction (defeasance).** When an `ensure` premise becomes false, the concept
|
|
87
|
+
un-casts and its `childConcepts` un-cast in cascade; `cleaner` hooks run. This is the
|
|
88
|
+
JTMS core — coherence-under-change as a *structural property*, not rollback code you
|
|
89
|
+
write by hand.
|
|
90
|
+
- **Revisions.** Each mutation is a revision-stamped atom; `serialize()` snapshots state.
|
|
91
|
+
This yields `rollbackTo(rev)` / `getRevisions()` / `getSnapshot(rev)` / `diffRevisions`
|
|
92
|
+
and `fork`/`merge` — "git for reasoning" (over **data and rules**: a rollback restores
|
|
93
|
+
the concept library too).
|
|
94
|
+
|
|
95
|
+
The loop is a small task sequencer (`lib/graph/tasks/taskflow.js`, a vendored zero-dep
|
|
96
|
+
scheduler) driving `lib/graph/tasks/stabilize.js`. Self-modification issued *mid-stabilize*
|
|
97
|
+
(a meta-concept patching rules) defers to the next quiescent boundary, and a runaway
|
|
98
|
+
re-cast loop is bounded by an apply-ceiling backstop and flagged `divergent`.
|
|
99
|
+
|
|
100
|
+
## 4b. Reasoning regimes — a Mixture of Reasoners
|
|
101
|
+
|
|
102
|
+
The same forward-chaining machine, **parameterized by the certainty algebra**, expresses four
|
|
103
|
+
regimes — an **architecture-level Mixture of Reasoners** over one auditable substrate, with a
|
|
104
|
+
deliberately-poor "narrow-waist" interface (snapped enums + a log-odds channel = a tree-
|
|
105
|
+
decomposition separator = an assume-guarantee contract). **Not** a weight-level MoE; everything
|
|
106
|
+
below is **additive** over the deterministic core and ships as host-opt-in providers:
|
|
107
|
+
|
|
108
|
+
- **D — deterministic JTMS socle** (§3–§4): the foundation.
|
|
109
|
+
- **P — probabilistic / log-linear**: `Semiring::reduce` folds `{__push}`ed contributions under a
|
|
110
|
+
commutative semiring — `boolean` (D's "any holds"), `logodds` (certainty, readout σ), `maxplus`
|
|
111
|
+
(best-path), `probor` (noisy-OR), or **`pareto`** (a multi-criteria **skyline SELECT** — keep the
|
|
112
|
+
non-dominated trade-offs, no forced weighting). Order-independent ⟺ the combine is a commutative
|
|
113
|
+
monoid (the coherence theorem). Plus `Stats::shrink` (hierarchical Beta-Binomial) and
|
|
114
|
+
`Nogood::guard` (learned dead-ends, sound-skip).
|
|
115
|
+
- **C — search / constraint**: a `Solve::run` **fork** searches (a dependency-free backtracking CSP
|
|
116
|
+
by default; inject Z3 / CP-SAT in prod) and merges back **only** the snapped model — search
|
|
117
|
+
internals stay in the fork (barrier preserved).
|
|
118
|
+
- **M — meta / blackboard**: a better-model **supervisor** detects `Stuck`, hypothesizes a
|
|
119
|
+
self-modification, evaluates it, and reverts cleanly if worse.
|
|
120
|
+
|
|
121
|
+
Cross-fork recombination (`Merge::combine` — sheaf-style agree/borderline/conflict bands) and
|
|
122
|
+
**tree-decomposition tiling** (`forkPlan` derives the candidate forks + each fork's frontier
|
|
123
|
+
alphabet straight off the concept-dependency graph) close the loop. D & P are literally *one fold
|
|
124
|
+
parameterized by a semiring* (provenance semirings, Green-Tannen 2007); the full study trail and
|
|
125
|
+
the on-engine experiments are kept in the project's local R&D notes.
|
|
126
|
+
|
|
127
|
+
## 4c. Two levels — ecosystems and the concept population
|
|
128
|
+
|
|
129
|
+
The system factors on **two orthogonal axes** (verified against the project's local two-level-coherence
|
|
130
|
+
review and grammar-induction study).
|
|
131
|
+
|
|
132
|
+
**Level 1 — ecosystems (worlds).** `fork`/`merge` are boundaries between interdependent sub-worlds: each fork is a
|
|
133
|
+
possible world with its own concept pool and a deliberately **narrow snapped *interface grammar*** (the separator
|
|
134
|
+
alphabet that crosses a cut). This is the sub-problem-delegation regime — one-shot scatter-gather over nested graph
|
|
135
|
+
frames under an assume-guarantee contract; treewidth bounds each ecosystem's internal inference (which is what keeps it
|
|
136
|
+
in **P**). Reserve the word "fork" for this level.
|
|
137
|
+
|
|
138
|
+
**Level 2 — the concept population (grammar).** Inside one ecosystem a **concept is a local neighbourhood operator**: it
|
|
139
|
+
reads typed facts on its reference segment, its neighbours, its parent and the path's endpoints, and writes relative
|
|
140
|
+
updates on the same surface. On the typed-fact (K1) fragment this is provably *the same object under three names* — a
|
|
141
|
+
bounded-context **graph-rewriting production** ≡ a **stratified-Datalog-with-aggregation rule** ≡ a **message-passing
|
|
142
|
+
(GNN) layer** — with the boolean **cast** as a hard (quantized) activation, trained, when learned, by a straight-through
|
|
143
|
+
estimator. The population **grows** (author a variant), **hybridizes** (compose two concepts into one — a reusable
|
|
144
|
+
abstract method, admitted only by an MDL/utility gate), and **consolidates**: every concept carries one **plasticity**
|
|
145
|
+
scalar `p∈[0,1]` — the unified creativity/learning knob for *both* a small-NN concept (noise/learning-rate) and an
|
|
146
|
+
LLM-calling concept (temperature) — `p=1` plastic/exploring, `p=0` frozen/deterministic, annealing toward 0 as its
|
|
147
|
+
reliability is proven (Complementary-Learning-Systems style: fast-plastic → slow-consolidated).
|
|
148
|
+
|
|
149
|
+
**The invariants that make it safe** (and that an implementer must not break): "accumulative" means *push to a list then
|
|
150
|
+
fold after quiescence by a commutative monoid*, never an in-stream read-modify-write; plasticity is **control-plane** (it
|
|
151
|
+
modulates a provider, it never *gates* applicability — a continuous gate would shatter the memo); **selection affects
|
|
152
|
+
ordering/latency, never the truth of a cast** (correctness comes from the deterministic gate + the verifier); structural
|
|
153
|
+
evolution must **preserve the interface** (a new/merged concept may not change which facts cross an ecosystem boundary —
|
|
154
|
+
a treewidth-non-regression check); and a learned/plastic output must be **snapped before any gate reads it** (the single
|
|
155
|
+
quiet failure is a plastic output leaking onto a typed gate, collapsing the incremental memo). The structure-learning
|
|
156
|
+
tooling for all of this lives in [`lib/authoring/`](../lib/authoring/) (`memo-stability`, `abstraction`, `mine`,
|
|
157
|
+
`crystallize`, `lifecycle`), built and tested ZERO-CORE; it is R&D, the deterministic core is the foundation.
|
|
158
|
+
|
|
159
|
+
## 4d. Learned concepts — training the population at the fixpoint
|
|
160
|
+
|
|
161
|
+
Because a population of concept-units run to a fixpoint **is** a quantized equilibrium GNN (§4c), it can be **trained**,
|
|
162
|
+
not just authored. A concept-unit is a **gate-NN** (decides whether to cast) × an **update-NN** (generates the value it
|
|
163
|
+
writes). The training subsystem (host-side, ZERO-CORE) is a small, composable pipeline:
|
|
164
|
+
|
|
165
|
+
- **The math — `equilibrium.js`.** The stabilization is a Picard iteration `z_{t+1}=F(z_t,θ)` to a fixpoint `z*=F(z*,θ)`.
|
|
166
|
+
We get `dL/dθ` **without unrolling** by differentiating the fixpoint condition (Deep Equilibrium Models / implicit
|
|
167
|
+
differentiation): solve the adjoint `(I−J_z)^T u = ∇_z L` at `z*`, then `dL/dθ = J_θ^T u`. Well-posed iff the iteration
|
|
168
|
+
contracts (`ρ(J_z)<1`); the engine's apply-cap is the analogue of the Neumann truncation depth; the hard cast is bridged
|
|
169
|
+
by a straight-through estimator (hard forward, smooth backward).
|
|
170
|
+
- **The substrate — `concept-net.js`.** Builds a population (`ring`/`chain`/`wide`), `train`s it end-to-end, `evolve`s its
|
|
171
|
+
**form** by success (grow a unit only if it beats a utility/MDL margin), and `bakePopulation` **serves a frozen result as
|
|
172
|
+
real engine concepts** (train offline plastic → freeze → bake → cascade in stabilization). A cyclic population is served
|
|
173
|
+
by `unrollPopulation` (unroll the fixpoint to depth N — a direct cyclic bake would deadlock).
|
|
174
|
+
- **The knob — `lifecycle.js`.** One plasticity scalar `p∈[0,1]` per concept switches train↔serve (plastic→soft/explore,
|
|
175
|
+
frozen→hard/deterministic) and modulates the actual provider (LLM temperature / NN noise).
|
|
176
|
+
|
|
177
|
+
This converges (a student recovers a teacher's fixpoint map), scales (2→6 units), evolves its form, and round-trips to the
|
|
178
|
+
real engine — all measured. **Honest limits:** it is a differentiable *mirror* + a serving bridge (the engine itself does
|
|
179
|
+
not train); a *chain* topology collapses in depth (use width); cyclic serving is unrolled (N× the concepts); and
|
|
180
|
+
non-differentiable concepts (LLM/rules) stay frozen / off-gradient (a Mixture of Reasoners, not a uniform net). Full
|
|
181
|
+
walk-through: **[concept-learning.md](concept-learning.md)**.
|
|
182
|
+
|
|
183
|
+
## 5. What the substrate is for — and the building blocks Use 2 leans on
|
|
184
|
+
|
|
185
|
+
The substrate's job is to be **bounded, structured, reversible working memory** so that reasoning over a large
|
|
186
|
+
problem happens in **bounded local steps** — the graph holds the global state, the dependencies and the
|
|
187
|
+
justifications, while each step sees only a small neighbourhood. The high-level system that turns this into
|
|
188
|
+
*composable methods with typed contracts + a durable executor* is **Use 2 → [concept-as-graph.md](concept-as-graph.md)**.
|
|
189
|
+
The substrate ships the pieces that make Use 2 possible, each usable **à nu**:
|
|
190
|
+
|
|
191
|
+
- **Canonicalization barrier (K1).** An `LLM::complete` concept writes only *canonicalized*
|
|
192
|
+
(enum-snapped / grain-rounded) keys as tracked facts, the reply text on an *untracked*
|
|
193
|
+
`prose` key, plus a stable digest — so two equivalent runs produce the same memo key.
|
|
194
|
+
- **Verification (K3, coherence ≠ truth).** `Verify::check` emits a distinct verdict fact
|
|
195
|
+
(never overwrites the target); `Vote::tally` does k-of-n consensus. Verdicts gate
|
|
196
|
+
downstream via `ensure`, so a refutation retracts in cascade.
|
|
197
|
+
- **Freshness / TTL (N1).** Time enters as a fact on a `clock` node; `ensure` invariants
|
|
198
|
+
auto-retract stale facts (cache-poisoning fix).
|
|
199
|
+
- **Declarative AI-authoring.** `addConcept` + an author-time validator (rejects prose on
|
|
200
|
+
dependency edges, missing self-flags, unparseable exprs, unknown refs) + a CEGIS loop
|
|
201
|
+
(`lib/authoring/author.js`) that proposes → validates → installs → tests → refines.
|
|
202
|
+
- **Safe live self-modification.** A supervised loop can hypothesize a self-mod, evaluate
|
|
203
|
+
it with a better-model judge, and `rollbackTo` cleanly if it's worse — re-entrancy-safe,
|
|
204
|
+
backstopped, and reversible (rules included).
|
|
205
|
+
- **The zoom bricks (F2).** `lib/authoring/dag-decompose.js` (the typed cutter prompt + archetype
|
|
206
|
+
router — pieces bind through `needs`/`produces`, never free prose), `context-project.js` (the bounded
|
|
207
|
+
per-piece projection; `stratComplete` is the stratified CONTEXT/DONE/ROADMAP rendering that held on
|
|
208
|
+
the compound "monster" tasks), `givens.js` (the typed base-fact front door + the measured CELLS
|
|
209
|
+
labelling rule), `leaf-io.js` (typed leaf value or a typed refusal — never carried garbage).
|
|
210
|
+
- **The support grammar** (`lib/authoring/support.js`). *Structure and search are reified in the graph, not held
|
|
211
|
+
in the model's context*: a problem decomposes; each bounded atomic segment **proposes K candidate answers**; a
|
|
212
|
+
`pareto` SELECT keeps the non-dominated front; a `Stuck` segment **escalates** to a better tier; the parent
|
|
213
|
+
synthesizes bottom-up. So a *small* local model need only be locally competent on a bounded sub-problem. This is
|
|
214
|
+
the seed of Use 2's forge/compose loop.
|
|
215
|
+
|
|
216
|
+
Two front-ends drive all of this: the **`sg` CLI** (`run` / `studio`) and the **Studio** — a
|
|
217
|
+
no-build web workbench (graph canvas with retraction flash, a concept↔fact **grammar graph**
|
|
218
|
+
with polarity + cross-corpus links + the tiling overlay, fork/split + merge-preview, timeline,
|
|
219
|
+
provider trace, live concept editor, and **`.sgc` corpus import/export** with a derived manifest).
|
|
220
|
+
|
|
221
|
+
Above the bricks sit the delivered **combos** (`Graph.combos.*`, C1–C9 — appliance, durable runner,
|
|
222
|
+
learning library, reactive KG, self-mod, proxy cache, plan loop, mixture serve, and **C9
|
|
223
|
+
`createCriticalMind`**, the external critical mind) and the **serving surfaces**: `sg serve` (an
|
|
224
|
+
OpenAI-compatible endpoint) and `sg mcp` (MCP tools, including the SOFT/HARD assistant lanes —
|
|
225
|
+
`hint` / `state_recall` / `state_note` / `plan_sync` vs the gate-tested `propose` — and the `critique` tool).
|
|
226
|
+
Per-capability maturity, the measured numbers (including the critical mind's measured decidability
|
|
227
|
+
bound), and the limits are consolidated in **[CAPABILITIES.md](CAPABILITIES.md)**.
|
|
228
|
+
|
|
229
|
+
## 6. Distributed execution
|
|
230
|
+
|
|
231
|
+
Sub-graphs stabilize in **separate worker processes**; graph parts dispatch to a pool of
|
|
232
|
+
waiting workers. The master/client sync boundary is already plain JSON, so nothing
|
|
233
|
+
non-serializable crosses: a worker rehydrates from a JSON concept-map + seed + its own
|
|
234
|
+
provider directory, and a parent-bound model `ask` is **proxied** back over the channel —
|
|
235
|
+
the "a model call is a generic, templated request, dispatchable anywhere" path.
|
|
236
|
+
|
|
237
|
+

|
|
238
|
+
|
|
239
|
+
## 7. Honest limits
|
|
240
|
+
|
|
241
|
+
| Limit | Mitigation built |
|
|
242
|
+
|---|---|
|
|
243
|
+
| **K1 — prose memo-fragmentation** (an LLM output feeding a dependency edge re-keys every run → cache never hits) | the typed-fact spine + canonicalization barrier |
|
|
244
|
+
| **K2 — terminize ≠ economy** (the fixpoint bounds *redundant* work, not the *size* of the productive tree / exploration cost) | assert-gated **budget cap**; beam/AO\* still only a cap |
|
|
245
|
+
| **K3 — coherence ≠ truth** (a hallucinated-but-valid fact propagates and retracts *cleanly* — rigor can give false confidence) | verification concepts + freshness/TTL |
|
|
246
|
+
| **K4 — incremental non-payoff zones** (numbering follows MODELISATION §8: some workloads never amortize) | STAGE-0 compose gate — measure *does the workload compose?* before investing |
|
|
247
|
+
| **K5 — one world (JTMS, not ATMS)** (compares plans only by forking) | `fork`/`merge` sub-graphs |
|
|
248
|
+
| **Authoring cost** (who writes/maintains the concept corpus?) | the validator + CEGIS author; **and this is the open problem — see below** |
|
|
249
|
+
|
|
250
|
+
## 8. Status & what's R&D
|
|
251
|
+
|
|
252
|
+
The **engine** is mechanically complete and heavily tested (declarative AI-authoring + safe
|
|
253
|
+
live self-modification included), and the **additive Mixture-of-Reasoners layer** (the P / C / M
|
|
254
|
+
regime providers, verification, tiling), the **support grammar**, the **Studio**, and the
|
|
255
|
+
`.sgc` corpus exchange are all shipped. The **Use-2 target system** built on top — concept-graphs as
|
|
256
|
+
composable methods, the durable executor, the C-contract / un-learn loop, and the **creative loop** (a library
|
|
257
|
+
**dispatch** over reified `FrontierSignature`s → combinator **mount** → `adaptOrForge`, so one method recombines
|
|
258
|
+
another's learned method by structure-mapping) — is documented in **[concept-as-graph.md](concept-as-graph.md)**
|
|
259
|
+
(part of the repo's 1350-test suite). What remains is **open research** + the deferred
|
|
260
|
+
performance work, and the biggest research piece is **how to organize concepts** — the current bet is a
|
|
261
|
+
semantically-meaningful hierarchical corpus keyed on *human vocabulary*, with judgment delegated to a
|
|
262
|
+
better-model supervisor while the rules handle orchestration + coherence. The shipped `concepts/common/` set is an
|
|
263
|
+
*illustration*, not a recommended ontology. The four capabilities run assembled in the shipped
|
|
264
|
+
**integrated demo** — `node examples/integrated-demo/run.js --replay` re-verifies its 7 checks
|
|
265
|
+
deterministically, no model, no GPU. The grounded model + historical roadmap is
|
|
266
|
+
[MODELISATION.md](MODELISATION.md); the live roadmap and the critical self-studies are kept in the
|
|
267
|
+
project's local R&D trail, outside this repo.
|