affectUI › Components › Agents

Repo Map

A codebase as a treemap with coding agents working on it – every folder a group, every file a tile as large as its lines, in Context Map's tiles. Each agent is its pixel mark hopping from file to file; a file it edits fills with its color from the bottom up with a sheen running over it and keeps the color once it moves on, so the map fills as the work goes on. A file it only reads gets a dashed edge, two agents in one file blink orange. Point at a file for its path, lines and who changed what; click an agent to keep its files clear.

Part of affectUI Pro. Install: npx shadcn@latest add https://www.affectui.com/r/repo-map.json · Import from @/components/ui/repo-map

When to use

  • Coding agents working on one codebase – which files each one is in, what it changed and where they get in each other's way
  • A run's footprint at a glance: the map fills with each agent's color as it works
  • Spotting two agents editing the same file before their changes collide

When not to use

  • What fills one agent's context window – use Context Map
  • A branch's commits one after another – use Commit Trail
  • Changes as lines of code – use a diff view such as Diff Timeline

Usage

import { RepoMap, type RepoAgent, type RepoFile } from "@/components/ui/repo-map";

const files: RepoFile[] = [
  { path: "src/lib/auth.ts", lines: 320, edits: [{ agent: "auth", added: 64, removed: 12 }] },
  { path: "src/lib/session.ts", lines: 240 },
  { path: "src/components/LoginForm.tsx", lines: 210 },
  { path: "tests/auth.test.ts", lines: 230 },
];

const agents: RepoAgent[] = [
  { id: "auth", name: "Auth agent", file: "src/lib/session.ts", action: "edit", task: "Adding token refresh" },
  { id: "tests", name: "Test agent", file: "tests/auth.test.ts", action: "read" },
];

export function Workspace() {
  return <RepoMap title="acme/web" branch="feat/token-refresh" files={files} agents={agents} />;
}

Props

NameTypeDefaultDescription
filesRepoFile[]Every file – { path, lines, edits? }. The folder in its path groups it, its lines are its area; a path given twice shows once
edits{ agent, added?, removed? }[]Per file, oldest first – who changed it and how much. The last one's agent tints the file; the tile shows +added −removed
agentsRepoAgent[]The agents – { id, name, color?, file?, action?, task? }. Each is its pixel mark in a color of the palette (blue when it works alone), sitting on the file it is at
action"edit" | "read"Per agent – edit (default) fills the file with its color and runs a sheen over it; read gives it a dashed edge. Two agents editing one file make it blink orange
title / branchstringThe repo's name and its branch, in the bar
depthnumberHow many folder levels group the files – 2 by default (src/components, src/lib …)
classNamestringExtra class on the root – set the color variables on it, e.g. --ui-rpm-height

Keyboard

  • Tab: The agents in the bar, then one stop for the map
  • ← / → / ↑ / ↓: Walk the files, folder by folder – each shows its card
  • Home / End: First or last file
  • Enter / Space: On an agent: keeps its files clear and fades the rest
  • Esc: Hides the file's card, or clears the agent you look at

Accessibility

  • Every file reads its path, its lines, who is in it and who changed what – "src/lib/session.ts, 240 lines, conflict, Auth agent and UI agent editing"
  • The agents in the bar are toggle buttons (aria-pressed) that say how many files each touched
  • A polite live region says when an agent moves to another file
  • Focus rings show for the keyboard only (:focus-visible), inside the tiles so the map never cuts them

Responsive

  • The map keeps its height and lays the files out again for any width – a file's name and its count show while there's room
  • Narrow: a taller map, the count on its own line, the agents wrap
  • Long paths and names end in … with the full text on hover and in the file's card
  • Dark mode built in: switches when an ancestor (usually <html>) has the class dark or data-theme="dark"

Requirements

  • React 19

Related

  • Context Map – What fills an agent's context window, as a living treemap – system prompt, tools, memory, every file, the chat and tool results as tiles that glide as it grows, the free space dashed, and compaction squeezing old turns into a summary
  • Agent Cursors – Agents working in a document like teammates in a multiplayer editor – live pointers with names, suggestions typed letter by letter, images they resize, code they fix and comments beside the page
  • Conflict Radar – Agents working on their own branches at once, and where they get in each other's way – a row per file and a column per agent, a line between the agents that changed the same lines, each agent's way in one sentence to pick from, and Merge once all are settled
  • Commit Trail – One line per commit with a tinted check on a blue trail, the message, a colored tag for the kind of change and how long ago; open a commit for who wrote it (agents with their pixel mark), the hash and what changed. A merge folds the commits it brought in, which bend off the trail as small dots. While an agent commits its marker turns and "Committing" shimmers, and when it lands the check draws itself