Repository navigation
Description
Summary
Agent definitions (.claude/agents/*.md) that work in other harnesses (Claude Code) get silently truncated in mecatl, and the log message calls it "skipped" even though the def is still loaded. Two related problems:
A. The body cap is too tight for real-world defs
The caps are defined canonically in engine/tool/agentsource.go:
MaxAgentDescriptionBytes = 800(:38)MaxAgentBodyBytes = 8 * 1024(8192) (:45)
A def over a cap is truncated, not dropped — it stays loaded with a clipped description/body (internal/adapter/agents/discover.go:363-377, via toolkit.TruncateRunes). Claude-Code-style specialist defs commonly run 10–20 KB bodies, so an 8 KiB cap silently drops ~60% of the specialist's system prompt — the agent still "runs" but on a half-instruction-set persona.
Blast radius differs by cap, which should drive the sizing:
- The description rides the Subagent tool's
Spec().Descriptionon every request, summed across all registered agents → genuinely expensive; raise modestly (e.g. ~1500–2000 B) if at all. - The body is in-context only for that one specialist engine's turns (not the parent's per-request surface) → cheap; for 128K+ context windows an 8 KiB system-prompt layer is negligible. Strong case to raise substantially (e.g. 16–32 KiB) or make configurable.
Rationale for the caps (ADR docs/adr/0013-agent-definitions.md; comments at agentsource.go:30-45): bound always-in-context per-turn token spend and preserve the byte-stable prompt-cache prefix. Any change is a one-time prefix-cache invalidation and must keep the prefix deterministic.
Options: (1) raise the body cap (cheap) + modest description bump; (2) make caps operator-configurable with safe defaults; (3) align cap severity with blast radius — keep the description tight, treat the body cap as a generous safety bound.
B. The "agent def skipped" log label is inaccurate
All outcomes funnel through one WARN call site — internal/app/agentdefs.go:1097-1099 — with the literal message "agent def skipped". But the reasons cover both fatal drops and non-fatal kept-with-notes cases:
| reason | def dropped? |
|---|---|
description is N bytes; truncated to … 800 bytes |
No — kept |
body is N bytes; truncated to … 8192 bytes |
No — kept |
… shadowed by a higher-precedence source |
dropped (same name kept elsewhere) |
malformed YAML frontmatter / missing name/description |
yes — excluded |
duplicate agent name / cannot read |
yes — excluded |
mcpServers entry / memory: not supported notes |
No — kept |
The truncation/mcp/memory cases keep a usable def, so "skipped" at WARN reads to an operator as "this agent wasn't loaded" — which is what prompted this report. The structural distinction already exists (empty perr + notes = kept; non-empty perr = dropped, internal/adapter/agents/source.go:40-55); the call site just flattens both. Fix: split the log into "truncated/adjusted" (kept) vs "skipped/dropped" (excluded).
Acceptance
- Body cap raised (and/or made configurable); description cap reviewed; rationale + prompt-cache-prefix determinism preserved; tests cover the new bounds.
- Truncation/kept-with-notes WARNs no longer say "skipped"; only fatal exclusions do.
Found via live perf monitoring (≈480 benign agent def skipped WARN lines/session from atrium defs). Shares the "honest, recoverable messaging" theme with #152/#153.
Activity
fix(agents): raise agent-def caps and stop mislabeling truncation as …