home / skills / plurigrid / asi / cider-embedding

cider-embedding skill

This skill helps navigate Clojure code by generating semantic embeddings for code search, completion, and cross-reference via CIDER.

npx playbooks add skill plurigrid/asi --skill cider-embedding

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

Files (1)
SKILL.md
1.5 KB
---
name: cider-embedding
description: Semantic embeddings for Clojure code navigation via CIDER
version: 1.0.0
---


# Cider Embedding Skill

**Status**: Stub
**Trit**: 0 (ERGODIC - embedding space navigation)

## Overview

Semantic embeddings for Clojure code navigation via CIDER.

## Features

- Code similarity search via embeddings
- Semantic code completion
- Cross-reference navigation

## Integration

Extends `cider-clojure` with vector space operations.



## 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: 3. Variations on an Arithmetic Theme

**Concepts**: generic arithmetic, coercion, symbolic, numeric

### GF(3) Balanced Triad

```
cider-embedding (−) + SDF.Ch3 (○) + [balancer] (+) = 0
```

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


### Connection Pattern

Generic arithmetic crosses type boundaries. This skill handles heterogeneous data.
## 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 provides semantic embeddings for Clojure code navigation integrated with CIDER. It turns code artifacts into vector representations to enable similarity search, semantic completion, and cross-reference discovery. The focus is on improving developer navigation and retrieval inside Clojure projects using vector-space operations.

How this skill works

The skill extracts code snippets, forms, and metadata from active CIDER sessions and encodes them into fixed-size embeddings using a configurable embedding model. It stores vectors in an index that supports nearest-neighbor search and exposes operations for similarity queries, clustering, and cross-reference traversal. Commands map search results back to locations in source files so editors can jump to relevant forms or suggest semantically coherent completions.

When to use it

  • When you want semantic search across a Clojure codebase rather than text-only grep.
  • To suggest context-aware completions based on similar code patterns.
  • When navigating large or unfamiliar projects to find relevant implementations and usages.
  • To cluster or visualize related forms and namespaces for architecture exploration.
  • When integrating with automated refactoring or code review tools that need semantic similarity.

Best practices

  • Index AST-level units (forms and defs) rather than raw file chunks for more precise matches.
  • Keep embeddings updated incrementally from the active CIDER session to reflect edits.
  • Tune embedding model and vector index parameters (dimensionality, distance metric, top-k) for your repo size.
  • Store lightweight metadata (namespace, line range, docstring) with each vector for fast context display.
  • Combine lexical filters (namespace, file) with vector search to reduce false positives.

Example use cases

  • Find alternative implementations of a protocol method by searching for semantically similar defn forms.
  • Jump from a test assertion to the most relevant production code using embedding nearest neighbors.
  • Suggest autocomplete snippets based on similar idioms used elsewhere in the codebase.
  • Cluster functions by behavior to identify duplication or refactor candidates.
  • Create a cross-reference map that surfaces callers, callees, and conceptually related forms.

FAQ

Which units of code should I embed?

Prefer embedding individual forms (defs, defn, let blocks) and public API surfaces; this balances granularity and semantic coherence.

How do I keep the index in sync with edits?

Use incremental updates from CIDER events: on-save or on-eval hooks can re-encode changed forms and update the vector store.

Can I restrict searches to a namespace?

Yes. Attach namespace metadata to vectors and apply lightweight namespace or file filters before running vector nearest-neighbor queries.