kushi-agents 5.0.3 → 5.1.0

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.
Files changed (40) hide show
  1. package/README.md +30 -0
  2. package/bin/cli.mjs +166 -1
  3. package/package.json +2 -2
  4. package/plugin/agents/kushi.agent.md +5 -2
  5. package/plugin/instructions/living-wiki.instructions.md +88 -0
  6. package/plugin/instructions/log-format.instructions.md +78 -0
  7. package/plugin/instructions/skill-authoring.instructions.md +147 -0
  8. package/plugin/instructions/wiki-lint.instructions.md +110 -0
  9. package/plugin/skills/_shared/Append-StateLog.ps1 +73 -0
  10. package/plugin/skills/_shared/Update-StateIndex.ps1 +47 -0
  11. package/plugin/skills/ask-project/SKILL.md +40 -0
  12. package/plugin/skills/build-state/SKILL.md +18 -2
  13. package/plugin/skills/intro/SKILL.md +160 -451
  14. package/plugin/skills/intro/references/walkthrough.md +310 -0
  15. package/plugin/skills/lint-state/.created-by-skill-creator +0 -0
  16. package/plugin/skills/lint-state/SKILL.md +98 -0
  17. package/plugin/skills/lint-state/evals/evals.json +34 -0
  18. package/plugin/skills/lint-state/lint.ps1 +218 -0
  19. package/plugin/skills/project-status/SKILL.md +10 -1
  20. package/plugin/skills/self-check/SKILL.md +4 -1
  21. package/plugin/skills/self-check/run.ps1 +214 -3
  22. package/plugin/skills/setup/SKILL.md +10 -0
  23. package/plugin/skills/skill-checker/SKILL.md +136 -0
  24. package/plugin/skills/skill-checker/check-skill.ps1 +416 -0
  25. package/plugin/skills/skill-checker/evals/evals.json +41 -0
  26. package/plugin/skills/skill-creator/SKILL.md +134 -0
  27. package/plugin/skills/skill-creator/evals/evals.json +40 -0
  28. package/plugin/skills/skill-creator/generate-eval-review.ps1 +101 -0
  29. package/plugin/skills/skill-creator/optimize-description.ps1 +87 -0
  30. package/plugin/skills/skill-creator/scaffold.ps1 +180 -0
  31. package/plugin/skills/skill-creator/templates/evals-starter.template.json +27 -0
  32. package/plugin/skills/skill-creator/templates/gotchas-stub.template.md +9 -0
  33. package/plugin/skills/skill-creator/templates/skill-skeleton.template.md +28 -0
  34. package/plugin/skills/vertex-link/SKILL.md +10 -0
  35. package/plugin/templates/state/answers.README.md +7 -0
  36. package/plugin/templates/state/hot.template.md +12 -0
  37. package/plugin/templates/state/review-queue.template.md +10 -0
  38. package/src/eval-runner.test.mjs +1 -1
  39. package/src/skill-checker.test.mjs +118 -0
  40. package/src/skill-creator.test.mjs +92 -0
package/README.md CHANGED
@@ -7,6 +7,8 @@
7
7
  [![host: VS Code](https://img.shields.io/badge/host-VS%20Code-007acc)](https://gim-home.github.io/kushi/)
8
8
  [![spec: agentskills.io](https://img.shields.io/badge/spec-agentskills.io-22c55e)](https://agentskills.io/skill-creation/best-practices)
9
9
 
10
+ > **v5.1.0 — Living wiki.** Build-state is now incremental: human edits outside `<!-- kushi:auto -->` fences are preserved, contradictions are flagged with Obsidian-compatible callouts (`> [!warning]`), and a new `lint-state` skill monitors wiki health. State/ is a valid [Obsidian](https://obsidian.md) vault — callout syntax, Dataview-compatible frontmatter, and `[[wikilinks]]` all work natively.
11
+
10
12
  > **v5.0.1 spec-compliance pass.** Every `plugin/skills/<name>/SKILL.md` follows the [agentskills.io best practices](https://agentskills.io/skill-creation/best-practices) and [optimizing-descriptions](https://agentskills.io/skill-creation/optimizing-descriptions) guides: ≤ 500 lines & ≤ 5000 tokens, load-on-trigger references, top-5 gotchas, checklist orchestrators, validation loops, plan-validate-execute for graph + State writers, and "USE WHEN …" descriptions. Enforced by `self-check -Deep` D30.*.
11
13
 
12
14
  > **Project lineage:** for the *why* behind each release — what built on what, what trade-offs were accepted, what external work inspired which design — see [`docs/genealogy.md`](docs/genealogy.md). Every release MUST add an entry there before tagging (enforced by `self-check` D31.genealogy).
@@ -74,6 +76,21 @@ Apply [a]ll · [s]elect · [n]one?
74
76
 
75
77
  Try it: `npx kushi-agents --clawpilot --profile preview` · How-to: [Two-way ADO update](https://gim-home.github.io/kushi/how-to/two-way-ado-update/) · Roadmap: [`docs/concepts/roadmap.md`](docs/concepts/roadmap.md).
76
78
 
79
+ ## Obsidian compatible
80
+
81
+ `State/` is a valid [Obsidian](https://obsidian.md) vault out of the box:
82
+
83
+ - **Callout syntax** — contradictions use `> [!warning]` / `> [!info]` callouts (native Obsidian rendering).
84
+ - **Dataview compatible** — every State page has YAML frontmatter (`kushi_state_page: true`, `entity_ids`, `related`, timestamps) queryable by [Dataview](https://blacksmithgu.github.io/obsidian-dataview/).
85
+ - **Wikilinks** — cross-references use `[[category/slug]]` form, resolvable by Obsidian's link resolver.
86
+ - **No binary assets required** — all content is plain Markdown. No images, no custom plugins needed.
87
+
88
+ To use: point Obsidian at `<project>/State/` as a vault. The `index.md` serves as the home page, `log.md` is the activity feed, and category folders (`people/`, `decisions/`, etc.) are navigable in the sidebar.
89
+
90
+ > **Note:** Obsidian is optional. State/ works identically without it — the conventions are designed to be tool-agnostic while being Obsidian-first for teams that use it.
91
+
92
+ <!-- Screenshot placeholder: Obsidian rendering of State/ with contradiction callouts visible. No binary screenshots committed — use text descriptions or link to docs site. -->
93
+
77
94
  ---
78
95
 
79
96
  ## Three install profiles
@@ -235,6 +252,19 @@ npm pack --dry-run
235
252
 
236
253
  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
254
 
255
+ ## Authoring a new skill (v5.0.4+)
256
+
257
+ Adding a new skill takes one command + a per-skill lint loop:
258
+
259
+ ```powershell
260
+ node bin/cli.mjs create-skill --name my-thing --type writer --description "Generates the foo report from State/"
261
+ node bin/cli.mjs check-skill --name my-thing
262
+ node bin/cli.mjs check-skill --name my-thing --retrofit --apply # auto-fix additive findings
263
+ npm run eval -- my-thing
264
+ ```
265
+
266
+ 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).
267
+
238
268
  ## Evaluating skills (v5.0.3+)
239
269
 
240
270
  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,27 @@ 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
+
18
+ // ── lint verb (v5.1.0+) ──────────────────────────────────────────────────────
19
+ if (args.length > 0 && args[0] === 'lint') {
20
+ const project = args[1] || '';
21
+ if (!project) {
22
+ console.error('\n Usage: kushi lint <project>\n');
23
+ process.exit(1);
24
+ }
25
+ await dispatchLint(project);
26
+ process.exit(0);
27
+ }
28
+
8
29
  if (args.includes('--help') || args.includes('-h')) {
9
30
  console.log(`
10
31
  Usage: npx kushi-agents [options]
@@ -41,13 +62,27 @@ if (args.includes('--help') || args.includes('-h')) {
41
62
 
42
63
  --help, -h Show this help
43
64
 
65
+ Skill authoring (v5.0.4+):
66
+ create-skill <name> --type <pull|writer|orchestrator|other> --description "<d>"
67
+ Scaffold a new plugin/skills/<name>/ tree.
68
+ check-skill <name> Lint a skill against the agentskills.io blueprint.
69
+ check-skill --all [--retrofit [--apply]]
70
+ Audit (or retrofit) every skill in plugin/skills/.
71
+ optimize-description <skill>
72
+ Rewrite a skill's description per the optimizer rules.
73
+ review-evals <skill> Render an HTML side-by-side eval-review viewer.
74
+
75
+ Wiki maintenance (v5.1.0+):
76
+ lint <project> Run wiki-lint checks on State/ (contradictions, stale claims, orphans).
77
+
44
78
  After install, talk to Kushi:
45
79
  bootstrap <project> First-time setup
46
80
  refresh <project> Incremental refresh + rebuild State/
47
81
  state <project> Re-render State/ from existing Evidence
48
82
  consolidate <project> Merge per-user evidence
49
83
  status <project> Show run-log
50
- ask <project> <q> Cited Q&A over Evidence/ (auto-routes)
84
+ ask <project> <q> Cited Q&A over Evidence/ (auto-routes, --file-back to save)
85
+ lint <project> Run wiki-lint checks on State/
51
86
 
52
87
  In VS Code Chat the prefix is "@Kushi". In Clawpilot just say "kushi <verb>".
53
88
  `);
@@ -114,3 +149,133 @@ function getFlag(flag) {
114
149
  const match = args.find((a) => a.startsWith(prefix));
115
150
  return match ? match.slice(prefix.length) : undefined;
116
151
  }
152
+
153
+ // ── skill-authoring verb dispatch (v5.0.4+) ─────────────────────────────────
154
+ async function dispatchSkillVerb(verb, rest) {
155
+ const { spawnSync } = await import('node:child_process');
156
+ const path = await import('node:path');
157
+ const url = await import('node:url');
158
+ const here = path.dirname(url.fileURLToPath(import.meta.url));
159
+ const repoRoot = path.resolve(here, '..');
160
+ const creatorDir = path.join(repoRoot, 'plugin', 'skills', 'skill-creator');
161
+ const checkerDir = path.join(repoRoot, 'plugin', 'skills', 'skill-checker');
162
+
163
+ let script, scriptArgs = [];
164
+ switch (verb) {
165
+ case 'create-skill': {
166
+ // Usage: kushi create-skill <name> [--type <t>] [--description "<d>"] [--force]
167
+ const name = rest.find((a) => !a.startsWith('-'));
168
+ if (!name) {
169
+ console.error('Usage: kushi-agents create-skill <name> --type <pull|writer|orchestrator|other> --description "USE WHEN ... DO NOT USE FOR ..."');
170
+ process.exit(1);
171
+ }
172
+ const type = pickFlag(rest, '--type') || 'other';
173
+ const desc = pickFlag(rest, '--description') || `USE WHEN ${name} is invoked. DO NOT USE FOR unrelated tasks.`;
174
+ script = path.join(creatorDir, 'scaffold.ps1');
175
+ scriptArgs = ['-Name', name, '-Type', type, '-Description', desc];
176
+ if (rest.includes('--force')) scriptArgs.push('-Force');
177
+ if (rest.includes('--dry-run')) scriptArgs.push('-DryRun');
178
+ break;
179
+ }
180
+ case 'check-skill': {
181
+ // Usage: kushi check-skill <name> | --all [--retrofit] [--apply]
182
+ script = path.join(checkerDir, 'check-skill.ps1');
183
+ const allFlag = rest.includes('--all') || rest.includes('-All');
184
+ const name = rest.find((a) => !a.startsWith('-'));
185
+ if (allFlag) scriptArgs.push('-All');
186
+ else if (name) scriptArgs.push('-Skill', name);
187
+ else {
188
+ console.error('Usage: kushi-agents check-skill <name> | --all [--retrofit] [--apply] [--dry-run]');
189
+ process.exit(1);
190
+ }
191
+ if (rest.includes('--retrofit')) scriptArgs.push('-Retrofit');
192
+ if (rest.includes('--apply')) scriptArgs.push('-Apply');
193
+ if (rest.includes('--dry-run')) scriptArgs.push('-DryRun');
194
+ if (rest.includes('--json')) scriptArgs.push('-Json');
195
+ break;
196
+ }
197
+ case 'optimize-description': {
198
+ // Usage: kushi optimize-description <skill>
199
+ const name = rest.find((a) => !a.startsWith('-'));
200
+ if (!name) {
201
+ console.error('Usage: kushi-agents optimize-description <skill>');
202
+ process.exit(1);
203
+ }
204
+ script = path.join(checkerDir, 'check-skill.ps1');
205
+ scriptArgs = ['-Skill', name, '-OptimizeDescription'];
206
+ break;
207
+ }
208
+ case 'review-evals': {
209
+ // Usage: kushi review-evals <skill>
210
+ const name = rest.find((a) => !a.startsWith('-'));
211
+ if (!name) {
212
+ console.error('Usage: kushi-agents review-evals <skill>');
213
+ process.exit(1);
214
+ }
215
+ script = path.join(checkerDir, 'check-skill.ps1');
216
+ scriptArgs = ['-Skill', name, '-Review'];
217
+ break;
218
+ }
219
+ default:
220
+ console.error(`Unknown skill verb: ${verb}`);
221
+ process.exit(1);
222
+ }
223
+
224
+ const result = spawnSync('pwsh', ['-NoProfile', '-File', script, ...scriptArgs], { stdio: 'inherit' });
225
+ process.exit(result.status ?? 1);
226
+ }
227
+
228
+ async function dispatchLint(project) {
229
+ const { spawn } = await import('node:child_process');
230
+ const { resolve } = await import('node:path');
231
+ const { fileURLToPath } = await import('node:url');
232
+ const __dirname = fileURLToPath(new URL('.', import.meta.url));
233
+ const scriptPath = resolve(__dirname, '..', 'plugin', 'skills', 'lint-state', 'lint.ps1');
234
+
235
+ const cwd = process.cwd();
236
+ const { readdirSync, existsSync } = await import('node:fs');
237
+ let stateDir = '';
238
+
239
+ const evidenceDir = resolve(cwd, project, 'Evidence');
240
+ if (existsSync(evidenceDir)) {
241
+ const aliases = readdirSync(evidenceDir, { withFileTypes: true })
242
+ .filter(d => d.isDirectory() && !d.name.startsWith('_'));
243
+ for (const alias of aliases) {
244
+ const candidate = resolve(evidenceDir, alias.name, 'State');
245
+ if (existsSync(candidate)) { stateDir = candidate; break; }
246
+ }
247
+ }
248
+
249
+ if (!stateDir) {
250
+ const direct = resolve(cwd, project, 'State');
251
+ if (existsSync(direct)) { stateDir = direct; }
252
+ }
253
+
254
+ if (!stateDir) {
255
+ console.error(`\n Could not find State/ directory for project '${project}'.`);
256
+ console.error(` Looked in: ${evidenceDir}/*/State/ and ${resolve(cwd, project, 'State')}/`);
257
+ console.error(` Run 'kushi state ${project}' first to build State/.\n`);
258
+ process.exit(1);
259
+ }
260
+
261
+ const child = spawn('pwsh', ['-NoProfile', '-File', scriptPath, '-StateDir', stateDir], {
262
+ stdio: 'inherit',
263
+ cwd: resolve(__dirname, '..'),
264
+ });
265
+
266
+ return new Promise((res, rej) => {
267
+ child.on('close', (code) => {
268
+ if (code !== 0) rej(new Error(`lint-state exited with code ${code}`));
269
+ else res();
270
+ });
271
+ child.on('error', rej);
272
+ });
273
+ }
274
+
275
+ function pickFlag(args, flag) {
276
+ const idx = args.indexOf(flag);
277
+ if (idx !== -1 && idx + 1 < args.length) return args[idx + 1];
278
+ const prefix = flag + '=';
279
+ const m = args.find((a) => a.startsWith(prefix));
280
+ return m ? m.slice(prefix.length) : undefined;
281
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kushi-agents",
3
- "version": "5.0.3",
3
+ "version": "5.1.0",
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",
@@ -17,8 +17,8 @@ Kushi ships in three profiles. The installed profile is recorded in `kushi-insta
17
17
  | Profile | What's installed | Verbs available |
18
18
  |---|---|---|
19
19
  | `core` | Aggregator only: `setup`, `pull-*`, `consolidate-evidence`, `aggregate-project`, `ask-project`, `project-status`, `vertex-link`, `emit-vertex`, `self-check`, `eval`, `intro` | `setup`, `aggregate`, `consolidate`, `status`, `pull`, `ask`, `vertex-link`, `emit-vertex` |
20
- | `standard` *(default)* | core + `bootstrap-project`, `refresh-project`, `fde-intake`, `fde-report`, `fde-triage` + FDE reference pack | core + `bootstrap`, `refresh`, `fde-intake`, `fde-report`, `fde-triage` |
21
- | `full` | standard + `build-state` | standard + `state` |
20
+ | `standard` *(default)* | core + `bootstrap-project`, `refresh-project`, `lint-state`, `fde-intake`, `fde-report`, `fde-triage` + FDE reference pack | core + `bootstrap`, `refresh`, `lint`, `fde-intake`, `fde-report`, `fde-triage` |
21
+ | `full` | standard + `build-state`, `link-entities`, `dashboard`, `tour` | standard + `state`, `link-entities`, `dashboard`, `tour` |
22
22
  | **`preview`** *(opt-in)* | standard + `propose-ado-update`, `apply-ado-update` | standard + `propose-ado`, `apply-ado` |
23
23
 
24
24
  The Evidence/ folder produced by `aggregate` is the **public contract** between Kushi and any downstream consumer (external rollup repo, BI tooling). See `docs/reference/evidence-contract.md`.
@@ -39,6 +39,7 @@ The Evidence/ folder produced by `aggregate` is the **public contract** between
39
39
  | `@Kushi link-entities <project>` | standard+ | n/a (read-only) | v5.0.0 — `link-entities` writes `<project>/Evidence/_graph/project-graph.json` from per-source `_index/entities.yml` + weekly CSC bodies. Deterministic by default; opt-in LLM augment via `m365Mutable.graph.llm_infer`. |
40
40
  | `@Kushi dashboard <project>` | standard+ | n/a (read-only) | v5.0.0 — `dashboard` writes `<project>/dashboard.html` (single self-contained file). Cytoscape.js v3 + Clawpilot theme. |
41
41
  | `@Kushi tour <project> [--top N]` | standard+ | n/a (read-only) | v5.0.0 — `tour` writes `<project>/State/tour.md`, an auto-generated week-in-review walkthrough scored by `recency_weight × cross_ref_count` (14-day half-life). Default N=10. |
42
+ | `@Kushi lint <project>` | standard+ | n/a (read-only) | v5.1.0 — `lint-state` runs wiki-lint checks against `State/` (contradictions, stale claims, orphans, missing cross-refs, data gaps). Writes `State/reports/lint-YYYY-MM-DD.md`. |
42
43
  | `@Kushi consolidate <project> last N days` | core+ | N days | `consolidate-evidence` only |
43
44
  | `@Kushi status <project>` | core+ | n/a | `project-status` — show run-log |
44
45
  | `@Kushi ask <project> <question>` | core+ | n/a (read-only) | `ask-project` — cited Q&A over Evidence/ (+ State/ on full) |
@@ -182,4 +183,6 @@ Meta skills (not called by verbs):
182
183
  | Skill | Role |
183
184
  |---|---|
184
185
  | `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". |
186
+ | `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 "..."`. |
187
+ | `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
188
  | `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,88 @@
1
+ ---
2
+ name: "living-wiki"
3
+ description: "v5.1.0 — Incremental-maintenance + contradiction-handling pattern for State/. Build-state preserves human edits outside <!-- kushi:auto --> fences; contradictions are flagged with callouts, never silently overwritten. Adapted from Karpathy's living-wiki gist. Authored to agentskills.io spec; deltas: adds incremental fencing convention + contradiction lifecycle + auto-resolve threshold not present in source."
4
+ applies_to: "build-state, lint-state, all writers touching State/"
5
+ since: "kushi v5.1.0"
6
+ ---
7
+
8
+ # living-wiki — doctrine
9
+
10
+ > **Authored to [agentskills.io](https://agentskills.io/skill-creation/best-practices) spec.**
11
+ > Deltas from source (Karpathy's living-wiki gist): adds `<!-- kushi:auto -->` fencing convention, contradiction lifecycle (current → contradicted → superseded), auto-resolve threshold with 3 conditions, `_review-queue.md` open-contradiction tracker.
12
+
13
+ Adapted from [Karpathy's living-wiki gist](https://gist.github.com/karpathy/442a6bf555914893e9891c11519de94f). The core insight: a wiki maintained by both humans and machines must have clear ownership boundaries and explicit conflict resolution — silent overwrites destroy trust.
14
+
15
+ ## Rules (HARD)
16
+
17
+ ### 1. Incremental maintenance
18
+
19
+ Every writer skill that touches `State/` MUST:
20
+
21
+ - **Preserve human edits.** Content outside `<!-- kushi:auto:start -->` / `<!-- kushi:auto:end -->` fences is NEVER modified by automation. Writers only update derived sections between those fences.
22
+ - **Never wipe the page.** If a page exists, read it first. Regenerate only the fenced regions. If the page does not exist, create it with fences around any auto-derived content.
23
+ - **Fence hygiene.** Every auto-derived block MUST be wrapped:
24
+ ```markdown
25
+ <!-- kushi:auto:start section="<section-id>" -->
26
+ ...auto-derived content...
27
+ <!-- kushi:auto:end section="<section-id>" -->
28
+ ```
29
+ The `section` attribute identifies which derivation produced this block (e.g., `section="entity-summary"`, `section="related-entities"`).
30
+
31
+ ### 2. Contradiction handling
32
+
33
+ When a new fact contradicts an existing claim (different value for the same entity property):
34
+
35
+ - **Flag both claims** with Obsidian-compatible callouts:
36
+ ```markdown
37
+ > [!warning] Contradicted by build-state run 2026-05-28
38
+ > Previous value: "MACC $500K" [source: ushak/crm/weekly/2026-05-01_crm-csc.md#acme-opp · 2026-05-01]
39
+
40
+ > [!info] New value (2026-05-28)
41
+ > Current value: "MACC $750K" [source: ushak/crm/weekly/2026-05-22_crm-csc.md#acme-opp · 2026-05-22]
42
+ ```
43
+ - **Never silently overwrite.** The old value stays visible until explicitly resolved.
44
+ - **Add to `_review-queue.md`** with entity, property, old value, new value, both sources, and date flagged.
45
+
46
+ ### 3. Contradiction lifecycle
47
+
48
+ Each contradicted claim moves through states:
49
+
50
+ | State | Meaning |
51
+ |---|---|
52
+ | `current` | Active, accepted truth. |
53
+ | `contradicted` | A newer claim disagrees. Both are visible. |
54
+ | `superseded` | Resolved — old claim is archived. The newer (or human-chosen) value wins. |
55
+
56
+ ### 4. Auto-resolve threshold
57
+
58
+ A contradicted claim MAY be automatically marked `superseded` (and removed from `_review-queue.md`) when ALL of:
59
+
60
+ 1. The new claim has **≥ 3 corroborating sources from different surfaces** (e.g., meetings + CRM + email all agree on the new value).
61
+ 2. The contradicted claim is **≥ 30 days old** (based on its source citation date).
62
+ 3. The contradicted claim has **no human override marker** (`<!-- kushi:human-override -->` above the claim blocks auto-resolve).
63
+
64
+ When auto-resolved, replace the callout pair with:
65
+ ```markdown
66
+ > [!info] Auto-resolved 2026-06-28 — superseded by 3+ corroborating sources (meetings, crm, email)
67
+ > Previous value archived: "MACC $500K" [source: ...]
68
+ ```
69
+
70
+ ### 5. `_review-queue.md`
71
+
72
+ Located at `Evidence/<alias>/State/_review-queue.md`. Lists all open (unresolved) contradictions:
73
+
74
+ ```markdown
75
+ # Review Queue
76
+
77
+ | Entity | Property | Old value | New value | Flagged | Sources |
78
+ |---|---|---|---|---|---|
79
+ | Acme Opp | MACC | $500K | $750K | 2026-05-28 | crm, meetings |
80
+ ```
81
+
82
+ Updated by `build-state` on every run. Cleared when contradictions are resolved (auto or manual).
83
+
84
+ ## References
85
+
86
+ - [Karpathy's living-wiki gist](https://gist.github.com/karpathy/442a6bf555914893e9891c11519de94f)
87
+ - `karpathy-state-layout.instructions.md` (v5.0.0 base layout)
88
+ - `wiki-lint.instructions.md` (contradiction-flagged finding class)
@@ -0,0 +1,78 @@
1
+ ---
2
+ name: "log-format"
3
+ description: "v5.1.0 — Canonical log format for State/log.md. Every writer appends reverse-chronological entries with grep-friendly headings. Adapted from axoviq-ai/synthadoc log-as-history pattern. Authored to agentskills.io spec; deltas: kushi-specific ops taxonomy, index.md 'Last touched' pointer, append-only rule."
4
+ applies_to: "every writer skill that touches State/ (bootstrap-project, refresh-project, build-state, lint-state, link-entities, dashboard, tour, ask-project --file-back)"
5
+ since: "kushi v5.1.0"
6
+ ---
7
+
8
+ # log-format — doctrine
9
+
10
+ > **Authored to [agentskills.io](https://agentskills.io/skill-creation/best-practices) spec.**
11
+ > Deltas from source (axoviq-ai/synthadoc): kushi-specific op taxonomy (`bootstrap`, `refresh`, `build-state`, `lint-state`, `ask-fileback`, `link-entities`, `dashboard`, `tour`), `index.md` "Last touched" pointer, reverse-chronological append-only rule.
12
+
13
+ Adapted from [axoviq-ai/synthadoc](https://github.com/axoviq-ai/synthadoc) — the log-as-grep-friendly-history pattern.
14
+
15
+ ## Rules (HARD)
16
+
17
+ ### 1. Canonical format
18
+
19
+ Every entry in `Evidence/<alias>/State/log.md` MUST use this heading format:
20
+
21
+ ```markdown
22
+ ## [YYYY-MM-DD HH:MM] <op> | <title>
23
+
24
+ <1–3 line summary>
25
+ Sources: <comma-separated source pointers>
26
+ ```
27
+
28
+ Example:
29
+ ```markdown
30
+ ## [2026-05-28 14:30] build-state | Incremental rebuild (3 entities updated)
31
+
32
+ Re-derived people/jane-doe.md, decisions/macc-increase.md, risks/timeline-slip.md.
33
+ Contradictions flagged: 1 (Acme Opp MACC). Auto-resolved: 0.
34
+ Sources: ushak/crm/weekly/2026-05-22_crm-csc.md, ushak/meetings/weekly/2026-05-21_meetings-csc.md
35
+ ```
36
+
37
+ ### 2. Grep-friendly
38
+
39
+ The heading format is designed for grep:
40
+ ```bash
41
+ grep '^## \[2026-05-' log.md # all May 2026 entries
42
+ grep '^## \[.*\] build-state' log.md # all build-state runs
43
+ grep '^## \[.*\] lint-state' log.md # all lint runs
44
+ ```
45
+
46
+ ### 3. Ops taxonomy (closed set)
47
+
48
+ | Op | Writer skill | Meaning |
49
+ |---|---|---|
50
+ | `bootstrap` | bootstrap-project | First-time project setup |
51
+ | `refresh` | refresh-project | Incremental evidence pull + state rebuild |
52
+ | `build-state` | build-state | Pure re-render of State/ from Evidence/ |
53
+ | `lint-state` | lint-state | Wiki lint pass over State/ |
54
+ | `ask-fileback` | ask-project --file-back | Q&A answer written back to State/answers/ |
55
+ | `link-entities` | link-entities | Cross-source graph rebuild |
56
+ | `dashboard` | dashboard | Dashboard HTML regeneration |
57
+ | `tour` | tour | Guided tour regeneration |
58
+
59
+ ### 4. Append-only, reverse-chronological
60
+
61
+ - New entries are **prepended** (newest at top, after the front-matter and file header).
62
+ - Entries are NEVER deleted or rewritten.
63
+ - Readers scan top-down for recency.
64
+
65
+ ### 5. Index.md "Last touched" pointer
66
+
67
+ After appending to `log.md`, the writer MUST also update the top of `State/index.md`:
68
+
69
+ ```markdown
70
+ > Last touched: YYYY-MM-DD HH:MM by <op> ([log](log.md))
71
+ ```
72
+
73
+ This single-line pointer lives immediately after the front-matter block of `index.md`.
74
+
75
+ ## References
76
+
77
+ - [axoviq-ai/synthadoc](https://github.com/axoviq-ai/synthadoc)
78
+ - `karpathy-state-layout.instructions.md` (log.md base contract)
@@ -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>