home / skills / plurigrid / asi / org-babel-execution

org-babel-execution skill

/skills/org-babel-execution

This skill enables literate programming across org-babel for polyglot execution, coordinating Julia, Python, and Clojure within narrative Org files.

npx playbooks add skill plurigrid/asi --skill org-babel-execution

Review the files below or copy the command above to add this skill to your agents.

Files (11)
SKILL.md
1.5 KB
---
name: org-babel-execution
description: Literate programming execution engine via org-babel for polyglot skill execution
version: 1.0.0
trit: 0
---

# Org-Babel Execution Engine

> **Transform asi from knowledge graph to execution engine via literate programming**

**Trit**: 0 (COORDINATOR - orchestrates execution across languages)

## Overview

Enables literate programming across Julia, Python, Clojure via org-babel.

## Core Concept

Embed executable code in narrative .org files:
- Execute in-place (C-c C-c)
- Tangle to extract source files (C-c C-v t)
- Pass data between languages
- Generate documentation with results

## Template

```org
#+TITLE: Skill Name
#+PROPERTY: header-args:julia :tangle Skill.jl

* Implementation
#+BEGIN_SRC julia
function skill_operation(input)
    # code here
end
#+END_SRC

* Tests
#+BEGIN_SRC julia :results output
@test skill_operation(42) == expected
#+END_SRC
```

## Related Skills

- `org` (0) - Org-mode syntax
- `emacs` (0) - Editor integration
- `julia-scientific` (+1) - Julia execution
- `python-development` (+1) - Python execution

## SDF Interleaving

This skill connects to **Software Design for Flexibility** (Hanson & Sussman, 2021):

### Primary Chapter: 2. Domain-Specific Languages

**Concepts**: DSL, wrapper, pattern-directed, embedding

### GF(3) Balanced Triad

```
org-babel-execution (+) + SDF.Ch2 (−) + [balancer] (○) = 0
```

**Skill Trit**: 1 (PLUS - generation)


### Connection Pattern

DSLs embed domain knowledge. This skill defines domain-specific operations.

Overview

This skill is a literate-programming execution engine built on org-babel that orchestrates polyglot code inside Org-mode documents. It enables embedding, executing, and tangling code blocks in languages like Julia, Python, and Clojure so documentation and runnable source stay in sync. The skill focuses on reproducible development, cross-language data exchange, and automated test/document generation.

How this skill works

You write code blocks inside .org files with language headers and execution directives. The engine executes blocks in place (C-c C-c), tangles source files (C-c C-v t), and propagates results back into the document for documentation and tests. It coordinates language kernels and marshalling so data can be passed between languages and test outputs included in generated docs.

When to use it

  • Developing polyglot skills or components that require combined Julia, Python, and Clojure logic.
  • Keeping implementation, tests, and documentation synchronized in a single authoring artifact.
  • Generating runnable source files from narrative documents for reproducible builds.
  • Running integration tests that span multiple languages and need shared data.
  • Teaching or prototyping algorithms where code and explanatory text should evolve together.

Best practices

  • Prefer explicit header-args for tangle and results to ensure predictable outputs.
  • Keep small, focused code blocks and use named results to pass data across languages.
  • Include tests in the same .org file so CI can execute and capture results automatically.
  • Use version-controlled tangle targets to avoid accidental overwrites of hand-edited files.
  • Document expected data formats when transferring between language runtimes.

Example use cases

  • Author a scientific workflow where data ingestion is Python, processing is Julia, and orchestration is Clojure.
  • Write an interactive tutorial that executes examples and embeds results directly into the lesson.
  • Tangle an org document into multiple language-specific source files for deployment.
  • Coordinate cross-language integration tests and include their outputs in generated documentation.
  • Rapidly prototype algorithms in one file and export production-ready code via tangling.

FAQ

How are variables shared between languages?

Use named results and explicit serialization formats (JSON, CSV) in code blocks; org-babel will capture outputs which other blocks can read and parse in their respective languages.

Can I run tests automatically in CI?

Yes. Include executable test blocks in the .org file and configure CI to run org-babel execution and verify the captured results or tangle the files and run language-specific test runners.