---
name: pijul
description: Pijul distributed VCS for versioning skills - this skill versions itself
version: 1.0.0
trit: 0
---

# pijul

Patch-based distributed version control for Agent Skills. This skill is self-versioning: use pijul to track changes to this very SKILL.md.

## Self-Reference

```
skills/pijul/SKILL.md  ←──┐
        │                 │
        └── versioned by ─┘
              pijul
```

## Why Pijul for Skills?

| Property | Git | Pijul | Skill Benefit |
|----------|-----|-------|---------------|
| Merge model | 3-way | Patch theory | Skills commute naturally |
| Identity | Commit hash | Patch hash | Same patch = same meaning everywhere |
| Rebase | Rewrites history | Unnecessary | Clean skill evolution |
| Conflicts | Per-merge | Per-patch | Detect skill incompatibility early |

## Quick Reference

```bash
# Initialize (already done for duck repo)
pijul init

# Record a change to this skill
pijul add skills/pijul/SKILL.md
pijul record -m "skill: pijul self-improvement"

# View patch log
pijul log

# Create a channel (like a branch, but patches commute across)
pijul channel new experimental-skill

# Apply patches from another channel
pijul apply <patch-hash>

# Push to nest (pijul's hub)
pijul push <remote>

# Pull patches
pijul pull <remote>
```

## Skill Versioning Workflow

### 1. Initialize skill repo
```bash
cd my-skills/
pijul init
pijul add skills/*/SKILL.md
pijul record -m "initial skill set"
```

### 2. Evolve a skill
```bash
# Edit skill
$EDITOR skills/pijul/SKILL.md

# Record the patch
pijul record -m "pijul: add channel examples"

# Patch hash becomes the skill version
pijul log --limit 1
```

### 3. Fork skill exploration
```bash
# Create experimental channel
pijul channel new pijul-v2

# Make changes
pijul record -m "pijul: experimental feature"

# Switch back
pijul channel switch main

# Cherry-pick if it works (patches commute!)
pijul apply <patch-hash>
```

### 4. Distribute skills
```bash
# Push to nest.pijul.com
pijul push nest.pijul.com:username/skills

# Others can pull specific skill patches
pijul pull nest.pijul.com:username/skills --patch <hash>
```

## GF(3) Trit Assignment

This skill is **trit 0** (ERGODIC):
- Versioning is coordination infrastructure
- Neither purely generative (+1) nor purely validating (-1)
- Enables skill flow between agents

## Channels as Skill Variants

```
main ─────●─────●─────●─────●
          │           │
          │  apply    │ apply
          ▼           ▼
experimental ───●─────●───────
                │
                ▼
          agent-specific ───●
```

Patches flow freely between channels because they commute.

## Flox Integration

```bash
# Ensure pijul available
flox install pijul

# Or activate environment with pijul
flox activate -- pijul log
```

## Self-Versioning Record

Track this skill's own evolution:

```bash
# After editing this file
cd /path/to/duck
flox activate -- pijul record -m "pijul skill: <description>"

# View this skill's history
flox activate -- pijul log skills/pijul/SKILL.md
```

## Patch Theory Essence

Pijul's patches satisfy:
- **Commutation**: Independent patches apply in any order
- **Idempotence**: Applying same patch twice = applying once  
- **Identity**: Patch hash is content-addressed

This mirrors GF(3) skill properties:
- Skills can interleave (commutation)
- Loading same skill twice is safe (idempotence)
- Skill identity from content, not path (addressing)

## Resources

- [pijul.org]https://pijul.org - Official docs
- [nest.pijul.com]https://nest.pijul.com - Patch hosting
- `man pijul` - Local reference (via flox)