4. Given the function $f(x)=a x+b, g(x)=\left\{\begin{array}{l}f(x), 0 \leq x \leq a \\ f(f(x)), x>a\end{array}\right.$, if for any positive number $a$, the function $g(x)$ is strictly monotonically increasing on $(0,+\infty)$, then the minimum value of the constant $b$ is
4. $\frac{1}{4}$.

Analysis: From the problem, we know that $g(x)=\left\{\begin{array}{l}a x+b, 0 \leq x \leq a \\ a^{2} x+a b+b, x>a\end{array}\right.$, since $a>0$, and $g(x)$ is strictly increasing, it is sufficient that $a^{2} \cdot a+a b+b \geq a \cdot a+b$, i.e., $b \geq a-a^{2}$ holds for any positive number $a$, and $a-a^{2} \leq \frac{1}{4}$ (equality holds when $a=\frac{1}{2}$), hence $b \geq \frac{1}{4}$, thus the minimum value of $b$ is $\frac{1}{4}$.