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.
npx skills add humanerd-drew/opencode-drewgent --skill search-files-content-trimgit clone --depth 1 https://github.com/humanerd-drew/opencode-drewgentWrote 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.
[](https://agentmods.dev/skills/humanerd-drew/opencode-drewgent/search-files-content-trim)<a href="https://agentmods.dev/skills/humanerd-drew/opencode-drewgent/search-files-content-trim"><img src="https://agentmods.dev/badge/skills/humanerd-drew/opencode-drewgent/search-files-content-trim.svg" alt="Measured on agentmods" height="20"></a>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.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00036 | $0.01359 |
| Opus 5 | $0.00018 | $0.00679 |
| Sonnet 5 | $0.00007 | $0.00272 |
| Haiku 4.5 | $0.00004 | $0.00136 |
Grade A, and why
search-files-content-trim 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 4d 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.
How it starts
The opening of the file, as written. The whole thing — 93 lines — stays where its author put it; the contents beside it link to each section on GitHub.
search_files Content Trim — Token-Efficient Default
Audit Finding (2026-05-31)
{{AGENT_NAME}}의 search_files tool은 757자짜리 line을 500자 (ripgrep MAX_CONTENT cap)까지 매번 그대로 LLM context에 push했음. 단일 검색 결과 한 match에 500자 × 50 matches = 25,000 chars/검색. 99.2%의 검색 call은 path:line만 필요하고, full content는 LLM이 read_file()로 follow-up할 일 — 첫 search response의 full content는 낭비.
원인: ripgrep의 MAX_CONTENT=500이 1차 cap. search_tool은 그 이상 truncate 안 함. LLM은 매번 500 chars/line을 받음.
Fix (shipped 2026-05-31)
~/.{{AGENT_NAME_LOWER}}/source/{{AGENT_NAME_LOWER}}-agent/tools/file_tools.py 의 search_tool에 2개 파라미터 추가:
| param | type | default | 의미 |
|---|---|---|---|
include_content |
bool | False |
True면 full content, False면 preview로 truncate |
preview_chars |
int | 100 |
False일 때 매치당 보존할 글자 수. 0이면 content 완전 drop (path:line만) |
적용 위치 (총 4개):
SEARCH_FILES_SCHEMA— input schema에 2 properties 추가search_toolsignature — 2 파라미터 + docstring에 audit 결과 명시search_toolbody —redact_sensitive_text직후 preview truncate 로직 (preview_chars=0→"",> preview_chars→[:preview_chars] + "...")_handle_search_fileshandler — args 2개 pass-through
Effect (verified)
| 시나리오 | Before | After (default) | 절약 |
|---|---|---|---|
| 757자 line 1 match | 500 chars | 103 chars (100+3) | 79% |
| 50 matches × 500 chars | 25,000 chars | 5,150 chars | 79% |
preview_chars=0 (path:line만) |
500 chars | 0 chars | 100% |
include_content=True (회귀 없음) |
500 chars | 500 chars | 0% (의도) |
When To Use
- default (no flag): LLM이 path:line만 필요하고 read_file()로 follow-up할 때. 대부분의 search 호출이 여기에 해당.
preview_chars=0: "이 file들이 존재하는지만 알면 됨" 케이스. 50개 file의 path:line만 받고 다음 단계로 넘어감.include_content=True: LLM이 full line을 보고 결정해야 할 때 (e.g. multi-line regex match, raw text/JSON structure 파악).
Pattern: Token-Efficient Tool Default
이 패턴은 다른 tool에도 동일 적용 가능:
- Audit current behavior: 한 tool call이 평균 몇 char를 LLM context에 push하는지 측정
- Default = cheapest sane option: full content 필요 케이스만 opt-in (include_*=True)
- Tunable:
preview_chars같은 numeric param으로 user가 명시적으로 trade-off 조절 - Schema에 명시: LLM이 schema description 읽고 알아서 적절히 선택하도록 guide
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.
- 4d ago First seen · 93 lines · 36 tokens per session scan A 90d6f2551f1f
search-files-content-trim is a skill published in the GitHub repository humanerd-drew/opencode-drewgent (2 stars, last pushed 1mo ago), licensed MIT. It adds 36 tokens to every session and 1,359 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-03.
Other skills, from other repositories
notes
Create and manage text notes in the workspace.
session-search
Use Moraine MCP tools to recover prior agent-session context when the user refers to earlier work, decisions, failures, branches, files, or other agents.
file-search
Find files and search content across directories.
tmux
Manage tmux terminal sessions.
agent-token-saver
Route token-heavy context, noisy shell logs and output through the smallest measured CLI or projection before loading heavy tools; recall past agent sessions before re-deriving; fan out to free lanes; benchmark cheap subagent workflows without broad prompt bloat.
rotation-check
Standard-Gerüst für rotierende Pipeline-Checks: Pro Lauf genau ein Ziel aus einer Menge (Projekte, Ordner, Repos) wählen — bevorzugt das am längsten ungeprüfte —, den Check durchführen, Ergebnis in einer Check-Registry und einem Verlaufslog festhalten. Nutze diesen Skill, wenn ein wiederkehrender Check über viele…