-->

Org Contingent Plan Editor

The Problem

I am wanting to find-or-create a contingent plan / game tree editor for Org-mode. I asked Claude and it recommended: org-brain and org-depend. I would also like to be able to visualize and possible even edit the tree in some kind of graphical perhaps third party program.

I tried writing my own such system a while back, but failed miserably, since I wasn't yet using org-mode at the time: https://github.com/aindilis/critic3

Ideally it would eventually accomodate temporally contingent plans, like in this paper: https://openreview.net/pdf?id=JJYg8KKLJtL (e.g. top left of p.g.s 7, 8 etc)

If anyone with more experience with org-mode would be interested in collaborating on an org-contingent-plan-editor codebase, that'd be great. It would ideally become part of the Emacs org package infrastructure and the Free Life Planner:

https://github.com/aindilis/free-life-planner/blob/master/README.md

I do a lot of stuff with AI planning, such as:

https://frdcsa.org/~andrewdo/iem2-3.mp4

... and for instance, I've heard that the TraCE program will likely receive a pared down open release at some point.

org-contingent-plan-editor could be a useful tool for people trying to resolve thorny life planning issues, like trying to find the best housing relocation option for a complicated time-sensitive move (in my current use case), or figuring out what to say in a particular dialog, etc.

It can also help work with newer autonomous AI agents (AAAs) like SuperAGI or MetaGPT. I integrated AgentSpeak(L) as a DSL for controlling AAAs, as talked about here:

https://youtube.com/watch?v=8vsQzTD3Qfk

Only, I have since moved away from using that approach to using a different custom approach based on what I call SPAMI (SWI-Prolog AgentSpeak(L) Meta-Intepreter). Here is an example Breadth-First Search based naive contingency planner that uses Large Language Models to generate contingency plans to situations expressed in either English or Prolog.

https://github.com/aindilis/autonomous-ai-agent/blob/main/agents/wopr.pasl

This is the basic algorithm:

✅ Newer Prolog-based WOPR
  ✅ Using NL for KRR and generating contingency plans via BFS (Knowledge Representation and Reasoning, Breadth First Search)
    ✅ Exports current fluents from WSM (World State Monitor) as world state, push onto queue
    ✅ Prompts Mistral Instruct 7B to generate:
      ✅ Shift queue to obtain world state
      ✅ Threats for the initial world state
      ✅ Potential contingency plans for those threats
      ✅ Effects of the contingency plans
      ✅ New world state by applying the effects to the parent world state

      ✅ Push new world state onto queue,and repeat above steps

For detailed information about the Free Life Planner in the reference manual, see here:

https://github.com/aindilis/flp/blob/main/ReferenceManual.md

And here is an earlier talk on FLP for EmacsConf 2019:

https://frdcsa.org/~andrewdo/frdcsa-emacsconf2019-final.webm

Here is a motivating fictional semi-biographical use case story:

https://frdcsa.org/~andrewdo/writings/homeless-story.html

Here is the chat with Claude.ai

AD:

Hi Claude, is there some code for Emacs Org-mode that allows one to edit large graphs or trees in Org-mode?

CLAUDE:

Yes, there are a few packages that allow you to create and edit graphs and trees in Emacs Org-mode. Here are a couple notable ones:

org-roam - This is a popular knowledge management package for Org-mode inspired by the Roam Research app. It allows you to create a graph of interconnected notes. You can easily visualize and navigate the graph of your notes.

org-brain - Another knowledge management package that lets you visualize your Org-mode files and headlines as a graph or concept map. It focuses on creating non-hierarchical relationships between nodes.

org-mind-map - This package generates mind-maps from org-mode files. It can export the mind map to several formats like PNG, JPEG, PDF, and more.

org-depend - Allows you to specify dependencies between Org-mode headings and visualize them as a graph. Useful for project planning.

org-graph-view - Provides a graphical view of the relationships between Org-mode headings based on the links between them.

To use any of these, you'll first need to install the package, usually from MELPA or a similar package archive. Then load it in your Emacs config. Each package has its own syntax and commands for creating and manipulating the graph/tree structures.

For example, with org-roam, you create relationships between notes using special link syntax like description. Then you can use a command like org-roam-graph to view the graph of connected notes.

These packages give you powerful tools to visualize and manage complex information structures right within Org-mode. Let me know if you have any other questions!

AD:

I am wanting to make an editor for game trees, and contingent planning problems. I was wondering, which Org-mode graph editor would work best.

CLAUDE:

For your use case of creating an editor for game trees and contingent planning problems, I would recommend using org-brain or org-depend.

org-brain is designed to create non-hierarchical relationships between nodes, which is often the case in game trees and contingent planning where different states or nodes can have complex relationships. It allows you to easily create links between headlines and visualize them as a graph. You can also attach additional metadata to each node. The visualization can help in understanding and analyzing the structure of the game tree or planning problem.

org-depend is more focused on defining dependencies between nodes, which can be useful for modeling the relationships in a game tree or contingent planning problem. You can specify that certain nodes depend on others, and org-depend will create a graph visualization of these dependencies. It also supports attaching additional data to each node.

Both of these packages allow you to leverage the power of Org-mode for organizing and outlining your data, while providing graph visualization and manipulation capabilities on top of that.

To get started, you can define your game states or planning steps as Org-mode headlines, and then use the package's syntax to define the relationships between them. For example, in org-brain you can create a link like this:

* State A

	[ [brain:State B][Transition to State B] ]

Then, you can use the package's commands to visualize and manipulate the graph.

The choice between org-brain and org-depend depends on the exact nature of your game trees and planning problems, and which type of visualization and manipulation you find more intuitive. I recommend experimenting with both to see which one fits your workflow better.

Let me know if you have any more specific questions as you're setting this up!