JEV-as-judge GAN harness for the substrate. Generator proposes, JEV (judge) scores, best kept, training data grows, coherence strengthens.
A Generative Adversarial Network where:
- Generator: proposes substrate observations (cells, signals, witness-log entries)
- Judge (JEV): scores each proposal against the canon, accepting/rejecting based on cosine similarity
- Training data: every accepted proposal becomes part of the substrate's canon
The key insight: JEV is a quantitative judge (it returns a cosine score), not a learned discriminator. This means the GAN's adversarial loop is stable by construction — there's no mode collapse risk because the judge is grounded in the existing canon, not in the generator's history.
import { Gan, SubstrateGenerator, SubstrateJudge } from 'substrate-gan';
const gan = new Gan({
generator: new SubstrateGenerator(),
judge: new SubstrateJudge(),
});
await gan.train(10, 'what does the substrate see when it observes itself?');
console.log(gan.history);
// GanMetrics[]: per-round, generator output, judge scores, kept vs rejected
const best = await gan.generate('topic'); ┌──────────────┐
│ Generator │ (proposes observation)
└──────┬───────┘
│
▼
┌──────────────┐
│ JEV Judge │ (cosine to canon)
└──────┬───────┘
│
┌────────────┴────────────┐
▼ ▼
score > 0.85 score < 0.85
ACCEPTED REJECTED
(added to canon) (logged but not canonized)
│
▼
┌──────────────┐
│ Training │ (next round, more context)
│ Data │
└──────────────┘
A traditional GAN has a discriminator that learns from the generator's outputs — it can drift, mode-collapse, or fail to converge. The substrate-gan uses JEV (a fixed cosine scorer against canon) as the judge, which means:
- No mode collapse — the judge is grounded in canon, not in the generator's history
- Interpretability — every score is explainable as cosine to nearest canon
- Composability — generator + judge are separable; either can be replaced
This makes substrate-gan a defensive generative model: it produces canon-aligned content, not adversarial content.
The substrate-gan is one of the canonical ways to grow the canon. Combined with the conscription loop (witness-log → feature_request tally → patch), it provides:
- Top-down: conscription loop tells us what features are needed
- Bottom-up: substrate-gan proposes canon-aligned content
The two together form a closed loop where the substrate grows organically.
class Gan {
constructor(opts: { generator: SubstrateGenerator, judge: SubstrateJudge });
train(rounds: number, prompt: string): Promise<GanMetrics[]>;
generate(prompt: string): Promise<Cell>;
history: GanMetrics[];
}
interface GanMetrics {
round: number;
generatorOutput: Cell;
judgeScore: number; // cosine to canon
verdict: 'ACCEPTED' | 'REJECTED';
timestamp: number;
}Implements the substrate's 11-opcode algebra to produce new observations.
Wraps the JEV-equivalent cosine scorer. Returns a score in [0, 1].
Part of the SuperInstance substrate-* family. Depends on:
@superinstance/substrate-foundation(11 opcodes + canary)@superinstance/jev-quilt(JEV oracle)
MIT