Background
Design
Why archr exists, the ideas it is built on, and the decisions it keeps to.
The other pages say how to use archr. This one says why it is shaped the way it is.
The problem
Agents write good code and weak architecture. Each change looks fine on its own, and the project drifts.
Review tools work on a changeset, so they show the drift one diff at a time. Nothing shows the whole project, what it is meant to be, and where it has gone wrong. Once a project has already drifted, there is no diff left to review.
The shape
archr is a review tool without the changeset as the unit of work. You browse a whole project, read code, and attach notes anywhere. Agents read those notes, reply to them, and propose changes to them.
There are two kinds of note because there are two lifetimes. An annotation is part of the project and is committed. A comment is part of one review and is never committed.
Decisions archr keeps to
Few concepts, one key model.
Each key does one job everywhere: → ← one level in and out, ctrl+o is the only history, Enter is the main action, i is what is said about something.
a is always an annotation, c a comment, x close and d delete.
Vim keys are used where they help, not as a goal.
Always in a review. In git there is no mode without a review, so comments always have somewhere to go. Reviews are named by their spec, and closing one keeps it to read.
Opening writes nothing. Folders and files are made on the first save. The one exception is upgrading data an older archr saved.
Annotations are yours. Agents never edit them. In a review, a change to an annotation is shown on the code it is about.
archr's guide holds archr's facts only.
A project's ways of working go in its own .archr/agent.md.
The terminal's own colours. archr uses the 16-colour palette and the background the terminal reports, so it follows your theme.
No work done early and thrown away. Files are read when shown, diffs are parsed once, and answers are kept until what they come from changes.
Anchoring
A note records the commit it was written against and its lines in that commit. Annotations are prose tied to paths, not to symbols, because symbols are more fragile under heavy refactoring.
Nothing moves a note yet when its file changes. The plan is to map its lines through the git diff, with the quoted text as the fallback for uncommitted work.
Where it is going
The aim is a helicopter ride over a project: see the architecture, zoom into one part, bring your mental model of it up to date while the rest stays in fog, and repeat. This is a vocabulary for the idea, not something built.
- Area: a concept such as "caching", which can span files in several directories.
- Baseline: the commit an area was last understood at. Reviewing the area moves its baseline forward.
- Fog: an area is unexplored, clear, or fogged when something changed since its baseline.
- Ahead-of-time design: an area can exist before its code, holding only what is intended.
Four ways of working follow from it.
- Initialise: an agent drafts a map of the code as it is, you write what it is meant to be, and the gap becomes the first comments.
- Review: a diff, a commit or a range, with whole files and annotations in view.
- Drift: what changed since you last read each file, and annotations whose code changed underneath them.
- Upkeep: after a change, an agent proposes updates to annotations as comments.
Review is built.
What is planned next is in TODO.md in the repository.
What it is built with
- Go, in one package.
- Bubble Tea, Bubbles and Lip Gloss for the interface.
- Lexis, from Quire, for highlighting: its tokens are styled per line, so notes can sit between source lines.
- fsnotify, to reload when notes or reviewed files change on disk.