There is a pretty well known, and widely written about, adjunction between augmented algebras and coaugmented coalgebras given by taking the bar construction on algebras and the cobar construction on coalgebras. Sometimes, under certain circumstances (for instance, if your algebras are group-like loop spaces), this adjunction is an equivalence (e.g. the equivalence between group-like loop spaces and connected spaces)

My question is: when does this lift to categories of modules and comodules? In other words, given an augmented monoid $A$ (augmented, let's say, over $k$) and an $A$-module $X$, we can produce a $BA$-comodule $BX$ by taking a bar construction $Bar(X,A,k)$, which is effectively a kind of ``quotient" by the $A$-action. There should, I feel, be a right adjoint going from $BA$-comodules to $A$-modules, given by $Cobar(C,BA,k)$ ($C$ being a comodule).

A good example is the case of $G$-spaces for a discrete group $G$. If we have a group action of $G$ on a space $X$, then we have an "action groupoid" which is basically a simplicial diagram whose bottom part looks like $G\times X\rightrightarrows X$ and whose colimit is $X//G$. In particular, we now also have a map $X//G\to BG=\ast//G$ endowing $X//G$ with a $BG$-comodule structure (using the diagonal map of $X//G$). On the other hand, given a map $Y\to BG$, we can perform a cobar construction whose effect is to take the fiber of $Y$ over the base point, which is, by elementary topological considerations, once again a $G$-space.

I'm skipping a lot of the technicalities of describing this kind of structure, but I'm really interested in knowing how general this structure is. In particular, I'd really like to be able to go between modules and comodules, and I'd really like to do this in some homotopical-enough setting (e.g. quasicategories or simplicial model categories). Are there well known references for this?

Note: There are TONS of references for this kind of thing for going between algebras and coalgebras. I'm very specifically interested in doing this for modules and comodules.