agent-skilltree 0.4.0__tar.gz → 0.4.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- agent_skilltree-0.4.2/PKG-INFO +161 -0
- agent_skilltree-0.4.2/README.md +147 -0
- {agent_skilltree-0.4.0 → agent_skilltree-0.4.2}/pyproject.toml +1 -1
- agent_skilltree-0.4.2/src/agent_skilltree.egg-info/PKG-INFO +161 -0
- {agent_skilltree-0.4.0 → agent_skilltree-0.4.2}/src/skilltree/__init__.py +12 -7
- {agent_skilltree-0.4.0 → agent_skilltree-0.4.2}/src/skilltree/cli.py +8 -7
- {agent_skilltree-0.4.0 → agent_skilltree-0.4.2}/src/skilltree/cohere.py +12 -11
- {agent_skilltree-0.4.0 → agent_skilltree-0.4.2}/src/skilltree/exchange.py +3 -7
- {agent_skilltree-0.4.0 → agent_skilltree-0.4.2}/src/skilltree/federation.py +1 -1
- {agent_skilltree-0.4.0 → agent_skilltree-0.4.2}/src/skilltree/forest.py +9 -9
- {agent_skilltree-0.4.0 → agent_skilltree-0.4.2}/src/skilltree/mapper.py +1 -1
- {agent_skilltree-0.4.0 → agent_skilltree-0.4.2}/src/skilltree/marketplace.py +3 -3
- {agent_skilltree-0.4.0 → agent_skilltree-0.4.2}/src/skilltree/materialize.py +22 -6
- {agent_skilltree-0.4.0 → agent_skilltree-0.4.2}/src/skilltree/model.py +9 -9
- {agent_skilltree-0.4.0 → agent_skilltree-0.4.2}/src/skilltree/registry.py +1 -1
- {agent_skilltree-0.4.0 → agent_skilltree-0.4.2}/src/skilltree/reports.py +2 -2
- {agent_skilltree-0.4.0 → agent_skilltree-0.4.2}/src/skilltree/search.py +18 -12
- {agent_skilltree-0.4.0 → agent_skilltree-0.4.2}/src/skilltree/tome.py +1 -1
- {agent_skilltree-0.4.0 → agent_skilltree-0.4.2}/src/skilltree/validate.py +1 -1
- {agent_skilltree-0.4.0 → agent_skilltree-0.4.2}/tests/test_cohere.py +21 -6
- {agent_skilltree-0.4.0 → agent_skilltree-0.4.2}/tests/test_federation.py +1 -1
- {agent_skilltree-0.4.0 → agent_skilltree-0.4.2}/tests/test_folder_search.py +21 -3
- {agent_skilltree-0.4.0 → agent_skilltree-0.4.2}/tests/test_forest.py +1 -1
- {agent_skilltree-0.4.0 → agent_skilltree-0.4.2}/tests/test_mapper.py +1 -1
- {agent_skilltree-0.4.0 → agent_skilltree-0.4.2}/tests/test_notifications.py +1 -1
- {agent_skilltree-0.4.0 → agent_skilltree-0.4.2}/tests/test_registry.py +1 -1
- agent_skilltree-0.4.2/tests/test_search.py +81 -0
- {agent_skilltree-0.4.0 → agent_skilltree-0.4.2}/tests/test_skilltree.py +19 -3
- {agent_skilltree-0.4.0 → agent_skilltree-0.4.2}/tests/test_tome.py +15 -3
- agent_skilltree-0.4.0/PKG-INFO +0 -168
- agent_skilltree-0.4.0/README.md +0 -154
- agent_skilltree-0.4.0/src/agent_skilltree.egg-info/PKG-INFO +0 -168
- agent_skilltree-0.4.0/tests/test_search.py +0 -47
- {agent_skilltree-0.4.0 → agent_skilltree-0.4.2}/LICENSE +0 -0
- {agent_skilltree-0.4.0 → agent_skilltree-0.4.2}/setup.cfg +0 -0
- {agent_skilltree-0.4.0 → agent_skilltree-0.4.2}/src/agent_skilltree.egg-info/SOURCES.txt +0 -0
- {agent_skilltree-0.4.0 → agent_skilltree-0.4.2}/src/agent_skilltree.egg-info/dependency_links.txt +0 -0
- {agent_skilltree-0.4.0 → agent_skilltree-0.4.2}/src/agent_skilltree.egg-info/entry_points.txt +0 -0
- {agent_skilltree-0.4.0 → agent_skilltree-0.4.2}/src/agent_skilltree.egg-info/requires.txt +0 -0
- {agent_skilltree-0.4.0 → agent_skilltree-0.4.2}/src/agent_skilltree.egg-info/top_level.txt +0 -0
- {agent_skilltree-0.4.0 → agent_skilltree-0.4.2}/tests/test_coords.py +0 -0
- {agent_skilltree-0.4.0 → agent_skilltree-0.4.2}/tests/test_emit_roundtrip.py +0 -0
- {agent_skilltree-0.4.0 → agent_skilltree-0.4.2}/tests/test_exchange.py +0 -0
- {agent_skilltree-0.4.0 → agent_skilltree-0.4.2}/tests/test_glyph_search.py +0 -0
- {agent_skilltree-0.4.0 → agent_skilltree-0.4.2}/tests/test_marketplace.py +0 -0
- {agent_skilltree-0.4.0 → agent_skilltree-0.4.2}/tests/test_portable.py +0 -0
- {agent_skilltree-0.4.0 → agent_skilltree-0.4.2}/tests/test_reports.py +0 -0
- {agent_skilltree-0.4.0 → agent_skilltree-0.4.2}/tests/test_summaries.py +0 -0
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: agent-skilltree
|
|
3
|
+
Version: 0.4.2
|
|
4
|
+
Summary: A coordinate-addressed tree of agent skill dirs wired by Read-tool breadcrumbs, with programmatic validation.
|
|
5
|
+
Author: Isaac Wostrel-Rubin
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/sancovp/skilltree
|
|
8
|
+
Keywords: skills,agents,skill-tree,claude,progressive-disclosure,coordinate-addressing
|
|
9
|
+
Requires-Python: >=3.11
|
|
10
|
+
Description-Content-Type: text/markdown
|
|
11
|
+
License-File: LICENSE
|
|
12
|
+
Requires-Dist: click
|
|
13
|
+
Dynamic: license-file
|
|
14
|
+
|
|
15
|
+
<p align="center"><img src="assets/header.svg" alt="SkillTree" width="100%"></p>
|
|
16
|
+
|
|
17
|
+
# SkillTree
|
|
18
|
+
|
|
19
|
+
   
|
|
20
|
+
|
|
21
|
+
SkillTree turns a flat folder of agent skills into a tree that a model walks one layer at a time. Every skill gets an
|
|
22
|
+
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
|
|
23
|
+
of checks keeps the tree true as skills are added, moved or removed. It is a Python library and a command line,
|
|
24
|
+
`skilltree`, published on PyPI as `agent-skilltree`, and it ships as a Claude Code plugin whose one skill teaches
|
|
25
|
+
Claude to install and use it.
|
|
26
|
+
|
|
27
|
+
## The problem it solves
|
|
28
|
+
|
|
29
|
+
Claude Code loads a skills folder one layer deep: every skill in `~/.claude/skills` or a project's `.claude/skills` is
|
|
30
|
+
offered to the model at once, and a `.claude` folder nested inside another is never loaded. With ten skills that costs
|
|
31
|
+
nothing. With a hundred, every skill's description is in front of the model on every turn, and choosing the right one
|
|
32
|
+
gets worse as the pile grows, because the model has to work out, each time, how the skills relate — which is general
|
|
33
|
+
and which is specific, which belongs under which — from a list that no longer says.
|
|
34
|
+
|
|
35
|
+
Those relations are already there in the skills themselves; the flat folder throws them away. The platform ships the
|
|
36
|
+
nodes and forbids the edge: no skill can cause a deeper skill to be loaded. SkillTree puts the edges back on the disk.
|
|
37
|
+
A model then reads the top layer, chooses a branch, and reads into it, so what it holds at any moment grows with how
|
|
38
|
+
deep it has gone, not with how many skills exist.
|
|
39
|
+
|
|
40
|
+
## Install
|
|
41
|
+
|
|
42
|
+
```
|
|
43
|
+
pip install agent-skilltree
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## First use
|
|
47
|
+
|
|
48
|
+
Point it at a skills folder, see what shape it is in, turn it into a tree, and undo it if you want:
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
skilltree cohere ~/my-project # is it a tree, or a flat pile with no root?
|
|
52
|
+
skilltree emit ~/my-project --root-forest --name my-project # make it a tree, in place
|
|
53
|
+
skilltree tree ~/my-project # show the tree, every skill by its address
|
|
54
|
+
skilltree search ~/my-project "deploy rollback" --scope 0.1 # search inside one branch
|
|
55
|
+
skilltree unemit ~/my-project # put everything back exactly as it was
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
From a clone of the repository, `pip install -e .` installs the same command.
|
|
59
|
+
|
|
60
|
+
From Python:
|
|
61
|
+
|
|
62
|
+
```python
|
|
63
|
+
from skilltree import SkillTree, TreeNode, materialize, validate
|
|
64
|
+
|
|
65
|
+
tree = SkillTree(TreeNode("root", "sc", children=[TreeNode("debug", "cor"), TreeNode("explain", "cor")]))
|
|
66
|
+
materialize(tree, "out/", coords=True) # write it to disk
|
|
67
|
+
assert validate("out/") == [] # every branch can be walked
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
## Its interface
|
|
71
|
+
|
|
72
|
+
<details>
|
|
73
|
+
<summary><b>Show its interface</b></summary>
|
|
74
|
+
|
|
75
|
+
The command line, `skilltree <command>`:
|
|
76
|
+
|
|
77
|
+
| command | what it does |
|
|
78
|
+
|---|---|
|
|
79
|
+
| `discover <root>` · `tree <root>` | read the tree that is actually on disk and print it, every skill by its address |
|
|
80
|
+
| `cohere <root>` | report where the tree on disk has drifted from its recorded shape; exits 1 on any drift |
|
|
81
|
+
| `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 |
|
|
82
|
+
| `unemit <root>` | undo the last tree-making `emit` exactly |
|
|
83
|
+
| `relink <root> [--localize]` | rewrite only the breadcrumb paths: relative (what you ship) or absolute for this machine |
|
|
84
|
+
| `build <manifest> <root> [--localize]` | write a tree from its manifest, then check it |
|
|
85
|
+
| `validate <root>` | check that every node loads and every breadcrumb leads somewhere |
|
|
86
|
+
| `map <folder> [--write]` | render any folder as one addressed index file |
|
|
87
|
+
| `search <folder> <query> [--scope C] [--ext E] [--limit N]` | ranked search over any folder, optionally inside one branch |
|
|
88
|
+
| `fold <dir> --into <node> --tree <root> [--relative]` | bind a framework into a volume of a tome |
|
|
89
|
+
| `project <root> <target> [--policy progressive\|flat] [--link absolute\|relative] [--node N]` | surface a tree into a skills folder as links |
|
|
90
|
+
| `notify <root> [--rules-dir D]` · `watch <root> [--interval S] [--once]` | write the tree's health into one notice file, once or on a timer |
|
|
91
|
+
| `exchange build <manifest> <repo>` · `exchange validate <manifest> <repo>` | many trees in one repository under one master |
|
|
92
|
+
| `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 |
|
|
93
|
+
| `demo` | build a small tree, walk it, check it, break it, and show the check catching the break |
|
|
94
|
+
|
|
95
|
+
The library, `import skilltree`: `SkillTree` and `TreeNode` (the model), `materialize` and `validate` (write and
|
|
96
|
+
check), `discover`, `cohere`, `emit`, `unemit` and `watch` (coherence), `project`, `link_tree`, `build_forest` and
|
|
97
|
+
`fold` (surfacing and the tome), `build_map`, `build_index` and `search` (navigation), `build_exchange`,
|
|
98
|
+
`walk_federation`, `validate_registry`, `validate_contribution` and `promote` (many trees), and `report_missed`,
|
|
99
|
+
`mark_problem`, `list_reports` and `resolve` (the reports queue).
|
|
100
|
+
|
|
101
|
+
</details>
|
|
102
|
+
|
|
103
|
+
## How it works
|
|
104
|
+
|
|
105
|
+
SkillTree uses the only three levers the platform leaves open. **Placement**: each node is a plain folder carrying its
|
|
106
|
+
own one-skill `.claude/`, so the path is the coordinate. **The inert nested `.claude`**: only the top layer loads, so
|
|
107
|
+
deeper nodes stay out of context until entered. **Breadcrumbs**: each node's `SKILL.md` ends with what lies below it
|
|
108
|
+
and the instruction to Read into it. A coordinate stands in for a node's identity and a breadcrumb for an edge —
|
|
109
|
+
emulations of what a graph would hold natively.
|
|
110
|
+
|
|
111
|
+
So a tree is plain folders. The root's skill lives at `<root>/.claude/skills/0-<root>/SKILL.md`; each child is a
|
|
112
|
+
folder beside that `.claude`, holding its own one-skill `.claude/skills/`, and only the root's skill is offered at
|
|
113
|
+
first. The root's `SKILL.md` ends with two generated parts: an index summary, which names everything reachable below
|
|
114
|
+
it so that a search for a deep skill still finds the branch that leads to it, and the breadcrumbs, one line per child
|
|
115
|
+
of the form ``- 0.1-debug (cor): Read `debug/.claude/skills/0.1-debug/SKILL.md` ``.
|
|
116
|
+
|
|
117
|
+
Descending is reading. When the model uses Claude Code's Read tool on a child's `SKILL.md`, Claude Code loads that
|
|
118
|
+
folder's layer — its `CLAUDE.md`, its rules and its skills — and nothing below it; a folder outside the project loads
|
|
119
|
+
nothing when read. A shell `cat` of the same file loads nothing either, so every breadcrumb says Read, never `cat`.
|
|
120
|
+
|
|
121
|
+
The shape is recorded in a manifest, `skilltree.json`, beside the tree. Breadcrumbs and the manifest's paths are
|
|
122
|
+
relative, so a tree names no machine and still works when copied; installing a tree writes them absolute for the place
|
|
123
|
+
it is installed. Because the platform does nothing to keep such a structure intact, SkillTree keeps it itself:
|
|
124
|
+
`validate` refuses a tree a model could not walk, `cohere` names every way the disk has drifted from the manifest,
|
|
125
|
+
`emit` repairs it in place, and a watch writes the verdict into one notice file that every session reads, so a broken
|
|
126
|
+
tree announces itself.
|
|
127
|
+
|
|
128
|
+
## What it needs
|
|
129
|
+
|
|
130
|
+
Python 3.11 or later and the `click` package, which pip installs with it. Search uses SQLite's FTS5, which ships with
|
|
131
|
+
Python. Reading an exchange manifest written in YAML needs PyYAML. Walking a tree by its breadcrumbs needs a coding
|
|
132
|
+
agent whose file reader loads a folder's skills when it reads a file there — Claude Code does; other agents need the
|
|
133
|
+
adapters of a later version.
|
|
134
|
+
|
|
135
|
+
## Roadmap
|
|
136
|
+
|
|
137
|
+
| version | what it holds | where it stands |
|
|
138
|
+
|---|---|---|
|
|
139
|
+
| **0.1.0** | the tree and its gate: materialize, validate, discover, cohere, emit, unemit, the watch and its notice, the command line. | reached |
|
|
140
|
+
| **0.2.0** | one product: map and search folded in as commands, and the tree view. | reached |
|
|
141
|
+
| **0.3.0** | the tome's bind operations: a volume node holding framework rows, fold, project, and the check that every row resolves. | reached |
|
|
142
|
+
| **0.4.0** | trees that ship portable: relative breadcrumbs and manifest paths, localized only at install. | reached |
|
|
143
|
+
| **0.4.1** | the install line names this package. | reached |
|
|
144
|
+
| **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 |
|
|
145
|
+
| **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 |
|
|
146
|
+
| **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 |
|
|
147
|
+
| **0.7.0** | versioned skills: a skill placed again keeps its history, and descent and search go to its newest version. | next |
|
|
148
|
+
| **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 |
|
|
149
|
+
| **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 |
|
|
150
|
+
|
|
151
|
+
## Links
|
|
152
|
+
|
|
153
|
+
[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)
|
|
154
|
+
|
|
155
|
+
## Changelog
|
|
156
|
+
|
|
157
|
+
Every publish is recorded in [CHANGELOG.md](./CHANGELOG.md).
|
|
158
|
+
|
|
159
|
+
## Licence
|
|
160
|
+
|
|
161
|
+
MIT License — see [LICENSE](./LICENSE).
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
<p align="center"><img src="assets/header.svg" alt="SkillTree" width="100%"></p>
|
|
2
|
+
|
|
3
|
+
# SkillTree
|
|
4
|
+
|
|
5
|
+
   
|
|
6
|
+
|
|
7
|
+
SkillTree turns a flat folder of agent skills into a tree that a model walks one layer at a time. Every skill gets an
|
|
8
|
+
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
|
|
9
|
+
of checks keeps the tree true as skills are added, moved or removed. It is a Python library and a command line,
|
|
10
|
+
`skilltree`, published on PyPI as `agent-skilltree`, and it ships as a Claude Code plugin whose one skill teaches
|
|
11
|
+
Claude to install and use it.
|
|
12
|
+
|
|
13
|
+
## The problem it solves
|
|
14
|
+
|
|
15
|
+
Claude Code loads a skills folder one layer deep: every skill in `~/.claude/skills` or a project's `.claude/skills` is
|
|
16
|
+
offered to the model at once, and a `.claude` folder nested inside another is never loaded. With ten skills that costs
|
|
17
|
+
nothing. With a hundred, every skill's description is in front of the model on every turn, and choosing the right one
|
|
18
|
+
gets worse as the pile grows, because the model has to work out, each time, how the skills relate — which is general
|
|
19
|
+
and which is specific, which belongs under which — from a list that no longer says.
|
|
20
|
+
|
|
21
|
+
Those relations are already there in the skills themselves; the flat folder throws them away. The platform ships the
|
|
22
|
+
nodes and forbids the edge: no skill can cause a deeper skill to be loaded. SkillTree puts the edges back on the disk.
|
|
23
|
+
A model then reads the top layer, chooses a branch, and reads into it, so what it holds at any moment grows with how
|
|
24
|
+
deep it has gone, not with how many skills exist.
|
|
25
|
+
|
|
26
|
+
## Install
|
|
27
|
+
|
|
28
|
+
```
|
|
29
|
+
pip install agent-skilltree
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## First use
|
|
33
|
+
|
|
34
|
+
Point it at a skills folder, see what shape it is in, turn it into a tree, and undo it if you want:
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
skilltree cohere ~/my-project # is it a tree, or a flat pile with no root?
|
|
38
|
+
skilltree emit ~/my-project --root-forest --name my-project # make it a tree, in place
|
|
39
|
+
skilltree tree ~/my-project # show the tree, every skill by its address
|
|
40
|
+
skilltree search ~/my-project "deploy rollback" --scope 0.1 # search inside one branch
|
|
41
|
+
skilltree unemit ~/my-project # put everything back exactly as it was
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
From a clone of the repository, `pip install -e .` installs the same command.
|
|
45
|
+
|
|
46
|
+
From Python:
|
|
47
|
+
|
|
48
|
+
```python
|
|
49
|
+
from skilltree import SkillTree, TreeNode, materialize, validate
|
|
50
|
+
|
|
51
|
+
tree = SkillTree(TreeNode("root", "sc", children=[TreeNode("debug", "cor"), TreeNode("explain", "cor")]))
|
|
52
|
+
materialize(tree, "out/", coords=True) # write it to disk
|
|
53
|
+
assert validate("out/") == [] # every branch can be walked
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## Its interface
|
|
57
|
+
|
|
58
|
+
<details>
|
|
59
|
+
<summary><b>Show its interface</b></summary>
|
|
60
|
+
|
|
61
|
+
The command line, `skilltree <command>`:
|
|
62
|
+
|
|
63
|
+
| command | what it does |
|
|
64
|
+
|---|---|
|
|
65
|
+
| `discover <root>` · `tree <root>` | read the tree that is actually on disk and print it, every skill by its address |
|
|
66
|
+
| `cohere <root>` | report where the tree on disk has drifted from its recorded shape; exits 1 on any drift |
|
|
67
|
+
| `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 |
|
|
68
|
+
| `unemit <root>` | undo the last tree-making `emit` exactly |
|
|
69
|
+
| `relink <root> [--localize]` | rewrite only the breadcrumb paths: relative (what you ship) or absolute for this machine |
|
|
70
|
+
| `build <manifest> <root> [--localize]` | write a tree from its manifest, then check it |
|
|
71
|
+
| `validate <root>` | check that every node loads and every breadcrumb leads somewhere |
|
|
72
|
+
| `map <folder> [--write]` | render any folder as one addressed index file |
|
|
73
|
+
| `search <folder> <query> [--scope C] [--ext E] [--limit N]` | ranked search over any folder, optionally inside one branch |
|
|
74
|
+
| `fold <dir> --into <node> --tree <root> [--relative]` | bind a framework into a volume of a tome |
|
|
75
|
+
| `project <root> <target> [--policy progressive\|flat] [--link absolute\|relative] [--node N]` | surface a tree into a skills folder as links |
|
|
76
|
+
| `notify <root> [--rules-dir D]` · `watch <root> [--interval S] [--once]` | write the tree's health into one notice file, once or on a timer |
|
|
77
|
+
| `exchange build <manifest> <repo>` · `exchange validate <manifest> <repo>` | many trees in one repository under one master |
|
|
78
|
+
| `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 |
|
|
79
|
+
| `demo` | build a small tree, walk it, check it, break it, and show the check catching the break |
|
|
80
|
+
|
|
81
|
+
The library, `import skilltree`: `SkillTree` and `TreeNode` (the model), `materialize` and `validate` (write and
|
|
82
|
+
check), `discover`, `cohere`, `emit`, `unemit` and `watch` (coherence), `project`, `link_tree`, `build_forest` and
|
|
83
|
+
`fold` (surfacing and the tome), `build_map`, `build_index` and `search` (navigation), `build_exchange`,
|
|
84
|
+
`walk_federation`, `validate_registry`, `validate_contribution` and `promote` (many trees), and `report_missed`,
|
|
85
|
+
`mark_problem`, `list_reports` and `resolve` (the reports queue).
|
|
86
|
+
|
|
87
|
+
</details>
|
|
88
|
+
|
|
89
|
+
## How it works
|
|
90
|
+
|
|
91
|
+
SkillTree uses the only three levers the platform leaves open. **Placement**: each node is a plain folder carrying its
|
|
92
|
+
own one-skill `.claude/`, so the path is the coordinate. **The inert nested `.claude`**: only the top layer loads, so
|
|
93
|
+
deeper nodes stay out of context until entered. **Breadcrumbs**: each node's `SKILL.md` ends with what lies below it
|
|
94
|
+
and the instruction to Read into it. A coordinate stands in for a node's identity and a breadcrumb for an edge —
|
|
95
|
+
emulations of what a graph would hold natively.
|
|
96
|
+
|
|
97
|
+
So a tree is plain folders. The root's skill lives at `<root>/.claude/skills/0-<root>/SKILL.md`; each child is a
|
|
98
|
+
folder beside that `.claude`, holding its own one-skill `.claude/skills/`, and only the root's skill is offered at
|
|
99
|
+
first. The root's `SKILL.md` ends with two generated parts: an index summary, which names everything reachable below
|
|
100
|
+
it so that a search for a deep skill still finds the branch that leads to it, and the breadcrumbs, one line per child
|
|
101
|
+
of the form ``- 0.1-debug (cor): Read `debug/.claude/skills/0.1-debug/SKILL.md` ``.
|
|
102
|
+
|
|
103
|
+
Descending is reading. When the model uses Claude Code's Read tool on a child's `SKILL.md`, Claude Code loads that
|
|
104
|
+
folder's layer — its `CLAUDE.md`, its rules and its skills — and nothing below it; a folder outside the project loads
|
|
105
|
+
nothing when read. A shell `cat` of the same file loads nothing either, so every breadcrumb says Read, never `cat`.
|
|
106
|
+
|
|
107
|
+
The shape is recorded in a manifest, `skilltree.json`, beside the tree. Breadcrumbs and the manifest's paths are
|
|
108
|
+
relative, so a tree names no machine and still works when copied; installing a tree writes them absolute for the place
|
|
109
|
+
it is installed. Because the platform does nothing to keep such a structure intact, SkillTree keeps it itself:
|
|
110
|
+
`validate` refuses a tree a model could not walk, `cohere` names every way the disk has drifted from the manifest,
|
|
111
|
+
`emit` repairs it in place, and a watch writes the verdict into one notice file that every session reads, so a broken
|
|
112
|
+
tree announces itself.
|
|
113
|
+
|
|
114
|
+
## What it needs
|
|
115
|
+
|
|
116
|
+
Python 3.11 or later and the `click` package, which pip installs with it. Search uses SQLite's FTS5, which ships with
|
|
117
|
+
Python. Reading an exchange manifest written in YAML needs PyYAML. Walking a tree by its breadcrumbs needs a coding
|
|
118
|
+
agent whose file reader loads a folder's skills when it reads a file there — Claude Code does; other agents need the
|
|
119
|
+
adapters of a later version.
|
|
120
|
+
|
|
121
|
+
## Roadmap
|
|
122
|
+
|
|
123
|
+
| version | what it holds | where it stands |
|
|
124
|
+
|---|---|---|
|
|
125
|
+
| **0.1.0** | the tree and its gate: materialize, validate, discover, cohere, emit, unemit, the watch and its notice, the command line. | reached |
|
|
126
|
+
| **0.2.0** | one product: map and search folded in as commands, and the tree view. | reached |
|
|
127
|
+
| **0.3.0** | the tome's bind operations: a volume node holding framework rows, fold, project, and the check that every row resolves. | reached |
|
|
128
|
+
| **0.4.0** | trees that ship portable: relative breadcrumbs and manifest paths, localized only at install. | reached |
|
|
129
|
+
| **0.4.1** | the install line names this package. | reached |
|
|
130
|
+
| **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 |
|
|
131
|
+
| **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 |
|
|
132
|
+
| **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 |
|
|
133
|
+
| **0.7.0** | versioned skills: a skill placed again keeps its history, and descent and search go to its newest version. | next |
|
|
134
|
+
| **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 |
|
|
135
|
+
| **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 |
|
|
136
|
+
|
|
137
|
+
## Links
|
|
138
|
+
|
|
139
|
+
[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)
|
|
140
|
+
|
|
141
|
+
## Changelog
|
|
142
|
+
|
|
143
|
+
Every publish is recorded in [CHANGELOG.md](./CHANGELOG.md).
|
|
144
|
+
|
|
145
|
+
## Licence
|
|
146
|
+
|
|
147
|
+
MIT License — see [LICENSE](./LICENSE).
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "agent-skilltree"
|
|
7
|
-
version = "0.4.
|
|
7
|
+
version = "0.4.2"
|
|
8
8
|
description = "A coordinate-addressed tree of agent skill dirs wired by Read-tool breadcrumbs, with programmatic validation."
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
license = { text = "MIT" }
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: agent-skilltree
|
|
3
|
+
Version: 0.4.2
|
|
4
|
+
Summary: A coordinate-addressed tree of agent skill dirs wired by Read-tool breadcrumbs, with programmatic validation.
|
|
5
|
+
Author: Isaac Wostrel-Rubin
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/sancovp/skilltree
|
|
8
|
+
Keywords: skills,agents,skill-tree,claude,progressive-disclosure,coordinate-addressing
|
|
9
|
+
Requires-Python: >=3.11
|
|
10
|
+
Description-Content-Type: text/markdown
|
|
11
|
+
License-File: LICENSE
|
|
12
|
+
Requires-Dist: click
|
|
13
|
+
Dynamic: license-file
|
|
14
|
+
|
|
15
|
+
<p align="center"><img src="assets/header.svg" alt="SkillTree" width="100%"></p>
|
|
16
|
+
|
|
17
|
+
# SkillTree
|
|
18
|
+
|
|
19
|
+
   
|
|
20
|
+
|
|
21
|
+
SkillTree turns a flat folder of agent skills into a tree that a model walks one layer at a time. Every skill gets an
|
|
22
|
+
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
|
|
23
|
+
of checks keeps the tree true as skills are added, moved or removed. It is a Python library and a command line,
|
|
24
|
+
`skilltree`, published on PyPI as `agent-skilltree`, and it ships as a Claude Code plugin whose one skill teaches
|
|
25
|
+
Claude to install and use it.
|
|
26
|
+
|
|
27
|
+
## The problem it solves
|
|
28
|
+
|
|
29
|
+
Claude Code loads a skills folder one layer deep: every skill in `~/.claude/skills` or a project's `.claude/skills` is
|
|
30
|
+
offered to the model at once, and a `.claude` folder nested inside another is never loaded. With ten skills that costs
|
|
31
|
+
nothing. With a hundred, every skill's description is in front of the model on every turn, and choosing the right one
|
|
32
|
+
gets worse as the pile grows, because the model has to work out, each time, how the skills relate — which is general
|
|
33
|
+
and which is specific, which belongs under which — from a list that no longer says.
|
|
34
|
+
|
|
35
|
+
Those relations are already there in the skills themselves; the flat folder throws them away. The platform ships the
|
|
36
|
+
nodes and forbids the edge: no skill can cause a deeper skill to be loaded. SkillTree puts the edges back on the disk.
|
|
37
|
+
A model then reads the top layer, chooses a branch, and reads into it, so what it holds at any moment grows with how
|
|
38
|
+
deep it has gone, not with how many skills exist.
|
|
39
|
+
|
|
40
|
+
## Install
|
|
41
|
+
|
|
42
|
+
```
|
|
43
|
+
pip install agent-skilltree
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## First use
|
|
47
|
+
|
|
48
|
+
Point it at a skills folder, see what shape it is in, turn it into a tree, and undo it if you want:
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
skilltree cohere ~/my-project # is it a tree, or a flat pile with no root?
|
|
52
|
+
skilltree emit ~/my-project --root-forest --name my-project # make it a tree, in place
|
|
53
|
+
skilltree tree ~/my-project # show the tree, every skill by its address
|
|
54
|
+
skilltree search ~/my-project "deploy rollback" --scope 0.1 # search inside one branch
|
|
55
|
+
skilltree unemit ~/my-project # put everything back exactly as it was
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
From a clone of the repository, `pip install -e .` installs the same command.
|
|
59
|
+
|
|
60
|
+
From Python:
|
|
61
|
+
|
|
62
|
+
```python
|
|
63
|
+
from skilltree import SkillTree, TreeNode, materialize, validate
|
|
64
|
+
|
|
65
|
+
tree = SkillTree(TreeNode("root", "sc", children=[TreeNode("debug", "cor"), TreeNode("explain", "cor")]))
|
|
66
|
+
materialize(tree, "out/", coords=True) # write it to disk
|
|
67
|
+
assert validate("out/") == [] # every branch can be walked
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
## Its interface
|
|
71
|
+
|
|
72
|
+
<details>
|
|
73
|
+
<summary><b>Show its interface</b></summary>
|
|
74
|
+
|
|
75
|
+
The command line, `skilltree <command>`:
|
|
76
|
+
|
|
77
|
+
| command | what it does |
|
|
78
|
+
|---|---|
|
|
79
|
+
| `discover <root>` · `tree <root>` | read the tree that is actually on disk and print it, every skill by its address |
|
|
80
|
+
| `cohere <root>` | report where the tree on disk has drifted from its recorded shape; exits 1 on any drift |
|
|
81
|
+
| `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 |
|
|
82
|
+
| `unemit <root>` | undo the last tree-making `emit` exactly |
|
|
83
|
+
| `relink <root> [--localize]` | rewrite only the breadcrumb paths: relative (what you ship) or absolute for this machine |
|
|
84
|
+
| `build <manifest> <root> [--localize]` | write a tree from its manifest, then check it |
|
|
85
|
+
| `validate <root>` | check that every node loads and every breadcrumb leads somewhere |
|
|
86
|
+
| `map <folder> [--write]` | render any folder as one addressed index file |
|
|
87
|
+
| `search <folder> <query> [--scope C] [--ext E] [--limit N]` | ranked search over any folder, optionally inside one branch |
|
|
88
|
+
| `fold <dir> --into <node> --tree <root> [--relative]` | bind a framework into a volume of a tome |
|
|
89
|
+
| `project <root> <target> [--policy progressive\|flat] [--link absolute\|relative] [--node N]` | surface a tree into a skills folder as links |
|
|
90
|
+
| `notify <root> [--rules-dir D]` · `watch <root> [--interval S] [--once]` | write the tree's health into one notice file, once or on a timer |
|
|
91
|
+
| `exchange build <manifest> <repo>` · `exchange validate <manifest> <repo>` | many trees in one repository under one master |
|
|
92
|
+
| `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 |
|
|
93
|
+
| `demo` | build a small tree, walk it, check it, break it, and show the check catching the break |
|
|
94
|
+
|
|
95
|
+
The library, `import skilltree`: `SkillTree` and `TreeNode` (the model), `materialize` and `validate` (write and
|
|
96
|
+
check), `discover`, `cohere`, `emit`, `unemit` and `watch` (coherence), `project`, `link_tree`, `build_forest` and
|
|
97
|
+
`fold` (surfacing and the tome), `build_map`, `build_index` and `search` (navigation), `build_exchange`,
|
|
98
|
+
`walk_federation`, `validate_registry`, `validate_contribution` and `promote` (many trees), and `report_missed`,
|
|
99
|
+
`mark_problem`, `list_reports` and `resolve` (the reports queue).
|
|
100
|
+
|
|
101
|
+
</details>
|
|
102
|
+
|
|
103
|
+
## How it works
|
|
104
|
+
|
|
105
|
+
SkillTree uses the only three levers the platform leaves open. **Placement**: each node is a plain folder carrying its
|
|
106
|
+
own one-skill `.claude/`, so the path is the coordinate. **The inert nested `.claude`**: only the top layer loads, so
|
|
107
|
+
deeper nodes stay out of context until entered. **Breadcrumbs**: each node's `SKILL.md` ends with what lies below it
|
|
108
|
+
and the instruction to Read into it. A coordinate stands in for a node's identity and a breadcrumb for an edge —
|
|
109
|
+
emulations of what a graph would hold natively.
|
|
110
|
+
|
|
111
|
+
So a tree is plain folders. The root's skill lives at `<root>/.claude/skills/0-<root>/SKILL.md`; each child is a
|
|
112
|
+
folder beside that `.claude`, holding its own one-skill `.claude/skills/`, and only the root's skill is offered at
|
|
113
|
+
first. The root's `SKILL.md` ends with two generated parts: an index summary, which names everything reachable below
|
|
114
|
+
it so that a search for a deep skill still finds the branch that leads to it, and the breadcrumbs, one line per child
|
|
115
|
+
of the form ``- 0.1-debug (cor): Read `debug/.claude/skills/0.1-debug/SKILL.md` ``.
|
|
116
|
+
|
|
117
|
+
Descending is reading. When the model uses Claude Code's Read tool on a child's `SKILL.md`, Claude Code loads that
|
|
118
|
+
folder's layer — its `CLAUDE.md`, its rules and its skills — and nothing below it; a folder outside the project loads
|
|
119
|
+
nothing when read. A shell `cat` of the same file loads nothing either, so every breadcrumb says Read, never `cat`.
|
|
120
|
+
|
|
121
|
+
The shape is recorded in a manifest, `skilltree.json`, beside the tree. Breadcrumbs and the manifest's paths are
|
|
122
|
+
relative, so a tree names no machine and still works when copied; installing a tree writes them absolute for the place
|
|
123
|
+
it is installed. Because the platform does nothing to keep such a structure intact, SkillTree keeps it itself:
|
|
124
|
+
`validate` refuses a tree a model could not walk, `cohere` names every way the disk has drifted from the manifest,
|
|
125
|
+
`emit` repairs it in place, and a watch writes the verdict into one notice file that every session reads, so a broken
|
|
126
|
+
tree announces itself.
|
|
127
|
+
|
|
128
|
+
## What it needs
|
|
129
|
+
|
|
130
|
+
Python 3.11 or later and the `click` package, which pip installs with it. Search uses SQLite's FTS5, which ships with
|
|
131
|
+
Python. Reading an exchange manifest written in YAML needs PyYAML. Walking a tree by its breadcrumbs needs a coding
|
|
132
|
+
agent whose file reader loads a folder's skills when it reads a file there — Claude Code does; other agents need the
|
|
133
|
+
adapters of a later version.
|
|
134
|
+
|
|
135
|
+
## Roadmap
|
|
136
|
+
|
|
137
|
+
| version | what it holds | where it stands |
|
|
138
|
+
|---|---|---|
|
|
139
|
+
| **0.1.0** | the tree and its gate: materialize, validate, discover, cohere, emit, unemit, the watch and its notice, the command line. | reached |
|
|
140
|
+
| **0.2.0** | one product: map and search folded in as commands, and the tree view. | reached |
|
|
141
|
+
| **0.3.0** | the tome's bind operations: a volume node holding framework rows, fold, project, and the check that every row resolves. | reached |
|
|
142
|
+
| **0.4.0** | trees that ship portable: relative breadcrumbs and manifest paths, localized only at install. | reached |
|
|
143
|
+
| **0.4.1** | the install line names this package. | reached |
|
|
144
|
+
| **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 |
|
|
145
|
+
| **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 |
|
|
146
|
+
| **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 |
|
|
147
|
+
| **0.7.0** | versioned skills: a skill placed again keeps its history, and descent and search go to its newest version. | next |
|
|
148
|
+
| **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 |
|
|
149
|
+
| **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 |
|
|
150
|
+
|
|
151
|
+
## Links
|
|
152
|
+
|
|
153
|
+
[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)
|
|
154
|
+
|
|
155
|
+
## Changelog
|
|
156
|
+
|
|
157
|
+
Every publish is recorded in [CHANGELOG.md](./CHANGELOG.md).
|
|
158
|
+
|
|
159
|
+
## Licence
|
|
160
|
+
|
|
161
|
+
MIT License — see [LICENSE](./LICENSE).
|
|
@@ -1,17 +1,22 @@
|
|
|
1
|
-
"""SkillTree — a tree of skill dirs wired by
|
|
1
|
+
"""SkillTree — a tree of skill dirs wired by Read-breadcrumbs, with programmatic validation.
|
|
2
2
|
|
|
3
|
-
The substrate won't auto-traverse it (
|
|
4
|
-
validator is the system. Nodes are skill dirs of any
|
|
5
|
-
|
|
3
|
+
The substrate won't auto-traverse it (a nested .claude never auto-loads), so the
|
|
4
|
+
validator is the system. Nodes are skill dirs of any kind (ac/cor/sc/skill), each
|
|
5
|
+
in its own folder's .claude/skills; an edge is a breadcrumb in the parent's SKILL.md,
|
|
6
|
+
and descending a level is a Read of the child's SKILL.md, which loads its layer.
|
|
6
7
|
"""
|
|
7
8
|
from __future__ import annotations
|
|
8
9
|
|
|
9
|
-
#
|
|
10
|
+
# the version is the installed distribution's; a source checkout that is not installed reads its pyproject.toml
|
|
10
11
|
from importlib.metadata import PackageNotFoundError, version as _pkg_version
|
|
11
12
|
try:
|
|
12
13
|
__version__ = _pkg_version("agent-skilltree")
|
|
13
|
-
except PackageNotFoundError:
|
|
14
|
-
|
|
14
|
+
except PackageNotFoundError:
|
|
15
|
+
import tomllib as _toml
|
|
16
|
+
from pathlib import Path as _Path
|
|
17
|
+
_pyproject = _Path(__file__).resolve().parents[2] / "pyproject.toml"
|
|
18
|
+
__version__ = (_toml.loads(_pyproject.read_text())["project"]["version"]
|
|
19
|
+
if _pyproject.is_file() else "0+unknown")
|
|
15
20
|
|
|
16
21
|
from .exchange import Exchange, Member, load_exchange
|
|
17
22
|
from .exchange import build as build_exchange
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"""skilltree —
|
|
1
|
+
"""skilltree — the command line over the whole library: build, check, cohere, surface and search skill trees."""
|
|
2
2
|
from __future__ import annotations
|
|
3
3
|
|
|
4
4
|
from pathlib import Path
|
|
@@ -14,7 +14,7 @@ from .validate import validate
|
|
|
14
14
|
@click.group()
|
|
15
15
|
@click.version_option(package_name="agent-skilltree", message="skilltree %(version)s")
|
|
16
16
|
def main() -> None:
|
|
17
|
-
"""SkillTree — a nested tree of skill dirs wired by
|
|
17
|
+
"""SkillTree — a nested tree of skill dirs wired by Read-breadcrumbs (validated)."""
|
|
18
18
|
|
|
19
19
|
|
|
20
20
|
@main.command(name="discover")
|
|
@@ -171,13 +171,14 @@ def map_cmd(folder: Path, write: bool) -> None:
|
|
|
171
171
|
@click.argument("query")
|
|
172
172
|
@click.option("--scope", "scope_coord", default=None,
|
|
173
173
|
help="restrict to a coordinate subtree, e.g. 0.1 (when the folder carries skilltree coordinates)")
|
|
174
|
-
@click.option("--ext", default=None, help="comma-separated extensions (default: .md,.txt,.mdx,.rst)")
|
|
174
|
+
@click.option("--ext", default=None, help="comma-separated extensions (default: SKILL.md files when any, else .md,.txt,.mdx,.rst)")
|
|
175
175
|
@click.option("--limit", default=10, type=int)
|
|
176
176
|
def search_cmd(folder: Path, query: str, scope_coord: str | None, ext: str | None, limit: int) -> None:
|
|
177
|
-
"""FTS5/BM25 search over ANY folder
|
|
178
|
-
|
|
177
|
+
"""FTS5/BM25 search over ANY folder: its skills when it holds any SKILL.md, else its text files
|
|
178
|
+
(or the --ext files). `--scope` restricts to a coordinate subtree when names carry coordinates."""
|
|
179
179
|
from .search import search_folder, DEFAULT_EXTS
|
|
180
|
-
exts = (tuple(e if e.startswith(".") else "." + e for e in ext.split(",")) if ext
|
|
180
|
+
exts = (tuple(e if e.startswith(".") else "." + e for e in ext.split(",")) if ext
|
|
181
|
+
else None if any(folder.rglob("SKILL.md")) else DEFAULT_EXTS)
|
|
181
182
|
hits = search_folder(folder, query, scope_coord=scope_coord, exts=exts, limit=limit)
|
|
182
183
|
where = f" in {scope_coord}" if scope_coord else ""
|
|
183
184
|
if not hits:
|
|
@@ -339,7 +340,7 @@ def exchange_validate(manifest: Path, repo: Path) -> None:
|
|
|
339
340
|
|
|
340
341
|
@main.command()
|
|
341
342
|
def demo() -> None:
|
|
342
|
-
"""Build a breadcrumb tree, walk it by
|
|
343
|
+
"""Build a breadcrumb tree, walk it by Read, validate, then break a breadcrumb."""
|
|
343
344
|
tree = SkillTree(TreeNode("cc-skill-tree", "sc", description="root of the cognition skill tree", children=[
|
|
344
345
|
TreeNode("debug", "cor", description="how to debug", children=[
|
|
345
346
|
TreeNode("symptom-attn", "ac", description="attend to the symptom"),
|
|
@@ -9,11 +9,12 @@ missing inverse + the drift gate the rest of the system needs to *use itself*:
|
|
|
9
9
|
the canonical tree). Decoherence = the breadcrumbs/coords on
|
|
10
10
|
disk no longer match the tree's real shape. This is what a
|
|
11
11
|
cron runs: "you decohered X — look at the tree shape."
|
|
12
|
-
emit(root) → rewrite each node's coord +
|
|
12
|
+
emit(root) → rewrite each node's coord + Read-breadcrumbs + index summary
|
|
13
13
|
IN PLACE (no rmtree), so reality matches the engineered shape
|
|
14
14
|
again — and, for a bare forest, ROOT it (the forest→tree fix).
|
|
15
15
|
|
|
16
|
-
The law (
|
|
16
|
+
The law (no bare forest — every set of skills is rooted): `cohere` finds a bare forest;
|
|
17
|
+
`emit` roots it.
|
|
17
18
|
"""
|
|
18
19
|
from __future__ import annotations
|
|
19
20
|
|
|
@@ -24,6 +25,7 @@ import shutil
|
|
|
24
25
|
from dataclasses import dataclass, field
|
|
25
26
|
from pathlib import Path
|
|
26
27
|
|
|
28
|
+
from .materialize import _front as _front_text, _read_scalar # the one frontmatter writer, and its reader
|
|
27
29
|
from .model import (PORTABLE_NOTE, SkillTree, TreeNode, assign_coords, compose_summary, crumb_path,
|
|
28
30
|
skill_name, tome_table)
|
|
29
31
|
|
|
@@ -53,7 +55,7 @@ def _front(skill_md: Path) -> dict:
|
|
|
53
55
|
for line in text.split("---", 2)[1].splitlines():
|
|
54
56
|
if ":" in line:
|
|
55
57
|
k, v = line.split(":", 1)
|
|
56
|
-
out[k.strip()] = v
|
|
58
|
+
out[k.strip()] = _read_scalar(v)
|
|
57
59
|
return out
|
|
58
60
|
|
|
59
61
|
|
|
@@ -156,7 +158,7 @@ def _node_dir(root: Path, path: list[str]) -> Path:
|
|
|
156
158
|
def cohere(root: str | Path) -> list[Finding]:
|
|
157
159
|
"""Decoherence report: how the on-disk tree has drifted from its engineered
|
|
158
160
|
shape. With a `skilltree.json` it diffs reality against that canon; without one
|
|
159
|
-
|
|
161
|
+
a dir whose skills have no single root is a bare forest (the no-bare-forest law)."""
|
|
160
162
|
root = Path(root)
|
|
161
163
|
findings: list[Finding] = []
|
|
162
164
|
manifest = root / "skilltree.json"
|
|
@@ -166,7 +168,7 @@ def cohere(root: str | Path) -> list[Finding]:
|
|
|
166
168
|
kids = live.root.children
|
|
167
169
|
if live.root.description and "synthesized root" in live.root.description:
|
|
168
170
|
findings.append(Finding("bare_forest", None, live.root.name,
|
|
169
|
-
f"no skilltree.json; {len(kids)} top skills with no root — run `emit --root` to tree-ify"))
|
|
171
|
+
f"no skilltree.json; {len(kids)} top skills with no root — run `emit --root-forest` to tree-ify"))
|
|
170
172
|
if any(c.coord is None for c in live.nodes()):
|
|
171
173
|
findings.append(Finding("uncoordinated", None, live.root.name,
|
|
172
174
|
"nodes have no coordinates (never materialized with coords)"))
|
|
@@ -259,8 +261,7 @@ def _rewrite_node_md(smd: Path, node: TreeNode, node_dir: Path, localize: bool =
|
|
|
259
261
|
tail = ""
|
|
260
262
|
if node.frameworks: # regenerate the tome table from the model rows
|
|
261
263
|
tail += f"\n\n{tome_table(node)}"
|
|
262
|
-
|
|
263
|
-
smd.write_text(out, encoding="utf-8")
|
|
264
|
+
smd.write_text(_front_text(sname, desc, f"{base}{tail}"), encoding="utf-8")
|
|
264
265
|
|
|
265
266
|
|
|
266
267
|
def relink(root: str | Path, *, localize: bool = False) -> dict:
|
|
@@ -311,7 +312,7 @@ def emit(root: str | Path, *, root_forest: bool = False,
|
|
|
311
312
|
a root, and **tree-ify it**: each flat leaf is MOVED WHOLESALE into its nested
|
|
312
313
|
node-dir (all its files preserved — *not* a body-only re-render), so it stops
|
|
313
314
|
auto-loading. Every move is JOURNALED to `.emit-journal.json` so `unemit` can
|
|
314
|
-
reverse it exactly (
|
|
315
|
+
reverse it exactly (a move is only lossless when it is recorded).
|
|
315
316
|
|
|
316
317
|
Breadcrumbs are written PORTABLE (relative to each node's folder) unless `localize=True`,
|
|
317
318
|
which writes them absolute for the place the tree is installed — the install-time step."""
|
|
@@ -464,11 +465,11 @@ def render_notifications(findings: list[Finding], *, root: str | Path) -> str:
|
|
|
464
465
|
lines += [
|
|
465
466
|
"", f"## To fix these ({len(errs)} error(s), {len(warns)} warning(s))",
|
|
466
467
|
"",
|
|
467
|
-
f"The SkillTree under `{root}` has **decohered**: its
|
|
468
|
-
"no longer match the tree's real shape (
|
|
468
|
+
f"The SkillTree under `{root}` has **decohered**: its breadcrumbs / coordinates "
|
|
469
|
+
"no longer match the tree's real shape (a bare forest, or stale wiring).",
|
|
469
470
|
"",
|
|
470
471
|
"**Run the `skilltree` skill** (the recohere flow). In short: `skilltree emit <root>` "
|
|
471
|
-
"re-coheres the tree in place (add `--root` to tree-ify a bare forest). This notice "
|
|
472
|
+
"re-coheres the tree in place (add `--root-forest` to tree-ify a bare forest). This notice "
|
|
472
473
|
"clears itself on the next check.",
|
|
473
474
|
]
|
|
474
475
|
return "\n".join(lines) + "\n"
|