|Sapphire image from Wikipedia
Ghost traps are items (most commonly gems) that have been enchanted to serve as prisons for spirits and incorporeal undead. Clerics of any level may create ghost traps with hit dice capacity no greater than their level. Ghost traps may contain no more than one spirit, even if the trapped spirit has hit dice less than the capacity of the trap. When occupied, a miniature version of the spirit can be seen leering within the gem, seemingly contorted and tormented.
To create a ghost trap, a cleric must have a gem of value equal to the desired hit dice capacity multiplied by 100 GP. For example, a 3 HD ghost trap requires a 300 GP gem. In addition, hit dice capacity * 100 GP must be spent on ritual components, and the whole process takes 1 week. There are some situations described below where a ghost trap is destroyed. In these cases, the gem crumbles to ash.
To use a ghost-trap, it must be strongly presented within 10′ of the spirit (this is a standard combat action). If the spirit fails its saving throw versus magic, it is imprisoned in the gem. A trap may also be thrown, but if the spirit makes its saving throw, there is a 1 in 6 chance that the gem will be destroyed when it hits the ground. Turned spirits do not get a saving throw and may be automatically imprisoned. All classes may use ghost traps, though clerics may set them as traps that will trigger when spirits draw near. An attempt to trap a spirit more powerful than the capacity of a given trap will automatically fail, and there is a 1 in 6 chance that the trap will be destroyed.
Trapped spirits may be released at any time, though they will generally be quite unhappy about having been imprisoned (-2 reaction). Releasing a spirit has a 1 in 6 chance of destroying the trap (otherwise it may be used again). Trapped spirits may speak telepathically with anyone touching the gem directly, will generally beseech any holder for freedom, and may promise all sorts of rewards (probably all lies). This contact is one-way, however, and it is impossible to communicate with a trapped spirit without using magic (see the magic-user ritual below).
Though only clerics can create ghost traps, many magic-users prize occupied ghost traps, as they believe that they are valuable currency in the land of the dead, and can also be used in arcane researches. Magic-users can also conduct rituals to communicate with trapped spirits. This requires 1d6 * 100 GP worth of components, and requires a saving throw versus spells. On a saving throw roll of 1, the spirit is released (or some other suitable magical mishap occurs). If the magic-user succeeds on the saving throw, the spirit will answer 1d6 yes/no questions to the best of its ability, and will be unable to lie.
(Though I know about Skyrim soul gems, the inspiration here is more Ghostbusters.)
(In Hexagram, the ability to create ghost traps comes with the banishment trait.)