pijul-sparse-skills

Sparsity-preserving skill versioning via Pijul patches with GF(3) projection gates

16 stars

Best use case

pijul-sparse-skills is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

Sparsity-preserving skill versioning via Pijul patches with GF(3) projection gates

Teams using pijul-sparse-skills should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/pijul-sparse-skills/SKILL.md --create-dirs "https://raw.githubusercontent.com/plurigrid/asi/main/plugins/asi/skills/pijul-sparse-skills/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/pijul-sparse-skills/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How pijul-sparse-skills Compares

Feature / Agentpijul-sparse-skillsStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

Sparsity-preserving skill versioning via Pijul patches with GF(3) projection gates

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

SKILL.md Source

# pijul-sparse-skills

Sparsity-preserving skill versioning where changes are stored as morphisms, not materialized states.

**Trit**: 0 (ERGODIC) - Coordinator role for projection gate decisions

---

## Philosophy

### Default: SPARSE Mode

```
┌─────────────────────────────────────────────────────────┐
│  SPARSE (default)                                       │
│  - Changes stored as patches (morphisms)                │
│  - No materialization unless required                   │
│  - Lazy evaluation of skill state                       │
│  - Minimal storage footprint                            │
└─────────────────────────────────────────────────────────┘
```

### Projection Only When:

| Trigger | Description | GF(3) |
|---------|-------------|-------|
| `--materialize` | Explicit flag | Any |
| `trit == 0` | ERGODIC coordination point | 0 |
| `--archive` | Explicit archive | Any |
| Conflict | Resolution requires full state | Any |

---

## Categorical Foundation

### Patches as Morphisms in Cat(Skills)

```
Ob(C) = { skill states }
Mor(C) = { patches transforming states }

For patches p, q:
  p ⊥ q (independent) ⟹ p;q = q;p (commute)
```

### Sparsity via Lazy Evaluation

```julia
# Sparse representation (default)
struct SparseSkill
    base_hash::UInt64      # Root state reference
    patches::Vector{Patch}  # Morphism chain, not applied
end

# Materialized only on demand
function materialize(s::SparseSkill)
    foldl(apply, s.patches; init=load(s.base_hash))
end
```

---

## GF(3) Projection Gates

### Gate Logic

```julia
function should_project(skill::Skill, flags::Flags)::Bool
    # Explicit materialization requested
    flags.materialize && return true
    
    # ERGODIC trit forces coordination checkpoint
    skill.trit == 0 && return true
    
    # Explicit archive
    flags.archive && return true
    
    # Conflict requires full state
    has_conflicts(skill) && return true
    
    # Otherwise: stay sparse
    return false
end
```

### Trit-Based Behavior

```
trit = -1 (MINUS/Validator):
  → Verify patch integrity without materializing
  → Check commutativity conditions
  → Validate GF(3) conservation
  
trit = 0 (ERGODIC/Coordinator):
  → PROJECT: Create materialized checkpoint
  → Coordinate merge points
  → Synchronize distributed states
  
trit = +1 (PLUS/Generator):
  → Generate new patches
  → Create without materializing target
  → Lazy forward references
```

---

## Workflow Examples

### Record Skill Change (Sparse)

```bash
cd .agents/skills/my-skill

# Edit SKILL.md
echo "new content" >> SKILL.md

# Record as patch (NOT materialized)
pijul record -m "Add GF(3) section"
# Stores: Patch{add_lines: [...], hash: 0x...}
```

### Sync Skills (Sparse Pull)

```bash
# Pull only patch metadata
pijul pull --partial origin

# View pending patches without applying
pijul log --pending

# Apply lazily (on access)
cat SKILL.md  # Materializes only this file
```

### Force Materialization (ERGODIC Gate)

```bash
# Explicit checkpoint
pijul reset --materialize

# Or via trit-aware tool
skill-checkpoint my-skill --trit 0
```

---

## Integration Patterns

### With flox-mcp

```clojure
;; Install pijul via flox MCP
(flox-install "pijul")

;; Record skill change
(shell "pijul" "record" "-m" (str "Update " skill-name))

;; Sparse pull from upstream
(shell "pijul" "pull" "--partial" upstream-url)
```

### With structured-decomp

```julia
# Tree decomposition of skill graph
tree = decompose(skill_graph)

# Each bag gets sparse representation
for bag in tree.bags
    bag.skills = map(to_sparse, bag.skills)
end

# Sheaf gluing respects sparsity
glue!(tree)  # Only materializes at boundaries
```

### With Gay.jl Colors

```julia
using Gay

# Patch hash → color for visual diff
function patch_color(patch::Patch)
    seed = reinterpret(UInt64, patch.hash)
    Gay.color_at(seed, 1)
end

# GF(3) conservation across patch chain
function verify_chain(patches::Vector{Patch})
    trits = [patch.trit for patch in patches]
    sum(trits) % 3 == 0
end
```

---

## Delta-State CRDT Bridge

### Patches as Delta-States

```
Pijul Patch ≅ Delta-CRDT Update

Both:
  - Commutative when independent
  - Compose via join semilattice
  - Support partial replication
```

### Merkle Search Tree Index

```
skills/
├── .pijul/
│   ├── patches/       # Merkle tree of patches
│   ├── sparse-index/  # Hash → patch mapping
│   └── projection-log # When/why materialized
```

---

## Commands

### Check Sparsity Status

```bash
pijul-sparse status
# Output:
#   my-skill: SPARSE (3 pending patches)
#   other-skill: MATERIALIZED (checkpoint 2024-01-07)
```

### Force Projection

```bash
pijul-sparse project my-skill --reason "coordination checkpoint"
```

### Verify Conservation

```bash
pijul-sparse verify-gf3
# Output:
#   Chain: patch_a(-1) + patch_b(0) + patch_c(+1) = 0 ✓
```

---

## References

- [pijul skill](../pijul/SKILL.md) - Core VCS operations
- [flox-mcp skill](../flox-mcp/SKILL.md) - Environment management
- [structured-decomp skill](../structured-decomp/SKILL.md) - Tree decompositions
- Mimram/Di Giusto: Categorical Patch Theory
- Almeida et al: Delta-State CRDTs
- Merkle Search Trees (Auvolat/Taïani)
- Irmin/MRDTs (Tarides)

---

## Triadic Composition

```
pijul-sparse-skills (0) + pijul (-1) + skill-creator (+1) = 0 ✓
     Coordinator          Validator      Generator
```

This skill coordinates the projection decision while `pijul` validates patches and `skill-creator` generates new content.

Related Skills

pijul

16
from plurigrid/asi

Pijul patch-based VCS with categorical patch theory for skill versioning

designing-workflow-skills

16
from plurigrid/asi

Guides the design and structuring of workflow-based Claude Code skills with multi-step phases, decision trees, subagent delegation, and progressive disclosure. Use when creating skills that involve sequential pipelines, routing patterns, safety gates, task tracking, phased execution, or any multi-step workflow. Also applies when reviewing or refactoring existing workflow skills for quality.

zx-calculus

16
from plurigrid/asi

Coecke's ZX-calculus for quantum circuit reasoning via string diagrams with Z-spiders (green) and X-spiders (red)

zulip-cogen

16
from plurigrid/asi

Zulip Cogen Skill 🐸⚡

zls-integration

16
from plurigrid/asi

zls-integration skill

zig

16
from plurigrid/asi

zig skill

zig-syrup-bci

16
from plurigrid/asi

Multimodal BCI pipeline in Zig: DSI-24 EEG, fNIRS mBLL, eye tracking IVT, LSL sync, EDF read/write, GF(3) conservation

zig-programming

16
from plurigrid/asi

zig-programming skill

zeroth-bot

16
from plurigrid/asi

Zeroth Bot - 3D-printed open-source humanoid robot platform for sim-to-real and RL research. Affordable entry point for humanoid robotics.

xlsx

16
from plurigrid/asi

Comprehensive spreadsheet creation, editing, and analysis with support

wycheproof

16
from plurigrid/asi

Google's Wycheproof test vectors for cryptographic implementation testing.

Writing Hookify Rules

16
from plurigrid/asi

This skill should be used when the user asks to "create a hookify rule", "write a hook rule", "configure hookify", "add a hookify rule", or needs guidance on hookify rule syntax and patterns.