kushi-agents 5.0.3 → 5.0.4

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.
package/README.md CHANGED
@@ -235,6 +235,19 @@ npm pack --dry-run
235
235
 
236
236
  The self-check validates frontmatter, agent inventory, prompt → skill routing, profile manifest, reference packs, cross-links, the verbs table in this README, and the layout diagram in `docs/reference/where-things-live.md`. Full reference: [docs/reference/self-check.md](docs/reference/self-check.md).
237
237
 
238
+ ## Authoring a new skill (v5.0.4+)
239
+
240
+ Adding a new skill takes one command + a per-skill lint loop:
241
+
242
+ ```powershell
243
+ node bin/cli.mjs create-skill --name my-thing --type writer --description "Generates the foo report from State/"
244
+ node bin/cli.mjs check-skill --name my-thing
245
+ node bin/cli.mjs check-skill --name my-thing --retrofit --apply # auto-fix additive findings
246
+ npm run eval -- my-thing
247
+ ```
248
+
249
+ Full walkthrough: [`docs/contributing/skill-authoring.md`](docs/contributing/skill-authoring.md). Doctrine: [`plugin/instructions/skill-authoring.instructions.md`](plugin/instructions/skill-authoring.instructions.md). Repo-wide dogfood baseline: [`docs/audits/v5.0.4-skill-creator-dogfood.md`](docs/audits/v5.0.4-skill-creator-dogfood.md).
250
+
238
251
  ## Evaluating skills (v5.0.3+)
239
252
 
240
253
  Every skill ships per-case evals at `plugin/skills/<name>/evals/evals.json`, aligned with the [agentskills.io evaluating-skills spec](https://agentskills.io/skill-creation/evaluating-skills). Doctrine: [`plugin/instructions/skill-evals.instructions.md`](plugin/instructions/skill-evals.instructions.md).
package/bin/cli.mjs CHANGED
@@ -5,6 +5,16 @@ import { runMultiHost } from '../src/multi-host.mjs';
5
5
 
6
6
  const args = process.argv.slice(2);
7
7
 
8
+ // ── skill-authoring verbs (v5.0.4+) ─────────────────────────────────────────
9
+ // Dispatch directly to the skill-creator / skill-checker pwsh scripts.
10
+ const SKILL_VERBS = new Set(['create-skill', 'check-skill', 'optimize-description', 'review-evals']);
11
+ if (args.length > 0 && SKILL_VERBS.has(args[0])) {
12
+ const verb = args[0];
13
+ const rest = args.slice(1);
14
+ await dispatchSkillVerb(verb, rest);
15
+ process.exit(0);
16
+ }
17
+
8
18
  if (args.includes('--help') || args.includes('-h')) {
9
19
  console.log(`
10
20
  Usage: npx kushi-agents [options]
@@ -41,6 +51,16 @@ if (args.includes('--help') || args.includes('-h')) {
41
51
 
42
52
  --help, -h Show this help
43
53
 
54
+ Skill authoring (v5.0.4+):
55
+ create-skill <name> --type <pull|writer|orchestrator|other> --description "<d>"
56
+ Scaffold a new plugin/skills/<name>/ tree.
57
+ check-skill <name> Lint a skill against the agentskills.io blueprint.
58
+ check-skill --all [--retrofit [--apply]]
59
+ Audit (or retrofit) every skill in plugin/skills/.
60
+ optimize-description <skill>
61
+ Rewrite a skill's description per the optimizer rules.
62
+ review-evals <skill> Render an HTML side-by-side eval-review viewer.
63
+
44
64
  After install, talk to Kushi:
45
65
  bootstrap <project> First-time setup
46
66
  refresh <project> Incremental refresh + rebuild State/
@@ -114,3 +134,86 @@ function getFlag(flag) {
114
134
  const match = args.find((a) => a.startsWith(prefix));
115
135
  return match ? match.slice(prefix.length) : undefined;
116
136
  }
137
+
138
+ // ── skill-authoring verb dispatch (v5.0.4+) ─────────────────────────────────
139
+ async function dispatchSkillVerb(verb, rest) {
140
+ const { spawnSync } = await import('node:child_process');
141
+ const path = await import('node:path');
142
+ const url = await import('node:url');
143
+ const here = path.dirname(url.fileURLToPath(import.meta.url));
144
+ const repoRoot = path.resolve(here, '..');
145
+ const creatorDir = path.join(repoRoot, 'plugin', 'skills', 'skill-creator');
146
+ const checkerDir = path.join(repoRoot, 'plugin', 'skills', 'skill-checker');
147
+
148
+ let script, scriptArgs = [];
149
+ switch (verb) {
150
+ case 'create-skill': {
151
+ // Usage: kushi create-skill <name> [--type <t>] [--description "<d>"] [--force]
152
+ const name = rest.find((a) => !a.startsWith('-'));
153
+ if (!name) {
154
+ console.error('Usage: kushi-agents create-skill <name> --type <pull|writer|orchestrator|other> --description "USE WHEN ... DO NOT USE FOR ..."');
155
+ process.exit(1);
156
+ }
157
+ const type = pickFlag(rest, '--type') || 'other';
158
+ const desc = pickFlag(rest, '--description') || `USE WHEN ${name} is invoked. DO NOT USE FOR unrelated tasks.`;
159
+ script = path.join(creatorDir, 'scaffold.ps1');
160
+ scriptArgs = ['-Name', name, '-Type', type, '-Description', desc];
161
+ if (rest.includes('--force')) scriptArgs.push('-Force');
162
+ if (rest.includes('--dry-run')) scriptArgs.push('-DryRun');
163
+ break;
164
+ }
165
+ case 'check-skill': {
166
+ // Usage: kushi check-skill <name> | --all [--retrofit] [--apply]
167
+ script = path.join(checkerDir, 'check-skill.ps1');
168
+ const allFlag = rest.includes('--all') || rest.includes('-All');
169
+ const name = rest.find((a) => !a.startsWith('-'));
170
+ if (allFlag) scriptArgs.push('-All');
171
+ else if (name) scriptArgs.push('-Skill', name);
172
+ else {
173
+ console.error('Usage: kushi-agents check-skill <name> | --all [--retrofit] [--apply] [--dry-run]');
174
+ process.exit(1);
175
+ }
176
+ if (rest.includes('--retrofit')) scriptArgs.push('-Retrofit');
177
+ if (rest.includes('--apply')) scriptArgs.push('-Apply');
178
+ if (rest.includes('--dry-run')) scriptArgs.push('-DryRun');
179
+ if (rest.includes('--json')) scriptArgs.push('-Json');
180
+ break;
181
+ }
182
+ case 'optimize-description': {
183
+ // Usage: kushi optimize-description <skill>
184
+ const name = rest.find((a) => !a.startsWith('-'));
185
+ if (!name) {
186
+ console.error('Usage: kushi-agents optimize-description <skill>');
187
+ process.exit(1);
188
+ }
189
+ script = path.join(checkerDir, 'check-skill.ps1');
190
+ scriptArgs = ['-Skill', name, '-OptimizeDescription'];
191
+ break;
192
+ }
193
+ case 'review-evals': {
194
+ // Usage: kushi review-evals <skill>
195
+ const name = rest.find((a) => !a.startsWith('-'));
196
+ if (!name) {
197
+ console.error('Usage: kushi-agents review-evals <skill>');
198
+ process.exit(1);
199
+ }
200
+ script = path.join(checkerDir, 'check-skill.ps1');
201
+ scriptArgs = ['-Skill', name, '-Review'];
202
+ break;
203
+ }
204
+ default:
205
+ console.error(`Unknown skill verb: ${verb}`);
206
+ process.exit(1);
207
+ }
208
+
209
+ const result = spawnSync('pwsh', ['-NoProfile', '-File', script, ...scriptArgs], { stdio: 'inherit' });
210
+ process.exit(result.status ?? 1);
211
+ }
212
+
213
+ function pickFlag(args, flag) {
214
+ const idx = args.indexOf(flag);
215
+ if (idx !== -1 && idx + 1 < args.length) return args[idx + 1];
216
+ const prefix = flag + '=';
217
+ const m = args.find((a) => a.startsWith(prefix));
218
+ return m ? m.slice(prefix.length) : undefined;
219
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kushi-agents",
3
- "version": "5.0.3",
3
+ "version": "5.0.4",
4
4
  "description": "Install Kushi — multi-source project evidence agent with Comprehensive Structured Capture (CSC) into weekly-only files across Email, Teams, OneNote, Loop, SharePoint, Meetings, CRM, ADO. Meetings retain a sibling verbatim/ audit folder. WorkIQ-only for M365 sources (Graph / m365_* FORBIDDEN as fallbacks; user-paste is first-class). Host-agnostic.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -41,7 +41,7 @@
41
41
  },
42
42
  "license": "MIT",
43
43
  "scripts": {
44
- "test": "node --test src/check-workiq.test.mjs src/seed-config.test.mjs src/sanitize-workiq-input.test.mjs src/detect-vertex-repo.test.mjs src/vertex-validate.test.mjs src/emit-vertex.e2e.test.mjs src/config-root-resolve.test.mjs src/forbidden-workiq-phrasings.test.mjs src/multi-host-install.test.mjs src/eval-aggregator.test.mjs src/eval-runner.test.mjs",
44
+ "test": "node --test src/check-workiq.test.mjs src/seed-config.test.mjs src/sanitize-workiq-input.test.mjs src/detect-vertex-repo.test.mjs src/vertex-validate.test.mjs src/emit-vertex.e2e.test.mjs src/config-root-resolve.test.mjs src/forbidden-workiq-phrasings.test.mjs src/multi-host-install.test.mjs src/eval-aggregator.test.mjs src/eval-runner.test.mjs src/skill-creator.test.mjs src/skill-checker.test.mjs",
45
45
  "test:integration:bootstrap": "node src/bootstrap-dryrun.integration.test.mjs",
46
46
  "smoke": "node scripts/smoke.mjs",
47
47
  "eval": "pwsh plugin/skills/eval/run-evals.ps1 -Skill",
@@ -182,4 +182,6 @@ Meta skills (not called by verbs):
182
182
  | Skill | Role |
183
183
  |---|---|
184
184
  | `self-check` | Pre-commit consistency check across skills, instructions, prompts, and docs. Run with `pwsh plugin/skills/self-check/run.ps1` (or `./run.sh` on macOS/Linux) or by asking "kushi self-check". |
185
+ | `skill-creator` | (v5.0.4) Scaffolds a new compliant skill — frontmatter + USE WHEN description + type-driven required section + starter evals. Run with `node bin/cli.mjs create-skill --name <kebab> --type <writer\|orchestrator\|pull\|other> --description "..."`. |
186
+ | `skill-checker` | (v5.0.4) Lints + retrofits every SKILL.md against `skill-authoring.instructions.md`. Modes: `-Lint` / `-Retrofit` / `-Apply` / `-OptimizeDescription` / `-Review` / `-All`. Run with `node bin/cli.mjs check-skill --all`. |
185
187
  | `intro` | Self-introduction + interactive walkthrough. Triggered by "what is kushi", "what can you do", "kushi intro", "i'm new to kushi", "kushi help". |
@@ -0,0 +1,147 @@
1
+ ---
2
+ name: "skill-authoring"
3
+ description: "v5.0.4 — How to author a new kushi skill so it ships conformant to the agentskills.io blueprint on day one. Codifies the required SKILL.md sections, file layout, evals starter, naming, and the description-optimization rules. Read this before running `npx kushi-agents create-skill`. Enforced by self-check D34.creator-conformance + by `kushi check-skill --lint`."
4
+ applies_to: "every plugin/skills/<name>/ created from v5.0.4 onward; existing skills are audited via the dogfood gate"
5
+ since: "kushi v5.0.4"
6
+ ---
7
+
8
+ # skill-authoring — doctrine
9
+
10
+ > Inspired by **Anthropic's [skill-creator](https://github.com/anthropics/skills/blob/main/skills/skill-creator/SKILL.md)**. Adapted to kushi's PowerShell-first stack, our 2-host install matrix, and the reality that the first 30 kushi skills were authored before any harness existed — hence the **retrofit** path in `skill-checker`.
11
+
12
+ ## Why this exists
13
+
14
+ A SKILL.md is the prompt that loads into the agent the moment its trigger fires. Drift between intent and spec is silent until evals catch it (and only if there are evals). This doctrine + the `skill-creator` + `skill-checker` skills make conformant authoring the default, not an afterthought.
15
+
16
+ ## Required files per skill
17
+
18
+ ```text
19
+ plugin/skills/<name>/
20
+ ├── SKILL.md ← REQUIRED — agent-loaded prompt; ≤500 lines, ≤5000 tokens
21
+ ├── evals/
22
+ │ └── evals.json ← REQUIRED — ≥2 cases, each with ≥1 assertion
23
+ ├── references/ ← OPTIONAL — load-on-trigger bulk content (>500 lines splits here)
24
+ └── .created-by-skill-creator ← OPTIONAL marker — set by `scaffold.ps1`; opts into the strict D34 gate
25
+ ```
26
+
27
+ A skill MAY also ship a runner (`run.ps1`, `run.sh`, `*.mjs`) when it's a tool-skill (`self-check`, `eval`, `skill-checker`, etc.). Pure prompt-skills don't need one.
28
+
29
+ ## Required SKILL.md sections
30
+
31
+ Every SKILL.md MUST have:
32
+
33
+ 1. **YAML frontmatter** — `name` (kebab-case, matches dir) + `description` (lead with `USE WHEN`).
34
+ 2. **`# Skill: <name>`** H1.
35
+ 3. **One-paragraph purpose** immediately after the H1.
36
+ 4. **At least one** of these procedure-shape sections, picked by skill **type**:
37
+ - `## Gotchas` — REQUIRED for `pull-*` and discovery skills (top-5 failure modes).
38
+ - `## Step checklist` — REQUIRED for orchestrators (`bootstrap-project`, `refresh-project`, `build-state`, `link-entities`, `dashboard`, `tour`, etc.); use GitHub `- [ ]` checkboxes.
39
+ - `## Validation loop` — REQUIRED for writer skills (anything that writes to `Evidence/`, `State/`, `_graph/`, `dashboards/`, `tours/`).
40
+ - `## Steps` or `## Procedure` — acceptable for other skills, plus one of the three above where it applies.
41
+
42
+ Skills can have more than one (e.g. `eval` ships all three). The checker is satisfied by **at least one** of `Gotchas` / `Step checklist` / `Validation loop` plus type-specific rules.
43
+
44
+ ## Description optimization (per agentskills.io)
45
+
46
+ The `description:` is the sole trigger signal. Optimize it:
47
+
48
+ ```yaml
49
+ description: "USE WHEN <situational trigger> AND <precondition>. DO NOT USE for <near-miss>. <one-line capability summary>."
50
+ ```
51
+
52
+ Rules (enforced by `D30.description-optimized` + `skill-checker --optimize-description`):
53
+
54
+ - Lead with `USE WHEN` (first 160 chars).
55
+ - Include a `DO NOT USE` clause for the most likely near-miss invocation.
56
+ - Be specific about the trigger (concrete user phrases or file/state conditions).
57
+ - No marketing fluff ("powerful", "comprehensive", "blazing").
58
+ - ≤1024 characters total.
59
+
60
+ | Bad | Good |
61
+ |---|---|
62
+ | `"Pulls OneNote pages."` | `"USE WHEN refreshing project evidence for a known kushi project AND boundaries.onenote.section_ids is non-empty. DO NOT USE for global OneNote search."` |
63
+ | `"Comprehensive eval framework."` | `"USE WHEN the user says 'run evals', 'eval canary', or before tagging a release. DO NOT USE for evidence validation of a real project."` |
64
+
65
+ ## Size caps
66
+
67
+ - ≤ 500 lines (`D30.skill-size`)
68
+ - ≤ 5000 tokens (~20 KB)
69
+
70
+ When you exceed either, **split into `references/<topic>.md` files** and cite them with explicit triggers:
71
+
72
+ ```markdown
73
+ Load `references/canonical-prompts.md` when constructing the WorkIQ query.
74
+ Load `references/error-modes.md` if the API returns non-200.
75
+ ```
76
+
77
+ Passive links (`[see foo](references/foo.md)`) do NOT count. The checker requires the literal substring `references/<file>.md` somewhere in SKILL.md if `references/` exists.
78
+
79
+ ## Evals (≥2 cases)
80
+
81
+ Every skill MUST ship `evals/evals.json` validated against `plugin/skills/eval/evals.schema.json`. Per `skill-evals.instructions.md`:
82
+
83
+ - `id`, `name`, `input`, `expected_assertions[]` (≥1), `grader_type` (`script` | `llm`).
84
+ - ≥2 cases. Mark canary-worthy ones `"canary": true`.
85
+ - Synthetic fixtures only — never real customer data.
86
+
87
+ The `create-skill` scaffold emits a starter `evals.json` with one `file-exists` and one `regex-match` case so the skill ships green from minute one.
88
+
89
+ ## Naming conventions
90
+
91
+ - **Skill directory + frontmatter `name`** — kebab-case, verb-led (`pull-onenote`, `consolidate-evidence`, `apply-ado-update`).
92
+ - **Skill types** (informational; pick at create time so the scaffold picks the right sections):
93
+ - `pull` — fetches evidence from a source.
94
+ - `writer` — writes files to `Evidence/` or `State/`.
95
+ - `orchestrator` — coordinates other skills.
96
+ - `other` — utility / tool / meta.
97
+ - **Instruction files** — `<topic>.instructions.md` in `plugin/instructions/`. Front-matter `name:` matches filename minus `.instructions.md`.
98
+
99
+ ## Contributor workflow
100
+
101
+ ```powershell
102
+ # 1. Scaffold
103
+ npx kushi-agents create-skill my-new-skill
104
+ # → answers: type (pull|writer|orchestrator|other), one-liner description
105
+ # → emits plugin/skills/my-new-skill/{SKILL.md, evals/evals.json}
106
+ # → marker file .created-by-skill-creator is written
107
+
108
+ # 2. Fill in the placeholders (search for "TODO(skill-creator)")
109
+
110
+ # 3. Validate
111
+ npx kushi-agents check-skill my-new-skill # lint mode
112
+ npm run eval -- my-new-skill # run evals
113
+
114
+ # 4. Optimize description before PR
115
+ npx kushi-agents optimize-description my-new-skill
116
+ # → emits a rewritten description; you decide whether to apply
117
+
118
+ # 5. Self-check + commit
119
+ pwsh plugin/skills/self-check/run.ps1 -Deep
120
+ git add plugin/skills/my-new-skill/
121
+ git commit -m "v<x.y.z>: my-new-skill"
122
+ ```
123
+
124
+ ## Retrofit (existing skills predating the harness)
125
+
126
+ Run `npx kushi-agents check-skill --all --retrofit` to identify gaps in legacy skills. `--apply` adds missing section stubs with `<!-- TODO(retrofit): fill in -->` markers — never overwrites existing content. The v5.0.4 dogfood report at `docs/audits/v5.0.4-skill-creator-dogfood.md` records the baseline.
127
+
128
+ ## Enforcement
129
+
130
+ | Check | What it does |
131
+ |---|---|
132
+ | `D34.skill-creator-exists` | `plugin/skills/skill-creator/scaffold.ps1` is parseable. |
133
+ | `D34.skill-checker-exists` | `plugin/skills/skill-checker/check-skill.ps1` is parseable. |
134
+ | `D34.creator-output-conforms` | Every skill carrying `.created-by-skill-creator` passes `check-skill --lint`. |
135
+ | `D34.retrofit-clean` | `check-skill --all --retrofit --dry-run` shows no unresolved non-additive gaps. |
136
+ | `D34.dogfood-report-fresh` | `docs/audits/v5.0.4-skill-creator-dogfood.md` was touched within 14 days (warn-only). |
137
+
138
+ ## References
139
+
140
+ - `plugin/instructions/agentskills-compliance.instructions.md` — the spec rules this builds on.
141
+ - `plugin/instructions/skill-evals.instructions.md` — the evals doctrine.
142
+ - `plugin/skills/skill-creator/SKILL.md` — the scaffolder.
143
+ - `plugin/skills/skill-checker/SKILL.md` — the linter / retrofitter.
144
+ - `docs/contributing/skill-authoring.md` — the human walkthrough.
145
+ - <https://github.com/anthropics/skills/blob/main/skills/skill-creator/SKILL.md> — upstream inspiration.
146
+ - <https://agentskills.io/skill-creation/best-practices>
147
+ - <https://agentskills.io/skill-creation/optimizing-descriptions>
@@ -197,3 +197,13 @@ Explicit triggers also accepted:
197
197
 
198
198
  - **v4.0.0 (kushi v5.0.0, 2026-05-26)**: graph-first cross-source resolution — consult `Evidence/_graph/project-graph.json` before walking weekly files when a question spans sources. Falls back to v4.9.0 walking strategy if graph absent/stale.
199
199
  - **v3.0.0 (kushi v4.9.0, 2026-05-26)**: 3-step reader fallback chain (`_index/entities.yml` → `weekly/*.md` → legacy `snapshot/` + `stream/`). New citation form `weekly/<YYYY-MM-DD>_<source>-csc.md#<anchor>`. Legacy citations suffixed `(legacy pre-v4.9.0 layout)`. Output marked with `Source-layout:` footer.
200
+
201
+
202
+ ## Validation loop
203
+
204
+ <!-- TODO(retrofit): fill in — describe how to verify this skill ran correctly. Auto-added by skill-checker --retrofit --apply per skill-authoring.instructions.md. -->
205
+
206
+ 1. Run pwsh plugin/skills/self-check/run.ps1 -Targeted <area>.
207
+ 2. Fix any findings, then re-run the affected step.
208
+ 3. Repeat until self-check exits 0.
209
+ 4. Only then update