Quick start
This page takes one change through the whole loop: declare an intent, push, propose, approve, land, and ask why a line is there.
What you need
Section titled “What you need”| Version | Used for | |
|---|---|---|
| Go | 1.25.8 or later | Building the CLI |
| git | 2.40 or later | Every command that touches a repo; the CLI shells out to it |
| A Wayglass Worker | Its URL and its key. Deploy your own with Self-hosting, or get both from whoever runs one |
1. Build the CLI
Section titled “1. Build the CLI”No release is tagged yet, so build from a clone:
git clone https://github.com/wayglass/wayglass.gitcd wayglassmake build # writes bin/wayglassexport PATH="$PWD/bin:$PATH"wayglass versionWithout make: go build -o bin/wayglass ./cmd/wayglass.
2. Log in
Section titled “2. Log in”wayglass login stores the Worker URL and key in ~/.config/wayglass/credentials.yaml with mode 0600, after checking the key against the Worker. The key is read from standard input or from WAYGLASS_KEY, never from a flag, so it stays out of shell history and the process list.
printf '%s\n' "$KEY" | wayglass login --worker https://wayglass.example.com --key-stdinThe key is the Worker’s admin key, an agent key bound to one name, or a human key bound to one name and allowed to decide changes policy routes to a person. Whoever runs the Worker logs in with the admin key and mints one key per agent or person:
wayglass keys create --agent claude-docs --note "docs agent on the laptop"wayglass keys create --agent alice --human --note "reviews on the laptop"Each key is shown once. Each agent logs in with its own key; the Worker then records every request under the key’s name and ignores any name the caller sends, so an agent cannot approve its own change as someone else. wayglass keys list and wayglass keys revoke <id> manage them. On a Worker with Cloudflare Access on, a person can instead run wayglass login --human and get a 12-hour key from their organisation’s login. See Security model.
With the admin key, your name in the audit log defaults to user@host; set another with --agent at login, or per command with WAYGLASS_AGENT.
Check the setup:
wayglass doctordoctor checks git, the stored login (and, for a human session, when it ends), that the Worker answers, that it accepts your key and which name it acts as, and, inside a project, that the trunk answers over git with a 60-second read-only token. It exits 1 if a check failed and says what to fix; --json gives the same checks to an agent.
WAYGLASS_URL, WAYGLASS_KEY and WAYGLASS_AGENT override the stored values on every command. WAYGLASS_CONFIG_DIR moves the config directory.
3. Initialise a repository
Section titled “3. Initialise a repository”In the git repository agents will work on:
wayglass initThis creates the project on the Worker and its trunk repo in Artifacts, writes three files, commits them, and pushes HEAD to the trunk:
.wayglass/policy.yaml, copied from the built-in example if the file does not exist yet. See Policy..wayglass/config.yaml: project name, trunk repo and remote, jurisdiction. It holds no secrets..wayglass/.gitignore, which ignores.wayglass/state/(the current intent and session context; never tokens).
The project name defaults to the directory name. --jurisdiction eu puts the project’s repos in the EU namespace, if the Worker has one; this cannot be changed later. --public opts the project in to the web audit view.
This works in a repository with years of history too, and wayglass init --from https://github.com/you/app.git clones one first with your own git credentials. See Existing repositories for GitHub, GitLab, private repositories, and publishing landed work back.
4. Declare an intent
Section titled “4. Declare an intent”Before writing code, say what you will change and why:
wayglass intent declare \ --goal "Add a getting-started guide" \ --reason "New users get lost after install" \ --path "docs/**"The Worker forks the trunk for this intent and mints a write token for that fork, valid for 15 minutes. The intent becomes this checkout’s current intent, so later commands find it without an argument. If another open intent declared overlapping paths, you get a warning and a suggested re-plan; see Overlaps.
5. Edit and push
Section titled “5. Edit and push”$EDITOR docs/guide.mdwayglass push -m "docs: add a getting-started guide"With -m, push stages and commits every change first and appends a Wayglass-Intent: <id> trailer. Without it, commit yourself and run wayglass push. It pushes HEAD to the intent’s fork, reports the changed files to the Worker for overlap checks, and asks the Worker for a fresh fork token each time, so a long session never needs the original token.
6. Propose
Section titled “6. Propose”wayglass proposeThe CLI classifies the diff locally and shows a preview. The Worker then reads the fork itself, classifies it again, and decides with the policy at the trunk’s current head. The Worker’s decision is the one that counts. The exit code says what happens next:
| Exit | Decision status | Next |
|---|---|---|
0 |
approved (auto_merge) |
wayglass land |
0 |
pending_agent (agent_review) |
A reviewer agent other than the author approves, then land |
4 |
pending_human, quarantined |
A person approves with wayglass approve |
3 |
blocked |
Change the code; a blocked decision can never be approved |
propose --dry-run decides locally and records nothing.
7. Approve (as someone else)
Section titled “7. Approve (as someone else)”Whoever the policy routed the change to approves it with a reason. The reason goes into the audit log and into the git note on the landed commit, so the CLI and the Worker both refuse placeholders such as TODO or <what you checked>.
wayglass review # the queue, as a TUI on a terminalwayglass approve i269d1c348e --reason "Read it; accurate and short"The approver must run under a different name from the author; the Worker refuses a decision by the agent that wrote the change. A change routed to a person (pending_human or quarantined) must be decided with the admin key or a human key; an agent key gets needs_human and exit 4. agent_review changes can be decided by another agent key.
8. Land
Section titled “8. Land”wayglass landOnly the intent’s author or the admin can land it. The Worker hands out a trunk write token that lives 300 seconds, and only for an approved decision whose fork has not moved since and whose policy is still the trunk’s. land merges the approved commit onto the current trunk in a temporary worktree, pushes it with the why note, and asks the Worker to verify that the trunk now holds exactly the approved change. If .wayglass/config.yaml names a mirror remote (for example origin on GitHub), land then pushes the trunk branch and notes there with your own git credentials. If the trunk’s policy changed since the decision, or the change no longer merges, land stops; wayglass sync, then push and propose again. See Landing.
9. Ask why
Section titled “9. Ask why”wayglass why docs/guide.md:1why blames the line to its commit and reads the note under refs/notes/wayglass: the intent’s goal and reason, the tags, the rule that matched, who decided, and each approver’s reason. Without a note in your checkout it asks the Worker.
- For agents has the same loop written for an agent, with
--json. wayglass watchshows every open intent, its tags and decisions as they happen.wayglass logreads the project’s audit log.