Series: Garnet Language Research Series Date: April 16, 2026 Author: Claude Code (Opus 4.7) at the direction of Jon — Island Development Crew Status: Stub created in Phase 1B; full v1.0 deliverable is a v4.0 commitment per the master plan Anchor: “Whatsoever thy hand findeth to do, do it with thy might.” — Ecclesiastes 9:10
This paper is a v3.3 Phase 1B stub. Per the master
plan
(~/.claude/plans/i-ll-follow-plan-mode-proud-lollipop.md):
This stub provides enough content to anchor Mini-Spec v1.0 §16’s normative single-CLI principle. The full v1.0 will expand each section with measured outcomes from Stages 2–4.
Garnet’s research contribution is partly the language and partly the engineering process by which the language was built. This paper documents the implementation ladder — the seven rungs from a parsed grammar to a deterministically-built signed binary — and the tooling that makes the ladder accessible to working developers. The thesis is that language design and toolchain design are co-equal first-order concerns: a beautifully designed language with fragmented tooling (Ruby’s eternal critique) loses ground to a less-elegant language with one coherent CLI (Cargo + rustup as the modern proof). Garnet inherits Cargo and SwiftPM’s single-binary discipline as a structural commitment that prevents fragmentation from re-emerging.
The Garnet research corpus is split across:
What’s missing — and what Phase 1B identifies as a Swift-inheritance gap — is a paper that treats the implementation journey itself as a research artifact. Paper III §3.1 identifies “package tooling and language ergonomics can reinforce one another” as one of three Swift contributions, but offers no extended argument for what that means in Garnet’s case.
This paper makes the case explicit: the choices made on the engineering ladder (rungs 2–7) are research-class decisions because they determine whether the language can be adopted, audited, and trusted at scale. We document them with the same discipline as the formal sections of Paper V.
The Garnet implementation is structured as seven rungs. Each rung is a self-contained capability that can be evaluated independently and that the next rung depends on. This is the same shape as Rust’s own ladder (lex → parse → typeck → MIR → codegen) but extended to capture the agentic and dual-mode aspects.
| Rung | Capability | Spec reference | Status (April 2026) |
|---|---|---|---|
| 1 | Lexical grammar | Mini-Spec §2 | ✅ Implemented (garnet-parser-v0.3) |
| 2 | Surface syntax parser | Mini-Spec §§3–11 | ✅ Implemented (garnet-parser-v0.3) |
| 3 | Managed-mode interpreter + REPL | Mini-Spec §§5–7, §15 | ⏳ Interpreter ✅; REPL stub |
| 4 | Safe-mode lowering (NLL + borrow check) | Mini-Spec §§8.5–8.6 | ⏳ Type-check ✅; NLL pending Rung 6 |
| 5 | Sendable + actor isolation | Mini-Spec §9.4 | ⏳ Marker trait spec’d; runtime check pending |
| 6 | Cycle collection + IR lowering | Mini-Spec §4.5; Compiler Architecture Spec | ⏳ Spec’d; not yet in interpreter |
| 7 | Cross-platform installer + signing | Mini-Spec §16; ManifestSig (v3.4) | ⏳ Planned for v3.4–v4.2 |
(The status column is a snapshot of v3.3 end-of-Phase-1B. Progress through the rungs is the subject of Stages 2–6 of the master plan.)
The base PL ladder is roughly: grammar → parser → type-checker → IR → codegen. Garnet inserts two additional rungs:
Rungs strictly depend on lower-numbered rungs. Rung 4 cannot ship before Rung 3 because the type checker depends on the parsed AST. But within a rung, components MAY ship independently. For example, Rung 3 ships the interpreter (used now) before the REPL (a v3.3-end-of-Phase-1B pending item).
garnet)A Garnet developer interacts with the toolchain through one binary,
garnet, with sub-commands for every workflow. The principle
is borrowed from Cargo (Rust) and SwiftPM (Swift). The deliberate
anti-pattern is Ruby’s tooling fragmentation: separate gem
/ bundle / rake / rspec /
rubocop binaries with overlapping configs, each with its
own version-pinning behavior, each with its own lockfile.
The single-CLI principle is normative (Mini-Spec §16.1). Any
conformant Garnet implementation MUST expose all standard workflows
through the garnet binary.
The complete v1.0 sub-command catalog is documented in Mini-Spec §16.1. Highlights:
garnet new / garnet init — project
creationgarnet build /
garnet build --deterministic — compilationgarnet run / garnet test — executiongarnet check / garnet fmt — static
analysis + formattinggarnet repl — interactive evaluation (Mini-Spec
§15)garnet doc — API doc generationgarnet audit — cargo-geiger-equivalent dep
scan (v3.5 FFIGeiger)garnet verify — manifest signature verification (v3.4
ManifestSig)garnet convert — code converter from Rust/Ruby/Python/Go
(v4.1)User-installed sub-commands follow the Cargo convention: an
executable named garnet-foo on PATH MAY be invoked as
garnet foo. This permits ecosystem extension without
overcrowding the core CLI.
All garnet sub-commands MUST produce machine-parseable
JSON output when given --format=json. Default output is
human-readable. This dual output is essential for IDE integration (LSP
server in v4.x) and CI integration.
The flat-CLI design means we do NOT have garnet pkg add,
garnet pkg remove, garnet pkg list — package
operations live as garnet add, garnet remove,
garnet list directly. The maximum nesting depth is two
(garnet build --deterministic is one sub-command with
flags, not nested sub-commands).
The REPL is specified normatively in Mini-Spec §15. This section provides the research argument for treating REPL design as a research artifact rather than an afterthought.
Three claims:
garnet test --doctests
(planned v3.4). Documentation that doesn’t pass is rejected by CI.Inherits from Ruby’s irb: - Per-input expression
evaluation - Multiline detection on incomplete expressions - Persistent
bindings across inputs - Last-expression-printed convention
Inherits from Rust’s evcxr: - Type display alongside
value - Module-level redefinition without ceremony
Garnet-specific changes: - Safe-mode requires module envelope
(Mini-Spec §15.4) — preserves the safe mode’s compile-time guarantees in
an interactive context - :type / :t command
for type inquiry without evaluation - :bench command for
ad-hoc performance measurement - Hot-reload semantics: redefining a
function takes effect immediately for new calls; running actors retain
old behavior until reload command (Mini-Spec §15.3)
REPL evaluation latency for trivial expressions MUST be ≤ 10 ms (Mini-Spec §15.9). This is a hard constraint that shapes the implementation: a JIT-compiled REPL would amortize poorly per input. Garnet’s REPL uses tree-walk interpretation with on-demand AST caching.
This trades peak throughput for latency, which is the right trade for an interactive surface.
.garnet-cache/)The Garnet build cache lives at
<project>/.garnet-cache/. It contains:
episodes.log — NDJSON record of every compilation event
(per Paper VI Contribution 3, Compiler-as-Agent)strategies.db — SQLite database of synthesized
compilation strategies (per Paper VI C3)knowledge.db — content-addressed knowledge store (per
Paper VI C3)manifest.json — deterministic-build manifest (per Paper
VI C7)Per v3.3 CacheHMAC + ProvenanceStrategy (Security Layer 1), every
record is HMAC-signed with a per-machine key at
~/.garnet/machine.key. Foreign records (committed cache
from another developer) are silently skipped, not honored.
~/.garnet/machine.key)Generated on first invocation of any garnet command that
writes to .garnet-cache/. 32 random bytes from
getrandom, file mode 0600 on Unix. Path
overridable via GARNET_MACHINE_KEY_PATH.
A language server protocol implementation is planned for v4.1 or
v4.2. The REPL’s tree-walk interpreter shares the type-inference engine,
so LSP hover and goto-definition reuse the
existing infrastructure. Full design deferred to that release.
garnet fmt)garnet fmt enforces a single canonical style — no
options, no configurable preferences. This is gofmt’s
discipline: arguments about style are over once and for all by giving
everyone the same answer.
The canonical style is documented in
C_Language_Specification/GARNET_Style_Guide.md (planned for
v3.5).
Per Stage 6 of the master plan:
cargo-wix,
signed with code-signing certificate, installs to
C:\Program Files\Garnet\.pkg installer via
productbuild, universal binary (x86_64 + arm64), notarized
with Apple Developer ID.deb + .rpm via
cargo-deb + cargo-rpm, plus
rustup-style universal shell installer at
https://garnet-lang.org/install.shTime from “begin install” to “running my first Garnet program”:
garnet new my_project,
cd my_project, garnet build,
garnet runThis metric is testable; v4.2 verification includes timed installs on clean VMs of all three OSes.
User has a Garnet logo ready. v4.2 integrates it into:
garnet --version ASCII art (small)garnet new <name> output headerA new language faces the chicken-and-egg problem: ecosystems require adopters; adopters require ecosystems. The Garnet response is a migration assistant, not a full transpiler: the current deterministic lanes cover stylized Rust, Ruby, Python, and Go source and emit Garnet plus lineage, metrics, and a migration checklist.
The relevant Paper VII commitment remains: converter outputs
ship in @sandbox mode by default (per Mini-Spec §11
+ v4.0 SandboxMode security item). Human audit is required before
promoting converted code to non-sandbox status. JavaScript, TypeScript,
Swift, Java, C/C++/C#, Perl, and LLM-assisted suggestions are planned
adoption lanes only after they preserve deterministic evidence,
lineage, sandboxing, garnet check, and dogfood-readiness
gates. The machine-readable converter status now records the planned
Garnet-aware assist contract as provider-optional advisory guidance with
safe-mode, memory, capability, actor, and migration-risk analysis targets,
not as an implemented broad-language converter. The deterministic
assist-plan reporter can inspect a single planned-language source file
and emit risk/gate evidence, but it still does not activate conversion.
A converter is a language artifact — its existence (or absence) shapes the value proposition. Including the converter design in Paper VII rather than treating it as out-of-scope is the explicit acknowledgment that adoption-friction is part of the research deliverable.
Three engineering disciplines have been documented in the v3.2 → v3.3 implementation work, and Paper VII formalizes them as research-class commitments:
Every velocity push is followed by an adversarial re-read of the diff
with a different question than the test author asked. v3.3 Phase 1A
demonstrated this on the v3.2 implementation; details in
GARNET_v3_3_SLOP_REVERIFICATION.md. The discipline:
Every new attack surface (memory primitive, network primitive, hot-reload channel) is paired with its hardening before it ships. v3.3 Security Layer 1 demonstrated this for the v3.2 → v3.3 cleanup; v3.4 Security Layer 2 will demonstrate it for the new networking stdlib.
The discipline: - No feature ships before its paired defense. -
Threat models are written explicitly with named attack vectors, not just
“we considered security.” - Novel-threat-class identification is part of
the threat model — Garnet’s strategy-miner adversarial training
and BoxGARNET_v3_3_SECURITY_THREAT_MODEL.md as Garnet-specific
novel threats with no prior art.
Ordering matters. Plans don’t say “we’ll add X later.” Plans gate releases on paired deliverables. v3.3 validated five sequencing rules; the master plan documents 11 more across v3.4 → v4.0. The discipline:
These three disciplines together constitute Garnet’s “engineering process as research” claim. They are why this paper exists.
C_Language_Specification/GARNET_v1_0_Mini_Spec.md)A_Research_Papers/Paper_III_Garnet_Synthesis_v2_1.md) —
§3.1 Swift inheritanceA_Research_Papers/Paper_V_Addendum_v1_0.md) — formal
companions to Mini-Spec §§4.5, 8.5–8.6, 9.4, 11.6A_Research_Papers/Paper_VI_Garnet_Novel_Frontiers.md) —
the seven novel contributionsC_Language_Specification/GARNET_Compiler_Architecture_Spec.md)
— implementation details for the seven rungsF_Project_Management/GARNET_v3_3_*.md)~/.claude/plans/i-ll-follow-plan-mode-proud-lollipop.mdThis stub will be expanded into Paper VII v1.0 in Phase 4C of the master plan (v4.0 stage). Additions:
The stub is structured so that the full v1.0 grows in place — each section already has its scaffold; the v4.0 paper fills in the measured outcomes.
Stub prepared 2026-04-16 by Claude Code (Opus 4.7) — Phase 1B Swift-inheritance close-out. The Mini-Spec §16 “single-CLI principle” is the spec hook; this paper is the research justification.
“Where there is no vision, the people perish: but he that keepeth the law, happy is he.” — Proverbs 29:18