Skip to content

🔧 Advanced

Advanced topics for power users and contributors.

Topics

✍️ Writing Adapters

Create custom adapters for new frameworks.

Learn →

🗄️ Vector Backends

Configure and optimize vector databases.

Configure →

☁️ Cloud Embeddings

Use cloud embedding providers.

Setup →

🔗 Agent Integration

Integrate SpecMem with AI agents.

Integrate →

Kiro Powers

SpecMem is available as a Kiro Power for seamless integration with Kiro IDE. Install it from the Powers panel or configure manually.

Architecture Deep Dive

graph TB
    subgraph Input
        A1[Kiro Specs]
        A2[Cursor Config]
        A3[Claude.md]
        A4[Custom]
    end

    subgraph Adapters
        B1[KiroAdapter]
        B2[CursorAdapter]
        B3[ClaudeAdapter]
        B4[CustomAdapter]
    end

    subgraph Core
        C1[SpecIR]
        C2[Memory Bank]
        C3[Impact Graph]
        C4[SpecDiff]
        C5[Validator]
    end

    subgraph Storage
        D1[LanceDB]
        D2[ChromaDB]
        D3[Qdrant]
    end

    subgraph Output
        E1[CLI]
        E2[Python API]
        E3[Web UI]
        E4[Agent Pack]
    end

    A1 --> B1
    A2 --> B2
    A3 --> B3
    A4 --> B4

    B1 --> C1
    B2 --> C1
    B3 --> C1
    B4 --> C1

    C1 --> C2
    C1 --> C3
    C1 --> C4
    C1 --> C5

    C2 --> D1
    C2 --> D2
    C2 --> D3

    C2 --> E1
    C2 --> E2
    C2 --> E3
    C3 --> E4

Performance Tuning

Embedding Batch Size

[embedding]
batch_size = 64  # Increase for faster indexing

Vector Index Settings

[vectordb]
# LanceDB specific
index_type = "IVF_PQ"
num_partitions = 256
num_sub_vectors = 96

Memory Usage

[memory]
# Limit in-memory cache
max_cache_size = 1000
# Enable disk-based storage
use_mmap = true

Extending SpecMem

Custom Validation Rules

from specmem.validator import ValidationRule, register_rule

@register_rule
class MyRule(ValidationRule):
    name = "my_rule"

    def validate(self, spec):
        # Custom validation logic
        pass

Custom Embedding Providers

from specmem.vectordb.embeddings import EmbeddingProvider, register_provider

@register_provider("custom")
class CustomEmbeddings(EmbeddingProvider):
    def embed(self, text: str) -> list[float]:
        # Custom embedding logic
        pass

Hooks and Events

from specmem import on_scan, on_build

@on_scan
def my_scan_hook(result):
    print(f"Scanned {result.count} specs")

@on_build
def my_build_hook(result):
    print(f"Built pack at {result.path}")