Distill scattered evidence into structured knowledge documents
Project description
pydstl
A Python library that turns scattered knowledge — code reviews, docs, notes — into structured skill documents using vector search and LLM distillation.
Why
Teams accumulate knowledge in scattered places — PR comments, incident notes, design docs, Slack threads. Most of it never gets consolidated into something reusable. pydstl automates the distillation: collect evidence from any source, run it through an LLM, and produce a clean markdown skill file that can be fed to AI coding assistants, onboarding docs, or team wikis.
Install
uv add pydstl
Quick Start
from pydstl import Dstl
dstllr = Dstl(db_path="knowledge.db", model="google-gla:gemini-3-flash-preview")
# Collect evidence from anywhere
dstllr.add_evidence(
"Always wrap network calls in try/except to handle timeouts gracefully",
source={"author": "alice", "origin": "pr-review", "repo": "acme/api"}
)
dstllr.add_evidence(
"Use structured logging (not print) in production — it makes debugging 10x easier",
source={"author": "bob", "origin": "incident-retro", "date": "2024-09-15"}
)
dstllr.add_evidence(
"Prefer composition over inheritance for service classes",
source={"author": "carol", "origin": "design-doc"}
)
# Distill into a skill document
path = dstllr.distill(topic="python best practices", output_dir="skills")
# -> skills/python-best-practices.md
dstllr.close()
API
Single class, minimal surface:
dstllr = Dstl(db_path="my.db", model="google-gla:gemini-3-flash-preview")
| Method | What it does |
|---|---|
add_evidence(content, source?) |
Store text + metadata, embed and index for search |
retrieve(query, top_k=5) |
Vector similarity search across all evidence |
list_evidence(source_filter?) |
List/filter evidence by source metadata fields |
distill(topic?, skill_id?, output_dir?, evidence?) |
Synthesize evidence into a markdown skill doc via LLM |
consolidate(documents, topic?, skill_id?, output_dir?) |
Merge multiple skill docs into one |
edit_skill(skill_id, instruction?, content?, output_dir?) |
LLM-assisted or manual edit of an existing skill |
report_outcome(skill_id, success, notes?) |
Link feedback to a skill for future reference |
Model-agnostic — uses pydantic-ai under the hood. Pass any supported model string:
Dstl(db_path="my.db", model="google-gla:gemini-3-flash-preview") # Gemini
Dstl(db_path="my.db", model="openai:gpt-4o") # OpenAI
Dstl(db_path="my.db", model="anthropic:claude-sonnet-4-20250514") # Anthropic
Set the corresponding provider env var (GEMINI_API_KEY, OPENAI_API_KEY, ANTHROPIC_API_KEY).
Storage — SQLite + sqlite-vec for vector search. No external database needed.
Embeddings — local sentence-transformers (all-MiniLM-L6-v2). No API calls for embeddings.
Development
uv sync --all-extras
uv run pytest tests/ -v
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pydstl-0.1.0.tar.gz.
File metadata
- Download URL: pydstl-0.1.0.tar.gz
- Upload date:
- Size: 177.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.10.7 {"installer":{"name":"uv","version":"0.10.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4981be2fb3581587c46d3241e8bf3704a4bd6af0fd4f0fa42fa45479009934b5
|
|
| MD5 |
82df3617f7a8b05b69ff1660d17e1ba7
|
|
| BLAKE2b-256 |
fa1b0364b6e788516381c9f7b54c247f795c843da0b6c741fe1af7dff133c4bc
|
File details
Details for the file pydstl-0.1.0-py3-none-any.whl.
File metadata
- Download URL: pydstl-0.1.0-py3-none-any.whl
- Upload date:
- Size: 9.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.10.7 {"installer":{"name":"uv","version":"0.10.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2889a0889ef685480cee73d06f82d6a7d527c45920ef7a233b28ebf36f7af8bf
|
|
| MD5 |
f22e325fa67660e82ebcba3b71f064de
|
|
| BLAKE2b-256 |
2653b0b8031761370eab978e0a7739a83fd2815429cb4a0ff0cdc004f287ace9
|