Unix shells have always had this limitation: when you navigate around in vim, ranger, or any other app, you lose that final location when you exit. You're back where you started, not where you ended up.
What if apps could just... inherit their final directory to the shell when they exit?
Instead of complex monitoring or protocols, applications can solve this themselves with a simple pattern:
# When your app exits, create a simple transition script:
#!/bin/bash
cd "/final/directory"
exec $SHELL
Then replace your process with that script. Works in any language.
That's it. The user gets a shell in the final directory.
- AUTOCD_CONCEPT_DOC.md - Explains the idea and shows why it works
- DEVELOPER_IMPLEMENTATION_GUIDE.md - Technical details for implementing it
I spent time exploring this concept and trying different approaches to make universal directory inheritance work. The shell replacement monitoring approach was too complex and fragile. But this app-level pattern is simple and actually works.
I can't put more resources into this right now, but I wanted to document the idea in case it's useful to others. This isn't a complete solution - just a small contribution to solving a problem that's bugged developers for decades.
If you're building a CLI app that navigates directories, maybe this pattern could help your users. And if enough apps adopt it, maybe we can finally fix this Unix limitation.
Sometimes the best solutions are the simplest ones.