core: Prune context and spawn notifier process only when needed