bundle-optimizer

bundle-optimizer is an agent for Claude Code from pablo-albaladejo/kaiord. It costs 24 tokens per session (1,016 once invoked), scanned A, original, MIT.

An autonomous tool for reducing the size of compiled JavaScript packages, called bundles, without changing their runtime behavior.

In plain words
What is it for?
Use it in the Kaiord monorepo, a repository containing multiple related packages, when built packages exceed their size limits. It measures output, examines build settings and imports, and optimizes the affected packages.
Why use it?
Smaller bundles can be shipped and loaded with less code. It focuses the work on removing unused code and improving how the build selects what to include.

Agent for Claude Code

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 agents/pablo-albaladejo/kaiord/bundle-optimizer
Clone the repo
git clone --depth 1 https://github.com/pablo-albaladejo/kaiord

Made for: Claude Code.

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 bundle-optimizer

README.md
[![agentmods](https://agentmods.dev/badge/agents/pablo-albaladejo/kaiord/bundle-optimizer.svg)](https://agentmods.dev/agents/pablo-albaladejo/kaiord/bundle-optimizer)
Your own site
<a href="https://agentmods.dev/agents/pablo-albaladejo/kaiord/bundle-optimizer"><img src="https://agentmods.dev/badge/agents/pablo-albaladejo/kaiord/bundle-optimizer.svg" alt="Measured on agentmods" height="20"></a>
Per session 24 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,016 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.00024 $0.01016
Opus 5 $0.00012 $0.00508
Sonnet 5 $0.00005 $0.00203
Haiku 4.5 $0.00002 $0.00102

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

Security

Grade A, and why

bundle-optimizer 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 3d ago.

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.

.claude/agents/bundle-optimizer.md · 143 lines

How it starts

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

You are the Bundle Optimizer agent for the Kaiord monorepo. Your mission is to reduce bundle sizes to meet per-package thresholds.

Scope

You optimize bundle output ONLY. You do not change functionality, add features, or modify test behavior. Every change must produce identical runtime behavior with smaller output.

Bundle Thresholds

Package Max Size
@kaiord/core 50 KB
@kaiord/fit 200 KB
@kaiord/tcx 200 KB
@kaiord/zwo 200 KB
@kaiord/garmin 200 KB
@kaiord/garmin-connect 200 KB
@kaiord/cli 500 KB
@kaiord/mcp 500 KB
@kaiord/ai 200 KB

Execution Protocol

Phase 1: Measure Baselines (2 turns)

  1. Build all packages: pnpm -r build
  2. Measure each dist:
    for pkg in packages/*/dist; do
      echo "$(du -sh $pkg) -> $(basename $(dirname $pkg))"
    done
    
  3. Identify packages exceeding thresholds

Phase 2: Analyze Composition (3 turns)

For each oversized package:

  1. Check tsdown/vite config for optimization gaps:
    • treeshake: true enabled?
    • splitting: true for code-splitting?
    • Unnecessary formats (CJS when only ESM needed)?
    • Source maps in production?
  2. Check for wildcard imports: grep -r "import \* as" packages/<pkg>/src/
  3. Check for barrel re-exports pulling in unused code
  4. Check for heavy dependencies: analyze node_modules contribution

Phase 3: Optimize

Apply optimizations in order of impact:

  1. Convert wildcard imports to named imports

    // Before
    import * as zod from "zod";
    // After
    import { z } from "zod";
    
  2. Remove unused exports from barrel files

    • Check if exported symbols are actually imported elsewhere
    • Remove dead exports
  3. Enable tree-shaking in build config

    // tsdown.config.ts
    treeshake: true,
    

Read the full file on GitHub · 143 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. 3d ago First seen · 143 lines · 24 tokens per session scan A b4d8edc0a1f0

Subscribe to this mod's changes

bundle-optimizer is an agent published in the GitHub repository pablo-albaladejo/kaiord (9 stars, last pushed 7d ago), licensed MIT. It adds 24 tokens to every session and 1,016 once invoked, about $0.0001 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-08-31.

Related

Other agents, from other repositories

audit-creative

Cross-platform creative specialist. Returns schema-valid findings covering creative fit, concept diversity, fatigue, format coverage, message match, and evidence-backed refresh recommendations.

AgriciDaniel/claude-ads · 34 tokens

stage-6-settlement

Agent "stage-6-settlement" from TelivityAI/otaip, covering stage 6 -- settlement agents, agent 6.1 -- refund processing, agent 6.2 -- adm prevention, agent 6.3 -- adm/acm processing and agent 6.4 -- customer communication.

TelivityAI/otaip · 0 tokens

esther

Use this agent when reviewing terms of service, privacy policies, ensuring regulatory compliance, or handling legal requirements. This agent excels at navigating the complex legal landscape of app development while maintaining user trust and avoiding costly violations. Examples:\n\n \nContext: Launching app in…

CarbeneAI/Forge · 0 tokens

barnabas

Use this agent for Discord server administration, community management, announcements, moderation, and member engagement. Specializes in the Cyber Defense Tactics Discord community. Reports to Chief Marketing Officer.

CarbeneAI/Forge · 39 tokens

philemon

Use this agent when you need email management, Gmail monitoring, spam filtering, email categorization, or email notifications via Telegram. Specialized in processing personal and workspace Gmail accounts with intelligent spam/phishing detection.

CarbeneAI/Forge · 44 tokens

gpd-research-synthesizer

Synthesizes research outputs from parallel researcher agents into SUMMARY.md. Spawned by the new-project or new-milestone orchestrator workflows after 4 parallel researcher agents complete.

psi-oss/get-physics-done · 44 tokens