Welcome to the Party. You like it here.
With that number it is either a 79 XS650F or a 79 XS650SF. There should be no difference in the wiring for those two models.
Your po may have been "fixing" something but all the component parts still have the right wires on them. The color of those wires match the diagram colors. Now the colors of any wires your PO used may not match.
Use any 79 wiring diagram and trace the wires by color from one component to the next.
Intermittent spark can be caused by several things. The 79 has points. The power feed to the coil can have a bad connection causing poor spark.
Fully charge your battery. Now turn the key and engine stop switch to run. Now with a meter check the battery voltage. It should be somewhere around 12.5 volts. Now check the voltage on the red/white wire at the coils. The voltage should be no more than .2 or .3 volts below battery voltage. If it's good, fine. If not you have a weak, dirty or just plain bad connection some where. The usual suspect at this point is the key switch or the engine stop switch.
These switchs can be taken apart and cleaned.
Before you do that you can check the switches to see which one it is. In the headlight bucket find the three wires that come down from the key switch. A red wire, a brown wire and a blue wire. Using your meter probe into the plug and check voltage from the harness side. The red wire is power in, it should read the same as battery voltage.
Now with the switch ON. Probe the brown and the blue wire. They both should read battery voltage. If not the switch is dirty. Remove the switch, take it apart and clean the contacts. Bright and shiny is good.
If the voltage is low on the red wire it could be the fuses. The stock round glass fuses and the fuse box cause many troubles. The clips that hold the fuses get weak and often break off. Best to replace with four inline fuse holders. Use the new blade style fuses. Round glass fuse are crap, always have been, always will be.
To test the engine stop switch take the right side switch housing off the bars. Your engine stop switch has two wires, both red/white or maybe a red/white and brown wire. Either way one is power in and the other power out. Test voltage with the switch off, one wire should have battery voltage one not. If the voltage is low on the power in wire there is a dirty wire connection somewhere between the key switch and engine stop switch.
If good power in flip the switch to run. Now test the other wire. you should get good voltage on both sides of the switch. If not, dirty switch. It can be taken apart and cleaned, Bright and shiny is good here two.
Once you get good voltage to the coils it should fix your intermittent spark. It could be in the wires from the coil to the points and condensers. Are the points clean? gapped right? timied right? Your repair manual explains how to.
On the starter the starter it self is seldom the problem. The gears connecting the starter to the engine are. These gears work like a bendix on a car starter. When you push the start button the starter spins and turns gears under a cover on the left side of the engine. These gears turn a shaft going over to the right where it turns more gears. These gears are like the bendix. As they turn a wish bone shaped spring holds one from turning, forcing it to slide on the other gear to engage the crank.
If this wishbone spring is weak it won't hold the gear. the gear just spins and grinds on the crank. An easy fix. Just remove the right side engine coevr, drain the oil first, Some have had luck justy reaching in with a pair of pliers to squeeze the spring tighter. Most need to remove the clutch and gears then tighten the spring. I'll post a pic.
I and others will reccomend starting at one end of the bike and work to the other taking apart all the connections, cleaning and tightening all the connections in the wiring. This includes the switches. It can take a long time but it will fix many of the electrical problems before they become problems.
On the charging it can be as simple as a weak connection or bad brushes to needing a complete alternator.
Up near the top of this page you will find an XS650 TECH button. This leads you to a list of threads. Scroll down the list, read any that seem to cover any problems you have. There is a good thread about charging system testing.
Hope this helps and gets you going in the right direction.
Leo