timebase

timebase is a skill for Claude Code, Codex from Generous-Corp/pulp. It costs 42 tokens per session (3,646 once invoked), scanned A, original, MIT.

A guide to the exact time and position calculations used by a music or media system. It covers beats, tempo and meter changes, sample positions, quantization, and safe arithmetic.

In plain words
What is it for?
Use it when editing musical time conversion, tempo or meter maps, transport-grid projection, or beat and frame quantization.
Why use it?
It gives agents the rules needed to change timing code without introducing rounding errors, invalid maps, or integer overflow.

Skill for Claude CodeCodex

Part of the pulp plugin — 63 skills, 30 commands, 3 hooks, 1 MCP server shipped together

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/generous-corp/pulp/timebase
Any agent
npx skills add Generous-Corp/pulp --skill timebase
Clone the repo
git clone --depth 1 https://github.com/Generous-Corp/pulp

Made for: Claude Code, Codex.

Or install pulp, the plugin that ships this one along with the rest of its 63 skills, 30 commands, 3 hooks, 1 MCP server.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for timebase

README.md
[![agentmods](https://agentmods.dev/badge/skills/generous-corp/pulp/timebase.svg)](https://agentmods.dev/skills/generous-corp/pulp/timebase)
Your own site
<a href="https://agentmods.dev/skills/generous-corp/pulp/timebase"><img src="https://agentmods.dev/badge/skills/generous-corp/pulp/timebase.svg" alt="Measured on agentmods" height="20"></a>
Per session 42 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 3,646 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00042 $0.03646
Opus 5 $0.00021 $0.01823
Sonnet 5 $0.00008 $0.00729
Haiku 4.5 $0.00004 $0.00365

Measured today against content hash ba11a2506c99, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

timebase scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured today.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.agents/skills/timebase/SKILL.md · 259 lines

How it starts

The opening of the file, as written. The whole thing — 259 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Timebase

Use this skill when changing core/timebase, tempo conversion, or the transport quantizer's beat/frame arithmetic.

Contracts

  • kTicksPerQuarter is 705,600. Musical positions are stored and accumulated as integer TickPosition; samples use integer SamplePosition. Tick-position, duration, and MonotonicBeat arithmetic saturates at the signed 64-bit endpoints; it must not invoke signed-overflow UB.
  • TempoMap and MeterMap are editable document values built through nonthrowing factories. Their first point is tick zero and points are strictly ordered. Meter changes must compile on exact preceding bar boundaries.
  • CompiledTempoMap is immutable and sample-rate-specific. Construct it only through CompiledTempoMap::compile() and handle TempoMapError; public throwing construction is forbidden. Its first tempo point is tick zero, points are strictly ordered, and BPM is finite in [1, 1000].
  • Tempo ramps are BPM-linear in tick position. Integrate them analytically; do not approximate ramps block-by-block or accumulate floating-point deltas.
  • Every segment begins at an integer sample anchor. samples_to_ticks() returns the first canonical tick mapping to that sample when one exists. Exact sample -> tick -> sample requires a tick grid at least as dense as samples. On a sparser grid, use resolve_sample() and inspect represented_sample, absolute_error_samples, and exact; the nearest tick is returned.
  • Arbitrary tick -> sample -> tick cannot be identity because many ticks share an integer sample. Test monotonicity and canonical-sample preservation instead.
  • Render-time phase mapping may use fractional_ticks_to_samples() and its analytic inverse fractional_samples_to_ticks(). Both retain the compiled integer segment anchors but avoid rounding their input/output domains; keep ramp round-trip coverage at fractional interior positions.
  • TempoCursor is the allocation-free playback path. Monotonic sample advances consume segment transitions once (amortized O(1)); seeks and loop wraps reset it explicitly. Differential tests must match cold-map canonical results.
  • CompiledMeterMap uses zero-based bars and exact integer bar/tick conversion. Tempo changes never affect bar conversion and meter changes never affect tick/sample conversion. Conversion is total across INT64_MIN..INT64_MAX: exact results are returned when representable and out-of-range results saturate without signed-overflow UB.
  • Keep TransportQuantizer's public behavior stable. Generic beat/frame/grid arithmetic belongs in <pulp/timebase/quantize.hpp> and the format wrapper delegates to it.
  • BeatDivision is an append-only persisted ordinal vocabulary. Append new values immediately before Count, assign every ordinal explicitly, and keep beat_fraction() reduced. division_ticks() must fail if a future fraction is not exactly representable on the 705,600-tick quarter-note lattice.
  • BeatDivision owns the canonical fraction table. The older signal::units::Division vocabulary is a compatibility adapter: preserve its lowercase public spellings and persisted ordinals, map it to BeatDivision, and derive its beat values from beat_fraction_or(). Append both enums in the same change and keep exhaustive compile-time and runtime parity coverage in test_signal_units.cpp; never add a second division formula in signal.
  • Grid projection consumes explicit document and monotonic anchors in GridProjectionRange; it does not infer transport state from an unwrapped sample clock. This matches playback::MasterTransport: pre-loop material uses its ordinary document interval, loop passes repeat the loop's document sample interval and tempo image, and seeks change the document anchor without resetting MonotonicBeat. Ranges and callbacks are half-open, so splitting a callback cannot duplicate a boundary. Keep capacity and signed-domain failure explicit and leave caller output untouched on insufficient capacity. Bound candidate opportunities before entering either timeline- or bar-grid loops; counting only emitted points leaves incoherent remote-sample ranges able to burn unbounded callback time.
  • For document-clock projection, enumerate the rounded end tick as a candidate and let [timeline_sample_start, timeline_sample_start + frame_count) decide ownership. Sparse maps can give a valid one-frame transport range equal rounded tick endpoints (at 1 BPM/48 kHz, tick 0 maps to sample 0 and tick 1 to sample 4). Returning early drops tick 0 from a 1 + 3 split even though a four-frame block emits it; excluding the end candidate merely moves the bug. The next range's sample filter prevents duplication.
  • A host-beat-mapped transport range carries fractional host tick endpoints and maps an exact document tick proportionally into output frames. Preserve that metadata in the dependency-lower grid range and match playback's half-open, floor-to-frame rule. Range-local proportions are not callback invariant when a loop boundary's output count was rounded. Retain one HostGridAnchor (normalized source tick, absolute frame, ticks per frame) across the continuous session interval, give each range its absolute first frame and loop-pass document-to-source offset, and floor on that stable clock before clamping to the owning half-open range. Initialize the source tick from the first resolved range in a normalization epoch, not from an absolute host beat that the transport has already wrapped into document coordinates; reset the anchor on an epoch or slope discontinuity. Never feed such a range through CompiledTempoMap::ticks_to_samples(): session tempo is independent of the document tempo, including on split loop ranges.
  • project_ratchet_interval() treats the hit count as including the onset and excludes the later clock boundary. It distributes integer-tick remainders from the original interval coordinates on every projection; do not advance a floating-point phase or carry remainder state between callbacks. Half-open windows must concatenate to the same schedule as one whole-window call. Reject a hit count greater than the integer-tick span rather than emitting duplicate positions.
  • LoopRegion (<pulp/timebase/loop_region.hpp>) is two document positions plus whether they are in force, and it lives here rather than beside a consumer because that is the whole of it. playback::LoopRegion is an alias of it and timeline_editor::UiPlayhead::loop names it directly, so the rung that runs the transport and the rung that draws the ruler cannot drift apart. enabled gates wrapping, not existence: a disabled loop keeps its bounds so a view goes on drawing the region and re-enabling returns the user to it.
  • A value type both the transport rung and the editor rung need belongs here, and this module is the only place it can go. playback's floor and timeline_editor's floor exclude each other; timebase is in both, so it is their entire intersection apart from platform/runtime. Reaching for a shared home anywhere else means widening a floor row, which is the thing the ladder exists to prevent. Before adding one, confirm the intersection still holds in MODULE_FLOORS (timeline_engine_dependency_floor_check.py) rather than assuming it.

Read the full file on GitHub · 259 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. today First seen · 259 lines · 42 tokens per session scan A ba11a2506c99

Subscribe to this mod's changes

timebase is a skill published in the GitHub repository Generous-Corp/pulp (16 stars, last pushed today), licensed MIT. It adds 42 tokens to every session and 3,646 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-04.

Related

Other skills, from other repositories

systematic-debugging

Use when encountering any bug, test failure, or unexpected behavior, before proposing fixes.

obra/superpowers · 21 tokens

local-ai-agents

Build local-first AI agents that run entirely on a developer workstation with Microsoft Foundry Local and Qwen function-calling models. Covers Small Language Models (SLMs), the OpenAI-compatible local endpoint, sandboxed local tools, local RAG with Chroma, local MCP servers, hybrid cloud/local routing, and the…

microsoft/ai-agents-for-beginners · 200 tokens

next-cache-components-adoption

Turn on Cache Components in a Next.js app and resolve the blocking routes it surfaces. Use when the user wants to enable, adopt, or migrate to Cache Components, flip the cacheComponents flag, work through a flood of blocking-prerender / instant validation errors, run the cache-components-instant-false codemod, or…

vercel/next.js · 95 tokens

chat-pet-sprite-creation

Use when creating or changing VS Code chat pet sprite art, sprite sheets, state animations, eye treatments, Stable/Insiders variants, or pet transitions under src/vs/workbench/contrib/chat/browser/widget/media/chatPet.

microsoft/vscode · 53 tokens

cpu-profile-analysis

Analyze V8/Chrome CPU profiles (.cpuprofile) and DevTools trace files (Trace-.json). Use when: profiling performance, investigating slow functions, comparing code paths, finding bottlenecks, analyzing timeToRequest, understanding call trees from sampling profiler data, analyzing layout/paint/rendering, investigating…

microsoft/vscode · 71 tokens

insight-error-page

Write or audit an insight-kind error page for the Next.js dev overlay. Use when creating a new errors/ .mdx page, auditing an existing one, or checking that a page matches the framework fix cards. Covers page structure, title alignment, FixCard cards with Copy prompt button, code snippets, terminology verification…

vercel/next.js · 83 tokens