[scripts] Improve knowledge base build