rust

rust is an agent for Claude Code from Ramilito/kubectl.nvim. It costs 38 tokens per session (1,269 once invoked), scanned A, original, Apache-2.0.

A Rust codebase specialist for a Neovim plugin, including its Rust files, Tokio asynchronous code, and connections between Rust, Lua, and Go. It provides project-specific guidance for reading, editing, and documenting that code.

In plain words
What is it for?
Use it to understand or change Rust code in the plugin, work with Tokio, telemetry, logging, Lua bindings, or Go integration.
Why use it?
It helps avoid breaking rules around the plugin's shared asynchronous runtime and its foreign-function interfaces, which let different programming languages call each other.

Agent for Claude Code

Written for Claude Code: installed under .claude/. Also seen: model in frontmatter; mentions subagents.

Install

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.

agentmods
npx agentmods add agents/ramilito/kubectl.nvim/rust
Clone the repo
git clone --depth 1 https://github.com/Ramilito/kubectl.nvim

Made for: Claude Code.

Wrote 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.

agentmods badge for rust

README.md
[![agentmods](https://agentmods.dev/badge/agents/ramilito/kubectl.nvim/rust.svg)](https://agentmods.dev/agents/ramilito/kubectl.nvim/rust)
Your own site
<a href="https://agentmods.dev/agents/ramilito/kubectl.nvim/rust"><img src="https://agentmods.dev/badge/agents/ramilito/kubectl.nvim/rust.svg" alt="Measured on agentmods" height="20"></a>
Per session 38 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,269 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

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.

ModelPer sessionOnce invoked
Fable 5.1 $0.00038 $0.01269
Opus 5 $0.00019 $0.00634
Sonnet 5 $0.00008 $0.00254
Haiku 4.5 $0.00004 $0.00127

Measured yesterday against content hash 28cd454185be, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-06, from the pricing page.

Security

Grade A, and why

rust 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 yesterday.

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.

.claude/agents/rust.md · 144 lines

How it starts

The opening of the file, as written. The whole thing — 144 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Rust Codebase Guidance

ALWAYS use this subagent for ANY task involving:

  • Reading, editing, or understanding Rust code
  • kubectl-client/ or kubectl-telemetry/ directories
  • Tokio async patterns, runtime, or collectors
  • mlua FFI bindings or Lua exports
  • Go FFI integration
  • Telemetry, tracing, or logging setup
  • Researching Rust code for documentation

For Lua-side integration, also consult the lua subagent.


Guidance for working with the Rust codebase (kubectl-client/).

Context: Neovim Plugin Dylib

This is a cdylib loaded by Neovim via the mlua Lua FFI. This context imposes critical constraints:

Runtime Constraints

Single Tokio Runtime: A singleton OnceLock<Runtime> manages all async operations. Never create additional runtimes.

Blocking Bridge: Lua calls are synchronous. Use block_on() to bridge async Rust to sync Lua:

fn block_on<F: std::future::Future>(fut: F) -> F::Output {
    match Handle::try_current() {
        Ok(h) => task::block_in_place(|| h.block_on(fut)),
        Err(_) => {
            let rt = RUNTIME.get_or_init(|| Runtime::new().expect("tokio runtime"));
            rt.block_on(fut)
        }
    }
}

Client Lifecycle: Kubernetes clients are stored in global Mutex<Option<Client>>. Use with_client() helper for safe access:

pub fn with_client<F, Fut, R>(f: F) -> LuaResult<R>
where
    F: FnOnce(Client) -> Fut,
    Fut: Future<Output = LuaResult<R>>,
{
    let client = CLIENT_INSTANCE.lock()...;
    block_on(f(client))
}

mlua FFI Patterns

Module Export: The #[mlua::lua_module(skip_memory_check)] attribute exports the module. All public functions must be registered in the exports table:

exports.set("function_name", lua.create_function(function_name)?)?;
exports.set("async_function", lua.create_async_function(async_function)?)?;

Async Functions: Use lua.create_async_function() for functions that should not block Neovim's main loop. These functions take Lua by value (not reference).

Read the full file on GitHub · 144 lines

Changes

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.

  1. yesterday First seen · 144 lines · 38 tokens per session scan A 28cd454185be

Subscribe to this mod's changes

rust is an agent published in the GitHub repository Ramilito/kubectl.nvim (537 stars, last pushed 22d ago), licensed Apache-2.0. It adds 38 tokens to every session and 1,269 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-04.