kushi-agents 4.9.0 → 5.0.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 (30) hide show
  1. package/README.md +18 -1
  2. package/package.json +1 -1
  3. package/plugin/agents/kushi.agent.md +8 -2
  4. package/plugin/instructions/dashboard-artifact.instructions.md +132 -0
  5. package/plugin/instructions/entity-graph.instructions.md +160 -0
  6. package/plugin/instructions/guided-tour.instructions.md +100 -0
  7. package/plugin/instructions/host-portability.instructions.md +77 -0
  8. package/plugin/instructions/karpathy-state-layout.instructions.md +124 -0
  9. package/plugin/plugin.json +17 -6
  10. package/plugin/prompts/dashboard.prompt.md +29 -0
  11. package/plugin/prompts/link-entities.prompt.md +30 -0
  12. package/plugin/prompts/tour.prompt.md +30 -0
  13. package/plugin/skills/ask-project/SKILL.md +13 -2
  14. package/plugin/skills/bootstrap-project/SKILL.md +17 -1
  15. package/plugin/skills/build-state/SKILL.md +42 -3
  16. package/plugin/skills/dashboard/SKILL.md +113 -0
  17. package/plugin/skills/link-entities/SKILL.md +216 -0
  18. package/plugin/skills/link-entities/build-graph.ps1 +483 -0
  19. package/plugin/skills/refresh-project/SKILL.md +22 -1
  20. package/plugin/skills/self-check/SKILL.md +5 -0
  21. package/plugin/skills/self-check/run.ps1 +120 -0
  22. package/plugin/skills/tour/SKILL.md +68 -0
  23. package/plugin/skills/tour/build-tour.ps1 +185 -0
  24. package/plugin/templates/dashboard/dashboard.template.html +431 -0
  25. package/plugin/templates/dashboard/embedder.ps1 +56 -0
  26. package/plugin/templates/state/AGENTS.template.md +33 -0
  27. package/plugin/templates/state/CLAUDE.template.md +33 -0
  28. package/plugin/templates/state/index.template.md +41 -0
  29. package/plugin/templates/state/log.template.md +14 -0
  30. package/plugin/templates/state/page.template.md +22 -0
package/README.md CHANGED
@@ -3,6 +3,8 @@
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/)
6
8
 
7
9
  > A multi-skill GitHub Copilot agent for grounded engagement evidence — across Email, Teams, Meetings, OneNote, SharePoint, Dataverse (CRM), and Azure DevOps.
8
10
 
@@ -30,6 +32,18 @@ The split is deliberate: aggregation is **heavy, scheduled, replayable**; answer
30
32
 
31
33
  See [Concepts → Aggregate, then Answer](https://gim-home.github.io/kushi/concepts/aggregate-and-answer/) for the full pattern.
32
34
 
35
+ ## v5.0.0 — Cross-source graph + Karpathy State + interactive dashboard + auto-tour
36
+
37
+ v5.0.0 builds on the v4.9.0 Comprehensive Structured Capture (CSC) + weekly-only layout to surface cross-source structure:
38
+
39
+ - **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`.
40
+ - **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.
41
+ - **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).
42
+ - **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`.
43
+ - **`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.
44
+
45
+ No migration required. Run `@Kushi refresh <project>` to produce the graph, regenerate State/, write the dashboard, and write the tour.
46
+
33
47
  ## Two-way sync to ADO — preview shipped
34
48
 
35
49
  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 +97,10 @@ The Evidence/ folder produced by every profile is a **stable public contract**
83
97
  | `aggregate` | core+ | last watermark → now | Pull every enabled source + consolidate. **No State/ rebuild.** |
84
98
  | `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
99
  | `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. |
100
+ | `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`). |
101
+ | `link-entities` | standard+ | n/a | v5.0.0 — Build the cross-source entity graph (`Evidence/_graph/project-graph.json`). Deterministic; opt-in LLM augment. |
102
+ | `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. |
103
+ | `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
104
  | `consolidate` | core+ | per week | Merge per-user streams into `_Consolidated/<YYYY-MM-DD>_consolidated.md`. |
88
105
  | `status` | core+ | n/a | Show the run-log for a project. |
89
106
  | `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.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": {
@@ -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,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".
@@ -0,0 +1,77 @@
1
+ ---
2
+ applyTo: "**"
3
+ description: "v5.0.0 — Host portability contract. `plugin/agents/kushi.agent.md` is the single source of truth for the multi-host top-level agent contract. Per-skill `plugin/skills/<n>/SKILL.md` files are host-portable (Claude Code skills, Clawpilot, Codex AGENTS.md, Copilot custom agents, Cursor, Gemini CLI). The install scripts mirror agent.md → SKILL.md for hosts that discover via SKILL.md (e.g. Clawpilot). No code changes are required by this doctrine — it is a contract write-up."
4
+ ---
5
+
6
+ # Host Portability — HARD RULE (kushi v5.0.0+)
7
+
8
+ ## Why
9
+
10
+ Kushi is shipped through several distinct host surfaces:
11
+
12
+ - **GitHub Copilot** (VS Code) — discovers via `.github/copilot-instructions.kushi.md`.
13
+ - **Clawpilot** (a Copilot fork) — discovers via `~/.copilot/m-skills/kushi/SKILL.md`.
14
+ - **Claude Code** — discovers via the Claude Code skills system (per-skill
15
+ `SKILL.md` in a known location).
16
+ - **Codex / OpenAI Agents SDK** — discovers via `AGENTS.md` at the project root.
17
+ - **Cursor** — discovers via `.cursor/rules/*.md`.
18
+ - **Gemini CLI** — discovers via per-skill markdown.
19
+
20
+ All of these surfaces consume the **same** prose. v5.0.0 formalizes that one
21
+ file is the source of truth and the install scripts mirror it where required.
22
+
23
+ ## Source of truth
24
+
25
+ `plugin/agents/kushi.agent.md` is the canonical top-level agent contract. It
26
+ describes the verbs, the routing, the global rules, and the references to
27
+ every skill / instruction / prompt.
28
+
29
+ Every other host-facing entry point (the live install's `SKILL.md`, the
30
+ `.github/copilot-instructions.kushi.md` shim, the `AGENTS.md` written into a
31
+ project's `State/`) is **derived** from this file via:
32
+
33
+ 1. `src/main.mjs` — mirrors `plugin/agents/kushi.agent.md` →
34
+ `~/.copilot/m-skills/kushi/SKILL.md` during `npx kushi-agents
35
+ --clawpilot` install. See the existing top-of-file comment in
36
+ `src/main.mjs`:
37
+
38
+ > `// Mirror agents/kushi.agent.md as top-level SKILL.md for Clawpilot discovery.`
39
+
40
+ 2. `plugin/templates/state/CLAUDE.template.md` / `AGENTS.template.md` —
41
+ per-project agent doc, written by `build-state` into `<project>/State/`.
42
+ The two templates are byte-identical (see
43
+ `karpathy-state-layout.instructions.md`); both reiterate "this is a kushi
44
+ project, use `[[wikilinks]]`, cite `Evidence/<alias>/<source>/weekly/...`
45
+ for every claim."
46
+
47
+ Self-check `D4` already enforces byte-identical parity between
48
+ `plugin/agents/kushi.agent.md` and the live install's `SKILL.md`.
49
+
50
+ ## Per-skill portability
51
+
52
+ Every per-skill `plugin/skills/<n>/SKILL.md` is host-portable by construction:
53
+
54
+ - Frontmatter (`name`, `version`, `description`) matches the Claude Code
55
+ skills system and the Clawpilot skills system.
56
+ - Skill prose uses relative markdown links (`../../instructions/<x>.md`) that
57
+ resolve regardless of which host root the file is rendered under.
58
+ - No host-specific tool names appear in the SKILL.md body. Tool dispatch
59
+ happens through neutral verbs (`WorkIQ`, `m365_*`) that each host wires up
60
+ in its own way.
61
+
62
+ ## No code changes
63
+
64
+ This doctrine introduces **no** new code or mirror behavior. The install
65
+ scripts already do the right thing; v5.0.0 simply documents the contract so
66
+ future hosts can be added by:
67
+
68
+ 1. Reading `plugin/agents/kushi.agent.md`.
69
+ 2. Pointing the new host's discovery at that file (or a mirrored copy).
70
+ 3. Re-running self-check to confirm `D4` still passes.
71
+
72
+ ## Cross-references
73
+
74
+ - `kushi-config-root.instructions.md` — config layout is also host-portable
75
+ (vscode `<workspace>/.kushi/` vs Clawpilot `~/.copilot/m-skills/kushi/`).
76
+ - `karpathy-state-layout.instructions.md` — per-project `State/CLAUDE.md` +
77
+ `State/AGENTS.md` are the per-project portability mirror.