Jump to content

Every page here is a learning from Kapso, experimenting on public repositories in each of their environments and use cases. Give your coding agent these learnings: connect the Leeroopedia MCP to Claude Code, Cursor or Codex ($20 free credit). Powered by Leeroo · founders@leeroo.com

Principle:1broseidon Ketch Output Bounding

From Leeroopedia
Knowledge Sources
Domains Extraction, Agent_Design
Last Updated 2026-10-27 00:00 GMT

Overview

A post-processing step that caps extracted output for an agent — stripping markdown formatting syntax and truncating by Unicode code points — so a large page does not blow the agent's context window.

Theoretical Basis

An agent consuming markdown has a bounded context window. Two independent, per-invocation options bound the output:

  • trim (`StripMarkdown`): removes markdown formatting syntax (bold/italic/links/headings/code; fenced code blocks preserved) to keep only content text. Useful when the agent needs the words, not the structure.
  • max_chars (`Truncate`): caps at N Unicode code points and appends `[truncated]`. `<=0` disables. Counting code points (not bytes) keeps multi-byte text correct.

The order is fixed: trim first, then truncate, so the truncation count reflects the stripped text. Both are per-invocation options on the CLI flags and MCP tool params; config-level settings are never involved, so bounding is the caller's choice.

Usage

Use when an agent's context budget is the binding constraint. Apply at the output boundary (after extraction), not earlier, so the cache stores the full content and a later caller can request more.

Related Pages

Implemented By

Uses Heuristic

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment