0.1.6: GBrain brains — refreshed after sync, clashes never make a second page
- A vault has a kind on the hub: Obsidian (as before) or GBrain. Set it with
`lunesync vault kind`, the canvas panel or the window; Lune suggests it when
it finds gbrain.yml / .gbrain-source. Every change is in the access log.
- GBrain vaults: devices that have `gbrain` (looked for beyond PATH) are asked
once whether to refresh it after sync. Lune then runs
`gbrain sync --source <name> --no-pull` in the background after notes arrive
or are saved; it never holds up syncing. A failed refresh turns the vault
amber ("GBrain not refreshed") with Retry, also on the canvas.
- Clashes in GBrain vaults: lines both sides added are kept in the one note,
incoming first. Same lines changed: the incoming version stays, this
device's waits under Notes to tidy, stored in .git/lune/tidy (never a copy
file GBrain would index). Applies to syncing, undo, held notes and
handovers. Held notes moved aside stay red until decided.
- .gbrain-source is kept per device. Obsidian vaults are unchanged.
- SPEC: M8 section and decisions recorded.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
40
docs/SPEC.md
40
docs/SPEC.md
@@ -148,6 +148,7 @@ Four targets, seven milestones. Each ends with a story Sen acts out as a user. A
|
||||
| C · Web | **5. Canvas for access** | Grant by drag, revoke by pinch with undo, button alternatives, invites, device labels, Float/Dock. |
|
||||
| | **6. Canvas for health and leaving** | Freshness glow and Nudge, tidy a conflict side by side, review a handover, remove from team — also from a phone. |
|
||||
| D · Desktop | **7. The app normal people install** | Download from the website, pair automatically, pick a folder, tray status, compare a conflict, receive an update, uninstall cleanly. |
|
||||
| E · Agents' brains | **8. My agents share one GBrain** *(draft, after M7)* | Codex adds a page on the laptop; Hermes's GBrain finds it on the VPS a minute later without anyone running anything. Both write the same page at once: GBrain still sees one page, not two. |
|
||||
|
||||
Only the current milestone gets detailed below. The next one is detailed when the current one is accepted.
|
||||
|
||||
@@ -192,8 +193,43 @@ This milestone ships **macOS (Apple silicon) only** (§8). The code stays portab
|
||||
### Out of scope for M7
|
||||
Windows and Linux installers, Intel Macs, server install script (D2), OS code signing (D4), security audit and release evidence (before a wider rollout, not the pilot).
|
||||
|
||||
## 6b. Milestone 8 — My agents share one GBrain *(draft, queued after M7)*
|
||||
|
||||
### Goal
|
||||
A vault that GBrain (https://github.com/garrytan/gbrain) uses as its brain syncs through Lune without making that brain messy. Every device's agent answers from the latest notes, and a clash never shows up in GBrain as a second copy of a page.
|
||||
|
||||
Why: GBrain indexes every Markdown file, so S4's `name (Label's version).md` becomes a duplicate page; and no device refreshes its GBrain index after notes arrive.
|
||||
|
||||
### What a person does
|
||||
- Marks a vault as a GBrain brain, in the canvas or the window (`lunesync vault kind <vault> gbrain`). Lune suggests it when it finds `gbrain.yml` or `.gbrain-source` in the vault. The vault shows a "GBrain" badge.
|
||||
- On each device where the `gbrain` command is found, the vault shows "Refresh GBrain after sync: on" (asked once). After that the person never runs GBrain commands themselves.
|
||||
|
||||
### Behavior
|
||||
GBrain vaults only; Obsidian vaults behave exactly as before.
|
||||
- **Refresh after sync.** After a sync that brought changes, Lune runs `gbrain sync --source <name> --no-pull` in the background (Lune does the pulling; GBrain only reads committed files by default, and Lune commits every burst). The source name is per device and defaults to the vault name. Lune looks for `gbrain` in the usual install places, not only the shell's PATH. It never holds up syncing. If it fails, the vault shows amber "GBrain not refreshed" with **Retry**.
|
||||
- **Both sides added lines in the same spot** → keep both, incoming first, then this device's. No clash copy.
|
||||
- **Same lines changed on both sides** → the incoming version stays in place. This device's version is not written into the vault folder; it is kept on this device, outside the vault's files (inside `.git/`, which GBrain never reads), under **Notes to tidy** (window, canvas, `lunesync tidy`) until resolved. This applies everywhere Lune would otherwise keep both copies (syncing, undo, handovers, held notes).
|
||||
- **The vault's kind is set on the hub**, so every device agrees. A GBrain vault therefore has to live on a Lune hub, not a plain Git remote.
|
||||
- **Ignore defaults**: `.gbrain-source` (a per-device source pin). `gbrain.yml` is shared.
|
||||
- The secret check (P2) and the runaway guard (S6) apply as before.
|
||||
|
||||
### Acceptance — Sen acts this out
|
||||
1. Mark Brain as a GBrain brain. Laptop "Codex" and VPS "Hermes" both point GBrain at their copy.
|
||||
2. Codex adds a page. Within about a minute `gbrain query` on the VPS finds it, with nothing run by hand.
|
||||
3. Both agents append to the same page's timeline at once: the page has both entries, and there is no copy file.
|
||||
4. Both rewrite the same paragraph: one stays, the other waits under Notes to tidy on its own device. `gbrain query` on either device returns one page. Tidy it and the result reaches both.
|
||||
5. Break GBrain on the VPS (rename the binary): the vault turns amber, notes keep syncing, and Retry works after fixing it.
|
||||
6. An Obsidian vault next to it behaves as before, including `(Label's version).md` copies.
|
||||
|
||||
### Out of scope for M8
|
||||
Installing or running GBrain for people, MCP through Lune, hosted gbrain.io, a shared Supabase database, parsing GBrain page sections.
|
||||
|
||||
### Open questions for M8
|
||||
1. Whether GBrain's upkeep (dream cycle, `gbrain maintain`) trips the runaway guard and needs a per-vault "trust big rewrites from this device" switch. Decide after a real GBrain run on Brain.
|
||||
2. GBrain can write into the vault itself: it edits a managed block in `.gitignore` after each sync, and its default (mixed) mode can create and commit pages. Lune would share those like any edit. Confirm that's fine on a real run, or suggest `GBRAIN_NO_GITIGNORE=1`.
|
||||
|
||||
## 7. Open questions
|
||||
None open.
|
||||
None open for M7. M8's are in §6b.
|
||||
|
||||
## 8. Decision changes
|
||||
Record here: date, what changed, why, which decision number. Example:
|
||||
@@ -212,3 +248,5 @@ Record here: date, what changed, why, which decision number. Example:
|
||||
- 2026-10-29 — A vault's settings decide where it shares: a folder found pointing elsewhere is set back. A leaving device whose older history has a possible secret hands over its current notes as one entry with those lines replaced, instead of never finishing (A6, P3). (Sen, after the Brain mix-up)
|
||||
- 2026-10-29 — Uploading checks everything first, the way the hub will: a vault on one device only holds every line that looks like a secret for a decision; "not a secret" marks travel to the team; history with one goes up as a fresh start. Nothing is made on the team until it passes. A vault on one device joins a same-named team vault only if they share history; otherwise the team's arrives beside it (P2, P3). (Sen, after the Brain upload)
|
||||
- 2026-10-29 — Community release without Apple signing, under AGPL-3.0-only; the public repo stays at git.senkensha.space. (Sen)
|
||||
- 2026-11-16 — For GBrain vaults, S4 changes: the losing version of a same-lines clash is kept only on its own device under Notes to tidy, never written into the vault folder; lines both sides added are kept, incoming first (S4, M8). (Sen)
|
||||
- 2026-11-16 — A vault's kind (Obsidian / GBrain) is a hub setting, so a GBrain vault must be on a hub; Brain moves from Gitea to the hub before M8's acceptance (M8). (Sen)
|
||||
|
||||
Reference in New Issue
Block a user