So the reputation system has been explained already. Its basically a version of the "golden rule" where you're treated differently by the light veric (villagers) depending on how you treat them.
Reputation is affected by actions towards villagers. It is lowered by harming them, causing discomfort, killing their copper automatons, and stealing from them. It is raised by helping them with raids, reducing their discomfort, curing zombification, and similar actions.
Discomfort is another stat that villagers have. It is a stat that indicates how they feel in a situation/location.
You can make villagers more comfortable by giving them beds, a place to rest at least 10 blocks away from their workstations, time to be around other villagers, and room to wander.
You can make villagers less comfortable by taking away these things.
Reputation affects how the villagers treat you. You start with fifty reputation, meaning they are completely neutral towards you. Your reputation scales from zero to one hundred.
If your reputation is lower than fifty, they will ask for more for trades, give you less time to do "tasks" (Inspired by bounties from the bounty board mod), and, if your reputation is from zero to ten, copper automatons summoned by villagers will attack you on sight.
If your reputation is higher than fifty, they will ask for less for trades, give you more time to do "tasks" and be less likely to take a single low-damage hit as a danger, meaning the copper automatons won't attack you for that every time.
Please note that you have a single reputation counter for all villagers, partially to make this easier for me to code.