Level: Cleric 3
Components: V, S
Casting Time: 1 standard action
Range: Touch
Target: Creature touched
Duration: 10 minutes/level
Saving Throw: None or Will negates (harmless)
Spell Resistance: No or Yes (harmless)

After an intonation and clasping of the subject creature, you grant it knowledge of where safety lies.

The recipient of this spell can find the shortest, most direct direction to a place of safety, with safety being defined as a location where the individual is not taking immediate damage from the environment, and immediate damage is not imminent. It does not provide the means for the subject to move in that direction.

A safety spell points out the shortest distance out of a poisonous cloud, or the direction one should dig to reach the surface if entombed in earth. It does not function against the maze spell, because that spell deals no physical damage. Nor does the spell provide knowledge of or protection against the creatures that inhabit those safe places.
In the D&D cosmology (DMG 150), safety has the following effects when cast on specific planes.

Plane of Shadow: Shortest route out of darklands.
Elemental Plane of Air: Nearest windproof shelter, shortest route out of smoke bank.
Elemental Plane of Earth: Nearest air pocket or open cavern.
Elemental Plane of Fire: Shortest route out of magma pools or other unusually hot places.
Elemental Plane of Water: Nearest pocket of breathable air; shortest route out of hot spot, ice pocket, or red tide.
Negative Energy Plane: Nearest doldrum area with the minor negative-dominant trait.
Positive Energy Plane: Nearest edge zone with the minor positive-dominant trait.
Limbo: Nearest area of stabilized limbo.
Pandemonium: Nearest shelter from a windstorm.
Carceri: Shortest route out of a Minethys sandstorm.
Gehenna: Nearest flat ledge, nearest shelter from Mungoth’s acidic snow.
Nine Hells: Nearest shelter from fireballs on Avernus, rockslides on Malbolge, or cold on Cania.
Acheron: Nearest shelter from Ocanthus bladestorms.
On planes you create yourself, safety might provide other information. This spell is mostly used in hostile environments, such as one of the Inner Planes, to locate the nearest pocket of habitable space.

If safety is cast and then followed by a plane shift spell, the plane shift sends the subject of safety to a place of relative safety on that plane. It is transported to a pocket of air on the Elemental Plane of Water, for example, or a cool spot on the Elemental Plane of Fire.