clai — command-line artifact interpreter

grammar-driven systems interface.

see it run →

systems work scatters across incompatible surfaces. compilation here. execution there. inspection elsewhere. handles ephemeral. context lost between operations.

clai consolidates: same @handle across forge → exec → inspect → evolve. one interface, composable by construction.

grammar

clai <lane>:<surface>.<verb> [subject] [options] [@context] [| next...]

@context — stable URI handles; immutable; replacements retain lineage · @A = handle name · @A/B = child context · ^ = parent

lanes (forces)

surfaces (scales)

atom → frame → module → program → graph → mesh → meta
(+ snapshot for frozen-topology state)

snapshot is orthogonal to the scale ladder — it captures frozen-topology state across any surface

examples

clai forge:module.c src/main.c
compile c source to module
clai exec:program.spawn bin/app --as @A
spawn process with handle @A
clai inspect:mem.map @A --at program
inspect memory map of @A
clai evolve:function.swap @A/factorial swap.c
evolve lane: transactional code mutation
clai inspect:mem.map @A | inspect:graph.view @.
pipeline: map memory then visualize

parser demo

grammar validator · returns parse tree (not execution)
$
{ "nstages": 1, "stages": [ { "lane": "inspect", "surface": "mem", "verb": "map", "context": "@svc", "at": "program", "flags": { "down": 0, "up": 0, "all": false } } ] }
syntax validation (click to parse):
inspect:program.handles --all forge:module.c test.c --opt=2 pipeline example error example

source

c99 parser. no heap. single pass.

quickstart

curl -O https://clai.ink/kernel/clai_parse.c -O https://clai.ink/kernel/clai_parse.h \
     -O https://clai.ink/kernel/demo.c -O https://clai.ink/kernel/Makefile
make
./clai_parse_demo "inspect:mem.map @svc --at program"
clai_parse.h (92 lines)
loading...
view raw
clai_parse.c (284 lines)
loading...
view raw
demo.c (23 lines)
loading...
view raw
Makefile (20 lines)
loading...
view raw
LICENSE (mit)
loading...
view raw

design foundations


invariants

  1. lane purity — inspect never mutates, evolve is transactional
  2. deterministic dispatch — (lane, surface, verb) → unique target or error
  3. stable handles — uris immutable; replacements have lineage
  4. explaining machine — clai explain always works
  5. capability security — verbs gated by mask, defaults least privilege
  6. structural persistence — topology + lineage, not heap dumps