Start with why you want to remain and compare that with what the buyer expects. A defined transitional role differs from an ongoing management position or an advisory relationship.
Agree responsibilities, authority and decision-making arrangements rather than relying on a title. Transfer the reasoning behind decisions as well as contacts and practical knowledge. Keep the sale price, compensation for future work and performance-related conditions conceptually separate. Continuing after a sale works best when both parties understand the role and how it may eventually end.