rust-code: Instructions file for Claude Code

CLAUDE.md

rust-code CLAUDE.md is an instructions file for Claude Code from fortunto2/rust-code. It costs 3,350 tokens per session, scanned A, original, MIT.

Technical instructions for rust-code, an AI coding agent written in Rust. They describe its asynchronous runtime, terminal interface, model integrations, code tools, MCP support, and main crates.

In plain words
What is it for?
Use them when changing the agent core, terminal interface, model clients, session handling, code tools, MCP client, or code-intelligence server.
Why use it?
They help agents understand how the Rust workspace is divided and which libraries and components belong in each part.

Instructions file for Claude Code

Written for Claude Code: the file is CLAUDE.md. Also seen: mentions CLAUDE.md; mentions Claude Code; mentions AGENTS.md.

This is fortunto2/rust-code's own configuration. It tells Claude Code how to work on rust-code itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything rust-code configures →

Needs its repository: it reads a path above its own folder, which exists only inside the repository. The line is cd dist && tar czf ../rust-code-macos-aarch64.tar.gz rust-code-macos-aarch64 && cd ...

Reuse

Borrowing it

Nothing to install: this file belongs to fortunto2/rust-code. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.

Copy the file
curl -O https://raw.githubusercontent.com/fortunto2/rust-code/master/CLAUDE.md
Clone the repo
git clone --depth 1 https://github.com/fortunto2/rust-code

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-code CLAUDE.md

README.md
[![agentmods](https://agentmods.dev/badge/instructions/fortunto2/rust-code/claude-md/github.svg)](https://agentmods.dev/instructions/fortunto2/rust-code/claude-md)
Your own site
<a href="https://agentmods.dev/instructions/fortunto2/rust-code/claude-md"><img src="https://agentmods.dev/badge/instructions/fortunto2/rust-code/claude-md/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for rust-code CLAUDE.md

Your own site · 80×15
<a href="https://agentmods.dev/instructions/fortunto2/rust-code/claude-md"><img src="https://agentmods.dev/badge/instructions/fortunto2/rust-code/claude-md.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 3,350 This file is loaded in full into every session.
When invoked 3,350 The same file — it is already loaded in full.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
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.03350 $0.03350
Opus 5.5 $0.01340 $0.01340
Sonnet 5.5 $0.00670 $0.00670
Haiku 4.5 $0.00335 $0.00335

Measured 2mo ago against content hash 722e5d0257a3, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

rust-code CLAUDE.md 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 2mo 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.

CLAUDE.md · 190 lines

How it starts

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

CLAUDE.md — rust-code

AI-powered terminal coding agent written in Rust.

Stack

  • Rust (Edition 2024), Tokio async runtime
  • Ratatui + Crossterm (TUI), tui-textarea (input)
  • sgr-agent (LLM client + agent framework + session + tools + providers)
  • Nucleo (fuzzy search, from Helix editor)
  • rmcp (MCP client — Model Context Protocol)
  • tmux (background task execution)

Architecture

  • crates/sgr-agent-core/ — minimal core: Tool trait, FileBackend trait, AgentContext (typed store), ToolError (5 variants), schema (6 deps)
  • crates/sgr-agent-tools/ — 14 tools + LocalFs + MockFs, generic over FileBackend trait (shell, apply_patch, indentation read, eval)
  • crates/sgr-agent/ — LLM client + agent framework + session/memory/providers/OpenAPI (re-exports core + tools)
  • crates/rc-cli/ — main binary: TUI (app.rs), headless mode (main.rs), agent loop (agent.rs), 27 tools (backend.rs + tools/)
  • crates/sgr-agent-tui/ — shared TUI shell: chat panel, streaming, agent loop integration, fuzzy picker
  • crates/solograph/ — MCP server for code intelligence
  • crates/genai/ — local fork of rust-genai (multi-provider LLM client: Gemini, OpenAI, Anthropic, Ollama, etc.)

Crate dependency graph

sgr-agent-core 0.2      <- Tool, FileBackend, AgentContext (typed store), ToolError (6 deps)
    ^              ^
sgr-agent-tools    sgr-agent 0.7
0.4                LLM framework + parallel tool execution
14 tools +         re-exports core + optional tools
LocalFs + MockFs        ^
                   rc-cli, agent-bit, souffleur, video-analyzer

Agent loop: user message → Agent::decide() → model returns Decision { situation, task, tool_calls } → execute tools → feed result back → repeat until finish_task or completion.

sgr-agent Framework

  • Core (sgr-agent-core): Tool trait, ToolOutput, ToolError, AgentContext, ToolDef, json_schema_for
  • Tools (sgr-agent-tools, or sgr-agent feature "tools"): 14 file-system tools generic over FileBackend:
    • Core: ReadTool (+ indentation mode), WriteTool (JSON repair), DeleteTool (batch), SearchTool (smart), ListTool, TreeTool, ReadAllTool
    • Deferred: MkDirTool, MoveTool, FindTool
    • Optional: EvalTool ("eval"), ShellTool ("shell"), ApplyPatchTool ("patch" — Codex-compatible diff DSL)
    • All-in-one: "tools-all" enables eval + shell + patch
  • LLM Client: GeminiClient, OpenAIClient — structured output + function calling + flexible parse
  • Agent framework (feature = "agent"):
    • Tool trait → ToolRegistry (builder, case-insensitive lookup, fuzzy resolve)
    • Agent trait → Decision { situation, task, tool_calls, completed }
    • 6 variants: SgrAgent (structured output), ToolCallingAgent (native FC), FlexibleAgent (text parse), HybridAgent (2-phase), Clarification, Planning
    • run_loop() — generic agent loop with 4-tier loop detection
    • ToolFilter — progressive discovery (keyword + fuzzy scoring)
  • Session (feature = "session"): Session, LoopDetector (4-tier), MemoryContext, hints, tasks, intent guard
  • App tools (feature = "app-tools"): bash, fs, git, apply_patch
  • OpenAPI (always available): parse any OpenAPI 3.x spec → fuzzy search endpoints → HTTP call
    • ApiRegistry — load multiple APIs, search across all, call by endpoint name
    • 10 popular APIs pre-configured: github, stripe, openai, supabase, posthog, slack, linear, cloudflare, vercel, sentry
    • APIs.guru fallback — 2800+ APIs searchable by name
    • Auto-cache specs to ~/.sgr-agent/openapi-cache/, auto-detect auth from env vars
    • $ref resolution for parameters and schemas, path-level param inheritance
  • Providers (feature = "providers"): TOML config, auth, CLI proxy, Codex proxy
  • Telemetry (feature = "telemetry"): OTEL file telemetry
  • Llm (feature = "genai"): provider-agnostic LLM facade — LlmConfig::auto("gpt-4o") / LlmConfig::endpoint(key, url, model)
  • Demo: cargo run -p sgr-agent --features agent --example agent_demo
  • Tests: cargo test -p sgr-agent --all-features — 510+ tests (sgr-agent), 82 tests (sgr-agent-tools), 15 tests (sgr-agent-core)

Read the full file on GitHub · 190 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. 2mo ago First seen · 190 lines · 3,350 tokens per session scan A 722e5d0257a3

Subscribe to this mod's changes

rust-code CLAUDE.md is an instructions file published in the GitHub repository fortunto2/rust-code (46 stars, last pushed 2mo ago), licensed MIT. It adds 3,350 tokens to every session, about $0.0134 per session on Opus 5.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-08-30.

Related

rust-code CLAUDE.md compared with instructions from other repositories

rust-code CLAUDE.md next to 6 instructions from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
rust-code CLAUDE.mdfortunto2/rust-codeInstructions file462mo agoMITA3,350Claude Code
vscode buildNext.instructions.mdmicrosoft/vscodeInstructions file195kyesterdayMITA9,719GitHub Copilot
next.js AGENTS.mdvercel/next.jsInstructions file143kyesterdayMITA7,461Codex, OpenCode
langchain AGENTS.mdlangchain-ai/langchainInstructions file149kyesterdayMITA4,680Codex, OpenCode
vscode oss-third-party-notices.instructions.mdmicrosoft/vscodeInstructions file195kyesterdayMITA5,516GitHub Copilot
vscode copilot-instructions.mdmicrosoft/vscodeInstructions file195kyesterdayMITA3,093GitHub Copilot
deepseek-harness AGENTS.mddeepseek-ai/deepseek-harnessInstructions file274k2d agoMITA4,313Codex, OpenCode