I keep $1k to $2k in liquid stable and balance in index funds. It takes a day or two to cash out some in a fund if cash needed to pay a bill. So far (knock on wood), 99% of our medical stuff has been stuff we scheduled ahead and no real unknown emergencies. Have been in a HDHP with HSA for about 9 years.
One strategy I’ve done: we have an auto transfer option in our HSA from investment to cash if you have an expense that you can toggle on and off. When I’ve had an expense I use the HSA for, I turn it off, then let the cash build back up through our contributions while keeping the invested dollars untouched.