What you are looking for is to see whether or not your basement living space is "grandfathered" into the municipalities building and housing codes.
(You say that you were sued by the housing authority, so is it okay to assume that you were renting this out, and were sued for improper rental - I am drafting this to address a complaint by the housing authority on that basis, but the same principles apply if you were cited by the building department for the construction).
- Start by identifying the specific code section that you were cited for. This should be in the citation or letter that you received.
- Once you receive this, go to that code section - many municipalities have these code sections online - but you may need to actually go to the City and find this in person.
- Check first in the specific code section, and if it is not there, in the general code chapter, for any type of "grandfather clause"
- A "grandfather clause" is a clause that permits pre-existing use or structures to remain even though those structures or use would violate newly enacted statutes or codes. These clauses can vary (such as permitting pre-existing use for 10 years after the date of the new code; permitting pre-existing use until sale of the property; permitting pre-existing use until substantial remodel of the structure, etc.)
- There is no requirement that a "grandfather clause" be included - so it may not be present at all
If you cannot find this information on your own, retain a local attorney and have them do a search for you - law firms pay for subscriptions to legal research tools that cost a lot of money to compile data such as municipal codes and they can help with this type of research if you are unable to identify the clause specifically.
Assuming you find a clause, write a letter (keep a copy) to the Dept. of Housing, identify the clause you were cited with (give the citation number, date, etc. so that they can identify the two), and give them the grandfather clause that permits your continued pre-existing use.
If there is no such grandfather clause, you may need to identify if there is any way that you can modify the structure so that it complies. Contact a law firm (or a reputable contractor or engineer with experience in your area) to inspect the property and see if they can assist you.