Self-hosted MCP server + dashboard giving Claude Code, Cursor & Hermes agents shared long-term memory over a git-backed markdown vault. Agent-native, Obsidian-compatible second brain — markdown RAG, no vector DB.
TypeScript agent-memoryai-agentsanthropicclaude-codecursorgitknowledge-baseknowledge-graphllmmarkdownmcpmcp-servermodel-context-protocolnote-takingobsidianpkmragsecond-brainself-hostedzettelkasten
feat(ui): surface the core pillars — home hub + live git status
Ronalds Palacis36809eca185b
diff --git a/app/(app)/page.tsx b/app/(app)/page.tsxindex 4242bbe..c44bb4b 100644--- a/app/(app)/page.tsx+++ b/app/(app)/page.tsx@@ -1,11 +1,142 @@+"use client";++import Link from "next/link";+import useSWR from "swr";+import { ArrowRight, Check, GitBranch, Plug, Zap } from "lucide-react";+import { fetcher } from "@/lib/client";++interface Repo {+ id: string;+ name: string;+ fullName?: string;+ active: boolean;+}+interface Sync {+ enabled: boolean;+ branch?: string;+ ahead?: number;+ behind?: number;+ dirty?: number;+ error?: boolean;+}++/** One pillar row: what it is, its live state, and the action to set it up. */+function Pillar({+ icon,+ title,+ desc,+ state,+ ok,+ href,+ cta,+}: {+ icon: React.ReactNode;+ title: string;+ desc: string;+ state?: string;+ ok?: boolean;+ href: string;+ cta: string;+}) {+ return (+ <Link+ href={href}+ className="group flex items-center gap-4 rounded-xl border border-border bg-card p-4 transition-colors hover:border-ring"+ >+ <div className="flex size-9 shrink-0 items-center justify-center rounded-lg border border-border text-muted-foreground">+ {icon}+ </div>+ <div className="min-w-0 flex-1">+ <div className="flex items-center gap-2">+ <span className="text-sm font-medium">{title}</span>+ {state && (+ <span className={`inline-flex items-center gap-1 text-xs ${ok ? "text-emerald-500" : "text-muted-foreground"}`}>+ <span className={`size-1.5 rounded-full ${ok ? "bg-emerald-500" : "bg-muted-foreground/50"}`} />+ {state}+ </span>+ )}+ </div>+ <p className="mt-0.5 text-xs text-muted-foreground">{desc}</p>+ </div>+ <span className="inline-flex items-center gap-1 whitespace-nowrap text-xs text-muted-foreground transition-colors group-hover:text-foreground">+ {ok ? <Check size={13} /> : null}+ {cta}+ <ArrowRight size={13} className="transition-transform group-hover:translate-x-0.5" />+ </span>+ </Link>+ );+}++const APP_NAME_FALLBACK = process.env.NEXT_PUBLIC_APP_NAME || "Engram";+export default function Home() {+ const { data: repos } = useSWR<{ repos: Repo[]; active: Repo | null }>("/api/repos", fetcher);+ const { data: sync } = useSWR<Sync>("/api/sync", fetcher, { refreshInterval: 10000 });+ const { data: feat } = useSWR<{ harness?: boolean; mcpAuthRequired?: boolean; appName?: string }>("/api/features", fetcher);+ const { data: tok } = useSWR<{ tokens: { id: string }[] }>("/api/tokens", fetcher);++ const active = repos?.active ?? null;+ const appName = feat?.appName || APP_NAME_FALLBACK;+ const tokenCount = tok?.tokens?.length ?? 0;++ const syncState = !active+ ? "sample vault"+ : sync?.enabled === false+ ? "sync off"+ : sync?.error+ ? "sync error"+ : sync?.ahead || sync?.behind || sync?.dirty+ ? `${sync?.dirty || 0} local · ↑${sync?.ahead || 0} ↓${sync?.behind || 0}`+ : "synced";+return (- <div className="flex h-full flex-col items-center justify-center gap-3 text-center">- <div className="size-2 rounded-full bg-primary" />- <p className="text-sm text-muted-foreground">- Select a note, or press{" "}- <kbd className="rounded border border-border px-1.5 py-0.5 font-mono text-[11px]">⌘K</kbd> to search.- </p>+ <div className="scrollbar-none h-full overflow-y-auto">+ <div className="mx-auto flex min-h-full max-w-2xl flex-col justify-center gap-6 px-8 py-12">+ <div>+ <div className="flex items-center gap-2">+ <div className="size-2 rounded-full bg-primary" />+ <h1 className="text-lg font-semibold tracking-tight">{appName}</h1>+ </div>+ <p className="mt-1.5 text-sm text-muted-foreground">+ A second brain your agents read and write — a git repo of markdown, live over MCP.+ </p>+ </div>++ <div className="space-y-2.5">+ <Pillar+ icon={<GitBranch size={16} />}+ title="Vault"+ ok={!!active}+ state={active ? `${active.name} · ${syncState}` : "not connected"}+ desc={active ? "Your notes live in this git repo — versioned, synced, portable." : "Connect a git repo of markdown — the source of truth for humans and agents."}+ href="/workspaces"+ cta={active ? "Manage" : "Connect a repo"}+ />+ <Pillar+ icon={<Plug size={16} />}+ title="Agents"+ ok={tokenCount > 0}+ state={tokenCount > 0 ? `${tokenCount} token${tokenCount === 1 ? "" : "s"}` : "none yet"}+ desc="Point Claude Code, Cursor, Hermes, or Claude.ai at the MCP endpoint to read + write this brain."+ href="/connect"+ cta={tokenCount > 0 ? "Manage" : "Connect an agent"}+ />+ <Pillar+ icon={<Zap size={16} />}+ title="AI capture"+ ok={!!feat?.harness}+ state={feat?.harness ? "on" : "off"}+ desc="Dump a rough note and the brain files it into the right place, with clean frontmatter."+ href="/settings"+ cta={feat?.harness ? "Configure" : "Enable"}+ />+ </div>++ <p className="text-center text-xs text-muted-foreground">+ Select a note, or press{" "}+ <kbd className="rounded border border-border px-1.5 py-0.5 font-mono text-[11px]">⌘K</kbd> to search.+ </p>+ </div></div>);}diff --git a/components/workspace-switcher.tsx b/components/workspace-switcher.tsxindex 9915bf7..9c9bfa2 100644--- a/components/workspace-switcher.tsx+++ b/components/workspace-switcher.tsx@@ -11,9 +11,18 @@ interface Repo {name: string;active: boolean;}+interface Sync {+ enabled: boolean;+ branch?: string;+ ahead?: number;+ behind?: number;+ dirty?: number;+ error?: boolean;+}export function WorkspaceSwitcher() {const { data } = useSWR<{ repos: Repo[]; active: Repo | null }>("/api/repos", fetcher);+ const { data: sync } = useSWR<Sync>("/api/sync", fetcher, { refreshInterval: 10000 });const { mutate } = useSWRConfig();const [open, setOpen] = useState(false);const [refreshing, setRefreshing] = useState(false);@@ -22,6 +31,19 @@ export function WorkspaceSwitcher() {const activeName = data?.active?.name ?? "Sample vault";const hasRemote = !!data?.active;+ // Live git status line — makes "it's a git repo" a constant truth, not a hidden setting.+ const branch = sync?.branch || "main";+ const changes = (sync?.ahead || 0) + (sync?.behind || 0) + (sync?.dirty || 0);+ const [dot, status] = !hasRemote+ ? ["bg-muted-foreground/40", "sample vault · local"]+ : sync?.enabled === false+ ? ["bg-muted-foreground/40", "sync off"]+ : sync?.error+ ? ["bg-amber-500", `${branch} · sync error`]+ : changes > 0+ ? ["bg-amber-500", `${branch} · ↑${sync?.ahead || 0} ↓${sync?.behind || 0}${sync?.dirty ? ` · ${sync.dirty} local` : ""}`]+ : ["bg-emerald-500", `${branch} · synced`];+async function switchTo(id: string) {await fetch("/api/repos/active", { method: "POST", headers: { "content-type": "application/json" }, body: JSON.stringify({ id }) });for (const k of ["/api/repos", "/api/tree", "/api/notes"]) mutate(k);@@ -40,24 +62,32 @@ export function WorkspaceSwitcher() {}return (- <div className="relative flex items-center gap-1 px-2 pb-2">- <button- onClick={() => setOpen((o) => !o)}- className="flex min-w-0 flex-1 items-center gap-2 rounded-md border border-border px-2 py-1.5 text-xs"- >- <span className="flex-1 truncate text-left text-foreground">{activeName}</span>- <ChevronsUpDown size={13} className="shrink-0 text-muted-foreground" />- </button>- {hasRemote && (+ <div className="relative px-2 pb-2">+ <div className="flex items-center gap-1"><button- onClick={refresh}- disabled={refreshing}- title="Pull latest from the remote"- className="inline-flex size-8 shrink-0 items-center justify-center rounded-md border border-border text-muted-foreground transition-colors hover:text-foreground disabled:opacity-50"+ onClick={() => setOpen((o) => !o)}+ className="flex min-w-0 flex-1 items-center gap-2 rounded-md border border-border px-2 py-1.5 text-xs">- <RefreshCw size={13} className={refreshing ? "animate-spin" : ""} />+ <span className="flex-1 truncate text-left text-foreground">{activeName}</span>+ <ChevronsUpDown size={13} className="shrink-0 text-muted-foreground" /></button>- )}+ {hasRemote && (+ <button+ onClick={refresh}+ disabled={refreshing}+ title="Pull latest from the remote"+ className="inline-flex size-8 shrink-0 items-center justify-center rounded-md border border-border text-muted-foreground transition-colors hover:text-foreground disabled:opacity-50"+ >+ <RefreshCw size={13} className={refreshing ? "animate-spin" : ""} />+ </button>+ )}+ </div>++ <div className="mt-1 flex items-center gap-1.5 px-1 text-[10px] text-muted-foreground">+ <span className={`size-1.5 shrink-0 rounded-full ${dot}`} />+ <span className="truncate">{status}</span>+ </div>+{open && (<><div className="fixed inset-0 z-10" onClick={() => setOpen(false)} />