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
feat([issue-899]): extend BrainGraph to include goals and journal nodes
Adam Eivy8d56867c998c
diff --git a/client/src/components/brain/constants.js b/client/src/components/brain/constants.jsindex 631a510e00..bbcc0d17f3 100644--- a/client/src/components/brain/constants.js+++ b/client/src/components/brain/constants.js@@ -1,4 +1,4 @@-import { MessageSquare, Database, Calendar, Rss, Shield, Users, FolderKanban, Lightbulb, ClipboardList, Settings, Link2, BookOpen, Network, FileText, NotebookPen, Upload } from 'lucide-react';+import { MessageSquare, Database, Calendar, Rss, Shield, Users, FolderKanban, Lightbulb, ClipboardList, Settings, Link2, BookOpen, Network, FileText, NotebookPen, Upload, Target, BookText } from 'lucide-react';// Main navigation tabs.// `fullBleed: true` marks a tab that fills the available height and owns its@@ -57,6 +57,16 @@ export const DESTINATIONS = {icon: BookOpen,color: 'bg-pink-500/20 text-pink-400 border-pink-500/30'},+ goals: {+ label: 'Goals',+ icon: Target,+ color: 'bg-orange-500/20 text-orange-400 border-orange-500/30'+ },+ journals: {+ label: 'Journal',+ icon: BookText,+ color: 'bg-teal-500/20 text-teal-400 border-teal-500/30'+ },unknown: {label: 'Unknown',icon: MessageSquare,@@ -115,6 +125,8 @@ export const BRAIN_TYPE_HEX = {projects: '#3b82f6',ideas: '#eab308',admin: '#22c55e',- memories: '#ec4899'+ memories: '#ec4899',+ goals: '#f97316',+ journals: '#14b8a6'};diff --git a/client/src/components/brain/tabs/BrainGraph.jsx b/client/src/components/brain/tabs/BrainGraph.jsxindex 39b0b214a9..cdcaf45a83 100644--- a/client/src/components/brain/tabs/BrainGraph.jsx+++ b/client/src/components/brain/tabs/BrainGraph.jsx@@ -18,7 +18,7 @@ const EDGE_COLORS = {linked: '#ffffff'};-const BRAIN_TYPES = ['people', 'projects', 'ideas', 'admin', 'memories'];+const BRAIN_TYPES = ['people', 'projects', 'ideas', 'admin', 'memories', 'goals', 'journals'];// Per-type API getters for detail panelconst TYPE_GETTERS = {@@ -26,7 +26,9 @@ const TYPE_GETTERS = {projects: api.getBrainProject,ideas: api.getBrainIdea,admin: api.getBrainAdminItem,- memories: api.getBrainMemory+ memories: api.getBrainMemory,+ goals: api.getBrainGoal,+ journals: api.getBrainJournalEntry};function GraphEdges({ simEdges, selectedId }) {@@ -587,11 +589,19 @@ export default function BrainGraph() {<h3 className="text-sm font-medium text-white mb-1">{selectedNode.label}</h3>{fullRecord ? (<div className="space-y-3">- {(fullRecord.context || fullRecord.oneLiner || fullRecord.notes || fullRecord.content) && (+ {(fullRecord.description || fullRecord.context || fullRecord.oneLiner || fullRecord.notes || fullRecord.content) && (<p className="text-sm text-gray-300 whitespace-pre-wrap">- {fullRecord.context || fullRecord.oneLiner || fullRecord.notes || fullRecord.content}+ {fullRecord.description || fullRecord.context || fullRecord.oneLiner || fullRecord.notes || fullRecord.content}</p>)}+ {typeof fullRecord.progress === 'number' && (+ <div className="flex items-center gap-2">+ <div className="flex-1 h-1.5 bg-port-border rounded-full overflow-hidden">+ <div className="h-full bg-port-accent rounded-full" style={{ width: `${fullRecord.progress}%` }} />+ </div>+ <span className="text-xs text-gray-500">{fullRecord.progress}%</span>+ </div>+ )}{fullRecord.tags?.length > 0 && (<div className="flex flex-wrap gap-1">{fullRecord.tags.map(tag => (@@ -602,6 +612,8 @@ export default function BrainGraph() {<div className="text-xs text-gray-500 flex flex-wrap gap-3">{fullRecord.createdAt && <span>Created: {new Date(fullRecord.createdAt).toLocaleDateString()}</span>}{fullRecord.nextAction && <span>Next: {fullRecord.nextAction}</span>}+ {fullRecord.horizon && <span>Horizon: {fullRecord.horizon}</span>}+ {fullRecord.targetDate && <span>Target: {fullRecord.targetDate}</span>}</div></div>) : (diff --git a/client/src/services/apiBrain.js b/client/src/services/apiBrain.jsindex f6cf423365..b333646096 100644--- a/client/src/services/apiBrain.js+++ b/client/src/services/apiBrain.js@@ -207,6 +207,16 @@ export const reorderBrainBuckets = (ids) => request('/brain/buckets/reorder', {body: JSON.stringify({ ids })});+// Brain - Goals (identity system, read-only view for the graph detail panel)+export const getBrainGoal = (id) =>+ request('/digital-twin/identity/goals').then(data =>+ (data?.goals ?? []).find(g => g.id === id) ?? null+ );++// Brain - Journal entries (Daily Log)+export const getBrainJournalEntry = (date) =>+ request(`/brain/daily-log/${encodeURIComponent(date)}`).then(r => r?.entry ?? r);+// Brain - Graph. Bounded by design: no `focus` returns an overview of the// most-connected nodes; a `focus` returns that node's neighborhood. The full// graph is never returned (it crashes the browser at scale).diff --git a/server/services/brainGraph.js b/server/services/brainGraph.jsindex c02a8fce91..98da528254 100644--- a/server/services/brainGraph.js+++ b/server/services/brainGraph.js@@ -18,6 +18,7 @@import * as brainStorage from './brainStorage.js';import * as memoryBackend from './memoryBackend.js';import { loadBridgeMap, bridgeKey } from './brainMemoryBridge.js';+import { getGoals } from './identity.js';const ENTITY_TYPES = ['people', 'projects', 'ideas', 'admin', 'memories'];@@ -65,6 +66,40 @@ async function loadNodes() {});}}++ // Goals (identity system): active + paused goals as graph nodes+ const goalsData = await getGoals().catch(() => null);+ for (const goal of goalsData?.goals ?? []) {+ if (goal.status === 'archived' || goal.status === 'deleted') continue;+ nodes.push({+ id: goal.id,+ brainType: 'goals',+ label: goal.title || '(untitled goal)',+ summary: goal.description || '',+ tags: goal.tags || [],+ importance: goal.status === 'active' ? 0.75 : 0.5,+ status: goal.status,+ progress: goal.progress+ });+ }++ // Journals (Daily Log): non-empty dated entries as graph nodes+ const journals = await brainStorage.getAll('journals').catch(() => []);+ for (const entry of journals) {+ if (!entry.content && !entry.segments?.length) continue;+ const date = entry.id || entry.date;+ if (!date) continue;+ nodes.push({+ id: date,+ brainType: 'journals',+ label: date,+ summary: entry.content ? entry.content.slice(0, 120) : '',+ tags: [],+ importance: 0.4,+ status: undefined+ });+ }+return nodes;}