Skip to content
Back to skills

535 Utils Limits 2e798909

ASecurity

Centralized tool output limits with cascading defaults

  • 9 stars
  • 0 votes
  • 0 copies
  • 3 views
  • Added June 1, 2026
toolspythonbash

Security analysis

A100/100

Pro scans all 2 files and shows the line behind each finding

Scanned June 1, 2026

npx -y skills add tools-only/X-Skills --skill 535-utils-limits_2e798909 --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of 535 Utils Limits 2e798909?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for 535 Utils Limits 2e798909
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/tools-only-535-utils-limits-2e798909/badge)](https://www.skillsdirectory.com/skills/tools-only-535-utils-limits-2e798909)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
title: Utils Limits
path: src/tunacode/configuration/limits.py
type: file
depth: 1
description: Centralized tool output limits with cascading defaults
exports: [get_command_limit, get_max_files_in_dir, get_max_tokens, clear_cache]
seams: [M]
---

# Utils Limits

## Purpose

Centralizes tool output limit configuration with a two-tier precedence system.

## Precedence System

```
explicit setting > standard default
```

Implemented in `_get_limit()`:

```python
def _get_limit(key: str, default: int) -> int:
    settings = _load_settings()

    # Explicit setting wins
    if key in settings:
        return settings[key]

    return default
```

## Key Functions

### get_command_limit()

Max chars from `bash` output.
- Standard: 5000 chars

### get_max_files_in_dir()

Max entries from `list_dir`.
- Standard: 50 files

### get_max_tokens()

Cap on model response length.
- Explicit `max_tokens` setting takes precedence
- Standard mode: returns `None` (unlimited)

### clear_cache()

Clears the `@lru_cache` on settings. Call when config changes at runtime.

## Integration Points

| Consumer | File | Usage |
|----------|------|-------|
| Bash tool | `tools/bash.py` | `get_command_limit()` |
| List dir tool | `tools/list_dir.py` | `get_max_files_in_dir()` |
| Agent config | `core/agents/agent_components/agent_config.py` | `get_max_tokens()` |

## Design Notes

- **Caching**: Uses `@lru_cache(maxsize=1)` for settings load
- **Circular import avoidance**: Imports config loader inside function

## Constants Location

Default values defined in `constants.py`:

```python
MAX_COMMAND_OUTPUT = 5000
MAX_FILES_IN_DIR = 50
```

## Seams (M)

**Modification Points:**
- Add new limit types (follow `_get_limit()` pattern)
- Change default values in `constants.py`

Files in this skill

  • README.md887 B
  • skill.md1.7 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.