Is there a case to double track this area?
Single tracking is all well and good on seldom used lines, but the success of TransWilts and the use of the track this weekend suggests that double tracking should be considered, or at least in part.
Double tracking is no longer the silly idea it once was, but even it wouldn't in itself sort out the issue of freight trains leaving Westbury and having to keep ahead of passenger trains behind them catching up - no lay-bys to Swindon. Technically the main line through Chippenham is bi-directional, but the chance of the second line being available for an overtaking move is low, and signallers have to be careful as one of them discovered with the sleeper last week ... with two trains waiting for the single line at Chippenham - one on each line - and one coming up the single line. Double track may come back in the next 20 years, but would/will require a second platform at Melksham, I suspect a rebuild of the bridge over the Avon, and realignment of much of the existing track; not cheap, though I don't know of any significant (building) construction on the old trackbed.
Much, much more modest than doubling - see upthread - are an intermediate signal to allow trains to follow at (say) 10 minute headway, and relaying of the junctions with higher speed limits and (at Thingley) the crossover close by where the 'branch' leaves the mainline. But these little fixes only give some extra capacity. Going further, a loop at the junctions (becoming double junctions so that a train can wait clear of the main line and one can pass it going the other way) would help with robustness. Lay that out such that it can be used as a bypass / holding line too, and your getting somewhere useful. A long bi-directional loop alongside the unused platform face at Chippenham would also provide for this bypassing, and would allow a train to be turned whilst expresses and freight passed both ways. Would have been useful, I suspect, on Saturday when a TransWilts train was turned at Chippenham amongst the heavy traffic - but I suspect the main use would be for bypassing, with trains in the future - coming up from Southampton (previous stop Melksham) and Bristol (previous stop Corsham) carrying on to Royal Wootton Bassett and Swindon as a minimum.
A loop somewhere near Melksham could also be useful. At the station means doubling the station or having it only as a bi-directional freight loop. Platforms on both lines means cost and (unless bidirectional) removes the overtaking possibility. Platform on the loop and on the same side off the end of the loop (Penryn solution) also a possibility.
I'm not best informed to evaluate the options - or what might be needed. Nor to evaluate whether a significant increase in capacity between Westbury and Chippenham would result in a new but wider (wide enough?) bottleneck from Royal Wootton Bassett into Swindon, or to the east of Swindon if the majority of traffic carried on to the Didcot area. Much depends on what all this extra traffic (on a regular basis) would be ... performance envelope, need to run to time and possibility of running late, etc. You could have the Southampton service, and the Taunton to Nuneaton train, each running hourly. Passenger traffic also on the Bristol Metro - phase 5 adds half hourly trains looping Bath - B-o-A - (restored chord) Melksham - (restored chord or Chippenham reverse) Corsham - Bath. Then you have the London to Weymouth
IEP▸ which runs every hour, following the old road from Paddington to Swindon where it detaches from the Gloucester and Cheltenham Spa service and carries on via Westbury, Castle Cary, Yeovil Pen Mill and Dorchester. The TransWilts also handing major freight traffic from Southampton to the north. Much of this sounds fanciful - with it all, I suspect you need to double and lay-bys ... but who knows in the next 50 years?