Heat the olive oil in a wide pan with high sides over medium-high heat until it just begins to smoke. Add the garlic cloves, adjust the heat if necessary to cook them at a steady sizzle, and cook, tipping the pan occasionally so the oil pools almost cover the cloves. Cook until the garlic has some golden brown spots and the skins begin to split and blister, about 5 minutes.
Push the garlic to one side of the pan, put the rosemary in the oil next to the garlic, and add the peanuts to the space remaining in the pan. Turn the heat down to medium and let the rosemary sizzle in the oil for a minute, stirring it a little, then stir it together with the peanuts and garlic.
Let them all quietly and steadily sizzle together — you're infusing the flavors of the garlic and rosemary into the peanuts and cooking the garlic more so it'll be soft and creamy. Reinvigorate the roasted peanuts by stirring and tossing them often, so they all get to spend some time against the bottom of the pan, about 5 minutes. About a minute before that, sprinkle on the salt, crumble in the chilies and stir well.
Take the pan off the heat and let the peanuts carry on, cooking gently in the hot pan. Stir the pan now and then, until they've cooled a bit. Have a taste and stir in a little more salt or crumbled chilies if you fancy it. Serve warm or at room temperature.