Metadata-Version: 2.4
Name: dynamic-skill-compiler
Version: 0.1.0
Summary: Task-driven compiler for agent skill libraries.
Author: ZJUNLP
License-Expression: MIT
Project-URL: Homepage, https://github.com/taomiao/DynamicSkillCompiler
Project-URL: Repository, https://github.com/taomiao/DynamicSkillCompiler
Project-URL: Issues, https://github.com/taomiao/DynamicSkillCompiler/issues
Keywords: agent,skills,compiler,retrieval,planning
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Science/Research
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Provides-Extra: semantic
Requires-Dist: numpy>=1.24; extra == "semantic"
Requires-Dist: openai>=1.109.1; extra == "semantic"
Provides-Extra: dev
Requires-Dist: build>=1.2.1; extra == "dev"
Requires-Dist: twine>=5.1.1; extra == "dev"
Provides-Extra: all
Requires-Dist: numpy>=1.24; extra == "all"
Requires-Dist: openai>=1.109.1; extra == "all"
Dynamic: license-file

# Dynamic Skill Compiler

Dynamic Skill Compiler (DSC) is a task-driven compiler for agent skills. It takes a natural-language task, retrieves candidate skills from a local skill library, builds a skill graph, and emits a compact, dependency-aware skill package for execution.

## What DSC Does

- Decomposes a task into subgoals and required capabilities.
- Retrieves local skill assets and their declared relationships.
- Extracts relevant skill fragments instead of passing whole skill files.
- Builds a graph over `similar_to`, `belong_to`, `compose_with`, and `depend_on` relationships.
- Runs compiler passes to select, repair, augment, and prune the skill set.
- Produces a `CompiledSkillPackage` with selected skills, execution order, coverage metrics, and pass traces.

## Repository Layout

```text
src/dynamic_skill_compiler/   Core DSC compiler package
tests/                        Compiler and experiment integration tests
experiments/                  Benchmark runners and local skill libraries
reports/                      DSC design notes
```

The benchmark runners under `experiments/` are kept as evaluation harnesses for ScienceWorld, ALFWorld, and WebShop. They are intentionally separate from the core compiler package.

## Quick Start

Install from a local checkout:

```bash
python -m pip install -e .
```

After the package is published to PyPI, users can install it with:

```bash
python -m pip install dynamic-skill-compiler
```

Semantic embedding support is optional:

```bash
python -m pip install "dynamic-skill-compiler[semantic]"
```

```python
from dynamic_skill_compiler import (
    CompilerConfig,
    DynamicSkillCompiler,
    LocalEnvironment,
    LocalSkillLibraryRetriever,
)

retriever = LocalSkillLibraryRetriever("experiments/src/skills/scienceworld")
compiler = DynamicSkillCompiler(
    retriever=retriever,
    config=CompilerConfig(),
)

compiled = compiler.compile(
    "Your task is to measure the temperature of an unknown substance.",
    environment=LocalEnvironment(benchmark="scienceworld"),
)

print([skill.asset.name for skill in compiled.compiled_skills])
print(compiled.execution_order)
print(compiled.metrics.coverage_score)
```

## CLI

The package installs a `dsc` command for quick local compilation:

```bash
dsc "Measure the temperature of the unknown object." \
  --skills-dir experiments/src/skills/scienceworld \
  --pretty
```

The command prints a JSON summary containing selected skills, execution order,
coverage metrics, compiler pass traces, and dropped-skill reasons.

## Build And Publish

Build source and wheel distributions:

```bash
python -m pip install ".[dev]"
python -m build
python -m twine check dist/*
```

Publish to TestPyPI first:

```bash
python -m twine upload --repository testpypi dist/*
```

Publish to PyPI:

```bash
python -m twine upload dist/*
```

Use a PyPI API token via `TWINE_USERNAME=__token__` and
`TWINE_PASSWORD=pypi-...` or through your local `.pypirc`.

## Tests

```bash
PYTHONPATH=src python -m unittest discover -s tests -p "test_*.py"

PYTHONPATH=src:experiments/src .venv-experiments/bin/python \
  experiments/test_runtime_execution_guard.py
```

## Branches

- `main`: standalone DSC codebase.
- `codex/v0321`: latest DSC development branch mirrored into `main`.
