Skip to main content

Agent Skill Management System with self-growth capabilities

Project description

Skill Manager

PyPI

Agent Skill Management System with self-growth capabilities.

Published on PyPI: https://pypi.org/project/skillvault/

Features

  • Skill Storage: SQLite + sqlite-vec for local storage with vector search
  • Semantic Query: ANN retrieval + dependency expansion + token budget cropping
  • Self-Growth: Automatically extract knowledge from conversations and tasks
  • Human-in-the-Loop: Review queue for approving/rejecting draft skills
  • Permission Separation: Agent code can only write drafts, humans control canonical
  • CLI Tool: Command-line interface for skill management (optional)

Installation

# Core (SQLite storage + vector search)
pip install skillvault

# With OpenAI embedding support
pip install skillvault[openai]

# With CLI tool
pip install skillvault[cli]

# Everything
pip install skillvault[openai,cli]

Quick Start

import json
from openai import OpenAI
from skillvault import SkillManager
from skillvault.models import Skill, Chunk

client = OpenAI()

# embed_fn: text -> list[float] (1536 dimensions for text-embedding-3-small)
def embed(text: str) -> list[float]:
    resp = client.embeddings.create(model="text-embedding-3-small", input=[text])
    return resp.data[0].embedding

sm = SkillManager("skills.db", embed_fn=embed)

# Register a skill
skill = Skill(
    id="frontend-react",
    name="Frontend React",
    chunks=[
        Chunk(
            id="frontend-react::hooks",
            skill_id="frontend-react",
            section="React Hooks",
            content="## useEffect\n\nUse useEffect for side effects...",
            tokens=50,
        )
    ]
)
sm.register(skill)

# Query skills
context = sm.query("React hooks best practices", budget=2000)
print(context)

Self-Growth (Extract knowledge from conversations)

import json
from openai import OpenAI
from skillvault import SkillManager

client = OpenAI()

def embed(text: str) -> list[float]:
    resp = client.embeddings.create(model="text-embedding-3-small", input=[text])
    return resp.data[0].embedding

# llm_fn: text -> dict (analyze context for reusable knowledge)
def extract_knowledge(text: str) -> dict:
    resp = client.chat.completions.create(
        model="gpt-4o",
        messages=[{"role": "user", "content": f"""Analyze this conversation and extract reusable knowledge.

{text}

Return JSON:
{{
    "has_knowledge": true/false,
    "title": "short title",
    "playbook": "step-by-step instructions in markdown",
    "examples": "code examples in markdown",
    "when_to_use": "specific scenarios",
    "dependencies": ["related-skill-id"]
}}"""}],
        response_format={"type": "json_object"},
    )
    return json.loads(resp.choices[0].message.content)

sm = SkillManager("skills.db", embed_fn=embed, llm_fn=extract_knowledge)

# Extract from conversation (returns draft_id or None)
draft_id = sm.extract([
    {"role": "user", "content": "How do I handle errors in async Python?"},
    {"role": "assistant", "content": "Use try/except with asyncio.gather..."},
])

# Review and approve
if draft_id:
    pending = sm.review_queue()
    sm.approve(draft_id)

Agent Mode (Restricted permissions)

from skillvault import SkillManager

# Same embed_fn as above
sm = SkillManager("skills.db", embed_fn=embed, mode="agent")

sm.query("...")           # OK - reads canonical skills only
sm.extract(messages)      # OK - creates drafts
sm.register(skill)        # raises PermissionError
sm.approve(draft_id)      # raises PermissionError

CLI Usage

Requires pip install skillvault[cli].

# List skills
python -m skillvault.cli list

# Review queue
python -m skillvault.cli review-queue

# Approve/reject
python -m skillvault.cli approve draft::skill-id
python -m skillvault.cli reject draft::skill-id --reason "Not useful"

# Export/Import
python -m skillvault.cli export frontend-react react.json
python -m skillvault.cli import react.json

# Statistics
python -m skillvault.cli stats

Architecture

SkillManager (one class)
    │
    ├── query(text, budget)        → Search + assemble context
    ├── register(skill)            → Save canonical skill
    ├── extract(context)           → LLM extraction → draft
    ├── approve/reject(skill_id)   → Review workflow
    └── export/import              → JSON serialization
    │
    ├── storage.py    (SQLite + sqlite-vec)
    ├── query.py      (embed + ANN + budget)
    └── growth.py     (LLM analysis + auto-promote)

Development

# Install in dev mode
pip install -e ".[dev,openai,cli]"

# Run tests
pytest

# Format & lint
black src/ tests/
ruff check src/ tests/

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

skillvault-0.1.2.tar.gz (34.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

skillvault-0.1.2-py3-none-any.whl (17.7 kB view details)

Uploaded Python 3

File details

Details for the file skillvault-0.1.2.tar.gz.

File metadata

  • Download URL: skillvault-0.1.2.tar.gz
  • Upload date:
  • Size: 34.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for skillvault-0.1.2.tar.gz
Algorithm Hash digest
SHA256 07e159f04bc0698bea83c725eabdb52261b5d07053f9669f245c46b0b39870e1
MD5 513ef8200a32b22201a68cac8d09bfd9
BLAKE2b-256 74e921972c2cbbd1033ae42cb27c4a31b5bbf2c08f46c1e5e123ac7e0b1bdd95

See more details on using hashes here.

File details

Details for the file skillvault-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: skillvault-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 17.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for skillvault-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 50eba7e1791b7ebe02486cf08c62c76ada986425ae058b33993c95a70758f22d
MD5 9eeace6823c2d8a82971efef6fe2c4cf
BLAKE2b-256 3dfcee39689fc3f252d802484a641e3fd504ba91000524c103f643ae37938b52

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page