This document defines the system architecture of Glyph: how its parts fit together, why they are separated, and what invariants must never be violated.
Glyph is not a single program. It is a coherent system composed of language, runtimes, tooling, and contracts.
Glyph exists to add a missing layer to modern software stacks:
A small, safe, portable scripting and module layer that complementsβnot competes withβGo, Dart, and Flutter.
The architecture is intentionally:
- Layered
- Spec-driven
- WASM-first
- Security-centric
- Tooling-aware
Every architectural decision serves one of these goals.
At a high level, Glyph consists of five orthogonal layers:
ββββββββββββββββββββββββββββββββ
β User & Editors β
β (VS Code, Neovim, CI) β
ββββββββββββββββ¬ββββββββββββββββ
β
ββββββββββββββββΌββββββββββββββββ
β Tooling Layer β
β (glyph CLI, rig, LSP) β
ββββββββββββββββ¬ββββββββββββββββ
β
ββββββββββββββββΌββββββββββββββββ
β Runtime Implementations β
β Wisp (Dart) | Sparq (Rust) β
ββββββββββββββββ¬ββββββββββββββββ
β
ββββββββββββββββΌββββββββββββββββ
β Canonical Specs β
β Language | AST | ABI | Man.β
ββββββββββββββββ¬ββββββββββββββββ
β
ββββββββββββββββΌββββββββββββββββ
β Host Systems β
β Go | Flutter | Web | Games β
ββββββββββββββββββββββββββββββββ
Key idea: Everything above the specs consumes them. Nothing below them depends on implementation details.
The spec layer is the heart of Glyph.
Located in:
glyph/spec/
It defines:
- Language semantics
- Canonical AST
- Module manifest
- Host ABI
The specs define truth. Implementations conform.
No runtime, tool, or editor may invent behavior not described in the specs.
Glyph deliberately has two runtimes, each optimized for a different axis.
Location: glyph/wisp/
Purpose:
- Fast iteration
- Hot reload
- Flutter integration
- REPL and debugging
Characteristics:
- AST interpreter
- No WASM
- Best-effort sandboxing
- Mirrors production semantics where possible
Wisp optimizes for developer experience.
Location: glyph/sparq/
Purpose:
- Secure execution
- Determinism
- Performance
- Portability
Characteristics:
- AST β WASM compiler
- WASM-first execution
- Strict sandboxing
- Capability enforcement
- Resource quotas
Sparq optimizes for correctness and safety.
Wisp may be forgiving. Sparq never is.
If behavior differs, Sparq is authoritative.
Location: glyph/toolchain/
Responsibilities:
- Build pipelines (source β AST β
.rwm) - Validation (specs, manifests, ABI)
- Packaging and signing
- Execution orchestration
- Registry interaction
The toolchain:
- never defines semantics
- never executes code directly
- never bypasses the runtime
It is a control plane, not an execution engine.
Location: glyph/lsp/
The LSP is not just syntactic.
It is:
- spec-aware
- manifest-aware
- runtime-aware
It surfaces:
- real execution constraints
- capability mismatches
- production-only failures
- dev/prod divergence
Editor feedback must never contradict runtime behavior.
.gl source
β
Wisp parser
β
Canonical AST
β
Wisp interpreter
β
Live execution (hot reload)
.gl source
β
Canonical AST
β
Sparq compiler
β
WASM
β
.rwm (WASM + manifest)
β
Sparq runtime
β
Sandboxed execution
The AST is the hinge between dev and prod.
Glyph modules are:
- isolated
- explicit
- capability-scoped
A module:
- cannot see the filesystem unless granted
- cannot access time or randomness implicitly
- cannot escape its sandbox
- cannot affect the host except via ABI
The manifest is authoritative for permissions.
Hosts (Go servers, Flutter apps, browsers, games):
- Provide capabilities
- Enforce policy
- Control scheduling
- Own resources
Modules:
- call into hosts
- never own host state
- never gain ambient authority
This inversion of control is intentional.
Security is not a feature layer.
It is enforced at:
- Spec level (what is allowed)
- Tooling level (what is validated)
- Runtime level (what is enforced)
No single layer is trusted alone.
If a module is malicious, the system must still be safe.
When enabled:
- execution is reproducible
- async scheduling is fixed
- time/randomness are virtualized
This enables:
- reliable CI
- replayable simulations
- safe plugin execution
Determinism is an architectural capability, not an optimization.
spec/ β contracts (truth)
wisp/ β dev runtime
sparq/ β prod runtime
toolchain/ β orchestration
lsp/ β editor intelligence
docs/ β human guidance
examples/ β reference usage
Directory boundaries reflect responsibility boundaries.
Glyph is not:
- a systems language
- a replacement for Go or Dart
- a general-purpose web scripting language
- a large standard library
- a monolithic runtime
Glyph succeeds by staying small.
The architecture is designed so that:
- new runtimes can be added
- new hosts can embed Glyph
- tooling can evolve independently
- specs can version cleanly
Breaking changes are possible β but deliberate.
These must never be broken:
- Specs define semantics
- No ambient authority
- WASM is the production contract
- Tooling does not weaken security
- Editor feedback matches runtime reality
If a proposal violates any of these, it is rejected.
Glyph is successful when it disappears into the architecture of larger systems β quietly making them safer, more flexible, and more humane to build.