modscode JA

modscode / Gallery / prompt-history

prompt-history

Every prompt you write, kept across sessions and projects: /history searches them and puts one back in the prompt box.

Code you can checkTerminal + desktopPaneToastBoxButtonText

What it does

  • Draws a pane, toasts
  • Adds /history
  • Hooks prompt.submit, session.start
  • Keeps its own state between turns
  • Starts processes

Good points

  • No network calls
  • Written in TypeScript
  • Has a desktop-specific branch
  • 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 prompt-history by mako-code (pane, toast), as modscode read it from the mod's code:
// https://modscode.com/gallery/mako-code-prompt-history/
// 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 pane: open it with $.ui.open({ id: 'my-pane', title: "Prompt history" })
  on('ui.render', { component: 'Pane', requestId: 'my-pane' }, async ($, e) => {
    const { Box, Text, Button } = $.ui.resolve(e)
    const status = '…'
    const text = '…'
    const text2 = '…'
    const text3 = '…'
    const when = '…'
    const text4 = '…'
    const text5 = '…'
    const text6 = '…'
    const when2 = '…'
    const text7 = '…'
    const text8 = '…'
    const text9 = '…'
    const when3 = '…'
    const length = '…'
    return (
      <Box flexDirection="column" gap={1}>
        <Text dimColor wrap="wrap">
          {status}
        </Text>
        <Box flexDirection="column" gap={1}>
          <Box flexDirection="column">
            <Text wrap="truncate-end">
              <Text inverse>
                {text}
              </Text>
              <Text inverse>
                {text2}
              </Text>
              <Text inverse>
                {text3}
              </Text>
            </Text>
            <Box gap={1}>
              <Button label="Use" />
              <Button label="Copy" dimColor />
              <Text dimColor>
                {when}
              </Text>
            </Box>
          </Box>
          <Box flexDirection="column">
            <Text wrap="truncate-end">
              <Text inverse>
                {text4}
              </Text>
              <Text inverse>
                {text5}
              </Text>
              <Text inverse>
                {text6}
              </Text>
            </Text>
            <Box gap={1}>
              <Button label="Use" />
              <Button label="Copy" dimColor />
              <Text dimColor>
                {when2}
              </Text>
            </Box>
          </Box>
          <Box flexDirection="column">
            <Text wrap="truncate-end">
              <Text inverse>
                {text7}
              </Text>
              <Text inverse>
                {text8}
              </Text>
              <Text inverse>
                {text9}
              </Text>
            </Text>
            <Box gap={1}>
              <Button label="Use" />
              <Button label="Copy" dimColor />
              <Text dimColor>
                {when3}
              </Text>
            </Box>
          </Box>
        </Box>
        <Text dimColor>
          {`${length} more in other projects.`}
        </Text>
        <Box>
          <Button hotkey="x" role="dismiss" label="Close" />
        </Box>
      </Box>
    )
  })

  on('session.start', async ($, e, next) => {
    await $.ui.toast(`Close the open dialog first, then press Use again.`)
    await $.ui.toast(`Copied: paste it into the prompt box.`)
    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/prompting/prompt-history/hooks/register.tsx lines 192–324 · Pane
  on('ui.render', { component: 'Pane', requestId: PANE }, async ($, e) => {
    const { Box, Text, Button } = $.ui.resolve(e)
    const q = await read($, query)
    const sc = await read($, scope)
    await read($, version)
    const now = await $.clock.now()
    const root = await $.session.root()
    let list: HistoryEntry[] = []
    try {
      list = await entries($)
    } catch (error) {
      debug($, `could not read the history: ${String(error)}`)
    }
    const terms = termsOf(q)
    const isMobile = e.surface === 'mobile'
    const found = search(list, terms, sc === 'project' ? root : null)
    const limit = isMobile ? 20 : 40
    const shown = found.slice(0, limit)
    const cols = Math.max(24, e.props.bodyColumns)
    const isNarrow = cols < 56
    const inProject = sc === 'project' ? search(list, [], root).length : list.length
    const here = projectName(root)

    const status =
      list.length === 0
        ? 'No prompts saved yet: every prompt you send from now on is kept here.'
        : found.length === 0
          ? terms.length > 0
            ? `Nothing matches "${q.trim()}"${sc === 'project' ? ` in ${here}` : ''}.`
            : `No prompts in ${here} yet; try All projects.`
          : `${found.length} ${found.length === 1 ? 'prompt' : 'prompts'}${terms.length > 0 ? ` matching "${q.trim()}"` : ''}${
              sc === 'project' ? ` in ${here}` : ' in all projects'
            }${found.length > shown.length ? `, newest ${shown.length} shown` : ''}`

    let controls
    if (e.surface === 'mobile') {
      controls = (
        <Box flexDirection="column">
          {q.trim() !== '' && <Text dimColor>{`Search: ${q.trim()} (from /history)`}</Text>}
          <Box>
            <Button
              key="scope"
              label={sc === 'project' ? 'Show all projects' : `Show ${here} only`}
              onPress={() => void toggleScope($)}
            />
          </Box>
        </Box>
      )
    } else {
      const { Input, Select } = $.ui.resolve(e)
      controls = (
        <Box flexDirection={isNarrow ? 'column' : 'row'} gap={isNarrow ? 0 : 2}>
          <Box flexGrow={1}>
            <Input
              key="q"
              label="Search "
              placeholder="words to find"
              value={q}
              autoFocus
              submitLabel="search"
              onInput={value => void setQuery($, value)}
              onSubmit={value => void setQuery($, value)}
            />
          </Box>
          <Select key="scope" label="In " options={SCOPES} value={sc} onSelect={value => void setScope($, value)} />
        </Box>
      )
    }

    const snippetWidth = cols - 2
    return (
      <Box flexDirection="column" gap={1}>
        {controls}
        <Text dimColor wrap="wrap">
          {status}
        </Text>
        <Box flexDirection="column" gap={isNarrow || isMobile ? 1 : 0}>
        {shown.map(entry => {
          const when = `${timeAgo(entry.t, now)}${sc === 'all' && normRoot(entry.root) !== normRoot(root) ? ` · ${projectName(entry.root)}` : ''}${
            entry.cut ? ' · cut' : ''
          }`
          // wide rows: `[ Use ] [ Copy ] <when> ` before the snippet, and a cell for its closing …
          const pieces = snippet(entry.text, terms, isNarrow || isMobile ? snippetWidth : cols - (7 + 8 + Math.max(6, when.length) + 4))
          const line = (
            <Text wrap="truncate-end">
              {pieces.map(p => (p.isHit ? <Text inverse>{p.text}</Text> : p.text))}
            </Text>
          )
          const use = <Button key={`use:${entry.id}`} label="Use" onPress={press => void usePrompt($, entry.text, press.surface)} />
          if (isMobile) {
            return (
              <Box key={entry.id} flexDirection="column">
                {line}
                <Box gap={1}>
                  {use}
                  <Text dimColor>{when}</Text>
                </Box>
              </Box>
            )
          }
          const copy = <Button key={`copy:${entry.id}`} label="Copy" dimColor onPress={press => void copyPrompt($, entry.text, press.surface)} />
          if (isNarrow) {
            return (
              <Box key={entry.id} flexDirection="column">
                {line}
                <Box gap={1}>
                  {use}
                  {copy}
                  <Text dimColor>{when}</Text>
                </Box>
              </Box>
            )
          }
          return (
            <Box key={entry.id} gap={1}>
              {use}
              {copy}
              <Text dimColor>{when.padEnd(6)}</Text>
              <Box flexGrow={1}>{line}</Box>
            </Box>
          )
        })}
        </Box>
        {list.length > 0 && sc === 'project' && inProject < list.length && found.length < limit && (
          <Text dimColor>{`${list.length - inProject} more in other projects.`}</Text>
        )}
        {/* the column's gap already leaves the blank line above */}
        <Box>
          <Button key="close" hotkey="x" role="dismiss" label="Close" onPress={() => void $.ui.close({ id: PANE })} />
        </Box>
      </Box>
    )
  })
Licence text (MIT)
MIT License

Copyright (c) 2026 mako-code

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 programsenv varsremembers

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 ec6ea2383749 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.mods/prompting/prompt-history/hooks/register.tsx
ParsesEvery file parses as TypeScript or JavaScript.2 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, with its own branch for the desktop
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.mods/prompting/prompt-history/hooks/register.tsx:116 a program named at run time
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 mako-code/gobworks
/plugin install prompt-history@gobworks

This installs the marketplace's latest commit, which may not be the one read here (ec6ea2383749). 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 "mako-code-prompt-history" with its code and make me a pane like it

Search them from Claude: the MCP connector

Similar designs