TITLE: Category of spaces/sheaves
QUESTION [6 upvotes]: Consider the following category $\mathcal C$:

An object of $\mathcal C$ is a pair $(X,\mathcal F)$ where $X$ is a space and $\mathcal F$ is a sheaf on $X$.
A morphism $(X,\mathcal F)\to(Y,\mathcal G)$ is a map of spaces $f:X\to Y$ together with a map of sheaves $f^*\mathcal G\to\mathcal F$ (equivalently $\mathcal G\to f_*\mathcal F$).

The words 'space' and 'sheaf' above can be taken in a number of senses: topological spaces and all sheaves, schemes and coherent sheaves, complex analytic spaces and coherent sheaves, etc.  My question is somewhat general, and I will leave it up to the reader which context they wish to work in.
Cohomology $H^*$ is a functor from $\mathcal C$ to the category of graded abelian groups, however we can say more.  Namely, let $W$ denote the class of morphisms $(X,\mathcal F)\to(Y,\mathcal G)$ in $\mathcal C$ for which $\mathcal G\xrightarrow\sim f_*\mathcal F\xrightarrow\sim Rf_*\mathcal F$ are both isomorphisms.  It follows by the Leray spectral sequence that $H^*$ sends morphisms in $W$ to isomorphisms.  The functor $H^*:\mathcal C\to\operatorname{AbGrp}$ thus factors through the localization $\mathcal C\to\mathcal C[W^{-1}]$ (note though that we have not argued that this localization exists).
The above suggests that cohomology makes sense not only for objects of $\mathcal C$ but also for what we might get by gluing together various objects of $\mathcal C$ along morphisms in $W$.  For instance, take two objects $(X_1,\mathcal F_1),(X_2,\mathcal F_2)\in\mathcal C$.  We could glue these together along a common open subset $(U_1,\mathcal F_1|_{U_1})\xrightarrow\sim(U_2,\mathcal F_2|_{U_2})$ to obtain another object of $\mathcal C$.  On the other hand, we should also be able to, at least formally speaking, glue together along any morphism $(U_1,\mathcal F_1|_{U_1})\xrightarrow\sim(U_2,\mathcal F_2|_{U_2})$ in $W$ and obtain some sort of generalized object (though not an object of $\mathcal C$) to which it still makes sense to apply the functor $H^*$.
I can imagine various ways of making the above discussion precise (i.e. making sense out of "objects of $\mathcal C$ glued together along morphisms in $W$"), however they all suffer from the following deficiency: there is no simple way to describe morphisms between two such objects.  This is similar to how a topological groupoid presents a stack, but given two topological groupoids it is somewhat cumbersome to describe, purely in terms of topological groupoids, the space of morphisms between the associated stacks.  The notion of a stack solves this issue (of describing morphism spaces) beautifully: a morphism of stacks (on a site $\mathcal D$) is just a natural transformation of functors $\mathcal D\to\operatorname{Groupoids}$.  I can finally form my question:

How can we form a category whose objects are "generalized objects" of $\mathcal C$ (i.e. gluings of objects of $\mathcal C$ along morphisms in $W$) and whose morphisms admit some sort of simple description?

REPLY [5 votes]: Here is a construction which I think is at least close to what you're driving at.
Let $\mathcal S$ be our category of spaces, and let $Shv: \mathcal S \to Cat$ be the pseudofunctor taking a space to its category of sheaves $Shv(X)$ and a taking a map $f$ to its pushforward $f_\ast$. Then by the Grothendieck construction there is a corresponding fibration $\mathcal C \to \mathcal S$. Moreover, this is the same $\mathcal C$ as in the question. That is,

The category $\mathcal C$ is the result of applying the Grothendieck construction to the functor $Shv: \mathcal S \to Cat$.

Let us assume that

$\mathcal S$ is locally presentable;
For each $X \in \mathcal S$, the category $Shv(X)$ is locally presentable;
For each $f: X \to Y$, the functor $f_\ast: Shv(X) \to Shv(Y)$ has a left adjoint $f^\ast$;
The functor $Shv : \mathcal S \to Cat$ preserves $\kappa$-filtered colimits for some $\kappa$.

Then the fibration $\mathcal C \to \mathcal S$ is a presentable fibration, and by Thm 10.3 here, $\mathcal C$ is a locally presentable category.
Now for locally presentable categories, there is a very nice theory of localization. Assuming that $W$ is closed under colimits in the arrow category and also under pushouts along arbitrary maps (satisfies a mild set-theoretic hypothesis), the localization $\mathcal C[W^{-1}]$ is a reflective subcategory of $\mathcal C$, consisting of the $W$-local objects.

To connect to your setting, what I would do is take the $\infty$-categorical version of all of this (as in the paper of Gepner and Haugseng referenced above). So I would take $Shv(X)$ to be the $\infty$-category of sheaves on $X$ localized at the quasi-isomorphisms (i.e. the $\infty$-categorical enhancement of the derived category). From your examples, it sounds like neither $\mathcal S$ nor $Shv(X)$ is necessarily presentable -- you might have some finiteness conditions on them which prevent them from being cocomplete (every locally presentable category is cocomplete). But that's fine -- assuming that $\mathcal S$ and $Shv(X)$ have finite colimits, ($\infty$-categorical colimits in the latter case), you can just take the Ind-category of each to get something presentable.
Having done this, we have a presentable $\infty$-category $\mathcal C$. I would take $\mathcal W$ to be the class of morphisms inverted by the cohomology functor. In order to apply the theory of localizations of presentable $\infty$-categories, $\mathcal W$ needs to be closed under colimits in the arrow category and pushout along arbitrary morphisms. I believe the colimits in $\mathcal C$ are going to be related to colimits in $\mathcal S$, so in order for this to work, you will probably need it to be the case that cohomology behaves well (i.e. satisfies Mayer-Vietoris) with respect to all pushouts in $\mathcal S$, which is probably not the case -- it probably only behaves well with respect to some kind of "homotopy pushouts". So probably $\mathcal S$ also needs to be modified by localizing it at some kind of "homotopy equivalences" to obtain an $\infty$-category $\mathcal S_L$ such that the $\infty$-categorical pushouts of $\mathcal S_L$ are computed via the "homotopy pushouts" of $\mathcal S_L$. So we'll end up with an $\infty$-category $\mathcal C_L$ by applying the $\infty$-categorical Grothendieck construction to the functor $Shv: \mathcal S_L \to Cat_\infty$.
But once all of this is done, $\mathcal C_L[\mathcal W^{-1}]$ will be the full subcategory of $\mathcal C_L$ consisting of the $\mathcal W$-local objects. This may seems surprising, but really it's analogous to the fact that sheaves are a full subcategory of presheaves -- allowing more types of gluing makes your objects more local.
Probably the trickiest part in general is constructing $\mathcal S_L$. When $\mathcal S$ is spaces, for example, $\mathcal S_L$ would be the $\infty$-category of spaces; when $\mathcal S$ is schemes, $\mathcal S_L$ might be motivic spaces, etc. Probably $\mathcal S_L$ can itself be constructed as some localization of sheaves of spaces on $\mathcal S$, as in motivic homotopy theory.