A multi-pass compiler that transforms natural-language sources into formal, typed, executable generative models with machine-verifiable provenance.
"Existing reading methodologies are distilled for human readers, not for agent executors. The skill-engineering-stack bridges this gap: it treats knowledge extraction as a compilation problem with formal guarantees, not a summarization problem with heuristics."
The first compiler that takes a book or a person and produces a verified, executable generative model — with the same rigor a compiler applies to source code.
The Skill Engineering Stack is a multi-pass compiler pipeline that transforms raw, unstructured source material — books, interviews, biographies, research papers — into verified, typed, executable generative models with full provenance tracking and machine-readable guarantees.
It is not a summarizer. It does not extract quotes. It extracts the machinery that produces what the author says — the generative mechanisms, decision functions, and formal structures that underlie the source content.
| Traditional Extraction | Skill Engineering Stack |
|---|---|
| Summarizes content | Compiles generative structure |
| Produces prose | Produces typed generators + invariants |
| No provenance | Full machine-readable provenance chain |
| Single-context | Blinded, isolated verification |
| Heuristic | Formal calculus + axiomatic ontology |
| Static output | Evolutionary optimization (Leonardo Lab) |
┌──────────────────────────────────────────┐
│ SOURCE (book / person) │
└─────────────────┬────────────────────────┘
│
┌─────────────────▼────────────────────────┐
│ Pass 0: Ontology Validation │
│ (core.yaml + GLOSSARY.md) │
└─────────────────┬────────────────────────┘
│
┌───────────────────────┼───────────────────────┐
│ │ │
┌──────────▼──────────┐ ┌────────▼──────────┐ ┌───────▼───────────┐
│ Nuwa (Layer 1) │ │ Cangjie (Layer 2) │ │ Darwin (Layer 3) │
│ Cognitive decision │ │ Generative mach. │ │ Evolutionary opt. │
│ function extractor │ │ machinery extractor│ │ Leonardo Lab │
│ │ │ │ │ │
│ N1–N6 extractors │ │ C1–C6 extractors │ │ M01–M05 mutations │
│ (parallel, blind) │ │ (parallel, blind) │ │ Pareto selection │
└──────────┬──────────┘ └────────┬──────────┘ └───────┬───────────┘
│ │ │
└───────────────────────┼───────────────────────┘
│
┌─────────────────▼────────────────────────┐
│ Pass 2: Type Checking + Evidence Graph │
└─────────────────┬────────────────────────┘
│
┌─────────────────▼────────────────────────┐
│ Pass 3: Verification (F1–F6) │
│ (independent, blinded verifier) │
└─────────────────┬────────────────────────┘
│
┌─────────────────▼────────────────────────┐
│ Pass 4: Leonardo Lab Evolution │
│ (population search + invariant filter) │
└─────────────────┬────────────────────────┘
│
┌────────────────────────────┼────────────────────────────┐
│ │ │
┌──────▼──────┐ ┌───────▼───────┐ ┌───────▼───────┐
│ Pass 5: │ │ Pass 6: │ │ Pass 7: │
│ Composition │ │ Lowering │ │ Code Gen │
│ (algebraic │ │ GMIR-H→GMIR-L │ │ + Test Harness│
│ linking) │ │ │ │ │
└──────┬──────┘ └───────┬───────┘ └───────┬───────┘
│ │ │
└───────────────────────────┼───────────────────────────┘
│
┌────────────────▼────────────────────────┐
│ Pass 7.5: Guard-Rail / Red-Team │
│ (bait generator ≠ bait grader) │
└────────────────┬────────────────────────┘
│
┌────────────────▼────────────────────────┐
│ Pass 8: Consolidation │
│ (FULL_REPORT.md + Integrity Audit) │
└─────────────────────────────────────────┘
Each generator must pass all six gates in strict order:
| Gate | Check | Catches |
|---|---|---|
| F1 Recurrence | ≥2 independent evidence items | One-off anomalies |
| F2 Transferability | Predicts novel scenarios in-source | Descriptive-only patterns |
| F3 Exclusivity | Name-stripped test | Label bias |
| F4 Fidelity | Active counter-example search | Source contradictions |
| F5 Formal Consistency | Ontology + type-check | Incompatible interfaces |
| F6 Compression | No simpler generator explains evidence | Over-engineering |
# Symlink into opencode skills directory (live — picks up edits):
mkdir -p ~/.config/opencode/skills/
ln -s /path/to/Cognitive-Compiler-Skill \
~/.config/opencode/skills/skill-engineering-stack# Layer 0 — ontology
ln -s /path/to/Cognitive-Compiler-Skill/ontology \
~/.config/opencode/skills/ontology-engineering
# Layer 1 — cognitive decision-function extractor
ln -s /path/to/Cognitive-Compiler-Skill/nuwa \
~/.config/opencode/skills/nuwa-cogextract
# Layer 2 — generative machinery extractor
ln -s /path/to/Cognitive-Compiler-Skill/cangjie \
~/.config/opencode/skills/cangjie-deconstructor
# Layer 3 — evolutionary optimizer
ln -s /path/to/Cognitive-Compiler-Skill/darwin \
~/.config/opencode/skills/darwin-skill
# Layer 4 — model composition
ln -s /path/to/Cognitive-Compiler-Skill/composition \
~/.config/opencode/skills/skill-engineering-stack-composeFor full details including verification and uninstall, see INSTALL.md.
Once installed, invoke the meta-skill:
/skill skill-engineering-stack
Then describe what you want to do:
| Command | Layer | Action |
|---|---|---|
| "Compile this book" | Cangjie (Layer 2) | Extract generative machinery from a text corpus |
| "Extract the decision function of X" | Nuwa (Layer 1) | Build cognitive decision-function model from a person |
| "Evolve my formal model" | Darwin (Layer 3) | Run Leonardo Lab evolutionary optimization |
| "Compose these two models" | Composition (Layer 4) | Algebraically link multiple models |
| "Run the compiler on " | Full pipeline | End-to-end compilation with all passes |
The compiler is grounded in a formal calculus with three core theorems:
Theorem 1 (Semantic Preservation): The operational execution computes the exact denotation of the source semantics — zero loss during extraction-to-execution.
Theorem 2 (Closure under Composition): Well-typed, interface-compatible models maintain logical integrity when composed.
Theorem 3 (Compression Non-Dominance): No accepted generator is dominated by a simpler generator within the hypothesis space.
The compiler operates on a state calculus with context tuple:
C = (State, History, Parameters, Randomness, Environment)
Three execution modes:
- Deterministic:
Γ ⊢ G : C → C - Probabilistic:
Γ ⊢ G : C × Ω → C - Adaptive:
Γ ⊢ G : C × Hist → C
| Dimension | GMIR-H (High) | GMIR-L (Low) |
|---|---|---|
| Content | Abstract generators + metadata | Concrete algorithms + code |
| Role | Output of extraction/verification | Input to code generation |
| Domain | Semantic & logical | Algorithmic & executable |
Every generator carries an epistemic classification:
- Observed — directly stated in the source
- Extracted — repeated structural pattern
- Inferred — logically derived from observations
- Latent — discovered via simulation/abduction
- Speculative — candidate requiring validation
Cognitive-Compiler-Skill/
├── SKILL.md # Complete compiler specification (v5.5)
├── README.md # This file
├── INSTALL.md # Installation guide
├── CONTRIBUTING.md # Contribution guidelines
├── CODE_OF_CONDUCT.md # Code of conduct
├── SECURITY.md # Security policy
├── CITATION.cff # Citation metadata
├── LICENSE # MIT License
│
├── ontology/ # Layer 0 — Formal vocabulary
│ ├── SKILL.md # Ontology engineering skill
│ ├── core.yaml # Primitive types, relations, invariants
│ └── GLOSSARY.md # Human-readable definitions
│
├── nuwa/ # Layer 1 — Cognitive decision-function extractor
│ ├── SKILL.md # Nuwa skill specification
│ ├── methodology/ # Phase-by-phase methodology
│ ├── extractors/ # N1–N6 extractor definitions
│ └── templates/ # Output templates
│
├── cangjie/ # Layer 2 — Generative machinery extractor
│ ├── SKILL.md # Cangjie skill specification
│ ├── methodology/ # Phase 0–7 methodology
│ │ └── legacy/ # Original RIA-TV++ mapping
│ ├── extractors/ # C1–C6 extractor definitions
│ └── templates/ # Output templates
│
├── darwin/ # Layer 3 — Evolutionary optimizer
│ ├── SKILL.md # Darwin skill specification
│ ├── methodology/ # Step-by-step methodology
│ └── templates/ # Output templates
│
├── composition/ # Layer 4 — Hybrid model composition
│ ├── SKILL.md # Composition engine specification
│ └── methodology/ # Step-by-step methodology
│
├── methodology/ # Root-level methodology overview
│ └── 00-overview.md # RIA-TV++ methodological overview
│
├── Templates/ # Shared output templates
│
├── books/ # Worked examples (compiled outputs)
│ └── tesla-corpus/ # Tesla perspective skills (15 skills)
│
├── extractors/ # Extractor definitions
│
├── assets/ # Presentation slides and media
│
└── .github/ # CI/CD, templates, and workflows
└── workflows/
└── validate.yml # GitHub Actions validation pipeline
| Layer | Skill | Purpose |
|---|---|---|
| 0 | ontology-engineering | Formal vocabulary (primitives, relations, invariants) |
| 1 | nuwa-cogextract | Cognitive decision-function extraction from person-corpora |
| 2 | cangjie-deconstructor | Generative machinery extraction from texts |
| 3 | darwin-skill | Evolutionary optimization of formal models (Leonardo Lab) |
| 4 | skill-engineering-stack-compose | Hybrid model composition from multiple sources |
The compiler's methodology draws on several established frameworks:
| Framework | Contribution |
|---|---|
| Mortimer Adler, How to Read a Book | Stage 0 analytical reading (structural / interpretive / critical) |
| 赵周, 这样读书就够了 RIA 拆书法 | R-I-A1-A2 scaffold; A2 → trigger mapping |
| Niklas Luhmann Zettelkasten | Atomic note decomposition + cross-linking |
| Tiago Forte, Progressive Summarization | Verifiable compression chains (Stage 4) |
| Formal type theory & category theory | GMIR typing, composition algebra, interface contracts |
| Evolutionary computation (Pareto, multi-objective) | Leonardo Lab kernel design |
See methodology/00-overview.md for the full RIA-TV++ methodology description.
The books/ directory contains compiled outputs from real source materials:
| Source | Type | Key Output |
|---|---|---|
| Tesla corpus (15 skills) | Person | Cognitive decision functions, perspective skills |
| 15 extracted perspective skills | Person | Formal cognitive models with full provenance |
Each worked example demonstrates the complete pipeline: extraction → verification → evolution → code generation → guard-rail testing → consolidation.
This project builds on and is inspired by prior work:
- alchaincyf/cangjie-skill — The original Cangjie extraction pipeline (Stage 0–5 methodology, 5 parallel extractors, RIA++ construction, Zettelkasten linking, blind pressure testing). The skill-engineering-stack refactors this into a formal compiler with typed IR, isolated verification, and evolutionary optimization.
- alchaincyf/nuwa-skill — Nuwa cognitive decision-function extraction. The parallel isolated extractor architecture and triple verification protocol were adapted into Layer 1.
- alchaincyf/darwin-skill — Darwin evolutionary skill optimization. The 9-dim rubric, paired-judge keep/revert logic, and invariant-preserving mutation framework were adapted into Layer 3 (now operating on formal models rather than SKILL.md files).
Contributions are welcome! The project follows the compiler's own isolation principles:
- Extractors must be independent — no cross-talk between parallel agents
- Verification must be blinded — the verifier sees only candidates + evidence, not the extractor's reasoning
- No self-grading — the context that produces an artifact cannot verify it
- Every claim must be provenanced — if it doesn't have a provenance header, it doesn't exist
Please read CONTRIBUTING.md for detailed guidelines.
MIT License. See LICENSE for details.
If you use this work, please cite:
@software{skill-engineering-stack,
title = {Skill Engineering Stack: Generative Model Compiler},
version = {5.5},
year = {2025},
author = {Forsythe},
url = {https://github.com/forsythe/Cognitive-Compiler-Skill},
description = {A multi-pass compiler that transforms natural-language sources into formal, typed, executable generative models with machine-verifiable provenance},
keywords = {compiler, generative-model, formal-methods, knowledge-extraction, ontology, verification}
}- 📖 Full Specification — Complete compiler specification (v5.5)
- 📦 Installation — Detailed installation and verification guide
- 🤝 Contribution Guidelines — How to contribute
- 🔒 Security — Responsible disclosure
- 📜 Code of Conduct — Community standards
- 🏗️ Ontology — Formal vocabulary and type system
Built on a formal calculus with an axiomatic ontology, a metric space over generators, and a predicate language (GML) for invariants.
Every artifact includes machine-readable provenance. No self-grading. No shortcuts.