SLOPSHOPPER

everforest-zen

A calm Everforest tree above your Claude Code prompt

bandspinnerguardtoastpromptprocess
v1.1.0MITupdated 2026-10-19MarDevMint/everforest-zen
A shopper browsing a rack in a slop shop
Preview · a replayed session in a sandbox
claude · ~/work/app · everforest-zen
› fix the failing auth test and add an audit log call ⏺ Read(src/auth.ts) ⎿ Read 6 lines ⏺ Update(src/auth.ts) ⎿ Added 2 lines, removed 1 line ⏺ Bash(bun test) ⎿ 3 pass, 1 fail ● Done. refresh now rejects expired claims and logs an audit event. ✻ Worked for 42s · done 4:20 PM Oo. ° Breathing ° .oO (0s) -.@@@&@@@@@@#-. * (.@@&@@@@@@@@@@&#####.) ((@@@@@@@@@@########%%#))  files cache.ts · audit.ts +1 (@@@@&@\@@#####/#%%%%%)  context ━━━━──── 49% ''##@@\%|%/##%%''  session ━━────── 31% NaNm \|/  time 30m (|) ~,~~~~~~~_,/(|)\,_~~~',',,' ────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── › ? for shortcuts

Draws

Band
-.@@@&@@@@@@#-. * (.@@&@@@@@@@@@@&#####.) ((@@@@@@@@@@########%%#))  files cache.ts · audit.ts +1 (@@@@&@\@@#####/#%%%%%)  context ━━━━──── 49% ''##@@\%|%/##%%''  session ━━────── 31% NaNm \|/  time 30m (|) ~,~~~~~~~_,/(|)\,_~~~',',,'
Spinner
Oo. ° Breathing ° .oO (0s)
README

everforest-zen

A calm Everforest tree above your Claude Code prompt.

everforest-zen

  • the crown sways while Claude works, turns cyan with subagents and blue on the web
  • context and session use at a glance
  • follows your clock: lighter by day, darker at night, fireflies after dusk
  • blooms like a cherry tree when the context runs high
  • soft wind when a turn ends, a small bird when Claude needs you
  • a gentle reminder to breathe every 50 minutes

Install

/plugin install everforest-zen --marketplace MarDevMint/everforest-zen

Needs Claude Code with mods (2.1.287+). Sounds play on Linux with PipeWire or PulseAudio.

Settings

Sounds, icons, the breathe reminder and the bloom threshold are in /config.

Make it yours

Everything lives in hooks/register.tsx: the palette, the tree, the words. Fork it, edit, and run claude --plugin-dir ./everforest-zen to try your changes.

MIT

Source 2 files
hooks/register.tsx 570 lines
1import { atom, read, update } from 'claude-code'
2import type { Register, SessionRateLimit } from 'claude-code'
3
4import type { Limits } from '../types'
5
6const tick = atom({ plugin: 'everforest-zen', key: 'tick' } as const, 0)
7const limits = atom({ plugin: 'everforest-zen', key: 'limits' } as const, null)
8const files = atom({ plugin: 'everforest-zen', key: 'files' } as const, [])
9const startedAt = atom({ plugin: 'everforest-zen', key: 'startedAt' } as const, null)
10const agents = atom({ plugin: 'everforest-zen', key: 'agents' } as const, 0)
11const activity = atom({ plugin: 'everforest-zen', key: 'activity' } as const, 0)
12const turnStart = atom({ plugin: 'everforest-zen', key: 'turnStart' } as const, 0)
13const lastBreath = atom({ plugin: 'everforest-zen', key: 'lastBreath' } as const, 0)
14const restUntil = atom({ plugin: 'everforest-zen', key: 'restUntil' } as const, 0)
15const bloomNoted = atom({ plugin: 'everforest-zen', key: 'bloomNoted' } as const, false)
16const context = atom({ plugin: 'everforest-zen', key: 'context' } as const, null)
17
18// settings, from the plugin's userConfig (see plugin.json); set in register
19let NERD = true
20let SOUND = true
21let BLOOM_AT = 80
22let BREATHE_EVERY = 50
23let HIDE_IN_IDE = true
24const REST_MS = 60_000
25
26// the tree belongs to a plain terminal: inside a code editor (VS Code and its
27// forks, JetBrains, Zed) it steps aside and leaves the editor's own look alone
28let IN_IDE = false
29
30const detectIde = (termProgram?: string, emulator?: string): boolean =>
31  termProgram === 'vscode' || termProgram === 'zed' || (emulator ?? '').startsWith('JetBrains')
32
33// draw the tree only on a real terminal, never in an editor's panel
34const quiet = (surface: string) => HIDE_IN_IDE && (surface !== 'terminal' || IN_IDE)
35
36// Everforest dark palette
37const C = {
38  far: '#3f5245',
39  back: '#56705a',
40  deep: '#4a6350',
41  mid: '#7d9a6b',
42  light: '#a7c080',
43  aqua: '#83c092',
44  trunk: '#7a6d5a',
45  bark: '#9a8a70',
46  grass: '#859289',
47  fg: '#d3c6aa',
48  yellow: '#dbbc7f',
49  blue: '#7fbbb3',
50  pink: '#d699b6',
51  moss: '#b5b27a',
52  brown: '#a68b5b',
53  earth: '#8c6a4a',
54  empty: '#4f585e',
55  hint: '#7a8478',
56  firefly: '#dbbc7f',
57  glowLeaf: '#c9d9a0',
58}
59
60const ROWS = 8
61const TW = 27
62const GAP = 3
63
64type Cell = { ch: string; color: string; glow?: boolean }
65type Seg = { text: string; color: string }
66
67const noise = (x: number, y: number, salt = 0) => {
68  let n = Math.imul(x + 11, 73856093) ^ Math.imul(y + 7, 19349663) ^ Math.imul(salt + 3, 83492791)
69  n = Math.imul(n ^ (n >>> 13), 1274126177)
70  return ((n ^ (n >>> 16)) >>> 0) % 1000 / 1000
71}
72
73// 1 by day, 0.4 at night, ramping through dawn (5-8h) and dusk (18-21h)
74const brightness = (h: number): number => {
75  if (h >= 8 && h < 18) return 1
76  if (h >= 18 && h < 21) return 1 - ((h - 18) / 3) * 0.6
77  if (h >= 5 && h < 8) return 0.4 + ((h - 5) / 3) * 0.6
78  return 0.4
79}
80
81// darken a colour toward the Everforest bg, so night stays green, only deeper
82const dim = (hex: string, f: number): string => {
83  if (f >= 1) return hex
84  const bg = [43, 51, 57]
85  const out = [1, 3, 5].map((i, k) => {
86    const c = parseInt(hex.slice(i, i + 2), 16)
87    return Math.round(bg[k]! + (c - bg[k]!) * f).toString(16).padStart(2, '0')
88  })
89  return `#${out.join('')}`
90}
91
92const put = (grid: Cell[][], row: number, col: number, ch: string, color: string, glow = false) => {
93  if (row < 0 || row >= grid.length || col < 0 || col >= TW || ch === ' ') return
94  grid[row]![col] = { ch, color, glow }
95}
96
97// shimmer: a stirred leaf takes the next shade
98const STIR: Record<string, string> = { '@': '&', '#': '@', '%': '#', '&': '%' }
99
100export type Mode = 'idle' | 'work' | 'agents' | 'web' | 'rest'
101
102// the crown's three shades per mode: green at rest, cyan with company, blue on the web
103// cherry blossom, in Everforest's own pink
104const SAKURA: [string, string, string] = ['#e8b8cc', '#d699b6', '#a97a92']
105
106const CROWN: Record<Mode, [string, string, string]> = {
107  idle: ['#a7c080', '#7d9a6b', '#56705a'],
108  work: ['#a7c080', '#7d9a6b', '#56705a'],
109  agents: ['#83c092', '#5f9a84', '#3f6b5e'],
110  web: ['#7fbbb3', '#5b8f8a', '#3e6466'],
111  rest: ['#d8c48a', '#b5a46e', '#8f8158'],
112}
113
114/**
115 * One detailed tree, always full. At rest it sways; while Claude works a band
116 * of light sweeps through the crown; with subagents or on the web, a wave of
117 * cyan or blue flows through the leaves.
118 */
119const tree = (t: number, mode: Mode, hour: number, workSecs: number, blooming: boolean): Cell[][] => {
120  const grid: Cell[][] = Array.from({ length: ROWS }, () =>
121    Array.from({ length: TW }, () => ({ ch: ' ', color: C.grass })),
122  )
123  const light = brightness(hour)
124  const busy = mode !== 'idle'
125  const fill = 0.97
126  const cx = 13
127  const cy = 2.1
128  const rx = 12.2
129  const ry = 2.75
130  // once the context runs high the tree blooms: pink blossom among the green
131  const green = CROWN.idle
132  const tinted = CROWN[mode]
133
134  for (let y = 0; y < 5; y++) {
135    for (let x = 0; x < TW; x++) {
136      const dx = (x - cx) / rx
137      const dy = (y - cy) / ry
138      const d = dx * dx + dy * dy
139      if (d > 1) continue
140      const edge = d > 0.78
141      if (noise(x, y) > fill + (edge ? 0.04 : 0.1)) continue
142
143      // which palette this leaf wears now: a diagonal wave drifting through the crown
144      const inWave =
145        ((mode === 'agents' || mode === 'web') && (((x + y * 2 - t) % 12) + 12) % 12 < 7) ||
146        // time to rest: a slow warm wave, like late afternoon light
147        (mode === 'rest' && (((x - y - Math.floor(t / 2)) % 10) + 10) % 10 < 6)
148      const blossom = blooming && noise(x, y, 11) < 0.7
149      const pal = inWave ? tinted : blossom ? SAKURA : green
150      // while working, a soft band of light passes left to right
151      const lit = mode === 'work' && (((x - t) % 18) + 18) % 18 < 3
152
153      if (edge) {
154        const side = Math.abs(dx) > 0.82
155        const ch = side ? (dx < 0 ? '(' : ')') : dy < 0 ? (noise(x, y, 1) > 0.5 ? '.' : '-') : "'"
156        put(grid, y, x, ch, lit ? C.glowLeaf : pal[0])
157        continue
158      }
159      // light falls from the top left; leaves grow in clumps
160      const clump = noise(Math.floor(x / 3), Math.floor(y / 2), 2)
161      const shade = -0.6 * dx - 0.5 * dy + (clump - 0.5) * 0.9
162      const [ch, color] = shade > -0.05 ? ['@', pal[0]] : shade > -0.5 ? ['#', pal[1]] : ['%', pal[2]]
163      const stirred = (x + y * 5 + t) % (busy ? 3 : 11) === 0
164      put(grid, y, x, stirred ? (STIR[ch] ?? ch) : ch, lit ? C.glowLeaf : color)
165    }
166  }
167
168  // branches, trunk and roots
169  const bark = C.trunk
170  put(grid, 3, cx - 4, '\\', C.bark)
171  put(grid, 3, cx + 4, '/', C.bark)
172  put(grid, 4, cx - 2, '\\', C.bark)
173  put(grid, 4, cx, '|', C.bark)
174  put(grid, 4, cx + 2, '/', C.bark)
175  put(grid, 5, cx - 1, '\\', bark)
176  put(grid, 5, cx, '|', bark)
177  put(grid, 5, cx + 1, '/', bark)
178  put(grid, 6, cx - 1, '(', bark)
179  put(grid, 6, cx, '|', bark)
180  put(grid, 6, cx + 1, ')', bark)
181  '_,/(|)\\,_'.split('').forEach((ch, i) => put(grid, 7, cx - 4 + i, ch, bark))
182
183  // ground
184  for (let x = 0; x < TW; x++) {
185    if (grid[7]![x]!.ch !== ' ') continue
186    const r = noise(x, 7, 5)
187    put(grid, 7, x, r < 0.55 ? '~' : r < 0.78 ? ',' : r < 0.9 ? "'" : '"', r < 0.15 ? C.light : C.grass)
188  }
189
190  // a sprout grows at the roots while Claude works
191  if (busy) {
192    const sx = cx + 6
193    const stage = workSecs < 3 ? 0 : workSecs < 8 ? 1 : workSecs < 15 ? 2 : 3
194    const sprout = [[','], ['i'], ['|', 'Y'], ['|', 'Y', '.']][stage]!
195    sprout.forEach((ch, i) => put(grid, 7 - i, sx, ch, i === 2 ? C.glowLeaf : C.light))
196  }
197
198  // sun or moon, and fireflies once the light goes
199  const isDay = hour >= 6 && hour < 18
200  put(grid, 0, TW - 1, isDay ? '*' : ')', C.yellow, true)
201  if (light < 0.85) {
202    for (let i = 0; i < 4; i++) {
203      if ((t + i * 3) % 5 >= 3) continue
204      const x = (i * 7 + 2 + Math.floor(t / 3) * (i % 2 === 0 ? 1 : -1) + TW * 8) % TW
205      put(grid, 1 + ((i * 3 + Math.floor(t / 4)) % 5), x, '*', C.firefly, true)
206    }
207  }
208
209  for (const row of grid) {
210    for (const cell of row) {
211      if (!cell.glow) cell.color = dim(cell.color, light)
212    }
213  }
214  return grid
215}
216
217// merge neighbouring cells of one colour so a row is a handful of Text nodes
218const runs = (row: Cell[]): Seg[] => {
219  const out: Seg[] = []
220  for (const cell of row) {
221    const last = out[out.length - 1]
222    if (last && last.color === cell.color) last.text += cell.ch
223    else out.push({ text: cell.ch, color: cell.color })
224  }
225  return out
226}
227
228const toLimits = (rates: readonly SessionRateLimit[]): Limits | null => {
229  const five = rates.find((r) => r.kind === 'five_hour')
230  if (!five) return null
231  const week = rates.find((r) => r.kind === 'seven_day')
232  return { session: five.percentUsed, resetsAt: five.resetsAt ?? null, week: week ? week.percentUsed : null }
233}
234
235const left = (resetsAt: string | null, now: number): string => {
236  if (!resetsAt) return ''
237  const mins = Math.max(0, Math.round((Date.parse(resetsAt) - now) / 60000))
238  const h = Math.floor(mins / 60)
239  return h > 0 ? `${h}h ${mins % 60}m` : `${mins}m`
240}
241
242// green while there is plenty, turning to moss and then earth as it runs low
243const tint = (pct: number) => (pct >= 90 ? C.earth : pct >= 75 ? C.brown : pct >= 50 ? C.moss : C.light)
244
245// label colours fade from leaf green down to bark
246const FADE = ['#a7c080', '#93ab76', '#7d9a6b', '#8f8a68', '#9a8a70'] as const
247
248const ICON = { files: '\uf15b', context: '\uf2db', session: '\uf017', time: '\uf253', agents: '\uf1bb' }
249
250const label = (name: keyof typeof ICON, color: string): Seg => ({
251  text: `${NERD ? `${ICON[name]} ` : ''}${name.padEnd(8)}`,
252  color,
253})
254
255const bar = (pct: number, width: number): Seg[] => {
256  const filled = Math.round((Math.min(100, Math.max(0, pct)) / 100) * width)
257  return [
258    { text: '━'.repeat(filled), color: tint(pct) },
259    { text: '─'.repeat(width - filled), color: C.empty },
260  ]
261}
262
263const baseName = (path: string) => path.split('/').pop() ?? path
264
265const clip = (segs: Seg[], width: number): Seg[] => {
266  const out: Seg[] = []
267  let room = width
268  for (const s of segs) {
269    if (room <= 0) break
270    out.push(s.text.length > room ? { ...s, text: s.text.slice(0, room) } : s)
271    room -= s.text.length
272  }
273  return out
274}
275
276type Facts = {
277  lim: Limits | null
278  recent: string[]
279  ctx: number | null
280  upMins: number | null
281  running: number
282  now: number
283}
284
285const span = (mins: number) => {
286  const h = Math.floor(mins / 60)
287  return h > 0 ? `${h}h ${mins % 60}m` : `${mins}m`
288}
289
290const info = (f: Facts, width: number): Seg[][] => {
291  const barW = Math.max(4, Math.min(8, width - 26))
292  const rows: Seg[][] = []
293
294  const shown = f.recent.slice(0, 2).map(baseName)
295  const more = f.recent.length - shown.length
296  // a row shows only once it has something to say
297  if (shown.length) {
298    rows.push([
299      label('files', FADE[0]),
300      { text: shown.join(' · '), color: C.fg },
301      ...(more > 0 ? [{ text: `  +${more}`, color: C.hint }] : []),
302    ])
303  }
304
305  if (f.ctx !== null) {
306    rows.push([label('context', FADE[1]), ...bar(f.ctx, barW), { text: ` ${Math.round(f.ctx)}%`, color: tint(f.ctx) }])
307  }
308
309  if (f.lim) {
310    rows.push([
311      label('session', FADE[2]),
312      ...bar(f.lim.session, barW),
313      { text: ` ${Math.round(f.lim.session)}%`, color: tint(f.lim.session) },
314      { text: f.lim.resetsAt ? `  ${left(f.lim.resetsAt, f.now)}` : '', color: C.hint },
315    ])
316  }
317
318  if (f.upMins !== null) rows.push([label('time', FADE[3]), { text: span(f.upMins), color: C.fg }])
319
320  if (f.running > 0) rows.push([label('agents', FADE[4]), { text: String(f.running), color: C.fg }])
321  return rows.map((r) => clip(r, width))
322}
323
324const WORDS = [
325  'Breathing',
326  'Rooting',
327  'Sprouting',
328  'Blooming',
329  'Meditating',
330  'Growing',
331  'Listening',
332  'Resting',
333  'Flowing',
334  'Unfolding',
335  'Settling',
336  'Drifting',
337]
338
339// bubbles either side of the words: a slow wave swells them in turn, mirrored,
340// so the two sides rise and settle together
341const BUBBLE = [' ', '.', '°', 'o', 'O'] as const
342const BUBBLE_SHADE = ['#4a6350', '#56705a', '#6b8a62', '#7d9a6b', '#a7c080'] as const
343const BUBBLES = 7
344
345const bubbles = (t: number): { ch: string; color: string }[] =>
346  Array.from({ length: BUBBLES }, (_, i) => {
347    // i = 0 sits by the words; the swell travels outward
348    const v = (Math.sin(t * 0.5 - i * 0.7) + 1) / 2
349    const level = Math.min(BUBBLE.length - 1, Math.floor(v * BUBBLE.length))
350    return { ch: BUBBLE[level]!, color: BUBBLE_SHADE[level]! }
351  })
352
353const hash = (s: string) => [...s].reduce((a, c) => (a * 31 + c.charCodeAt(0)) % 9973, 7)
354
355export const register: Register = (on, options) => {
356  NERD = options.nerdIcons !== false
357  SOUND = options.sound !== false
358  BLOOM_AT = typeof options.bloomAt === 'number' ? options.bloomAt : 80
359  BREATHE_EVERY = typeof options.breatheEvery === 'number' ? options.breatheEvery : 50
360  HIDE_IN_IDE = options.hideInIde !== false
361
362  on('session.start', async ($, e, next) => {
363    IN_IDE = detectIde(
364      await $.env.get('TERM_PROGRAM'),
365      await $.env.get('TERMINAL_EMULATOR'),
366    )
367    $.clock.every(700, () => {
368      void update($, tick, (n) => n + 1)
369    })
370    // every so often, a gentle nudge to breathe: a toast, the wind, warm light in the crown
371    $.clock.every(60_000, async () => {
372      if (BREATHE_EVERY <= 0) return
373      const now = await $.clock.now()
374      const last = await read($, lastBreath)
375      if (last === 0) {
376        await update($, lastBreath, () => now)
377        return
378      }
379      if (now - last < BREATHE_EVERY * 60_000) return
380      await update($, lastBreath, () => now)
381      await update($, restUntil, () => now + REST_MS)
382      $.ui.toast('🌿 take a breath · stretch a little', { timeoutMs: 12_000 })
383      if (SOUND) {
384        const file = `${$.plugin.root}/sounds/wind.wav`
385        void $.process
386          .run(['pw-play', '--volume', '0.7', file])
387          .then((r) => (r.exitCode === 0 ? r : $.process.run(['paplay', file])))
388          .catch(() => undefined)
389      }
390    })
391    $.clock.every(2000, async () => {
392      const list = await $.agent.list()
393      const running = list.filter((a) => a.status === 'running' || a.status === 'pending').length
394      await update($, agents, () => running)
395    })
396    const usage = await $.session.usage()
397    await update($, limits, () => toLimits(usage.rateLimits))
398    await update($, context, () => usage.context.percent ?? null)
399    await update($, startedAt, () => usage.startedAt)
400    return next(e)
401  })
402
403  on('session.measure', async ($, e, next) => {
404    if (e.changed.includes('rateLimits')) await update($, limits, () => toLimits(e.rateLimits))
405    if (e.changed.includes('context')) {
406      const pct = e.context.percent ?? null
407      await update($, context, () => pct)
408      // one quiet word when the tree first blooms; again only after it settles
409      const noted = await read($, bloomNoted)
410      if (pct !== null && pct >= BLOOM_AT && !noted) {
411        await update($, bloomNoted, () => true)
412        $.ui.toast('🌸 the tree is in bloom · /compact when you are ready', { timeoutMs: 10_000 })
413      } else if (pct !== null && pct < BLOOM_AT && noted) {
414        await update($, bloomNoted, () => false)
415      }
416    }
417    return next(e)
418  })
419
420  // web tools in flight: the tree turns blue while any runs
421  on('tool.call', { tool: 'WebSearch' }, async ($, e, next) => {
422    await update($, activity, (n) => n + 1)
423    try {
424      return await next(e)
425    } finally {
426      await update($, activity, (n) => Math.max(0, n - 1))
427    }
428  })
429
430  on('tool.call', { tool: 'WebFetch' }, async ($, e, next) => {
431    await update($, activity, (n) => n + 1)
432    try {
433      return await next(e)
434    } finally {
435      await update($, activity, (n) => Math.max(0, n - 1))
436    }
437  })
438
439  on('tool.call', async ($, e, next) => {
440    // bookkeeping only: it must never get in the way of the call
441    try {
442      if (e.tool === 'Edit' || e.tool === 'Write') {
443        const path = e.file_path
444        await update($, files, (list) => [path, ...list.filter((p) => p !== path)].slice(0, 20))
445      }
446    } catch {}
447    return next(e)
448  })
449
450  // Claude is waiting on you: a permission prompt or a dialog. One soft call of a bird.
451  on('classic.Notification', async ($, e, next) => {
452    if (e.notification_type === 'permission_prompt' || e.notification_type === 'elicitation_dialog') {
453      if (SOUND) {
454        const file = `${$.plugin.root}/sounds/call.wav`
455        void $.process
456          .run(['pw-play', '--volume', '0.7', file])
457          .then((r) => (r.exitCode === 0 ? r : $.process.run(['paplay', file])))
458          .catch(() => undefined)
459      }
460    }
461    return next(e)
462  })
463
464  on('tool.call', { tool: 'AskUserQuestion' }, async ($, e, next) => {
465    if (SOUND) {
466      const file = `${$.plugin.root}/sounds/call.wav`
467      void $.process
468        .run(['pw-play', '--volume', '0.7', file])
469        .then((r) => (r.exitCode === 0 ? r : $.process.run(['paplay', file])))
470        .catch(() => undefined)
471    }
472    return next(e)
473  })
474
475  // a soft gust of wind when a turn ends. The engine's own player is
476  // macOS-only, so on Linux PipeWire plays the file; elsewhere it stays quiet.
477  on('turn.complete', async ($, e, next) => {
478    if (SOUND && e.agentId === undefined) {
479      const file = `${$.plugin.root}/sounds/wind.wav`
480      void $.process
481        .run(['pw-play', '--volume', '0.7', file])
482        .then((r) => (r.exitCode === 0 ? r : $.process.run(['paplay', file])))
483        .catch(() => undefined)
484    }
485    return next(e)
486  })
487
488  on('prompt.submit', async ($, e, next) => {
489    const now = await $.clock.now()
490    await update($, turnStart, () => now)
491    return next(e)
492  })
493
494  // the spinner line drawn in green, the words floating between two rows of bubbles
495  on('ui.render', { component: 'Spinner' }, async ($, e, next) => {
496    if (quiet(e.surface)) return next(e)
497    const { Box, Text } = $.ui.resolve(e)
498    const t = await read($, tick)
499    const began = await read($, turnStart)
500    const secs = began ? Math.max(0, Math.round(((await $.clock.now()) - began) / 1000)) : 0
501    const word = e.props.message ?? WORDS[hash(e.props.word) % WORDS.length] ?? WORDS[0]!
502    const side = bubbles(t)
503    const left = [...side].reverse()
504    return (
505      <Box>
506        {left.map((b, i) => (
507          <Text key={`l${i}`} color={b.color}>
508            {b.ch}
509          </Text>
510        ))}
511        <Text color={C.mid}> {word} </Text>
512        {side.map((b, i) => (
513          <Text key={`r${i}`} color={b.color}>
514            {b.ch}
515          </Text>
516        ))}
517        <Text color={C.hint}> ({secs < 60 ? `${secs}s` : `${Math.floor(secs / 60)}m ${secs % 60}s`})</Text>
518      </Box>
519    )
520  })
521
522  on('ui.render', { component: 'AbovePrompt' }, async ($, e, next) => {
523    if (e.props.hasSurvey || quiet(e.surface)) return next(e)
524
525    const t = await read($, tick)
526    const now = await $.clock.now()
527    const lim = await read($, limits)
528    const began = await read($, startedAt)
529    const facts: Facts = {
530      lim,
531      recent: await read($, files),
532      ctx: await read($, context),
533      running: await read($, agents),
534      upMins: began === null ? null : Math.max(0, Math.round((now - began) / 60000)),
535      now,
536    }
537    const clock = new Date(now)
538    const web = await read($, activity)
539    const resting = now < (await read($, restUntil))
540    const mode: Mode = resting ? 'rest' : web > 0 ? 'web' : facts.running > 0 ? 'agents' : e.props.isWorking ? 'work' : 'idle'
541    const began2 = await read($, turnStart)
542    const workSecs = began2 ? (now - began2) / 1000 : 0
543    const grid = tree(t, mode, clock.getHours() + clock.getMinutes() / 60, workSecs, (facts.ctx ?? 0) >= BLOOM_AT)
544    const infoWidth = Math.max(0, Math.min(e.props.bodyColumns, 100) - TW - GAP)
545    const side = info(facts, infoWidth)
546    const top = Math.max(0, Math.floor((ROWS - side.length) / 2))
547    const { Box, Text } = $.ui.resolve(e)
548
549    return (
550      <Box flexDirection="column">
551        {grid.map((row, y) => (
552          <Box key={`r${y}`}>
553            {runs(row).map((seg, i) => (
554              <Text key={`t${i}`} color={seg.color}>
555                {seg.text}
556              </Text>
557            ))}
558            {infoWidth > 0 && side[y - top] ? <Text>{' '.repeat(GAP)}</Text> : null}
559            {(side[y - top] ?? []).map((seg, i) => (
560              <Text key={`i${i}`} color={seg.color}>
561                {seg.text}
562              </Text>
563            ))}
564          </Box>
565        ))}
566      </Box>
567    )
568  })
569}
570
types/index.d.ts 20 lines
1export type Limits = { session: number; resetsAt: string | null; week: number | null }
2
3declare module 'claude-code' {
4  interface PluginState {
5    'everforest-zen': {
6      tick: number
7      limits: Limits | null
8      files: string[]
9      startedAt: number | null
10      context: number | null
11      agents: number
12      activity: number
13      turnStart: number
14      lastBreath: number
15      restUntil: number
16      bloomNoted: boolean
17    }
18  }
19}
20