The basics of mafia are explained elsewhere on this site; however, to make the game work in forum form, more specific rules relating to code-of-conduct, activity levels, and formalities is in order. This is a good typical ruleset; however, games with unusual modified mechanics will need different rulesets.
General
0. I am mod, and I am God. Whatever I say trumps the rules as you understand them.
1. Cyan is my colour. Don't use it. I will consider it an attempt to impersonate the mod.
2. Do not quote private communication with the mod. This includes role PMs. Doing so will risk modkill.
3. Unless your role specifies otherwise, do not talk about the game outside the game thread. If your role does specify otherwise, you may still only talk about the game where your PM says you can.
4. Don't edit your own posts, you will be instantly modkilled.
5. When a player achieves the majority of the votes, the game enters twilight. This means players can no longer change their votes, but they can still talk.
6. Once the mod declares you dead, you are dead. Dead people do not talk.
7. Once the mod declares it night-time, you are asleep. Sleeping people do not talk. Sleeptalking is a modkillable offence.
8. Modkills are to be done in the way most disadvantageous to the player and their faction. This means that any modkilled player changes to neutral, and therefore cannot win the game. If a mafia-sided player was modkilled, the day continues. If a town-sided player was modkilled, the day ends immediately.
Activity and Deadlines
9. Post every 48 hours. If you fail to do this, you will be prodded. If you do not respond within 48 hours of your prod, you will be replaced. This rule is flexible if you give advance warning of your absence.
10. If you will be absent, tell us when you will be back.
11. Day one has a deadline of three weeks. Day two and onwards have a deadline of two weeks. All nights have a deadline of three days. If anyone has announced that they will be absent over the course of a night, the night will be extended for 24 hours after their announced return. Deadlines are non-negotiable barring absences and exceptional circumstances.
12. If no player has acheived the majority of votes by deadline, then no-one is lynched.
Voting
13. Votes are to be bolded and roughly in the form Vote: Playername
14. Retracting a vote is to be done in the form Unvote: Playername. Unvoting before voting a new player is appreciated but not compulsary.
The all important rule
15. If you think you've found a loophole in the rules, then you're wrong.