Skill Packs and CLIs: A Low-Pollution, Composable Tool Layer for AI Agents

    AI agents need external capabilities to do real work, but inserting every tool description, parameter, example, and constraint into the context window quickly consumes the model’s working memory. This article explains how to separate what the model needs to know from what the runtime actually executes by using versioned skill packs loaded on demand and narrow, auditable command-line execution surfaces. It covers context pollution, composability, permission boundaries, output contracts, practical adoption, observability, evaluation, and human confirmation for irreversible actions.

    AI agents that do real work almost always need to call external capabilities: look up information, edit files, run tests, send messages, and pull monitoring data. The problem is not whether the agent can call these capabilities. The problem is how those capabilities enter the model’s working memory. A common approach writes the names, parameters, examples, and constraints of many tools into the context all at once. Once the window grows long, the model has not even started working, yet its attention is already occupied by manuals. Another approach packages capabilities as skill packs that can be loaded on demand, then executes them through a command-line interface or an equivalent narrow interface. The first approach is like spreading an entire manual on the desk. The second is like providing a table of contents first and opening only the chapter that is needed.

    Why Context Gets Polluted by Tool Protocols

    Context is not an unlimited scratchpad. System prompts, conversation history, retrieved snippets, tool returns, and the current task description all compete for the same budget. Tool-layer pollution usually falls into four categories.

    First, static bloat. Every tool comes with parameter tables, enum values, error codes, and call examples. When the number of tools grows from ten to hundreds, fixed overhead grows linearly, while a task often uses only two or three of them.

    Second, dynamic reinjection. A single failure returns an entire log, a full web page, or a complete object tree, and the next turn inserts that text back verbatim. The model begins to repeat noise instead of advancing toward the goal.

    Third, semantic overlap. Multiple tools can “search,” “summarize,” or “execute,” and their descriptions look similar, so selection becomes guesswork. The more overlapping descriptions there are, the more mis-calls occur, and mis-calls produce even more garbage returns.

    Fourth, lack of composability. The output fields of tool A and the input fields of tool B have no stable contract, so the model has to stitch them together on the fly. The stitching logic lives in the conversation, cannot be versioned, and cannot be reused by another task.

    The direct consequences of pollution are reduced effective reasoning depth, drifting tool selection, rising cost per turn, and unstable results when the same task is phrased differently. For engineering teams, the bigger problem is debugging difficulty: it is hard to tell whether the model made a bad judgment or whether the context never contained a clean basis for the decision.

    Why “Exposing All Tools at Once” Is Not Composable

    Composability means capabilities can evolve independently, be trimmed by permission, be assembled per task, and have failures retried locally. Permanently attaching all tool descriptions to a session violates these properties.

    Capability boundaries become unclear. If reading files, writing files, executing scripts, and accessing the network all share one extremely long description, least privilege cannot be enforced. When the model sees a description of write permission, it may attempt modifications during a task that should only read.

    Versions become coupled. When a protocol or parameter changes, the “manual” for every session must be refreshed. When examples in old conversations conflict with new interfaces, the model calls according to the old shape it remembers.

    Testing becomes difficult. You cannot unit test “this small capability” because correct behavior depends on whether other tool descriptions are present in the same context, in what order, and whether they were truncated.

    Human collaboration also gets worse. Human reviewers face a large mix of tool descriptions and intermediate results, and they cannot tell which step was an authorized action and which was only exploration.

    The right direction is therefore not to pile on more tool descriptions, but to separate “what the model needs to know” from “what the runtime actually executes.”

    Skill Packs: Capability Boundaries Loaded per Task

    A skill pack can be understood as a short, versionable work instruction, not another giant protocol. It answers only four things: what problem the skill solves, when it should be enabled, which resources it may touch, and how success and failure are determined.

    A practical skill pack should keep “thin description, thick execution”:

    • Intent: define inputs and outputs in one or two sentences, and avoid putting implementation details into the prompt.
    • Triggers: state applicable and non-applicable boundaries so that similar skills do not compete for the same work.
    • Permissions: declare only the read, write, network, or secret scope this skill needs, and deny everything else by default.
    • Step skeleton: list check, execute, and verify as three steps, without carrying every flag of every command into context.
    • Stop conditions: define when to ask a human and when to fail directly with a structured reason.

    Loading should be on demand, not full injection at session start. During planning, keep only a skill catalog: name, one-line purpose, and risk level. After the model selects a skill, load that skill’s short description. Unload it when the task ends or the phase changes. In this way, what persists in context is a catalog, not an encyclopedia.

    Composition between skills relies on contracts, not on the model remembering what the previous output looked like. The previous step hands over only a small structured result, such as status, path, summary, and error code; the next step consumes only those fields. Raw logs, long documents, and binaries remain in external storage. Context holds references and hashes, and content is truncated as needed when the window allows.

    CLIs: A Narrow and Auditable Execution Surface

    The command-line interface is a good executor behind skills for a simple reason: parameters are explicit, output can be redirected, permissions can be constrained by operating-system accounts and working directories, and the process can be logged. For an agent, the CLI is not a shell for free improvisation; it is a set of pre-approved actions.

    It is useful to reduce the execution surface into three layers.

    The discovery layer provides only read-only, low-side-effect commands, such as listing directories, viewing status, and reading summaries. Returns must be length-limited. Oversized content goes to logs or object storage, and the context keeps only “N lines total, key lines below.”

    The mutation layer requires explicit skill authorization. Writing files, installing dependencies, publishing, and deleting should first present a plan diff, then execute. High-risk actions require human confirmation by default, and the confirmation record is archived together with the command.

    The verification layer uses independent commands or scripts to determine results rather than letting the model declare success. A skill is complete only when tests pass, checksums match, and health checks return the expected state.

    An illustrative set of invocation constraints can be written as an internal team convention instead of being stuffed into a long model manual:

    1. skill: review-change
    2. allow: read workspace, run tests
    3. deny: network publish, delete history
    4. output: {status, summary<=500, artifacts[]}
    5. on_fail: return code + last 20 lines, never full log

    The model sees only this short constraint and the truncated text of the current command result. Specific flags, retries, and path normalization live in the controlled executor. The executor handles timeouts, working directories, environment-variable allowlists, and output trimming. The model decides “whether to do it and how far to go,” but it is not responsible for remembering every historical compatibility form of every command.

    Comparison with the Traditional Tool-List Approach

    The advantage of the tool-list approach is fast onboarding: a new capability becomes visible to the model after adding a description. The cost is that context and permissions widen together. Skill packs plus CLIs require upfront governance: writing clear skill boundaries, executor policies, and output contracts. The payoff is later reuse.

    When selecting tools, the model faces a short catalog, so the probability of mis-selection is lower. During execution, parameters are filled in by the skill template and the user task together, rather than copied temporarily from an example in an extremely long document. On failure, return codes and truncated logs are enough to decide whether to retry, change the plan, or escalate to a human. During composition, the structured output of skill A can directly become the input of skill B, without the model reparsing a large block of natural language in between.

    There is no claim that “the command line is always superior to any tool interface.” For read-only queries and strongly typed internal services, a stable narrow interface is equally reasonable. The key is to keep interface descriptions short, returns small, and permissions explicit. The CLI is simply a form that is easy to implement under these principles in general engineering environments.

    Practical Adoption Points

    Start with a skill inventory. Cluster existing tools by task, merge semantically overlapping items, and delete descriptions that are rarely used. Write a risk level for each skill: read-only, reversible write, or irreversible change.

    Then work on the context budget. Set limits separately for system instructions, the skill catalog, the current skill, and tool returns. Summarize returns above the threshold and preserve the location of the original text. Do not use “a larger window” to hide unbounded returns.

    Separate permissions from identity. The executor uses task-scoped temporary credentials that expire when the skill ends. Secrets do not enter conversation text. The model can request only “a class of action” and cannot concatenate arbitrary command strings. Allowed commands come from templates and parameter allowlists, preventing the executor from becoming an uncontrolled generic shell.

    Observability must answer three questions: which skills were loaded at the time, which command was actually executed, and whether the full text or a summary entered context. Without these three, production behavior cannot be reviewed.

    Evaluation should not look only at whether the task was ultimately completed. It should also track tool-selection accuracy, average context usage, invalid retry count, and privilege-attempt count. If a skill-pack approach improves completion rate but increases privilege attempts, the boundaries are not strict enough or the executor is still too broad.

    Finally, put humans before irreversible actions. A skill pack should make “requires confirmation” a normal path rather than an exception. Confirmation should show the diff and impact surface, not paste an entire tool protocol.

    Conclusion

    The essence of context pollution is keeping manuals, logs, and permissions that should be externalized inside the model’s working memory for long periods. Once tools cannot be trimmed, unloaded, or truncated in their output, they are both expensive and hard to compose. Skill packs turn capabilities into versioned thin contracts, while CLIs or equivalent narrow executors handle actions that are auditable, restrictable, and testable. Together, the model gets the one page the current task actually needs, not the whole library. The team gets reusable work units, not an extremely long prompt that cannot be regression-tested. This is a sustainable path for evolving the agent tool layer.