anchor.diff:  -spec fold(ctx(), fold_fun(doc()), fold_fun(key()), boolean(), fold_acc()) ->
       {ok, fold_acc()} | {error, term()}.
   fold(Ctx0 = #{model := Model, fold_enabled := true}, Fun, KeyFilter, ReverseKeys, Acc) ->
  -    Ctx = case Ctx0 of
  -        #{local_fold := true} -> Ctx0#{routing => local};
  -        _ -> Ctx0
  +    {Ctx, ModelKey} = case Ctx0 of
  +        #{local_fold := true} ->
  +            NodeModelKey = <<(atom_to_binary(Model, utf8))/binary, "###", (atom_to_binary(node(), utf8))/binary>>,
  +            {Ctx0#{routing => local}, NodeModelKey};
  +        _ ->
  +            {Ctx0, atom_to_binary(Model, utf8)}
       end,
  -    ModelKey = atom_to_binary(Model, utf8),
       LinksAns = fold_links(Ctx, ModelKey, ?MODEL_ALL_TREE_ID, fun(#link{name = Key}, Acc2) ->
           KeyFilter(Key, Acc2)
       end, [], #{}),
  
positive.code: -spec fold_keys(ctx(), fold_fun(key()), fold_acc()) ->
      {ok, fold_acc()} | {error, term()}.
  fold_keys(Ctx0 = #{model := Model, fold_enabled := true}, Fun, Acc) ->
      Ctx = case Ctx0 of
          #{local_fold := true} -> Ctx0#{routing => local};
          _ -> Ctx0
      end,
      ModelKey = atom_to_binary(Model, utf8),
      fold_links(Ctx, ModelKey, ?MODEL_ALL_TREE_ID, fun(#link{name = Key}, Acc2) ->
          Fun(Key, Acc2)
      end, Acc, #{});
  
negative.code:     {ok, doc()} | {error, term()}.
  add_fold_link(Ctx = #{model := Model, fold_enabled := true}, Key, {ok, Doc}) ->
      Ctx2 = Ctx#{sync_enabled => false},
      {Ctx3, ModelKey} = case Ctx2 of
          #{local_fold := true} ->
              NodeModelKey = <<(atom_to_binary(Model, utf8))/binary, "###", (atom_to_binary(node(), utf8))/binary>>,
              {Ctx2#{routing => local}, NodeModelKey};
          _ ->
              {Ctx2, atom_to_binary(Model, utf8)}
      end,
      case add_links(Ctx3, ModelKey, ?MODEL_ALL_TREE_ID, [{Key, <<>>}]) of
          [{ok, #link{}}] -> {ok, Doc};
          [{error, already_exists}] -> {ok, Doc};
  