How to sync TextEdit (or other file on Mac) and Apple Notes pages?

Sounds like a good starting point. I'll check it out. Thank you very much!

The more I think about it, simply being able to open a specific note by double clicking on an exectuable file in a specific folder, so I could have lots of notes that are specific to lots of folders, that would probably do the trick. That means I'm not really needing to synch files like I originally asked about. I had presumed a more complicated way to address my real problem.

So now my task is to automate running that "Float Specifice Apple Notes" macro triggered by a shell script. Somehow I'll need to either embed the name of the Note or feed the name of the folder to the script or to the macro. I guess that depends on whether I want there to only be one Notes page per Mac folder or might a Mac folder have links to open multiple different Notes.

I'm imagining a use case like this: In my ~/Personal/Vehicles/Prius folder on my Mac I have an executable file called Prius Mechanic Notes.sh or whatever suffix is appropriate. I double click that and it opens the right Note embedded in whatever folder it's in within the Notes app, probably something like Vehicles/Prius. I maked notes of my questions there, on my laptop, while I'm planning my trip to the mechanoic. Then when I'm at the mechanic, I use Notes on my phone to makes notes about our conversation and his recommendations. When I'm back at my desk I can open those notes from the Vehicles/Prius folder, without having to navigate the Notes app to get there.

There are multiple ways available to automatically generate a note-opening script whenever and wherever I want it, and I don't immediately see a path that is obviously easiest. I'll start by playing around with that Macro and triggering it with a manually created script, to see what's really involved. Any suggestions come to mind?

Any tips on running a KBM macro from a shell script? I know it can be done by using the Trigger By Shell Script and copying one of the suggested shell commands that comes up, which basically are shell commands to run AppleScript to "tell application "Keyboard Maestro Engine" to do script "..." with parameter "..."". What I'm asking for is any caveats, tricks, tips, or gotchas in doing that.

I just had an idea. There's a shell variable that is the name of the current file being executed. If that becomes the variable that is passed to @_jims's script, then name of the executable file would match the name of the note and the correspondence is automatic, with the same script being used in all cases and the only change needed is a change of filename, nothing embedded into the script. I'm liking this idea a lot.