General rule for when 一 is yi1 and when it's yi2/yi4 The tone that 一 is pronounced with is sometimes hard to predict. Is there a good general rule for when to use yi1 and when to use yi2/yi4?

The 不 tone change rule is fairly straightforward and easy to remember. 不 is underlyingly bu4 but changes to bu2 before another fourth tone, within a phrase. Maybe the 不-change rule can be blocked by a phrase boundary; I am not sure.
The 一 tone change rule (YTC) is much more confusing. 一 can be pronounced as yi1 or yi2 or yi4 according to both the surrounding environment and how 一 is being used.
For explaining the YTC, it almost seems like there are two separate words: one of which is always pronounced yi1 and the other is pronounced as yi4 or yi2 using the same rules as 不.
Wiktionary lists a bunch of terms with 一 pronounced as yi1, as yi2 and as yi4.
The yi2 and yi4 pronunciation appear to be in complementary distribution and never appear phrase-finally.
yi1 seems to appear in contexts where the corresponding two-related lexeme would use 二 instead of 两.

一来
二来

I am not sure that the distribution of 两 versus 二 is the exactly the same as yi2/yi4 versus yi1. Is there a better rule of thumb?
The rule of thumb is the following.
When indexing it is yi1. For example

一楼 (first floor)
一声 (first tone)
第一 (the first)
一次世界大战 (World War I)
一来 (firstly)

When counting （the same rule as 不）

it is yi4 when followed by 1, 2, 3 tone

一呼百应
一毛不拔
一百
一扫而光


it is yi2 when followed by 4 tone

一蹴而就
一气呵成



For others, mostly yi1. For example

统一
均一
敬一丹（name）

As a comparison, 二 can be indexing or counting, but 两 is only counting.
PS: Most of the words in the Wikipedia list are right, but there are clear errors. For example &quot;一yi4夫一yi4妻&quot; appeared in 2 lists. And, it should be &quot;一yi4朝一yi4夕&quot;. Don't fully trust it.