viff

module
v0.0.0-...-3d60dd8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 25, 2026 License: Apache-2.0

README

viff

Viff is a small runtime. It governs software delivery work across systems that you do not own, and you choose how much of that work agents do without asking. One viff instance is shared by a team: everyone in it, and every agent, acts under their own name, and whoever holds the permission sees and steers the work.

You install a charter. A charter is a list of rules, and each rule has a condition and an action. Viff keeps a shared store of data, which anyone may observe. When data changes, viff finds the rules that match and does the work with agents.

Every reaction passes a gate. A gate has one of three modes:

Mode What happens
auto the action runs
ask a person or an agent must approve first
park the action is held

You set the mode for each action. The agents that do the work stay observable, and you can steer them while they run.

data changes ──▶ trigger matches ──▶ gate resolves ──▶ action fires
     ▲                                                      │
     └───────────── actions write data ◀───────────────────┘

No orchestrator

Viff has no orchestrator. This follows from what viff can do. It is not a preference.

Viff works with things it does not own: a repository, a chat workspace, a person's time. Viff can observe them, and it can request that they change. It cannot stop them from changing.

An orchestrator keeps a position in a plan. That position is a second statement about the state of those things, and it is wrong as soon as one of them changes between two steps. So viff keeps no plan. It reacts to what it last observed. This is why the loop in the diagram goes through the store, and not through a scheduler.

The flow of work is therefore not written down anywhere. Viff derives it when you ask: viff flow show <subject> builds the flow for one subject from three sources.

Source What it says
the charter what may still happen
the mirror what has already happened
the live registry what is running now

You write the rules, and each rule's spawn says what its task may reach, its environment, and what it does without asking, its autonomy.

Quick start

You need Go 1.27.1 or later.

go build -o viff ./cmd/viff
export PATH="$PWD:$PATH"          # so that `viff` is this build
export VIFF_ADDR=localhost:9797
viff up                          # engine + task runtime + store, in one process

./scripts/seed-demo.sh            # in another terminal: a charter, entities, a waiting gate

viff up starts the store too, as two child processes (logd and docd), so the store is durable from the first run. up finds the o binary that hosts them by itself. It uses -o-bin if you give it, else a matching version on PATH, else one it installs into ~/.viff/bin (the reference). So up works in any directory, and not only in a checkout.

You need no configuration to start. Toward a viff instance on your own machine the CLI acts as user:<login>@localhost, where <login> is your login name.

scripts/seed-demo.sh fills the empty viff. It writes two rules and some data. When it ends, one reaction has already happened and one gate is waiting for you. Then it prints what to type next.

You can do the same by hand: viff charter -a …, viff data … --put …, viff question, viff question approve ….

Two more scripts seed worlds to read and to react to:

  • scripts/seed-entities.sh writes data to select over, for the data page of the tutorial.
  • scripts/charter-shapes.sh installs the shapes a rule can have, one command each, under demo. Each shape is installed, made to fire, suspended and removed by name.

The tutorial has a page for each part of viff, data, questions, tasks and charters, and a second page of charters.

What's here

Three tiers of package. Public by intent is what the two documented examples import: a runner is built on pkg/runner, pkg/runner/runnerd, pkg/systems and pkg/task; an iod on pkg/entity, pkg/io and pkg/io/iod; a program that drives a viff instance on pkg/client. The rest of pkg/ is public because Go makes it so, being what those pull in, and nothing in it is promised yet. internal/ is viffd's own, until a documented need moves something out: opening a package is free, closing one breaks whoever imported it. internal/iotests holds the shipped iods' tests that run against a real viffd, and, for github, linear and slack, their unit tests too, moved whole so that the fakes both kinds share stay unexported.

  • pkg/entity/ — the store. It is one tree of data, and a kinded path addresses each node. The store can be watched, and every commit has a revision. It is durable, and a scope is a copy-on-write view of it. It runs over logd and docd. Every write names who made it. A node belongs to whoever created it, and the store refuses a write that the node's permissions do not allow (permissions).

  • internal/trigger/ — the rule engine. A rule matches when all of its conditions hold. All the gates of a rule are asked at the same time, and all must pass. An action is data, not code. A new rule acts on what already stands in the store. The engine watches only the subtrees that its rules read.

  • pkg/task/ — a task is a unit of work that viff governs and that you can steer. An agent or a shell command does it.

  • pkg/runner/ — where a task runs: on a runner served over HTTP, the one viff up starts beside itself or one registered with it. The engine drives each through one interface, so every viff task command works with each. pkg/runner/runnerd/ hosts a runner and serves it over HTTP, and pkg/runner/runnerd/stock/ is the runner viff ships.

  • pkg/mirror/ — writes each running task into the store, as data at mirror.task.instance.<id>. So to observe or steer a task, you observe data.

  • internal/resolver/ — a service that answers asks for whoever grants it. A resolver is installed. It is not written in a charter, because it lasts longer than one rule, and because it belongs to whoever runs it. Its match says which asks it watches; a person or a place's owner on record grants it to answer for them, and its answer is then theirs. To consult somebody it raises an onward ask, whose answer comes back as its own.

  • pkg/io/ and cmd/iod/ — the connection to an external system. An iod has two halves: it reflects state in, and it acts out. You deploy an iod and install it (viff iod add). It owns a place in the store, such as git, and rules react to that place. Viff ships five (iod git|git-issue|slack|linear|github). To write another, copy the sample program and write one function.

  • internal/viffd/ and cmd/viff/ — the HTTP server and the viff CLI. Each command is named in the singular, and with no argument it lists.

    The CLI Commands
    governs data, charter, schedule, task, flow, resolver, runner, iod, perms, group
    asks and answers with ask, question
    reads status, watch, schema
    says who you are whoami, account
    serves to an agent's host mcp
    runs up, down
  • deploy/ and Makefile — build the image locally and run viff on Kubernetes, from a checked-in o build.

Docs

docs/ is the index: the basic concepts, the tutorial, the systems, control, the glossary, a comparison with other tools, and the reference. It describes what runs, and so does the site mkdocs builds from it. Start with:

Deployment

  • Deployment of shared instance I gets an annotated git tag deploy/<I>.N. The annotation for the tag mentions the components which are deployed.
  • Deployment tags the main branch in normal operation, but may tag off main to work around a deployment issue. If it tags off-main, the tag annotation names the nearest main commit.
  • main stays ff-only

Directories

Path Synopsis
cmd
iod command
Command iod serves viff's reflection contract for the systems viff ships a connector for: a git repository (or a mirror of a remote one), the issues `git issue` keeps inside one, a Slack workspace, a Linear team, a set of GitHub repositories.
Command iod serves viff's reflection contract for the systems viff ships a connector for: a git repository (or a mirror of a remote one), the issues `git issue` keeps inside one, a Slack workspace, a Linear team, a set of GitHub repositories.
runnerd command
Command runnerd is the runner viff ships: a program that does the work a launch describes, and that viff reaches over a URL.
Command runnerd is the runner viff ships: a program that does the work a launch describes, and that viff reaches over a URL.
viff command
Command viff is the single CLI for the viff prototype: `up` starts the daemon(s); every other subcommand is a client that connects to a running viff.
Command viff is the single CLI for the viff prototype: `up` starts the daemon(s); every other subcommand is a client that connects to a running viff.
viff-call-tool command
Command viff-call-tool calls one tool of the task whose workspace it runs in: `question-ask`, `git-push`, `git-fetch`, `github-create-pr`, `github-update-pr`, `github-list-prs`, `github-read-pr`, `github-comment-pr`, `github-reply-comment`, and whatever the task's runner offers.
Command viff-call-tool calls one tool of the task whose workspace it runs in: `question-ask`, `git-push`, `git-fetch`, `github-create-pr`, `github-update-pr`, `github-list-prs`, `github-read-pr`, `github-comment-pr`, `github-reply-comment`, and whatever the task's runner offers.
viff-secret-exec command
Command viff-secret-exec runs one command with one secret of the runner's store, from a shell of the task's, as if the command ran in place: its stdout and stderr are this command's, its exit status this command's, and with `-stdin` this command's stdin is its input.
Command viff-secret-exec runs one command with one secret of the runner's store, from a shell of the task's, as if the command ran in place: its stdout and stderr are this command's, its exit status this command's, and with `-stdin` this command's stdin is its input.
docs
reference/examples/io command
Command io is a viff iod you can copy and change: the smallest thing that serves the viff-facing reflection contract, so a drive can reflect a system viff itself knows nothing about — one behind a corp firewall, one whose credentials belong to somebody else, one that has not been written yet.
Command io is a viff iod you can copy and change: the smallest thing that serves the viff-facing reflection contract, so a drive can reflect a system viff itself knows nothing about — one behind a corp firewall, one whose credentials belong to somebody else, one that has not been written yet.
reference/examples/runner command
Command runner is a viff runner you can copy and change: the smallest thing that serves the viff-facing task-control contract, so a drive can deploy somewhere to run work that the viff deployment does not otherwise need to know about.
Command runner is a viff runner you can copy and change: the smallest thing that serves the viff-facing task-control contract, so a drive can deploy somewhere to run work that the viff deployment does not otherwise need to know about.
internal
adminface
Package adminface wires a viff daemon's out-of-band face: the gops agent, and go-tony's admin listener — net/http/pprof, goroutine stacks, and a short index of what this process is and where it listens — on a listener that is off the data path.
Package adminface wires a viff daemon's out-of-band face: the gops agent, and go-tony's admin listener — net/http/pprof, goroutine stacks, and a short index of what this process is and where it listens — on a listener that is off the data path.
config
Package config loads viff's layered configuration.
Package config loads viff's layered configuration.
repocharters
Package repocharters is the reconciler of a repository's charters: a system-level charter viff ships, rendered for one repository and installed by a deployment, which keeps what runs in viff equal to the last state of the repository's charters directory on its main branch that the team said yes to (git-issue dzxn44gw; the design is j5vbwvja and its parts).
Package repocharters is the reconciler of a repository's charters: a system-level charter viff ships, rendered for one repository and installed by a deployment, which keeps what runs in viff equal to the last state of the repository's charters directory on its main branch that the team said yes to (git-issue dzxn44gw; the design is j5vbwvja and its parts).
resolver
Package resolver is the record of an installed resolver: a service that watches asks and answers for whoever granted it (9ce3bva0, stage 4).
Package resolver is the record of an installed resolver: a service that watches asks and answers for whoever granted it (9ce3bva0, stage 4).
schema
Package schema is viff's self-description: ONE tony schema, in one context, defining everything viff puts on the wire — the top-level paths of the API and every shape they name.
Package schema is viff's self-description: ONE tony schema, in one context, defining everything viff puts on the wire — the top-level paths of the API and every shape they name.
trigger
Package trigger is the ECA core: it observes the entity-viff, matches triggers against each change, gates the ones that match, and fires their actions.
Package trigger is the ECA core: it observes the entity-viff, matches triggers against each change, gates the ones that match, and fires their actions.
trigger/charter
Package charter is the shape of a charter's records: where a rule, a stratum and a package's declaration stand in the viff instance, what each record holds, and the records as they change (Follow).
Package charter is the shape of a charter's records: where a rule, a stratum and a package's declaration stand in the viff instance, what each record holds, and the records as they change (Follow).
viffd
Package viffd is the viff instance as one process: the entity store, the trigger engine, the task runtime and the door that says who a request is from, assembled behind one HTTP surface that the `viff` CLI drives (Server).
Package viffd is the viff instance as one process: the entity store, the trigger engine, the task runtime and the door that says who a request is from, assembled behind one HTTP surface that the `viff` CLI drives (Server).
viffd/viffdtest
Package viffdtest stands up a viffd for a test outside the package: a server over a store, with a runner served beside it and registered as its local runner, as `viff up` registers its own.
Package viffdtest stands up a viffd for a test outside the package: a server over a store, with a runner served beside it and registered as its local runner, as `viff up` registers its own.
pkg
answer
Package answer is the contract a spawn puts on its own final message.
Package answer is the contract a spawn puts on its own final message.
api
Package api is the Operator API: viffd's HTTP surface, as the routes it serves and the requests and answers that are its own.
Package api is the Operator API: viffd's HTTP surface, as the routes it serves and the requests and answers that are its own.
charterfile
Package charterfile is how a charter is read back and handed in, by `viff charter`, viff mcp's viff_charter and viff_charter_check, and the viff system's viff-charter-get and viff-charter-check alike: one way to read GET /charter's tree as the files that install it, to list what is installed, and to read a text of charters, so a task reads the charters as its owner would.
Package charterfile is how a charter is read back and handed in, by `viff charter`, viff mcp's viff_charter and viff_charter_check, and the viff system's viff-charter-get and viff-charter-check alike: one way to read GET /charter's tree as the files that install it, to list what is installed, and to read a text of charters, so a task reads the charters as its owner would.
client
Package client is how a program outside the viff instance talks to one: the operator API over HTTP, in the wire format, stamped with who is asking and which contract it speaks.
Package client is how a program outside the viff instance talks to one: the operator API over HTTP, in the wire format, stamped with who is asking and which contract it speaks.
codec
Package codec is the one place in viff that knows about serialization formats.
Package codec is the one place in viff that knows about serialization formats.
entity
Package entity is the viff instance as ONE DOCUMENT: a tony tree, addressed by kinded paths.
Package entity is the viff instance as ONE DOCUMENT: a tony tree, addressed by kinded paths.
entity/entitytest
Package entitytest opens entity stores for tests.
Package entitytest opens entity stores for tests.
exprs
Package exprs answers, without the values, what go-tony evaluates in a charter's strings: which expressions a string holds, and which names each one reads.
Package exprs answers, without the values, what go-tony evaluates in a charter's strings: which expressions a string holds, and which names each one reads.
idptest
Package idptest is an OpenID Connect identity provider for tests: discovery, a JWKS, and id_tokens minted with whatever claims a test asks for, signed with a key it generates.
Package idptest is an OpenID Connect identity provider for tests: discovery, a JWKS, and id_tokens minted with whatever claims a test asks for, signed with a key it generates.
io
io/github
Package github reflects the collaboration around a repository — its issues, pull requests, discussions, Actions runs and comments — into the `github:*` slice of the entity-viff.
Package github reflects the collaboration around a repository — its issues, pull requests, discussions, Actions runs and comments — into the `github:*` slice of the entity-viff.
io/iod
Package iod serves the viff-facing source contract over HTTP, so a Source can be a program somebody deploys rather than a library viff has to be built with.
Package iod serves the viff-facing source contract over HTTP, so a Source can be a program somebody deploys rather than a library viff has to be built with.
io/linear
Package linear reflects Linear teams — their issues and cycles — into the `linear:*` slice of the entity-viff.
Package linear reflects Linear teams — their issues and cycles — into the `linear:*` slice of the entity-viff.
io/slack
Package slack reflects a Slack workspace into the `slack:*` slice of the entity-viff.
Package slack reflects a Slack workspace into the `slack:*` slice of the entity-viff.
launch
Package launch is the wire form of an action: a declarative, serializable description of a task to launch when a trigger fires — the "action as data", not a Go closure.
Package launch is the wire form of an action: a declarative, serializable description of a task to launch when a trigger fires — the "action as data", not a Go closure.
mirror
Package mirror reflects a running Task's state into the entity-viff as a task:instance:<id> entity — one-way, index-not-warehouse.
Package mirror reflects a running Task's state into the entity-viff as a task:instance:<id> entity — one-way, index-not-warehouse.
runner
Package runner is the Runner API: the contract between viff and a runner, as the routes a runner serves and the requests and answers that are its own.
Package runner is the Runner API: the contract between viff and a runner, as the routes a runner serves and the requests and answers that are its own.
runner/client
Package client is viff's HTTP client of a runner: an httpRunner drives a runner at a base URL over the Runner API (package runner), so the engine runs a task wherever a runner serves it: beside viff, on another host, on k8s.
Package client is viff's HTTP client of a runner: an httpRunner drives a runner at a base URL over the Runner API (package runner), so the engine runs a task wherever a runner serves it: beside viff, on another host, on k8s.
runner/runnerd
Package runnerd hosts a runner: the tasks it runs, and what it offers.
Package runnerd hosts a runner: the tasks it runs, and what it offers.
runner/runnerd/apt
Package apt wraps the Debian package manager as the runner's install wrapper: it resolves a package's dependency closure against the signed index of the repositories the operator trusts, reads the fetch plan, fetches each package by the index's SHA256, extracts it with none of its own scripts run, and assembles a self-contained prefix for the cellar under the runpath discipline — `$ORIGIN/../lib` on each executable, `$ORIGIN` on each bundled library, so the prefix runs with no LD_LIBRARY_PATH and collides with nothing.
Package apt wraps the Debian package manager as the runner's install wrapper: it resolves a package's dependency closure against the signed index of the repositories the operator trusts, reads the fetch plan, fetches each package by the index's SHA256, extracts it with none of its own scripts run, and assembles a self-contained prefix for the cellar under the runpath discipline — `$ORIGIN/../lib` on each executable, `$ORIGIN` on each bundled library, so the prefix runs with no LD_LIBRARY_PATH and collides with nothing.
runner/runnerd/calltool
Package calltool is how a PROGRAM in a task's workspace calls the task's tools: `question-ask`, `git-push`, `git-fetch`, `github-create-pr`, `github-update-pr`, `github-list-prs`, `github-read-pr`, `github-comment-pr`, `github-reply-comment`, and whatever the runner offers next.
Package calltool is how a PROGRAM in a task's workspace calls the task's tools: `question-ask`, `git-push`, `git-fetch`, `github-create-pr`, `github-update-pr`, `github-list-prs`, `github-read-pr`, `github-comment-pr`, `github-reply-comment`, and whatever the runner offers next.
runner/runnerd/cellar
Package cellar keeps the prefixes a runner has installed: one directory per package and version, immutable once written, shared across tasks.
Package cellar keeps the prefixes a runner has installed: one directory per package and version, immutable once written, shared across tasks.
runner/runnerd/claude
Package claude is the claude agent: Anthropic's Claude Code as a viff task, with every command, every edit and every question it proposes decided by the task's autonomy and shown on the read plane.
Package claude is the claude agent: Anthropic's Claude Code as a viff task, with every command, every edit and every question it proposes decided by the task's autonomy and shown on the read plane.
runner/runnerd/codex
Package codex is the codex agent: OpenAI's Codex as a viff task, with every command and every patch it proposes decided by the task's autonomy and shown on the read plane.
Package codex is the codex agent: OpenAI's Codex as a viff task, with every command and every patch it proposes decided by the task's autonomy and shown on the read plane.
runner/runnerd/delivery
Package delivery is how a task's work leaves the sandbox: a push is a CAPABILITY the runner holds and the task may ask it to exercise, and the runner exercises it.
Package delivery is how a task's work leaves the sandbox: a push is a CAPABILITY the runner holds and the task may ask it to exercise, and the runner exercises it.
runner/runnerd/mcpclient
Package mcpclient is the runner's side of the mcp system: the client that calls remote MCP servers for a task.
Package mcpclient is the runner's side of the mcp system: the client that calls remote MCP servers for a task.
runner/runnerd/runnerdtest
Package runnerdtest serves a runner for a test: a builder's tasks behind the task-control contract, over HTTP, proving itself to a viff instance with a static token as a registered runner does.
Package runnerdtest serves a runner for a test: a builder's tasks behind the task-control contract, over HTTP, proving itself to a viff instance with a static token as a registered runner does.
runner/runnerd/secretstore
Package secretstore is the runner's secret store: a directory the deployment mounts, one file to a secret, the file's name the secret's name.
Package secretstore is the runner's secret store: a directory the deployment mounts, one file to a secret, the file's name the secret's name.
runner/runnerd/stock
Package stock is the runner viff ships, built on package runnerd: it offers the agents its configuration names under `agents:` (viff's own, package viff; codex; claude) and, where it has a `script:` section, scripts.
Package stock is the runner viff ships, built on package runnerd: it offers the agents its configuration names under `agents:` (viff's own, package viff; codex; claude) and, where it has a `script:` section, scripts.
runner/runnerd/viff
Package viff is the viff agent, viff's own: an LLM agent on top of the viff task loop, an OpenAI-compatible Chat Completions driver (served via Portkey), a filesystem executor confined to a working directory, under the launch's gates.
Package viff is the viff agent, viff's own: an LLM agent on top of the viff task loop, an OpenAI-compatible Chat Completions driver (served via Portkey), a filesystem executor confined to a working directory, under the launch's gates.
runner/runnerd/viff/modeltest
Package modeltest serves a SCRIPTED model on the wire the llm driver speaks (OpenAI-compatible Chat Completions, pkg/runner/runnerd/viff/llm.go), so a test outside package viff can run a real task — a real loop, real tools, a real answer contract — against a model whose every reply the test decides.
Package modeltest serves a SCRIPTED model on the wire the llm driver speaks (OpenAI-compatible Chat Completions, pkg/runner/runnerd/viff/llm.go), so a test outside package viff can run a real task — a real loop, real tools, a real answer contract — against a model whose every reply the test decides.
runner/runnerd/workspace
Package workspace is a task's git working directory: every repository a launch names, cloned off a mirror the runner keeps, side by side under one root, each on the task's own branch.
Package workspace is a task's git working directory: every repository a launch names, cloned off a mirror the runner keeps, side by side under one root, each on the task's own branch.
schedule
Package schedule is what a schedule is in the store: a record in viff's own half that holds its period, its phase, the instant the daemon is armed against, and its standing tick.
Package schedule is what a schedule is in the store: a record in viff's own half that holds its period, its phase, the instant the daemon is armed against, and its standing tick.
systems
Package systems is the systems a task acts on, each described once, as data: `git`, `github`, `git-issue`, `github-issue`, `linear-issue`, `slack`, `question`, and the three a runner intercepts inside a run, `files`, `commands` and `agent`.
Package systems is the systems a task acts on, each described once, as data: `git`, `github`, `git-issue`, `github-issue`, `linear-issue`, `slack`, `question`, and the three a runner intercepts inside a run, `files`, `commands` and `agent`.
systems/systemstest
Package systemstest is ceilings for tests.
Package systemstest is ceilings for tests.
task
Package task is the governed-task substrate for viff: a running unit of work whose actions pass an inter-action boundary, where the steps a gate names (StepOf) ask a person first, through a late-bound, substitutable resolver.
Package task is the governed-task substrate for viff: a running unit of work whose actions pass an inter-action boundary, where the steps a gate names (StepOf) ask a person first, through a late-bound, substitutable resolver.
task/tasktest
Package tasktest is a conformance suite for producers of task.Snapshot.
Package tasktest is a conformance suite for producers of task.Snapshot.
verbs
Package verbs is the viff verbs an agent is offered twice, defined once: by `viff mcp`, to an agent acting as you (viff_data), and by a runner's viff system, to a task acting as the person it runs for (viff-data-get).
Package verbs is the viff verbs an agent is offered twice, defined once: by `viff mcp`, to an agent acting as you (viff_data), and by a runner's viff system, to a task acting as the person it runs for (viff-data-get).

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL