Ranking|Claude Code Mods

ModsCode / Claude Code Mods / Ranking / headspace

headspace

What Claude carries, in colour: a bar above the prompt with system, rules, conversation and large tool results, and a pane to turn rules off for the session, edit and save them, and take out large results.

Code you can checkTerminal + desktopPaneBandToastBoxButtonText
writes files, draws

What it does

  • Draws a band above the prompt, a pane, toasts
  • Hooks prompt.context, prompt.section, session.start, turn.complete and 1 more
  • Keeps its own state between turns

Good points

  • No network calls
  • Starts no processes
  • Written in TypeScript
  • Handles errors

Code to start from

A starter ModsCode writes from the drawing it read, and the mod's own lines that draw, where there are any.

Starter (register.tsx)

register.tsx
import type { Register } from 'claude-code'

// Drawn like headspace by Xabilimon1 (pane, band, toast), as ModsCode read it from the mod's code:
// https://modscode.com/claude-mods/mods/xabilimon1-headspace/
// Written by ModsCode from that reading, not copied from the mod: use it as you like.
// Each value below stands for one the mod works out at run time; put in your own.
export const register: Register = on => {
  // the band above the prompt; what else goes there is drawn under it
  on('ui.render', { component: 'AbovePrompt' }, async ($, e, next) => {
    const { Box, Text, Button } = $.ui.resolve(e)
    const run = '…'
    const run2 = '…'
    const run3 = '…'
    const percent = '…'
    const text = '…'
    const text2 = '…'
    const text3 = '…'
    const text4 = '…'
    const text5 = '…'
    const text6 = '…'
    return (
      <Box flexDirection="column">
        <Box gap={2}>
          <Box flexShrink={0}>
            <Box flexShrink={0}>
              <Text dimColor>
                {run}
              </Text>
              <Box position="absolute" top={0} left={0} display="none">
                <Button plain label={`${run}`} />
              </Box>
            </Box>
            <Box flexShrink={0}>
              <Text dimColor>
                {run2}
              </Text>
              <Box position="absolute" top={0} left={0} display="none">
                <Button plain label={`${run}`} />
              </Box>
            </Box>
            <Box flexShrink={0}>
              <Text dimColor>
                {run3}
              </Text>
              <Box position="absolute" top={0} left={0} display="none">
                <Button plain label={`${run}`} />
              </Box>
            </Box>
          </Box>
          <Button plain label={`${percent}`} />
          <Box flexGrow={1} flexShrink={1}>
            <Text color="#d97757" wrap="truncate-end">
              {text}
            </Text>
            <Text color="#d97757" wrap="truncate-end">
              {text2}
            </Text>
            <Text color="#d97757" wrap="truncate-end">
              {text3}
            </Text>
            <Box position="absolute" top={0} left={0} display="none">
              <Text wrap="truncate-end">
                {text4}
              </Text>
            </Box>
            <Box position="absolute" top={0} left={0} display="none">
              <Text wrap="truncate-end">
                {text5}
              </Text>
            </Box>
            <Box position="absolute" top={0} left={0} display="none">
              <Text wrap="truncate-end">
                {text6}
              </Text>
            </Box>
          </Box>
        </Box>
        {await next(e)}
      </Box>
    )
  })

  // the pane: open it with $.ui.open({ id: 'my-pane', title: "headspace" })
  on('ui.render', { component: 'Pane', requestId: 'my-pane' }, async ($, e) => {
    const { Box, Text, Button } = $.ui.resolve(e)
    const lost = '…'
    const kind = '…'
    const formatTokens = '…'
    return (
      <Box flexDirection="column" gap={1}>
        <Text color="#d97757">
          {`headspace lost track at ${lost}`}
        </Text>
        <Box gap={2} flexWrap="wrap">
          <Box gap={1}>
            <Text dimColor>
              ▁
            </Text>
            <Button plain label={`${kind}`} />
          </Box>
          <Box gap={1}>
            <Text dimColor>
              ▁
            </Text>
            <Button plain label={`${kind}`} />
          </Box>
          <Box gap={1}>
            <Text dimColor>
              ▁
            </Text>
            <Button plain label={`${kind}`} />
          </Box>
        </Box>
        <Text bold>
          {`${kind}  ${formatTokens}`}
        </Text>
      </Box>
    )
  })

  on('session.start', async ($, e, next) => {
    const refusal = '…'
    const reason = '…'
    await $.ui.toast(`headspace: ${refusal}`)
    await $.ui.toast(`headspace: widen the terminal to see the pane (${reason})`)
    return next(e)
  })
}

The mod's own code

Shown under the mod's licence (MIT); its text is below. Keep the notice if you copy these lines.

mods/headspace/hooks/register.tsx lines 1456–1487 · Band
  on('ui.render', { component: 'AbovePrompt' }, async ($, e, next) => {
    let shot: HeadspaceSnapshot | null
    try {
      shot = await read($, snapshot)
    } catch {
      shot = null
    }
    if (shot === null || e.props.hasSurvey) {
      return next(e)
    }
    // One band for every plugin: emcc-core or witness may draw beneath, in the rows headspace's one row leaves.
    // What they draw is never swallowed.
    const below = await next({ ...e, props: { ...e.props, maxRows: Math.max(1, e.props.maxRows - 1) } })
    try {
      const row = await bandRow($, $.ui.resolve(e), shot, e.props.bodyColumns)
      if (isBlank(below)) {
        return row
      }
      const { Box } = $.ui.resolve(e)

      // headspace's row first, then the band beneath; a pair taller than maxRows scrolls in the band's window.
      return (
        <Box flexDirection="column">
          {row}
          {below}
        </Box>
      )
    } catch {
      // Writes are refused while drawing: the band beneath stands in, and the pane says the rest.
      return below
    }
  })
mods/headspace/hooks/register.tsx lines 1260–1311 · Band
async function bandRow($: EngineInterface, els: Els, shot: HeadspaceSnapshot, bodyColumns: number): Promise<RenderElement> {
  const { Box, Text, Button } = els
  const mode = fallback(bodyColumns)
  const columns = Math.max(BAR_MIN, Math.min(BAR_MAX, bodyColumns - BESIDE[mode]))
  const tokens = Object.fromEntries(shot.segments.map(s => [s.kind, s.tokens])) as Partial<Record<HeadspaceKind, number>>
  const rules = await read($, sessionRules)
  const off = offCount(await read($, applied))
  const marked = (await read($, marks)).length
  const stale = await read($, staleCount)
  const cells = widths(shot.segments, shot.window, columns).filter(cell => cell.width > 0)
  const percent = `${Math.round(shot.percent)}%`
  const labelOf = (kind: HeadspaceKind): string => {
    if (mode === 'bare') {
      return LETTER[kind]
    }

    return mode === 'full' && (kind === 'rules' || kind === 'large') ? `${kind} ${formatTokens(tokens[kind] ?? 0)}` : SHORT[kind]
  }
  const after: Partial<Record<HeadspaceKind, Item>> =
    mode === 'bare'
      ? {}
      : {
          ...(off > 0 ? { rules: { key: 'label-off', text: `${off} off`, opens: 'rules' } } : {}),
          ...(marked > 0 ? { large: { key: 'label-marked', text: `${marked} marked`, opens: 'large' } } : {}),
        }
  const items: Item[] = [
    ...cells.flatMap(cell => [{ key: `label-${cell.kind}`, text: labelOf(cell.kind), opens: cell.kind }, ...(after[cell.kind] === undefined ? [] : [after[cell.kind] as Item])]),
    ...(mode !== 'bare' && stale > 0 ? [{ key: 'stale', text: stale === 1 ? '1 change no longer applies' : `${stale} changes no longer apply`, opens: null }] : []),
  ]
  // The cells the bar and the percentage leave, less the two gaps between them.
  const room = bodyColumns - cells.reduce((sum, cell) => sum + cell.width, 0) - percent.length - 4
  const held = pieces(rules)

  return (
    <Box gap={2}>
      <Box flexShrink={0}>{cells.map(cell => segment($, els, cell.kind, cell.width))}</Box>
      <Button key="label-percent" plain label={percent} onPress={() => press($, 'ui.press', () => openOn($, 'rules'))} />
      <Box gap={GAP[mode]} flexGrow={1} flexShrink={1}>
        {items.map(item =>
          item.opens === null ? (
            <Text key={item.key} color={CLAY} wrap="truncate-end">
              {item.text}
            </Text>
          ) : (
            <Button key={item.key} plain dimColor label={item.text} onPress={() => press($, 'ui.press', () => openOn($, item.opens ?? 'rules'))} />
          ),
        )}
        {mode !== 'bare' && room >= CARD_MIN && cells.map(cell => card(els, cell.kind, cardText(cell.kind, tokens[cell.kind] ?? 0, held), room))}
      </Box>
    </Box>
  )
}
mods/headspace/hooks/register.tsx lines 981–995 · Band
function segment($: EngineInterface, { Box, Text, Button }: Els, kind: HeadspaceKind, width: number): RenderElement {
  const run = glyph(kind).repeat(width)
  const hover = { scope: scopeOf(kind), color: LIGHTER[kind] }

  return (
    <Box key={`seg-${kind}`} flexShrink={0}>
      <Text color={COLOURS[kind]} dimColor={kind === 'free' ? true : undefined} hover={hover}>
        {run}
      </Text>
      <Box position="absolute" top={0} left={0} display="none" hover={{ display: 'flex' }}>
        <Button key={`open-${kind}`} plain label={run} hover={hover} onPress={() => press($, 'ui.press', () => openOn($, kind))} />
      </Box>
    </Box>
  )
}
mods/headspace/hooks/register.tsx lines 1009–1017 · Band
function card({ Box, Text }: Els, kind: HeadspaceKind, text: string, room: number): RenderElement {
  return (
    <Box key={`card-${kind}`} position="absolute" top={0} left={0} width={room} display="none" hover={{ display: 'flex', scope: scopeOf(kind) }}>
      <Text color={COLOURS[kind]} wrap="truncate-end">
        {cut(text, room).padEnd(room)}
      </Text>
    </Box>
  )
}
mods/headspace/hooks/register.tsx lines 1489–1519 · Pane
  on('ui.render', { component: 'Pane', requestId: PANE }, async ($, e) => {
    const table = $.ui.resolve(e)
    const { Box, Text, Button } = table
    const Input = 'Input' in table ? table.Input : undefined
    const els = { Box, Text, Button }
    try {
      const kind = await read($, selected)
      const at = cursorOf(await read($, cursor))
      const lost = await read($, lostAt)
      const shot = await read($, snapshot)
      const tokens = shot?.segments.find(s => s.kind === kind)?.tokens ?? 0
      const columns = e.props.bodyColumns
      const body =
        kind === 'rules'
          ? await rulesBody($, els, Input, columns, at)
          : kind === 'large'
            ? await largeBody($, els, columns, at)
            : categoriesBody(els, kind, tokens)

      return (
        <Box flexDirection="column" gap={1}>
          {lost !== null && <Text color={CLAY}>{`headspace lost track at ${lost}`}</Text>}
          {tabs($, els, kind)}
          <Text bold color={COLOURS[kind]}>{`${kind}  ${formatTokens(tokens)}`}</Text>
          {body}
        </Box>
      )
    } catch {
      return <Text color={CLAY}>headspace lost track at ui.render</Text>
    }
  })
mods/headspace/hooks/register.tsx lines 1020–1039 · Pane
function tabs($: EngineInterface, { Box, Text, Button }: Els, shown: HeadspaceKind): RenderElement {
  return (
    <Box gap={2} flexWrap="wrap">
      {ORDER.map(kind =>
        kind === shown ? (
          <Text key={`tab-${kind}-on`} color={COLOURS[kind]} inverse bold>
            {` ${kind} `}
          </Text>
        ) : (
          <Box key={`tab-box-${kind}`} gap={1}>
            <Text color={COLOURS[kind]} dimColor={kind === 'free' ? true : undefined}>
              {glyph(kind)}
            </Text>
            <Button key={`tab-${kind}`} plain label={kind} onPress={() => press($, 'ui.press', () => showKind($, kind))} />
          </Box>
        ),
      )}
    </Box>
  )
}
Licence text (MIT)
MIT License

Copyright (c) 2026 Xabier Ariznabarreta

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

How to build this: Pane (panel), Keep state with $.store

What its code calls

writes filesenv varsremembers

What its code shows

Read from the source at commit 1c5ffa30349f. The first group decides whether a mod is listed; the rest is for you to weigh. A later commit is not read until the next crawl.

Decides the listing: code you can check
Entry readEvery module hooks/hooks.json names was read.mods/headspace/hooks/register.tsx
ParsesEvery file parses as TypeScript or JavaScript.5 files parsed
All its code is in the modEvery import is a file of the mod or the engine's own module; no packages, no require.all its code is in the mod
ReadableNo minified lines, no eval or new Function, no import of a computed path, no encoded blobs.no minified code, no eval, no encoded blobs
Calls in the openNetwork and programs are reached as $.http.fetch and $.process.run in place, never passed around.every call outside goes through $ in the open
For you to weigh before installing
Where it drawsThe terminal, the desktop app, both, or nothing (hooks only: a guard or a prompt rewriter), as its code says. Shown, never a reason to leave a mod out.draws in the terminal and the desktop app, the same in both
Install lineWhether its repository's own .claude-plugin/marketplace.json lists it, so it installs from that marketplace with the lines on its page.listed in its repository's .claude-plugin/marketplace.json: installs from there
Programs on WindowsWhether every program it starts through $.process exists on Windows (tail, date, open, osascript, /usr/… do not).runs no program a Windows PC lacks
NetworkWhether every fetch names its https host in the code.no network
ProgramsWhether every program it starts is named in the code and is not a shell, an interpreter or a network tool.starts no programs
Reads and sendsWhether it both reads something of yours (files, environment variables, the transcript, settings) and reaches outside (the network, an MCP server, another session, telemetry).reads environment variables, files, the transcript, but reaches nothing outside
Keys in the sourceWhether the source holds what looks like an API key or a private key.no keys in the source
LicenceAn open licence (MIT, Apache-2.0, BSD, ISC, Unlicense, 0BSD, CC0) with its text lets ModsCode show its code; otherwise the code is linked.MIT
Settings hooksHooks declared in hooks/hooks.json or plugin.json beside the module: a command (a shell when it has no args), an HTTP request, an MCP tool or a model prompt at an event. They run outside $.no settings hooks: its function hooks alone
Servers it shipsMCP servers (a program, or a URL; a headersHelper is a shell command; a .mcpb bundle is unpacked at run time), LSP servers, monitors (a shell command for the whole session) and bin/ (on the PATH of the Bash tool).ships no MCP or LSP server, no monitor, no bin/
Skills, commands, agentsWhat its Markdown declares beyond text: allowed-tools granted for the turn, hooks added when a skill is invoked, a command run before Claude reads the skill.no skills, commands, agents or workflows
Tools and MCPWhether every tool it calls through $.tool.call and $.mcp.call is named in the code, and none is a shell (Bash through the tool runs a shell without $.process).calls no tool, MCP server or command
Asks of the modelCompletions it runs ($.model.complete, fork, classify), subagents it spawns, prompts it submits as you, and the tools, commands and agents it adds.adds command ?
Events it hooksBy what a hook there can do: gates (refuse a tool call, a prompt, a setting, another plugin), shapes (what the model reads: the system prompt, tool descriptions, each request), reads (your input, the events of the settings hooks, every event with *), and the rest.gates: command.run · shapes: prompt.context, prompt.section · also: session.start, turn.start, turn.complete, ui.render (AbovePrompt, Pane) · timers: clock.after
Reads, by nameThe environment variables and files it names, and whether it reads the transcript, settings.json, the prompt box or the mouse selection.env: CLAUDE_CONFIG_DIR, HOME; files: a path computed at run time; the transcript
Writes, by nameThe files and environment variables it names, and whether it changes settings, the prompt box, the clipboard, the conversation (a row the model reads) or another session.files: a path computed at run time

This is a reading of the code text, not a security review: it does not run the mod, and it cannot see what a program the mod starts does. The check before installing is yours. How mods are chosen

Install it

Check it yourself before you install it. Mods run unsandboxed, with your permissions, and ModsCode does not vouch for what this code does. Read its code (or run claude plugin validate . in its folder), weigh what it reaches, and install the commit you read.

From its marketplace

Its repository is its marketplace. Add that marketplace (in the terminal with these commands, or in the desktop app's plugin settings) and install the mod from it:

/plugin marketplace add Xabilimon1/EMCC
/plugin install headspace@emcc
/reload-plugins

This installs the marketplace's latest commit, which may not be the one read here (1c5ffa30349f). Compare them before you install. /reload-plugins loads it into a session that is already open.

Try the commit ModsCode read

No marketplace needed. In a terminal, clone the repository, check out the commit read, validate the mod, and load it for one session:

git clone https://github.com/Xabilimon1/EMCC
git -C EMCC checkout 1c5ffa30349f8b11b632aaa81be341853d3faa1d
claude plugin validate EMCC/mods/headspace
claude --plugin-dir EMCC/mods/headspace

The validate line lists the events the mod hooks and what it asks Claude Code to do, without running it. The last line loads the mod for this session only and writes nothing to your settings. If the author has rewritten history, the commit may no longer exist.

Ask Claude or ChatGPT about it

With ModsCode added as a connector, Claude or ChatGPT can read this mod's code, what it reaches and how its controls are wired, and build on them. Ask it like this:

Read the ModsCode mod "xabilimon1-headspace" with its code and make me one like it

Add the ModsCode MCP to Claude or ChatGPT

Similar mods

More from this repository

Badge for your README

If this is your mod, paste this into your README. It links to this page.

README.md
[![ModsCode](https://modscode.com/badge/xabilimon1-headspace.svg)](https://modscode.com/claude-mods/mods/xabilimon1-headspace/)