We consider quantum decoherence in solid-state systems by studying the transverse dynamics of a single qubit interacting with a fermionic bath and driven by external pulses. Our interest is in investigating the extent to which the lost coherence can be restored by the application of external pulses to the qubit. We show that the qubit evolution under various pulse sequences can be mapped onto Keldysh path integrals. This approach allows a simple diagrammatic treatment of different bath excitation processes contributing to qubit decoherence. We apply this theory to the evolution of the qubit coupled to the Andreev-fluctuator bath in the context of widely studied superconducting qubits. We show that charge fluctuations within the Andreev-fluctuator model lead to a 1/f noise spectrum with a characteristic temperature depedence. We discuss the strategy for suppression of decoherence by the application of higher-order (beyond spin echo) pulse sequences.