glyphd is the headless self-hosted Glyph server. It is not a GitHub UI clone. Its first job is Glyph-native preservation and coordination: projects, token auth, content blobs, graph records, work contexts, claims, publications, and race-safe sync cursors. GitHub remains useful as a public mirror. glyphd is for the Glyph graph itself.

Start A Server

Create an admin user, token, and project:
glyphd --data-dir .glyphd user create alice --admin
glyphd --data-dir .glyphd token create alice --scope project:read,project:write,project:publish
glyphd --data-dir .glyphd project create alice/glyph
Run the server:
glyphd --data-dir .glyphd serve --addr :8787 --storage sqlite
SQLite is the first storage adapter. The server code uses a storage interface so a Postgres adapter can be added later without changing the HTTP API or CLI sync flow.

Log In From The CLI

Store the token in the local Glyph credentials directory:
glyph auth login http://localhost:8787 --token glyph_...
glyph auth status --json
Credentials live under .glyph/credentials/ and are not part of public Git export.

Add A Glyph Sync Remote

glyph remote add origin glyph+http://localhost:8787/alice/glyph --mode glyph-sync --json
glyph remote sync origin --json
glyph remote sync dispatches by remote mode:
ModeBehavior
export-onlyExport public to Git/GitHub.
glyph-syncSync full Glyph graph records and content blobs with glyphd.

What Sync Preserves

V1 sync preserves the full graph data available in the current local store:
  • realms
  • source and content records
  • content blobs
  • work contexts
  • current unpublished workspace files
  • snapshots and checkpoints
  • claims, heartbeats, dependencies, and conflicts
  • publications and semantic publication metadata
  • remotes, mounts, hook runs, and audit events
Current snapshot records store tree hashes, not full path-to-content maps. Active workspace files are synced as work_file records so unpublished work can move between devices. Rich historical snapshot reconstruction can be added once snapshots store tree maps.

Race Safety

Each project has a monotonic server cursor. Pushes include the client’s last known cursor. If another device moved the server forward:
  • append-only records can still be accepted when they do not touch guarded state
  • guarded changes fail with 409 conflict
  • guarded state includes realm publications, claims, work context status, source paths, and workspace files
That means system A cannot silently overwrite system B’s newer publication or claim. A must pull, inspect, and retry after resolving conflicts.

Device Handoff

On device A:
glyph remote sync origin --json
On device B:
glyph init --json
glyph auth login http://localhost:8787 --token glyph_...
glyph remote add origin glyph+http://localhost:8787/alice/glyph --mode glyph-sync --json
glyph remote sync origin --json
Device B receives the Glyph graph records and content needed to reconstruct public state and active workspaces.