Swarm: Instructions file for Claude Code

CLAUDE.md

Swarm CLAUDE.md is an instructions file for Claude Code from christopherkarani/Swarm. It costs 4,360 tokens per session, scanned A, original, MIT.

Repository instructions for Swarm, a Swift framework for building software agents and workflows on Apple platforms and Linux. They explain its layout, build and test commands, and optional integrations.

In plain words
What is it for?
Use them when developing, testing, or reviewing Swarm code and its agent, workflow, tool, memory, or integration components.
Why use it?
They give coding agents the project’s design rules and everyday commands before they modify the framework.

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 christopherkarani/Swarm's own configuration. It tells Claude Code how to work on Swarm 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 Swarm configures →

Reuse

Borrowing it

Nothing to install: this file belongs to christopherkarani/Swarm. 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/christopherkarani/Swarm/main/CLAUDE.md
Clone the repo
git clone --depth 1 https://github.com/christopherkarani/Swarm

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

README.md
[![agentmods](https://agentmods.dev/badge/instructions/christopherkarani/swarm/claude-md/github.svg)](https://agentmods.dev/instructions/christopherkarani/swarm/claude-md)
Your own site
<a href="https://agentmods.dev/instructions/christopherkarani/swarm/claude-md"><img src="https://agentmods.dev/badge/instructions/christopherkarani/swarm/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 Swarm CLAUDE.md

Your own site · 80×15
<a href="https://agentmods.dev/instructions/christopherkarani/swarm/claude-md"><img src="https://agentmods.dev/badge/instructions/christopherkarani/swarm/claude-md.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 4,360 This file is loaded in full into every session.
When invoked 4,360 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.04360 $0.04360
Opus 5.5 $0.01744 $0.01744
Sonnet 5.5 $0.00872 $0.00872
Haiku 4.5 $0.00436 $0.00436

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

Security

Grade A, and why

Swarm 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 1mo 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 · 356 lines

How it starts

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

CLAUDE.md

Guidance for AI coding assistants (Claude Code, Cursor, etc.) working in this repository. This file is the canonical, in-repo briefing — read it before making changes.

What is Swarm?

Swarm is a Swift 6.2 framework for building agents and multi-agent workflows on Apple platforms (iOS 26+, macOS 26+, tvOS 26+) and Linux. It is built around:

  • Agents — Agent struct with @ToolBuilder trailing closures, an AgentRuntime protocol, and pluggable inference providers.
  • Workflows — fluent composition (.step, .parallel, .route, .repeatUntil) compiled to a DAG with checkpoint/resume.
  • Tools — the @Tool macro generates JSON schemas from Swift structs at compile time; FunctionTool covers ad-hoc closures.
  • Memory — conversation, sliding-window, summary, vector, and persistent backends.
  • Guardrails / Resilience / Observability — first-class concerns, not bolt-ons.
  • Providers — Built-in Apple Foundation Models; custom backends inject InferenceProvider. No Conduit / cloud façade ships with Swarm.
  • MCP — Model Context Protocol client and server support.

The package uses Swift 6.2 with StrictConcurrency enabled across all targets. All public types must be Sendable — the compiler enforces it.

Repository Layout

Swarm/
├── Package.swift                  # SPM manifest (Swift 6.2, products)
├── README.md                      # User-facing overview
├── Sources/
│   ├── Swarm/                     # Main library (156 .swift files)
│   │   ├── Agents/                # Agent struct, workspace integration
│   │   ├── Core/                  # AgentRuntime, Conversation, Environment,
│   │   │                          #   PromptEnvelope, RuntimeMetadata, …
│   │   ├── Workflow/              # Workflow + durable engine + checkpointing
│   │   ├── Tools/                 # Tool protocol, ToolCollection, ParallelExecutor,
│   │   │                          #   built-ins, web tools, schema bridging
│   │   ├── Memory/                # Conversation, sliding window, summary, vector,
│   │   │                          #   SwiftData, ContextCore, hybrid backends
│   │   ├── Providers/             # Foundation Models, multi-provider, sessions
│   │   ├── Guardrails/            # Input/Output/Tool guardrail specs + runner
│   │   ├── Resilience/            # Retry, circuit breaker, fallback, rate limit
│   │   ├── Observability/         # AgentTracer, SwiftLog/OSLog tracers, metrics
│   │   ├── MCP/                   # MCPClient, MCPServerConnection, stdio/HTTP transports, ToolBridge
│   │   ├── Workspace/             # AgentWorkspace (AGENTS.md, .swarm/ skills)
│   │   ├── Macros/                # Public macro declarations
│   │   ├── Integration/           # Membrane and Wax integrations
│   │   └── Internal/GraphRuntime/ # Compiled DAG runtime (internal)
│   ├── HiveCore/                  # In-tree durable graph (Integrations only)
│   ├── MembraneCore/              # In-tree Membrane core (Integrations only)
│   ├── Membrane/                  # In-tree Membrane session (Integrations only)
│   ├── MembraneContextCore/       # In-tree Membrane↔ContextCore (Integrations)
│   ├── ContextCoreTypes/          # In-tree ContextCore types (Integrations)
│   ├── ContextCoreShaders/        # In-tree Metal shaders (Integrations)
│   ├── ContextCoreEngine/         # In-tree ContextCore engine (Integrations)
│   ├── ContextCore/               # In-tree ContextCore façade (Integrations)
│   ├── SwarmMacros/               # Compiler plugin (@Tool, @Parameter,
│   │                              #   @Traceable, #Prompt, builders)
│   ├── SwarmMembrane/             # Deprecated hollow re-export (remove in 0.7.0)
│   ├── SwarmMCP/                  # MCP server adapter product
│   ├── SwarmCapabilityShowcase/        # Executable: deterministic showcase CLI
│   ├── SwarmCapabilityShowcaseSupport/ # Library backing the showcase
│   ├── SwarmDemo/                 # (opt-in) demo executable
│   └── SwarmMCPServerDemo/        # (opt-in) MCP server demo
├── Tests/
│   ├── SwarmTests/                # Main test target (mirrors Sources/Swarm)
│   │   └── Mocks/                 # MockAgentRuntime, MockInferenceProvider, …
│   ├── HiveSwarmTests/            # Hive integration tests
│   ├── SwarmMacrosTests/          # Macro expansion tests
│   └── SwarmCapabilityShowcaseTests/
├── Examples/CodeReviewer/         # Standalone example SPM project
├── docs/
│   ├── guide/                     # Getting started, agent workspace, showcase
│   ├── reference/                 # API catalog, front-facing-api, audits
│   └── release/                   # release-checklist.md
└── .github/workflows/             # swift.yml, claude.yml, claude-code-review.yml,
                                   #   docs.yml

Read the full file on GitHub · 356 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. 1mo ago Changed · +1 lines · +21 tokens per session 0a57cdee05c1
  2. 1mo ago Changed · +2 tokens per session 4ac69d381e49
  3. 2mo ago First seen · 355 lines · 4,337 tokens per session scan A 2bd08d4a578d

Subscribe to this mod's changes

Swarm CLAUDE.md is an instructions file published in the GitHub repository christopherkarani/Swarm (587 stars, last pushed 3d ago), licensed MIT. It adds 4,360 tokens to every session, about $0.0174 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

Swarm CLAUDE.md compared with instructions from other repositories

Swarm CLAUDE.md next to 6 instructions from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
Swarm CLAUDE.mdchristopherkarani/SwarmInstructions file5873d agoMITA4,360Claude Code
vscode buildNext.instructions.mdmicrosoft/vscodeInstructions file195kyesterdayMITA9,719GitHub Copilot
next.js AGENTS.mdvercel/next.jsInstructions file143ktodayMITA7,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