What's a bag? And what's a TiddlyWebAdaptor?

I wanted to find out what a ‘bag’ was (in trying to figure out ways to organise posts), and search lead me to this tiddler

https://tiddlywiki.com/#TiddlerFields

which says:

The TiddlyWebAdaptor uses a few more fields:

|bag|The name of the bag from which a tiddler came|

Which doesn’t tell me a lot about what bags are for, and the TiddlyWebAdaptor tiddler doesn’t exist. Is anyone able to shed any light on these mysteries?

Welcome to the talk.tiddlywiki forum!

The best recent thread here to start with (for orienting to the new developments that make use of “bags” of tiddlers) is this one:

1 Like

Welcome to talk.tiddlywiki @a7ndrew

I don’t think you need to go that way. Perhaps describe the problem you want to solve, to organise posts. Are they or could they be tiddlers?

FYI Revision field, who is using this? Should I use it? · Jermolene/TiddlyWiki5 · Discussion #7719 · GitHub

I’ve made an update to tiddlywiki.com to try to address this gap. You can see the changes on GitHub, and they will be live in a few minutes here:

https://tiddlywiki.com/#Bags%20and%20Recipes:TiddlyWeb%20TiddlyWebAdaptor%20[[Bags%20and%20Recipes]]

I’ve pasted the material about bags and recipes below.


The bags and recipes model is a reference architecture for how tiddlers can be shared between multiple wikis. It was first introduced by TiddlyWeb in 2008.

The principles of bags and recipes can be simply stated:

  1. Tiddlers are stored in named “bags”
  2. Bags have access controls that determines which users can read or write to them
  3. Recipes are named lists of bags, ordered from lowest priority to highest
  4. The tiddlers within a recipe are accumulated in turn from each bag in the recipe in order of increasing priority. Thus, if there are multiple tiddlers with the same title in different bags then the one from the highest priority bag will be used as the recipe tiddler
  5. Wikis are composed by splicing the tiddlers from the corresponding recipe into the standard TW5 HTML template

A very simple example of the recipe/bag model might be for a single user who maintains the following bags:

  • recipes - tiddlers related to cooking recipes
  • work - tiddlers related to work
  • app - common tiddlers for customising TiddlyWiki

Those bags would be used with the following recipes:

  • recipes –> recipes, app - wiki for working with recipes, with common custom components
  • work –> work, app - wiki for working with work, with common custom components
  • app –> app - wiki for maintaining custom components

All of this will work dynamically, so changes to the app bag will instantly ripple into the affected hosted wikis.

A more complex example might be for a teacher working with a group of students:

  • student-{name} bag for each students work
  • teacher-course bag for the coursework, editable by the teacher
  • teacher-tools bag for custom tools used by the teacher

Those bags would be exposed through the following hosted wikis:

  • student-{name} hosted wiki for each students work, including the coursework material
  • teacher-course hosted wiki for the coursework, editable by the teacher
  • teacher hosted wiki for the teacher, bringing together all the bags, giving them an overview of all the students work
3 Likes

Apologies for the extremely untimely response. Thanks for the replies and the wiki update. That makes things clear! I’m still a happy TW Self-hoster.

I found using “recipe” as an example bag, when explaining what bags and recipes are, makes the explanation difficult to follow. Perhaps this could be renamed ‘cookbook’ or something to avoid overloading the word “recipe” in the explanation?

Given the likelihood in this example that multiple students may name their work the same, wouldn’t this result in the teacher wiki missing data from some students?

1 Like

There is a question that I would like to ask. When I start a wiki using TIDGI, which does not contain any includeWikis, I can see that there is a bag field in the tiddler information with a value of default. but when I import an external wiki using includeWikis, regardless of whether it is a pre-existing tiddler or an includeWikis tiddler, there is no bag field anymore, and the new tiddler also has no bag field. Why is this?

1 Like

You have to ask deepwiki, in TidGi there is an IPCSyncAdaptor, similar to tw core plugin’s tiddlyweb-adaptor, I try to keep them behave the same. But maybe it may differ when handling bags, because bags was useless until MWS release, I haven’t put many attention on it.