Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
show which Ollama models are loaded in memory on the Local LLM Playground
[._.]/ Adam Eivy7b3762bca8b8
diff --git a/.changelog/NEXT.md b/.changelog/NEXT.mdindex 214ad004ac..38a37db0eb 100644--- a/.changelog/NEXT.md+++ b/.changelog/NEXT.md@@ -4,6 +4,8 @@- **[issue-1408] LoRA training quality-of-life: vision-assisted reference-sheet slicing, caption with Claude/Codex CLI providers, and a richer training queue.** Three improvements to building character LoRAs (Create → LoRA Training). **(1) Smarter sheet slicing** — "Slice reference sheet" now offers *Auto-detect figures with a vision model*, which asks a vision model to draw a tight box around each figure on the turnaround and crops those instead of a rigid grid; it falls back to the columns×rows grid automatically when no vision model is installed or detection finds nothing, so you still get crops to prune either way. **(2) Caption with a CLI model** — the caption-model picker now also lists vision-capable CLI providers (Codex / Claude Code), so you can auto-caption a dataset with `codex` or `claude` (vision) rather than only a local LM Studio / Ollama vision model. **(3) Training queue at a glance** — the new Training queue on the LoRA Training page shows each run's loss curve (a sparkline over its checkpoints) and sample thumbnails right in the row, so you can watch a run learn — and spot a divergence — without opening it. (Part of #1227, #1408)- **[issue-1412] Editorial check classifies unmodeled proper nouns used as character names — the LLM-assisted half of roster economy.** A new **Unmodeled proper nouns used as character names** LLM check (Create → Editorial Checks) closes the gap the deterministic **roster economy** check (#1292) deliberately left open: that scan only sees canon names + aliases, so a proper noun used as an *apparent* character name that was never added to the story bible is invisible to it. This check surfaces those — and **classifies** each one, because a keyword scan can't tell a person from a place, organization, brand, or honorific. It reads the stitched manuscript plus your canon roster (names + aliases) as an exclusion list, flags capitalized proper nouns used as character names that are **absent from canon**, and calls out **throwaway one-appearance names** the reader is told to remember but who never recur — suggesting either adding them to canon or recasting them as an unnamed description. Unlike roster economy it runs even on an **empty bible** (then every named proper noun is a candidate). The LLM does only the judgment it alone can — surface a name and confirm it's a *person* — while a **deterministic pass counts each surfaced name's appearances across the whole manuscript and authors the verdict** (one-appearance throwaway vs recurring), so a long book reviewed in chunks never mislabels a name that appears in chapters 1 and 12 as a throwaway (and the same name surfaced from two chunks collapses to one finding). Findings render as `Casting` notes anchored to the issue + a verbatim quote. Ships a new stage prompt (`pipeline-editorial-unmodeled-names`) that migrates for existing installs (116). (`server/lib/editorial/checkRegistry.js`, `data.reference/prompts/stages/pipeline-editorial-unmodeled-names.md`, `scripts/migrations/116-editorial-unmodeled-names-stage.js`, Part of #1283, #1412)+- **The Local LLM Playground now shows which Ollama models are warm in memory (and which one is processing).** The models sidebar reads Ollama's `/api/ps` (the same loaded-model probe the Memory Management panel uses) and flags each resident model with a green **In memory** badge carrying its VRAM footprint, plus a relative **"frees in Nm"** countdown until Ollama auto-evicts it. While a run is in flight, the model(s) it's driving show a **Processing** badge with a live spinner — derived from the playground's own in-flight run since `/api/ps` reports residency but not which model is mid-generation. A header chip summarizes **"N in memory"** at a glance. The loaded list polls every 6s (2s while busy) and refreshes on the manual refresh button. (`client/src/pages/LocalLlmPlayground.jsx`)+- **[issue-1317] Editorial check flags theme-coherence problems — themes stated but never dramatized, dropped after the opening, or unpaid at the climax (plus emergent-theme detection).** A new **Theme coherence / thematic throughline** LLM check (Create → Editorial Checks) asks whether the manuscript actually *delivers* the themes the story arc declares (`series.arc.themes`), not just names them. For each declared theme it builds a setup → complication → payoff coverage map and flags a theme that is **stated but never dramatized** through a character's choices or the central conflict, a theme that is **dropped** after the opening, and a climax that **resolves the plot but never lands the thematic argument** the setup promised. It also detects a strong **emergent theme** the story is really telling that isn't in the declared list — offering to add it (or reconciling it when the story drifts into a competing argument). It reads your reverse-outline scene segmentation as context so it can attribute a theme's setup/payoff to a scene + issue, and **degrades gracefully** — no authored themes ⇒ it works from the prose alone to surface emergent themes; no outline ⇒ it scans the whole manuscript. Whole-arc judgments (a dropped theme, an unpaid climax) are deferred until it has seen the final chunk, and cross-chunk findings + clean-setup digests keep a long book reviewed in pieces from false-flagging a theme whose payoff lands later. Findings render as `Theme` notes anchored to the issue + a verbatim quote. Ships a new stage prompt (`pipeline-editorial-theme-coherence`) that migrates for existing installs (115). (`server/lib/editorial/checkRegistry.js`, `server/services/pipeline/editorial/checkRunner.js`, `data.reference/prompts/stages/pipeline-editorial-theme-coherence.md`, `scripts/migrations/115-editorial-theme-coherence-stage.js`, Part of #1283, #1317)- **[issue-1316] Editorial health score + revision-trend tracking — *manage* the draft, not just receive findings.** A new **Editorial Health** panel (Create → Editorial Checks, alongside the findings triage) turns the point-in-time manuscript-review findings into a metric you can steer by. A transparent, deterministic **health score** (0–100, per series with a per-issue drill-down) is computed from the OPEN findings weighted by severity — `100 − Σ weight(severity)` with published weights (high 12 / medium 5 / low 1), so it's never a black box; accepted (fixed) and dismissed (waived) findings cost nothing. A **revision-trend ledger** snapshots the open-finding counts (by severity + category) on each editorial-checks / completeness run — the run is the revision boundary — so the panel renders a **score sparkline** across revisions, the most-recent-revision **delta**, and per-category **regressions** (a category that got *worse* after an edit pass). A configurable **readiness gate** ("no open high findings" by default, or the stricter "no high or medium", or "none") is the convergence signal the UI shows as **Ready / Not ready** *and* that the **autopilot editorial loop** now reads as a final gate (`editorialHealthGate`): after both editorial passes seed their findings, autopilot pauses with the residual blockers if the manuscript isn't clean — catching a blocker the registry checks surface *after* the completeness loop converged. The trend ledger is install-local telemetry (`data/pipeline-editorial-health/{seriesId}.json`, not synced); the score/readiness are derived live from the synced review. Scoring is pure + unit-tested. (`server/services/pipeline/editorialScore.js`, `server/routes/pipeline/editorial.js`, `server/services/pipeline/{editorial/checkRunner,manuscriptCompletenessRunner,seriesAutopilot}.js`, `client/src/components/pipeline/editorial/EditorialHealthPanel.jsx`, `client/src/lib/editorialHealth.js`, Part of #1283, #1316)diff --git a/client/src/pages/LocalLlmPlayground.jsx b/client/src/pages/LocalLlmPlayground.jsxindex c205472874..81bca1f58f 100644--- a/client/src/pages/LocalLlmPlayground.jsx+++ b/client/src/pages/LocalLlmPlayground.jsx@@ -1,13 +1,13 @@import { useCallback, useEffect, useMemo, useRef, useState } from 'react';import { Link, useSearchParams } from 'react-router-dom';-import { ArrowLeft, ArrowRightLeft, Brain, Check, ChevronDown, Clock, Copy, Gauge, MessageSquare, Play, RefreshCw, Send, TriangleAlert, X } from 'lucide-react';+import { ArrowLeft, ArrowRightLeft, Brain, Check, ChevronDown, Clock, Copy, Cpu, Gauge, MessageSquare, Play, RefreshCw, Send, TriangleAlert, X } from 'lucide-react';import BrailleSpinner from '../components/BrailleSpinner';import PlaygroundOutput from '../components/localLlm/PlaygroundOutput';import toast from '../components/ui/Toast';import { copyToClipboard } from '../lib/clipboard';import { localLlmTargetKey } from '../lib/localLlmTargetKey';-import { formatBytes, recommendedRamGb } from '../utils/formatters';-import { compareLocalLlmModels, getLocalLlmCatalog, getLocalLlmStatus, streamLocalLlmTest } from '../services/api';+import { formatBytes, recommendedRamGb, timeUntil } from '../utils/formatters';+import { compareLocalLlmModels, getLoadedLlmModels, getLocalLlmCatalog, getLocalLlmStatus, streamLocalLlmTest } from '../services/api';const BACKEND_LABEL = { ollama: 'Ollama', lmstudio: 'LM Studio' };const DEFAULT_PROMPT = 'Write a short, vivid paragraph about a lighthouse computer waking up at dawn.';@@ -42,6 +42,16 @@ function formatRate(value) {return `${value.toFixed(value >= 10 ? 1 : 2)} chars/s`;}+// Ollama auto-evicts an idle model after `keep_alive` (5m default). `/api/ps`+// returns the absolute eviction time as `expires_at`; render it as a short+// "frees in 5m" countdown so the badge says when the slot frees itself. Reuses+// the shared future-relative formatter, returning null (badge hidden) once the+// slot has expired or no eviction time is reported.+function formatExpiresIn(expiresAt) {+ const rel = timeUntil(expiresAt, null);+ return rel ? rel.replace(/^in /, 'frees in ') : null;+}+function modelSizeLabel(model) {if (Number.isFinite(model?.size)) return formatBytes(model.size);return model?.catalog?.size || '';@@ -93,6 +103,16 @@ function parseTargetsParam(searchParams) {return [];}+// Tiny status pill used for the sidebar memory badges (In memory / Processing /+// frees-in). Keeps the shared chrome in one place; callers pass only the color.+function Pill({ className, children }) {+ return (+ <span className={`inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-[10px] leading-none ${className}`}>+ {children}+ </span>+ );+}+function Metric({ icon: Icon, label, value }) {return (<div className="flex items-center gap-1.5 text-xs text-gray-400">@@ -201,6 +221,10 @@ export default function LocalLlmPlayground() {const [catalogByBackend, setCatalogByBackend] = useState({});const [loadingStatus, setLoadingStatus] = useState(true);const [modelLoadError, setModelLoadError] = useState('');+ // Ollama models currently resident in VRAM/unified memory (from `/api/ps`),+ // polled so the sidebar can flag which models are warm — and which one is+ // actively serving the in-flight run.+ const [loadedModels, setLoadedModels] = useState([]);const [selectedTargets, setSelectedTargets] = useState(() => parseTargetsParam(searchParams));const [activeMode, setActiveMode] = useState(() => searchParams.get('mode') === 'compare' ? 'compare' : 'chat');const [runMode, setRunMode] = useState('round-robin');@@ -271,6 +295,20 @@ export default function LocalLlmPlayground() {useEffect(() => { loadStatus(); }, [loadStatus]);+ const refreshLoaded = useCallback(() => {+ return getLoadedLlmModels({ silent: true })+ .then((res) => { if (mountedRef.current) setLoadedModels(res?.ollama || []); })+ .catch(() => { if (mountedRef.current) setLoadedModels([]); });+ }, []);++ // Poll which models are warm in memory. A faster cadence while a run is busy+ // so the "serving" flag and freed-slot countdown stay live; relaxed when idle.+ useEffect(() => {+ refreshLoaded();+ const interval = setInterval(refreshLoaded, busy ? 2000 : 6000);+ return () => clearInterval(interval);+ }, [refreshLoaded, busy]);+const installedTargets = useMemo(() => {const models = [];for (const backend of ['ollama', 'lmstudio']) {@@ -292,12 +330,32 @@ export default function LocalLlmPlayground() {return models;}, [catalogByBackend, status]);+ // Map each warm Ollama model to its installed-row key so the sidebar can+ // match it. `/api/ps` reports the same tagged name `/api/tags` does, so the+ // shared `normalizeCatalogId` reconciles `:latest` and casing on both sides.+ const loadedByKey = useMemo(() => {+ const map = new Map();+ for (const m of loadedModels) {+ const key = normalizeCatalogId('ollama', m.id || m.name);+ if (key) map.set(key, m);+ }+ return map;+ }, [loadedModels]);+useEffect(() => {if (selectedTargets.length > 0 || installedTargets.length === 0) return;setSelectedTargets([{ backend: installedTargets[0].backend, modelId: installedTargets[0].modelId }]);}, [installedTargets, selectedTargets.length]);const selectedKeys = useMemo(() => new Set(selectedTargets.map(localLlmTargetKey)), [selectedTargets]);+ // `/api/ps` reports what's resident but not which model is mid-generation, so+ // derive the "processing" flag from our own in-flight run: the streaming chat+ // target, or every target in a busy comparison.+ const runningKeys = useMemo(() => {+ if (!busy) return new Set();+ if (activeMode === 'chat') return streamingChat ? new Set([localLlmTargetKey(streamingChat)]) : new Set();+ return new Set(selectedTargets.map(localLlmTargetKey));+ }, [busy, activeMode, streamingChat, selectedTargets]);const primaryTarget = selectedTargets[0] || null;const canRunChat = Boolean(primaryTarget && prompt.trim());const canCompare = selectedTargets.length > 0 && prompt.trim();@@ -394,10 +452,15 @@ export default function LocalLlmPlayground() {</Link><div className="min-w-0"><h1 className="text-lg md:text-2xl font-bold text-white truncate">Local LLM Playground</h1>- <p className="text-xs md:text-sm text-gray-500 truncate">{selectedTargets.length} model{selectedTargets.length === 1 ? '' : 's'} selected</p>+ <p className="text-xs md:text-sm text-gray-500 truncate">+ {selectedTargets.length} model{selectedTargets.length === 1 ? '' : 's'} selected+ {loadedModels.length > 0 && (+ <span className="text-port-success"> · {loadedModels.length} in memory</span>+ )}+ </p></div></div>- <button onClick={loadStatus} disabled={loadingStatus} className="p-2 text-gray-400 hover:text-white transition-colors" title="Refresh models" aria-label="Refresh models">+ <button onClick={() => { loadStatus(); refreshLoaded(); }} disabled={loadingStatus} className="p-2 text-gray-400 hover:text-white transition-colors" title="Refresh models" aria-label="Refresh models"><RefreshCw size={16} className={loadingStatus ? 'animate-spin' : ''} /></button></div>@@ -438,6 +501,9 @@ export default function LocalLlmPlayground() {const size = modelSizeLabel(target);const ram = recommendedRamGb(target?.size, target?.catalog?.size);const tags = getUseCaseTags(target);+ const loaded = backend === 'ollama' ? loadedByKey.get(normalizeCatalogId('ollama', target.modelId)) : null;+ const running = runningKeys.has(localLlmTargetKey(target));+ const freesIn = loaded ? formatExpiresIn(loaded.expiresAt) : null;const detailParts = [target.catalog?.params || target.params,size,@@ -455,6 +521,24 @@ export default function LocalLlmPlayground() {<span className="min-w-0 flex-1 space-y-1"><span className="block text-sm text-white truncate">{target.name}</span><span className="block text-xs text-gray-500 truncate">{target.modelId}</span>+ {(loaded || running) && (+ <span className="flex flex-wrap items-center gap-1 pt-0.5">+ {running ? (+ <Pill className="bg-port-accent/15 text-port-accent">+ <BrailleSpinner />+ Processing+ </Pill>+ ) : (+ <Pill className="bg-port-success/15 text-port-success">+ <Cpu size={10} />+ In memory{Number.isFinite(loaded?.sizeVram) ? ` · ${formatBytes(loaded.sizeVram)}` : ''}+ </Pill>+ )}+ {!running && freesIn && (+ <Pill className="bg-port-border/70 text-gray-400">{freesIn}</Pill>+ )}+ </span>+ )}{detailParts.length > 0 && (<span className="block text-[11px] text-gray-400 truncate">{detailParts.join(' · ')}</span>)}diff --git a/client/src/pages/LocalLlmPlayground.test.jsx b/client/src/pages/LocalLlmPlayground.test.jsxindex 0aae2f25a3..1514f0ee40 100644--- a/client/src/pages/LocalLlmPlayground.test.jsx+++ b/client/src/pages/LocalLlmPlayground.test.jsx@@ -5,6 +5,7 @@ import { MemoryRouter } from 'react-router-dom';vi.mock('../services/api', () => ({getLocalLlmStatus: vi.fn(),getLocalLlmCatalog: vi.fn(),+ getLoadedLlmModels: vi.fn(),testLocalLlmModel: vi.fn(),streamLocalLlmTest: vi.fn(),compareLocalLlmModels: vi.fn(),@@ -15,7 +16,7 @@ vi.mock('../components/ui/Toast', () => ({}));import LocalLlmPlayground from './LocalLlmPlayground';-import { getLocalLlmCatalog, getLocalLlmStatus, streamLocalLlmTest } from '../services/api';+import { getLoadedLlmModels, getLocalLlmCatalog, getLocalLlmStatus, streamLocalLlmTest } from '../services/api';const renderPlayground = () => render(<MemoryRouter initialEntries={['/local-llm/playground?backend=ollama&model=command-r-plus%3A104b']}>@@ -41,6 +42,7 @@ beforeEach(() => {},lmstudio: { models: [] },});+ getLoadedLlmModels.mockResolvedValue({ ollama: [] });getLocalLlmCatalog.mockResolvedValue({backend: 'ollama',models: [@@ -70,6 +72,21 @@ describe('LocalLlmPlayground', () => {expect(screen.getByText('Multilingual')).toBeTruthy();});+ it('flags a model that is resident in memory with its VRAM size', async () => {+ getLoadedLlmModels.mockResolvedValue({+ ollama: [+ // Ollama's /api/ps reports the tagged name and VRAM footprint; the+ // sidebar should reconcile it to the installed row and show "In memory".+ { id: 'command-r-plus:104b', name: 'command-r-plus:104b', size: 59 * 1024 ** 3, sizeVram: 60 * 1024 ** 3, expiresAt: null },+ ],+ });++ renderPlayground();++ await waitFor(() => expect(screen.getByText(/In memory/)).toBeTruthy());+ expect(screen.getByText(/1 in memory/)).toBeTruthy();+ });+it('renders a live "Thinking" block for streamed reasoning, separate from the answer', async () => {// Drive reasoning tokens then a content token through the streaming callback,// mirroring a reasoning model (deepseek-r1, qwq) that emits its chain-of-thought