Plaintiff attorney was hired by defendant as an in-house attorney, but his compensation was dependent, in part, on the outcome of a large bit of litigation in which the defendant was engaged. This decision holds that plaintiff’s agreement was a contingency fee agreement which was unenforceable because not written and signed by both parties as required by B&P Code 6147. The fact that plaintiff was an in-house attorney did not exempt him from section 6147’s requirements. Though his compensation could be characterized as wages, it was also attorney fees and hence governed by section 6147.