Fork me on GitHub

I've used Clara rules a bit but am planning on doing something more complicated with it and had a question. It seems like when you start working on defining your rules you have to decide on a sort of scope for your session. I was curious if sessions have any way of composing? Let's say I decide I want to handle some subset of rules in its own session and then apply that to many of some type in a parent session. Is that possible?


I don't think that Clara has anything like that. I would assume that one could fire the sub session, then extract data via queries to populate facts within the parent session. Though I would think that simply having a single session would be less complex


Is there any general wisdom about what a session should operate on? Like let's say I had some domain for accounts, should my session be for a single account vs all accounts, which I imagine could get confusing because you're dealing with many things vs one?


In general, It would come down to the scope of what you are reasoning about. If all of the questions you are trying to answer, if all of them are bounded by a single account, then it would probably make sense to operate on a single rather than multi.


It would likely reduce the complexity of the rules, as they could implicitly assume that the facts pertain to a single accout


I think in my case it's most likely the scope will be both the single and the many, at least for some parts. Which is why I was worried starting at one level would require lots of rework later to adjust the scope.


Going from multi to single, in theory, should be passive. Though single to multi would require rework as the implicit assumptions based on a single account would be broken


Right, without the ability to compose sessions, starting at many is probably the way to go to avoid rework.

👍 9

Thanks for discussing!


Glad to lend an ear, and hear about people using Clara


Yeah, I agree with Ethan overall


If your cases now were single account - you could go about it that way and expose queries to data from that session later that you could use for “multi account reasoning”


but it really depends on the case which would be more efficient or make more sense.


@mikerod I’ll give that a shot too. I think the way I’ll be analyzing the data it could work, IE multiple passes through different sessions.