ScuttleBot

ui: stable nick colors — strip session hash suffix before color hashing Agents get a new nick suffix on every relay restart (e.g. 87d771ed → 415b7e12). Strip the hex suffix so color is based on the agent base name (claude-scuttlebot) and stays consistent across sessions.

lmata 2026-04-04 19:15 trunk
Commit dc1fa0ea0a991d98a3d6b2dff05e6ecfbb9bacac4e7f17cbef25be8b3ee0964f
1 file changed +4 -1
--- internal/api/ui/index.html
+++ internal/api/ui/index.html
@@ -1879,12 +1879,15 @@
18791879
}).join('');
18801880
}
18811881
// Nick colors — deterministic hash over a palette
18821882
const NICK_PALETTE = ['#58a6ff','#3fb950','#ffa657','#d2a8ff','#56d364','#79c0ff','#ff7b72','#a5d6ff','#f0883e','#39d353'];
18831883
function nickColor(nick) {
1884
+ // Strip session hash suffix (e.g. claude-scuttlebot-87d771ed → claude-scuttlebot)
1885
+ // so the same agent keeps a stable color across relay restarts.
1886
+ const base = nick.replace(/-[0-9a-f]{6,}$/i, '');
18841887
let h = 0;
1885
- for (let i = 0; i < nick.length; i++) h = (h * 31 + nick.charCodeAt(i)) & 0xffff;
1888
+ for (let i = 0; i < base.length; i++) h = (h * 31 + base.charCodeAt(i)) & 0xffff;
18861889
return NICK_PALETTE[h % NICK_PALETTE.length];
18871890
}
18881891
18891892
let _lastMsgNick = null, _lastMsgAt = 0;
18901893
const GROUP_MS = 5 * 60 * 1000;
18911894
--- internal/api/ui/index.html
+++ internal/api/ui/index.html
@@ -1879,12 +1879,15 @@
1879 }).join('');
1880 }
1881 // Nick colors — deterministic hash over a palette
1882 const NICK_PALETTE = ['#58a6ff','#3fb950','#ffa657','#d2a8ff','#56d364','#79c0ff','#ff7b72','#a5d6ff','#f0883e','#39d353'];
1883 function nickColor(nick) {
 
 
 
1884 let h = 0;
1885 for (let i = 0; i < nick.length; i++) h = (h * 31 + nick.charCodeAt(i)) & 0xffff;
1886 return NICK_PALETTE[h % NICK_PALETTE.length];
1887 }
1888
1889 let _lastMsgNick = null, _lastMsgAt = 0;
1890 const GROUP_MS = 5 * 60 * 1000;
1891
--- internal/api/ui/index.html
+++ internal/api/ui/index.html
@@ -1879,12 +1879,15 @@
1879 }).join('');
1880 }
1881 // Nick colors — deterministic hash over a palette
1882 const NICK_PALETTE = ['#58a6ff','#3fb950','#ffa657','#d2a8ff','#56d364','#79c0ff','#ff7b72','#a5d6ff','#f0883e','#39d353'];
1883 function nickColor(nick) {
1884 // Strip session hash suffix (e.g. claude-scuttlebot-87d771ed → claude-scuttlebot)
1885 // so the same agent keeps a stable color across relay restarts.
1886 const base = nick.replace(/-[0-9a-f]{6,}$/i, '');
1887 let h = 0;
1888 for (let i = 0; i < base.length; i++) h = (h * 31 + base.charCodeAt(i)) & 0xffff;
1889 return NICK_PALETTE[h % NICK_PALETTE.length];
1890 }
1891
1892 let _lastMsgNick = null, _lastMsgAt = 0;
1893 const GROUP_MS = 5 * 60 * 1000;
1894

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button