  We study supersymmetric sectors at half-BPS boundaries and interfaces in the
4d $\mathcal{N}=4$ super Yang-Mills with the gauge group $G$, which are
described by associative algebras equipped with twisted traces. Such data are
in one-to-one correspondence with an infinite set of defect correlation
functions. We identify algebras and traces for known boundary conditions. Ward
identities expressing the (twisted) periodicity of the trace highly constrain
its structure, in many cases allowing for the complete solution. Our main
examples in this paper are: the universal enveloping algebra $U(\mathfrak{g})$
with the trace describing the Dirichlet boundary conditions; and the finite
W-algebra $\mathcal{W}(\mathfrak{g},t_+)$ with the trace describing the Nahm
pole boundary conditions.
