Files
wehub-resource-sync e7738de6d2
CI / Deep Native Runtime Cases (1/6) (push) Has been skipped
CI / Native Preflight (push) Failing after 1s
CI / Native Runtime Cases (1/2) (push) Failing after 0s
CI / Native Runtime Cases (2/2) (push) Failing after 1s
CI / Native Metadata Reports (push) Failing after 0s
CI / Native Direct Backend Artifacts (push) Failing after 0s
CI / Native Sanitizer Smoke (push) Failing after 1s
CI / Command Contract Snapshots (push) Failing after 1s
CI / Deep Conformance Suite (push) Has been skipped
CI / Graph Build Perf (push) Failing after 1s
CI / Deep Native Preflight (push) Has been skipped
CI / Deep Native Runtime Cases (2/6) (push) Has been skipped
CI / Deep Native Runtime Cases (3/6) (push) Has been skipped
CI / Conformance Suite (push) Failing after 1s
CI / Workspace Checks (push) Failing after 0s
CI / Deep Native Runtime Cases (5/6) (push) Has been skipped
CI / Deep Native Runtime Cases (6/6) (push) Has been skipped
CI / Deep Native Runtime Cases (4/6) (push) Has been skipped
CI / Deep Graph Build Perf (push) Has been skipped
chore: import upstream snapshot with attribution
2026-07-13 12:29:30 +08:00

2.6 KiB
Raw Permalink Blame History

Start With An Agent

Zerolang is designed for a human working with an agent.

The agent should author the program through the graph. The human should review the graph summary, command output, and the .0 projection when useful. A projection is readable and bidirectional, but it is not the normal place for an agent to write code.

Install

curl -fsSL https://zerolang.ai/install.sh | bash
export PATH="$HOME/.zero/bin:$PATH"
zero --version

Then install the agent bootstrap skill:

npx skills add vercel-labs/zerolang

Use the installed zero command in public examples. If you are developing Zero itself, follow the repository contributor notes for checkout-local compiler work.

Hello World

Start by asking:

{
  "messages": [
    {
      "role": "user",
      "text": "build hello world for zerolang"
    },
    {
      "role": "assistant",
      "text": "Ill initialize this directory, add main, and run it."
    },
    {
      "role": "tools",
      "calls": [
        {
          "command": "zero init",
          "output": "graph project init ok\nwrote: ./zero.toml\nwrote: ./zero.graph"
        },
        {
          "command": "zero patch --op 'addMain' --op 'addCheckWrite fn=\"main\" text=\"hello from zero\\n\"'",
          "output": "program graph patch ok"
        },
        {
          "command": "zero run",
          "output": "hello from zero"
        }
      ]
    }
  ]
}

The expected projection is:

pub fn main(world: World) -> Void raises {
    check world.out.write("hello from zero\n")
}

That file is a projection of zero.graph. Humans can read it, review it, and occasionally edit it. Agents should normally keep using zero query and zero patch.

The Daily Loop

Use this loop for most tasks:

zero query
zero patch --op help
zero patch --op 'addMain'
zero check
zero test
zero run -- <args>

The default input is the current directory, so a package command does not need . unless you want to be explicit.

Reviewing A Projection

When a human wants to see readable text:

zero export
zero verify-projection

When a human intentionally edits src/main.0, import the projection back into the graph before checking or running:

zero import
zero check

Do not use projection export as an automatic agent step. Export when a human asks to review source-like text or when CI wants a projection drift gate.

Build An Artifact

Use zero build for executable, object, or LLVM IR artifacts:

zero build --emit exe --target linux-musl-x64 --out .zero/out/app

For early exploration, zero run is usually enough.