# Introduction

> What zelk is, the three ways to use it, and where it stands.

zelk is an agent loop for Go. It sends the conversation to a model, runs the
tools the model asks for, checks each call against the permission rules, keeps
the context inside the model's window and decides when a run is really done.
Everything else stays with the program that embeds it: the process, storage,
isolation, scheduling, transport and the user's identity.

Every session is an append-only log of events. The loop reads its state from
that log, so a session survives a crash, moves between processes and replays
exactly as it happened.

:::caution[Pre-release]
zelk has no release yet, and its APIs may change before v1.0. Until the first
release, take it from a checkout of the repository, at a commit you pin:
[Get zelk](/start/get/) shows how.
:::

There are three ways to use zelk, in the order most readers want them.

## The library

The module is `github.com/barevoidco/zelk/core`, and its root package is `zelk`.
This is the way zelk is meant to be used: your program embeds the loop and
keeps the process, the storage, the isolation and the people. With no wiring
at all, `Run` reads `OPENAI_API_KEY` (or `OPENAI_BASE_URL`) and works in the
current directory:

```go
// core/lifecycle_example_test.go
res, err := zelk.Run(context.Background(), "Summarize README.md in one sentence.")
if err != nil {
	panic(err)
}
fmt.Println(res.Outcome, res.Text)
```

For anything more, [`zelk.New`](/reference/go/zelk/#new) takes each
dependency as an option: the provider, the model, a permission mode, a
workspace and a shell, a store for sessions that outlive the process.
[Quickstart: Go](/start/go/) builds a first program, and the
**Embedding guides** take it on from there.

## The zelk command, for scripts and CI

`zelk` is a coding agent in one binary, built on the library like any other
host. With `-p`, or in a pipe, it runs one task and prints the answer;
`zelk exec` runs headless jobs with resumable sessions and structured
output; `zelk acp` serves editors over the Agent Client Protocol. It takes
its provider from flags and variables, so a script needs no setup.

```sh
zelk -p -mode plan "what does ./pkg/foo do?"   # one task, read-only, then exit
zelk exec -mode accept-edits "fix the typo in README.md"
```

[Quickstart: the CLI](/start/cli/) takes you from a model to a command you
can put in a script.

## The terminal UI, to try it

On a terminal, plain `zelk` opens a full-screen chat in your repository that
asks before it changes anything. It is the quickest way to see zelk work. The
library and the scripting commands are what the rest of these pages build on.

```sh
zelk   # the terminal UI, in this directory
```

[Quickstart: the terminal UI](/start/tui/) gets you to a first change in a
minute.

## How it's built

[How zelk works](/concepts/overview/) explains the ideas: the loop and the
host, sessions as logs, executions and leases. The design contracts under
**Internals** say exactly how each part behaves, starting with the
[architecture](/internals/architecture/).
