The p4 Q Matrix
phi · p4 · Zeckendorf

One matrix, M = [[1,1],[1,0]], runs the whole store

Nest stores with a p4 = 1 and a .claude = 0. Never put a p4 directly in a p4. The rules that are left are exactly the Fibonacci Q matrix. The same matrix numbers the model nodes, prunes them, and routes a task to one of them.

There is no quantum part. The Q in “Q matrix” is Charles King’s 1960 name for M. Nothing in phi or p4 runs on qubits. The only quantum link in phi is a citation in .docs/phi/Q.md to Q-matrix key generation (Lai et al., 2017).

1 · the nesting rule is the matrix

Two states, three moves, one forbidden

.claude in .claude p4 in .claude .claude in p4 p4 in p4 — never (11) 0 1 after a .claude after a p4
→ 0→ 1 from 011 from 110

Count the allowed moves between the two states and you get M. The 0 is the forbidden p4-in-p4.

Powers of M count the paths: Mn = [[F(n+1), F(n)], [F(n), F(n−1)]]. So the number of legal stores of each depth is a Fibonacci number. The 11 the store never makes also works as the comma in a stream of addresses: no length field and no lookup table needed.

2 · every address is a Zeckendorf number

Store addresses by length

An address starts and ends with a p4 and has no 11. Read with Fibonacci weights 1, 2, 3, 5, 8… from the right, each address is a different integer.

length 11
1 = 1
length 20
11 is forbidden
length 31
101 = 4
length 41
1001 = 6
length 52
10001 = 910101 = 12
length 63
100001 = 14100101 = 17101001 = 19
length 75
10000011000101100100110100011010101

The counts are 1, 0, 1, 1, 2, 3, 5, the Fibonacci sequence after the empty length 2. Computed by scripts/session/stream_logic.py.

3 · the model tree at k = 4

Four nodes, oldest history deepest

1 root · newest shard starts from its children’s mean 101 1001 10001 shard 3 shard 2 shard 1 · oldest 10101 (k=5)
the owner’s reading
1101 100110001

The 4 nodes as the 4 cells of [[n1, n2], [n3, n4]]. Untested: k = 2, 3, 5 and 6 would show whether the k = 4 win comes from this shape or from the shard size.

A node’s parent is its address with the last p4 and the .claude’s before it removed (phi_rank.tree.parent), so the first four addresses all hang off the root. Leaves start from scratch: a node is 213 rows and the shared base 215, so the base doesn’t fit. Each node is pruned by phi_mask, which never keeps two adjacent rows. That is the same no-11 rule, applied to the weights.

4 · the matrix that pruned a node routes to it

From task to answer, by effort

taskhashed into feature rows
each nodesums its kept rows’ weight at those features
routethe heaviest node wins (argmax)
answerthat node scores the candidates
EffortWho answersMeasured
lowJSON ranker alone; no .pt server0.380
mediumthe one routed node (tree:medium:<address>)best node 50% of pools at k = 4 (chance 25%); alone 0.190
highall 4 nodes, z-scored and averaged (tree:high:4)0.235 against one large model’s 0.220, both seeds
backgroundthe grown tree, retrained off the hot path0.258 at k = 8; not built yet

Held-out r-precision on phi’s own store, from .docs/p4/nested-store.md. The 0.380 is the deployed JSON ranker’s figure. A store chooses its tier with pool-effort: (vlds 0.0.74).