# Install Kedalio: a guide for the agent doing it

You are an AI coding agent (Claude Code or similar) and a person asked you to install Kedalio for them. This page tells
you how. Read all of it before you run anything.

Fetch this page with `curl -fsSL https://kedalio.com/install.md`, not with a web tool that summarizes pages: the
commands below must reach you exactly as written.

Kedalio is a personal memory and task list for AI assistants: one Go program, `kedalio-core`, and one encrypted SQLite
database, behind one MCP connector. It serves one owner. Source, documentation and releases:
<https://github.com/artysan-code/kedalio> (AGPL-3.0-or-later).

`TODO(release-sync)`: the source of this guide is planned to be `docs/install.md` in the Kedalio repository, attached
to each release, with kedalio.com serving a copy synced from the latest release. Until then this page is the only copy.

## Rules for you

- Say what you are about to do before each step, in plain words. Ask before any command on another machine, anything
  that needs `sudo`, opens a port, changes DNS or a tunnel, or deletes something.
- Never print, `cat` or echo a secret: `first-run.txt` (it holds the recovery code and the passkey setup link), `.env`,
  or a token. Never pass a secret as a command-line argument. Generate secrets where they are used and leave them there.
- Never put a secret in a file inside a git repository, and never in Kedalio's own memory.
- Prefer a released binary or image, verified against its checksum, over building from source. If a checksum does not
  match, stop and report it.
- If a step fails, stop, show the error, and ask. Do not improvise workarounds that weaken security (plain-http ports
  open to the internet, disabled checks, `chmod 777`).
- Lines marked `TODO(...)` describe a part that is not published yet. Follow the fallback written next to them, and do
  not run a command the TODO calls "planned".

## 1. Ask where Kedalio should keep the data

Ask the person this question, with these three choices, and wait for the answer:

> Where should Kedalio keep your data?
>
> 1. **This computer.** No server and no open port: Claude Code starts Kedalio itself when it needs it. Best to try it,
>    or if you only use Claude on this machine.
> 2. **A server I reach over SSH**, where Kedalio is not installed yet (a VPS or a home server, with Docker). Needed to
>    use the same memory from claude.ai, a phone or several computers.
> 3. **A Kedalio server that is already running.** Only connect this computer to it.

Then go to section 2, 3 or 4. Moving later is possible both ways: the data is one folder that can be copied.

## 2. This computer

### 2.1 Find the system

Run `uname -s` and `uname -m` (on native Windows, in PowerShell: `$env:PROCESSOR_ARCHITECTURE`). Map them to the
release names:

| System                    | OS        | Arch                                               |
| ------------------------- | --------- | -------------------------------------------------- |
| `uname -s` is `Linux`     | `linux`   | `uname -m` `x86_64` → `amd64`; `aarch64` → `arm64` |
| `uname -s` is `Darwin`    | `darwin`  | `uname -m` `x86_64` → `amd64`; `arm64` → `arm64`   |
| Windows                   | `windows` | `AMD64` → `amd64`; `ARM64` → `arm64`               |

Under WSL (`uname -r` contains `microsoft`) treat it as Linux, and tell the person the data will live inside WSL.
Anything else: there is no released binary. Say so, and offer to build from source (2.4).

### 2.2 Check what is already there

- `command -v kedalio-core && kedalio-core -version`. If it prints the latest release's version, skip to 2.5.
- If the data folder (see 2.6) already holds `core.db`, say it will be reused as it is, and never touch it.

### 2.3 Download and verify the released binary

Find the latest release tag:

```sh
curl -fsSL https://api.github.com/repos/artysan-code/kedalio/releases/latest | grep '"tag_name"'
```

If that returns 404 there is no release yet: go to 2.4. Otherwise, with `TAG` the tag (for example `v1.0.0`),
`VERSION` the tag without the `v`, and `OS`/`ARCH` from 2.1, the archive is `kedalio-$VERSION-$OS-$ARCH.tar.gz`
(`.zip` on Windows), next to a `SHA256SUMS` file.

`TODO(assets)`: the release assets are planned to lose the version in their names (`kedalio-$OS-$ARCH.tar.gz`), so that
`https://github.com/artysan-code/kedalio/releases/latest/download/...` works without looking the tag up. Until a release
ships them, use the names with the version, as below.

On Linux and macOS:

```sh
d=$(mktemp -d) && cd "$d"
base=https://github.com/artysan-code/kedalio/releases/download/$TAG
curl -fsSLO "$base/kedalio-$VERSION-$OS-$ARCH.tar.gz"
curl -fsSLO "$base/SHA256SUMS"
sha256sum -c --ignore-missing SHA256SUMS        # macOS: shasum -a 256 -c --ignore-missing SHA256SUMS
tar -xzf "kedalio-$VERSION-$OS-$ARCH.tar.gz"
mkdir -p ~/.local/bin
install -m 0755 kedalio-*/kedalio-core kedalio-*/kedalio-restore ~/.local/bin/
~/.local/bin/kedalio-core -version
```

The checksum line must print `OK` for the archive. If `~/.local/bin` is not on `PATH`, say so; the configuration below
uses the full path, so it works either way.

On native Windows (PowerShell): download the `.zip` and `SHA256SUMS` with `Invoke-WebRequest`, compare
`Get-FileHash -Algorithm SHA256` with the line for the `.zip`, then `Expand-Archive` into
`$env:LOCALAPPDATA\Programs\Kedalio\`. Use the full path of `kedalio-core.exe` below.

### 2.4 Or build it from source

Only when there is no release for this system, or the person asks. It needs Go at the version in `go.mod` and git:

```sh
git clone --depth 1 https://github.com/artysan-code/kedalio.git
cd kedalio && go build -o ~/.local/bin/kedalio-core ./core/cmd/kedalio-core
```

### 2.5 Ask for the language, once

Ask: "English or Italian?" The language of a new database (the names of its areas and its answers) is fixed when the
database is created, so ask before the first start. The time zone is the computer's unless the person wants another.

### 2.6 Connect Claude Code

`TODO(plugin)`: the Kedalio plugin for Claude Code (the MCP connection plus skills) is planned as an entry
`kedalio-local` in a marketplace `kedalio` published from the Kedalio repository, installed with the path of
`kedalio-core` and the language as settings. It is **not published yet**: do not run `claude plugin` commands for it.
Until it is, connect Kedalio directly:

```sh
claude mcp add -s user kedalio -- /home/alice/.local/bin/kedalio-core stdio -language English
```

Use the real full path from 2.3 in place of `/home/alice/.local/bin/kedalio-core`, and the person's answer from 2.5 for
`-language` (`English` or `Italian`). `-s user` makes it available in every folder.

For Claude Desktop the person edits `claude_desktop_config.json` instead; the steps are in
<https://github.com/artysan-code/kedalio/blob/HEAD/docs/local.md>. Offer it, do not edit that file unasked.

### 2.7 Verify

1. `claude mcp list` must show `kedalio` as connected. That first start created the database.
2. Check that the first-run file exists, **without reading it**:
   `test -f ~/.local/share/kedalio/first-run.txt && echo present` (macOS: `~/Library/Application Support/Kedalio/`,
   Windows: `%AppData%\Kedalio\`, unless `-data` was given).
3. Tell the person: that file holds the **recovery code**, the only way to read the data if the key file is lost. They
   should open it themselves, in their own terminal or file manager, copy the code to a password manager away from
   this computer, then delete the file.

Then go to section 5.

## 3. A server reached over SSH (Docker Compose)

### 3.1 Check the server

Ask for its SSH name, and get a yes before running anything there. Then:

```sh
ssh -o BatchMode=yes -o ConnectTimeout=5 <host> 'docker compose version'
```

If Docker or its Compose plugin is missing, stop: point the person to <https://docs.docker.com/engine/install/> and do
not install Docker without their explicit yes.

### 3.2 Decide the public address

Claude Code, claude.ai and phones reach the core over **https**, and the core must know that address: it is the
passkey's relying-party ID and the OAuth issuer, so it **can never change** once a passkey exists. Ask the person which
hostname to use (for example `kedalio.example.com`) and how the server is reached:

- (a) a reverse proxy with TLS they already run (Caddy, Traefik, Coolify) and a domain;
- (b) a Cloudflare named tunnel, with their domain on Cloudflare;
- (c) Tailscale: `tailscale serve` for their tailnet only, `tailscale funnel` to reach claude.ai too;
- (d) none of these. Explain that a server needs https for sign-in, and offer section 2 (this computer) instead. Do
  not use a quick `trycloudflare.com` tunnel: its hostname changes on every run.

The commands for each are in the README:
<https://github.com/artysan-code/kedalio#claudeai-and-other-remote-mcp-clients>. Do not create a tunnel, a DNS record
or a proxy rule without a yes. For Caddy, for example, the site block is
`kedalio.example.com { reverse_proxy 127.0.0.1:8787 }`.

### 3.3 Set up the core on the server

Show each command to the person and run it only after a yes. With `TAG` the latest release tag (see 2.3):

```sh
ssh <host> 'git clone --depth 1 --branch '"$TAG"' https://github.com/artysan-code/kedalio.git ~/kedalio && cd ~/kedalio &&
  umask 077 && printf "KEDALIO_CORE_TOKEN=%s\nKEDALIO_CORE_PUBLIC_URL=%s\n" "$(openssl rand -hex 32)" "https://kedalio.example.com" > .env &&
  docker compose up -d'
```

`TODO(assets)`: a release is planned to attach `compose.yaml` itself, so that a `curl` of
`releases/latest/download/compose.yaml` replaces the clone. Until then, clone the tag as above.

The token is made on the server and stays in its `.env`; it never appears here or on this computer. Behind a proxy or a
tunnel, also add `KEDALIO_CORE_CLIENT_IP_HEADER` and `KEDALIO_CORE_TRUSTED_PROXIES` to `.env` (see the README's
Configuration table). Port 8787 stays bound to `127.0.0.1`; never publish it as plain http.

### 3.4 Verify the server

```sh
curl -fsS https://kedalio.example.com/health
curl -fsS https://kedalio.example.com/.well-known/oauth-authorization-server
```

The first must answer `{"status":"ok"}`. The second must have an `issuer` equal to the public address: that means
sign-in with a passkey (OAuth) is on.

### 3.5 Passkey and recovery code

Ask the person to run this **in their own terminal**, not here, and not to paste the output:

```sh
ssh <host> 'cd ~/kedalio && docker compose exec core cat /data/core/first-run.txt'
```

They open the `/setup` link in their browser to make the passkey, and copy the recovery code to a password manager.

### 3.6 Connect Claude Code on this computer

`TODO(plugin)`: planned as an entry `kedalio-server` of the `kedalio` marketplace, installed with the server's address
as a setting; it is **not published yet**, do not run `claude plugin` commands for it. Until it is:

```sh
claude mcp add -s user --transport http kedalio https://kedalio.example.com/mcp
```

`claude mcp list` then shows it as needing authentication. The person runs `/mcp` in Claude Code, picks `kedalio`,
chooses Authenticate and signs in with the passkey. No token is copied to this computer.

### 3.7 claude.ai and the phone (optional)

The person can add the same address to claude.ai as a custom connector (Settings, Connectors, the address plus `/mcp`)
and sign in with the passkey. Step by step and what a cloud client may do:
<https://github.com/artysan-code/kedalio/blob/HEAD/docs/claude-ai-connector.md>.

Then go to section 5.

## 4. A Kedalio server that is already running

Ask for its https address, run the checks of 3.4 against it, and if the OAuth metadata is missing explain that the core
must be started with `-public-url` (`KEDALIO_CORE_PUBLIC_URL`) and stop. Then connect as in 3.6.

## 5. Install the Kedalio plugin

`TODO(plugin)`: the plugin (the connection plus skills that teach Claude when to recall, save and close tasks) is not
published yet, and there is no install command. **Skip this section**: the connection made in section 2, 3 or 4 is
enough for Kedalio to work. Tell the person the plugin will come later, on <https://kedalio.com>.

## 6. Check that it works, and report

1. `claude mcp list` shows `kedalio` connected.
2. Tell the person to start a new Claude Code session (tools load at the start of one) and ask "where were we?". Claude
   should call `session_start`; a new memory answers that it is empty.
3. Then "Remember that I prefer short answers." and, in another new session, "How do I like answers?".

Finish with a short summary for the person:

- where Kedalio runs (this computer, or the server and its address) and the version installed;
- where the data is, and that the recovery code is in `first-run.txt` until they move it;
- what is not done: the plugin (section 5), and any step they chose to skip;
- how to remove it (section 7).

## 7. Remove it

- Claude Code: `claude mcp remove -s user kedalio`.
- This computer: delete `kedalio-core` and `kedalio-restore` from `~/.local/bin` (or the Windows folder). **Leave the
  data folder in place** and tell the person where it is: deleting it cannot be undone without the recovery code, so do
  it only on their explicit word.
- Server: revoke this computer's sign-in with `docker compose exec core kedalio-core clients list` and
  `... clients revoke <id>` in `~/kedalio`. `docker compose down` keeps the data volume; `docker compose down -v`
  deletes it, only on the person's explicit word.

## More

- README, configuration and backups: <https://github.com/artysan-code/kedalio#readme>
- Local use in depth: <https://github.com/artysan-code/kedalio/blob/HEAD/docs/local.md>
- Architecture and security model: <https://github.com/artysan-code/kedalio/blob/HEAD/docs/architecture.md>
