This paper presents a novel framework for customized modular bus systems that leverages travel demand prediction and modular autonomous vehicles to optimize services proactively. The proposed framework addresses two prediction scenarios with different forward-looking operations: optimistic operation and pessimistic operation. A mixed integer programming model in a space-time-state network is developed for the optimistic operation to determine module routes, schedules, formations and passenger-to-module assignments. For the pessimistic case, a two-stage optimization procedure is introduced. The first stage involves two formulations (i.e., deterministic and robust) to generate cost-saving plans, and the second stage adapts plans with control strategies periodically. A Lagrangian heuristic approach is proposed to solve formulations efficiently. The performance of the proposed framework is evaluated using smartcard data from Beijing and two state-of-the-art machine learning algorithms. Results indicate that the proposed framework outperforms the real-time approach in operating costs and highlights the role of module capacity and time dependency.