Reconstructing a signal from FFT by adding individual signal components
There are a couple of mistakes in your calculations:  


The t array is incorrectly specified. It should be 0:1/8:7/8 as the time positions at which the signal is assumed to be sampled for the default FFT calculation performed by fft() are 0, 1, ..., (N-1) where N = 8 in your case, the signal length. Since in your formula you are using t as the ratio n/N (where n is the array of sample times) you get the aforementioned expression to use for t.
You wrote a(1) instead of a(5) at the last term of your recs expression.
You are missing 2* multiplying each term except the first (k=0) and last (k=N/2) ones, where k is the index of the frequency axis of the Fourier transform F (recall that this 2* comes from leveraging the symmetry of the Fourier transform associated to a real signal).


Therefore, your reconstruction expression should read:

recs =  (1*a(1)/8)*cos(0*pi*t + an(1)) + ...
        (2*a(2)/8)*cos(2*pi*t + an(2)) + ...
        (2*a(3)/8)*cos(4*pi*t + an(3)) + ...
        (2*a(4)/8)*cos(6*pi*t + an(4)) + ...
        (1*a(5)/8)*cos(8*pi*t + an(5));


which gives the original signal s as verified by computing:

recs - s

ans =

   1.0e-14 *

         0   -0.1332         0   -0.0444   -0.2665    0.3553    0.1332         0