> ## Documentation Index
> Fetch the complete documentation index at: https://docs.reasonos.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Code Editing

> The hands-on guide to working with code in the ReasonOS editor: navigating files, editing, searching, running targets, terminals, and reviewing changes on your branch.

This page is the day-to-day guide to the **Code** view — opening and editing
files, searching, running builds and tests, and reviewing what changed on your
branch. For how the editor connects to a branch node and what the other views
(Graph, Atlas, Tasks, Jobs) are for, start with the
[editor overview](/editor/overview).

Everything described here happens on the **branch node**: the file tree,
searches, terminals, git operations, and builds all run on the server that
owns your branch's workspace — not on your machine.

## Opening files

### The file explorer

The left sidebar shows the workspace file tree. It streams in as the node
scans the workspace, loads folder contents lazily as you expand them, and
collapses single-child folder chains into one row
(`src / main / java / com / example`).

From the explorer you can:

* **Open a file** — click it (it opens in the focused editor pane).
* **Create files and folders** — the header buttons create at the workspace
  root; right-click a folder for **New File** / **New Folder** inside it.
* **Rename, copy, cut, paste, delete** — all in the right-click context menu.
* **Move files** — drag and drop onto a folder, or onto empty space to move
  to the root. Multi-select with Cmd/Ctrl+click first to move several at once.
* **See git status at a glance** — changed files get a color and a status
  letter (M modified, A added, D deleted, R renamed, U untracked); folders
  containing changes are tinted too. A revert button on modified files
  discards their changes (with confirmation).
* **See who's there** — files a teammate has open carry their presence
  marker (see [Collaboration](/editor/collaboration)).

Toggle the explorer with **Cmd/Ctrl+B**, from the top bar, or from the status
bar. Drag its edge to resize it.

### Quick open

**Cmd/Ctrl+P** opens the fuzzy file finder. It shows results before you
finish typing, highlights the matched characters, and shows each file's
directory so same-named files are distinguishable. Arrow keys or Tab move the
selection; Enter opens; Esc closes. The footer shows how many files were
searched and how fast.

<Note>
  **Cmd/Ctrl+Shift+P** currently opens the same file finder — there is no
  command palette yet. Every action lives in the top bar, the icon rail, the
  status bar, or a keyboard shortcut.
</Note>

## Searching the workspace

The editor has three ways to search, all served by the branch node:

**Find in file — Cmd/Ctrl+F.** A find bar over the active editor with match
counts, case-sensitive / whole-word / regex toggles, and an expandable
replace row (Replace / Replace All). Enter jumps to the next match,
Shift+Enter to the previous, Esc closes.

**Search in files — Cmd/Ctrl+Shift+F.** Full-content search across the
workspace with **streaming results** — matches appear as they're found while
the node scans. It searches live as you type (Enter forces an immediate
search), supports case / whole-word / regex, and takes include and exclude
globs (`*.ts, *.tsx` / `node_modules, dist`) under **More Options**. Results
group by file with line numbers and highlighted context; clicking a match
opens the file at that line.

**Semantic search — Cmd/Ctrl+Shift+S.** Plain-language search over the
branch's [Atlas](/editor/atlas) index — describe what you're looking for
("where are refresh tokens validated") and get ranked symbol results with
relevance scores and exact locations, filterable by package. The panel shows
the index status (and a re-index action), and a second tab opens the
generated **wiki** view of the codebase. See [Atlas](/editor/atlas) for how
the index is built and kept fresh.

## The editing surface

The editor opens files in tabs above a code editor with line numbers, syntax
highlighting, code folding, bracket matching, auto-closing brackets, multiple
selections, and rectangular (column) selection. Dedicated highlighting covers
JavaScript/TypeScript (including JSX/TSX), HTML, CSS, JSON, Markdown, Python,
SQL, C/C++, and `.rbs` build files; other text formats open as plain
editable text. Word wrap is a toggle in Settings → Editor.

Binary formats (images and other non-text files) can't be edited — the
editor shows a notice instead of file content.

### Tabs and split view

* Click a tab to switch files; drag tabs to reorder them.
* Close with the × button or a **middle-click**.
* A dot on the tab means unsaved changes; presence dots show teammates who
  have the file open.

**Cmd/Ctrl+\\** splits the editor into two side-by-side panes (also available
from the top bar and status bar). Each pane has its own tabs; a file lives in
exactly one pane — opening a file that's already open in the other pane
focuses it there instead of duplicating it. Un-splitting merges the second
pane's tabs back into the first.

### Saving

**Cmd/Ctrl+S** saves the active file (there's also a Save button in the
editor's status row while a file has unsaved changes). Saving is explicit —
there is no auto-save — but the workspace is live: files changed outside
your editor (by the AI agent, a terminal command, or a build) are picked up
by the node's file watcher and **reload automatically** in open tabs. When
collaborative editing is on, saving asks the node to persist the shared
document, and every connected client's unsaved indicator clears together.

### Language intelligence, inline

When the file's language has a running language server you get, directly in
the editor:

* **Completions** as you type
* **Hover documentation** on symbols
* **Diagnostics** rendered inline, with per-file error and warning counts in
  the editor's status row

The status row's **LSP** indicator shows the connection state. If a server
isn't available it becomes a retry button; if the language's tooling hasn't
been resolved yet, it tells you to run `rbs sync`. See
[Language Intelligence](/editor/language-intelligence) for how servers are
provisioned and configured — there's nothing to install or set up.

### AI completions

Independent of the language server, the editor offers AI ghost-text
completions: a suggestion appears inline as you pause, and **Tab** accepts
it. Toggle it from the **✦ AI** control in the status bar or in Settings →
Editor. For the full AI agent — chat, multi-file edits, task runs — open the
**AI** tool in the right pane (see the [agent docs](/agents/overview)).

### The git gutter

In a git repository, the editor gutter marks added, modified, and deleted
lines against HEAD. Click a marker to open an **inline diff popup** for that
hunk, with a one-click **Revert** — no confirmation, and Cmd/Ctrl+Z undoes
it in the buffer.

### The editor status row

Under the editor, each pane shows the active file's path, its diagnostic
counts, the LSP indicator, the AI completion badge, the **Collab** toggle
(opt-in co-editing with live peer count — see
[Collaboration](/editor/collaboration)), the file encoding, and the Save
button when there are unsaved changes.

<Note>
  Two things the editing surface does not have yet: a **format document**
  command (formatting runs through your build's own tooling, from a terminal)
  and a **debugger**. Keyboard shortcuts are fixed and not yet remappable.
</Note>

## Running builds, tests, and targets

### Terminals

The terminal dock (**Cmd/Ctrl+\`**, or the terminal icon in the rail / status
bar) opens real shells running **on the branch node**, in the workspace
directory. This is where day-to-day build commands run:

```bash theme={null}
rbs build //api:server        # build a target
rbs test //api/...            # run tests
rbs run client:dev            # run a binary / dev server
```

Terminal features:

* **Multiple sessions** in tabs — the + button adds one; double-click a tab
  to rename it; middle-click (or right-click) closes it.
* **^C, Clear, Reconnect** buttons act on the active session — you can
  interrupt a process on the node even from another machine.
* Drag the dock's top edge to resize it; each tab shows a connection
  indicator.
* **Port detection** — when a process in a terminal starts listening on a
  port, the node registers a proxy and the editor opens the URL in the
  built-in **Browser** tool automatically.

Because terminals run on the node, everyone connected to the branch shares
the same processes — a dev server one person starts is reachable by all
(see [Previewing your app](/editor/overview#previewing-your-app)).

### The built-in browser

The **Browser** tool (right pane, opened automatically on port detection or
from the Tools menu) is for previewing what you're running: an address bar,
back/forward/refresh, a fullscreen toggle, and a list of the node's currently
proxied ports to jump between. External (non-local) sites load only if you
opt in to routing them through the node's proxy.

### The Graph view

The **Graph** view (top bar) renders the workspace's build graph — targets,
their dependencies, external packages, infrastructure, and CI nodes — with
filters by type, kind, and package, two layout directions, and a detail panel
showing a selected target's sources, outputs, and attributes. It's the
fastest way to answer "what depends on this target?" before you change it.

<Note>
  The Graph view is an inspector — it doesn't launch builds. Builds and tests
  run from a terminal, from the AI agent, or (for cluster workloads) from the
  Jobs view.
</Note>

### The Jobs view

The **Jobs** view submits work to the RBS cluster and appears when the branch
node has a cluster configured. Submit a **command**, a **script**, or a
workspace **target** (any target marked `schedulable = True` in its
`BUILD.rbs` — the cluster builds and runs it via `rbs run`, prefilling the
target's declared resources). Each job takes resource requests — GPUs, CPUs,
memory, a time limit, a queue, and a priority.

The panel lists active and historical jobs with state, duration, and
resources; selecting a job **streams its logs live**, and running jobs can be
cancelled or re-run with the same parameters.

## Viewing changes on the branch

### The Source Control panel

**Cmd/Ctrl+Shift+G** (or the branch icon in the rail, which shows a
changed-files badge) opens the Source Control panel:

* Files grouped into **Staged Changes**, **Changes**, and **Untracked**,
  each with insertion/deletion counts and status badges.
* **Stage / unstage** per file; **discard** requires a second click to
  confirm.
* Clicking a file opens its **diff** — hunk by hunk, with old/new line
  numbers — and also opens the file in the editor.
* The panel shows the current branch and survives disconnects: if the node
  becomes unreachable it says so and resumes automatically on reconnect.

The same information follows you around the editor: status colors in the
file explorer and tabs, and change markers in the gutter.

<Note>
  The panel stages, diffs, and reverts — it doesn't commit. Commit from a node
  terminal, or use the branch's [checkpoints](/workflow/checkpoints) and
  [stack workflow](/workflow/stacks), which manage commits for you.
</Note>

### Branches and the stack

The top bar shows the branch this node has checked out. The branch menu
lists and filters all branches — but picking one doesn't run a checkout:
**it navigates you to that branch's own workspace**, served by that branch's
node ([one server per branch](/editor/overview#one-server-per-branch)). When
the workspace's stack has branches beyond the trunk, a stack control appears
next to it for moving between stacked branches and creating new ones (see
[Stacks](/workflow/stacks)). If the node's actual checkout ever diverges
from the branch in your URL — say, a CLI stack operation moved it — a
banner appears offering to take you to the right workspace.

## Notifications

The bell in the top bar is the notification center, fed live by the branch
node: task events (created, state changes, comments, questions, lifecycle)
and agent session events (started, completed, failed). Unread count shows on
the bell; clicking a notification deep-links to its subject — a task
notification opens the Tasks board on that card, an agent notification opens
that chat session in the AI pane. **Mark all read** clears the badge.

## Settings and your account

### Editor settings

The gear icon in the rail (or **Settings** in the profile menu) opens the
editor's settings:

* **AI Agent** — choose the agent engine, the model (grouped by provider),
  max tokens, temperature, max steps, extended thinking and its budget, a
  cheaper "explore" model for read-only work, and per-provider API keys.
* **Editor** — AI autocomplete and word wrap toggles.
* **Environment** — the resolved environment for this workspace, read from
  the branch node itself.

The status bar carries quick toggles for the AI completion, the icon rail,
the explorer, split view, search, the git panel, and the terminal.

### Account and workspace settings

The profile button (top right) shows who you're signed in as and which
workspace checkout you're editing. Everything organization-level lives
outside the editor, in the workspace's **Settings** app (reachable at
`/settings` on your workspace address): workspace general settings and
people, organization details, roles, teams, compute quotas, and Git & SSH
keys. Your personal profile lives at `/usr/<your-handle>`. Signing in,
sign-up, invitations, and password resets are handled by the auth app at
`/auth`. The **← Projects** button in the top bar takes you back to the
project hub.

## Keyboard shortcuts

| Shortcut            | Action                              |
| ------------------- | ----------------------------------- |
| Cmd/Ctrl+P          | Quick open (fuzzy file finder)      |
| Cmd/Ctrl+F          | Find (and replace) in file          |
| Cmd/Ctrl+Shift+F    | Search in files                     |
| Cmd/Ctrl+Shift+S    | Semantic search                     |
| Cmd/Ctrl+Shift+G    | Source Control panel                |
| Cmd/Ctrl+B          | Toggle file explorer                |
| Cmd/Ctrl+\\         | Toggle split editor                 |
| Cmd/Ctrl+\`         | Toggle terminal                     |
| Cmd/Ctrl+S          | Save active file                    |
| Tab                 | Accept AI completion                |
| Enter / Shift+Enter | Next / previous match (in find)     |
| Esc                 | Close find, quick open, or dialogs  |
| Middle-click a tab  | Close it (editor and terminal tabs) |
