Swarm CLAUDE.md

Swarm CLAUDE.md is an instructions file for coding agents from christopherkarani/Swarm. It costs 4,337 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

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 instructions/christopherkarani/swarm/claude-md
Clone the repo
git clone --depth 1 https://github.com/christopherkarani/Swarm

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.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.svg" alt="Measured on agentmods" height="20"></a>
Per session 4,337 This file is loaded in full into every session.
When invoked 4,337 The same file — it is already loaded in full.
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 $0.04337 $0.04337
Opus 5 $0.02168 $0.02168
Sonnet 5 $0.00867 $0.00867
Haiku 4.5 $0.00434 $0.00434

Measured 4d ago against content hash 2bd08d4a578d, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, 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 4d 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 · 355 lines

How it starts

The opening of the file, as written. The whole thing — 355 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:

  • AgentsAgent 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 · 355 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. 4d 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 (574 stars, last pushed 5d ago), licensed MIT. It adds 4,337 tokens to every session, about $0.0217 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-08-30.