Glyphlang
Skill tdw419/glyphlang
AI-first backend programming language with spatial assembly substrate. Use when building APIs, backend services, or spatial computation programs with GlyphLang, compiling .glyph files, or working with the Geometry OS stack.From its SKILL.md
npx -y skills add tdw419/glyphlangAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
2 things to look at
- no licenseNo license file was found in the repository. Code published without one is not open source by default, so using it at work is a question for whoever answers licensing questions where you are.
- 0 stars0 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
SKILL.md
6.6 KB, ~1.7k tokens by cl100k_base, as published. Nobody here has run it
GlyphLang
AI-first backend language that compiles to a single static binary. Designed for minimal token consumption and maximum LLM generation accuracy. ~5x fewer lines and tokens than equivalent Python/FastAPI.
When to Use
- Building REST APIs, WebSockets, or backend services with AI code generation
- Minimizing LLM token costs for backend development
- Single-file service deployment (no container orchestration needed)
- Spatial computation or self-modifying programs (Ouroboros architecture)
- Polyglot code generation (one
.glyphsource → Python/TypeScript output)
Quick Start
glyph init # Initialize project
glyph run hello.glyph # Run server (default :3000)
glyph dev hello.glyph # Dev server with hot reload
glyph validate src/ --ai # Validate with JSON error output
glyph context --format compact # Project summary for AI context
Symbol Reference
| Symbol | Name | Usage | Example |
|---|---|---|---|
@ | Route/Endpoint | HTTP endpoint | @ GET /users |
: | Type | Type definition | : User { id: int } |
$ | Variable | Variable declaration | $ name = "Alice" |
! | Function | Function/CLI command | ! greet(name: str) |
> | Return | Return statement | > {message: "ok"} |
+ | Middleware | Apply middleware | + auth(jwt) |
% | Inject | Dependency injection | % db: Database |
? | Optional | Optional type | email: str? |
* | Cron | Scheduled task | * "0 * * * *" cleanup |
~ | Event | Event handler | ~ user.created |
& | Queue | Queue worker | & emails processEmail |
# | Comment | Single-line comment | # comment |
-> | Arrow | Return type annotation | -> User |
| | Union | Union type | str | int |
Type modifiers: T! (required), T? (optional), [T] (array)
Core Patterns
CRUD API
: User {
id: int!
name: str!
email: str?
}
@ GET /users -> [User] {
% db: Database
> db.query("SELECT * FROM users")
}
@ POST /users {
% db: Database
> db.insert("users", input)
}
@ GET /users/:id -> User | Error {
% db: Database
$ user = db.query("SELECT * FROM users WHERE id = ?", id)
if user == null { > {error: "not found", code: 404} }
> user
}
Pattern Matching
$ result = match code {
200 => "OK"
404 => "Not Found"
n when n >= 500 => "Server Error"
_ => "Unknown"
}
Async/Await with Combinators
@ GET /dashboard {
$ user = async { > db.getUser(userId) }
$ orders = async { > db.getOrders(userId) }
> {user: await user, orders: await orders}
}
WebSocket
@ ws /chat/:room {
on connect { ws.join(room) }
on message { ws.broadcast_to_room(room, input) }
on disconnect { ws.leave(room) }
}
Generics
! map<T, U>(arr: [T], fn: (T) -> U): [U] {
$ result = []
for item in arr { result = append(result, fn(item)) }
> result
}
Auth + Middleware Chain
@ GET /api/profile -> User {
+ auth(jwt)
+ ratelimit(100/min)
% db: Database
> db.query("SELECT * FROM users WHERE id = ?", auth.user_id)
}
Type System
| Type | Syntax | Notes |
|---|---|---|
| Primitives | int, str, bool, float | Built-in |
| Arrays | [T] | Generic collections |
| Objects | { field: Type } | Inline or named via : |
| Optional | T? | Nullable |
| Union | A | B | Either type |
| Generic | T | Type parameters on functions/types |
Project Layout
my-project/
├── main.glyph # Entry point with routes
├── types.glyph # Type definitions (optional)
├── utils.glyph # Utility functions (optional)
└── .glyph/ # Build artifacts
Import modules: import "./utils" → access as utils.functionName()
AI Agent Workflow
# 1. Get project context (optimized for LLM context windows)
glyph context --format compact
# 2. Make changes, then validate
glyph validate src/ --ai # Returns JSON errors with fix hints
# 3. Check what changed
glyph context --changed
# 4. Generate polyglot output if needed
glyph codegen main.glyph --lang typescript -o ./out
Spatial Assembly Substrate (Low-Level)
For advanced use: Ouroboros Level 3 architecture with self-modifying programs. See references/spatial-assembly.md for the full opcode reference.
Key opcodes:
| Opcode | Stack Effect | Description |
|---|---|---|
0-9 | ( -- n) | Push integer |
+ - * / | ( a b -- r) | Arithmetic |
> < = | ( a b -- bool) | Comparison (pushes 1/0) |
? | ( c t f -- r) | Conditional |
L | ( s e -- [r]) | Range generator |
M | ( v o -- ) | Mutator: overwrite code at IP+offset |
S | ( o -- id) | Mitosis: clone VM into parallel thread |
. | ( v -- ) | Output to visual grid |
@ | ( -- ) | Terminate thread |
@> | ( -- ) | Request natural language intervention |
Register protocol: Lowercase a-z pops stack → store. Uppercase A-Z loads register → push stack.
Common Mistakes
| Mistake | Fix |
|---|---|
Using return keyword | Use > for returns |
Declaring types with type | Use : prefix: : User { ... } |
Writing function | Use ! prefix: ! myFunc() |
| Multiple files for simple API | Keep in single .glyph file |
Forgetting ! on required fields | T! = required, T? = optional |
Using async/await keywords | Use async { } blocks and await expression |
| Missing dependency injection | Use % db: Database to inject |
Performance Characteristics
- Compilation: ~867ns to static binary
- Execution: 2.95-37.6 ns/op instruction throughput
- Token savings: 23% vs FastAPI, 36% vs Flask, 57% vs Spring/Java
- Deployment: Single static binary, built-in HTTP server + DB access
References
- Spatial Assembly Opcode Reference - Full low-level instruction set
- GitHub Repository - Source, issues, discussions
- VS Code Extension - LSP + syntax highlighting
What ships with it: 614 files
6149.9 KB alongside SKILL.md, 43 of them executable
aipm/
- compression_analyzer.pyruns5.9 KB
- orchestrator.glyph3.2 KB
- prompt_queue_bridge.pyruns6.1 KB
- README.md3.4 KB
benchmarks/
- bench_ai_efficiency.pyruns21.1 KB
- BenchJava.java7.0 KB
- bench_python.pyruns5.0 KB
- .gitignore44 B
bootstrap/
- ast.glyph3.1 KB
- compiler.glyph18.3 KB
- interpreter.glyph118.1 KB
- INTERPRETER_PLAN.md2.6 KB
- lexer.glyph8.1 KB
- parser.glyph36.2 KB
- README.md4.1 KB
- runtime_minimal.md2.6 KB
- test_bootstrap_cycle.glyph2.1 KB
- test_bytecode_debug.glyph1.1 KB
- test_chaining.glyph1.7 KB
- test_circular_a.glyph116 B
- test_circular_b.glyph109 B
- test_command_dispatch.glyph6.1 KB
- test_e2e.glyph1.7 KB
- test_for_in_e2e.glyph7.8 KB
- test_for_in.glyph2.7 KB
- test.glyph1.0 KB
- test_gpu_exec.glyph3.2 KB
- test_imports.glyph295 B
- test_interp2.glyph249 B
- test_interp.glyph312 B
- test_iterators.glyph3.0 KB
- test_minimal_runtime.glyph1.4 KB
- test_module.glyph212 B
- test_multiarg.glyph3.1 KB
- test_parse_debug.glyph986 B
- test_self_compile.glyph2.7 KB
- test_trace.glyph1.4 KB
- test_vm_bootstrap.glyph4.0 KB
- AGENT_TASK.md3.9 KB
- .air.toml953 B
574 more files not listed here. See all 614 in the repository.