# Share a workspace

> Let other people into a workspace, give each a role, and see who is there and where they point.

Source: https://hivemind.griiken.com/guide/multiplayer/

Work on one workspace with other people, each in their own Hivemind app. The workspace stays on your computer, or on your [host](https://hivemind.griiken.com/guide/host/).

<AgentPrompt description="Paste this into your coding agent to invite someone into one of your workspaces and let them in." page="multiplayer">{`Invite a person into one of my Hivemind workspaces from the terminal, and let them in when they ask.

1. Ask me which workspace folder to share, which role to give, how many people may use the link and for how long. Roles: \`view\` sees the canvas and terminals; \`edit\` also moves, adds and closes tiles; \`terminals\` also types into terminals. A link gives at most \`terminals\`. The \`agents\` role runs commands on my computer: give it only if I ask, once they are in, with \`hive people role <person> agents\`.
2. Check this computer can be reached from where they are: \`hive network show\`. If its first line ends with \`(built in: local)\`, only people on the same network can join. If they are elsewhere, tell me a network server comes first (the "Set up your own network server" page) and stop.
3. Make the link: \`hive share <folder> --role <role> --uses <n> --expires <time, e.g. 2d>\`. Give me the link to send them. They paste it under Join in their app, or run \`hive join '<link>'\`.
4. When I say they have used it, run \`hive people requests\` and show me who is asking. Let someone in only after I name them: \`hive people allow <number>\`. Never allow a request I have not confirmed.

At the end, run \`hive people list\` and show me who is in, at which role. Tell me \`hive people remove <name>\` disconnects someone and stops their link.`}</AgentPrompt>

Nothing is copied to a server. Traffic goes directly between your apps, or through a relay that cannot read it.

## Before you start [#before-you-start]

- People on your network need nothing else. People elsewhere need your own [network server](https://hivemind.griiken.com/guide/self-hosting/).
- Each guest has Hivemind installed.

## Roles [#roles]

A <Tooltip tip="What a person or a program may do: view, edit, terminals or agents." cta="Glossary" href="https://hivemind.griiken.com/guide/glossary/#role">role</Tooltip> says what each person may do.

Each role can do everything the roles above it can. People and programs get the same four roles.

| Role | For a person, the app says | For a token, **API access** says | Can |
|---|---|---|---|
| `view` | **Can view** | **View** | see the canvas, terminals, agents and their replies, files, diffs, issues and review comments |
| `edit` | **Can edit board** | **Edit** | also move, add and close tiles, press widgets, open a tool's tile |
| `terminals` | **Can use terminals** | **Use terminals** | also type into terminals (a person once given the keyboard) |
| `agents` | **Can drive agents** | **Drive agents** | also start, answer, message, put to sleep and close agents, which means running commands on your computer. A person gets it only while they are here, after a warning. |

## Let someone in [#let-someone-in]

<Tabs>
  <Tab title="In the app">
    1. In the workspace's window, open **Settings → Connect** and press **Connect**.
    2. Send them **Copy the link**.
    3. When they use it and the three words match, answer **Someone else** with a role.

    The full steps are in [Connect your devices](https://hivemind.griiken.com/guide/connect/).
  </Tab>
  <Tab title="In a terminal">
    1. Make an invite link, for several people if you like:

       ```bash
       hive share ~/work/api --role edit --uses 3 --expires 2d
       ```

    2. They paste it under **Join**, or run `hive join '<link>'`.
    3. Answer each request in the notice (**Allow** / **Deny**), or in a terminal:

       ```bash
       hive people requests
       hive people allow 1             # --role view to lower it
       ```

    To let anyone with a valid link in without asking, run `hive people rule invite`. `hive people rule ask` goes back.
  </Tab>
</Tabs>

## Check it worked [#check-it-worked]

The guest's face appears at the top right of your window. `hive people list` shows them, with their role.

## Who is there [#who-is-there]

| You see | Means |
|---|---|
| Faces, top right | Who else is in. A guest clicks one to follow that person's view. |
| Named pointers | Where each person points. Their selection is ringed in their colour. |
| The banner, as a guest | *You're in ⟨workspace⟩ on ⟨host⟩'s machine*, with **Leave**. |

To change a role or remove someone:

```bash
hive people list
hive people role ana terminals
hive people remove ana          # disconnects them; their link stops working
```

In the app, **People in this workspace** on **Settings → Connect** shows the same, with **Remove**.

## One keyboard per terminal [#one-keyboard-per-terminal]

A terminal's title bar says who has its keyboard.

1. Someone who **Can use terminals** presses **Ask for keyboard**.
2. The holder answers **Give** or **Not now**.

The owner takes it back with **Take back**, or ⌘⇧K / Ctrl+Shift+K in the terminal.

## If it didn't [#if-it-didnt]

| You see | Do |
|---|---|
| `This invite has expired or was used. Ask for a new one.` | Make a new invite. |
| The guest waits and nothing happens | Answer the request: a notice on your computer, or `hive people requests`. |
| The workspace is offline for guests | Your computer is asleep. Move the workspace to a [host](https://hivemind.griiken.com/guide/host/). |

More in [Troubleshooting](https://hivemind.griiken.com/guide/troubleshooting/).

## Related [#related]

- [API tokens](https://hivemind.griiken.com/guide/api-tokens/): programs get the same roles.
- [Trust, permissions and privacy](https://hivemind.griiken.com/guide/security-and-privacy/)

<LastValidated />
