Let $a(n)$ be A057985 (i.e., start with $0$ and repeatedly substitute: $0\to01, 1\to12, 2\to0$).
Let $\operatorname{wt}(n)$ be A000120 (i.e., number of ones in the binary expansion of $n$). Here
$$ \operatorname{wt}(2n+1) = \operatorname{wt}(n)+1, \\ \operatorname{wt}(2n) = \operatorname{wt}(n), \\ \operatorname{wt}(0) = 0 $$
- Let $\operatorname{tr}(n)$ be A007814 (i.e., number of trailing zeros in the binary expansion of $n$). Here
$$ \operatorname{tr}(2n+1) = 0, \\ \operatorname{tr}(2n) = \operatorname{tr}(n) + 1, \\ $$
- Let $b(n)$ be a sequence of positive integers such that $b(n)=A$ after $\operatorname{wt}(n)-1$ iterations. To get $A$ start with $A = n$ and then apply
$$ A := \left\lfloor\frac{A+1}{2^{1-\operatorname{tr}(A+1)}}\right\rfloor $$
- Let $c(n)$ be a sequence of positions where new integer occurs in $b(n)$.
I conjecture that $$a(n)=\begin{cases} 2 & \text{if } b(c(n))=\frac{b(c(n-1))}{2}; \\ \operatorname{tr}(b(c(n)))\bmod 2 & \text{otherwise}. \end{cases} $$
Here is the PARI/GP program to check it numerically:
b(n) = my(A = n); for(i = 1, hammingweight(n) - 1, A++; A >>= 1 - valuation(A, 2)); A
f1(n) = if(n == 1, 2, my(A = solve(r=0, 1, r*(2 - r + r^2)-1)); ceil(log((19*A - A^2 + 11*A^3)/(23*n))/log(A)))
f2(n) = if(n == 1, 2, my(A = solve(r=0, 1, r*(2 - r + r^2)-1)); ceil(log((48*A - 11*A^2 + 29*A^3)/(23*n))/log(A)))
c(n) = my(v1); v1 = vector(f1(n)+1, i, 0); v1[2] = 1; v1[3] = 2; for(i = 4, #v1, v1[i] = 2*v1[i-1] - v1[i-2] + v1[i-3]); v2 = v1; for(i = 2, #v1, v2[i] += v2[i-1]); my(b1(n) = my(A = f1(n) + 1); A - (v1[A]>n), b2(n) = my(A = f2(n) + 1); A - (v2[A]>n), A = 0, B = 0, C); while(n > 2, if(!(B%2), C = b2(n-2); n -= v2[C] + 1; A += 1 << (B/2 + C - 1), C = b1(n-1); n -= v1[C]; A += 1 << ((B-1)/2 + C - 2)); B++); A + n
a(n) = my(A = 2, v1); v1 = [0, 1]; while(#v1<n, v1 = concat(v1, if(v1[A]==2, [0], [v1[A], v1[A]+1])); A++); v1[n]
a1(n) = if(n == 1, 0, my(A = b(c(n))); if(A == b(c(n-1))/2, 2, valuation(A, 2)%2))
test(n) = a(n) == a1(n)
This program also shows how to compute $c(n)$ without recursion.
UPD:
It looks like that for $\operatorname{wt}(n)+2k-1, k\geqslant 0$ iterations similar conjectures are equivalent. Also, for $\operatorname{wt}(n)+2k, k\geqslant$ we have similar conjectures which are also equivalent to each other, but here we get A287066 instead of $a(n)$.
Is there a way to prove it?