home / skills / plurigrid / asi / bafishka

bafishka skill

/skills/bafishka

This skill enables Fish shell users to run Clojure-processed file operations with a Steel-backed SCI engine for fast, scriptable workflows.

npx playbooks add skill plurigrid/asi --skill bafishka

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

Files (1)
SKILL.md
4.2 KB
---
name: bafishka
description: 🐟 Rust-native Fish shell-friendly file operations with Steel-backed SCI
version: 1.0.0
---


# Bafishka - Fish Shell + Clojure File Operations

🐟 Rust-native Fish shell-friendly file operations with Steel-backed SCI Clojure evaluation.

## Repository
- **Source**: https://github.com/bmorphism/bafishka
- **Language**: Clojure (SCI) + Rust
- **Seed**: 1069 (deterministic)

## Core Concept

Bafishka bridges Fish shell ergonomics with Clojure's data processing power:

```fish
# Fish shell with Clojure evaluation
baf '(map inc [1 2 3])'  # => [2 3 4]

# File operations with Clojure
baf '(fs/glob "**/*.clj" | count)'  # => 42
```

## Architecture

```
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                    Bafishka                        β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”‚
β”‚  β”‚  Fish    β”‚   β”‚  Steel   β”‚   β”‚  SCI         β”‚   β”‚
β”‚  β”‚  Shell   │──▢│  (Rust)  │──▢│  (Clojure)   β”‚   β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β”‚
β”‚       β”‚              β”‚               β”‚             β”‚
β”‚       β–Ό              β–Ό               β–Ό             β”‚
β”‚   Readline       File I/O        Data Xform       β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
```

## Key Features

### Steel Backend
Steel is a Rust Scheme implementation providing:
- Fast native execution
- Seamless Rust FFI
- Async I/O support

### SCI Clojure
Small Clojure Interpreter for:
- Full Clojure core library
- REPL evaluation
- Babashka compatibility

## Usage Examples

```fish
# List files with Clojure processing
baf '(->> (fs/list-dir ".")
         (filter #(str/ends-with? % ".md"))
         (map fs/file-name))'

# JSON processing
baf '(-> (slurp "data.json")
         json/parse-string
         :items
         count)'

# With deterministic seed (1069)
baf '(gay/color 1069)'  # Deterministic color
```

## Integration with plurigrid/asi

### With gay-mcp
```clojure
;; File operations with color coding
(defn colored-ls [dir]
  (->> (fs/list-dir dir)
       (map (fn [f] 
              {:file f 
               :color (gay/color (hash f))}))))
```

### With duckdb-ies
```clojure
;; Query DuckDB from bafishka
(baf '(duck/query "SELECT * FROM files WHERE mtime > now() - interval 1 hour"))
```

## Configuration

```fish
# ~/.config/fish/conf.d/bafishka.fish
set -gx BAF_SEED 1069
set -gx BAF_HISTORY ~/.baf_history
alias baf 'bafishka eval'
```

## Related Skills
- `gay-mcp` - Deterministic colors
- `duckdb-ies` - Database integration
- `polyglot-spi` - Multi-language SPI
- `abductive-repl` - REPL patterns



## Scientific Skill Interleaving

This skill connects to the K-Dense-AI/claude-scientific-skills ecosystem:

### Graph Theory
- **networkx** [β—‹] via bicomodule
  - Universal graph hub

### Bibliography References

- `general`: 734 citations in bib.duckdb



## SDF Interleaving

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

### Primary Chapter: 5. Evaluation

**Concepts**: eval, apply, interpreter, environment

### GF(3) Balanced Triad

```
bafishka (βˆ’) + SDF.Ch5 (βˆ’) + [balancer] (βˆ’) = 0
```

**Skill Trit**: -1 (MINUS - verification)

### Secondary Chapters

- Ch4: Pattern Matching
- Ch2: Domain-Specific Languages

### Connection Pattern

Evaluation interprets expressions. This skill processes or generates evaluable forms.
## Cat# Integration

This skill maps to **Cat# = Comod(P)** as a bicomodule in the equipment structure:

```
Trit: 0 (ERGODIC)
Home: Prof
Poly Op: βŠ—
Kan Role: Adj
Color: #26D826
```

### GF(3) Naturality

The skill participates in triads satisfying:
```
(-1) + (0) + (+1) ≑ 0 (mod 3)
```

This ensures compositional coherence in the Cat# equipment structure.

Overview

This skill brings Fish shell ergonomics together with Rust-native file operations and an embedded Clojure evaluator. It exposes fast, scriptable file and data transformations from the Fish prompt using a Steel-backed SCI runtime. The design targets reliable, deterministic tooling for CLI data workflows.

How this skill works

It embeds a Rust runtime (Steel) to handle fast I/O and FFI, and runs Clojure expressions via SCI for data transformation and evaluation. From Fish you call a single entrypoint to evaluate Clojure forms that can inspect the filesystem, parse JSON, query DuckDB, or produce deterministic outputs using a seeded RNG. Results are returned to the shell in simple, usable formats.

When to use it

  • Ad-hoc file discovery and transformation from the Fish shell
  • Compact Clojure-based data processing without launching a JVM
  • Deterministic generation or colorization tasks with a fixed seed
  • Piping filesystem metadata into SQL queries or DuckDB from the CLI
  • Embedding small evaluable snippets in shell scripts for automation

Best practices

  • Keep expressions focused and statelessβ€”use pure transforms for reproducibility
  • Use the provided deterministic seed for tasks requiring repeatability
  • Prefer built-in fs and json helpers for robust parsing and I/O
  • Limit long-running or blocking work to background tasks; Steel supports async I/O but keep shell responsiveness
  • Sanitize inputs before evaluating untrusted expressions to avoid executing harmful forms

Example use cases

  • List markdown files and extract file names with a single expression from Fish
  • Parse and count items in a local JSON file and emit just the count
  • Colorize directory listings deterministically for consistent UI across machines
  • Run a quick DuckDB query on a files table produced from the filesystem stream
  • Compose pipeline: glob files β†’ filter by extension β†’ map to metadata β†’ import into a database

FAQ

Do I need Java or a JVM to run this?

No. The runtime uses Steel (Rust) and SCI for Clojure evaluation, so a JVM is not required.

Can I call external Rust or native libraries?

Yesβ€”Steel provides native FFI hooks. Use the runtime's safe bindings to interact with native code.