MacPass just lost a bunch of my passwords because I.... shutdown my mac.
The autosave behaviour for OS X doesn't stick so well with the design of a Keepass database, as you have to understand the risks involved. And since MacPass does not support the history correctly this even might cause more trouble. What's include is a save on lock feature, that is, MacPass always stores the database if it gets locked. Since I did change a bit of the undo/redo support some changes aren't register as changes and you will not get a "save changes?" on quit dialog but this should be back in the next release. And sorry for causing you trouble with this behaviour!
MacPass always stores the database if it gets locked.
The lock mode is useless to me, I never lock MacPass.
I never even _look_ at MacPass. I just keep it open in the
background and add passwords to it with the Chrome extension.
Consequently all my changes must be persisted immediately
or near immediately. I can not switch to MacPass and manually
hit save every time I add a password. That's not how software
works in 2016.
I don't care what MacPass has to do to realize this requirement.
My computer is fast. Rename the old db and save to a new file if
that's what it takes.
Here is how I currently implement "auto-save on system sleep",
via keyboard maestro automation:

Please fix this in MacPass.
If you'd like to implement the feature feel free to open a pull request. If it works I'll gladly merge it.
What I tried to tell you is this. There are more than two users of MacPass and a handful of Keepass users around. I have no plan to diverge MacPass away and add custom behaviour or custom extension to the format as long as it's not needed. The whole purpose of MacPass is feature parity with Keepass, not another password manager as there are plenty of those around.
What you might have missed - and I did not state - MacPass saves on lock and there's a setting to lock the database when the computer goes to sleep. So your custom solution works but is (for this case) not needed. As for saving every time you edit something that's a case for a trigger system. Keepass supports this, and I might implement something like this (or add AppleScript support) but since I even haven't gotten other basic stuff worked out there's simply no time for this. If someone else (or as stated above you) want's to jump in, that's highly apreciated.
And as a kind remark: No one get's a dime putting time into MacPass. We're all here for the fun, not for the hassle ;)
BTW https://keeweb.info has a auto-save feature as far as I'm aware. You might want to give this client a try since it might suit your style more than MacPass.
@mstarke Thanks for all your hard work and positive attitude, despite those who have no gratitude for it
@mstarke Re lock-after-sleep. I'm aware of that setting.
It would require me to re-enter the (long) db password
after every sleep/wake cycle for no gain. That's why
I had to resort to KM automation.
I'm not belittling the work that went into MacPass,
it's much appreciated. My tone results from the
frustration over the fact that a trivial feature
would prevent predictable loss of user data
and broken expectations here.
It was one of those precious moments where you
sit in front of your screen and think "This didn't really just happen?".
As seen on the issue tracker I'm not the first
to run into this, and surely not the last.
Why not have an auto-save timer in the preferences
that fires a save if modified every n seconds while the
window is out of focus (as to not annoy an active user
with intermittent beachballs)?
I tried to emulate that with KM, but due to OSX constraints it
has to bring the window to the foreground to trigger a menu item...
I did suspect you were frustrated about data loss and thus pissed, hence I wasn't trying to keep the heat up. To get you into my head a little more:
I'm not against those little features - on the contrary, but sometime I try to hold them back to implement a proper solution. There are so many little request that often seem trivial and sound vey useful. The proper solution would be the trigger system for many of "Those Little Things". A save-timer or a "save after every modification" setting is one of those those too.
The trigger system is a no-go for me right now so I think yet another checkbox might be the better way. I hate this a lot since Keepass already throws a huge bag of tools at you screaming "Want more? Here you go!" and I like the @marcoarment way of just using sensible defaults and not having a dip-switch for every little thing.
To be honest, I never really thought about the use-case of never locking and always sleeping thus having MacPass run unlocked indefinitely.
Thanks for insisting on this. I hope I can fix this properly soon.
Yup, my previous post also came out more harsh than intended,
I apologize for that.
However, I still think the better should not be the
enemy of the good when critical user data is at stake.
Having triggers would be _nice_, but it should not
stand in the way of preventing loss of passwords.
Running MacPass unlocked indefinitely may seem like an unusual
mode, but it really is the only one that makes sense in conjunction
with the browser extension (which will otherwise just quietly fail
when the database is locked).
The number of people using MacPass in this mode will probably only
go up, as the faith in closed source password managers declines
with every exploit[1].
[1] https://labs.detectify.com/2016/07/27/how-i-made-lastpass-give-me-all-your-passwords/
To prevent this in the future I did experiment with NSDocument's autosaving in place and it seems to work as expected. If this works as expected, theres no need for a custom setting or code to emulate this in MacPass and as a bonus, you now get a version browser.
I have made more progress on autosave of the document. I suspect a lot of edge cases might exist, but for now I think I have found a good solution to work out a lot of lost data issues with this. It's not 100% safe, since some text edits might still be lost, but it's a lot closer to the goal than before. If you like to test it, feel free to use the master branch but there might be stuff broken since I also threw out 10.8 support to get some of the old nssheet api out of the way.
@saulodigital sorry for having caused so much trouble. Creating a tool that stores such sensible data puts the developer in a tight spot sometimes. I tend to be over-cautios in some areas but still bugs creep in that might make a lot of trouble. As stated in the comment above, the master has auto-save in place so this is working if you compile MacPass yourself. I currently am implementing KDBX4 support for KeePassKit to make MacPass compatible with the new format. I might release another version of MacPass before this is done but there's definitely an upcoming release that will add KDBX4.0 support (besides a lot more small stuff)
2e1e4ad5acd2364825c19c38c81e56af58e9bbe3 has fixes for a lot of "unsaved changes are lost" on save/quit and in combination with auto save enabled I'll consider this as done. If there are issue with the current implementation, please create separate issues for those.
Most helpful comment
@mstarke Thanks for all your hard work and positive attitude, despite those who have no gratitude for it