Metadata-Version: 2.4
Name: agent-skilltree
Version: 0.4.2
Summary: A coordinate-addressed tree of agent skill dirs wired by Read-tool breadcrumbs, with programmatic validation.
Author: Isaac Wostrel-Rubin
License: MIT
Project-URL: Homepage, https://github.com/sancovp/skilltree
Keywords: skills,agents,skill-tree,claude,progressive-disclosure,coordinate-addressing
Requires-Python: >=3.11
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: click
Dynamic: license-file

<p align="center"><img src="assets/header.svg" alt="SkillTree" width="100%"></p>

# SkillTree

![Licence](https://img.shields.io/github/license/sancovp/skilltree) ![Version](https://img.shields.io/pypi/v/agent-skilltree) ![Stars](https://img.shields.io/github/stars/sancovp/skilltree?style=social) ![Last commit](https://img.shields.io/github/last-commit/sancovp/skilltree)

SkillTree turns a flat folder of agent skills into a tree that a model walks one layer at a time. Every skill gets an
address (`0`, `0.1`, `0.1.1`), every branch tells the model what lies below it and how to go down into it, and a set
of checks keeps the tree true as skills are added, moved or removed. It is a Python library and a command line,
`skilltree`, published on PyPI as `agent-skilltree`, and it ships as a Claude Code plugin whose one skill teaches
Claude to install and use it.

## The problem it solves

Claude Code loads a skills folder one layer deep: every skill in `~/.claude/skills` or a project's `.claude/skills` is
offered to the model at once, and a `.claude` folder nested inside another is never loaded. With ten skills that costs
nothing. With a hundred, every skill's description is in front of the model on every turn, and choosing the right one
gets worse as the pile grows, because the model has to work out, each time, how the skills relate — which is general
and which is specific, which belongs under which — from a list that no longer says.

Those relations are already there in the skills themselves; the flat folder throws them away. The platform ships the
nodes and forbids the edge: no skill can cause a deeper skill to be loaded. SkillTree puts the edges back on the disk.
A model then reads the top layer, chooses a branch, and reads into it, so what it holds at any moment grows with how
deep it has gone, not with how many skills exist.

## Install

```
pip install agent-skilltree
```

## First use

Point it at a skills folder, see what shape it is in, turn it into a tree, and undo it if you want:

```bash
skilltree cohere ~/my-project            # is it a tree, or a flat pile with no root?
skilltree emit ~/my-project --root-forest --name my-project   # make it a tree, in place
skilltree tree ~/my-project              # show the tree, every skill by its address
skilltree search ~/my-project "deploy rollback" --scope 0.1   # search inside one branch
skilltree unemit ~/my-project            # put everything back exactly as it was
```

From a clone of the repository, `pip install -e .` installs the same command.

From Python:

```python
from skilltree import SkillTree, TreeNode, materialize, validate

tree = SkillTree(TreeNode("root", "sc", children=[TreeNode("debug", "cor"), TreeNode("explain", "cor")]))
materialize(tree, "out/", coords=True)    # write it to disk
assert validate("out/") == []             # every branch can be walked
```

## Its interface

<details>
<summary><b>Show its interface</b></summary>

The command line, `skilltree <command>`:

| command | what it does |
|---|---|
| `discover <root>` · `tree <root>` | read the tree that is actually on disk and print it, every skill by its address |
| `cohere <root>` | report where the tree on disk has drifted from its recorded shape; exits 1 on any drift |
| `emit <root> [--root-forest] [--name N] [--localize]` | rewrite addresses and breadcrumbs in place; `--root-forest` turns a flat folder into a tree, moving each skill whole and recording every move |
| `unemit <root>` | undo the last tree-making `emit` exactly |
| `relink <root> [--localize]` | rewrite only the breadcrumb paths: relative (what you ship) or absolute for this machine |
| `build <manifest> <root> [--localize]` | write a tree from its manifest, then check it |
| `validate <root>` | check that every node loads and every breadcrumb leads somewhere |
| `map <folder> [--write]` | render any folder as one addressed index file |
| `search <folder> <query> [--scope C] [--ext E] [--limit N]` | ranked search over any folder, optionally inside one branch |
| `fold <dir> --into <node> --tree <root> [--relative]` | bind a framework into a volume of a tome |
| `project <root> <target> [--policy progressive\|flat] [--link absolute\|relative] [--node N]` | surface a tree into a skills folder as links |
| `notify <root> [--rules-dir D]` · `watch <root> [--interval S] [--once]` | write the tree's health into one notice file, once or on a timer |
| `exchange build <manifest> <repo>` · `exchange validate <manifest> <repo>` | many trees in one repository under one master |
| `report-missed` · `mark-problem` · `reports` | record a skill that was needed and missing, or one that should have been used, for whoever improves the tree |
| `demo` | build a small tree, walk it, check it, break it, and show the check catching the break |

The library, `import skilltree`: `SkillTree` and `TreeNode` (the model), `materialize` and `validate` (write and
check), `discover`, `cohere`, `emit`, `unemit` and `watch` (coherence), `project`, `link_tree`, `build_forest` and
`fold` (surfacing and the tome), `build_map`, `build_index` and `search` (navigation), `build_exchange`,
`walk_federation`, `validate_registry`, `validate_contribution` and `promote` (many trees), and `report_missed`,
`mark_problem`, `list_reports` and `resolve` (the reports queue).

</details>

## How it works

SkillTree uses the only three levers the platform leaves open. **Placement**: each node is a plain folder carrying its
own one-skill `.claude/`, so the path is the coordinate. **The inert nested `.claude`**: only the top layer loads, so
deeper nodes stay out of context until entered. **Breadcrumbs**: each node's `SKILL.md` ends with what lies below it
and the instruction to Read into it. A coordinate stands in for a node's identity and a breadcrumb for an edge —
emulations of what a graph would hold natively.

So a tree is plain folders. The root's skill lives at `<root>/.claude/skills/0-<root>/SKILL.md`; each child is a
folder beside that `.claude`, holding its own one-skill `.claude/skills/`, and only the root's skill is offered at
first. The root's `SKILL.md` ends with two generated parts: an index summary, which names everything reachable below
it so that a search for a deep skill still finds the branch that leads to it, and the breadcrumbs, one line per child
of the form ``- 0.1-debug (cor): Read `debug/.claude/skills/0.1-debug/SKILL.md` ``.

Descending is reading. When the model uses Claude Code's Read tool on a child's `SKILL.md`, Claude Code loads that
folder's layer — its `CLAUDE.md`, its rules and its skills — and nothing below it; a folder outside the project loads
nothing when read. A shell `cat` of the same file loads nothing either, so every breadcrumb says Read, never `cat`.

The shape is recorded in a manifest, `skilltree.json`, beside the tree. Breadcrumbs and the manifest's paths are
relative, so a tree names no machine and still works when copied; installing a tree writes them absolute for the place
it is installed. Because the platform does nothing to keep such a structure intact, SkillTree keeps it itself:
`validate` refuses a tree a model could not walk, `cohere` names every way the disk has drifted from the manifest,
`emit` repairs it in place, and a watch writes the verdict into one notice file that every session reads, so a broken
tree announces itself.

## What it needs

Python 3.11 or later and the `click` package, which pip installs with it. Search uses SQLite's FTS5, which ships with
Python. Reading an exchange manifest written in YAML needs PyYAML. Walking a tree by its breadcrumbs needs a coding
agent whose file reader loads a folder's skills when it reads a file there — Claude Code does; other agents need the
adapters of a later version.

## Roadmap

| version | what it holds | where it stands |
|---|---|---|
| **0.1.0** | the tree and its gate: materialize, validate, discover, cohere, emit, unemit, the watch and its notice, the command line. | reached |
| **0.2.0** | one product: map and search folded in as commands, and the tree view. | reached |
| **0.3.0** | the tome's bind operations: a volume node holding framework rows, fold, project, and the check that every row resolves. | reached |
| **0.4.0** | trees that ship portable: relative breadcrumbs and manifest paths, localized only at install. | reached |
| **0.4.1** | the install line names this package. | reached |
| **0.4.2** | the design and its face: every file of SkillTree explained in its design, the README written from that design, one roadmap, frontmatter every parser reads, search that finds a tree's skills and answers any query, and no hosted workflow. | next |
| **0.5.0** | the typed volume: a volume holding skills, frameworks, AIOSes and apps, each kind bound by its own fold and checked by its own table. | next |
| **0.6.0** | the checks made true: every gate exiting non-zero on a fault, portable rows by default, one rule of addressing, and a notice whose remedy fits the installation. | next |
| **0.7.0** | versioned skills: a skill placed again keeps its history, and descent and search go to its newest version. | next |
| **0.8.0** | adapters for other coding agents: the same tree walked under Codex and under Gemini, each by its own emulation of descent. | next |
| **1.0.0** | the positional map: wherever the agent stands, it is shown the branches above it and around it, and skills placed by the graph that owns them are restored when missing. | next |

## Links

[PyPI](https://pypi.org/project/agent-skilltree/) · [Marketplace](https://github.com/sancovp/sancrev-marketplace) · [Paper — Flat versus Tree](https://github.com/sancovp/skilltree/blob/master/papers/flat-vs-tree.md) · [Paper — Coordinate-Addressed Skill Trees](https://github.com/sancovp/skilltree/blob/master/papers/skilltree-paper.md)

## Changelog

Every publish is recorded in [CHANGELOG.md](./CHANGELOG.md).

## Licence

MIT License — see [LICENSE](./LICENSE).
