DeepClause meets pi: controlling pi with Prolog and vice versa
Substack von Andreas
AbonnierenAnmelden
DeepClause meets pi: controlling pi with Prolog and vice versa
Andreas<br>Aug. 21, 2026
Teilen
So, for a while I’ve been working on my own harness, which was fun and interesting, but ultimately there comes a point where you have to admit defeat and just start using something a bit more serious (ever tried to write your own search engine?).<br>In my case I’ve decided to start using pi as a frontend for DeepClause. The result is the new DeepClause extension for pi.<br>Installation is easy:<br>pi install git:github.com/deepclause/deepclause-pi<br>Before you start using DeepClause from a project, you need to initialize the .pi/deepclause folder using the “/dc” command. Then you’re ready to go!<br>In the following I will now briefly describe the two main use cases for this extension:<br>Creating and running small agentic automations (Run DML from Pi)
Controlling pi using logic programs as executable plans (Run Pi from DML)
If you like deepclause and the deepclause pi extension, please consider starring the projects on github.<br>https://github.com/deepclause/deepclause-pi<br>https://github.com/deepclause/deepclause-sdk
Use Case 1: Running DML inside pi for automating common workflows
DML (DeepClause Meta Language) is a small DSL that can be used to encode agents and agentic workflows as small executable logic programs. For some more background, please take a look at some recent posts, such as this one.<br>DML programs meant to be executed by pi live in .pi/deepclause/skills/ and can be run with a slash command:<br>/dc-run exampleThe extension uses the model currently selected in pi. It does not ask for another API key or try to guess the provider. Model calls, cancellation, input prompts and usage stay connected to the current pi session.<br>A minimal DML file (or “compiled skill”):<br>agent_main(Topic) :-<br>system("You are a concise technical analyst."),<br>format(string(Request),<br>"Explain ~w. Store the final explanation in Summary.",<br>[Topic]),<br>task(Request, string(Summary)),<br>answer(Summary).<br>Run it as follows:<br>/dc-run skills/explain.dml "constraint logic programming"Once you have the extension installed, pi will also know about how to write DML programs via a conjext injection. So you can directly ask it to e.g implement a lot of recurring workflows as DML!
Use Case 2: Executable Plans from Specs
There have been a lot of discussions around “Spec Driven Development”, “Software Factories”, “Loop Engineering” etc. All of these approaches somehow aim at formalizing and automating the software development process.<br>However, what I always felt was a bit weird, is that whatever approach is chosen, the end result is a bunch of markdown plan files combined with the hope that the model/harness combination is smart enough to turn this into working software.<br>And to some extent the models and harnesses are good enough, that is if you pay enough money to Anthropic and OpenAI. However, even SOTA models do sometimes decide to go off the rails and once your agents are running it is often very hard to follow what’s going on. Also, the entire modern agentic development process is hardly reproducible.<br>So, if you’d like a bit more sanity in all of this, why not try turning your markdown specs into actual exectuable plans! Let’s explore how DeepCLause and pi can help with that!
deepclause-pi and /dc-plan + /dc-run
The extension adds this command:<br>/dc-plan [--name=slug]<br>For example:<br>/dc-plan build a small Three.js Space Invaders game and verify it --name=threejs-space-invaders<br>This starts a normal pi turn. The planner will then start to understand the current project environment, read its instructions, see loaded skills and consider the currently active tools. It does not directly return a Markdown checklist and it does not generate arbitrary DML source in one shot.<br>Instead, the planning turn finishes by calling a temporary tool named dc_plan_commit. The tool accepts a typed plan specification with:<br>a title and objective
ordered steps
an executor for each step
exact required tool names
relevant pi skills
an expected result for every step
a fallback message
The extension validates this object and shows a preview. After user confirmation, it deterministically assembles the DML file, parses the generated program and writes it under .pi/deepclause/plans/ without overwriting an existing file.<br>This follows the same general idea as the planner used in my DeepPlanning experiments: ask the model for a constrained intermediate representation and let normal code produce the executable DML. This is generally simpler and more reliable than letting and LLM try to implement a plan (how would we test it anyways without executing the plan and potentially wasting a lot of tokens?).<br>A generated plan looks like this:<br>agent_main :-<br>output("Step 1/3: Inspect the workspace"),<br>exec(pi_agent_step(<br>instruction: "Inspect repository instructions and identify the target...