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
address review: star topology tag edges, parent-relative clustering, client tag limits, tab redirect, avoid urgency mutation
Adam Eivydc238147430a
diff --git a/client/src/components/goals/GoalDetailPanel.jsx b/client/src/components/goals/GoalDetailPanel.jsxindex 6ff52143bb..ca6660ade5 100644--- a/client/src/components/goals/GoalDetailPanel.jsx+++ b/client/src/components/goals/GoalDetailPanel.jsx@@ -23,6 +23,9 @@ const HORIZON_OPTIONS = [{ value: 'lifetime', label: 'Lifetime' }];+const MAX_TAGS = 20;+const MAX_TAG_LENGTH = 50;+export { CATEGORY_CONFIG, HORIZON_OPTIONS };export default function GoalDetailPanel({ goal, allGoals, onClose, onRefresh }) {@@ -86,8 +89,8 @@ export default function GoalDetailPanel({ goal, allGoals, onClose, onRefresh })};const addTag = () => {- const tag = tagInput.trim();- if (tag && !form.tags.includes(tag)) {+ const tag = tagInput.trim().slice(0, MAX_TAG_LENGTH);+ if (tag && form.tags.length < MAX_TAGS && !form.tags.includes(tag)) {setForm({ ...form, tags: [...form.tags, tag] });}setTagInput('');@@ -207,7 +210,11 @@ export default function GoalDetailPanel({ goal, allGoals, onClose, onRefresh })placeholder="Add tag..."className="flex-1 bg-port-bg border border-port-border rounded px-2 py-1 text-xs text-white"/>- <button onClick={addTag} className="px-2 py-1 text-xs rounded bg-port-accent/20 text-port-accent">+ <button+ onClick={addTag}+ disabled={form.tags.length >= MAX_TAGS}+ className="px-2 py-1 text-xs rounded bg-port-accent/20 text-port-accent disabled:opacity-50"+ >Add</button></div>diff --git a/client/src/components/goals/GoalsListView.jsx b/client/src/components/goals/GoalsListView.jsxindex f0e184d4ac..32864fba26 100644--- a/client/src/components/goals/GoalsListView.jsx+++ b/client/src/components/goals/GoalsListView.jsx@@ -252,7 +252,6 @@ export default function GoalsListView({ data, onRefresh }) {onToggle={toggleExpand}onSelect={handleSelect}selectedId={selectedGoal?.id}- allGoals={data?.flat}onAddChild={handleAddChild}/>))diff --git a/client/src/components/goals/goalTreeLayout.js b/client/src/components/goals/goalTreeLayout.jsindex 9991501cdd..21b3122af0 100644--- a/client/src/components/goals/goalTreeLayout.js+++ b/client/src/components/goals/goalTreeLayout.js@@ -56,12 +56,13 @@ export function layoutGoalNodes(flatGoals) {let x, y, z;if (parent && radius > 0) {- // Offset from parent position with some spread+ // Offset relative to parent position with a local radius+ const localRadius = RING_RADIUS;const parentAngle = Math.atan2(parent.z, parent.x);const spread = Math.PI / (count + 2);const childAngle = parentAngle + (i - count / 2) * spread;- x = Math.cos(childAngle) * radius;- z = Math.sin(childAngle) * radius;+ x = parent.x + Math.cos(childAngle) * localRadius;+ z = parent.z + Math.sin(childAngle) * localRadius;y = parent.y + (rng() - 0.5) * Y_SPREAD;} else if (radius === 0) {// Center ring - small spread@@ -108,25 +109,27 @@ export function layoutGoalNodes(flatGoals) {tagMap[tag].push(goal.id);}}- const seenPairs = new Set();+ // Star topology: connect each goal to the first goal in the tag group (hub)+ const seenTagEdges = new Set();for (const ids of Object.values(tagMap)) {- for (let i = 0; i < ids.length; i++) {- for (let j = i + 1; j < ids.length; j++) {- const key = [ids[i], ids[j]].sort().join(':');- if (seenPairs.has(key)) continue;- seenPairs.add(key);- // Don't add tag edge if parent-child edge already exists- const a = goalMap.get(ids[i]), b = goalMap.get(ids[j]);- if (a?.parentId === ids[j] || b?.parentId === ids[i]) continue;- if (positioned.has(ids[i]) && positioned.has(ids[j])) {- edges.push({- source: ids[i],- target: ids[j],- type: 'tag',- sourceNode: positioned.get(ids[i]),- targetNode: positioned.get(ids[j])- });- }+ if (ids.length < 2) continue;+ const hub = ids[0];+ for (let i = 1; i < ids.length; i++) {+ const spoke = ids[i];+ const key = [hub, spoke].sort().join(':');+ if (seenTagEdges.has(key)) continue;+ seenTagEdges.add(key);+ // Don't add tag edge if parent-child edge already exists+ const a = goalMap.get(hub), b = goalMap.get(spoke);+ if (a?.parentId === spoke || b?.parentId === hub) continue;+ if (positioned.has(hub) && positioned.has(spoke)) {+ edges.push({+ source: hub,+ target: spoke,+ type: 'tag',+ sourceNode: positioned.get(hub),+ targetNode: positioned.get(spoke)+ });}}}diff --git a/client/src/pages/Goals.jsx b/client/src/pages/Goals.jsxindex 896f9badab..244eece60d 100644--- a/client/src/pages/Goals.jsx+++ b/client/src/pages/Goals.jsx@@ -27,6 +27,12 @@ export default function Goals() {useEffect(() => { loadData(); }, [loadData]);+ useEffect(() => {+ if (rawTab && !VALID_TABS.has(rawTab)) {+ navigate('/goals/tree', { replace: true });+ }+ }, [rawTab, navigate]);+const handleTabChange = (tabId) => {navigate(`/goals/${tabId}`, { replace: true });};diff --git a/server/services/identity.js b/server/services/identity.jsindex f25cabc0b8..89308d2fe5 100644--- a/server/services/identity.js+++ b/server/services/identity.js@@ -803,15 +803,16 @@ export async function getGoalsTree() {const goals = await getGoals();const longevity = await loadJSON(LONGEVITY_FILE, DEFAULT_LONGEVITY);- // Enrich goals with urgency- for (const goal of goals.goals) {+ // Enrich goals with urgency (shallow copies to avoid mutating persisted objects)+ const enriched = goals.goals.map(goal => {if (goal.status === 'active' && longevity.timeHorizons) {- goal.urgency = computeGoalUrgency(goal, longevity.timeHorizons);+ return { ...goal, urgency: computeGoalUrgency(goal, longevity.timeHorizons) };}- }+ return { ...goal };+ });// Build hierarchical tree- const goalMap = new Map(goals.goals.map(g => [g.id, { ...g, children: [] }]));+ const goalMap = new Map(enriched.map(g => [g.id, { ...g, children: [] }]));const roots = [];for (const node of goalMap.values()) {if (node.parentId && goalMap.has(node.parentId)) {@@ -823,7 +824,7 @@ export async function getGoalsTree() {// Build tag index (deduplicated per tag)const tagIndex = {};- for (const goal of goals.goals) {+ for (const goal of enriched) {for (const tag of new Set(goal.tags || [])) {if (!tagIndex[tag]) tagIndex[tag] = [];tagIndex[tag].push(goal.id);@@ -832,7 +833,7 @@ export async function getGoalsTree() {return {roots,- flat: goals.goals,+ flat: enriched,tagIndex,birthDate: goals.birthDate,lifeExpectancy: longevity.lifeExpectancy || goals.lifeExpectancy,