modscode JA

modscode / Gallery / ak-cockpit

ak-cockpit

AgentKit cockpit above the prompt: context fill with a handoff nudge, and the active plan's phase and checklist.

Code you can checkTerminal + desktopPaneBandToastBoxButtonText

What it does

  • Draws a band above the prompt, a pane, toasts
  • Hooks session.start, turn.complete
  • Starts processes

Good points

  • No network calls
  • Small: 264 lines
  • Written in TypeScript
  • Handles errors

Code to start from

Two kinds: a starter modscode writes from the design above, and the lines of the mod's own code that draw it.

Starter (register.tsx)

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

// Drawn like ak-cockpit by Thieu Nguyen (pane, band, toast), as modscode read it from the mod's code:
// https://modscode.com/gallery/thieung-ak-cockpit/
// 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 glyph = '…'
    const percent = '…'
    const shortTokens = '…'
    const threshold = '…'
    const planLine = '…'
    return (
      <Box flexDirection="column">
        <Box gap={2}>
          <Box gap={1} flexShrink={0}>
            <Text>
              {glyph}
              {" Context "}
              {percent}
              % (
              {shortTokens}
              {") · handoff ở "}
              {threshold}
              %
            </Text>
            <Button label="Handoff" variant="primary" />
          </Box>
          <Button plain label={`${planLine}`} />
        </Box>
        {await next(e)}
      </Box>
    )
  })

  // the pane: open it with $.ui.open({ id: 'my-pane', title: "‹title›" })
  on('ui.render', { component: 'Pane', requestId: 'my-pane' }, async ($, e) => {
    const { Box, Text } = $.ui.resolve(e)
    const title = '…'
    const doneTasks = '…'
    const totalTasks = '…'
    const number = '…'
    const title2 = '…'
    const doneTasks2 = '…'
    const totalTasks2 = '…'
    const number2 = '…'
    const title3 = '…'
    const doneTasks3 = '…'
    const totalTasks3 = '…'
    const number3 = '…'
    const title4 = '…'
    const doneTasks4 = '…'
    const totalTasks4 = '…'
    const number4 = '…'
    const length = '…'
    const text = '…'
    const text2 = '…'
    const text3 = '…'
    const length2 = '…'
    return (
      <Box flexDirection="column">
        <Text bold wrap="truncate-end">
          {title}
        </Text>
        <Text dimColor>
          {doneTasks}
          /
          {totalTasks}
          {" task xong"}
        </Text>
        <Text color="cyan" wrap="truncate-end">
          ▸
          {" "}
          {number}
          {". "}
          {title2}
          {" ("}
          {doneTasks2}
          /
          {totalTasks2}
          )
        </Text>
        <Text color="cyan" wrap="truncate-end">
          ▸
          {" "}
          {number2}
          {". "}
          {title3}
          {" ("}
          {doneTasks3}
          /
          {totalTasks3}
          )
        </Text>
        <Text color="cyan" wrap="truncate-end">
          ▸
          {" "}
          {number3}
          {". "}
          {title4}
          {" ("}
          {doneTasks4}
          /
          {totalTasks4}
          )
        </Text>
        <Text bold>
          {"Phase "}
          {number4}
          {" — còn "}
          {length}
          {" mục:"}
        </Text>
        <Text wrap="truncate-end">
          {" ☐ "}
          {text}
        </Text>
        <Text wrap="truncate-end">
          {" ☐ "}
          {text2}
        </Text>
        <Text wrap="truncate-end">
          {" ☐ "}
          {text3}
        </Text>
        <Text dimColor>
          {" … và "}
          {length2}
          {" mục khác"}
        </Text>
      </Box>
    )
  })

  on('session.start', async ($, e, next) => {
    const percent = '…'
    await $.ui.toast(`Context ${percent}% — nên chạy /ak:handoff trước khi bị compact`)
    await $.ui.toast(`Không chạy được /ak:handoff: skill chưa được cài?`)
    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.

ak-cockpit/hooks/register.tsx lines 95–122 · Band
  on('ui.render', { component: 'AbovePrompt' }, async ($, e, next) => {
    const below = await next(e)
    if (e.props.hasSurvey) return below
    const reading = await read($, context)
    const view = await read($, plan)
    if (!reading && !view) return below
    const { Box, Text, Button } = $.ui.resolve(e)
    const weather = reading ? forecast(reading.percent, threshold) : null
    const isHot = reading !== null && reading.percent >= threshold
    const handoff = () =>
      $.command.run({ command: HANDOFF }).catch(() => $.ui.toast(`Không chạy được /${HANDOFF}: skill chưa được cài?`))
    return (
      <Box flexDirection="column">
        <Box key="cockpit" gap={2} width={e.props.bodyColumns}>
          {reading && weather && (
            <Box key="context" gap={1} flexShrink={0}>
              <Text key="reading" color={weather.color} bold={isHot}>
                {weather.glyph} Context {reading.percent}% ({shortTokens(reading.delta)}) · handoff ở {threshold}%
              </Text>
              {isHot && <Button key="handoff" label="Handoff" variant="primary" onPress={handoff} />}
            </Box>
          )}
          {view && <Button key="plan" plain label={planLine(view)} onPress={() => $.ui.open({ id: PANE, title: view.title })} />}
        </Box>
        {below}
      </Box>
    )
  })
ak-cockpit/hooks/register.tsx lines 124–146 · Pane
  on('ui.render', { component: 'Pane', requestId: PANE }, async ($, e) => {
    const { Box, Text } = $.ui.resolve(e)
    const view = await read($, plan)
    if (!view) return <Text dimColor>Không tìm thấy plan nào trong plans/.</Text>
    if (!view.phases.length) return <Text dimColor>{view.title}: plan chưa có phase nào.</Text>
    const open = view.checklist.filter(item => !item.isDone)
    const room = Math.max(3, e.props.scroll.bodyRows - view.phases.length - PANE_FIXED_ROWS)
    const shown = open.length > room ? room - 1 : open.length
    return (
      <Box flexDirection="column" width={e.props.bodyColumns}>
        <Text key="title" bold wrap="truncate-end">{view.title}</Text>
        <Text key="totals" dimColor>{view.doneTasks}/{view.totalTasks} task xong</Text>
        {view.phases.map((phase, i) => (
          <Text key={`phase-${phase.number}`} color={i === view.current ? 'cyan' : undefined} dimColor={i !== view.current && phase.doneTasks === phase.totalTasks} wrap="truncate-end">
            {i === view.current ? '▸' : i < view.current || view.current < 0 ? '✓' : ' '} {phase.number}. {phase.title} ({phase.doneTasks}/{phase.totalTasks})
          </Text>
        ))}
        {view.current >= 0 && <Text key="open" bold>Phase {view.phases[view.current]?.number} — còn {open.length} mục:</Text>}
        {open.slice(0, shown).map((item, i) => <Text key={`item-${i}`} wrap="truncate-end">  ☐ {item.text}</Text>)}
        {open.length > shown && <Text key="overflow" dimColor>  … và {open.length - shown} mục khác</Text>}
      </Box>
    )
  })
Licence text (MIT)
MIT License

Copyright (c) 2026 Thieu Nguyen

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.

What its code calls

runs programsreads files

The design, read from code

Drawn from the mod's source at the commit read, not from a run: a list is drawn three times, a condition takes its first branch that draws in the desktop app, and a value only the run time knows is shown as a made-up sample (dotted underline) or left out. Colours and type are this site's.

What its code shows

Read from the source at commit bc038914b142 on 2026-10-06. 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.ak-cockpit/hooks/register.tsx
ParsesEvery file parses as TypeScript or JavaScript.3 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.ak
Reads and sendsWhether it both reads files or environment variables and reaches the network.reaches no network
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

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 the code below (or run claude plugin validate . in its folder), weigh what it reaches, and install the commit you read.

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 thieung/claude-mods
/plugin install ak-cockpit@thieung-mods

This installs the marketplace's latest commit, which may not be the one read here (bc038914b142). Compare them before you install.

Ask Claude about it

With the modscode connector added, Claude can read this design, what its code reaches and its code, and build on them. Ask it like this:

Read the modscode design "thieung-ak-cockpit" with its code and make me a pane like it

Search them from Claude: the MCP connector

Similar designs