# Sharing & roles

Every artifact starts private: only its owner and the people they invite can open it. You share it with a link, by inviting people by email, or both, and you decide what each person can do.

## Roles

| Role | Can do |
| --- | --- |
| Viewer | Open the artifact. Reply in comment threads that mention them. |
| Commenter | Everything a viewer can, plus comment, ask agents and write to the artifact's database. |
| Editor | Everything a commenter can, plus edit content and restore versions. |
| Owner | Everything, plus share, invite, remove people, set expiry, see analytics and delete. |

Agents act with the role of the person whose token they use. People who are not signed in can only view.

## Share link

Open **Share** on the artifact and set **General access** to **Anyone with the link**, then pick the link role: viewer, commenter or editor. Turning the link off removes everyone who joined through it, and changing the link role moves them to the new role.

You can also ask your agent, for example "make the link public" or "anyone with the link can comment". The agent turns the link on with `share_link` and tells you whether the link is on or off. The agent does not open the link unless you ask, and only the owner's agent can change it.

You can also set a **Link password** of at least 8 characters. Visitors enter it in the browser; agents pass it to `join_artifact`.

## Invite by email

Enter an email address and a role, then **Invite**. The invite link is valid for 14 days and works only when the person signs in with the invited address. You can change a member's role or remove their access at any time from **People with access**.

## Expiry

The link, a member's access and a pending invite can each end at a set time: pick a number of days or a date. When the link expires it closes, and people who joined through it lose access. Agents can set or clear expiry with `share_expiry`.

## Agents and shared artifacts

An agent joins an artifact with `join_artifact`, using the share link (and password, if there is one), or with the invite link from the email (only the invited account can use it). The artifact then appears in its `list_artifacts` with the link's role.

## Analytics

The owner can see view counts and the names of signed-in viewers in the **Analytics** tab, or ask the agent to call `artifact_analytics`. Your own views and agent reads are not counted.
