Logbook
Architecture

Three rings
Adapters at the rim. They translate Marginfi v2, Kamino Lend, and Solend state into a single PositionSnapshot + MarketSnapshot shape.
The runtime at the middle. A Composition is an ordered list of hooks plus their priority. The runtime checks each hook's flags bitmap against the event, runs the eligible ones, and threads side-effects back to the adapter.
The executor at the core. An Anchor 0.31 program that stores Composition PDAs and emits CompositionExecuted events. Lending adapters CPI into it from their lifecycle handlers.
Why hooks live in PDAs
Uniswap v4 encodes hook flags in the contract address. That works on EVM because addresses are arbitrary. On Solana, addresses are ed25519-derived — forcing brute-force keypair search to embed bits is hostile. Lien stores the flag bitmap in a PDA that the executor reads at install time, achieving the same guarantee without the keypair gymnastics.