kushi-agents 4.9.0 → 5.0.1

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 (68) hide show
  1. package/README.md +23 -1
  2. package/package.json +1 -1
  3. package/plugin/agents/kushi.agent.md +8 -2
  4. package/plugin/instructions/agentskills-compliance.instructions.md +144 -0
  5. package/plugin/instructions/dashboard-artifact.instructions.md +132 -0
  6. package/plugin/instructions/entity-graph.instructions.md +160 -0
  7. package/plugin/instructions/guided-tour.instructions.md +100 -0
  8. package/plugin/instructions/host-portability.instructions.md +77 -0
  9. package/plugin/instructions/karpathy-state-layout.instructions.md +124 -0
  10. package/plugin/instructions/plan-validate-execute.instructions.md +75 -0
  11. package/plugin/instructions/release-genealogy.instructions.md +52 -0
  12. package/plugin/plugin.json +17 -6
  13. package/plugin/prompts/dashboard.prompt.md +29 -0
  14. package/plugin/prompts/link-entities.prompt.md +30 -0
  15. package/plugin/prompts/tour.prompt.md +30 -0
  16. package/plugin/skills/aggregate-project/SKILL.md +11 -2
  17. package/plugin/skills/apply-ado-update/SKILL.md +11 -2
  18. package/plugin/skills/ask-project/SKILL.md +13 -2
  19. package/plugin/skills/bootstrap-project/SKILL.md +54 -126
  20. package/plugin/skills/bootstrap-project/references/discovery-sweep.md +40 -0
  21. package/plugin/skills/bootstrap-project/references/pull-dispatch.md +50 -0
  22. package/plugin/skills/bootstrap-project/references/registry-persistence.md +55 -0
  23. package/plugin/skills/build-state/SKILL.md +91 -4
  24. package/plugin/skills/consolidate-evidence/SKILL.md +11 -2
  25. package/plugin/skills/dashboard/SKILL.md +132 -0
  26. package/plugin/skills/emit-vertex/SKILL.md +10 -1
  27. package/plugin/skills/fde-intake/SKILL.md +10 -1
  28. package/plugin/skills/fde-report/SKILL.md +10 -1
  29. package/plugin/skills/fde-triage/SKILL.md +10 -1
  30. package/plugin/skills/intro/SKILL.md +1 -1
  31. package/plugin/skills/link-entities/SKILL.md +258 -0
  32. package/plugin/skills/link-entities/build-graph.ps1 +483 -0
  33. package/plugin/skills/project-status/SKILL.md +1 -1
  34. package/plugin/skills/propose-ado-update/SKILL.md +11 -2
  35. package/plugin/skills/pull-ado/SKILL.md +26 -9
  36. package/plugin/skills/pull-crm/SKILL.md +39 -125
  37. package/plugin/skills/pull-crm/references/dataverse-doctrine.md +108 -0
  38. package/plugin/skills/pull-crm/references/legacy-shape.md +28 -0
  39. package/plugin/skills/pull-email/SKILL.md +33 -79
  40. package/plugin/skills/pull-email/references/retrieval-order.md +43 -0
  41. package/plugin/skills/pull-email/references/two-pass-pull.md +41 -0
  42. package/plugin/skills/pull-loop/SKILL.md +194 -177
  43. package/plugin/skills/pull-meetings/SKILL.md +35 -72
  44. package/plugin/skills/pull-meetings/references/legacy-stream.md +15 -0
  45. package/plugin/skills/pull-meetings/references/verbatim-capture.md +61 -0
  46. package/plugin/skills/pull-misc/SKILL.md +24 -7
  47. package/plugin/skills/pull-onenote/SKILL.md +207 -555
  48. package/plugin/skills/pull-onenote/references/playwright-fallback.md +111 -0
  49. package/plugin/skills/pull-onenote/references/preflight.md +85 -0
  50. package/plugin/skills/pull-onenote/references/runtime-contract.md +118 -0
  51. package/plugin/skills/pull-sharepoint/SKILL.md +26 -9
  52. package/plugin/skills/pull-teams/SKILL.md +26 -9
  53. package/plugin/skills/refresh-project/SKILL.md +46 -3
  54. package/plugin/skills/self-check/SKILL.md +13 -1
  55. package/plugin/skills/self-check/run.ps1 +225 -3
  56. package/plugin/skills/setup/SKILL.md +14 -120
  57. package/plugin/skills/setup/references/onedrive-pin-sync.md +60 -0
  58. package/plugin/skills/setup/references/recovery-prompts.md +81 -0
  59. package/plugin/skills/tour/SKILL.md +85 -0
  60. package/plugin/skills/tour/build-tour.ps1 +185 -0
  61. package/plugin/skills/vertex-link/SKILL.md +1 -1
  62. package/plugin/templates/dashboard/dashboard.template.html +431 -0
  63. package/plugin/templates/dashboard/embedder.ps1 +56 -0
  64. package/plugin/templates/state/AGENTS.template.md +33 -0
  65. package/plugin/templates/state/CLAUDE.template.md +33 -0
  66. package/plugin/templates/state/index.template.md +41 -0
  67. package/plugin/templates/state/log.template.md +14 -0
  68. package/plugin/templates/state/page.template.md +22 -0
package/README.md CHANGED
@@ -3,6 +3,13 @@
3
3
  [![npm version](https://img.shields.io/npm/v/kushi-agents.svg)](https://www.npmjs.com/package/kushi-agents)
4
4
  [![npm downloads](https://img.shields.io/npm/dw/kushi-agents.svg)](https://www.npmjs.com/package/kushi-agents)
5
5
  [![license](https://img.shields.io/npm/l/kushi-agents.svg)](LICENSE)
6
+ [![host: Clawpilot](https://img.shields.io/badge/host-Clawpilot-7c9cff)](https://gim-home.github.io/kushi/)
7
+ [![host: VS Code](https://img.shields.io/badge/host-VS%20Code-007acc)](https://gim-home.github.io/kushi/)
8
+ [![spec: agentskills.io](https://img.shields.io/badge/spec-agentskills.io-22c55e)](https://agentskills.io/skill-creation/best-practices)
9
+
10
+ > **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
+
12
+ > **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).
6
13
 
7
14
  > A multi-skill GitHub Copilot agent for grounded engagement evidence — across Email, Teams, Meetings, OneNote, SharePoint, Dataverse (CRM), and Azure DevOps.
8
15
 
@@ -30,6 +37,18 @@ The split is deliberate: aggregation is **heavy, scheduled, replayable**; answer
30
37
 
31
38
  See [Concepts → Aggregate, then Answer](https://gim-home.github.io/kushi/concepts/aggregate-and-answer/) for the full pattern.
32
39
 
40
+ ## v5.0.0 — Cross-source graph + Karpathy State + interactive dashboard + auto-tour
41
+
42
+ v5.0.0 builds on the v4.9.0 Comprehensive Structured Capture (CSC) + weekly-only layout to surface cross-source structure:
43
+
44
+ - **Cross-source entity graph** — `link-entities` walks every per-source `_index/entities.yml` + weekly CSC body and emits `<project>/Evidence/_graph/project-graph.json`. Closed edge taxonomy (`references`, `decides`, `action-item-tracks`, `discusses`, `produced-by`, `follow-up-of`, `same-thread`, `participant-of`); deterministic by default; LLM augment is opt-in via `m365Mutable.graph.llm_infer`.
45
+ - **Karpathy-style State layout** — `build-state` now also emits `State/index.md` + `State/log.md` + per-entity pages under closed-set categories (`people/`, `opportunities/`, `adoworkitems/`, `decisions/`, `risks/`, `customerasks/`, `meetings/`, `artifacts/`), plus `State/CLAUDE.md` and `State/AGENTS.md`. Legacy `State/00_…–09_…` files coexist for `full` profile parity.
46
+ - **Interactive HTML dashboard** — `dashboard` writes a single self-contained `<project>/dashboard.html` (Cytoscape.js v3 + cose-bilkent, Clawpilot theme variables, Graph + Timeline tabs, source/alias/date filters, fuzzy search, side panel with cited CSC blocks).
47
+ - **Auto-generated guided tour** — `tour` writes `<project>/State/tour.md`, a top-N walkthrough scored by `recency_weight × cross_ref_count` (14-day half-life × graph degree). Default N=10, configurable via `m365Mutable.tour.topN`.
48
+ - **`refresh` and `bootstrap` chain it all** — at the end of each run, both orchestrators dispatch `link-entities → dashboard → tour`; failures are recorded but never block the next step.
49
+
50
+ No migration required. Run `@Kushi refresh <project>` to produce the graph, regenerate State/, write the dashboard, and write the tour.
51
+
33
52
  ## Two-way sync to ADO — preview shipped
34
53
 
35
54
  Kushi can now **propose updates back to ADO** from the cited evidence it already has. Two skills under the opt-in `preview` profile:
@@ -83,7 +102,10 @@ The Evidence/ folder produced by every profile is a **stable public contract**
83
102
  | `aggregate` | core+ | last watermark → now | Pull every enabled source + consolidate. **No State/ rebuild.** |
84
103
  | `bootstrap` | standard+ | 30 days (default) | First-time setup — scaffold folders, lay configs side-by-side, initial pull. Profile-aware (builds State only on `full`). |
85
104
  | `refresh` | standard+ | last watermark → now | Pull only what changed. Profile-aware (rebuilds State only on `full`). |
86
- | `state` | full | n/a | Render the outcome-based `State/` files from existing evidence. No new pulls. |
105
+ | `state` | full | n/a | Render the outcome-based `State/` files from existing evidence. No new pulls. v5.0.0 also emits Karpathy-style layout (`index.md` + `log.md` + per-entity pages under closed-set categories + `CLAUDE.md`/`AGENTS.md`). |
106
+ | `link-entities` | standard+ | n/a | v5.0.0 — Build the cross-source entity graph (`Evidence/_graph/project-graph.json`). Deterministic; opt-in LLM augment. |
107
+ | `dashboard` | standard+ | n/a | v5.0.0 — Render `<project>/dashboard.html` — single self-contained Cytoscape.js v3 dashboard with Graph + Timeline views, filters, fuzzy search, side panel. |
108
+ | `tour` | standard+ | n/a | v5.0.0 — Render `<project>/State/tour.md`, an auto-generated week-in-review walkthrough scored by `recency_weight × cross_ref_count`. |
87
109
  | `consolidate` | core+ | per week | Merge per-user streams into `_Consolidated/<YYYY-MM-DD>_consolidated.md`. |
88
110
  | `status` | core+ | n/a | Show the run-log for a project. |
89
111
  | `ask` | core+ | n/a | Read-only natural-language Q&A. Always cites. Auto-routes. |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kushi-agents",
3
- "version": "4.9.0",
3
+ "version": "5.0.1",
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": {
@@ -35,7 +35,10 @@ The Evidence/ folder produced by `aggregate` is the **public contract** between
35
35
  | `@Kushi bootstrap <project>` | standard+ | last 30 days | `bootstrap-project` → `pull-*` → `consolidate-evidence` → (full only) `build-state` |
36
36
  | `@Kushi refresh <project>` | standard+ | since last watermark (fallback 7d) | `refresh-project` → `pull-*` → `consolidate-evidence` → (full only) `build-state` |
37
37
  | `@Kushi refresh <project> last N days` / `since <date>` / `<from>..<to>` | standard+ | as supplied | same |
38
- | `@Kushi state <project>` | **full** | n/a (no pull) | `build-state` only — re-render State/ from existing Evidence |
38
+ | `@Kushi state <project>` | **full** | n/a (no pull) | `build-state` only — re-render State/ from existing Evidence (v5.0.0: ALSO emits Karpathy `State/` layout — `index.md` + `log.md` + per-entity pages + `CLAUDE.md`/`AGENTS.md` — gated on `m365Mutable.state.layout`, default `karpathy`). |
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
+ | `@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
+ | `@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. |
39
42
  | `@Kushi consolidate <project> last N days` | core+ | N days | `consolidate-evidence` only |
40
43
  | `@Kushi status <project>` | core+ | n/a | `project-status` — show run-log |
41
44
  | `@Kushi ask <project> <question>` | core+ | n/a (read-only) | `ask-project` — cited Q&A over Evidence/ (+ State/ on full) |
@@ -145,7 +148,10 @@ Top-level orchestrator skills (called directly by verbs):
145
148
  | `aggregate-project` | core+ | Pull-only orchestrator. Runs every enabled `pull-*` + `consolidate-evidence`. **Does NOT run `build-state`.** |
146
149
  | `bootstrap-project` | standard+ | First-time setup; lays configs side-by-side, scaffolds folders, runs initial 30d pull. Profile-aware: calls `build-state` only on `full`. |
147
150
  | `refresh-project` | standard+ | Watermark-driven incremental orchestrator. Profile-aware: calls `build-state` only on `full`. |
148
- | `build-state` | **full** | Renders `State/` from existing `Evidence/` (no source pulls). |
151
+ | `build-state` | **full** | Renders `State/` from existing `Evidence/` (no source pulls). v5.0.0: also emits Karpathy layout (`index.md` + `log.md` + per-entity pages + `CLAUDE.md`/`AGENTS.md`) when `m365Mutable.state.layout: karpathy` (default). |
152
+ | `link-entities` | standard+ | v5.0.0 — cross-source entity graph builder. Walks `Evidence/<alias>/<source>/_index/entities.yml` + weekly CSC bodies and emits `Evidence/_graph/project-graph.json` (nodes per canonical entity id, edges by closed taxonomy). LLM augment is opt-in via `m365Mutable.graph.llm_infer`. |
153
+ | `dashboard` | standard+ | v5.0.0 — renders `<project>/dashboard.html` (single self-contained file) from the entity graph + per-source `_index/entities.yml` + `State/index.md`. Cytoscape.js v3 + Clawpilot theme variables. |
154
+ | `tour` | standard+ | v5.0.0 — emits `<project>/State/tour.md`, an auto-generated week-in-review walkthrough scored by `recency_weight × cross_ref_count` (14-day half-life). |
149
155
  | `consolidate-evidence` | core+ | Merges per-user streams into `_Consolidated/`. |
150
156
  | `project-status` | core+ | Read-only run-log inspector. |
151
157
  | `ask-project` | core+ | Read-only natural-language Q&A over Evidence/ (+ State/ on full). Cited; no source pulls; no outbound. Auto-dispatches when a project name + question are detected. |
@@ -0,0 +1,144 @@
1
+ ---
2
+ name: "agentskills-compliance"
3
+ description: "Spec-compliance doctrine. Aligns every plugin/skills/<name>/SKILL.md with the conventions from https://agentskills.io/skill-creation/best-practices and /optimizing-descriptions. Defines size caps, load-on-trigger layout, gotchas, checklists, validation loops, plan-validate-execute, defaults-not-menus, and description-optimization rules. Enforced by self-check D30."
4
+ applies_to: "every plugin/skills/<name>/SKILL.md"
5
+ since: "kushi v5.0.1"
6
+ ---
7
+
8
+ # agentskills-compliance — doctrine
9
+
10
+ A SKILL.md is loaded **fully** into the agent's context window the moment it triggers. Every token competes with the conversation, system prompt, and other active skills. Compliance with the agentskills.io best-practices is therefore not stylistic — it is a context-budget contract.
11
+
12
+ Authoritative external references:
13
+
14
+ - <https://agentskills.io/skill-creation/best-practices>
15
+ - <https://agentskills.io/skill-creation/optimizing-descriptions>
16
+
17
+ ## Rules (HARD)
18
+
19
+ ### 1. Size cap
20
+
21
+ Every `plugin/skills/<name>/SKILL.md` MUST be:
22
+
23
+ - ≤ **500 lines**, AND
24
+ - ≤ **5000 tokens** (approximated by `char_count / 4`).
25
+
26
+ Oversize SKILLs MUST be split per rule 2 below. Enforced by `self-check D30.skill-size`.
27
+
28
+ ### 2. Load-on-trigger layout
29
+
30
+ `plugin/skills/<name>/SKILL.md` contains:
31
+
32
+ - front-matter (`name`, `version`, `description`)
33
+ - one-paragraph purpose
34
+ - `## Gotchas` (top 5) — pull-* skills MUST have this
35
+ - numbered or checklist procedure
36
+ - `## Validation loop` (writer skills)
37
+ - output contract
38
+
39
+ Bulk content (full canonical WorkIQ prompts, full error-mode taxonomies, deep schema details, worked examples) moves to `plugin/skills/<name>/references/<topic>.md`. Standard reference filenames:
40
+
41
+ | File | Contents |
42
+ |------|----------|
43
+ | `references/canonical-prompts.md` | Full WorkIQ prompt text (tier A/B/C, CSC, recovery) |
44
+ | `references/error-modes.md` | Error taxonomy with retry semantics |
45
+ | `references/taxonomy.md` | CSC schema deep details (where source-specific) |
46
+ | `references/examples.md` | Full worked examples |
47
+ | `references/playwright-fallback.md` | Opt-in fallback procedures |
48
+
49
+ Every reference cited from SKILL.md MUST be cited with an **explicit trigger**, not a passive link. Trigger templates:
50
+
51
+ ```
52
+ > Load references/canonical-prompts.md when constructing the WorkIQ query for this source.
53
+ > Load references/error-modes.md if the API returns non-200, or WorkIQ returns "throttled".
54
+ > Load references/playwright-fallback.md only when WorkIQ body-retrieval rate stays poor across ≥2 refreshes.
55
+ ```
56
+
57
+ Enforced by `self-check D30.references-layout`.
58
+
59
+ ### 3. Gotchas (top 5)
60
+
61
+ Every `pull-*` SKILL.md MUST surface its top 5 gotchas in a `## Gotchas` section near the top (immediately after the H1 / opening paragraph; before `## Steps` or `## Procedure`).
62
+
63
+ Format: bullet list. Each bullet starts with the **concrete failure mode**, then the correction.
64
+
65
+ ```markdown
66
+ ## Gotchas
67
+
68
+ - **Moved pages keep original wdsectionfileid** → if a section returns `page-body-unavailable` or zero `wdpartid` entries, the pages were authored elsewhere and moved. Open OneNote desktop, drag pages back into target section, retry.
69
+ - **WorkIQ tier C requires ONE page per call** — batching multiple pages into a single ask returns empty results. Loop over pageIds, one call each.
70
+ ```
71
+
72
+ Pull from `plugin/learnings/<source>.md` if present; else extract from the SKILL body itself. Enforced by `self-check D30.gotchas-section`.
73
+
74
+ ### 4. Checklists for orchestrators
75
+
76
+ Orchestrator SKILLs (`bootstrap-project`, `refresh-project`, `build-state`, `link-entities`, `dashboard`, `tour`) MUST use GitHub checkbox syntax `- [ ]` for their step lists so progress is trackable in tooling and in conversation.
77
+
78
+ ```markdown
79
+ - [ ] Step 1 — Resolve engagement root.
80
+ - [ ] Step 2 — Resolve project alias.
81
+ - [ ] Step 3 — Preflight per source.
82
+ ```
83
+
84
+ Enforced by `self-check D30.checklist-orchestrators`.
85
+
86
+ ### 5. Validation loops (writer skills)
87
+
88
+ Every skill that writes files to `Evidence/`, `State/`, `_graph/`, `dashboards/`, or `tours/` MUST end with a `## Validation loop` section:
89
+
90
+ ```markdown
91
+ ## Validation loop
92
+
93
+ After writing outputs:
94
+
95
+ 1. Run self-check targeted at this skill: `pwsh plugin/skills/self-check/run.ps1 -Targeted <area>`
96
+ 2. If failures: fix and re-run the affected step (not the whole skill).
97
+ 3. Repeat until self-check exits 0.
98
+ 4. Only then update `run-log.yml` with success status.
99
+ ```
100
+
101
+ Enforced by `self-check D30.validation-loop`.
102
+
103
+ ### 6. Plan-validate-execute (link-entities + build-state)
104
+
105
+ See `plan-validate-execute.instructions.md`. The skill writes a plan JSON, validates against a source of truth, then executes.
106
+
107
+ ### 7. Defaults not menus
108
+
109
+ Pick ONE tool for each procedure step. Alternatives are escape hatches and MUST live in `references/` (e.g. `references/playwright-fallback.md`), not in the main SKILL body. The SKILL.md procedure does not enumerate alternatives.
110
+
111
+ ### 8. Procedures over declarations
112
+
113
+ Write what the agent must DO, not what the skill IS. Imperative voice, concrete steps.
114
+
115
+ ### 9. Description optimization
116
+
117
+ Per <https://agentskills.io/skill-creation/optimizing-descriptions> the `description:` front-matter is the sole trigger signal. It MUST describe **WHEN to use** the skill (trigger conditions), not just what it does. Convention for kushi skills:
118
+
119
+ ```yaml
120
+ description: "USE WHEN <situational trigger> AND <precondition>. DO NOT USE for <near-miss>. <one-line capability summary>."
121
+ ```
122
+
123
+ - BAD: `"Pulls OneNote pages and saves them as markdown."`
124
+ - GOOD: `"USE WHEN refreshing project evidence for a known kushi project AND the project boundaries.onenote.section_ids list is non-empty. DO NOT USE for global OneNote search or non-kushi note capture."`
125
+
126
+ Hard limit: 1024 characters. Enforced loosely by `self-check D30.description-optimized` (checks for the literal substring `USE WHEN` or `WHEN ` near the start of `description:`).
127
+
128
+ ## Migration checklist (per oversized SKILL)
129
+
130
+ - [ ] Move full WorkIQ prompts → `references/canonical-prompts.md`
131
+ - [ ] Move full error taxonomy → `references/error-modes.md`
132
+ - [ ] Move source-specific schema details → `references/taxonomy.md`
133
+ - [ ] Move opt-in fallbacks (Playwright, Edge profile bootstrap) → `references/playwright-fallback.md`
134
+ - [ ] Add `## Gotchas` (top 5)
135
+ - [ ] Add `## Validation loop` (if writer)
136
+ - [ ] Replace inline blocks with "Load references/&lt;file&gt; when …" pointers
137
+ - [ ] Bump skill version (minor) since structure changed
138
+ - [ ] Re-run `self-check D30` and `npm test`
139
+
140
+ ## References
141
+
142
+ - `instructions/plan-validate-execute.instructions.md`
143
+ - `instructions/capture-learnings.instructions.md`
144
+ - `instructions/issue-recovery.instructions.md`
@@ -0,0 +1,132 @@
1
+ ---
2
+ applyTo: "**"
3
+ description: "v5.0.0 — Interactive HTML dashboard. Single self-contained `<project>/dashboard.html` rendered from `_graph/project-graph.json` + `_index/entities.yml` (per source) + `State/index.md`. Uses Cytoscape.js v3 + cose-bilkent layout, two-view tabs (Graph + Timeline), source/alias/date filters, fuzzy search, and a side panel that surfaces weekly CSC blocks on node click. Theming follows the Clawpilot `web-artifacts-builder` skill (CSS variables). Idempotent — regenerated every run."
4
+ ---
5
+
6
+ # Dashboard Artifact — HARD RULE (kushi v5.0.0+)
7
+
8
+ ## Why
9
+
10
+ Stakeholders ask "what happened on this engagement?" and we hand them
11
+ markdown nobody reads. v5.0.0 ships a single HTML file that visualizes the
12
+ project graph and lets the reader click any node to surface the cited CSC
13
+ block. No server, no build, no install — just open the file.
14
+
15
+ ## Output
16
+
17
+ - **Path:** `<engagement-root>/<project>/dashboard.html`
18
+ - **Producer:** `dashboard` skill.
19
+ - **Idempotency:** the file is **fully regenerated** every run. The producer
20
+ embeds the latest graph + indices + state catalog inline. There is no
21
+ external fetch at view time; the file opens from any path on any browser.
22
+
23
+ ## Input contract
24
+
25
+ The dashboard reads three things (all OPTIONAL; missing inputs gracefully
26
+ degrade the view):
27
+
28
+ 1. `<project>/Evidence/_graph/project-graph.json` — nodes + edges.
29
+ 2. `<project>/Evidence/<alias>/<source>/_index/entities.yml` for every
30
+ contributor / source — surfaces `latest_csc_file` + per-entity weekly
31
+ pointers used by the side panel.
32
+ 3. `<project>/State/index.md` — list of v5 State pages, used to populate the
33
+ side panel's "State pages" section.
34
+
35
+ If `_graph/project-graph.json` is missing, the dashboard is not produced.
36
+ (Self-check D22.dashboard enforces this.)
37
+
38
+ ## Output contract
39
+
40
+ A **single self-contained HTML file** with:
41
+
42
+ - All JS libraries inlined (no CDN at view time).
43
+ - All graph + index + state data inlined via
44
+ `<script id="graph-data" type="application/json">...</script>`
45
+ (and sibling `index-data` / `state-data` scripts).
46
+ - All CSS inlined using Clawpilot theme variables (per the
47
+ `web-artifacts-builder` skill).
48
+
49
+ ## Rendering stack
50
+
51
+ - **Cytoscape.js v3.x** for graph rendering (Q2 = B locked in the v5 plan).
52
+ v3.x because it is the current major; v3 ships an ES5-friendly minified
53
+ build that inlines cleanly into a single HTML file.
54
+ - **cytoscape-cose-bilkent** layout for force-directed node placement.
55
+ - **Optional fuzzy search:** inline `fuse.js` (≈ 9 KB minified) OR a 30-line
56
+ bespoke fuzzy matcher in the template — producer's choice based on the
57
+ final inline size budget.
58
+
59
+ CDN URLs are referenced at template **author time** for traceability, but
60
+ the bytes themselves are **embedded inline** in
61
+ `plugin/templates/dashboard/dashboard.template.html`. The shipped file does
62
+ NOT fetch from any CDN at view time.
63
+
64
+ ## Theming
65
+
66
+ Follows the Clawpilot `web-artifacts-builder` skill. The template MUST use
67
+ CSS variables (`--bg`, `--fg`, `--accent`, `--surface`, `--border`, etc.)
68
+ defined by that skill so the dashboard adopts the user's Clawpilot theme when
69
+ opened inside Clawpilot, and falls back to a Clawpilot-default light/dark
70
+ scheme when opened in a vanilla browser.
71
+
72
+ ## Views
73
+
74
+ The dashboard exposes two views via top-level tabs:
75
+
76
+ 1. **Graph view** — Cytoscape canvas. Nodes colored by `source`. Edge style
77
+ varies by `kind`. Default layout: `cose-bilkent`. Pan + zoom +
78
+ click-to-select.
79
+ 2. **Timeline view** — CSS-grid layout with one column per ISO week (computed
80
+ from `last_touched_iso` across all nodes). Within each column, nodes are
81
+ stacked + grouped by source. Click selects same as Graph view.
82
+
83
+ ## Side panel
84
+
85
+ Clicking a node opens a side panel showing:
86
+
87
+ - Title + source pill + last_touched date.
88
+ - `weekly_refs` — each rendered as a collapsible block. When expanded, the
89
+ block loads the cited CSC anchor inline (HTML-rendered markdown extracted
90
+ client-side from the embedded weekly file text, or — if the file body is
91
+ too large to inline — a click-through link to the file path).
92
+ - Incoming + outgoing edges with their evidence snippets + kind pill.
93
+ - Related State pages (resolved via `State/index.md`) as `[[wikilink]]`
94
+ click-throughs that open `State/<category>/<slug>.md`.
95
+
96
+ ## Filters
97
+
98
+ A header strip exposes:
99
+
100
+ - **Source** — multi-select pill list of the seven source families.
101
+ - **Alias** — multi-select of contributors who touched the project.
102
+ - **Date range** — slider over ISO-week buckets between
103
+ `min(first_seen_iso)` and `max(last_touched_iso)` across all nodes.
104
+
105
+ Filter application is client-side; no re-fetch.
106
+
107
+ ## Search
108
+
109
+ A search box (top-right of header) does fuzzy match on node `title`.
110
+ Selecting a hit pans the Graph view to the node and opens the side panel.
111
+
112
+ ## Configuration
113
+
114
+ Producer reads from the user's `m365-mutable.json` /
115
+ `integrations.yml#dashboard.*` (no required keys today; reserved for future
116
+ options like `dashboard.layout` override or `dashboard.maxNodes`).
117
+
118
+ ## Self-check
119
+
120
+ `D22.dashboard` enforces:
121
+
122
+ - If `_graph/project-graph.json` exists, `<project>/dashboard.html` exists.
123
+ - WARN (not fail) if `dashboard.html` is older than the graph file (suggests
124
+ the user ran `link-entities` standalone without `dashboard`).
125
+
126
+ ## Cross-references
127
+
128
+ - `entity-graph.instructions.md` — input schema (source of truth).
129
+ - `karpathy-state-layout.instructions.md` — `State/index.md` is one of the
130
+ inputs.
131
+ - `web-artifacts-builder` (Clawpilot user skill) — theming + single-HTML
132
+ packaging contract.
@@ -0,0 +1,160 @@
1
+ ---
2
+ applyTo: "**"
3
+ description: "v5.0.0 — Cross-source entity graph. One JSON artifact per project: `Evidence/_graph/project-graph.json`. Nodes are source entities (email threads, teams chats, meetings, OneNote pages, SharePoint sites, CRM records, ADO work items) keyed by canonical entity-id URIs from weekly-csc.instructions.md. Edges are typed (closed taxonomy) and carry weekly/+anchor evidence. Deterministic-first; LLM-inferred edges are opt-in. Multi-user safe: merge by node-id + (from,to,kind)."
4
+ ---
5
+
6
+ # Entity Graph — HARD RULE (kushi v5.0.0+)
7
+
8
+ ## Why
9
+
10
+ After v4.9.0 every entity across every source is captured as a structured CSC
11
+ block with a canonical entity-id. That makes one new artifact possible:
12
+ a project-scoped, cross-source graph that says **which entities relate to
13
+ which** — meeting decisions to ADO work items, customer asks to CRM
14
+ opportunities, email threads to meetings.
15
+
16
+ This doctrine defines the graph schema, the closed edge taxonomy, the
17
+ producer/reader contract, and the multi-user merge rules. The graph is
18
+ consumed by `dashboard`, `tour`, `build-state`, and `ask-project`.
19
+
20
+ ## Output
21
+
22
+ - **Path:** `<engagement-root>/<project>/Evidence/_graph/project-graph.json`
23
+ - **Producer:** `link-entities` skill (see `plugin/skills/link-entities/`).
24
+ - **Idempotency:** the file is **fully regenerated** on every `link-entities`
25
+ run. There is no append/merge across runs — the producer always rewalks
26
+ `_index/` + `weekly/` and rebuilds from scratch.
27
+
28
+ ## Schema
29
+
30
+ ```jsonc
31
+ {
32
+ "kushi_version": "5.0.0",
33
+ "project": "<project-name>",
34
+ "generated_at": "<ISO-8601 UTC>",
35
+ "generated_by_alias": "<alias>",
36
+ "nodes": [
37
+ {
38
+ "id": "<canonical-entity-id>", // see weekly-csc.instructions.md
39
+ "source": "email|teams|meetings|onenote|sharepoint|crm|ado",
40
+ "title": "<display title>",
41
+ "first_seen_iso": "YYYY-MM-DD",
42
+ "last_touched_iso": "YYYY-MM-DD",
43
+ "weekly_refs": [
44
+ "<alias>/<source>/weekly/YYYY-MM-DD_<source>-csc.md#<entity-anchor>"
45
+ ]
46
+ }
47
+ ],
48
+ "edges": [
49
+ {
50
+ "from": "<node-id>",
51
+ "to": "<node-id>",
52
+ "kind": "<one of the closed edge taxonomy values>",
53
+ "owner": "<optional — action-item-tracks only>",
54
+ "due": "<optional ISO date or 'unspecified' — action-item-tracks only>",
55
+ "evidence": {
56
+ "weekly_file": "<alias>/<source>/weekly/YYYY-MM-DD_<source>-csc.md",
57
+ "anchor": "<entity-anchor>",
58
+ "bullet_snippet": "<≥20 chars verbatim from the source bullet>"
59
+ },
60
+ "confidence": "explicit | inferred-llm"
61
+ }
62
+ ]
63
+ }
64
+ ```
65
+
66
+ ## Canonical entity-id formats
67
+
68
+ Identical to `weekly-csc.instructions.md` — the graph never invents IDs.
69
+
70
+ | Source | Canonical id |
71
+ |------------|--------------|
72
+ | email | `email://conversation_id=<id>` |
73
+ | teams | `teams://chat_id=<id>` OR `teams://channel=<teamId>/<channelId>/<rootMessageId>` |
74
+ | meetings | `meetings://joinurl=<urlencoded>&start=<iso>` |
75
+ | onenote | `onenote://page/wdpartid=<id>` |
76
+ | sharepoint | `sharepoint://siteurl=<url>` |
77
+ | crm | `crm://entity=<logicalName>/id=<guid>` |
78
+ | ado | `ado://org=<org>/project=<project>/workitemid=<int>` |
79
+
80
+ ## Closed edge taxonomy
81
+
82
+ Edges MUST use one of these `kind` values. Producers that need a new kind
83
+ update this doctrine first.
84
+
85
+ | `kind` | Meaning |
86
+ |---|---|
87
+ | `references` | X cites/links Y (URL reference in a bullet). |
88
+ | `decides` | X makes a decision that affects Y (bullet appears under Decisions). |
89
+ | `action-item-tracks` | An action item in X is tracked in Y (typically ADO/CRM). Bullet appears under Action Items. `owner` + `due` MAY be populated. |
90
+ | `discusses` | X (meeting/chat/email) discusses Y (CRM/ADO/OneNote/SharePoint). Bullet appears under Topics Discussed or Q & A. |
91
+ | `produced-by` | Artifact Y was produced from discussion X. |
92
+ | `follow-up-of` | Y is chronologically a follow-up to X. |
93
+ | `same-thread` | X and Y are part of the same conversation thread. |
94
+ | `participant-of` | Person Y is a participant in X. (Reserved — person nodes ship in a later release.) |
95
+
96
+ ## Evidence + citation requirements
97
+
98
+ - Every node has ≥ 1 `weekly_refs` entry that resolves to an existing
99
+ `<alias>/<source>/weekly/<file>` + `#<anchor>` on disk.
100
+ - Every edge carries `evidence.weekly_file` + `evidence.anchor` that resolve
101
+ on disk. `evidence.bullet_snippet` is the verbatim bullet text (or a leading
102
+ prefix ≥ 20 chars) that justified the edge.
103
+ - Edges with `confidence: inferred-llm` MUST include `bullet_snippet` ≥ 20
104
+ chars — empty inferences are forbidden.
105
+
106
+ ## Confidence
107
+
108
+ | Value | Meaning |
109
+ |---|---|
110
+ | `explicit` | Produced by the deterministic extractor (URL match, ID token match, conversation-id correlation). The default and the only confidence written when `m365Auth.linkEntities.llmInfer` is false (default). |
111
+ | `inferred-llm` | Produced by an LLM augment pass (WorkIQ call given the project entity inventory). Only emitted when `m365Auth.linkEntities.llmInfer: true` is set in the user's `m365-auth.yml`. |
112
+
113
+ When the flag is false, the graph contains **only** explicit edges. Toggling
114
+ the flag does not invalidate existing graphs — it just changes what the next
115
+ `link-entities` run will emit.
116
+
117
+ ## Multi-user merge rules
118
+
119
+ `link-entities` walks **all** contributors under `Evidence/<alias>/<source>/`
120
+ and produces a single project-scoped graph:
121
+
122
+ 1. **Nodes:** dedupe by `id`. If two contributors saw the same entity,
123
+ merge: `first_seen_iso = min`, `last_touched_iso = max`, `title` from the
124
+ most-recent contributor, `weekly_refs` is the **union** across contributors
125
+ (preserves per-contributor citations).
126
+ 2. **Edges:** dedupe by `(from, to, kind)`. When duplicates exist, keep the
127
+ one with the strongest confidence (`explicit > inferred-llm`); ties keep
128
+ the most-recent weekly_file. `weekly_refs` are not stored on edges —
129
+ evidence is the single bullet that justified the edge.
130
+ 3. **No contributor isolation.** The graph is a project artifact. Contributors
131
+ never own slices of it; `_graph/` lives outside any `<alias>/` folder.
132
+
133
+ ## Reader contract
134
+
135
+ Readers (dashboard, tour, build-state, ask-project) MUST treat the graph as
136
+ authoritative for "what relates to what" within a project, and MUST follow
137
+ edges back to `evidence.weekly_file#anchor` to cite their answers.
138
+
139
+ If `_graph/project-graph.json` is missing, readers fall back to the v4.9.0
140
+ behavior (walk `weekly/` + `_index/` per source).
141
+
142
+ ## Self-check
143
+
144
+ `D20.graph` enforces the schema:
145
+
146
+ - Every node has ≥ 1 `weekly_refs` entry that resolves on disk.
147
+ - Every edge has `evidence.weekly_file` + `anchor` that resolve on disk.
148
+ - Every edge `kind` is in the closed taxonomy above.
149
+ - Inferred-llm edges have `bullet_snippet` ≥ 20 chars.
150
+
151
+ ## Cross-references
152
+
153
+ - `weekly-csc.instructions.md` — canonical entity-id formats (source of truth).
154
+ - `comprehensive-structured-capture.instructions.md` — section taxonomy that
155
+ drives edge-kind inference (Decisions → `decides`, Action Items →
156
+ `action-item-tracks`, Topics/Q&A → `discusses`, else → `references`).
157
+ - `karpathy-state-layout.instructions.md` — consumer (writes one State page
158
+ per cross-source entity in the graph).
159
+ - `dashboard-artifact.instructions.md` — consumer (visualizes the graph).
160
+ - `guided-tour.instructions.md` — consumer (scores + walks the graph).
@@ -0,0 +1,100 @@
1
+ ---
2
+ applyTo: "**"
3
+ description: "v5.0.0 — Guided tour. Auto-generated week-in-review markdown walkthrough at `<project>/State/tour.md`. Score: `recency_weight × cross_ref_count`. recency_weight = exp(-days_since_last_touched / 14). cross_ref_count = degree in the graph. DFS through edges in priority order (decides → action-item-tracks → discusses → references → others). Default top-N = 10 (configurable via `m365Mutable.tour.topN`)."
4
+ ---
5
+
6
+ # Guided Tour — HARD RULE (kushi v5.0.0+)
7
+
8
+ ## Why
9
+
10
+ After link-entities + build-state, the project has a graph and a wiki, but
11
+ nothing tells a reader **where to start**. The tour is a small ranked
12
+ walkthrough that picks the most-recent, highest-degree entities and DFS-walks
13
+ their connections in order of edge importance.
14
+
15
+ ## Output
16
+
17
+ - **Path:** `<engagement-root>/<project>/State/tour.md`
18
+ - **Producer:** `tour` skill.
19
+ - **Idempotency:** fully regenerated each run.
20
+ - **Empty case:** if `_graph/project-graph.json` has zero nodes, `tour.md` is
21
+ written with a single line: `_No graph nodes — run @Kushi refresh first._`
22
+
23
+ ## Scoring
24
+
25
+ For each node N in the graph:
26
+
27
+ ```
28
+ days_since = max(0, today - last_touched_iso) # in whole days, UTC
29
+ recency_weight = exp(- days_since / 14) # 14-day half-life ≈ ln(2)/14 ≈ 0.0495
30
+ cross_ref_count = degree(N) # in + out edges, dedupe by edge identity
31
+ score(N) = recency_weight × cross_ref_count
32
+ ```
33
+
34
+ Sort nodes by `score` descending. Take the top-N (default 10; configurable
35
+ via `m365Mutable.tour.topN` in the user's per-project mutable config).
36
+
37
+ ## DFS ordering
38
+
39
+ Tour stops are emitted in DFS order starting from the highest-scored node:
40
+
41
+ 1. Start with the highest-scored unvisited node → emit it as the next stop.
42
+ 2. Pick the next node by walking that node's edges in **edge priority order**:
43
+ 1. `decides`
44
+ 2. `action-item-tracks`
45
+ 3. `discusses`
46
+ 4. `references`
47
+ 5. (any other kind in `entity-graph.instructions.md` taxonomy)
48
+ Within a priority bucket, prefer the edge whose target has the highest
49
+ unvisited `score`.
50
+ 3. Skip nodes already visited (cycle break).
51
+ 4. If the DFS hits a dead end before reaching N stops, restart from the
52
+ next-highest-scored unvisited node.
53
+ 5. Stop after N stops emitted.
54
+
55
+ ## Per-stop markdown shape
56
+
57
+ ```markdown
58
+ ## <ordinal>. <Node title>
59
+
60
+ > _Why this matters:_ <one-line synthesis — recency + degree + dominant edge
61
+ > kind, e.g. "Touched 3 days ago; ties together 5 ADO items and 2 CRM
62
+ > opportunities."_
63
+
64
+ - **Source:** `<source>` · last touched `YYYY-MM-DD`
65
+ - **Cite:** [`<alias>/<source>/weekly/<file>#<anchor>`](<relative path>)
66
+ - **Related State pages:** [[slug-a]] · [[slug-b]] · …
67
+ ```
68
+
69
+ Citations MUST resolve on disk (D23.tour enforces this).
70
+
71
+ ## Header
72
+
73
+ The file starts with:
74
+
75
+ ```markdown
76
+ ---
77
+ kushi_tour: true
78
+ generated_at: <ISO-8601 UTC>
79
+ generated_by_alias: <alias>
80
+ top_n: <N>
81
+ score_basis: "recency_weight × cross_ref_count (14-day half-life)"
82
+ ---
83
+
84
+ # Guided Tour — <project>
85
+
86
+ > _Auto-generated week-in-review. <N> top entities by recency × cross-reference count._
87
+ ```
88
+
89
+ ## Self-check
90
+
91
+ `D23.tour` enforces:
92
+
93
+ - If `_graph/project-graph.json` has ≥ 1 node, `State/tour.md` exists.
94
+ - Every tour stop's citation resolves to an existing weekly file + anchor.
95
+
96
+ ## Cross-references
97
+
98
+ - `entity-graph.instructions.md` — source of nodes + edge taxonomy.
99
+ - `karpathy-state-layout.instructions.md` — `[[wikilink]]` resolution rules
100
+ used by per-stop "Related State pages".