modscode / Gallery / turn-timeline
turn-timeline
Draws the current turn as a timeline in a pane (/timeline): model requests and tool calls per loop, where the time went, and the slowest steps
What it does
- Draws a pane
- Adds /timeline
- Watches tool calls
- Hooks session.start, turn.complete, turn.start, turn.step
Good points
- No network calls
- Starts no processes
- Small: 323 lines
- Written in TypeScript
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)
import type { Register } from 'claude-code'
// Drawn like turn-timeline by Mehmet Aras (pane), as modscode read it from the mod's code:
// https://modscode.com/gallery/arasovic-turn-timeline/
// 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: "Timeline" })
on('ui.render', { component: 'Pane', requestId: 'my-pane' }, async ($, e) => {
const { Box, Text } = $.ui.resolve(e)
const t = '…'
const t2 = '…'
const t3 = '…'
const length = '…'
const t4 = '…'
const t5 = '…'
const t6 = '…'
const t7 = '…'
const t8 = '…'
const t9 = '…'
const t10 = '…'
const t11 = '…'
const t12 = '…'
const t13 = '…'
const t14 = '…'
const t15 = '…'
const t16 = '…'
const t17 = '…'
const t18 = '…'
const t19 = '…'
const t20 = '…'
const t21 = '…'
const right = '…'
const t22 = '…'
const t23 = '…'
const t24 = '…'
const t25 = '…'
const t26 = '…'
const t27 = '…'
const t28 = '…'
const t29 = '…'
const t30 = '…'
return (
<Box flexDirection="column" paddingTop={1}>
<Text>
<Text>
{t}
</Text>
<Text>
{t2}
</Text>
<Text>
{t3}
</Text>
</Text>
<Box flexDirection="column" marginTop={1}>
<Text>
<Text dimColor>
{"╭─ "}
</Text>
<Text bold>
Timeline
</Text>
<Text dimColor>
{" "}
────────
</Text>
<Text dimColor>
{" "}
{`${length} loop`}
{" "}
</Text>
<Text dimColor>
─╮
</Text>
</Text>
<Text>
<Text dimColor>
{"│ "}
</Text>
<Text>
{t4}
</Text>
<Text>
{t5}
</Text>
<Text>
{t6}
</Text>
<Text dimColor>
{" │"}
</Text>
</Text>
<Text>
<Text dimColor>
{"│ "}
</Text>
<Text>
{t7}
</Text>
<Text>
{t8}
</Text>
<Text>
{t9}
</Text>
<Text dimColor>
{" │"}
</Text>
</Text>
<Text>
<Text dimColor>
{"│ "}
</Text>
<Text>
{t10}
</Text>
<Text>
{t11}
</Text>
<Text>
{t12}
</Text>
<Text dimColor>
{" │"}
</Text>
</Text>
<Text dimColor>
╰
────────
╯
</Text>
</Box>
<Box flexDirection="column" marginTop={1}>
<Text>
<Text dimColor>
{"╭─ "}
</Text>
<Text bold>
Where time went
</Text>
<Text dimColor>
{" "}
────────
</Text>
<Text dimColor>
{" "}
main loop
{" "}
</Text>
<Text dimColor>
─╮
</Text>
</Text>
<Text>
<Text dimColor>
{"│ "}
</Text>
<Text>
{t13}
</Text>
<Text>
{t14}
</Text>
<Text>
{t15}
</Text>
<Text dimColor>
{" │"}
</Text>
</Text>
<Text>
<Text dimColor>
{"│ "}
</Text>
<Text>
{t16}
</Text>
<Text>
{t17}
</Text>
<Text>
{t18}
</Text>
<Text dimColor>
{" │"}
</Text>
</Text>
<Text>
<Text dimColor>
{"│ "}
</Text>
<Text>
{t19}
</Text>
<Text>
{t20}
</Text>
<Text>
{t21}
</Text>
<Text dimColor>
{" │"}
</Text>
</Text>
<Text dimColor>
╰
────────
╯
</Text>
</Box>
<Box flexDirection="column" marginTop={1}>
<Text>
<Text dimColor>
{"╭─ "}
</Text>
<Text bold>
Slowest
</Text>
<Text dimColor>
{" "}
────────
</Text>
<Text dimColor>
{" "}
{right}
{" "}
</Text>
<Text dimColor>
─╮
</Text>
</Text>
<Text>
<Text dimColor>
{"│ "}
</Text>
<Text>
{t22}
</Text>
<Text>
{t23}
</Text>
<Text>
{t24}
</Text>
<Text dimColor>
{" │"}
</Text>
</Text>
<Text>
<Text dimColor>
{"│ "}
</Text>
<Text>
{t25}
</Text>
<Text>
{t26}
</Text>
<Text>
{t27}
</Text>
<Text dimColor>
{" │"}
</Text>
</Text>
<Text>
<Text dimColor>
{"│ "}
</Text>
<Text>
{t28}
</Text>
<Text>
{t29}
</Text>
<Text>
{t30}
</Text>
<Text dimColor>
{" │"}
</Text>
</Text>
<Text dimColor>
╰
────────
╯
</Text>
</Box>
</Box>
)
})
}
The mod's own code
Shown under the mod's licence (MIT); its text is below. Keep the notice if you copy these lines.
turn-timeline/hooks/register.tsx lines 190–310 · Pane
on('ui.render', { component: 'Pane', requestId: PANE }, async ($, e) => {
const { Box, Text } = $.ui.resolve(e)
const t = await read($, turn)
const now = await $.clock.now()
const w = Math.max(30, e.props.bodyColumns - 1)
const inner = w - 6
if (!t) return <Text dimColor>The timeline starts with the next turn.</Text>
const draw = (row: Row, width: number) =>
fit(row, width).map((s, j) => <Text key={String(j)} color={s.c} dimColor={s.d} bold={s.b}>{s.t}</Text>)
const frame = (title: string, tone: string, rows: Row[], right = '') => {
const rule = Math.max(0, w - 6 - title.length - (right ? right.length + 2 : 0))
return (
<Box key={title} flexDirection="column" marginTop={1}>
<Text>
<Text color={tone} dimColor>╭─ </Text>
<Text color={tone} bold>{title}</Text>
<Text color={tone} dimColor> {'─'.repeat(rule)}</Text>
{right ? <Text dimColor> {right} </Text> : null}
<Text color={tone} dimColor>─╮</Text>
</Text>
{rows.map((row, i) => (
<Text key={String(i)}>
<Text color={tone} dimColor>│ </Text>
{draw(row, inner)}
<Text color={tone} dimColor> │</Text>
</Text>
))}
<Text color={tone} dimColor>╰{'─'.repeat(w - 2)}╯</Text>
</Box>
)
}
// A background subagent outlives the main turn, so the timeline runs until its last step ends too.
const end = !t.end || t.spans.some(s => s.end === undefined) ? now : Math.max(t.end, ...t.spans.map(s => s.end ?? 0))
const duration = end - t.start
const cols = inner - LABEL_W
const main = t.spans.filter(s => s.lane === 'main')
const parts = breakdown(main, t.start, end, now)
const pct = (name: string) => Math.round(parts.find(p => p.name === name)?.pct ?? 0)
const toolPct = Math.max(0, 100 - pct('model') - pct('idle'))
const glance: Row = [
{ t: t.end && end !== now ? 'Last turn ' : 'Running ', d: true },
{ t: clock(duration), b: true },
{ t: ' model ', d: true },
{ t: `${pct('model')}%`, c: 'suggestion', b: true },
{ t: ' tools ', d: true },
{ t: `${toolPct}%`, c: 'success', b: true },
{ t: ' idle ', d: true },
{ t: `${pct('idle')}%`, b: true },
]
// One row per loop, the busiest first after main; lanes past the room left fold into a count.
const maxLanes = Math.max(1, Math.floor((e.props.scroll.bodyRows - 20) / 2))
const lanes = t.lanes.slice(0, maxLanes)
const laneRows: Row[] = lanes.flatMap((lane, i) => {
const cells = laneCells(
t.spans.filter(s => s.lane === lane.id),
t.start,
end,
cols,
now,
).map(k => CELL[k])
const row: Row = [{ t: lane.label.padEnd(LABEL_W).slice(0, LABEL_W), b: lane.id === 'main', d: lane.id !== 'main' }, ...cells]
return i ? [[], row] : [row]
})
const hidden = t.lanes.length - lanes.length
const timelineRows: Row[] = [
...laneRows,
...(hidden > 0 ? [[{ t: `+${hidden} more loops`, d: true }]] : []),
[{ t: ' '.repeat(LABEL_W) }, { t: axis(duration, cols), d: true }],
[],
[{ t: '█', c: 'success' }, { t: ' tool ', d: true }, { t: '▒', c: 'suggestion' }, { t: ' model ', d: true }, { t: '█', c: 'error' }, { t: ' failed ', d: true }, { t: '·', d: true }, { t: ' idle', d: true }],
]
// Each share as a bar against the turn's length, model and idle named, tools by name.
const barW = inner - 24
const shareRows: Row[] = parts.slice(0, 6).map(p => {
const filled = Math.round((p.pct / 100) * barW)
const tone = p.name === 'model' ? 'suggestion' : p.name === 'idle' ? undefined : 'success'
return spread(
[{ t: p.name.padEnd(9).slice(0, 9), d: p.name === 'idle' }, { t: '█'.repeat(filled), c: tone, d: p.name === 'idle' }, { t: '·'.repeat(Math.max(0, barW - filled)), d: true }],
[{ t: clock(p.ms).padStart(6), d: true }, { t: `${Math.round(p.pct)}%`.padStart(5), b: true }],
inner,
)
})
const slowest = t.spans
.filter(s => s.end !== undefined)
.sort((a, b) => (b.end ?? 0) - b.start - ((a.end ?? 0) - a.start))
.slice(0, 3)
// A model request has no target of its own, so it is named by its place in its loop: "request 3 of 5".
const requestOf = (s: TimelineSpan) => {
const mine = t.spans.filter(x => x.lane === s.lane && x.kind === 'model')
return `request ${mine.indexOf(s) + 1} of ${mine.length}`
}
const slowRows: Row[] = slowest.length
? slowest.map(s =>
spread(
[
{ t: s.kind === 'model' ? 'model' : s.name, c: s.kind === 'model' ? 'suggestion' : s.ok === false ? 'error' : 'success', b: true },
{ t: ` ${s.lane === 'main' ? '' : `${t.lanes.find(l => l.id === s.lane)?.label ?? ''} `}${s.kind === 'model' ? requestOf(s) : s.detail}`, d: true },
],
[{ t: clock((s.end ?? now) - s.start), b: true }],
inner,
),
)
: [[{ t: 'Nothing has finished yet.', d: true }]]
return (
<Box flexDirection="column" paddingTop={1}>
<Text>
{draw(glance, w - 3)}
</Text>
{frame('Timeline', 'suggestion', timelineRows, `${t.lanes.length} ${t.lanes.length === 1 ? 'loop' : 'loops'}`)}
{frame('Where time went', 'success', shareRows, 'main loop')}
{frame('Slowest', 'warning', slowRows)}
</Box>
)
})Licence text (MIT)
MIT License Copyright (c) 2026 Mehmet Aras 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
drives Claudetool calls
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 bfa1831e396b 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 read | Every module hooks/hooks.json names was read.turn-timeline/hooks/register.tsx |
| Parses | Every file parses as TypeScript or JavaScript.1 files parsed |
| All its code is in the mod | Every import is a file of the mod or the engine's own module; no packages, no require.all its code is in the mod |
| Readable | No 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 open | Network 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 draws | The 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 line | Whether 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 Windows | Whether every program it starts through $.process exists on Windows (tail, date, open, osascript, /usr/… do not).runs no program a Windows PC lacks |
| Network | Whether every fetch names its https host in the code.no network |
| Programs | Whether 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 sends | Whether it both reads files or environment variables and reaches the network.reaches no network |
| Keys in the source | Whether the source holds what looks like an API key or a private key.no keys in the source |
| Licence | An 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 arasovic/claude-code-mods/plugin install turn-timeline@claude-code-modsThis installs the marketplace's latest commit, which may not be the one read here (bfa1831e396b). 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 "arasovic-turn-timeline" with its code and make me a pane like itSearch them from Claude: the MCP connector
Similar designs
-
Ask Claude…Blast RadiusBlast Radius: npm testWould Cancel. Proceed Proceed ProceedProceed 1Cancel 2
-
Ask Claude…Replay TheaterReplay Theater 31 31 31src/app.ts (step 01 of 3)● Write● Write● WritePrev pNext nClose q
-
What it does
- Draws a pane
- Hooks session.end, session.start, ui.close
- Starts processes
-
Ask Claude…Fix login▸★ build ok▸★ build ok▸★ build ok+3 moretasks 3 pending · Glob claimed · 3 doneConsensus42%
-
Ask Claude…2h 10m · █████░░░✓ build ✓ build ✓ buildJavaKotlin3 Python■ ok 3 ■ ok 3 ■ ok 3 Razor proven 3 Razor proven 3 Razor proven 3Phases ──────── 3/3build Pythonbuild Pythonbuild Python… 3 more phasesLua ──────── 3/Kotlin■ the whole upgrade Ruby■ build build Ruby■ build build Ruby■ build build Ruby … 3 moreNext ──────── PythonRuby (by hand)Podsclick a button, or ctrl+x tab then Tab, EnterAttention ──────── 3! Scala ! Scala ! Scala … 3 moreSession ──────── okJava
-
What it does
- Draws a band above the prompt
- Adds /seo-spend, /seo-doctor, /seo-cockpit
- Watches Agent calls and can refuse them
- Hooks agent.spawn, classic.SessionStart, prompt.submit, session.compact and 3 more