Here's how I imagine it could work at Caltech.
1. For undergraduates, give everyone a rapid response COVID test when they arrive. Anyone who fails is quarantined until they are no longer infectious.
2. Once an undergraduate is cleared to move in, they must not leave campus for the rest of the term. This should be fairly easy. When I was there, most people only had to leave on weekend, because food was only served as part of your room & board contract during weekdays. That could be extended to cover weekends during COVID. Most other things that we used to leave campus for back then are now readily obtain online for delivery.
It is #2 that I think would be problematic at many schools. I recall that earlier in the pandemic some told students to not leave campus but they were not obeyed.
At Caltech, every undergraduate could understand the science and the mathematical models behind the policy, and see that it is correct. Also, violating the policy after you agreed to it would probably be seen as an honor code violation, which the students take very seriously.
Same for MIT and Harvey Mudd on the science aspect, although I'm not quite sure about MIT. MIT does offer undergraduate degrees in quite a few fields that aren't STEM, such as music, theater arts, global studies and languages, and several others, and I'm not sure how much STEM people in those majors have to take. (Caltech has non-STEM degrees too, such as English, but they still have to take the same calculus, physics, and chemistry that STEM majors have to take--when I was there that was two years of calculus and two years of physics and I think a year of chemistry, although I believe now it is just one year of calculus because nowadays almost everyone has had high school calculus).
For the military academies I assume the students would stay in line because they could be ordered to, and obeying orders is a big deal at those places.
3. OK, we've got a COVID free collection of undergraduates. But to have in-person classes we need someone to teach them. Professors don't usually live on campus, so the "once verified as clean never leave" approach won't work for them.
This could probably be handled by having professors on days they are teaching take a rapid response test in the morning, early enough to have results before their first class.
4. For graduate students that live on campus and are not married (or are married but their spouse is also a graduate student at the same school), a similar approach to that for undergraduates could work.
These graduate students could also handle much of the teaching of undergraduate classes, reducing the need for professors to come in.
5. For researchers not involved in teaching, and other staff, you could probably arrange so that they and the students (undergraduates plus whatever graduate students are serving as teachers) do not come in contact.
6. Reorganize classes as far so they are done Hogwarts style. Have separate classes for students living in Ricketts House, Dabney House, Blacker House, and so on.
Couple this with regular testing. The idea is that if someone in one house does get COVID, you find it with the rapid testing, and you can quarantine that house. Since they only have classes with members in their own house, there is a good chance this will catch it before they have spread it to the other houses.
However, just because it might be doable doesn't necessarily mean it is worthwhile.
It would take a lot of planning and a lot of schedule manipulation and choreographing movements around campus to make it so if someone does get it, it is found out before they had spread it beyond a well defined sub-population that is easily quarantined. That might require too much control, except maybe at the military academies.