Heat 2 tablespoons of the oil in a medium skillet over medium heat and cook the onion, stirring occasionally, until golden and lightly caramelized, 10 to 15 minutes.
Meanwhile, heat a comal, griddle, or heavy skillet over medium-low heat, and toast the chiles, turning them over frequently, until puffed, deep brown (with some black blisters) all over and brittle again (they become softer at first), 8 to 10 minutes. Remove them from the heat and let them cool slightly.
Crumble the chiles into the blender jar, then add the onion, water, agave syrup, vinegar, garlic, and salt and blend until smooth, at least 2 minutes.
Heat the remaining tablespoon of oil in the skillet over medium heat until it shimmers, then carefully add the sauce (you can swish a little water around in the blender jar to get the remaining sauce out). Simmer, stirring occasionally, until the sauce thickens slightly and its color changes from brownish to purplish, 10 to 15 minutes (use a splatter screen so the sauce doesn't make a mess of the stove). Turn the heat to low, and cook for another 25 minutes or until it's so thick that when you tip the skillet it barely moves. Let the salsa cool to room temperature before you serve it, and season to taste with additional salt, agave syrup, and vinegar.
This salsa keeps in the refrigerator for up to five days or in the freezer for up to one month.
Reprinted with permission from Truly Mexican by Roberto Santibanez with JJ Goode, copyright (C) 2011. Published by Wiley.