# Lune **One vault. Every copy current. Access you can take back.** Lune keeps shared Markdown vaults (ordinary folders of notes, the kind Obsidian opens) in sync across people, laptops, servers and AI agents. Grant access by dragging a vault onto a person; take it back by pulling the ribbon between them. Lune keeps the history, combines edits and handles the keys for you, so nobody on the team needs to know Git. - **Sync you can trust.** Edits reach everyone within seconds. Nothing is ever silently overwritten: if two people change the same lines, both versions are kept. - **Access as a lifecycle.** Invite, change roles, remove someone from one vault or from the whole team. Their unshared work comes back to you before their copy disappears. - **Approachable.** A menu-bar app and a web canvas. No terminal needed unless you want one. > Lune is in its community release. The Mac app isn't signed by Apple yet (see [First open on a Mac](#first-open-on-a-mac)). --- ## What it's for - **A team knowledge base** (runbooks, DevOps notes, decisions) that everyone edits in their own editor, without anyone having to learn Git. - **One person with several machines and agents.** Codex on your laptop and Hermes on a VPS keep reading and writing the same notes. - **Bringing people in and letting them go cleanly.** When someone leaves, their access ends, their unshared notes are handed back for review, and the copies on their devices are removed. Lune works on **plain folders**. Obsidian, VS Code, an AI agent or a shell script just read and write files; nothing needs a plugin. ## What it can do | | | |---|---| | **Automatic sync** | Changes are shared after about 5 seconds of quiet (at most 60 seconds while you keep typing). Each burst of edits becomes one history entry, labeled with the device it came from. | | **Works offline** | Keep editing without a connection; everything goes out when you're back online. | | **Conflicts keep both** | Edits to different lines are combined on their own. If the same lines changed in two places, the incoming version stays in place and yours is saved next to it as `note (Your Mac's version).md`. Compare them side by side and pick one, in the app or on the canvas. Sync never stops to wait for you. | | **Secret check** | Before a change leaves your device, Lune looks for things like cloud keys, tokens and private keys. A note with one is held back on your device (marked red) until you replace the secret with a pointer, such as "search prod-deploy in Secrets Manager", or say it isn't a secret. The hub runs the same check. | | **Runaway guard** | If something deletes or rewrites a large part of a vault at once (about 20% of notes, or 50+), the change is held on that device until its owner chooses **Share anyway** or **Undo**. | | **Roles** | Each person has **Read**, **Edit** or **Manage** on each vault. A Read member can edit their own copy, but those edits stay on their device. | | **Taking access back** | Remove someone from a vault: their device makes the folder read-only, hands over anything unshared for a manager to **Keep** or **Discard**, then deletes its copy. Devices that are offline do this when they come back. | | **Team canvas** | A web page on your hub showing vaults, people and devices. Drag to grant, pull a ribbon to revoke (with Undo), and see who is current, behind, offline, or holding a secret. **Nudge** a device to share now. Works on a phone too. | | **GBrain brains** | Mark a vault as a [GBrain](https://github.com/garrytan/gbrain) brain and every device that has `gbrain` refreshes it after notes arrive, so agents answer from the latest notes. Clashes never become a second page: lines both sides added are kept in the one note, and if the same lines changed, the other version waits on its own device under **Notes to tidy** instead of as a copy file. | | **Several teams** | One device can belong to more than one team's hub, such as your own and your workplace's, each with its own vaults. | | **Signed updates** | The Mac app updates itself from your hub. Every update is signed by your hub and checked before it's installed. | ## How it fits together ``` your Mac (Lune app) ─┐ your VPS (lunesync) ─┼──► hub (your server) ◄── teammate's Mac an agent's machine ──┘ · keeps each vault's history · accounts, roles, devices, access log · team canvas at https://your-hub ``` - **Hub:** one small server you host (Docker). It holds each vault's history, the team's accounts and memberships, and the access log, and it serves the team canvas. - **Lune for Mac:** a menu-bar app for people. - **`lunesync`:** the same sync engine as a command-line tool, for servers, agents, and anyone who prefers a terminal. --- ## Getting started ### Join a team (Mac) 1. Open the invite link you were sent. 2. Click **Download Lune for Mac**, open the download, and drag **Lune** to **Applications**. 3. Open Lune. The first time, see [First open on a Mac](#first-open-on-a-mac). 4. Back on the invite page, click **Open Lune to join**. 5. In Lune, check the name for this Mac (your team sees it next to your changes) and where shared vaults should live (default `~/Vaults`), then click **Join**. Your vaults arrive in that folder. Open them in Obsidian or any editor; from now on Lune only shows up in the menu bar. **Adding another Mac to your account:** sign in to your team's canvas, open **Vaults & people**, and click **Connect this Mac**. No code to copy. ### First open on a Mac Lune isn't signed by Apple yet, so the first time macOS says it can't check the app: 1. Open **System Settings → Privacy & Security**. 2. Scroll to the message about Lune and click **Open Anyway**. You only do this once; updates install without asking again. ### A server or an agent's machine Install the command-line tool (needs [Rust](https://rustup.rs) 1.89 or newer): ```sh cargo install --git https://git.senkensha.space/senkensha/lune.git lunesync ``` Then either join with an invite, or add the machine to your existing account: ```sh # With an invite link (creates your account): lunesync join https://your-hub/join/XXXX --name "Hermes" # Or add it to your account: run `lunesync pair` on a device you already have, then: lunesync login --hub https://your-hub --code K7QD-4MXA --name "Hermes" # Keep syncing in the background (launchd on macOS, systemd on Linux): lunesync service install ``` > The tool is tested on macOS. Linux builds should work but haven't been tested yet. ### Start a team (host a hub) See [Hosting a hub](#hosting-a-hub). The team owner's one-time join link appears in the hub's log on first start. --- ## Using Lune ### The menu bar The moon icon shows how things are: | Dot | Means | |---|---| | 🟢 green | Everything is shared | | 🟠 amber | Something is waiting: changes not shared yet, a big change to confirm, a note to tidy, or an update needed | | ⚪ grey | Offline; changes are saved and will go out later | | 🔴 red | A note was held back because it may contain a secret | The menu has **Open Lune**, **Open team canvas**, **Share now**, **Restart to update** (when a new version is ready), **Uninstall Lune…** and **Quit**. ### The Lune window Lists each vault with its status, and anything that needs you: - **A big change is waiting:** **Undo** brings back everything it removed or rewrote; **Share anyway** sends it. - **A note may contain a secret:** type where the secret really lives and click **Replace**, or click **Not a secret**. - **A note was changed in two places:** **Compare** shows both versions with the differences highlighted. Keep one, or keep both as separate notes. - **GBrain:** **Mark as GBrain** makes the vault a GBrain brain for the whole team (Lune suggests it when it sees `gbrain.yml`). Where `gbrain` is installed, Lune asks once whether to refresh GBrain after each sync; if a refresh fails, the vault turns amber with **Retry**. - **Upload:** put a vault that's only on this Mac onto a team, history included. The button shows for whoever may create vaults on that team: by default the team owner and anyone who manages a vault there, or every member if the hub allows it (`LUNE_VAULT_CREATION=anyone`). A vault that syncs with its own remote (GitHub, GitLab, Gitea…) is **detached** from it first, so its notes don't end up in two places; that remote keeps its copy as it was. Before anything is made on the team, Lune checks the notes the way the team's hub will: a line that looks like a secret turns red to decide (replace it with where to find it, or mark it not a secret), and if older history has one, you can upload just the current notes (the full history stays on your Mac). - **Join another team:** add a second hub, such as your workplace's. **Leave** next to a team removes this Mac from it (anything unshared is handed over first). ### The team canvas Open it from the menu (**Open team canvas**), or with `lunesync open`. Managers and the team owner can: - **Grant:** drag a vault onto a person. - **Revoke:** pull the ribbon between them until it snaps. You get an **Undo** for about 8 seconds; nothing reaches their devices before that. - **Invite person**, **New vault** (the team owner and anyone who manages a vault; every member if the hub sets `LUNE_VAULT_CREATION=anyone`), **Delete vault…** (team owner; asks first, and the history stays archived on the hub), change roles, rename devices, **Nudge** a device that's behind, tidy notes changed in two places, review **handovers**, and (team owner only) **Remove from team** or **Restore**. Every gesture also has a button in the side panel. Every access change is recorded in the hub's access log. ### Useful commands ```sh lunesync status # how each vault is doing lunesync checkpoint "Before the migration" # a named point in history, shared now lunesync held # what's held back here, and how to decide lunesync tidy # notes kept in two versions lunesync tidy keep mine notes/plan.md # or: theirs, both lunesync gbrain --vault Brain --refresh on # refresh GBrain after sync on this device (--source , --retry) lunesync history # recent changes and which device made them lunesync open # the team canvas, already signed in lunesync pair # a one-time code to add another device ``` Team management from the terminal: ```sh lunesync vault new DevOps # the team owner, or anyone who manages a vault (any member with LUNE_VAULT_CREATION=anyone) lunesync vault kind Brain gbrain # a GBrain brain for the whole team (or: obsidian) lunesync vault detach Brain # stop syncing with its own remote (GitHub, GitLab…); stays on this device lunesync vault upload Brain # put a vault that's only on this device onto the team lunesync invite Alice --vault DevOps:edit --vault Notes:read lunesync grant Alice Notes --role manage lunesync members DevOps lunesync remove Alice --vault DevOps # her unshared work comes back as a handover lunesync handovers # then: lunesync handover show|keep|discard|skip lunesync device remove "Old laptop" # a lost device: hands over and leaves, then its key stops working lunesync team remove Alice # owner only: ends everything, account can be restored lunesync vault delete Sandbox --yes # owner only: everyone's copy goes, the history stays archived on the hub lunesync leave --team work.example.com # this device leaves a team (add --forget if that hub is gone) lunesync hub log # owner only: the access log ``` On a device that belongs to several teams, add `--team ` to say which one. ### Without a hub `lunesync` also syncs a folder through any plain Git remote you already have (GitHub, Gitea, a bare repository over SSH), with the same conflict handling, secret check and runaway guard. There are no accounts or access control in this mode: ```sh lunesync add Notes ~/Vaults/Notes --remote git@github.com:you/notes.git lunesync run ``` Such a vault still shows in the Lune app with its status, but not on a team canvas: who can reach it is up to that remote. To bring it onto a team, **detach** it and **upload** it (above). --- ## Options ### Per vault (on the hub) | Setting | Default | | |---|---|---| | Delete from their devices | on | When someone is removed, their copy is deleted after their unshared work is handed over. Off: their copy stays, read-only and no longer synced. `lunesync vault set DevOps --delete-from-devices off` | | Kind | Obsidian | **GBrain** changes how clashes are kept (no copy files, see above) and lets devices refresh GBrain after sync. `lunesync vault kind Brain gbrain` | ### Per device | | | |---|---| | Device name | Shown on everything this device shares. `lunesync device name "Codex"`, or set when joining. Brackets must pair up, e.g. `Mac (work)`. | | Vaults folder | Where vaults from the hub arrive (default `~/Vaults`). Chosen when connecting the Mac app, or `--vaults-dir` on `join` / `login`. | | Settings folder | `~/Library/Application Support/lune` on macOS, `~/.config/lune` on Linux. Set `LUNE_HOME` to use another folder (handy for running two test devices on one machine). | ### Hub (environment variables) | Variable | Default | | |---|---|---| | `LUNE_HUB_URL` | `http://localhost:8080` | The public address people and devices use. Use `https://` in production. | | `LUNE_OWNER_NAME` | `Owner` | Name of the team owner, whose join link is printed on first start. | | `LUNE_HUB_DATA` | `/data` | Where vault histories, the database and the update-signing key live. | | `LUNE_HUB_LISTEN` | `0.0.0.0:8080` | Address the hub listens on. | | `LUNE_RELEASE_PASSWORD` | (asks) | Password of the update-signing key, for `release keygen` / `publish`. | | `LUNE_VAULT_CREATION` | `managers` | Who may create vaults (and upload one): `managers` is the team owner and anyone who manages a vault; `anyone` is every member. Creators manage only their own new vault, and sharing a vault still needs Manage on it. Any other value stops the hub at start. | --- ## Hosting a hub You need a server with Docker and a domain name. Put the hub behind a reverse proxy that handles HTTPS (Caddy, nginx, Traefik). Example with Caddy: ```yaml # compose.yaml services: lune: build: https://git.senkensha.space/senkensha/lune.git # or a local checkout: build: . restart: unless-stopped environment: LUNE_HUB_URL: https://lune.example.com LUNE_OWNER_NAME: Sen # LUNE_VAULT_CREATION: anyone # let every member create vaults (default: managers) volumes: - ./data:/data caddy: image: caddy:2 restart: unless-stopped ports: ["80:80", "443:443"] volumes: - ./Caddyfile:/etc/caddy/Caddyfile - ./caddy-data:/data ``` ``` # Caddyfile lune.example.com { reverse_proxy lune:8080 } ``` ```sh docker compose up -d docker compose logs lune # the owner's one-time join link ``` On a small server (around 4 GB RAM), limit the build: `docker compose build --build-arg CARGO_BUILD_JOBS=2`. **Back up `./data`.** It holds every vault, the accounts, and the update-signing key. ### Publishing the Mac app from your hub The hub offers the app for download and for updates, signed with a key that never leaves your server. 1. **Once:** create the signing key on the hub, and keep its password safe: ```sh docker compose exec lune lunehub release keygen ``` Put the public key it prints into `desktop/tauri.conf.json` → `plugins.updater.pubkey`. Apps built from then on trust only that key, so don't lose it. 2. **Each release:** build on a Mac (Apple silicon, with Rust and Node.js): ```sh desktop/build.sh 0.2.0 ``` 3. Copy the two files it prints into the hub's data folder, then sign and publish: ```sh docker compose exec lune lunehub release publish 0.2.0 \ /data/incoming/Lune_0.2.0_aarch64.app.tar.gz /data/incoming/Lune_0.2.0_aarch64.dmg "What changed" ``` Apps pick up the new version when they start, when their window opens, and every few hours. The hub keeps serving the newest version and the one before it; older apps keep saving locally and show **Update Lune to keep syncing**. **Several hubs, one key:** a second hub (say, your workplace's) can offer the same signed releases without ever holding the key. Copy the `releases//` folder from the signing hub and run `lunehub release import `. --- ## Security and privacy - **Pointers, not secrets.** Vaults are for knowledge, not credentials. Lune holds back anything that looks like a secret, and the hub refuses it too. Write where to get access ("use tsh", "search X in Secrets Manager"). - **Lune never grants infrastructure access.** It doesn't touch SSH, cloud, repository or deployment permissions; those stay in your existing tools. - **What the hub knows:** vault contents and history, accounts, roles, device names, the access log, and each device's health (when it last synced and how many changes are waiting; never what they are). - **Devices** sign in with their own key; the hub stores only a hash of it. Losing a device means removing that one device. - **The team canvas** has no passwords: you sign in with a one-time link from one of your devices (`lunesync open`) or a short code (`lunesync pair`). - **Uninstalling** (menu → **Uninstall Lune…**) shares what it can, hands the rest over to your team, removes this Mac from every team, and deletes only the vault folders Lune created. Folders you added yourself, and any folder with changes that couldn't be shared, stay. - **Known limit:** taking access back can't recall copies someone made elsewhere, or content they already gave to other tools. ## Limitations - The Mac app is for **Apple silicon Macs** (macOS 12+). Intel Macs, Windows and Linux desktop apps aren't available yet; on those, use `lunesync`. - The Mac app isn't signed or notarized by Apple yet (see [First open on a Mac](#first-open-on-a-mac)). - No mobile app. The team canvas works in a phone browser for urgent things like revoking access or nudging a device. - Vaults are whole folders: access can't be limited to part of a vault, and there's no time-limited access yet. --- ## Building from source ```sh git clone https://git.senkensha.space/senkensha/lune.git && cd lune cargo test --workspace # sync, hub and conflict tests cargo install --path cli # lunesync (cd web && npm ci && npm run build) # the team canvas, embedded in the hub cargo build --release -p lunehub # the hub desktop/build.sh # the Mac app (macOS, Apple silicon) ``` | Folder | | |---|---| | `core/` | The sync engine: watching, saving, conflicts, secret check, runaway guard, hub client | | `cli/` | `lunesync` | | `hub/` | `lunehub`: accounts, memberships, devices, vault storage, access log, releases | | `web/` | The team canvas (React), and the Mac app's window | | `desktop/` | The Mac app (Tauri) | | `docs/SPEC.md` | How Lune is meant to behave, and every design decision | ## License [GNU Affero General Public License v3.0](LICENSE) (AGPL-3.0-only). You may use, change and share Lune freely; if you run a changed hub for others, offer them its source.