aybe you could make it write down every short RS code of a star system you visit in a small text file, then just cycle through that when you visit a star to see if you've been there, surely that shouldn't take too much space?
No, this will get very slow when the database grows. The database should be more optimized and use a very fast search algorithm, like octree and binary search in pre-sorted array.
BTW, you already have journey journal ("Tab" menu). It shows the objects that you've visited by autopilot. I can easily make markers that will show the locations of all journal entries in space, but only if I leave it limited in size (100-1000 entries).