Eventually, good spirits examine them to determine their nature. This is done in various ways because in this first state evil people can say true things and do good things just the way good people do. As I have already explained, this is because they have lived just as morally in outward form because they were living under governments and laws, and because this gained them a reputation for fairness and honesty, won people over to them, and raised them to high office and wealth. However, one can tell evil spirits from good ones particularly by the fact that the evil ones pay close attention when the conversation is about external concerns and little attention when it is about more inward matters, about the true and good principles of the church and heaven. They do hear such things, but without any real attention or pleasure. One can also identify them by the fact that they consistently turn toward certain regions, and when they are left to themselves follow paths that lead to them. One can tell what love is leading them from the regions they face and the paths they follow.
All the spirits who arrive from the world are put in touch with some community in heaven or some community in hell. However, this applies only to their deeper natures, and their deeper natures are not apparent to them as long as they are focused on their outward concerns. This is because their outward concerns cloak their inner ones, especially for people more deeply involved in evil. However, they come out in the open when they arrive in the second state because there their deeper levels are opened and their outer ones become dormant.
This first state after death lasts a few days for some people, months for some, and a year for some, but rarely more than a year for anyone. The difference for particular individuals depends on the harmony or discord between their inner and outer natures. These inner and outer natures must act as one and correspond for everyone. No one is allowed to think and intend one way and speak and act another way in the spiritual world. Everyone must be an image of his or her affection or love, which means we must be outwardly what we are inwardly. This is why the outer concerns of a spirit are first stripped off and brought into order: so that they may serve as a plane responsive to the inner ones.
from Heaven and Hell, Sections 496-498