---
title: Projects
summary: What a project is, how one item inside an extension is identified when a project links to it (ProjectItem), how an extension's things become addable today through Search, and what opening one does.
audience: both
stability: experimental
since: protocol 1
---

# Projects

A project is one person's folder: some of their assistant chats, plus things from extensions that belong with
them (a note, a task list, a repository, a customer in the CRM). Everything connected to the project shows on its
page, reached from **Projects** in the sidebar. Projects are per person, like chats: nobody else on the server sees
yours, and a project is never shared with the team. What a project links to is usually the team's data, though, and
a link grants nothing: opening it goes through your extension's own view and access rules, as any other visit does.

A project doesn't copy anything out of an extension. It keeps a link to the item: enough to show it in a list and
to open it in the extension's view. Your extension stays the owner of its data; when the item changes or goes away,
your view is where that shows.

## `ProjectItem`

```ts
interface ProjectItem {
  extension: string;
  route?: string;
  title: string;
  subtitle?: string;
  icon?: string;
  collection?: string;
  recordId?: string;
}
```

One thing inside an extension that a project links to, as the host keeps it. Defined in
`packages/sdk/src/index.ts`.

- **`extension`**: the extension the item belongs to, its manifest `id`. Set by the host to the extension the item
  came from; an extension never chooses it. Items the host owns itself may later name one of the ids reserved for SpaceMIX itself
  (`registry::CORE_NAMESPACES` in `apps/desktop/src-tauri/src/registry.rs`), never an id an extension can be installed
  under, or carry a new optional field; either is additive.
- **`route`**: where the item opens in the extension's view, as a [route](host/view.md#routes). Without it, the
  view opens where it was.
- **`title`**: one line of plain text naming the item, as `SearchResult.title`. Always rendered as text, never as
  markup.
- **`subtitle`**: a second, quieter line of plain text, as `SearchResult.subtitle`.
- **`icon`**: a Lucide icon name, like the manifest's `icon`. Defaults to the extension's icon.
- **`collection`**: when the item is a record of one of the extension's collections, that collection's `name`.
- **`recordId`**: with `collection`, the record's id.

The host copies `title`, `subtitle` and `icon` when the item is added and shows them from then on; they don't
follow later changes to the item. It trims `title`, `subtitle`, `collection` and `recordId` and cuts them to 200
characters (an empty `title` becomes `Untitled`), cuts `route` to 2000, drops an `icon` that doesn't look like a
Lucide name (1 to 64 lowercase letters, digits and `-`), and holds at most 200 items per project. A project holds an item once: two items of the same `extension` are the
same when they have the same `collection` and `recordId`, or else the same `route`, or (with neither) the same
`title`.

## How your things become addable

Today a person adds an item to a project from the project's page, by searching: **Add from an extension** runs the
same search as the app's Search, and the result they pick becomes a `ProjectItem`. Whatever makes your extension
findable makes its things addable; there is nothing more to declare. See
[Being found in Search](../guide/search.md).

- **Collections**: give each collection a `route` with `{id}` for the record's id. A found record becomes an item
  with its `route`, its `collection` and its `recordId`, but only when your extension has no `search` action: with
  one, only the action is asked, and its results have neither. Without a `route` a record can still be added, but
  it opens your view where it was.
- **A search action**: when your data lives elsewhere, declare a `search` action. Each `SearchResult` it returns
  becomes an item with the result's `title`, `subtitle`, `route` and `icon`; such items have no `collection` or
  `recordId`.

So give every result a `route` your view understands, and keep routes stable: a project keeps the route it was
given, possibly for a long time. A route naming something that's gone should show the nearest sensible page (see
[Routes](host/view.md#routes)).

### The assistant

The assistant can add items too, with its `project_add_item` tool, when the person approves. For a record of one of
your collections it gives the collection's `name` and the record's id; the host checks the record exists, and the
record's title (its first search field, or else its first string field) and the collection's `route` are the
defaults when the model gives none. A collection whose `operations` offer neither `get` nor `list` is refused. For
anything else the model supplies the `title` and the `route` itself. Either way it may also give a `subtitle` and
an `icon`. So a route in a project may come from the model, for a record as much as for anything else, not only
from your Search results: make sure a route naming something that isn't there lands on a sensible page.

In a chat inside a project, the assistant sees the project's items and reads a linked record through
`<namespace>_<collection>_get`, the read tool a collection gets unless its `operations` leave out `get`. A
collection without `get` gives the model the link but no tool that reads that one record. See
[For agents](../agents.md#projects-tools).

A chat in a project continued through the [SpaceMIX API](api.md#assistant) sees the same project name, instructions
and linked items. There the read tool is named only when the API key gives the model that tool (`tools:read` or
`tools:write`), and the `project_*` tools aren't offered: they run only in the SpaceMIX app.

## Opening an item

Opening an item from a project does what picking a Search result does: the host sets your view's route to the
item's `route` (when it has one) and opens your view. Your view hears it as any other route change, through
`host.view.route()` on start or `host.view.onRoute`. An item whose extension isn't installed is shown under the
extension's id and can't be opened. An item whose extension is installed but not available to the person (see
[Who can use an extension](permissions.md#who-can-use-an-extension)) stays in the project, shown under the
extension's name, and can't be opened either; the assistant gets no tool to read it, and `project_get` marks it
`unavailable: true`. An item whose extension is a paid one [turned off until it's paid
for](permissions.md#turned-off-until-its-paid-for) is treated the same way; to someone who may use that extension the
project says `turned off until it's paid for` instead, and `project_get` also marks the item `turnedOff: true`. It
opens again once the server's purchase covers it; with the [Hub off](hub-optional.md#hub-off), renewing needs the Hub back on. A build that's turned off because a paid listing took its id says that instead, and one that needs installing again (its package is from before the rename, or its builder left the server) says so instead of `not installed`. To someone it's withheld from because it's [someone's own build the owner hasn't approved](permissions.md#how-far-a-members-build-reaches), the project says so in those words instead of `isn't available to you`, and the owner is pointed to the build's page. If a listing replaces a build, the build's items stay in the project and open the listing, which may or may not have what they pointed to.

## Stability

Experimental. There is no `host.projects` API yet: an extension can't add items to a project, list them or hear
about them. One is planned, not promised, and would build on `ProjectItem`. Until then the type may
grow (new optional fields) but its fields won't change meaning. How projects look and behave in the app may change
freely.
