I'm not a lawyer and this is not legal advice, but the relevant documents are the US-Japan tax treaty, as well as the SSA totalization agreement with Japan (social security tax).
SSA Totalization Agreement
If you are a US citizen living and working in Japan, employed by a Japanese entity that does not have a US entity as its parent, you can claim the foreign earned income tax credit (as long as you meet the other criteria, like presence test etc.). If instead you are working as a contractor, you should also be able to claim the foreign earned income tax credit, however be aware that social security tax still applies (since you'll count as self-employed). If you pay your self-employment social security tax to Japan, by virtue of the totalization agreement, you can actually avoid double-taxation on social security by going through the process described in the documents, which basically involves requesting a document showing you paid said taxes in Japan, which you will then present to US tax authorities.
State taxes are an entirely different beast and vary from state to state, where California is particularly tough on expats.
I hope that gives you a good start. My advice is to consult a tax lawyer familiar with international taxes.