Memory Palace Example

A memory palace is a handy way of memorising information.

In the age of AI and search engines, I find that having information memorised helps quite a bit when speaking in public, discussing a point, holding a debate, and even just good old fashioned offline thinking. Thus I’ve been building memory palaces little by little over the years, but in a disorganised and unsystematic way.

I realised that Tbx could be a place where my memory palaces could live and get some semblance of order. This would help with reviewing them (called walking through the memory palace). So I started the process. It took me a couple of hours to get it right. I have attached the demo, with instructions in the readme.

Keep in mind that it doesn’t contain any images, because the images are in my imagination.

My intention with this is to:

  1. Make a contribution to this wonderful community, which I feel indebted to.
  2. Show off just a little bit, because I’m proud of myself for figuring out how to do this :smiling_face:
  3. See if this sparks some insights in the community about how to improve this, so I can steal ideas and use them :joy:

In terms of future developments, it would be interesting to be able to place the notes in map view over background images corresponding to the loci. That would help when one needs a palace that has more loci than are available in one’s house, for example. But that would be for version 2. It would also be great to implement spaced repetition. I tried to read the spaced repetition tutorials and examples, but they were too deep and intense for me. I’ll have to give them a shot another time after my brain’s rested a bit.

I hope this helps someone in the community. Eager to hear more if it does.

PS: I think the “Flip” functionality may prove useful to those who are looking for ways to mimic Anki decks and flashcards and spaced repetition.
Memory Palace 1e.tbx (110.7 KB)

1 Like

Thanks for this contribution to the community. The ‘read me’ is most helpful (and I know feel like unnecessary effort when writing them … for others). I like the flip mechanism.

One small syntax note there. The test:


should be (with 2 corrections):


Luckily Tinderbox guess correctly the intent of your code and works as if you had written the latter. In a query content, ‘is equal to/exactly the same as’ is written as ==. Boolean values are always lowercase words and not quoted. Errors in the latter are more liable to go wrong, such that “False” might be evaluated as boolean true as "False" doesn’t necessarily coerce to a value equating to false.

For a large palace with many such docs, I’d consider moving the logic from a rule to an edict. If that seems counter-intuitive, here’s why. All rules run all the time so more notes means more background activity. Yet, we only need the Flip logic to run if we tick the box in a note’s Displayed Attributes. An overlooked aspect of edicts is that whilst they run far less often than rules, they do run if any Displayed Attributes values in the current note changes. So if you have 100 such ‘prompts’, you have 100 rules each update cycle. With 100 edicts they run on doc open and then once an hour, except when invoked on demand, e.g. via a change to Displayed Attributes.

1 Like

Your post ties nicely with one of the goals I had in one of my recent posts (not sure if you saw it, or just fortuitous timing for me) I’m excited to see what you’ve created and if it might help my exam prep workflow. Thanks for sharing!! :grinning:

1 Like


Here is what I did.

  1. Replaced Flip with ShowAnswer.
  2. Added mpTextAnswer:String because I do not messing with $Name and $Text Directly. I prefer to put my values attributes. Many lessons, the hard way.
  3. Changed name Locus to mpLocus,mpRoom,mpTopic \ I have lots of UA, it helps to prefix them out to categorize them.
    4.Added an mpImage to put images in files and use them
  4. Added a template to see the images: YOU MUST USE PREVIEW to SEE the IMAGE.
    this could by a drawing, photo or even a Generative AI image…whatever you want
  5. Added another Attribute called IsRemembered as a boolean to file this memory piece as done.
  6. Oh, lastly, I changed the rule.

MemoryPalaceShared-td.tbx (103.4 KB)

Anyway, gotta go. This is something quick and dirty that others can improve on.



My earlier post let me to an example I couldn’t finish before the weekly meet-up and ironically took me a different path to @TomD 's solution above. The latter goes the presentation route (i.e. using the Text view’s Preview sub-pane). To save toggling back to the text sb-pane to show the answer, you could add a simply javascript control, e.g a tick-box to the page (now the view uses WebKit) to toggle showing the answer without leaving the text.

I took a different route, deliberately avoiding the extra set-up on using the presentation mode. But, I want to stress there is no right/wrong in that. both work and the choice depends on the work you’re prepared to put into the set-up and your desire for a highly styled visual display of the Q&A.

So, my take is here: Memory Palace -ma.tbx (143.9 KB)

The readme:

I’ve amended the original method thus:

  • The ‘PROMPTS’ container OnAdd action now set the ‘pPrompt’ prototype for new child notes.

  • I’ve moved the answer text out of the rule into $AnswerText which is called into the rule. this makes it easier to get the text from other places.

  • I’ve moved the rule code from $Rule to $Edit. It works the same but should scale better to a set of 10s or 100s or Prompt notes.

This prepares for an automated test.

Added a new separator ‘TEST’ preceding a new agent ‘Random Prompt’

The agent query collects all the notes using prototype ‘pPrompt’

The agent edict handles the test. Click $UpdatePrompt in the agent Displayed Attributes to get a new prompt. Don’t worry that the tick mark doesn’t show on screen, as the edict immediately turns the attribute off again. Meanwhile it selects a random alias child of the agent and for that prompt gets the $Locus, $Room, $Topic and sets them as Displayed Attributes and sets the prompt’s title as the agent’s $Text.

On loading a prompt’s details, the new (v9.5.2+) action show() gives a warning pane to not place the input cursor in the $Text area or the edict can’t update (you might be making an edit!).

For reasons unclear, the $Text may flash on/off occasionally, but not change. I’m not sure why but it will be some aspect of the edict handler doing something!

As before, ticking $Flip in the Displayed Attributes sets the agent’s $Text ext to the answer text of the prompt. Indeed, $Flip works as a toggle switching the agent’s $Text between prompt and answer.

When ready for a new test, click the $Update.

The main code is the agent’s Edict:

   var:string vPath = $Path(randomChild(original));

   show("WARNING: Do not place cursor in $Text area or it will not update", "light red");

   $Flip = false;
   $Locus = $Locus(vPath);
   $Room = $Room(vPath);
   $Topic = $Topic(vPath);  
   $Text = $Name(vPath);



Closing thought: there is no single right solution. Indeed, I can think of a number of ways this and previous solution can be improved , to suit individual style.

1 Like

Hi Mark

I am dissecting your code to understand. Question: In your Random Prompt Rule, you have a variable “$RandomPromptPath”, that I think is a UA. I have no idea how you are pulling a value into it. It works, but I am trying to understand your magic.


Lastly, I think your flashing text is because $Text is in your Rule and your Edict are competing with true logic for “if $Flip==true” at the same time. That is the way I am understanding it. I could be wrong though.



1 Like

Thanks - good spot! I tried lots of things that didn’t work and the agent rule was some litter from that—it would explain the $Text area ‘flashing’. Thus, my earlier file updated, with that rule removed: Memory Palace -ma v1-2.tbx (143.7 KB)

I should add the use of the show() was a shameless test of the new show() action code. In practice, you’ve find this annoying once you know not the leave focus in the $Text area so it can update. a boolean would fix that. Once you don’t need the reminder you can turn it off. Something for v2 (below).

I’m actually at work on v2 of my solution to add:

  • a number of expected repetitions
  • counter for the number of uses in the current session of reps

IOW, we might want to see all prompts no more than N times. Once any single prompt has been shown N times, it is removed from the random draw. Once all prompts have been shown N times, we reset the session and start over. This is method to ensure all prompts get tested (random != even distribution).

For your presentation-based approach, if you put a flip control in the template, then you might have a ‘next’ link that takes you to the next (not yet seen) prompt. Or you could blend the ‘not seen’ concept with the above approach (N reps each per full cycle).

1 Like

Hi pw did you do the piece above? Where does $RandomPromptPatch gets its path value

I do not see it defined?


It’s not used - it was only used for the rule that your rightly spotted wasn’t needed!

Why? As part of fixing the wrong [sic] problem with the overall task I had a rule and edict needing the same data. A variable can’t be shared so I cached it in a user attribute … which it turned out I didn’t need. I forgot to clear out the kitty litter tray. My bad.


†. Good learning point here. Whilst experience helps, it doesn’t solve our human facility with making bad guesses. Evidently, I made rather lot of bad guesses en route to my solution above but happily I’m old enough to be past worrying about appearing smart. What’s not obvious isn’t so: IOW, you’ve got to kiss more than a few frogs along the way. Not wanting to appear stupid is what holds us back from just trying stuff. As Ted Nelson puts is: “The more I know, the older I get.”. I should add this is not an endorsement the tech cargo cult of “move fast and break things”, as not all that is broken by casual inattention is easily mended; others care about the ‘things’ we don’t. Thank heavens for thinking tools like Tinderbox. :slight_smile:


I may be mistaken, but when Random Prompt is selected AND $Flip is positive, I was expecting answer test to appear. I might have misunderstood your intentions…if so, my apologies.


Try this: Memory Palace -ma v1-3.tbx (148.6 KB)

I’d forgotten I also needed to move the vPath out of the first if() block in the edict, as otherwise it can’t be used in the second if() that sets the $Text area.


If I wanted to reset all the $Flip attributes to false (so that whenever I open the file, all the answers are hidden), how would I do it? Because a Stamp/ Quickstamp with the action


isn’t working. I considered having it as an edict (which I think would be more elegant, having something running in the background) but I haven’t yet figured out how to get the timing right, so that it, say for examples, turns all the cards over once a day. Thanks.

But that doesn’t set the value of $Flip, it is a query to test if the attribute has a value. See = (i.e. value assignment) vs. == (i.e. value equality). You want the stamp’s code $Flip=false;. As you want to reset all notes, simpler might be to stamp the “PROMPTS” container with:

$Filter(children) = false;

Unsure how that works? See Left side expressions.

I think those are great ideas. What about having a configuration file for all these options. Different people, different strokes. The configuration file would be where you would set the parameters.


Good idea.

Aha! I see the difference now. Thank you.

Good idea. I see the wisdom in that and I’m running with it.

Memory Palace -ma v2-1.tbx (309.3 KB)

In this update, see the TBX’s read me, I’ve improved things so the logic ensures that for a count N (user set) every prompt note is seen/tested N times, after which a new cycle starts. This avoids the scenario where randomness means some tests never seem to get called. N is set to 3 in the demo, use what you like. At the back of the cycle, less-called notes will, of course, turn up more often as to pool of untested items falls (and until a new cycle starts.

Am interesting point, annotated in the code, is that that then of a cycle, the $Text isn’t voided. Why, because Tinderbox places focus in the $Text area which locks it against action code edits (so it doesn’t squish current user editing. But there’s no action code way to say (Yes, but I want to override and alter $Text).

Catching up on the forum, I see a v9.5.2+ way to do this that works around the last and avoids needing to use preview mode. Well perhaps… !

Memory Palace -ma v2-1.tbx (309.3 KB)

1 Like

Awesomeness Mark!
Quick Question:

I know this is a new feature, but how do I save room and delete the extra space.


Better, using the new v9.5.2+ multi-line option for string attributes in Displayed Attributes, we can get rid of the $Text focus/edit lock issue (and the red message placards). Otherwise behaviour is as before. User attributes now have a text description in the Inspector.

Revised TBX: Memory Palace -ma v2-2.tbx (285.4 KB)

When the “Prompt Test” note’s $UpdatePrompt is clicked a new prompt is selected with its prompt text in the $TextSpace area in Displayed Attributes. Also shown in column view, currently one note has been 3 times the other two only once:

If $Flip is clicked, we the the answer in $TestSpace:

Finally, when all available prompts have been shown the $MaxShowCount number of times (here: 3 times), we get a sign we’re starting a new test cycle, and the shown counts of individual prompts are re-set to zero:

Phew, this took much longer than imagined. In fairness I’m trying to use Displayed Attributes as a control UI, which is not its intended purpose. So, it works. With hindsight, I don’t think this was the best implementation approach. But nothing ventured, nothing gained.

The code is all annotated in the Edict that runs the whole process.