# Swarms

Session requires a secondary logical data layer built on top of the Session Node Network to ensure reliable message storage and retrieval.&#x20;

Swarms protect users from message loss if Session Nodes go offline, drop messages, or become otherwise unavailable. Messages are replicated across small groupings of Session Nodes (swarms). Swarm composition is determined by the network design, not individual nodes, keeping network swarms robust and operational even as Session Nodes join and leave the network.

The following set of simple rules ensure that Session Nodes within swarms remain synchronized as

the composition of swarms changes:&#x20;

* &#x20;When a node joins a new swarm, existing swarm members recognize the new member and push the swarm’s data records to the new member.
* &#x20;When a node leaves a swarm, its existing records can be safely erased, with the exception of when the node is migrating from a dissolving swarm. In this case, the migrating node determines the swarms responsible for its records and distributes them accordingly.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.getsession.org/session-network/session-nodes/swarms.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
