Sync ctx d07ce54bd2f1
Browse files- README.md +2 -2
- mkdocs.yml +2 -2
- skills/find-skills/SKILL.md +65 -65
- skills/repo-stats-autoupdate/SKILL.md +56 -56
- skills/skill-router/SKILL.md +37 -37
- skills/skill-router/references/01-scope.md +31 -31
- skills/skill-router/references/02-plan.md +34 -34
- skills/skill-router/references/03-build.md +38 -38
- skills/skill-router/references/04-check.md +28 -28
- skills/skill-router/references/05-deliver.md +34 -34
- skills/toolbox/SKILL.md +61 -61
- src/tests/test_update_repo_stats.py +37 -11
- src/update_repo_stats.py +39 -17
README.md
CHANGED
|
@@ -1,5 +1,6 @@
|
|
| 1 |
---
|
| 2 |
license: mit
|
|
|
|
| 3 |
tags:
|
| 4 |
- agents
|
| 5 |
- mcp
|
|
@@ -10,7 +11,6 @@ tags:
|
|
| 10 |
- harness
|
| 11 |
- codex
|
| 12 |
- claude-code
|
| 13 |
-
pretty_name: ctx
|
| 14 |
---
|
| 15 |
|
| 16 |
# ctx — Skill, Agent, MCP & Harness Catalog
|
|
@@ -18,7 +18,7 @@ pretty_name: ctx
|
|
| 18 |
[](LICENSE)
|
| 19 |
[](https://python.org)
|
| 20 |
[](https://pypi.org/project/claude-ctx/)
|
| 21 |
-
[](graph/)
|
| 23 |
[](https://stevesolun.github.io/ctx/)
|
| 24 |
|
|
|
|
| 1 |
---
|
| 2 |
license: mit
|
| 3 |
+
pretty_name: ctx
|
| 4 |
tags:
|
| 5 |
- agents
|
| 6 |
- mcp
|
|
|
|
| 11 |
- harness
|
| 12 |
- codex
|
| 13 |
- claude-code
|
|
|
|
| 14 |
---
|
| 15 |
|
| 16 |
# ctx — Skill, Agent, MCP & Harness Catalog
|
|
|
|
| 18 |
[](LICENSE)
|
| 19 |
[](https://python.org)
|
| 20 |
[](https://pypi.org/project/claude-ctx/)
|
| 21 |
+
[](#)
|
| 22 |
[](graph/)
|
| 23 |
[](https://stevesolun.github.io/ctx/)
|
| 24 |
|
mkdocs.yml
CHANGED
|
@@ -21,8 +21,8 @@ strict: true
|
|
| 21 |
# in the rendered nav; the skill-router section summarizes it.
|
| 22 |
not_in_nav: |
|
| 23 |
SKILL.md
|
| 24 |
-
|
| 25 |
-
theme:
|
| 26 |
name: material
|
| 27 |
features:
|
| 28 |
- navigation.instant
|
|
|
|
| 21 |
# in the rendered nav; the skill-router section summarizes it.
|
| 22 |
not_in_nav: |
|
| 23 |
SKILL.md
|
| 24 |
+
|
| 25 |
+
theme:
|
| 26 |
name: material
|
| 27 |
features:
|
| 28 |
- navigation.instant
|
skills/find-skills/SKILL.md
CHANGED
|
@@ -1,65 +1,65 @@
|
|
| 1 |
-
---
|
| 2 |
-
name: find-skills
|
| 3 |
-
description: Discover installable agent skills from ctx's shipped Skills.sh catalog, the Skills.sh search API, and the npx skills CLI. Use when a user asks whether a skill exists, wants to add/update a skill, or needs a repeatable procedure for finding candidate skills safely.
|
| 4 |
-
---
|
| 5 |
-
|
| 6 |
-
# Find Skills
|
| 7 |
-
|
| 8 |
-
Use this when the user wants a skill recommendation or when ctx's curated graph
|
| 9 |
-
does not already contain the capability they need.
|
| 10 |
-
|
| 11 |
-
## Source Of Truth
|
| 12 |
-
|
| 13 |
-
1. Query ctx first: use the shared recommendation surface so curated skills,
|
| 14 |
-
agents, MCP servers, harnesses, and the shipped Skills.sh external catalog are
|
| 15 |
-
ranked together.
|
| 16 |
-
2. If ctx is stale or too narrow, search upstream:
|
| 17 |
-
|
| 18 |
-
```bash
|
| 19 |
-
npx skills find "<query>"
|
| 20 |
-
```
|
| 21 |
-
|
| 22 |
-
3. For the upstream discovery skill itself, the canonical install command is:
|
| 23 |
-
|
| 24 |
-
```bash
|
| 25 |
-
npx skills add https://github.com/vercel-labs/skills --skill find-skills
|
| 26 |
-
```
|
| 27 |
-
|
| 28 |
-
## Recommendation Checklist
|
| 29 |
-
|
| 30 |
-
Before recommending or installing an upstream skill:
|
| 31 |
-
|
| 32 |
-
- Prefer official or high-reputation sources.
|
| 33 |
-
- Check install count, upstream repo activity, and whether a license is present.
|
| 34 |
-
- Read the skill body before installing; never rely only on search rank.
|
| 35 |
-
- Run the security review below for new or updated skills.
|
| 36 |
-
- If a matching ctx entity already exists, use the update-review flow and compare
|
| 37 |
-
benefits, risks, lost tags/capabilities, and security findings before replacing
|
| 38 |
-
anything.
|
| 39 |
-
|
| 40 |
-
## Security Review
|
| 41 |
-
|
| 42 |
-
Flag the candidate for manual review if it asks the agent to:
|
| 43 |
-
|
| 44 |
-
- Run network-fetched shell code, such as `curl ... | sh`, `wget ... | bash`, or
|
| 45 |
-
`Invoke-Expression`.
|
| 46 |
-
- Exfiltrate secrets or environment variables.
|
| 47 |
-
- Disable tests, lint, CI, permissions, sandboxing, auth, TLS, or audit logging.
|
| 48 |
-
- Run destructive commands such as `rm -rf`, `git reset --hard`, or broad file
|
| 49 |
-
deletion without a scoped path.
|
| 50 |
-
- Install packages or tools from unpinned, unknown, or typo-squatted sources.
|
| 51 |
-
|
| 52 |
-
Do not install or import a flagged skill automatically. Present the user with
|
| 53 |
-
the exact concern, the likely benefit, the safer alternative, and the explicit
|
| 54 |
-
command they would need to approve.
|
| 55 |
-
|
| 56 |
-
## Updating ctx
|
| 57 |
-
|
| 58 |
-
When adding accepted skills to ctx itself:
|
| 59 |
-
|
| 60 |
-
1. Add or update the source skill file.
|
| 61 |
-
2. Run `ctx-skill-add --skill-path <path>/SKILL.md --name <slug>`.
|
| 62 |
-
3. Run `ctx-wiki-graphify`.
|
| 63 |
-
4. Repack `graph/wiki-graph.tar.gz` and refresh repo stats.
|
| 64 |
-
5. Verify with `ctx-scan-repo --repo . --recommend` or
|
| 65 |
-
`ctx__recommend_bundle` for a query that should return the skill.
|
|
|
|
| 1 |
+
---
|
| 2 |
+
name: find-skills
|
| 3 |
+
description: Discover installable agent skills from ctx's shipped Skills.sh catalog, the Skills.sh search API, and the npx skills CLI. Use when a user asks whether a skill exists, wants to add/update a skill, or needs a repeatable procedure for finding candidate skills safely.
|
| 4 |
+
---
|
| 5 |
+
|
| 6 |
+
# Find Skills
|
| 7 |
+
|
| 8 |
+
Use this when the user wants a skill recommendation or when ctx's curated graph
|
| 9 |
+
does not already contain the capability they need.
|
| 10 |
+
|
| 11 |
+
## Source Of Truth
|
| 12 |
+
|
| 13 |
+
1. Query ctx first: use the shared recommendation surface so curated skills,
|
| 14 |
+
agents, MCP servers, harnesses, and the shipped Skills.sh external catalog are
|
| 15 |
+
ranked together.
|
| 16 |
+
2. If ctx is stale or too narrow, search upstream:
|
| 17 |
+
|
| 18 |
+
```bash
|
| 19 |
+
npx skills find "<query>"
|
| 20 |
+
```
|
| 21 |
+
|
| 22 |
+
3. For the upstream discovery skill itself, the canonical install command is:
|
| 23 |
+
|
| 24 |
+
```bash
|
| 25 |
+
npx skills add https://github.com/vercel-labs/skills --skill find-skills
|
| 26 |
+
```
|
| 27 |
+
|
| 28 |
+
## Recommendation Checklist
|
| 29 |
+
|
| 30 |
+
Before recommending or installing an upstream skill:
|
| 31 |
+
|
| 32 |
+
- Prefer official or high-reputation sources.
|
| 33 |
+
- Check install count, upstream repo activity, and whether a license is present.
|
| 34 |
+
- Read the skill body before installing; never rely only on search rank.
|
| 35 |
+
- Run the security review below for new or updated skills.
|
| 36 |
+
- If a matching ctx entity already exists, use the update-review flow and compare
|
| 37 |
+
benefits, risks, lost tags/capabilities, and security findings before replacing
|
| 38 |
+
anything.
|
| 39 |
+
|
| 40 |
+
## Security Review
|
| 41 |
+
|
| 42 |
+
Flag the candidate for manual review if it asks the agent to:
|
| 43 |
+
|
| 44 |
+
- Run network-fetched shell code, such as `curl ... | sh`, `wget ... | bash`, or
|
| 45 |
+
`Invoke-Expression`.
|
| 46 |
+
- Exfiltrate secrets or environment variables.
|
| 47 |
+
- Disable tests, lint, CI, permissions, sandboxing, auth, TLS, or audit logging.
|
| 48 |
+
- Run destructive commands such as `rm -rf`, `git reset --hard`, or broad file
|
| 49 |
+
deletion without a scoped path.
|
| 50 |
+
- Install packages or tools from unpinned, unknown, or typo-squatted sources.
|
| 51 |
+
|
| 52 |
+
Do not install or import a flagged skill automatically. Present the user with
|
| 53 |
+
the exact concern, the likely benefit, the safer alternative, and the explicit
|
| 54 |
+
command they would need to approve.
|
| 55 |
+
|
| 56 |
+
## Updating ctx
|
| 57 |
+
|
| 58 |
+
When adding accepted skills to ctx itself:
|
| 59 |
+
|
| 60 |
+
1. Add or update the source skill file.
|
| 61 |
+
2. Run `ctx-skill-add --skill-path <path>/SKILL.md --name <slug>`.
|
| 62 |
+
3. Run `ctx-wiki-graphify`.
|
| 63 |
+
4. Repack `graph/wiki-graph.tar.gz` and refresh repo stats.
|
| 64 |
+
5. Verify with `ctx-scan-repo --repo . --recommend` or
|
| 65 |
+
`ctx__recommend_bundle` for a query that should return the skill.
|
skills/repo-stats-autoupdate/SKILL.md
CHANGED
|
@@ -1,56 +1,56 @@
|
|
| 1 |
-
---
|
| 2 |
-
name: repo-stats-autoupdate
|
| 3 |
-
description: Keeps README badge + inline counts in sync with the real number of skills, agents, graph nodes/edges, communities, converted pipelines, and pytest tests. Runs automatically on every commit via a git pre-commit hook. Use when the README drifts from reality or before publishing a release.
|
| 4 |
-
type: maintenance
|
| 5 |
-
priority: 30
|
| 6 |
-
always_load: false
|
| 7 |
-
---
|
| 8 |
-
|
| 9 |
-
# repo-stats-autoupdate
|
| 10 |
-
|
| 11 |
-
## What this skill does
|
| 12 |
-
|
| 13 |
-
Reads the **authoritative sources** for the ctx repo's key numbers and patches `README.md` in place so badges and inline counts never drift:
|
| 14 |
-
|
| 15 |
-
| Number | Source of truth |
|
| 16 |
-
|---|---|
|
| 17 |
-
| Skills | `~/.claude/skill-wiki/graphify-out/graph.json` — count nodes where `type == "skill"` |
|
| 18 |
-
| Agents | same file — count nodes where `type == "agent"` |
|
| 19 |
-
| Graph nodes | `len(graph["nodes"])` |
|
| 20 |
-
| Graph edges | `len(graph["edges"])`, formatted as `642K` / `1.2M` |
|
| 21 |
-
| Communities | `graph/communities.json` → `total_communities` |
|
| 22 |
-
| Converted pipelines | `~/.claude/skill-wiki/converted/` subdir count |
|
| 23 |
-
| Tests | `pytest --collect-only -q` from `src/` |
|
| 24 |
-
|
| 25 |
-
Fields that can't be resolved (e.g. wiki not deployed) are left untouched — the updater never blocks a commit.
|
| 26 |
-
|
| 27 |
-
## How to use it
|
| 28 |
-
|
| 29 |
-
**One-time install (per clone):**
|
| 30 |
-
```bash
|
| 31 |
-
git config core.hooksPath .githooks
|
| 32 |
-
```
|
| 33 |
-
|
| 34 |
-
After that, every `git commit` runs `.githooks/pre-commit` which calls the updater and re-stages `README.md` if any number drifted.
|
| 35 |
-
|
| 36 |
-
**Manual run:**
|
| 37 |
-
```bash
|
| 38 |
-
python src/update_repo_stats.py # patch README
|
| 39 |
-
python src/update_repo_stats.py --check # exit 1 if stale (for CI)
|
| 40 |
-
```
|
| 41 |
-
|
| 42 |
-
## When NOT to use it
|
| 43 |
-
|
| 44 |
-
- When you've deliberately phrased a number descriptively (e.g. "over 1,700 skills") — the regex patterns only match exact digits, so prose phrasings are safe, but double-check after big imports.
|
| 45 |
-
- When the wiki isn't deployed locally. The updater degrades gracefully: it prints a warning and skips fields it can't resolve. It does **not** invent numbers.
|
| 46 |
-
|
| 47 |
-
## Known gaps (intentionally out of scope)
|
| 48 |
-
|
| 49 |
-
- **Does not rebuild the graph or wiki.** Rebuilding `graph/wiki-graph.tar.gz` takes minutes and churns a 159 MB tree — too heavy for per-commit. Run `python src/wiki_graphify.py` and repack the tarball manually when the skill catalog changes materially.
|
| 50 |
-
- **Does not verify graph integrity.** If `graphify-out/graph.json` is corrupt, you'll get junk numbers. Run the wiki health check (`python src/wiki_orchestrator.py --check`) separately.
|
| 51 |
-
|
| 52 |
-
## Related files
|
| 53 |
-
|
| 54 |
-
- [src/update_repo_stats.py](../../src/update_repo_stats.py) — the worker
|
| 55 |
-
- [.githooks/pre-commit](../../.githooks/pre-commit) — the per-commit trigger
|
| 56 |
-
- `README.md` — the target being kept in sync
|
|
|
|
| 1 |
+
---
|
| 2 |
+
name: repo-stats-autoupdate
|
| 3 |
+
description: Keeps README badge + inline counts in sync with the real number of skills, agents, graph nodes/edges, communities, converted pipelines, and pytest tests. Runs automatically on every commit via a git pre-commit hook. Use when the README drifts from reality or before publishing a release.
|
| 4 |
+
type: maintenance
|
| 5 |
+
priority: 30
|
| 6 |
+
always_load: false
|
| 7 |
+
---
|
| 8 |
+
|
| 9 |
+
# repo-stats-autoupdate
|
| 10 |
+
|
| 11 |
+
## What this skill does
|
| 12 |
+
|
| 13 |
+
Reads the **authoritative sources** for the ctx repo's key numbers and patches `README.md` in place so badges and inline counts never drift:
|
| 14 |
+
|
| 15 |
+
| Number | Source of truth |
|
| 16 |
+
|---|---|
|
| 17 |
+
| Skills | `~/.claude/skill-wiki/graphify-out/graph.json` — count nodes where `type == "skill"` |
|
| 18 |
+
| Agents | same file — count nodes where `type == "agent"` |
|
| 19 |
+
| Graph nodes | `len(graph["nodes"])` |
|
| 20 |
+
| Graph edges | `len(graph["edges"])`, formatted as `642K` / `1.2M` |
|
| 21 |
+
| Communities | `graph/communities.json` → `total_communities` |
|
| 22 |
+
| Converted pipelines | `~/.claude/skill-wiki/converted/` subdir count |
|
| 23 |
+
| Tests | `pytest --collect-only -q` from `src/` |
|
| 24 |
+
|
| 25 |
+
Fields that can't be resolved (e.g. wiki not deployed) are left untouched — the updater never blocks a commit.
|
| 26 |
+
|
| 27 |
+
## How to use it
|
| 28 |
+
|
| 29 |
+
**One-time install (per clone):**
|
| 30 |
+
```bash
|
| 31 |
+
git config core.hooksPath .githooks
|
| 32 |
+
```
|
| 33 |
+
|
| 34 |
+
After that, every `git commit` runs `.githooks/pre-commit` which calls the updater and re-stages `README.md` if any number drifted.
|
| 35 |
+
|
| 36 |
+
**Manual run:**
|
| 37 |
+
```bash
|
| 38 |
+
python src/update_repo_stats.py # patch README
|
| 39 |
+
python src/update_repo_stats.py --check # exit 1 if stale (for CI)
|
| 40 |
+
```
|
| 41 |
+
|
| 42 |
+
## When NOT to use it
|
| 43 |
+
|
| 44 |
+
- When you've deliberately phrased a number descriptively (e.g. "over 1,700 skills") — the regex patterns only match exact digits, so prose phrasings are safe, but double-check after big imports.
|
| 45 |
+
- When the wiki isn't deployed locally. The updater degrades gracefully: it prints a warning and skips fields it can't resolve. It does **not** invent numbers.
|
| 46 |
+
|
| 47 |
+
## Known gaps (intentionally out of scope)
|
| 48 |
+
|
| 49 |
+
- **Does not rebuild the graph or wiki.** Rebuilding `graph/wiki-graph.tar.gz` takes minutes and churns a 159 MB tree — too heavy for per-commit. Run `python src/wiki_graphify.py` and repack the tarball manually when the skill catalog changes materially.
|
| 50 |
+
- **Does not verify graph integrity.** If `graphify-out/graph.json` is corrupt, you'll get junk numbers. Run the wiki health check (`python src/wiki_orchestrator.py --check`) separately.
|
| 51 |
+
|
| 52 |
+
## Related files
|
| 53 |
+
|
| 54 |
+
- [src/update_repo_stats.py](../../src/update_repo_stats.py) — the worker
|
| 55 |
+
- [.githooks/pre-commit](../../.githooks/pre-commit) — the per-commit trigger
|
| 56 |
+
- `README.md` — the target being kept in sync
|
skills/skill-router/SKILL.md
CHANGED
|
@@ -1,37 +1,37 @@
|
|
| 1 |
-
---
|
| 2 |
-
name: skill-router
|
| 3 |
-
description: Alive skill router — reads the current project's stack and loads/unloads skills dynamically. Invoke at session start or when project context changes.
|
| 4 |
-
type: meta
|
| 5 |
-
priority: 99
|
| 6 |
-
always_load: true
|
| 7 |
-
---
|
| 8 |
-
|
| 9 |
-
# skill-router
|
| 10 |
-
|
| 11 |
-
Reads `~/.claude/skill-manifest.json` and `~/.claude/pending-skills.json`.
|
| 12 |
-
Executes the 5-stage pipeline. **No skipping stages.**
|
| 13 |
-
|
| 14 |
-
## Pipeline
|
| 15 |
-
|
| 16 |
-
```
|
| 17 |
-
01-scope → 02-plan → 03-build → 04-check → 05-deliver
|
| 18 |
-
```
|
| 19 |
-
|
| 20 |
-
## Invoke When
|
| 21 |
-
|
| 22 |
-
- Session starts (automatic via using-superpowers pattern)
|
| 23 |
-
- User switches projects or opens a new repo
|
| 24 |
-
- `pending-skills.json` exists (mid-session signals detected)
|
| 25 |
-
- User asks "what skills are loaded?" or "update my skills"
|
| 26 |
-
|
| 27 |
-
## Stage Files
|
| 28 |
-
|
| 29 |
-
All stage files are in `references/`. Read and follow each in order.
|
| 30 |
-
|
| 31 |
-
1. **[01-scope](references/01-scope.md)** — Is a scan needed?
|
| 32 |
-
2. **[02-plan](references/02-plan.md)** — Run the scanner
|
| 33 |
-
3. **[03-build](references/03-build.md)** — Resolve the manifest
|
| 34 |
-
4. **[04-check](references/04-check.md)** — Validate before loading
|
| 35 |
-
5. **[05-deliver](references/05-deliver.md)** — Present to user
|
| 36 |
-
|
| 37 |
-
See [check-gates.md](check-gates.md) for validation questions.
|
|
|
|
| 1 |
+
---
|
| 2 |
+
name: skill-router
|
| 3 |
+
description: Alive skill router — reads the current project's stack and loads/unloads skills dynamically. Invoke at session start or when project context changes.
|
| 4 |
+
type: meta
|
| 5 |
+
priority: 99
|
| 6 |
+
always_load: true
|
| 7 |
+
---
|
| 8 |
+
|
| 9 |
+
# skill-router
|
| 10 |
+
|
| 11 |
+
Reads `~/.claude/skill-manifest.json` and `~/.claude/pending-skills.json`.
|
| 12 |
+
Executes the 5-stage pipeline. **No skipping stages.**
|
| 13 |
+
|
| 14 |
+
## Pipeline
|
| 15 |
+
|
| 16 |
+
```
|
| 17 |
+
01-scope → 02-plan → 03-build → 04-check → 05-deliver
|
| 18 |
+
```
|
| 19 |
+
|
| 20 |
+
## Invoke When
|
| 21 |
+
|
| 22 |
+
- Session starts (automatic via using-superpowers pattern)
|
| 23 |
+
- User switches projects or opens a new repo
|
| 24 |
+
- `pending-skills.json` exists (mid-session signals detected)
|
| 25 |
+
- User asks "what skills are loaded?" or "update my skills"
|
| 26 |
+
|
| 27 |
+
## Stage Files
|
| 28 |
+
|
| 29 |
+
All stage files are in `references/`. Read and follow each in order.
|
| 30 |
+
|
| 31 |
+
1. **[01-scope](references/01-scope.md)** — Is a scan needed?
|
| 32 |
+
2. **[02-plan](references/02-plan.md)** — Run the scanner
|
| 33 |
+
3. **[03-build](references/03-build.md)** — Resolve the manifest
|
| 34 |
+
4. **[04-check](references/04-check.md)** — Validate before loading
|
| 35 |
+
5. **[05-deliver](references/05-deliver.md)** — Present to user
|
| 36 |
+
|
| 37 |
+
See [check-gates.md](check-gates.md) for validation questions.
|
skills/skill-router/references/01-scope.md
CHANGED
|
@@ -1,31 +1,31 @@
|
|
| 1 |
-
# Stage 1: Scope — Is a Scan Needed?
|
| 2 |
-
|
| 3 |
-
Determine which action to take before spending tokens on a full scan.
|
| 4 |
-
|
| 5 |
-
## Check Order
|
| 6 |
-
|
| 7 |
-
1. **Read** `~/.claude/pending-skills.json`
|
| 8 |
-
- If exists and `generated_at` is < 2 hours old → action = `apply_pending`
|
| 9 |
-
- Delete the file after reading (it is one-shot)
|
| 10 |
-
|
| 11 |
-
2. **Read** `~/.claude/skill-manifest.json`
|
| 12 |
-
- Extract `repo_path` and `generated_at`
|
| 13 |
-
- If `repo_path` ≠ current working directory → action = `full_scan`
|
| 14 |
-
- If `generated_at` > 1 hour ago → action = `full_scan`
|
| 15 |
-
- Otherwise → action = `use_cached`
|
| 16 |
-
|
| 17 |
-
3. **If no manifest exists** → action = `full_scan`
|
| 18 |
-
|
| 19 |
-
## Output
|
| 20 |
-
|
| 21 |
-
Emit one of:
|
| 22 |
-
```
|
| 23 |
-
ACTION: full_scan — proceed to Stage 2
|
| 24 |
-
ACTION: apply_pending — skip to Stage 3 (use pending-skills.json as manifest delta)
|
| 25 |
-
ACTION: use_cached — skip to Stage 5 (just display current manifest)
|
| 26 |
-
```
|
| 27 |
-
|
| 28 |
-
## Fast Path
|
| 29 |
-
|
| 30 |
-
If `use_cached`: read current manifest load list and jump to Stage 5 directly.
|
| 31 |
-
If `apply_pending`: merge pending into current manifest, jump to Stage 4.
|
|
|
|
| 1 |
+
# Stage 1: Scope — Is a Scan Needed?
|
| 2 |
+
|
| 3 |
+
Determine which action to take before spending tokens on a full scan.
|
| 4 |
+
|
| 5 |
+
## Check Order
|
| 6 |
+
|
| 7 |
+
1. **Read** `~/.claude/pending-skills.json`
|
| 8 |
+
- If exists and `generated_at` is < 2 hours old → action = `apply_pending`
|
| 9 |
+
- Delete the file after reading (it is one-shot)
|
| 10 |
+
|
| 11 |
+
2. **Read** `~/.claude/skill-manifest.json`
|
| 12 |
+
- Extract `repo_path` and `generated_at`
|
| 13 |
+
- If `repo_path` ≠ current working directory → action = `full_scan`
|
| 14 |
+
- If `generated_at` > 1 hour ago → action = `full_scan`
|
| 15 |
+
- Otherwise → action = `use_cached`
|
| 16 |
+
|
| 17 |
+
3. **If no manifest exists** → action = `full_scan`
|
| 18 |
+
|
| 19 |
+
## Output
|
| 20 |
+
|
| 21 |
+
Emit one of:
|
| 22 |
+
```
|
| 23 |
+
ACTION: full_scan — proceed to Stage 2
|
| 24 |
+
ACTION: apply_pending — skip to Stage 3 (use pending-skills.json as manifest delta)
|
| 25 |
+
ACTION: use_cached — skip to Stage 5 (just display current manifest)
|
| 26 |
+
```
|
| 27 |
+
|
| 28 |
+
## Fast Path
|
| 29 |
+
|
| 30 |
+
If `use_cached`: read current manifest load list and jump to Stage 5 directly.
|
| 31 |
+
If `apply_pending`: merge pending into current manifest, jump to Stage 4.
|
skills/skill-router/references/02-plan.md
CHANGED
|
@@ -1,34 +1,34 @@
|
|
| 1 |
-
# Stage 2: Plan — Run the Scanner
|
| 2 |
-
|
| 3 |
-
Only reached if Stage 1 determined `full_scan`.
|
| 4 |
-
|
| 5 |
-
## Steps
|
| 6 |
-
|
| 7 |
-
1. **Identify current repo root**
|
| 8 |
-
- Use current working directory from the session
|
| 9 |
-
- Confirm it looks like a project (has package.json, pyproject.toml, Cargo.toml, go.mod, etc.)
|
| 10 |
-
- If it's the home dir or system dir → warn and use limited scan
|
| 11 |
-
|
| 12 |
-
2. **Run the scanner**
|
| 13 |
-
|
| 14 |
-
```bash
|
| 15 |
-
python3 ~/.claude/ctx/scan_repo.py \
|
| 16 |
-
--repo <cwd> \
|
| 17 |
-
--output /tmp/skill-stack-profile.json
|
| 18 |
-
```
|
| 19 |
-
|
| 20 |
-
(Replace `~/.claude/ctx` with the actual ctx_dir from `~/.claude/skill-registry.json`)
|
| 21 |
-
|
| 22 |
-
3. **Read the output** (`/tmp/skill-stack-profile.json`)
|
| 23 |
-
- Report top 5 detected stacks with confidence scores
|
| 24 |
-
- Note any monorepo packages detected
|
| 25 |
-
|
| 26 |
-
## Expected Duration
|
| 27 |
-
|
| 28 |
-
< 10 seconds for repos up to 10K files. If it takes longer, something is wrong.
|
| 29 |
-
|
| 30 |
-
## On Failure
|
| 31 |
-
|
| 32 |
-
If scanner exits non-zero or output file is missing:
|
| 33 |
-
- Fallback: use `use_cached` action if manifest exists
|
| 34 |
-
- Otherwise: proceed to Stage 3 with an empty profile (will load only meta-skills)
|
|
|
|
| 1 |
+
# Stage 2: Plan — Run the Scanner
|
| 2 |
+
|
| 3 |
+
Only reached if Stage 1 determined `full_scan`.
|
| 4 |
+
|
| 5 |
+
## Steps
|
| 6 |
+
|
| 7 |
+
1. **Identify current repo root**
|
| 8 |
+
- Use current working directory from the session
|
| 9 |
+
- Confirm it looks like a project (has package.json, pyproject.toml, Cargo.toml, go.mod, etc.)
|
| 10 |
+
- If it's the home dir or system dir → warn and use limited scan
|
| 11 |
+
|
| 12 |
+
2. **Run the scanner**
|
| 13 |
+
|
| 14 |
+
```bash
|
| 15 |
+
python3 ~/.claude/ctx/scan_repo.py \
|
| 16 |
+
--repo <cwd> \
|
| 17 |
+
--output /tmp/skill-stack-profile.json
|
| 18 |
+
```
|
| 19 |
+
|
| 20 |
+
(Replace `~/.claude/ctx` with the actual ctx_dir from `~/.claude/skill-registry.json`)
|
| 21 |
+
|
| 22 |
+
3. **Read the output** (`/tmp/skill-stack-profile.json`)
|
| 23 |
+
- Report top 5 detected stacks with confidence scores
|
| 24 |
+
- Note any monorepo packages detected
|
| 25 |
+
|
| 26 |
+
## Expected Duration
|
| 27 |
+
|
| 28 |
+
< 10 seconds for repos up to 10K files. If it takes longer, something is wrong.
|
| 29 |
+
|
| 30 |
+
## On Failure
|
| 31 |
+
|
| 32 |
+
If scanner exits non-zero or output file is missing:
|
| 33 |
+
- Fallback: use `use_cached` action if manifest exists
|
| 34 |
+
- Otherwise: proceed to Stage 3 with an empty profile (will load only meta-skills)
|
skills/skill-router/references/03-build.md
CHANGED
|
@@ -1,38 +1,38 @@
|
|
| 1 |
-
# Stage 3: Build — Resolve the Manifest
|
| 2 |
-
|
| 3 |
-
Convert the stack profile into a concrete load/unload list.
|
| 4 |
-
|
| 5 |
-
## Steps
|
| 6 |
-
|
| 7 |
-
1. **Run the resolver**
|
| 8 |
-
|
| 9 |
-
```bash
|
| 10 |
-
python3 ~/.claude/ctx/resolve_skills.py \
|
| 11 |
-
--profile /tmp/skill-stack-profile.json \
|
| 12 |
-
--wiki ~/.claude/skill-wiki \
|
| 13 |
-
--output ~/.claude/skill-manifest.json \
|
| 14 |
-
--intent-log ~/.claude/intent-log.jsonl
|
| 15 |
-
```
|
| 16 |
-
|
| 17 |
-
2. **Read the manifest** (`~/.claude/skill-manifest.json`)
|
| 18 |
-
- Extract: `load[]`, `unload[]`, `warnings[]`, `suggestions[]`
|
| 19 |
-
|
| 20 |
-
3. **Sync to wiki**
|
| 21 |
-
|
| 22 |
-
```bash
|
| 23 |
-
python3 ~/.claude/ctx/wiki_sync.py \
|
| 24 |
-
--profile /tmp/skill-stack-profile.json \
|
| 25 |
-
--manifest ~/.claude/skill-manifest.json \
|
| 26 |
-
--wiki ~/.claude/skill-wiki
|
| 27 |
-
```
|
| 28 |
-
|
| 29 |
-
## apply_pending Fast Path
|
| 30 |
-
|
| 31 |
-
If Stage 1 returned `apply_pending`:
|
| 32 |
-
- Read `pending-skills.json` suggestion list
|
| 33 |
-
- Add each suggested skill to the manifest load list (if available on disk)
|
| 34 |
-
- Skip re-running the full resolver
|
| 35 |
-
|
| 36 |
-
## On Failure
|
| 37 |
-
|
| 38 |
-
If resolver fails: use previous manifest if < 24 hours old. Report error as warning.
|
|
|
|
| 1 |
+
# Stage 3: Build — Resolve the Manifest
|
| 2 |
+
|
| 3 |
+
Convert the stack profile into a concrete load/unload list.
|
| 4 |
+
|
| 5 |
+
## Steps
|
| 6 |
+
|
| 7 |
+
1. **Run the resolver**
|
| 8 |
+
|
| 9 |
+
```bash
|
| 10 |
+
python3 ~/.claude/ctx/resolve_skills.py \
|
| 11 |
+
--profile /tmp/skill-stack-profile.json \
|
| 12 |
+
--wiki ~/.claude/skill-wiki \
|
| 13 |
+
--output ~/.claude/skill-manifest.json \
|
| 14 |
+
--intent-log ~/.claude/intent-log.jsonl
|
| 15 |
+
```
|
| 16 |
+
|
| 17 |
+
2. **Read the manifest** (`~/.claude/skill-manifest.json`)
|
| 18 |
+
- Extract: `load[]`, `unload[]`, `warnings[]`, `suggestions[]`
|
| 19 |
+
|
| 20 |
+
3. **Sync to wiki**
|
| 21 |
+
|
| 22 |
+
```bash
|
| 23 |
+
python3 ~/.claude/ctx/wiki_sync.py \
|
| 24 |
+
--profile /tmp/skill-stack-profile.json \
|
| 25 |
+
--manifest ~/.claude/skill-manifest.json \
|
| 26 |
+
--wiki ~/.claude/skill-wiki
|
| 27 |
+
```
|
| 28 |
+
|
| 29 |
+
## apply_pending Fast Path
|
| 30 |
+
|
| 31 |
+
If Stage 1 returned `apply_pending`:
|
| 32 |
+
- Read `pending-skills.json` suggestion list
|
| 33 |
+
- Add each suggested skill to the manifest load list (if available on disk)
|
| 34 |
+
- Skip re-running the full resolver
|
| 35 |
+
|
| 36 |
+
## On Failure
|
| 37 |
+
|
| 38 |
+
If resolver fails: use previous manifest if < 24 hours old. Report error as warning.
|
skills/skill-router/references/04-check.md
CHANGED
|
@@ -1,28 +1,28 @@
|
|
| 1 |
-
# Stage 4: Check — Validate Before Loading
|
| 2 |
-
|
| 3 |
-
Binary YES/NO gates. Any NO = stop and report before proceeding.
|
| 4 |
-
|
| 5 |
-
## Gates
|
| 6 |
-
|
| 7 |
-
- [ ] **G1** Load list has ≥ 1 skill?
|
| 8 |
-
- [ ] **G2** Load list has ≤ 15 skills?
|
| 9 |
-
- [ ] **G3** No skill appears in both load AND unload?
|
| 10 |
-
- [ ] **G4** All loaded skills have a valid path that exists on disk?
|
| 11 |
-
- [ ] **G5** No two conflicting skills in load list? (e.g., flask + fastapi, jest + vitest)
|
| 12 |
-
- [ ] **G6** Manifest `generated_at` is within the last 24 hours?
|
| 13 |
-
|
| 14 |
-
## Failure Handling
|
| 15 |
-
|
| 16 |
-
| Gate | Failure action |
|
| 17 |
-
|------|---------------|
|
| 18 |
-
| G1 | Load only meta-skills (skill-router), warn user |
|
| 19 |
-
| G2 | Trim to top 15 by priority, warn about excluded skills |
|
| 20 |
-
| G3 | Remove the skill from unload (keep loaded version) |
|
| 21 |
-
| G4 | Remove missing-path skills from load, add to suggestions |
|
| 22 |
-
| G5 | Keep highest-priority conflicting skill, warn about the other |
|
| 23 |
-
| G6 | Warn that manifest may be stale, offer to re-scan |
|
| 24 |
-
|
| 25 |
-
## Pass Condition
|
| 26 |
-
|
| 27 |
-
All gates YES (or failures handled per table above).
|
| 28 |
-
Proceed to Stage 5 only after resolving all failures.
|
|
|
|
| 1 |
+
# Stage 4: Check — Validate Before Loading
|
| 2 |
+
|
| 3 |
+
Binary YES/NO gates. Any NO = stop and report before proceeding.
|
| 4 |
+
|
| 5 |
+
## Gates
|
| 6 |
+
|
| 7 |
+
- [ ] **G1** Load list has ≥ 1 skill?
|
| 8 |
+
- [ ] **G2** Load list has ≤ 15 skills?
|
| 9 |
+
- [ ] **G3** No skill appears in both load AND unload?
|
| 10 |
+
- [ ] **G4** All loaded skills have a valid path that exists on disk?
|
| 11 |
+
- [ ] **G5** No two conflicting skills in load list? (e.g., flask + fastapi, jest + vitest)
|
| 12 |
+
- [ ] **G6** Manifest `generated_at` is within the last 24 hours?
|
| 13 |
+
|
| 14 |
+
## Failure Handling
|
| 15 |
+
|
| 16 |
+
| Gate | Failure action |
|
| 17 |
+
|------|---------------|
|
| 18 |
+
| G1 | Load only meta-skills (skill-router), warn user |
|
| 19 |
+
| G2 | Trim to top 15 by priority, warn about excluded skills |
|
| 20 |
+
| G3 | Remove the skill from unload (keep loaded version) |
|
| 21 |
+
| G4 | Remove missing-path skills from load, add to suggestions |
|
| 22 |
+
| G5 | Keep highest-priority conflicting skill, warn about the other |
|
| 23 |
+
| G6 | Warn that manifest may be stale, offer to re-scan |
|
| 24 |
+
|
| 25 |
+
## Pass Condition
|
| 26 |
+
|
| 27 |
+
All gates YES (or failures handled per table above).
|
| 28 |
+
Proceed to Stage 5 only after resolving all failures.
|
skills/skill-router/references/05-deliver.md
CHANGED
|
@@ -1,34 +1,34 @@
|
|
| 1 |
-
# Stage 5: Deliver — Present to User
|
| 2 |
-
|
| 3 |
-
Show a concise summary. Keep it under 20 lines.
|
| 4 |
-
|
| 5 |
-
## Format
|
| 6 |
-
|
| 7 |
-
```
|
| 8 |
-
─── Skill Router ──────────────────────────────────
|
| 9 |
-
Project: <repo_name> (<project_type>)
|
| 10 |
-
Detected: <top 3 stacks with confidence>
|
| 11 |
-
|
| 12 |
-
Loading [N]: <skill1>, <skill2>, <skill3> ...
|
| 13 |
-
Unloading[M]: <skill_a>, <skill_b> ... (first 5)
|
| 14 |
-
|
| 15 |
-
⚠ Warnings: <if any, one per line>
|
| 16 |
-
💡 Suggestions: <missing but needed skills, with install hint>
|
| 17 |
-
───────────────────────────────────────────────────
|
| 18 |
-
```
|
| 19 |
-
|
| 20 |
-
## Rules
|
| 21 |
-
|
| 22 |
-
- List loaded skills in priority order (highest first)
|
| 23 |
-
- If unload count > 5: show first 5 then "+ N more"
|
| 24 |
-
- Warnings: only show if there are any (no empty section)
|
| 25 |
-
- Suggestions: include install hint if skill is in a marketplace
|
| 26 |
-
|
| 27 |
-
## After Delivery
|
| 28 |
-
|
| 29 |
-
The session continues normally. The loaded skills are now available
|
| 30 |
-
via the Skill tool. The PostToolUse hook watches for new intent signals.
|
| 31 |
-
|
| 32 |
-
If the user asks to re-evaluate: re-run from Stage 1.
|
| 33 |
-
If the user asks to force-load a skill: add `always_load: true` to its wiki page.
|
| 34 |
-
If the user asks to block a skill: add `never_load: true` to its wiki page.
|
|
|
|
| 1 |
+
# Stage 5: Deliver — Present to User
|
| 2 |
+
|
| 3 |
+
Show a concise summary. Keep it under 20 lines.
|
| 4 |
+
|
| 5 |
+
## Format
|
| 6 |
+
|
| 7 |
+
```
|
| 8 |
+
─── Skill Router ──────────────────────────────────
|
| 9 |
+
Project: <repo_name> (<project_type>)
|
| 10 |
+
Detected: <top 3 stacks with confidence>
|
| 11 |
+
|
| 12 |
+
Loading [N]: <skill1>, <skill2>, <skill3> ...
|
| 13 |
+
Unloading[M]: <skill_a>, <skill_b> ... (first 5)
|
| 14 |
+
|
| 15 |
+
⚠ Warnings: <if any, one per line>
|
| 16 |
+
💡 Suggestions: <missing but needed skills, with install hint>
|
| 17 |
+
───────────────────────────────────────────────────
|
| 18 |
+
```
|
| 19 |
+
|
| 20 |
+
## Rules
|
| 21 |
+
|
| 22 |
+
- List loaded skills in priority order (highest first)
|
| 23 |
+
- If unload count > 5: show first 5 then "+ N more"
|
| 24 |
+
- Warnings: only show if there are any (no empty section)
|
| 25 |
+
- Suggestions: include install hint if skill is in a marketplace
|
| 26 |
+
|
| 27 |
+
## After Delivery
|
| 28 |
+
|
| 29 |
+
The session continues normally. The loaded skills are now available
|
| 30 |
+
via the Skill tool. The PostToolUse hook watches for new intent signals.
|
| 31 |
+
|
| 32 |
+
If the user asks to re-evaluate: re-run from Stage 1.
|
| 33 |
+
If the user asks to force-load a skill: add `always_load: true` to its wiki page.
|
| 34 |
+
If the user asks to block a skill: add `never_load: true` to its wiki page.
|
skills/toolbox/SKILL.md
CHANGED
|
@@ -1,61 +1,61 @@
|
|
| 1 |
-
---
|
| 2 |
-
name: toolbox
|
| 3 |
-
description: Pre/post dev toolbox — named bundles of skills/agents loaded before development work and councils of experts invoked after. Run /toolbox or the toolbox.py CLI to list, activate, initialize, export, import, and validate toolboxes. Invoke at the start or end of a dev session, when setting up a new repo, or when sharing toolboxes with a team.
|
| 4 |
-
type: feature
|
| 5 |
-
priority: 50
|
| 6 |
-
always_load: false
|
| 7 |
-
---
|
| 8 |
-
|
| 9 |
-
# toolbox
|
| 10 |
-
|
| 11 |
-
Named bundles of skills/agents that run **before** (`pre`) or **after** (`post`)
|
| 12 |
-
a development task. Learn patterns from past work and propose new bundles.
|
| 13 |
-
Invoke slash, pre-commit, session-end, or file-save.
|
| 14 |
-
|
| 15 |
-
## Quick reference
|
| 16 |
-
|
| 17 |
-
| Task | Command |
|
| 18 |
-
|--------------------------------------------|-----------------------------------------|
|
| 19 |
-
| Seed 5 starter toolboxes | `python src/toolbox.py init` |
|
| 20 |
-
| List available toolboxes | `python src/toolbox.py list` |
|
| 21 |
-
| Inspect one | `python src/toolbox.py show ship-it` |
|
| 22 |
-
| Activate (global) | `python src/toolbox.py activate ship-it`|
|
| 23 |
-
| Export for sharing | `python src/toolbox.py export ship-it` |
|
| 24 |
-
| Import a shared toolbox | `python src/toolbox.py import file.yaml`|
|
| 25 |
-
| Validate config | `python src/toolbox.py validate` |
|
| 26 |
-
|
| 27 |
-
## Starter templates
|
| 28 |
-
|
| 29 |
-
| Name | When to use |
|
| 30 |
-
|-------------------|-----------------------------------------------------------------|
|
| 31 |
-
| ship-it | End-of-feature: 7-expert council on the change set |
|
| 32 |
-
| security-sweep | Security audit with guardrail blocking HIGH findings |
|
| 33 |
-
| refactor-safety | Refactors with graph-informed blast radius |
|
| 34 |
-
| docs-review | When touching Markdown or API docs |
|
| 35 |
-
| fresh-repo-init | Blank repo: run intent interview and scaffold |
|
| 36 |
-
|
| 37 |
-
## Data model
|
| 38 |
-
|
| 39 |
-
Global: `~/.claude/toolboxes.json`.
|
| 40 |
-
Per-repo (overrides global): `<repo_root>/.toolbox.yaml`.
|
| 41 |
-
|
| 42 |
-
Each toolbox declares:
|
| 43 |
-
- `pre` — skills/agents to load before work starts
|
| 44 |
-
- `post` — agents that form the council after work ends
|
| 45 |
-
- `scope.analysis` — `diff` | `full` | `graph-blast` | `dynamic`
|
| 46 |
-
- `trigger` — `slash`, `pre_commit`, `session_end`, or `file_save` glob
|
| 47 |
-
- `budget.max_tokens` / `budget.max_seconds` — hard stop on runaway cost
|
| 48 |
-
- `dedup.policy` — `fresh` (always re-run) or `cached` (reuse within window)
|
| 49 |
-
- `guardrail` — if true, block commit on HIGH findings
|
| 50 |
-
|
| 51 |
-
## Invoke when
|
| 52 |
-
|
| 53 |
-
- User says "I'm done with this feature" or commits a feature branch.
|
| 54 |
-
- User opens a fresh repo (triggers `fresh-repo-init` suggestion).
|
| 55 |
-
- User touches security-sensitive paths (triggers `security-sweep` file_save).
|
| 56 |
-
- User asks "what toolboxes do I have?" or "run the council".
|
| 57 |
-
|
| 58 |
-
## Reasoning
|
| 59 |
-
|
| 60 |
-
See `docs/roadmap/toolbox.md` for the full design rationale, open decisions,
|
| 61 |
-
and phase rollout.
|
|
|
|
| 1 |
+
---
|
| 2 |
+
name: toolbox
|
| 3 |
+
description: Pre/post dev toolbox — named bundles of skills/agents loaded before development work and councils of experts invoked after. Run /toolbox or the toolbox.py CLI to list, activate, initialize, export, import, and validate toolboxes. Invoke at the start or end of a dev session, when setting up a new repo, or when sharing toolboxes with a team.
|
| 4 |
+
type: feature
|
| 5 |
+
priority: 50
|
| 6 |
+
always_load: false
|
| 7 |
+
---
|
| 8 |
+
|
| 9 |
+
# toolbox
|
| 10 |
+
|
| 11 |
+
Named bundles of skills/agents that run **before** (`pre`) or **after** (`post`)
|
| 12 |
+
a development task. Learn patterns from past work and propose new bundles.
|
| 13 |
+
Invoke slash, pre-commit, session-end, or file-save.
|
| 14 |
+
|
| 15 |
+
## Quick reference
|
| 16 |
+
|
| 17 |
+
| Task | Command |
|
| 18 |
+
|--------------------------------------------|-----------------------------------------|
|
| 19 |
+
| Seed 5 starter toolboxes | `python src/toolbox.py init` |
|
| 20 |
+
| List available toolboxes | `python src/toolbox.py list` |
|
| 21 |
+
| Inspect one | `python src/toolbox.py show ship-it` |
|
| 22 |
+
| Activate (global) | `python src/toolbox.py activate ship-it`|
|
| 23 |
+
| Export for sharing | `python src/toolbox.py export ship-it` |
|
| 24 |
+
| Import a shared toolbox | `python src/toolbox.py import file.yaml`|
|
| 25 |
+
| Validate config | `python src/toolbox.py validate` |
|
| 26 |
+
|
| 27 |
+
## Starter templates
|
| 28 |
+
|
| 29 |
+
| Name | When to use |
|
| 30 |
+
|-------------------|-----------------------------------------------------------------|
|
| 31 |
+
| ship-it | End-of-feature: 7-expert council on the change set |
|
| 32 |
+
| security-sweep | Security audit with guardrail blocking HIGH findings |
|
| 33 |
+
| refactor-safety | Refactors with graph-informed blast radius |
|
| 34 |
+
| docs-review | When touching Markdown or API docs |
|
| 35 |
+
| fresh-repo-init | Blank repo: run intent interview and scaffold |
|
| 36 |
+
|
| 37 |
+
## Data model
|
| 38 |
+
|
| 39 |
+
Global: `~/.claude/toolboxes.json`.
|
| 40 |
+
Per-repo (overrides global): `<repo_root>/.toolbox.yaml`.
|
| 41 |
+
|
| 42 |
+
Each toolbox declares:
|
| 43 |
+
- `pre` — skills/agents to load before work starts
|
| 44 |
+
- `post` — agents that form the council after work ends
|
| 45 |
+
- `scope.analysis` — `diff` | `full` | `graph-blast` | `dynamic`
|
| 46 |
+
- `trigger` — `slash`, `pre_commit`, `session_end`, or `file_save` glob
|
| 47 |
+
- `budget.max_tokens` / `budget.max_seconds` — hard stop on runaway cost
|
| 48 |
+
- `dedup.policy` — `fresh` (always re-run) or `cached` (reuse within window)
|
| 49 |
+
- `guardrail` — if true, block commit on HIGH findings
|
| 50 |
+
|
| 51 |
+
## Invoke when
|
| 52 |
+
|
| 53 |
+
- User says "I'm done with this feature" or commits a feature branch.
|
| 54 |
+
- User opens a fresh repo (triggers `fresh-repo-init` suggestion).
|
| 55 |
+
- User touches security-sensitive paths (triggers `security-sweep` file_save).
|
| 56 |
+
- User asks "what toolboxes do I have?" or "run the council".
|
| 57 |
+
|
| 58 |
+
## Reasoning
|
| 59 |
+
|
| 60 |
+
See `docs/roadmap/toolbox.md` for the full design rationale, open decisions,
|
| 61 |
+
and phase rollout.
|
src/tests/test_update_repo_stats.py
CHANGED
|
@@ -44,22 +44,24 @@ def test_tarball_stats_only_trust_safe_regular_members(
|
|
| 44 |
[
|
| 45 |
("./graphify-out/graph.json", {"nodes": [{}, {}], "edges": [{}, {}, {}]}),
|
| 46 |
("./graphify-out/communities.json", {"total_communities": 4}),
|
| 47 |
-
("./entities/skills/good.md", b"# skill"),
|
| 48 |
-
("entities/agents/good.md", b"# agent"),
|
| 49 |
-
("entities/mcp-servers/a/good.md", b"# mcp"),
|
| 50 |
-
("
|
| 51 |
-
("entities/skills/
|
| 52 |
-
|
|
|
|
| 53 |
)
|
| 54 |
|
| 55 |
assert urs._read_graph_from_tarball() == {
|
| 56 |
"nodes": 2,
|
| 57 |
"edges": 3,
|
| 58 |
-
"skills": 1,
|
| 59 |
-
"agents": 1,
|
| 60 |
-
"mcps": 1,
|
| 61 |
-
"
|
| 62 |
-
|
|
|
|
| 63 |
|
| 64 |
|
| 65 |
def test_tarball_stats_reject_suffix_impersonation(
|
|
@@ -128,6 +130,7 @@ def test_tarball_stats_uses_report_when_graph_json_is_large(
|
|
| 128 |
("entities/skills/good.md", b"# skill"),
|
| 129 |
("entities/agents/good.md", b"# agent"),
|
| 130 |
("entities/mcp-servers/a/good.md", b"# mcp"),
|
|
|
|
| 131 |
],
|
| 132 |
)
|
| 133 |
|
|
@@ -137,6 +140,7 @@ def test_tarball_stats_uses_report_when_graph_json_is_large(
|
|
| 137 |
"skills": 1,
|
| 138 |
"agents": 1,
|
| 139 |
"mcps": 1,
|
|
|
|
| 140 |
"communities": 50,
|
| 141 |
}
|
| 142 |
|
|
@@ -149,6 +153,7 @@ def test_test_badge_is_labeled_collected_not_passing() -> None:
|
|
| 149 |
"skills": None,
|
| 150 |
"agents": None,
|
| 151 |
"mcps": None,
|
|
|
|
| 152 |
"communities": None,
|
| 153 |
}
|
| 154 |
patched = text
|
|
@@ -159,6 +164,27 @@ def test_test_badge_is_labeled_collected_not_passing() -> None:
|
|
| 159 |
assert "_passing" not in patched
|
| 160 |
|
| 161 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 162 |
def test_read_test_count_prefers_project_python(
|
| 163 |
monkeypatch: pytest.MonkeyPatch,
|
| 164 |
) -> None:
|
|
|
|
| 44 |
[
|
| 45 |
("./graphify-out/graph.json", {"nodes": [{}, {}], "edges": [{}, {}, {}]}),
|
| 46 |
("./graphify-out/communities.json", {"total_communities": 4}),
|
| 47 |
+
("./entities/skills/good.md", b"# skill"),
|
| 48 |
+
("entities/agents/good.md", b"# agent"),
|
| 49 |
+
("entities/mcp-servers/a/good.md", b"# mcp"),
|
| 50 |
+
("entities/harnesses/good.md", b"# harness"),
|
| 51 |
+
("shadow/entities/skills/ignored.md", b"# ignored"),
|
| 52 |
+
("entities/skills/../ignored.md", b"# ignored"),
|
| 53 |
+
],
|
| 54 |
)
|
| 55 |
|
| 56 |
assert urs._read_graph_from_tarball() == {
|
| 57 |
"nodes": 2,
|
| 58 |
"edges": 3,
|
| 59 |
+
"skills": 1,
|
| 60 |
+
"agents": 1,
|
| 61 |
+
"mcps": 1,
|
| 62 |
+
"harnesses": 1,
|
| 63 |
+
"communities": 4,
|
| 64 |
+
}
|
| 65 |
|
| 66 |
|
| 67 |
def test_tarball_stats_reject_suffix_impersonation(
|
|
|
|
| 130 |
("entities/skills/good.md", b"# skill"),
|
| 131 |
("entities/agents/good.md", b"# agent"),
|
| 132 |
("entities/mcp-servers/a/good.md", b"# mcp"),
|
| 133 |
+
("entities/harnesses/good.md", b"# harness"),
|
| 134 |
],
|
| 135 |
)
|
| 136 |
|
|
|
|
| 140 |
"skills": 1,
|
| 141 |
"agents": 1,
|
| 142 |
"mcps": 1,
|
| 143 |
+
"harnesses": 1,
|
| 144 |
"communities": 50,
|
| 145 |
}
|
| 146 |
|
|
|
|
| 153 |
"skills": None,
|
| 154 |
"agents": None,
|
| 155 |
"mcps": None,
|
| 156 |
+
"harnesses": None,
|
| 157 |
"communities": None,
|
| 158 |
}
|
| 159 |
patched = text
|
|
|
|
| 164 |
assert "_passing" not in patched
|
| 165 |
|
| 166 |
|
| 167 |
+
def test_harness_aware_readme_prose_is_updated() -> None:
|
| 168 |
+
text = (
|
| 169 |
+
"walks a **1,000 skills, 20 agents, 30 MCP servers, "
|
| 170 |
+
"and 4 cataloged harnesses** graph"
|
| 171 |
+
)
|
| 172 |
+
stats = {
|
| 173 |
+
"nodes": None,
|
| 174 |
+
"edges": None,
|
| 175 |
+
"skills": 92815,
|
| 176 |
+
"agents": 464,
|
| 177 |
+
"mcps": 10787,
|
| 178 |
+
"harnesses": 13,
|
| 179 |
+
"communities": None,
|
| 180 |
+
}
|
| 181 |
+
patched = text
|
| 182 |
+
for pattern, replacement in urs.build_replacements(stats, tests=None, converted=None):
|
| 183 |
+
patched = pattern.sub(replacement, patched)
|
| 184 |
+
|
| 185 |
+
assert "**92,815 skills, 464 agents, 10,787 MCP servers, and 13 cataloged harnesses**" in patched
|
| 186 |
+
|
| 187 |
+
|
| 188 |
def test_read_test_count_prefers_project_python(
|
| 189 |
monkeypatch: pytest.MonkeyPatch,
|
| 190 |
) -> None:
|
src/update_repo_stats.py
CHANGED
|
@@ -128,14 +128,15 @@ def _read_graph_from_tarball_legacy() -> dict[str, int | None] | None:
|
|
| 128 |
return None
|
| 129 |
stats: dict[str, int | None] = {
|
| 130 |
"nodes": None, "edges": None,
|
| 131 |
-
"skills": None, "agents": None, "mcps": None, "
|
|
|
|
| 132 |
}
|
| 133 |
try:
|
| 134 |
with tarfile.open(tarball, "r:gz") as tf:
|
| 135 |
# Count entity pages directly from the archive index.
|
| 136 |
# MCP entities are sharded by first char (entities/mcp-servers/<shard>/)
|
| 137 |
# so we match the whole subtree, not just one level.
|
| 138 |
-
s = a = m = 0
|
| 139 |
for member in tf.getmembers():
|
| 140 |
name = _safe_tar_name(member.name)
|
| 141 |
if name is None or not member.isfile() or not name.endswith(".md"):
|
|
@@ -144,9 +145,11 @@ def _read_graph_from_tarball_legacy() -> dict[str, int | None] | None:
|
|
| 144 |
s += 1
|
| 145 |
elif name.startswith("entities/agents/"):
|
| 146 |
a += 1
|
| 147 |
-
elif name.startswith("entities/mcp-servers/"):
|
| 148 |
-
m += 1
|
| 149 |
-
|
|
|
|
|
|
|
| 150 |
# Graph + communities are smaller files — extract to read.
|
| 151 |
for path in (_GRAPH_JSON_MEMBER, _COMMUNITIES_JSON_MEMBER):
|
| 152 |
body = _read_json_member(tf, path)
|
|
@@ -183,11 +186,12 @@ def _read_graph_from_tarball() -> dict[str, int | None] | None:
|
|
| 183 |
return None
|
| 184 |
stats: dict[str, int | None] = {
|
| 185 |
"nodes": None, "edges": None,
|
| 186 |
-
"skills": None, "agents": None, "mcps": None, "
|
|
|
|
| 187 |
}
|
| 188 |
try:
|
| 189 |
with tarfile.open(tarball, "r:gz") as tf:
|
| 190 |
-
s = a = m = 0
|
| 191 |
for member in tf.getmembers():
|
| 192 |
name = _safe_tar_name(member.name)
|
| 193 |
if name is None or not member.isfile() or not name.endswith(".md"):
|
|
@@ -198,7 +202,9 @@ def _read_graph_from_tarball() -> dict[str, int | None] | None:
|
|
| 198 |
a += 1
|
| 199 |
elif name.startswith("entities/mcp-servers/"):
|
| 200 |
m += 1
|
| 201 |
-
|
|
|
|
|
|
|
| 202 |
|
| 203 |
report = _read_text_member(tf, _GRAPH_REPORT_MEMBER)
|
| 204 |
if report is not None:
|
|
@@ -258,11 +264,12 @@ def read_graph_stats() -> dict:
|
|
| 258 |
stats: dict[str, int | None] = {
|
| 259 |
"nodes": None,
|
| 260 |
"edges": None,
|
| 261 |
-
"skills": None,
|
| 262 |
-
"agents": None,
|
| 263 |
-
"mcps": None,
|
| 264 |
-
"
|
| 265 |
-
|
|
|
|
| 266 |
|
| 267 |
if graph_json.exists():
|
| 268 |
g = json.loads(graph_json.read_text(encoding="utf-8"))
|
|
@@ -274,9 +281,10 @@ def read_graph_stats() -> dict:
|
|
| 274 |
for n in g.get("nodes", []):
|
| 275 |
t = n.get("type", "?")
|
| 276 |
type_counts[t] = type_counts.get(t, 0) + 1
|
| 277 |
-
stats["skills"] = type_counts.get("skill")
|
| 278 |
-
stats["agents"] = type_counts.get("agent")
|
| 279 |
-
stats["mcps"] = type_counts.get("mcp-server")
|
|
|
|
| 280 |
|
| 281 |
if communities_repo.exists():
|
| 282 |
c = json.loads(communities_repo.read_text(encoding="utf-8"))
|
|
@@ -401,7 +409,21 @@ def build_replacements(stats: dict, tests: int | None, converted: int | None) ->
|
|
| 401 |
if stats["skills"]:
|
| 402 |
s = stats["skills"]
|
| 403 |
reps.append((re.compile(r"badge/Skills-[0-9%,]+-"), f"badge/Skills-{s:,}-".replace(",", "%2C")))
|
| 404 |
-
#
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 405 |
# Order matters — this regex is more specific than the 2-type one
|
| 406 |
# below, so match it first. Handles the MCP-aware tagline that
|
| 407 |
# lands in the README after the Phase 7 MCP-first rewrite.
|
|
|
|
| 128 |
return None
|
| 129 |
stats: dict[str, int | None] = {
|
| 130 |
"nodes": None, "edges": None,
|
| 131 |
+
"skills": None, "agents": None, "mcps": None, "harnesses": None,
|
| 132 |
+
"communities": None,
|
| 133 |
}
|
| 134 |
try:
|
| 135 |
with tarfile.open(tarball, "r:gz") as tf:
|
| 136 |
# Count entity pages directly from the archive index.
|
| 137 |
# MCP entities are sharded by first char (entities/mcp-servers/<shard>/)
|
| 138 |
# so we match the whole subtree, not just one level.
|
| 139 |
+
s = a = m = h = 0
|
| 140 |
for member in tf.getmembers():
|
| 141 |
name = _safe_tar_name(member.name)
|
| 142 |
if name is None or not member.isfile() or not name.endswith(".md"):
|
|
|
|
| 145 |
s += 1
|
| 146 |
elif name.startswith("entities/agents/"):
|
| 147 |
a += 1
|
| 148 |
+
elif name.startswith("entities/mcp-servers/"):
|
| 149 |
+
m += 1
|
| 150 |
+
elif name.startswith("entities/harnesses/"):
|
| 151 |
+
h += 1
|
| 152 |
+
stats["skills"], stats["agents"], stats["mcps"], stats["harnesses"] = s, a, m, h
|
| 153 |
# Graph + communities are smaller files — extract to read.
|
| 154 |
for path in (_GRAPH_JSON_MEMBER, _COMMUNITIES_JSON_MEMBER):
|
| 155 |
body = _read_json_member(tf, path)
|
|
|
|
| 186 |
return None
|
| 187 |
stats: dict[str, int | None] = {
|
| 188 |
"nodes": None, "edges": None,
|
| 189 |
+
"skills": None, "agents": None, "mcps": None, "harnesses": None,
|
| 190 |
+
"communities": None,
|
| 191 |
}
|
| 192 |
try:
|
| 193 |
with tarfile.open(tarball, "r:gz") as tf:
|
| 194 |
+
s = a = m = h = 0
|
| 195 |
for member in tf.getmembers():
|
| 196 |
name = _safe_tar_name(member.name)
|
| 197 |
if name is None or not member.isfile() or not name.endswith(".md"):
|
|
|
|
| 202 |
a += 1
|
| 203 |
elif name.startswith("entities/mcp-servers/"):
|
| 204 |
m += 1
|
| 205 |
+
elif name.startswith("entities/harnesses/"):
|
| 206 |
+
h += 1
|
| 207 |
+
stats["skills"], stats["agents"], stats["mcps"], stats["harnesses"] = s, a, m, h
|
| 208 |
|
| 209 |
report = _read_text_member(tf, _GRAPH_REPORT_MEMBER)
|
| 210 |
if report is not None:
|
|
|
|
| 264 |
stats: dict[str, int | None] = {
|
| 265 |
"nodes": None,
|
| 266 |
"edges": None,
|
| 267 |
+
"skills": None,
|
| 268 |
+
"agents": None,
|
| 269 |
+
"mcps": None,
|
| 270 |
+
"harnesses": None,
|
| 271 |
+
"communities": None,
|
| 272 |
+
}
|
| 273 |
|
| 274 |
if graph_json.exists():
|
| 275 |
g = json.loads(graph_json.read_text(encoding="utf-8"))
|
|
|
|
| 281 |
for n in g.get("nodes", []):
|
| 282 |
t = n.get("type", "?")
|
| 283 |
type_counts[t] = type_counts.get(t, 0) + 1
|
| 284 |
+
stats["skills"] = type_counts.get("skill")
|
| 285 |
+
stats["agents"] = type_counts.get("agent")
|
| 286 |
+
stats["mcps"] = type_counts.get("mcp-server")
|
| 287 |
+
stats["harnesses"] = type_counts.get("harness")
|
| 288 |
|
| 289 |
if communities_repo.exists():
|
| 290 |
c = json.loads(communities_repo.read_text(encoding="utf-8"))
|
|
|
|
| 409 |
if stats["skills"]:
|
| 410 |
s = stats["skills"]
|
| 411 |
reps.append((re.compile(r"badge/Skills-[0-9%,]+-"), f"badge/Skills-{s:,}-".replace(",", "%2C")))
|
| 412 |
+
# 4-type pattern: "92,815 skills, 464 agents, 10,787 MCP servers,
|
| 413 |
+
# and 13 cataloged harnesses". Keep this before the 3-type fallback
|
| 414 |
+
# so the README's harness-aware lead sentence stays machine-owned.
|
| 415 |
+
if stats["agents"] and stats["mcps"] and stats["harnesses"]:
|
| 416 |
+
reps.append((
|
| 417 |
+
re.compile(
|
| 418 |
+
r"\*\*[\d,]+\s+skills,\s+[\d,]+\s+agents,\s+"
|
| 419 |
+
r"[\d,]+\s+MCP\s+servers,\s+and\s+[\d,]+\s+"
|
| 420 |
+
r"cataloged\s+harnesses\*\*"
|
| 421 |
+
),
|
| 422 |
+
f"**{s:,} skills, {stats['agents']:,} agents, "
|
| 423 |
+
f"{stats['mcps']:,} MCP servers, and "
|
| 424 |
+
f"{stats['harnesses']:,} cataloged harnesses**",
|
| 425 |
+
))
|
| 426 |
+
# 3-type pattern: "1,789 skills, 464 agents, and 10,786 MCP servers"
|
| 427 |
# Order matters — this regex is more specific than the 2-type one
|
| 428 |
# below, so match it first. Handles the MCP-aware tagline that
|
| 429 |
# lands in the README after the Phase 7 MCP-first rewrite.
|