kaiord: Agent for Claude Code

.claude/agents/complexity-reducer.md

complexity-reducer is an agent for Claude Code from pablo-albaladejo/kaiord. It costs 23 tokens per session (1,170 once invoked), scanned A, original, MIT.

A code-refactoring agent that breaks large files into smaller ones, extracts functions, and lowers the number of paths through the code.

In plain words
What is it for?
Use it in the Kaiord monorepo, a repository containing multiple related packages, to find oversized TypeScript files and functions and split or simplify them.
Why use it?
It helps make complex code easier to read and maintain while keeping its behavior, interfaces, and tests unchanged.

Agent for Claude Code

Written for Claude Code: installed under .claude/. Also seen: model in frontmatter; mentions CLAUDE.md.

This is pablo-albaladejo/kaiord's own configuration. It tells Claude Code how to work on kaiord itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything kaiord configures →

Reuse

Borrowing it

Nothing to install: this file belongs to pablo-albaladejo/kaiord. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.

Copy the file
curl -O https://raw.githubusercontent.com/pablo-albaladejo/kaiord/main/.claude/agents/complexity-reducer.md
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 complexity-reducer

README.md
[![agentmods](https://agentmods.dev/badge/agents/pablo-albaladejo/kaiord/complexity-reducer/github.svg)](https://agentmods.dev/agents/pablo-albaladejo/kaiord/complexity-reducer)
Your own site
<a href="https://agentmods.dev/agents/pablo-albaladejo/kaiord/complexity-reducer"><img src="https://agentmods.dev/badge/agents/pablo-albaladejo/kaiord/complexity-reducer/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for complexity-reducer

Your own site · 80×15
<a href="https://agentmods.dev/agents/pablo-albaladejo/kaiord/complexity-reducer"><img src="https://agentmods.dev/badge/agents/pablo-albaladejo/kaiord/complexity-reducer.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 23 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,170 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
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.1 $0.00023 $0.01170
Opus 5.5 $0.00009 $0.00468
Sonnet 5.5 $0.00005 $0.00234
Haiku 4.5 $0.00002 $0.00117

Measured 1mo ago against content hash 8b5209fd70aa, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

complexity-reducer 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 1mo 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/complexity-reducer.md · 158 lines

How it starts

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

You are the Complexity Reducer agent for the Kaiord monorepo. Your mission is to reduce code complexity while maintaining identical behavior.

Scope

You refactor for simplicity ONLY. You do not add features, change APIs, or modify test behavior. Every refactoring must be behavior-preserving. Existing tests must continue to pass without modification (unless they test internal implementation details that changed).

Project Limits

Metric Limit Source
File size 100 lines max CLAUDE.md
Function size 40 lines max CLAUDE.md
React component 60 lines max CLAUDE.md
Functions over classes Always CLAUDE.md

Execution Protocol

Phase 1: Identify Targets (max 3 turns)

  1. Find oversized files:
    find packages/*/src -name "*.ts" ! -name "*.test.ts" ! -name "*.d.ts" -exec wc -l {} + | sort -rn | head -20
    
  2. Find oversized functions (heuristic: search for function bodies exceeding 40 lines)
  3. Rank by severity: lines over limit * file importance

Phase 2: Plan Splits

For each file exceeding 100 lines:

  1. Read the file and identify logical groupings
  2. Plan the split:
    • What stays in the original file
    • What moves to new files
    • What shared types/helpers are needed
  3. Ensure exports remain unchanged (no breaking API changes)

Phase 3: Execute Refactoring

For each planned split:

  1. Create new files for extracted functions/types
  2. Move code to new files with proper imports
  3. Update the original file to re-export if needed
  4. Update all import sites (grep for old imports)
  5. Verify: pnpm --filter <package> test 2>&1
  6. Verify: pnpm --filter <package> lint 2>&1

Phase 4: Function Extraction

For functions exceeding 40 lines:

  1. Identify extractable sub-operations
  2. Extract to named helper functions in the same file (or a new helpers file if the file is also too long)
  3. Use descriptive names that document intent
  4. Verify tests still pass

Read the full file on GitHub · 158 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. 1mo ago First seen · 158 lines · 23 tokens per session scan A 8b5209fd70aa

Subscribe to this mod's changes

complexity-reducer is an agent published in the GitHub repository pablo-albaladejo/kaiord (9 stars, last pushed today), licensed MIT. It adds 23 tokens to every session and 1,170 once invoked, about $0.0001 per session on Opus 5.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

pre-commit-reviewer

Use this agent to review code changes before committing and pushing to a PR. This agent analyzes diffs for bugs, style issues, dead code, missing tests, and alignment with target repository conventions. Use as a fallback when the PR review toolkit is unavailable, or dispatch directly for standalone pre-commit review.…

costajohnt/oss-autopilot · 243 tokens

workflow-quality

Use this agent when you need expert guidance on Output SDK implementation patterns, code quality, and best practices. Invoke when writing or reviewing workflow code, troubleshooting implementation issues, or ensuring code follows SDK conventions.

growthxai/output · 43 tokens

ts-enforcer

TypeScript strict mode enforcement — no any types, schema-first at trust boundaries, type vs interface discipline, strict tsconfig audit.

bdfinst/agentic-dev-team · 29 tokens

typescript-software-architect-review

Expert TypeScript software architect that provides Clean Architecture, Domain-Driven Design (DDD), Node.js patterns, and modern TypeScript frameworks guidance. Reviews TypeScript codebases for architectural integrity, proper separation of concerns, and best practices across Express, Fastify, NestJS, and other…

giuseppe-trisciuoglio/developer-kit · 89 tokens

sdd-tester

Runs the project's verification suite (type-check, lint, tests) and reports pass/fail with concrete failures. Use AFTER the implementer finishes a task and BEFORE the verifier. Read-only on source. Stack-agnostic — reads the commands from .memory/30-tech.md.

chohra-med/expo_boilerplate · 61 tokens

typescript-reviewer

TypeScript-specific code reviewer focusing on type safety, async patterns, and frontend best practices. Use after implementing TypeScript code to catch TypeScript-specific issues.

DmitriyYukhanov/claude-plugins · 35 tokens