# Use Computers

> Use a browser terminal with port previews and a web code editor for your Agent's files. On Oyster, they connect to a Computer in a cloud container.

Use Shed for a browser terminal with port previews and Inkcap as a web code
editor for the same Computer. On Oyster, that Computer is a Linux workspace in a
Cloudflare Container.

A [Computer](/concepts/computer/) holds files and provides a place to run work.
In Grove, a new Agent defaults to the newest existing Computer, or **No
Computer** when none exists. Under **More options**, choose **New Computer** for
separate files or an existing Computer to share its files. Home is the Agent's
default attached Computer. Choose that Computer in an App to work on the same
files as the Agent. A Computer's name is not its identity, so check the
selection before saving or running anything.

If Home is detached, the Agent does not silently use another Computer. Attach an
appropriate Computer and choose `/home <name>` yourself in the Agent's
conversation. The choice is shared across that Agent's Sessions and takes effect
on later runs; an active run keeps its captured target and fails if access is
revoked.

## Open and edit a file

1. Open **Inkcap** from your Team's App menu.
2. Select the Agent's Home Computer in the status bar at the bottom-left of
   Inkcap's window.
3. Allow the file access you need, then choose a file in the explorer. On a
   narrow screen, choose **Open file explorer** first.
4. Edit a text file and choose **Save**, or press **Ctrl+S** (**⌘S** on macOS).
   Wait for **Saved**. Edits you make while a save is running remain unsaved
   until you save them too.

Inkcap keeps your draft in the open tab if a read or save fails. A tab belongs
to the Computer it came from: if you switch Computers, select the original one
before saving or reloading that tab. Host **Back** returns to a previously
visited tab without discarding its edits.

### When the file changes elsewhere

An Agent, another App or another person can edit the same Computer file. On
Save, Inkcap checks that the file still matches the text you opened or last
saved. If it differs, the save is refused and Inkcap shows **This file changed
on the Computer since you opened it**. Your draft stays open and unsaved; the
Computer file is not overwritten.

Choose how to resolve it:

- **Compare** shows the Computer version and your draft. Removed lines come from
  the Computer; added lines are your edits. Comparing writes nothing. Choose
  **Back to editing** to return to your draft.
- **Keep mine** explicitly overwrites the Computer file with your draft.
- **Reload theirs** replaces your draft with the Computer file's current text,
  discarding your unsaved edits.

Compare ignores an initial UTF-8 byte-order mark and differences between line
endings so those alone do not highlight every line. This affects the display
only, not the saved text or the check used by Save. Compare is a view of the
versions, not an automatic merge.

For a clean tab, **Reload file** reads the latest saved contents. Ordinary
reload is disabled while the tab has unsaved edits or a save is running. During
a conflict, use the choices above.

### Create a file or save another copy

Choose **New draft**, write your text, then **Save file as**. Enter the Computer
path and choose **Save As**. You can also use **Save file as** on an existing
text tab. An absolute path starts with `/`; a relative path uses the selected
explorer directory, or the open file's directory when there is no selection. For
a new draft without either, it uses the App's current project directory.

After a successful Computer write, the tab adopts the path and the explorer
refreshes. A failed write keeps your edits and the old path. **Save As to a
different existing path replaces that file's contents**; choose an unused path
to keep both copies. Use ordinary **Save** when updating the current file with
conflict protection.

To create an empty file or folder directly, open an explorer item's context menu
and choose **New file** or **New folder**. Enter a single name; the dialog shows
the destination directory and reports an existing name. Rename and delete
controls are not available in Inkcap. Use Shed or an Agent for those operations.

### File types and unsaved work

PNG, JPEG, GIF, WebP, SVG and AVIF files open as image previews. MP4 and WebM
files open as videos. Markdown files have a rendered preview as well as an
editor. Other files open as UTF-8 text; invalid UTF-8 is refused without
replacing an existing tab.

You can write a local draft without Computer access and use **Download** to save
it through your browser. **Save As** saves to the selected Computer when
connected; without a connection, it starts a browser download. Closing a dirty
tab or closing the App through its host offers save, discard and cancel choices.
Keep the tab open until you have saved or downloaded work you want to keep.

## Run a command

Open **Shed**, select the Computer, and grant **Run commands** access. Its
terminal runs on that Computer's hosted execution backend. It does not run on
your browser or in your laptop's current folder.

Illustrative: these read-only shell commands need a running Computer and an
admitted Shed terminal. They do not start an Agent or a model request.

```sh
pwd
ls
```

Shed shows connection failures and lets you retry. An empty process list is
different from a failed or unavailable process read.

## Long commands and background processes

A command you wait for can run for up to **ten minutes**. For anything longer,
or anything you do not want to wait on, start it as a background process. An
Agent does this with `start_process`: it returns an id at once, the command runs
detached with no run-time limit, and the Agent reads progress with
`process_logs`, waits for the end with `wait_process` (it returns early with
`timedOut` set, so the Agent calls again to keep waiting), and stops it with
`kill_process`. Output is kept, bounded to the last 200 lines, and stays
readable after the process ends or the Computer sleeps.

A background process lives only while its Computer is awake. If the Computer
goes to sleep while it runs, the process ends and its record says it ended on
idle sleep; turn on Keep awake for work that must continue. Start a process
again after the Computer wakes if you still need it.

## Processes and port previews

The **Processes** panel lists retained commands reported by the selected
Computer, including background processes an Agent started, with their state,
exit code and why one ended. Refresh it to check current state. Stop a running
process with its Stop action. A process whose state is uncertain needs a fresh
check before you assume it is running or finished.

For a web server, enter its listening port in **Exposed ports** and choose
**Expose**. Exposing a port does not start a server. Port previews require
deployment support as well as permission. Shed reports when previews are not
configured instead of presenting an empty list as a working connection.

The terminal and Computer control ports are reserved. Use an application port,
and remove its exposure when you no longer need it. A preview does not make your
whole Computer or filesystem public.

## Sleep and recovery

Hosted execution starts on demand and can sleep when idle. Saved Computer files
and running processes have different lifetimes. A process does not survive
sleep. Check the process list and restart a needed server after waking the
Computer. Keep your own backup or version-controlled copy of important work.

If an operation fails, check the selected Computer, App permissions and the
connection before retrying. Inspect partial output or changed files before
repeating a command with side effects. Buying credit and granting App access are
separate steps. See [billing](/account/billing/).

You can also [attach a local folder](/guides/attach-a-local-folder/). Files sync
both ways, and eligible commands can run on your machine while it is connected.
Shed's terminal, process list and port previews still use a hosted backend.
