skill-weave 0.3.0__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.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 FeiMing Studio
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,296 @@
1
+ Metadata-Version: 2.4
2
+ Name: skill-weave
3
+ Version: 0.3.0
4
+ Summary: Adaptive skill routing for multi-agent systems
5
+ Author: FeiMing Studio
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://github.com/Hxh-yaoxing/skill-weave
8
+ Project-URL: Repository, https://github.com/Hxh-yaoxing/skill-weave
9
+ Requires-Python: >=3.10
10
+ Description-Content-Type: text/markdown
11
+ License-File: LICENSE
12
+ Dynamic: license-file
13
+
14
+ # ๐Ÿงถ Skill Weave
15
+
16
+ **Routing that learns. Chains that self-correct. Zero install to try.**
17
+
18
+ [![Python](https://img.shields.io/badge/python-3.10+-blue)](https://pypi.org/project/skill-weave)
19
+ [![License](https://img.shields.io/badge/license-MIT-green)](LICENSE)
20
+ [![Tests](https://img.shields.io/badge/tests-20%2F20-brightgreen)](tests/)
21
+ [![Release](https://img.shields.io/github/v/release/Hxh-yaoxing/skill-weave)](https://github.com/Hxh-yaoxing/skill-weave/releases)
22
+ [![Colab](https://img.shields.io/badge/โ–ถ%20Try%20Now-Colab-orange)](https://colab.research.google.com/github/Hxh-yaoxing/skill-weave/blob/main/notebooks/skill_weave_demo.ipynb)
23
+
24
+ <br>
25
+
26
+ > **What makes it special:** A three-stage routing pipeline that shrinks 141 candidate skills to 15 *before* any LLM call. An online learner that gets smarter every time you use it. A weaver that chains skills into DAGs instead of picking just one.
27
+ >
28
+ > **95.7% accuracy. 81% fewer tokens. 20 tests. Zero required dependencies.**
29
+
30
+ ---
31
+
32
+ ## ๐Ÿ”ฅ Why This Exists
33
+
34
+ Multi-agent systems drown in their own skills.
35
+
36
+ | Problem | Why It Hurts | How Skill Weave Fixes It |
37
+ |---------|-------------|--------------------------|
38
+ | **Keyword routing** breaks under overlap | "deploy" vs "ssh-deploy" vs "docker-deploy" all match | 4-dim weighted scoring: semantic ร— recency ร— success ร— cost |
39
+ | **Static tables** rot silently | Add/remove one skill, the whole map breaks | Dynamic registration + online learning from every route |
40
+ | **Flat LLM routing** burns tokens | 141 skills = 141 candidates to rank. Every. Single. Time. | 3-stage cascade: Tree Filter (141โ†’15) โ†’ BM25 โ†’ LLM Re-rank |
41
+
42
+ ---
43
+
44
+ ## ๐Ÿ†š How It Compares
45
+
46
+ | Feature | Skill Weave | Keyword Match | LangChain Router | Semantic Kernel |
47
+ |---------|-------------|---------------|------------------|-----------------|
48
+ | Zero-dependency core | โœ… | โœ… | โŒ | โŒ |
49
+ | 3-stage cascade pipeline | โœ… | โŒ | โŒ | โŒ |
50
+ | Online learning from outcomes | โœ… | โŒ | โŒ | โŒ |
51
+ | Multi-skill DAG weaving | โœ… | โŒ | โŒ | โŒ |
52
+ | Chinese-English synonym match | โœ… | โŒ | โŒ | โŒ |
53
+ | Production-tested (141 skills) | โœ… | โ€” | โ€” | โ€” |
54
+ | Token cost per route | 0โ€“2K | 0 | โˆž (flat) | โˆž (flat) |
55
+
56
+ > **Bottom line:** Keyword matching is fast but brittle. LangChain/SK handle semantics but burn tokens on every call. Skill Weave does both โ€” cascade filtering + semantic re-rank โ€” with learning on top.
57
+
58
+ ---
59
+
60
+ ## ๐ŸŽฎ Try It Now
61
+
62
+ No install. No API key. 10 seconds.
63
+
64
+ [![Open in Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/Hxh-yaoxing/skill-weave/blob/main/notebooks/skill_weave_demo.ipynb)
65
+
66
+ Four interactive demos: basic routing โ†’ active learning โ†’ skill weaving โ†’ multi-plan comparison.
67
+
68
+ ---
69
+
70
+ ## ๐Ÿ“ฆ Install
71
+
72
+ ```bash
73
+ # From GitHub (recommended until PyPI listing is complete)
74
+ pip install git+https://github.com/Hxh-yaoxing/skill-weave.git
75
+
76
+ # Coming soon: pip install skill-weave
77
+ ```
78
+
79
+ ---
80
+
81
+ ## โšก 30-Second Quick Start
82
+
83
+ ```python
84
+ from skill_weave import SkillRouter
85
+
86
+ router = SkillRouter()
87
+ router.register_skill("deploy", metadata="deploy to production, handle rollback")
88
+ router.register_skill("monitor", metadata="monitor health metrics, alert on anomalies")
89
+ router.register_skill("rollback", metadata="revert failed deployments")
90
+
91
+ results = router.route("The new deploy broke everything, we need to go back")
92
+ for r in results:
93
+ print(f"{r.skill.name}: {r.score:.2f}")
94
+ # โ†’ rollback: 0.68
95
+ # โ†’ deploy: 0.54
96
+ # โ†’ monitor: 0.42
97
+ ```
98
+
99
+ *It chose `rollback` โ€” even though the query never said "rollback". That's semantic routing.*
100
+
101
+ ---
102
+
103
+ ## ๐Ÿง  The Pipeline
104
+
105
+ ```mermaid
106
+ flowchart TD
107
+ TASK["๐Ÿ’ฌ Task: 'deploy broke, revert now'"]
108
+
109
+ TASK --> L1
110
+
111
+ subgraph L1["L1: Tree Filter (zero token)"]
112
+ T1["'deploy' โ†’ infrastructure โ†’ 37 matches"]
113
+ T2["'revert' โ†’ narrows to 4 candidates"]
114
+ T1 --> T2
115
+ end
116
+
117
+ L1 --> L2
118
+
119
+ subgraph L2["L2: BM25 Rank (<50ms)"]
120
+ B1["Statistical scoring over 4 candidates"]
121
+ B2["rollback: 0.68 | deploy: 0.54"]
122
+ B1 --> B2
123
+ end
124
+
125
+ L2 --> L3
126
+
127
+ subgraph L3["L3: LLM Re-rank (optional, ~1s)"]
128
+ R1["Semantic understanding over top ~10"]
129
+ R2["Accuracy: 69.6% โ†’ 95.7%"]
130
+ R1 --> R2
131
+ end
132
+
133
+ L3 --> OUTPUT["โœ… rollback (score: 0.92)"]
134
+ ```
135
+
136
+ | Stage | What It Does | Token Cost | Latency |
137
+ |-------|-------------|------------|---------|
138
+ | **L1: Tree Filter** | Hierarchy + synonym match โ†’ narrows 141โ†’~15 | **0** | <1ms |
139
+ | **L2: BM25** | Character 2-gram (ไธญๆ–‡) + word-level (EN) retrieval | **0** | <50ms |
140
+ | **L3: LLM Re-rank** | Deep semantic reasoning over ~10 candidates | ~2K | ~1s |
141
+
142
+ ---
143
+
144
+ ## ๐Ÿ“– API Reference
145
+
146
+ ### `SkillRouter` โ€” Zero-dependency core
147
+
148
+ ```python
149
+ router = SkillRouter(
150
+ alpha=0.45, # semantic weight
151
+ beta=0.20, # recency weight
152
+ gamma=0.25, # success rate weight
153
+ delta=0.10, # cost weight
154
+ )
155
+ router.register_skill(name, metadata="...", tags=[...], avg_cost=1.0)
156
+ router.unregister_skill(name)
157
+ router.route(task, top_k=5, max_cost=None, tags_filter=None) โ†’ list[RouteResult]
158
+ router.record_outcome(skill_name, success=True, cost=1.0)
159
+ router.skills โ†’ dict[str, Skill]
160
+ ```
161
+
162
+ ### `SkillWeave` โ€” Production 3-stage pipeline
163
+
164
+ ```python
165
+ sw = SkillWeave(skill_dir="/path/to/skills", llm_rank_fn=my_llm_fn)
166
+ sw.route(query, top_k=5, exclude_tier3=True) โ†’ list[dict]
167
+ sw.run_benchmark(queries, verbose=True) โ†’ {"accuracy": 0.957, ...}
168
+ sw.stats โ†’ {"total_skills": 141, ...}
169
+ ```
170
+
171
+ ### `FeedbackLearner` โ€” Online weight adjustment
172
+
173
+ ```python
174
+ learner = FeedbackLearner(router)
175
+ learner.route(task, explore=True) # UCB bandit exploration
176
+ learner.record(skill_name, task, success=True,
177
+ dimension_contributions={"semantic": 0.9, ...})
178
+ learner.stats() # weight changes + success rates
179
+ learner.reset() # restore original weights
180
+ ```
181
+
182
+ ### `WeavePlanner` โ€” Multi-skill DAG orchestration
183
+
184
+ ```python
185
+ planner = WeavePlanner(router)
186
+ planner.register_chain_simple("pipeline", ["fetch", "parse", "store"])
187
+ planner.register_chain("ci-cd", ["deploy", "monitor"],
188
+ conditions={1: ("'error' in str(output)", "rollback")})
189
+ planner.plan("run the ci-cd pipeline") โ†’ WeaveChain
190
+ planner.plan_deep("complex task", max_depth=3) โ†’ list[list[str]]
191
+ planner.record_chain_outcome("pipeline", True) # track chain success
192
+ ```
193
+
194
+ ### `annotate` โ€” Skill metadata management
195
+
196
+ ```python
197
+ from skill_weave import annotate_skill, inject_annotations, load_skill_metadata
198
+
199
+ dims = annotate_skill("path/to/SKILL.md") # generate 4-dim metadata
200
+ inject_annotations("path/to/SKILL.md", dims) # write into frontmatter
201
+ skills = load_skill_metadata("/skill/dir") # scan all skill metadata
202
+ ```
203
+
204
+ ---
205
+
206
+ ## ๐Ÿ“Š Real-World Performance
207
+
208
+ Deployed in production routing **141 skills** across **63 categories**:
209
+
210
+ ```
211
+ BM25 only + LLM Re-rank
212
+ Accuracy โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–‘โ–‘ 69.6% โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆ 95.7%
213
+ Tokens 0 ~2K per query
214
+ Latency <50ms ~1s
215
+ ```
216
+
217
+ 23-query benchmark included in the repo (`benchmark/queries.json`).
218
+
219
+ ---
220
+
221
+ ## ๐Ÿ—บ๏ธ Architecture
222
+
223
+ ```
224
+ skill_weave/
225
+ โ”œโ”€โ”€ router.py SkillRouter โ€” 4-dim weighted scoring (zero-dependency)
226
+ โ”œโ”€โ”€ advanced.py SkillWeave โ€” 3-stage pipeline + BM25 + TreeFilter
227
+ โ”œโ”€โ”€ annotate.py Annotation โ€” 4-dim metadata generation + injection
228
+ โ”œโ”€โ”€ learner.py Learning โ€” UCB bandit + gradient weight adjustment
229
+ โ””โ”€โ”€ weaver.py Weaving โ€” DAG orchestration (chains, parallel, conditional)
230
+
231
+ benchmark/queries.json 23 real-world routing test cases
232
+ notebooks/demo.ipynb Colab: try before you read
233
+ tests/ 20 tests, all passing
234
+ ```
235
+
236
+ ---
237
+
238
+ ## ๐Ÿค Contributing
239
+
240
+ Skill Weave is built by **FeiMing Studio** โ€” a small team of humans and AI agents building together.
241
+
242
+ We welcome contributions. Before diving in:
243
+
244
+ 1. **Browse the [Colab demo](https://colab.research.google.com/github/Hxh-yaoxing/skill-weave/blob/main/notebooks/skill_weave_demo.ipynb)** โ€” understand what the project does
245
+ 2. **Read [CONTRIBUTING.md](CONTRIBUTING.md)** โ€” setup, conventions, commit style
246
+ 3. **Open an issue** โ€” discuss before coding large changes
247
+ 4. **Run the tests** โ€” `python tests/test_router.py && python tests/test_learner.py`
248
+
249
+ We use **conventional commits** (`feat:`, `fix:`, `docs:`) and squash-merge to `main`.
250
+
251
+ ### Development Setup
252
+
253
+ ```bash
254
+ git clone https://github.com/Hxh-yaoxing/skill-weave.git
255
+ cd skill-weave
256
+ pip install -e ".[dev]"
257
+ python tests/test_router.py # 9 tests
258
+ python tests/test_learner.py # 11 tests
259
+ ```
260
+
261
+ ---
262
+
263
+ ## ๐Ÿ“Š Status & Roadmap
264
+
265
+ Active development. Core pipeline stable. Used daily in production.
266
+
267
+ | Version | Date | Highlights |
268
+ |---------|------|------------|
269
+ | **0.3.0** | 2026-06-05 | Active learning (UCB), skill weaving (DAG), 20 tests |
270
+ | **0.2.0** | 2026-06-05 | 3-stage pipeline, BM25, TreeFilter, annotation, benchmark |
271
+ | **0.1.0** | 2026-06-05 | Core `SkillRouter` with 4-dim weighted scoring |
272
+
273
+ **Up next:** v0.4 โ€” async routing + embedding backends. [Full changelog โ†’](CHANGELOG.md)
274
+
275
+ ---
276
+
277
+ ## ๐Ÿ‘ฅ Authors
278
+
279
+ | Role | Name |
280
+ |------|------|
281
+ | **Engine & Architecture** | Hermes ๆทฑ่“ ([@Hxh-yaoxing](https://github.com/Hxh-yaoxing)) |
282
+ | **Creative Direction & Co-creation** | ๆ›œ่กŒ (He Xuheng) |
283
+ | **Initial Scaffold** | Hermes ๆฅšไน” |
284
+ | **Infrastructure** | FeiMing Studio |
285
+
286
+ *We're real people (and agents) who iterate fast, communicate openly, and ship on weekends. If you open an issue, a human will respond.*
287
+
288
+ ---
289
+
290
+ ## ๐Ÿ“„ License
291
+
292
+ MIT โ€” use it, fork it, ship it.
293
+
294
+ ---
295
+
296
+ *[FeiMing Studio](https://github.com/Hxh-yaoxing) โ€” where humans and agents build together.*
@@ -0,0 +1,283 @@
1
+ # ๐Ÿงถ Skill Weave
2
+
3
+ **Routing that learns. Chains that self-correct. Zero install to try.**
4
+
5
+ [![Python](https://img.shields.io/badge/python-3.10+-blue)](https://pypi.org/project/skill-weave)
6
+ [![License](https://img.shields.io/badge/license-MIT-green)](LICENSE)
7
+ [![Tests](https://img.shields.io/badge/tests-20%2F20-brightgreen)](tests/)
8
+ [![Release](https://img.shields.io/github/v/release/Hxh-yaoxing/skill-weave)](https://github.com/Hxh-yaoxing/skill-weave/releases)
9
+ [![Colab](https://img.shields.io/badge/โ–ถ%20Try%20Now-Colab-orange)](https://colab.research.google.com/github/Hxh-yaoxing/skill-weave/blob/main/notebooks/skill_weave_demo.ipynb)
10
+
11
+ <br>
12
+
13
+ > **What makes it special:** A three-stage routing pipeline that shrinks 141 candidate skills to 15 *before* any LLM call. An online learner that gets smarter every time you use it. A weaver that chains skills into DAGs instead of picking just one.
14
+ >
15
+ > **95.7% accuracy. 81% fewer tokens. 20 tests. Zero required dependencies.**
16
+
17
+ ---
18
+
19
+ ## ๐Ÿ”ฅ Why This Exists
20
+
21
+ Multi-agent systems drown in their own skills.
22
+
23
+ | Problem | Why It Hurts | How Skill Weave Fixes It |
24
+ |---------|-------------|--------------------------|
25
+ | **Keyword routing** breaks under overlap | "deploy" vs "ssh-deploy" vs "docker-deploy" all match | 4-dim weighted scoring: semantic ร— recency ร— success ร— cost |
26
+ | **Static tables** rot silently | Add/remove one skill, the whole map breaks | Dynamic registration + online learning from every route |
27
+ | **Flat LLM routing** burns tokens | 141 skills = 141 candidates to rank. Every. Single. Time. | 3-stage cascade: Tree Filter (141โ†’15) โ†’ BM25 โ†’ LLM Re-rank |
28
+
29
+ ---
30
+
31
+ ## ๐Ÿ†š How It Compares
32
+
33
+ | Feature | Skill Weave | Keyword Match | LangChain Router | Semantic Kernel |
34
+ |---------|-------------|---------------|------------------|-----------------|
35
+ | Zero-dependency core | โœ… | โœ… | โŒ | โŒ |
36
+ | 3-stage cascade pipeline | โœ… | โŒ | โŒ | โŒ |
37
+ | Online learning from outcomes | โœ… | โŒ | โŒ | โŒ |
38
+ | Multi-skill DAG weaving | โœ… | โŒ | โŒ | โŒ |
39
+ | Chinese-English synonym match | โœ… | โŒ | โŒ | โŒ |
40
+ | Production-tested (141 skills) | โœ… | โ€” | โ€” | โ€” |
41
+ | Token cost per route | 0โ€“2K | 0 | โˆž (flat) | โˆž (flat) |
42
+
43
+ > **Bottom line:** Keyword matching is fast but brittle. LangChain/SK handle semantics but burn tokens on every call. Skill Weave does both โ€” cascade filtering + semantic re-rank โ€” with learning on top.
44
+
45
+ ---
46
+
47
+ ## ๐ŸŽฎ Try It Now
48
+
49
+ No install. No API key. 10 seconds.
50
+
51
+ [![Open in Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/Hxh-yaoxing/skill-weave/blob/main/notebooks/skill_weave_demo.ipynb)
52
+
53
+ Four interactive demos: basic routing โ†’ active learning โ†’ skill weaving โ†’ multi-plan comparison.
54
+
55
+ ---
56
+
57
+ ## ๐Ÿ“ฆ Install
58
+
59
+ ```bash
60
+ # From GitHub (recommended until PyPI listing is complete)
61
+ pip install git+https://github.com/Hxh-yaoxing/skill-weave.git
62
+
63
+ # Coming soon: pip install skill-weave
64
+ ```
65
+
66
+ ---
67
+
68
+ ## โšก 30-Second Quick Start
69
+
70
+ ```python
71
+ from skill_weave import SkillRouter
72
+
73
+ router = SkillRouter()
74
+ router.register_skill("deploy", metadata="deploy to production, handle rollback")
75
+ router.register_skill("monitor", metadata="monitor health metrics, alert on anomalies")
76
+ router.register_skill("rollback", metadata="revert failed deployments")
77
+
78
+ results = router.route("The new deploy broke everything, we need to go back")
79
+ for r in results:
80
+ print(f"{r.skill.name}: {r.score:.2f}")
81
+ # โ†’ rollback: 0.68
82
+ # โ†’ deploy: 0.54
83
+ # โ†’ monitor: 0.42
84
+ ```
85
+
86
+ *It chose `rollback` โ€” even though the query never said "rollback". That's semantic routing.*
87
+
88
+ ---
89
+
90
+ ## ๐Ÿง  The Pipeline
91
+
92
+ ```mermaid
93
+ flowchart TD
94
+ TASK["๐Ÿ’ฌ Task: 'deploy broke, revert now'"]
95
+
96
+ TASK --> L1
97
+
98
+ subgraph L1["L1: Tree Filter (zero token)"]
99
+ T1["'deploy' โ†’ infrastructure โ†’ 37 matches"]
100
+ T2["'revert' โ†’ narrows to 4 candidates"]
101
+ T1 --> T2
102
+ end
103
+
104
+ L1 --> L2
105
+
106
+ subgraph L2["L2: BM25 Rank (<50ms)"]
107
+ B1["Statistical scoring over 4 candidates"]
108
+ B2["rollback: 0.68 | deploy: 0.54"]
109
+ B1 --> B2
110
+ end
111
+
112
+ L2 --> L3
113
+
114
+ subgraph L3["L3: LLM Re-rank (optional, ~1s)"]
115
+ R1["Semantic understanding over top ~10"]
116
+ R2["Accuracy: 69.6% โ†’ 95.7%"]
117
+ R1 --> R2
118
+ end
119
+
120
+ L3 --> OUTPUT["โœ… rollback (score: 0.92)"]
121
+ ```
122
+
123
+ | Stage | What It Does | Token Cost | Latency |
124
+ |-------|-------------|------------|---------|
125
+ | **L1: Tree Filter** | Hierarchy + synonym match โ†’ narrows 141โ†’~15 | **0** | <1ms |
126
+ | **L2: BM25** | Character 2-gram (ไธญๆ–‡) + word-level (EN) retrieval | **0** | <50ms |
127
+ | **L3: LLM Re-rank** | Deep semantic reasoning over ~10 candidates | ~2K | ~1s |
128
+
129
+ ---
130
+
131
+ ## ๐Ÿ“– API Reference
132
+
133
+ ### `SkillRouter` โ€” Zero-dependency core
134
+
135
+ ```python
136
+ router = SkillRouter(
137
+ alpha=0.45, # semantic weight
138
+ beta=0.20, # recency weight
139
+ gamma=0.25, # success rate weight
140
+ delta=0.10, # cost weight
141
+ )
142
+ router.register_skill(name, metadata="...", tags=[...], avg_cost=1.0)
143
+ router.unregister_skill(name)
144
+ router.route(task, top_k=5, max_cost=None, tags_filter=None) โ†’ list[RouteResult]
145
+ router.record_outcome(skill_name, success=True, cost=1.0)
146
+ router.skills โ†’ dict[str, Skill]
147
+ ```
148
+
149
+ ### `SkillWeave` โ€” Production 3-stage pipeline
150
+
151
+ ```python
152
+ sw = SkillWeave(skill_dir="/path/to/skills", llm_rank_fn=my_llm_fn)
153
+ sw.route(query, top_k=5, exclude_tier3=True) โ†’ list[dict]
154
+ sw.run_benchmark(queries, verbose=True) โ†’ {"accuracy": 0.957, ...}
155
+ sw.stats โ†’ {"total_skills": 141, ...}
156
+ ```
157
+
158
+ ### `FeedbackLearner` โ€” Online weight adjustment
159
+
160
+ ```python
161
+ learner = FeedbackLearner(router)
162
+ learner.route(task, explore=True) # UCB bandit exploration
163
+ learner.record(skill_name, task, success=True,
164
+ dimension_contributions={"semantic": 0.9, ...})
165
+ learner.stats() # weight changes + success rates
166
+ learner.reset() # restore original weights
167
+ ```
168
+
169
+ ### `WeavePlanner` โ€” Multi-skill DAG orchestration
170
+
171
+ ```python
172
+ planner = WeavePlanner(router)
173
+ planner.register_chain_simple("pipeline", ["fetch", "parse", "store"])
174
+ planner.register_chain("ci-cd", ["deploy", "monitor"],
175
+ conditions={1: ("'error' in str(output)", "rollback")})
176
+ planner.plan("run the ci-cd pipeline") โ†’ WeaveChain
177
+ planner.plan_deep("complex task", max_depth=3) โ†’ list[list[str]]
178
+ planner.record_chain_outcome("pipeline", True) # track chain success
179
+ ```
180
+
181
+ ### `annotate` โ€” Skill metadata management
182
+
183
+ ```python
184
+ from skill_weave import annotate_skill, inject_annotations, load_skill_metadata
185
+
186
+ dims = annotate_skill("path/to/SKILL.md") # generate 4-dim metadata
187
+ inject_annotations("path/to/SKILL.md", dims) # write into frontmatter
188
+ skills = load_skill_metadata("/skill/dir") # scan all skill metadata
189
+ ```
190
+
191
+ ---
192
+
193
+ ## ๐Ÿ“Š Real-World Performance
194
+
195
+ Deployed in production routing **141 skills** across **63 categories**:
196
+
197
+ ```
198
+ BM25 only + LLM Re-rank
199
+ Accuracy โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–‘โ–‘ 69.6% โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆ 95.7%
200
+ Tokens 0 ~2K per query
201
+ Latency <50ms ~1s
202
+ ```
203
+
204
+ 23-query benchmark included in the repo (`benchmark/queries.json`).
205
+
206
+ ---
207
+
208
+ ## ๐Ÿ—บ๏ธ Architecture
209
+
210
+ ```
211
+ skill_weave/
212
+ โ”œโ”€โ”€ router.py SkillRouter โ€” 4-dim weighted scoring (zero-dependency)
213
+ โ”œโ”€โ”€ advanced.py SkillWeave โ€” 3-stage pipeline + BM25 + TreeFilter
214
+ โ”œโ”€โ”€ annotate.py Annotation โ€” 4-dim metadata generation + injection
215
+ โ”œโ”€โ”€ learner.py Learning โ€” UCB bandit + gradient weight adjustment
216
+ โ””โ”€โ”€ weaver.py Weaving โ€” DAG orchestration (chains, parallel, conditional)
217
+
218
+ benchmark/queries.json 23 real-world routing test cases
219
+ notebooks/demo.ipynb Colab: try before you read
220
+ tests/ 20 tests, all passing
221
+ ```
222
+
223
+ ---
224
+
225
+ ## ๐Ÿค Contributing
226
+
227
+ Skill Weave is built by **FeiMing Studio** โ€” a small team of humans and AI agents building together.
228
+
229
+ We welcome contributions. Before diving in:
230
+
231
+ 1. **Browse the [Colab demo](https://colab.research.google.com/github/Hxh-yaoxing/skill-weave/blob/main/notebooks/skill_weave_demo.ipynb)** โ€” understand what the project does
232
+ 2. **Read [CONTRIBUTING.md](CONTRIBUTING.md)** โ€” setup, conventions, commit style
233
+ 3. **Open an issue** โ€” discuss before coding large changes
234
+ 4. **Run the tests** โ€” `python tests/test_router.py && python tests/test_learner.py`
235
+
236
+ We use **conventional commits** (`feat:`, `fix:`, `docs:`) and squash-merge to `main`.
237
+
238
+ ### Development Setup
239
+
240
+ ```bash
241
+ git clone https://github.com/Hxh-yaoxing/skill-weave.git
242
+ cd skill-weave
243
+ pip install -e ".[dev]"
244
+ python tests/test_router.py # 9 tests
245
+ python tests/test_learner.py # 11 tests
246
+ ```
247
+
248
+ ---
249
+
250
+ ## ๐Ÿ“Š Status & Roadmap
251
+
252
+ Active development. Core pipeline stable. Used daily in production.
253
+
254
+ | Version | Date | Highlights |
255
+ |---------|------|------------|
256
+ | **0.3.0** | 2026-06-05 | Active learning (UCB), skill weaving (DAG), 20 tests |
257
+ | **0.2.0** | 2026-06-05 | 3-stage pipeline, BM25, TreeFilter, annotation, benchmark |
258
+ | **0.1.0** | 2026-06-05 | Core `SkillRouter` with 4-dim weighted scoring |
259
+
260
+ **Up next:** v0.4 โ€” async routing + embedding backends. [Full changelog โ†’](CHANGELOG.md)
261
+
262
+ ---
263
+
264
+ ## ๐Ÿ‘ฅ Authors
265
+
266
+ | Role | Name |
267
+ |------|------|
268
+ | **Engine & Architecture** | Hermes ๆทฑ่“ ([@Hxh-yaoxing](https://github.com/Hxh-yaoxing)) |
269
+ | **Creative Direction & Co-creation** | ๆ›œ่กŒ (He Xuheng) |
270
+ | **Initial Scaffold** | Hermes ๆฅšไน” |
271
+ | **Infrastructure** | FeiMing Studio |
272
+
273
+ *We're real people (and agents) who iterate fast, communicate openly, and ship on weekends. If you open an issue, a human will respond.*
274
+
275
+ ---
276
+
277
+ ## ๐Ÿ“„ License
278
+
279
+ MIT โ€” use it, fork it, ship it.
280
+
281
+ ---
282
+
283
+ *[FeiMing Studio](https://github.com/Hxh-yaoxing) โ€” where humans and agents build together.*
@@ -0,0 +1,24 @@
1
+ [build-system]
2
+ requires = ["setuptools>=68.0", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "skill-weave"
7
+ version = "0.3.0"
8
+ description = "Adaptive skill routing for multi-agent systems"
9
+ readme = "README.md"
10
+ license = "MIT"
11
+ requires-python = ">=3.10"
12
+ authors = [
13
+ {name = "FeiMing Studio"},
14
+ ]
15
+
16
+ [project.urls]
17
+ Homepage = "https://github.com/Hxh-yaoxing/skill-weave"
18
+ Repository = "https://github.com/Hxh-yaoxing/skill-weave"
19
+
20
+ [tool.setuptools.packages.find]
21
+ include = ["skill_weave*"]
22
+
23
+ [tool.pytest.ini_options]
24
+ testpaths = ["tests"]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,56 @@
1
+ """Skill Weave โ€” Adaptive skill routing for multi-agent systems.
2
+
3
+ Core router: 4-dimension weighted scoring (semantic ร— recency ร— success ร— cost).
4
+ Advanced router: 3-stage pipeline (Tree Filter โ†’ BM25 โ†’ LLM Re-rank).
5
+ Active learning: online weight adjustment via bandit + gradient feedback.
6
+ Skill weaving: multi-skill DAG orchestration (chains, parallel, conditional).
7
+
8
+ Production-proven with 141 real-world skills, 95.7% benchmark accuracy.
9
+ """
10
+
11
+ from .router import Skill, RouteResult, SkillRouter
12
+
13
+ # Lazy imports for optional heavy dependencies
14
+ __all__ = [
15
+ "SkillRouter",
16
+ "SkillWeave",
17
+ "Skill",
18
+ "RouteResult",
19
+ "TreeFilter",
20
+ "BM25Scorer",
21
+ "FeedbackLearner",
22
+ "WeavePlanner",
23
+ "WeaveNode",
24
+ "WeaveEdge",
25
+ "WeaveChain",
26
+ "MergeStrategy",
27
+ "NodeType",
28
+ "annotate_skill",
29
+ "inject_annotations",
30
+ "load_skill_metadata",
31
+ ]
32
+
33
+ __version__ = "0.3.0"
34
+
35
+
36
+ def __getattr__(name: str):
37
+ if name == "SkillWeave":
38
+ from .advanced import SkillWeave as _SkillWeave
39
+ return _SkillWeave
40
+ if name == "TreeFilter":
41
+ from .advanced import TreeFilter as _TreeFilter
42
+ return _TreeFilter
43
+ if name == "BM25Scorer":
44
+ from .advanced import BM25Scorer as _BM25Scorer
45
+ return _BM25Scorer
46
+ if name in ("annotate_skill", "inject_annotations", "load_skill_metadata"):
47
+ from . import annotate as _annotate
48
+ return getattr(_annotate, name)
49
+ if name == "FeedbackLearner":
50
+ from .learner import FeedbackLearner as _FeedbackLearner
51
+ return _FeedbackLearner
52
+ if name in ("WeavePlanner", "WeaveNode", "WeaveEdge", "WeaveChain",
53
+ "MergeStrategy", "NodeType"):
54
+ from . import weaver as _weaver
55
+ return getattr(_weaver, name)
56
+ raise AttributeError(f"module 'skill_weave' has no attribute {name!r}")