We study supersymmetric sectors at half-BPS boundaries and interfaces in the 4d $$ \mathcal{N} $$
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\left(\mathfrak{g}\right) $$
U
g
with the trace describing the Dirichlet boundary conditions; and the finite W-algebra $$ \mathcal{W}\left(\mathfrak{g},{t}_{+}\right) $$
W
g
t
+
with the trace describing the Nahm pole boundary conditions.