SLOPSHOPPER

Context View

The context window as one row above the prompt, drawn the way Claude Code draws its own meters: the context's cells, the percentage used, the tokens over the…

bandguardcommandprompttimer
★ 1v0.4.0MITupdated 2026-10-12kongyo2/context-view
A shopper browsing a rack in a slop shop
Preview · a replayed session in a sandbox
claude · ~/work/app · context-view
› 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 › /context-view ⎿ context-view: Context view hidden ────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── › ? for shortcuts
README

context-view

The context window as a plugin: one row in the band above the prompt, drawn the way Claude Code draws its own meters. The cells the context fills come first in ▰, the window left in dim ▱, and the reserve auto-compact keeps at the window's end in dim ▰; then the percentage used, the tokens over the window, and the tokens left before auto-compact, joined by Claude Code's byline separator.

▰▰▰▰▰▰▰▰▱▱▱▱▱▱▱▱▱▰▰▰ 42% · 84.1k/200k tokens · 82.9k until auto-compact

The row is for you. With the awareness option on, Claude itself reads the same figures, as one line after your prompts and its tool results, from the point you set, such as 400k tokens: see Telling Claude.

The row follows the session after every main-thread turn and after every request of a running turn, so it moves while a long turn works; a subagent's requests are left out. It reads the window again whenever the window itself moves: after /clear, a resume or a branch, a compaction (/compact, auto-compact, or a plugin's), a model switch (/model, the picker, a fallback), and a change to auto-compact (/autocompact, or the /config toggle). The engine can land those after the hook that sees them has returned, so the row reads them a tenth of a second later, and twice more after that for a busy machine. Every two seconds it also compares the engine's live figures with its reading, without asking for a breakdown, so a change no event announces, such as a rewound conversation, shows within two seconds.

A request in which Claude consulted the advisor is read differently. The API runs the advisor inside that one request, the main model reading the conversation once before the advice and again after it, and reports the request's usage summed over those passes, so its count is about twice the window's. For such a request the row takes the engine's own figure, the last pass, as the status line and /context count it, and reads it again a tenth of a second later and twice more, in case the engine lands it late; it never shows the summed count, not even for a moment.

Until a response of the window has landed (a new session, and the window after /clear or a compaction), the row shows the engine's local estimate, the total /context shows, each figure marked with ~ as Claude Code marks an approximation:

▱▱▱▱▱▱▱▱▱▱▱▱▱▱▱▱▱▱▱▰ ~3% · ~33.4k/1m tokens · ~933.6k until auto-compact

/context-view hides the row and shows it again, at once even while a turn runs, leaving Context view hidden or Context view shown in the transcript. /context-view hide and /context-view show (or off and on) set it whatever it was, and any other word is answered with Usage: /context-view [show|hide]. The choice holds in later sessions.

The meter and the percentage are drawn in the blue Claude Code fills its usage meters with, the tokens and the headroom dim. From six tenths of the way to the auto-compact threshold they turn to Claude Code's warning colour, the headroom with them, and within the last 20k tokens before it, where Claude Code's own line under the prompt appears, to its error colour; past the threshold the headroom reads auto-compact next. The headroom counts the last reply too, which the next request carries, as Claude Code counts it toward its threshold. Every colour is a theme key (permission, warning, error, and the dim text's), so the row follows the dark, light, daltonized and ANSI themes; nothing is bold.

The reserve is the one /context draws. Where Claude Code compacts only once the API refuses a full window, as it runs a 200k model with no compaction window set, /context keeps none and neither does the row: the headroom counts down to the window's end.

▰▰▰▰▰▰▰▰▰▰▰▰▰▰▰▰▱▱▱▱ 80% · 160k/200k tokens · 40k until auto-compact

With auto-compact off, the reserve is the room Claude Code keeps for a reply and for a manual /compact, and the headroom counts down to where it stops sending requests (92.9k before the limit), then asks for run /compact to continue as Claude Code's own line does.

The meter spans the model's whole window, as the percentage and the tokens do. Where a setting caps the window compaction measures against below the model's (/autocompact 150000, or autoCompactWindow), everything past the threshold is reserve, so the meter shows how little of a large window is left before auto-compact runs:

▱▱▰▰▰▰▰▰▰▰▰▰▰▰▰▰▰▰▰▰ ~3% · ~33.9k/1m tokens · ~83.1k until auto-compact

The row starts at the prompt's text column, where the hints under the prompt start, and runs to the end of the columns Claude Code gives the band, which leave out the [-] it draws at the band's right end. As the band narrows, the meter steps down from 20 cells to 12 and 8, as Claude Code's progress rows narrow their bars, and every word stays; once even that does not fit, the headroom goes, then the tokens, the meter widening again each time, and the percentage stays. In Ghostty the meter is drawn in █ and ░, as Claude Code draws its own there. Nothing is drawn while a survey holds the band, while the row is hidden, or while the engine has neither a figure nor an estimate. Every mod shares the band, so what the mods after this one draw there, Claude Code's own notes among them, stays below the row.

Counts print as Claude Code prints them (84.1k, 200k, 1m). The percentage is the status line's: the last response's input tokens over the model's window. Claude Code's own context used line, which it shows instead of a countdown where compaction waits for the API, counts against the window less the room it keeps for a reply, so it reads higher (89% context used where the row reads 80%). The threshold and the reserve come from the breakdown /context draws, estimated locally with no request sent; where no breakdown answers, the 33k Claude Code usually keeps stands in. A reading the engine cannot give, a command it will not register, and a choice it cannot save go to the debug log (claude --debug) under the plugin's name, and the row keeps its last reading. A choice the store cannot read back leaves the row as it was. A change to autoCompactEnabled made by editing a settings file, rather than in /config, shows after the next turn.

Where Claude Code's built-in guard runs, with managed settings or a Team or Enterprise plan, the settings-hook events (classic.*) don't reach a mod a person installs. The row also follows /clear, /resume, /branch and /model through the commands themselves, and the check every two seconds covers the rest.

hooks/register.ts is the module; everything under hooks/ is its parts, importing claude-code and one another alone. types/index.d.ts declares the values the module keeps in $.state, so they survive a hot reload and each write draws the row again.

Telling Claude

Claude reads none of the row. With the awareness option on, it reads the same figures as one line of its own, so it knows how much room is left before auto-compact and can plan its work around it:

context-view: your context holds 412.3k/1m tokens (41%); 554.7k until auto-compact

The line follows each prompt you send, and the results of Claude's own tool calls while a turn runs, once the context has reached the point the options set. After a prompt it is there every time; after a tool result only when the context has grown by awarenessStep since Claude was last told, when the row changes colour, or when the context has shrunk, as after a compaction, so a turn of many small calls carries a handful of lines, not one a call. Results that land together, from one request, carry it once, and a reload of the module, as turning the option on again in /config makes, starts afresh: the next tool result tells Claude again. Its figures are the row's: an estimate is marked ~, past the threshold the line ends auto-compact next, and with auto-compact off it says so and counts down to the limit (auto-compact off, 92.9k before the limit). A subagent's tool results, a call another plugin makes, and a call that was refused carry nothing, and nothing is added before the first reading. The line does not depend on the row: it is there while the row is hidden too.

The line is added after the prompt or the tool result, as a settings hook's context is, and is never changed afterwards. The system prompt and everything before the line stay as they were, so the prompt cache keeps matching.

Each option is a row in /config, and /plugin configure context-view@context-view sets them together:

option/config rowwhat it doesdefault
awarenessTell Claude its contextTurns the line on.off
awarenessFromTell Claude from (tokens held)Claude is told once its context holds this many tokens, such as 400000. 0 leaves this out.0
awarenessWithinOr within (tokens of auto-compact)Claude is also told once auto-compact is this many tokens away or nearer, such as 100000, whichever of the two comes first. 0 leaves this out; with both left out, Claude is told from the start.0
awarenessStepTell again every (tokens)How much the context grows before a tool result tells Claude again. 0 tells it after each tool result once the context has grown at all.20000
awarenessAtTell Claude afterprompts-and-tool-results, prompts or tool-results.prompts-and-tool-results

They are kept in your settings under pluginConfigs, so Claude is told from 400k tokens on with

{
  "pluginConfigs": {
    "context-view@context-view": {
      "options": {
        "awareness": true,
        "awarenessFrom": 400000
      }
    }
  }
}

A change in /config reloads the module with the new values. With awareness off, as it is by default, the module hooks neither prompts nor tool calls.

What it changes

With awareness off, as it is by default, nothing but the band. Apart from drawing the row and answering its own /context-view, every hook passes its event on and hands back what Claude Code, and any settings hook or mod after it, answered, unchanged: no prompt, tool call, permission, setting, command, compaction or first message of a session is rewritten, answered, refused or added to. With awareness on, one thing more: the line for Claude is added after a prompt or a tool result, after whatever else was added there, while the prompt, the call and its result stay as they were. The hooks listed below that sit on a settings-hook event, or on an event that is also the name of a call on $, say so, and what each does there.

What it hooks

eventwhat the hook does
session.startRegisters /context-view; once the session is up, reads which marks the terminal draws the meter with, copies the person's choice from the store, takes the first reading, and starts the check of the engine's live figures every two seconds. Hands back the start's own answer.
classic.SessionStart of clear, resume, forkCopies the choice again and takes a reading, as those reset $.state, and reads again once a resumed session has been swapped in. A settings-hook event, and the hook changes nothing in it: it passes the event on with return next(e), so the SessionStart hooks in your settings run as they would without the mod, and what they answer (context for Claude, a session title, the session's first message, paths to watch) reaches the session as they wrote it.
classic.PostModelSwitchReads the new model's window once the engine has moved to it. A settings-hook event, and the hook changes nothing in it: it passes the event on with return next(e), so the PostModelSwitch hooks in your settings run, and the context they add reaches Claude, as without the mod.
session.measureAfter a main-thread turn whose context moved: takes a reading, the fill from the figures the engine pushed.
turn.stepAfter each request of the main loop: the input tokens it was answered over are the fill at that moment; for a request in which the API ran a tool of its own (the advisor), whose usage is the loop's sum, the engine's own figure instead. The response streams through as it came and is handed back unchanged.
session.compact of manual, auto, pluginAfter a compaction of the main window that stands (not one computed ahead of time, a subagent's, or one vetoed): reads the window once the engine has landed it. The event is also the call $.session.compact, so the hook sees a compaction whoever asks for it, /compact, auto-compact or another plugin; it never skips, rewrites or answers one, and hands back what Claude Code answered.
config.set of autoCompactReads the window once /config has turned auto-compact on or off. The event is also the call $.config.set, so the hook sees that one row change whoever makes it; it passes the change on with return next(e) and hands back what Claude Code answered, a refusal included.
command.run of clear, resume, branchPasses the command on, then copies the choice again and reads the window, as the classic.SessionStart hook does where the guard holds that event back. The event is also the call $.command.run, so the hook sees these three commands whoever runs them, you or another plugin; it never answers or rewrites one, and hands back Claude Code's own result.
command.run of autocompact, modelPasses the command on, then reads the window it set. As above, it sees these commands whoever runs them, never answers or rewrites one, and hands back Claude Code's own result.
command.run of context-viewAnswers the plugin's own command: hides or shows the row as asked, keeps the choice in the store, and says which.
ui.render of AbovePromptDraws the row above what the mods after it draw; passes while a survey holds the band, while the row is hidden, and while there is nothing to draw.
prompt.submitHooked only with awareness on and awarenessAt other than tool-results. Once the options say Claude is told, adds the line after the prompt, after any context another hook added, and passes the prompt on as typed; Claude reads the line, and you never see it.
tool.callHooked only with awareness on and awarenessAt other than prompts. Lets the call run, then, for a call Claude made in the main conversation that was not refused, adds the line after the result when it is due, and hands back the result otherwise as Claude Code answered it. The event is also the call $.tool.call, and a call another plugin makes gets nothing, as no line reaches Claude from it.

What it calls on $

clock.after (the readings after a change the engine lands late), clock.every (the check of the live figures), command.register, env.get (TERM and TERM_PROGRAM, once a load, to tell Ghostty), session.usage (with breakdown: 'summary', estimated locally; the plain figures where that fails), state.get, state.set, store.get, store.set, ui.log (to the debug log alone) and ui.resolve.

What it reads and sends

It reads the session's own context figures through $.session.usage, the TERM and TERM_PROGRAM environment variables, its options, and the one choice it keeps in its store; it writes that choice to its store and its failures to the debug log. It reads no file, starts no process, calls no model and makes no network request. With awareness off nothing it reads leaves the machine; with it on, the line for Claude goes to the model with the rest of the conversation Claude Code sends, and nowhere else.

Try it

claude --plugin-dir /path/to/context-view

The row appears above the prompt as soon as the session is up: the estimate in a new session, the restored figure in a resumed one. To try the line for Claude, turn on Tell Claude its context in /config; for a plugin loaded this way the options are kept under pluginConfigs as context-view. Claude Code 2.1.290 or later; tested on 2.1.296.

Install

This repository is its own marketplace. In a Claude Code session:

/plugin install context-view --marketplace kongyo2/context-view

Answer y to add the marketplace, then pick a scope; the options screen that follows can be left as it is, awareness staying off until you turn it on. Or in three steps:

/plugin marketplace add kongyo2/context-view
/plugin install context-view@context-view
/reload-plugins

Testing

claude plugin test .

Each file under tests/ covers the file of its name under hooks/. tests/register.test.ts drives the module through a session's events (the start, the estimate before the first response, measurements, a running turn's requests and their replies, a request that consulted the advisor and one whose figure lands late, /clear, a resume, a branch, compactions of each kind, a model switch, /config and /autocompact, a rewind, a reading that resolves late, /context-view and its words, a survey, another mod's note, the built-in guard, what each hook hands back, failed readings, refused calls, Ghostty) on the terminal and the desktop, and through prompts and tool results with awareness off and on (from 400k tokens, within 50k of auto-compact, the step, the row's colours, a shrunk context, results that land together, a reload, after prompts or tool results alone, a refused call, auto-compact off, an estimate, no reading); tests/views/band.test.ts reads the drawn row at each width and level, as an estimate, and over a capped window, and tests/awareness/ reads the options and the line for Claude.

claude plugin validate --strict .claude-plugin/plugin.json

reports what the module hooks and calls; claude plugin validate . reads this folder as the marketplace it also is.

Source 85 files
hooks/register.ts 400 lines
1import { atom, read, update } from 'claude-code'
2import type {
3  EngineInterface,
4  On,
5  PluginOptions,
6  SessionContextUsage,
7  SessionUsage,
8  Timer,
9  TurnUsage,
10} from 'claude-code'
11
12import Awareness from './awareness'
13import Command from './command'
14import Glyphs from './glyphs'
15import Limits from './limits'
16import { messageOf } from './message-of'
17import Names from './names'
18import Readings from './readings'
19import Views from './views'
20
21const contextWindow = atom(
22  { plugin: 'context-view', key: 'window' } as const,
23  null,
24)
25
26const contextFill = atom({ plugin: 'context-view', key: 'fill' } as const, null)
27
28const isHidden = atom(
29  { plugin: 'context-view', key: 'isHidden' } as const,
30  false,
31)
32
33const contextNoted = atom(
34  { plugin: 'context-view', key: 'noted' } as const,
35  null,
36)
37
38let latest = 0
39
40let knownHidden: boolean | undefined
41
42export function register(on: On, options: PluginOptions): void {
43  const awareness = Awareness.awarenessOf(options)
44  let glyphs: Glyphs.GlyphSet = Glyphs.PILL_GLYPHS
45  let rechecking: Timer | undefined
46
47  on('session.start', async ($, e, next) => {
48    try {
49      await $.command.register({
50        name: 'context-view',
51        description: Names.COMMAND_DESCRIPTION,
52        argumentHint: Names.COMMAND_ARGUMENT_HINT,
53        immediate: true,
54      })
55    } catch (error) {
56      $.ui.log(Names.registerFailedTextOf(messageOf(error)), { to: 'debug' })
57    }
58
59    const result = await next(e)
60
61    glyphs = await glyphsFor($)
62    await loadHidden($)
63    await forgetNoted($)
64    await measure($)
65
66    rechecking?.cancel()
67    rechecking = recheckEvery($)
68
69    return result
70  })
71
72  on(
73    'classic.SessionStart',
74    { source: ['clear', 'resume', 'fork'] },
75    async ($, e, next) => {
76      await loadHidden($)
77      await measure($)
78      settle($)
79
80      return next(e)
81    },
82  )
83
84  on(
85    'command.run',
86    { command: ['clear', 'resume', 'branch'] },
87    async ($, e, next) => {
88      const result = await next(e)
89
90      await loadHidden($)
91      await measure($)
92      settle($)
93
94      return result
95    },
96  )
97
98  on('session.measure', async ($, e, next) => {
99    const result = await next(e)
100
101    if (e.changed.includes('context')) {
102      await measure($, e.context)
103    }
104
105    return result
106  })
107
108  on('turn.step', async function* ($, e, next) {
109    const result = yield* next(e)
110
111    if (e.agentId !== undefined || !result.usage) {
112      return result
113    }
114
115    if (Readings.isLoopTotal(result)) {
116      await measure($)
117      settle($)
118    } else {
119      await follow($, result.usage)
120    }
121
122    return result
123  })
124
125  on(
126    'session.compact',
127    { trigger: ['manual', 'auto', 'plugin'] },
128    async ($, e, next) => {
129      const result = await next(e)
130
131      if (e.agentId === undefined && result.skip === undefined) {
132        settle($)
133      }
134
135      return result
136    },
137  )
138
139  on('classic.PostModelSwitch', ($, e, next) => {
140    settle($)
141
142    return next(e)
143  })
144
145  on('config.set', { key: 'autoCompact' }, ($, e, next) => {
146    settle($)
147
148    return next(e)
149  })
150
151  on(
152    'command.run',
153    { command: ['autocompact', 'model'] },
154    async ($, e, next) => {
155      const result = await next(e)
156
157      settle($)
158
159      return result
160    },
161  )
162
163  on('command.run', { command: 'context-view' }, async ($, e) => {
164    const hidden = Command.hiddenOf(e.args, await read($, isHidden))
165
166    if (hidden === null) {
167      return { text: Names.USAGE_TEXT }
168    }
169
170    knownHidden = hidden
171    await update($, isHidden, () => hidden)
172
173    await $.store
174      .set(Names.STORE_HIDDEN_KEY, hidden)
175      .catch(error =>
176        $.ui.log(Names.saveFailedTextOf(messageOf(error)), { to: 'debug' }),
177      )
178
179    return { text: hidden ? Names.HIDDEN_TEXT : Names.SHOWN_TEXT }
180  })
181
182  on('ui.render', { component: 'AbovePrompt' }, async ($, e, next) => {
183    const measured = await read($, contextWindow)
184    const filled = await read($, contextFill)
185    const hidden = await read($, isHidden)
186
187    if (e.props.hasSurvey || hidden || !measured || !filled) {
188      return next(e)
189    }
190
191    const { Box, Text } = $.ui.resolve(e)
192
193    return Views.band(
194      {
195        ui: { Box, Text },
196        columns: e.props.bodyColumns,
197        glyphs: e.surface === 'terminal' ? glyphs : Glyphs.PILL_GLYPHS,
198      },
199      measured,
200      filled,
201      await next(e),
202    )
203  })
204
205  if (awareness?.isOnPrompts) {
206    on('prompt.submit', async ($, e, next) => {
207      const note = await noteFor($, awareness, true)
208
209      if (note === undefined) {
210        return next(e)
211      }
212
213      return next({ ...e, context: [...(e.context ?? []), note] })
214    })
215  }
216
217  if (awareness?.isOnToolResults) {
218    on('tool.call', async ($, e, next) => {
219      const result = await next(e)
220
221      const isClaudeOwn =
222        e.agentId === undefined && next.origin.plugin === 'engine'
223
224      if (!isClaudeOwn || result.deny !== undefined) {
225        return result
226      }
227
228      const note = await noteFor($, awareness, false)
229
230      if (note === undefined) {
231        return result
232      }
233
234      return { ...result, context: [...(result.context ?? []), note] }
235    })
236  }
237}
238
239async function glyphsFor($: EngineInterface): Promise<Glyphs.GlyphSet> {
240  const term = await $.env.get('TERM').catch(() => undefined)
241  const program = await $.env.get('TERM_PROGRAM').catch(() => undefined)
242
243  return Glyphs.glyphsOf(term, program)
244}
245
246async function loadHidden($: EngineInterface): Promise<void> {
247  const hidden = await $.store.get(Names.STORE_HIDDEN_KEY).then(
248    stored => stored === true,
249    () => knownHidden,
250  )
251
252  if (hidden === undefined) {
253    return
254  }
255
256  knownHidden = hidden
257  await update($, isHidden, () => hidden).catch(() => undefined)
258}
259
260async function measure(
261  $: EngineInterface,
262  context?: SessionContextUsage,
263): Promise<void> {
264  latest += 1
265
266  const ticket = latest
267
268  try {
269    const usage = await usageOf($)
270    const measured = Readings.windowOf(usage.context)
271    const filled = Readings.fillOf(
272      context?.tokens === undefined
273        ? usage.context
274        : { ...context, breakdown: usage.context.breakdown },
275    )
276
277    if (ticket === latest) {
278      await update($, contextWindow, () => measured)
279    }
280
281    if (ticket === latest) {
282      await update($, contextFill, () => filled)
283    }
284  } catch (error) {
285    $.ui.log(Names.readingFailedTextOf(messageOf(error)), { to: 'debug' })
286  }
287}
288
289async function usageOf($: EngineInterface): Promise<SessionUsage> {
290  try {
291    return await $.session.usage({ breakdown: 'summary' })
292  } catch {
293    return $.session.usage()
294  }
295}
296
297async function follow($: EngineInterface, usage: TurnUsage): Promise<void> {
298  try {
299    if (!(await read($, contextWindow))) {
300      await measure($)
301    }
302
303    const measured = await read($, contextWindow)
304
305    if (!measured) {
306      return
307    }
308
309    latest += 1
310
311    const tokens = Readings.tokensOf(usage)
312    const percent = Readings.percentOf(tokens, measured.window)
313
314    await update($, contextFill, () => ({
315      tokens,
316      percent,
317      isEstimate: false,
318      output: usage.output_tokens,
319    }))
320  } catch (error) {
321    $.ui.log(Names.readingFailedTextOf(messageOf(error)), { to: 'debug' })
322  }
323}
324
325function settle($: EngineInterface): void {
326  try {
327    for (const ms of Limits.SETTLE_DELAYS_MS) {
328      $.clock.after(ms, () => void measure($))
329    }
330  } catch (error) {
331    $.ui.log(Names.readingFailedTextOf(messageOf(error)), { to: 'debug' })
332  }
333}
334
335function recheckEvery($: EngineInterface): Timer | undefined {
336  try {
337    return $.clock.every(Limits.RECHECK_MS, () => void recheck($))
338  } catch (error) {
339    $.ui.log(Names.readingFailedTextOf(messageOf(error)), { to: 'debug' })
340
341    return undefined
342  }
343}
344
345async function forgetNoted($: EngineInterface): Promise<void> {
346  await update($, contextNoted, () => null).catch(() => undefined)
347}
348
349async function noteFor(
350  $: EngineInterface,
351  awareness: Awareness.Awareness,
352  isEveryTime: boolean,
353): Promise<string | undefined> {
354  try {
355    const measured = await read($, contextWindow)
356    const filled = await read($, contextFill)
357
358    if (!measured || !filled) {
359      return undefined
360    }
361
362    if (!Awareness.isActive(awareness, measured, filled)) {
363      return undefined
364    }
365
366    let isNoted = false
367
368    await update($, contextNoted, noted => {
369      isNoted =
370        isEveryTime || Awareness.isDue(awareness, measured, filled, noted)
371
372      return isNoted ? Awareness.notedOf(measured, filled) : noted
373    })
374
375    return isNoted ? Awareness.noteTextOf(measured, filled) : undefined
376  } catch (error) {
377    $.ui.log(Names.noteFailedTextOf(messageOf(error)), { to: 'debug' })
378
379    return undefined
380  }
381}
382
383async function recheck($: EngineInterface): Promise<void> {
384  try {
385    const { context } = await $.session.usage()
386    const measured = await read($, contextWindow)
387    const filled = await read($, contextFill)
388
389    if (!measured) {
390      await loadHidden($)
391    }
392
393    if (Readings.isOutdated(context, measured, filled)) {
394      await measure($)
395    }
396  } catch {
397    return
398  }
399}
400
hooks/awareness/index.ts 14 lines
1export * from './awareness.js'
2export * from './awareness-of.js'
3export * from './default-place.js'
4export * from './is-active.js'
5export * from './is-due.js'
6export * from './note-text-of.js'
7export * from './noted-of.js'
8export * from './place.js'
9export * from './place-of.js'
10export * from './places.js'
11export * from './tokens-option-of.js'
12
13export * as default from '.'
14
hooks/command/index.ts 4 lines
1export * from './hidden-of.js'
2
3export * as default from '.'
4
hooks/glyphs/index.ts 10 lines
1export * from './block-glyphs.js'
2export * from './estimate-mark.js'
3export * from './gap.js'
4export * from './glyph-set.js'
5export * from './glyphs-of.js'
6export * from './pill-glyphs.js'
7export * from './separator.js'
8
9export * as default from '.'
10
hooks/limits/index.ts 14 lines
1export * from './awareness-step-tokens.js'
2export * from './band-inset.js'
3export * from './bar-cells.js'
4export * from './default-reserve-tokens.js'
5export * from './empty-cell-share.js'
6export * from './full-cell-share.js'
7export * from './low-headroom-tokens.js'
8export * from './recheck-ms.js'
9export * from './reply-reserve-tokens.js'
10export * from './settle-delays-ms.js'
11export * from './warning-share.js'
12
13export * as default from '.'
14
hooks/message-of/index.ts 4 lines
1export * from './message-of.js'
2
3export * as default from '.'
4
hooks/names/index.ts 22 lines
1export * from './auto-compact-off-text.js'
2export * from './before-limit-text.js'
3export * from './command-argument-hint.js'
4export * from './command-description.js'
5export * from './compact-next-text.js'
6export * from './hidden-text.js'
7export * from './hide-words.js'
8export * from './note-failed-text-of.js'
9export * from './note-lead-text.js'
10export * from './reading-failed-text-of.js'
11export * from './register-failed-text-of.js'
12export * from './run-compact-text.js'
13export * from './save-failed-text-of.js'
14export * from './show-words.js'
15export * from './shown-text.js'
16export * from './store-hidden-key.js'
17export * from './tokens-text.js'
18export * from './until-compact-text.js'
19export * from './usage-text.js'
20
21export * as default from '.'
22
hooks/readings/index.ts 9 lines
1export * from './fill-of.js'
2export * from './is-loop-total.js'
3export * from './is-outdated.js'
4export * from './percent-of.js'
5export * from './tokens-of.js'
6export * from './window-of.js'
7
8export * as default from '.'
9
hooks/views/index.ts 12 lines
1export * from './band.jsx'
2export * from './bar.jsx'
3export * from './fit.js'
4export * from './fit-of.js'
5export * from './format-count.js'
6export * from './headroom-text-of.js'
7export * from './kit.js'
8export * from './segment.js'
9export * from './segments-of.js'
10
11export * as default from '.'
12
hooks/awareness/awareness.ts 8 lines
1export type Awareness = {
2  fromTokens: number
3  withinTokens: number
4  stepTokens: number
5  isOnPrompts: boolean
6  isOnToolResults: boolean
7}
8
hooks/awareness/awareness-of.ts 26 lines
1import type { PluginOptions } from 'claude-code'
2
3import Limits from '../limits'
4import type { Awareness } from './awareness.js'
5import { placeOf } from './place-of.js'
6import { tokensOptionOf } from './tokens-option-of.js'
7
8export function awarenessOf(options: PluginOptions): Awareness | null {
9  if (options.awareness !== true) {
10    return null
11  }
12
13  const place = placeOf(options.awarenessAt)
14
15  return {
16    fromTokens: tokensOptionOf(options.awarenessFrom, 0),
17    withinTokens: tokensOptionOf(options.awarenessWithin, 0),
18    stepTokens: tokensOptionOf(
19      options.awarenessStep,
20      Limits.AWARENESS_STEP_TOKENS,
21    ),
22    isOnPrompts: place !== 'tool-results',
23    isOnToolResults: place !== 'prompts',
24  }
25}
26
hooks/awareness/default-place.ts 4 lines
1import type { Place } from './place.js'
2
3export const DEFAULT_PLACE: Place = 'prompts-and-tool-results'
4