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

# init

> Connect a directory to a project.

```bash theme={"theme":"nord"}
cd ~/code/my-service
resumecontext init
```

Creates the project and marks **this exact directory** as belonging to it.

Run it inside the directory you want archived. It never walks up to an enclosing
git root, which is what lets a subfolder of a monorepo be its own project.

## What else it does

It registers the directory with the background daemon and starts it if it is not
already running. That is what makes syncing automatic from here on, roughly
every 20 seconds, with no command to run. See [`daemon`](/docs/cli/daemon).

<Note>
  On an OS with neither launchd nor systemd the CLI cannot install a background
  service. It says so, and on those machines [`sync`](/docs/cli/sync) has to be run
  by hand.
</Note>

## What it prints

The project's MCP URL, and a pointer to [`resumecontext mcp`](/docs/cli/mcp) for the
token your agent needs. Add that MCP server only to this directory's
folder-level agent configuration, never to a global agent configuration.

## Running it twice

Not an error. If the directory already has a marker, either because you ran
`init` before or because the marker was committed to git and you just cloned
the repo, `init` looks the project up and reports your relationship to it:

| Outcome              | Meaning                                                    |
| -------------------- | ---------------------------------------------------------- |
| `created`            | New project, now yours                                     |
| `already_has_access` | It exists and you are in it                                |
| `pending_invite`     | You have been invited; run [`accept`](/docs/cli/sharing#accept) |

<Note>
  There is no way to create a project from the website. `init` writes the marker
  file that ties a directory to a project id, and a browser has no directory.
</Note>

## Invited projects

Do not use `init` to join an existing project. After accepting an invite, run
[`sync`](/docs/cli/sync) once from a clone that contains the project's
`.resumecontext.json` marker. That registers the clone with the daemon and
makes later syncing automatic.
