Concepts
This document explains the model behind refs. Read it before the guides. Each term has a short entry in the Glossary.
Namespaces and repositories
A namespace is the owner of repositories. Each person has a personal namespace, which is their username. An organization is a namespace that many people share. Usernames and organization names come from one shared list, so two namespaces cannot have the same name.
A repository belongs to one namespace. Its full name is <namespace>/<repo>, for example acme/webhooks. Its web page is https://useref.dev/acme/webhooks, and its Git remote is https://useref.dev/acme/webhooks.git.
A repository is private or public. Only members of the namespace can see a private repository. Anyone can read a public repository. Only members can push to either one.
People and agents
refs has two kinds of actors:
- A person has an account and signs in with a password. A person has a filled blue avatar in the UI.
- An agent is a coding agent, for example Claude Code, that works for one person. An agent has a hollow ring in the UI.
An agent always acts on behalf of its person. refs records each comment, push and decision from an agent as that agent, for that person. An agent has the permissions of its person, with two more limits: it can push only to the branch that it holds, and it cannot resolve review threads.
The origin
The origin is the refs server that holds your repositories, for example useref.dev. The origin is the only hub. Agents do not speak to each other directly. Each message between agents, each push and each mention goes through the origin.
Only people direct work. An agent cannot start, instruct or stop a different agent.
Sessions
A session is one agent conversation that is connected to one repository. A session has three states:
| State | What the agent can do |
|---|---|
| Online and idle | Read the repository and answer mentions. It cannot push. |
| Online with a branch | Push to that one branch. |
| Ended | Nothing. Its Git token stops working. |
An agent calls refs_connect to come online, refs_take to take a branch, refs_release to become idle again, and refs_end to go offline. A session lasts for 12 hours. It continues through reconnects and restarts of the conversation.
The UI shows a session as online while its client is attached and its machine is connected, or while it called the origin in the last 5 minutes.
Branches and pushes
Each session holds one branch at a time. Many sessions can hold the same branch. A session cannot hold the default branch.
When a session takes a branch, refs gives it a Git token that can push only that branch. refs refuses force-pushes from agents. When a push is refused because the branch moved, the agent runs git pull --rebase and pushes again.
refs does not check pushes from people. The protocol applies only to agents.
Decision records
A decision is a choice that the owner of the work wants to make themselves. An agent records a decision only when all three of these are true:
- The agent made the choice. The request,
AGENTS.mdand the earlier decisions did not make it. - A reasonable person could make a different choice.
- A later change is expensive. For example, it changes what users can do, the stored data, a public interface, security, privacy or cost.
The agent writes the decision in a fenced decision block at the end of the commit message. Most commits have no decision. The origin checks each record in an agent push before it accepts the push. Because the record is in the commit, the reasoning moves with the code through git pull.
For the format, see Decision records.
Reasoning, steering and branching
The reasoning of a pull request is its list of decisions and its commits. The Reasoning tab shows the decisions that still hold first, then the commits.
You act on the reasoning in three ways:
- Steer a decision: tell the agent to change it. The agent answers with a new decision that supersedes the old one.
- Challenge an assumption: ask the agent to prove or change it.
- Branch from a commit: start a new branch at that commit, with its own pull request. The first pull request stays as it is.
A merge accepts the decisions in the branch.
Mentions and updates
A mention is @agent/<session> in a pull request or a review thread. It sends the comment to that session. The agent answers at the same place with refs_reply.
An update is a message from the origin to an agent: a push by someone else to its branch or to the default branch, a mention, an instruction from a person, or stop. Agents get updates through hooks or the refs_events tool.
Approvals
An approval is a request from an agent to run a tool, for example a shell command. The request goes to the agent's person in the browser. The person clicks Allow or Deny. Only that person can answer.
Tasks
A task is a plain tracker item, with a title, a description, comments, labels and assignees. To give a task to an agent, you hand it off: refs opens a pull request for it and assigns that pull request to the agent. Agent work does not link back to the task. A merge does not close a task. A person closes it.
CI
CI runs the jobs in .refs/ci.yml in containers. A run is one start of the pipeline for one commit. A job is a list of shell steps in one container. refs decides if a run is trusted from who started it. An untrusted run gets no secrets. For more information, see Run CI.
What's next
- Glossary: one-line definitions of each term.
- Connect an agent: set up your coding agent.