kushi-agents 3.4.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 (111) hide show
  1. package/.github/config/m365-auth.json.example +56 -0
  2. package/.github/config/m365-mutable.json.example +11 -0
  3. package/LICENSE +201 -0
  4. package/README.md +159 -0
  5. package/bin/cli.mjs +75 -0
  6. package/package.json +35 -0
  7. package/plugin/agents/kushi.agent.md +147 -0
  8. package/plugin/instructions/answer-from-evidence.instructions.md +73 -0
  9. package/plugin/instructions/auth-and-retry.instructions.md +116 -0
  10. package/plugin/instructions/az-auth-conditional.instructions.md +39 -0
  11. package/plugin/instructions/azure-auth-patterns.instructions.md +226 -0
  12. package/plugin/instructions/citation-ledger.instructions.md +52 -0
  13. package/plugin/instructions/engagement-root-resolution.instructions.md +82 -0
  14. package/plugin/instructions/evidence-thoroughness.instructions.md +62 -0
  15. package/plugin/instructions/side-by-side-config.instructions.md +56 -0
  16. package/plugin/instructions/snapshot-vs-stream.instructions.md +87 -0
  17. package/plugin/instructions/thoroughness-detector.instructions.md +105 -0
  18. package/plugin/instructions/workiq-first.instructions.md +47 -0
  19. package/plugin/plugin.json +96 -0
  20. package/plugin/prompts/aggregate.prompt.md +24 -0
  21. package/plugin/prompts/ask.prompt.md +16 -0
  22. package/plugin/prompts/bootstrap.prompt.md +23 -0
  23. package/plugin/prompts/consolidate.prompt.md +21 -0
  24. package/plugin/prompts/fde-intake.prompt.md +41 -0
  25. package/plugin/prompts/fde-report.prompt.md +46 -0
  26. package/plugin/prompts/fde-triage.prompt.md +46 -0
  27. package/plugin/prompts/refresh.prompt.md +17 -0
  28. package/plugin/prompts/state.prompt.md +17 -0
  29. package/plugin/prompts/status.prompt.md +17 -0
  30. package/plugin/reference-packs/README.md +74 -0
  31. package/plugin/reference-packs/fde/README.md +62 -0
  32. package/plugin/reference-packs/fde/core-fde-reference.md +427 -0
  33. package/plugin/reference-packs/fde/intake-questions.md +168 -0
  34. package/plugin/reference-packs/fde/report-doctrine.md +189 -0
  35. package/plugin/skills/aggregate-project/SKILL.md +72 -0
  36. package/plugin/skills/ask-project/SKILL.md +162 -0
  37. package/plugin/skills/bootstrap-project/SKILL.md +129 -0
  38. package/plugin/skills/build-state/SKILL.md +69 -0
  39. package/plugin/skills/consolidate-evidence/SKILL.md +47 -0
  40. package/plugin/skills/fde-intake/SKILL.md +147 -0
  41. package/plugin/skills/fde-report/SKILL.md +159 -0
  42. package/plugin/skills/fde-triage/SKILL.md +114 -0
  43. package/plugin/skills/intro/SKILL.md +449 -0
  44. package/plugin/skills/project-status/SKILL.md +61 -0
  45. package/plugin/skills/pull-ado/SKILL.md +77 -0
  46. package/plugin/skills/pull-crm/SKILL.md +75 -0
  47. package/plugin/skills/pull-email/SKILL.md +75 -0
  48. package/plugin/skills/pull-meetings/SKILL.md +77 -0
  49. package/plugin/skills/pull-onenote/SKILL.md +82 -0
  50. package/plugin/skills/pull-sharepoint/SKILL.md +85 -0
  51. package/plugin/skills/pull-teams/SKILL.md +75 -0
  52. package/plugin/skills/refresh-project/SKILL.md +89 -0
  53. package/plugin/skills/self-check/SKILL.md +166 -0
  54. package/plugin/skills/self-check/run.ps1 +517 -0
  55. package/plugin/skills/self-check/run.sh +33 -0
  56. package/plugin/templates/fde/intake.md +114 -0
  57. package/plugin/templates/fde/report-fitness.md +151 -0
  58. package/plugin/templates/fde/report-long.md +109 -0
  59. package/plugin/templates/fde/report-short.md +45 -0
  60. package/plugin/templates/fde/report-stage-readiness.md +70 -0
  61. package/plugin/templates/fde/report-weekly.md +73 -0
  62. package/plugin/templates/fde/triage-00-fde-analysis.md +78 -0
  63. package/plugin/templates/fde/triage-02-risk-analysis.md +76 -0
  64. package/plugin/templates/fde/triage-03-6Q.md +40 -0
  65. package/plugin/templates/fde/triage-04-readiness-checklist.md +82 -0
  66. package/plugin/templates/fde/triage-05-executive-consolidated.md +78 -0
  67. package/plugin/templates/fde/triage-06-global-opportunity.md +70 -0
  68. package/plugin/templates/fde/triage-07-validation-warnings.md +60 -0
  69. package/plugin/templates/init/ado-config.template.yml +21 -0
  70. package/plugin/templates/init/crm-config.template.yml +16 -0
  71. package/plugin/templates/init/kushi-projects.template.json +14 -0
  72. package/plugin/templates/init/m365-auth.template.json +67 -0
  73. package/plugin/templates/init/m365-mutable.template.json +19 -0
  74. package/plugin/templates/init/project-contributors.template.yml +27 -0
  75. package/plugin/templates/init/project-evidence.template.yml +32 -0
  76. package/plugin/templates/init/project-integrations.template.yml +34 -0
  77. package/plugin/templates/init/project-user-settings.template.yml +71 -0
  78. package/plugin/templates/paste-prompt.md +35 -0
  79. package/plugin/templates/snapshot/ado-item.template.md +45 -0
  80. package/plugin/templates/snapshot/crm-record.template.md +34 -0
  81. package/plugin/templates/snapshot/meetings-series-index.template.md +32 -0
  82. package/plugin/templates/snapshot/onenote-page.template.md +28 -0
  83. package/plugin/templates/snapshot/sharepoint-file.template.md +31 -0
  84. package/plugin/templates/snapshot/sharepoint-tree.template.md +39 -0
  85. package/plugin/templates/snapshot/teams-roster.template.md +27 -0
  86. package/plugin/templates/state/00_overview.template.md +44 -0
  87. package/plugin/templates/state/01_decisions.template.md +41 -0
  88. package/plugin/templates/state/02_stakeholders.template.md +48 -0
  89. package/plugin/templates/state/03_architecture-and-solution.template.md +56 -0
  90. package/plugin/templates/state/04_workshops-and-key-meetings.template.md +43 -0
  91. package/plugin/templates/state/05_action-items.template.md +29 -0
  92. package/plugin/templates/state/06_risks-and-issues.template.md +43 -0
  93. package/plugin/templates/state/07_timeline-and-milestones.template.md +45 -0
  94. package/plugin/templates/state/08_artifacts-and-deliverables.template.md +55 -0
  95. package/plugin/templates/state/09_open-questions.template.md +62 -0
  96. package/plugin/templates/state/README.md +41 -0
  97. package/plugin/templates/weekly/ado-stream.template.md +71 -0
  98. package/plugin/templates/weekly/consolidated.template.md +98 -0
  99. package/plugin/templates/weekly/crm-stream.template.md +74 -0
  100. package/plugin/templates/weekly/email-stream.template.md +103 -0
  101. package/plugin/templates/weekly/meetings-stream.template.md +182 -0
  102. package/plugin/templates/weekly/onenote-stream.template.md +106 -0
  103. package/plugin/templates/weekly/run-log.template.md +88 -0
  104. package/plugin/templates/weekly/sharepoint-stream.template.md +121 -0
  105. package/plugin/templates/weekly/teams-stream.template.md +121 -0
  106. package/src/constants.mjs +49 -0
  107. package/src/copy-assets.mjs +183 -0
  108. package/src/main.mjs +262 -0
  109. package/src/profile-resolver.mjs +168 -0
  110. package/src/prompt.mjs +42 -0
  111. package/src/settings.mjs +77 -0
@@ -0,0 +1,75 @@
1
+ ---
2
+ name: "pull-email"
3
+ version: "2.0.0"
4
+ description: "Pull Email evidence (stream only — emails ARE events). WorkIQ-first. Scopes to configured project email folder per m365-mutable hints."
5
+ ---
6
+
7
+ # Skill: pull-email
8
+
9
+ Pulls **email** evidence in two shapes per `snapshot-vs-stream.instructions.md`:
10
+
11
+ - **snapshot/** — (none — emails ARE events, no snapshot)
12
+ - **stream/** — messages with full body, sender, recipients, attachments, reply chain — grouped by thread
13
+
14
+ WorkIQ-first per `workiq-first.instructions.md`. Thoroughness per `evidence-thoroughness.instructions.md`; runtime detector + auto-retry + paste-prompt per `thoroughness-detector.instructions.md`. Citations per `citation-ledger.instructions.md`. Side-by-side mutable hints written immediately on discovery per `side-by-side-config.instructions.md`.
15
+
16
+ ## Inputs
17
+
18
+ - `<project>` — already-resolved project name.
19
+ - `<alias>` — current contributor.
20
+ - `<window>` — date range. For snapshot: ignored (always full re-fetch). For stream: `(from, to)`.
21
+ - (read) `<engagement-root>/.project-evidence/m365/m365-mutable.json m365Mutable.knownSections.<project>` — pinned hints.
22
+ - (read) `<engagement-root>/<project>/Evidence/<alias>/.settings.yml` — per-(project x user) overrides.
23
+
24
+ ## Resolution hints (pinned in mutable)
25
+
26
+ - `emailContext.folder` — full path of the project's email folder
27
+ - `emailContext.folderId` — folder ID for direct lookup
28
+
29
+ ## Snapshot pass
30
+
31
+ _(no snapshot for email — emails are inherently event-stream)_
32
+
33
+ Write to: `<engagement-root>/<project>/Evidence/<alias>/email/snapshot/<entity>.md`
34
+
35
+ Use template: `templates/snapshot/email-<kind>.template.md`
36
+
37
+ ## Stream pass
38
+
39
+ Per `evidence-thoroughness.instructions.md`: every substantive thread gets sender + recipients (to+cc) + subject + **full body or close paraphrase** + attachments + reply chain in order. Group by thread.
40
+
41
+ Write to: `<engagement-root>/<project>/Evidence/<alias>/email/stream/<YYYY-MM-DD>_email-stream.md` (date = Monday of the ISO week the events fall in).
42
+
43
+ Use template: `templates/weekly/email-summary.template.md`
44
+
45
+ If a week file already exists, MERGE (dedupe by event ID, append new events, keep existing).
46
+
47
+ ## Tools (in order)
48
+
49
+ 1. **WorkIQ** — ````$WorkIQQuery`````
50
+ 2. **Host fallback** — `m365_search_emails` / `m365_list_emails` scoped to `m365Auth.emailContext.folders`
51
+ 3. **Graph REST** — last resort, soft-fail per `az-auth-conditional.instructions.md`.
52
+ 4. **Ask user** — paste verbatim source content if all above fail.
53
+
54
+ Document which path succeeded under `## Source Basis` in each output file.
55
+
56
+ ## Mutable hints to upsert (during the run, not at the end)
57
+
58
+ If discovered, immediately write to `m365Mutable.knownSections.<project>.<source>` with `discoveredOn` + `confidence`:
59
+
60
+ - `emailContext.folder` — full path of the project's email folder
61
+ - `emailContext.folderId` — folder ID for direct lookup
62
+
63
+ ## Update run-log
64
+
65
+ After successful pass:
66
+ - `sources.email.last_pulled = now`
67
+ - `sources.email.watermark = now` (stream only; snapshot has no watermark)
68
+ - `sources.email.item_count = <N>`
69
+ - For each week touched, add to `weekly_files` index.
70
+
71
+ ## Stop conditions
72
+
73
+ - Hint missing AND fuzzy resolution returns 0 candidates → ask user once, persist answer to mutable, continue.
74
+ - Multiple plausible candidates → ask user to pick, persist answer.
75
+ - WorkIQ fails AND host fallback fails AND Graph fails → write evidence file with `❌ all paths failed` marker, log to run-log errors, continue with rest of run.
@@ -0,0 +1,77 @@
1
+ ---
2
+ name: "pull-meetings"
3
+ version: "2.1.0"
4
+ description: "Pull Meetings evidence (snapshot: series-index; stream: per-meeting transcripts + decisions + actions). WorkIQ-first; falls back to chat reconstruction when transcripts don't exist."
5
+ ---
6
+
7
+ # Skill: pull-meetings
8
+
9
+ Pulls **meetings** evidence in two shapes per `snapshot-vs-stream.instructions.md`:
10
+
11
+ - **snapshot/** — series-index.md listing all recurring meeting series for this project (subject, recurrence, organizer, current attendees)
12
+ - **stream/** — per-meeting blocks: attendees (req/opt/actual), agenda, **chronological transcript walk-through with verbatim quotes + timestamps**, decisions, actions, open questions, artifact links
13
+
14
+ Auth + retry + error logging per `auth-and-retry.instructions.md`. WorkIQ-first per `workiq-first.instructions.md`. Thoroughness per `evidence-thoroughness.instructions.md`; runtime detector + auto-retry + paste-prompt per `thoroughness-detector.instructions.md`. Citations per `citation-ledger.instructions.md`.
15
+
16
+ ## Inputs
17
+
18
+ - `<project>` — already-resolved project name.
19
+ - `<alias>` — current contributor.
20
+ - `<window>` — date range. For snapshot: ignored (always full re-fetch). For stream: `(from, to)`.
21
+ - (read) `<engagement-root>/.project-evidence/m365/m365-mutable.json m365Mutable.knownSections.<project>` — pinned hints (`calendarContext.subjectKeywords`, `calendarContext.knownSeries`).
22
+
23
+ ## Discovery (snapshot pass)
24
+
25
+ 1. `m365_list_meetings` over the window with `subjectKeywords` filter (post-filter — Graph search is relevance-ranked, not exact).
26
+ 2. For each match: capture `id`, `subject`, `start`, `end`, `organizer`, `joinUrl`. Persist to mutable as `calendarContext.knownSeries[]`.
27
+ 3. Cross-reference with Teams chat IDs from `pull-teams` (meeting chat IDs of form `19:meeting_…@thread.v2`). Each match enriches with attendee roster + chat ID.
28
+
29
+ Write `snapshot/series-index.md` listing all matched series. Updated every refresh (organizers/attendees may change).
30
+
31
+ ## Per-meeting stream pass — path cascade
32
+
33
+ For EACH meeting in the window, attempt to capture transcript text via this cascade. Apply retry pattern per `auth-and-retry.instructions.md`. Record errors[] entry for each path attempted.
34
+
35
+ 1. **WorkIQ**: `Get full transcript and Copilot recap for meeting "<subject>" on <date>`.
36
+ 2. **`m365_get_transcript`** with the meeting's `joinUrl`.
37
+ 3. **Reconstruction from chat** (NOT a failure — first-class fallback). When transcripts simply don't exist (transcription was off, or VTT not yet attached), reconstruct evidence from:
38
+ - Meeting chat thread: `m365_list_chat_messages(chatId)` — captured already by `pull-teams`.
39
+ - Pre/post-meeting context messages.
40
+ - Any Copilot recap card posted to the chat.
41
+ Mark the per-meeting block `Source basis: reconstructed from meeting chat (no transcript)`. This is **evidence**, not a gap.
42
+ 4. **Ask user**: paste verbatim transcript or notes if all above produced nothing usable.
43
+
44
+ A meeting block built from chat reconstruction with attendees + key decisions + actions is **valid evidence**. Do NOT mark such a meeting as `failed`. Mark it `partial` only if NO source produced any content (no transcript AND no chat messages).
45
+
46
+ ## Stream pass
47
+
48
+ Per `evidence-thoroughness.instructions.md`: every meeting in the window gets a full per-meeting block. **A 30-line meetings file for a week with 2 meetings is a defect — expect 200+ lines.**
49
+
50
+ Write to: `<engagement-root>/<project>/Evidence/<alias>/Meetings/stream/<YYYY-MM-DD>_meetings-stream.md` (date = Monday of the ISO week).
51
+
52
+ Use template: `templates/weekly/meetings-summary.template.md`
53
+
54
+ If a week file already exists, MERGE (dedupe by event ID, append new events, keep existing).
55
+
56
+ ## Mutable hints to upsert (during the run, not at the end)
57
+
58
+ If discovered, immediately write to `m365Mutable.knownSections.<project>.calendarContext` with `discoveredOn` + `confidence`:
59
+
60
+ - `subjectKeywords` — keywords that successfully matched
61
+ - `knownSeries[]` — `{id, subject, joinUrl, chatId}` for each resolved meeting
62
+
63
+ ## Update run-log
64
+
65
+ After the pass:
66
+ - `sources.meetings.last_run = now`
67
+ - `sources.meetings.last_status = ok | partial | failed | skipped-auth`
68
+ - `sources.meetings.watermark_to = now`
69
+ - `sources.meetings.items_pulled = <N meetings with at least chat-reconstruction>`
70
+ - `sources.meetings.errors = [...]` per `auth-and-retry.instructions.md` schema. Use signature `transcripts-not-generated` with `action_taken: reconstructed-from-chat` when relevant — do NOT use `failed`.
71
+ - For each week touched, add to `weekly_files` index.
72
+
73
+ ## Stop conditions
74
+
75
+ - Subject keyword resolution returns 0 candidates → ask user once for keywords, persist to mutable, continue.
76
+ - A meeting has neither transcript NOR chat messages → write `❌ no source available` block, log error, continue.
77
+ - All paths failed for ALL meetings in the window → mark source `failed`, write a single `❌ all paths failed` evidence file with actionable next step.
@@ -0,0 +1,82 @@
1
+ ---
2
+ name: "pull-onenote"
3
+ version: "2.1.0"
4
+ description: "Pull OneNote evidence (snapshot: full page bodies; stream: page-edit events). WorkIQ-only per workspace auth policy — Graph OneNote is unreliable."
5
+ ---
6
+
7
+ # Skill: pull-onenote
8
+
9
+ Pulls **onenote** evidence in two shapes per `snapshot-vs-stream.instructions.md`:
10
+
11
+ - **snapshot/** — full page bodies — one file per page with last-modified + author + verbatim body content
12
+ - **stream/** — page-edit events with diff summary (created/modified/renamed/deleted)
13
+
14
+ Auth + retry + error logging per `auth-and-retry.instructions.md`. WorkIQ-only per `workiq-first.instructions.md`. Thoroughness per `evidence-thoroughness.instructions.md`; runtime detector + auto-retry + paste-prompt per `thoroughness-detector.instructions.md`. Citations per `citation-ledger.instructions.md`.
15
+
16
+ ## Inputs
17
+
18
+ - `<project>` — already-resolved project name.
19
+ - `<alias>` — current contributor.
20
+ - `<window>` — date range. For snapshot: ignored (always full re-fetch). For stream: `(from, to)`.
21
+ - (read) `<engagement-root>/.project-evidence/m365/m365-mutable.json m365Mutable.knownSections.<project>` — pinned hints.
22
+ - (read) `<engagement-root>/<project>/Evidence/<alias>/.settings.yml` — per-(project x user) overrides.
23
+
24
+ ## Resolution hints (pinned in mutable, query in this priority order)
25
+
26
+ 1. `one_sectionFileId` — drive item ID of the project's section file (e.g. AGCO.one) — narrowest, use first
27
+ 2. `one_sectionName` — display name (typically `<Project>.one`)
28
+ 3. Project alias keyword search — last resort
29
+
30
+ ## Path cascade (HARD — per `auth-and-retry.instructions.md`)
31
+
32
+ 1. **WorkIQ** (only supported path here per `workiq-first.instructions.md` — workspace policy disables Graph `/me/onenote/*`):
33
+ - **Pre-flight**: `Get-Command workiq`. If missing → log `workiq-not-on-path` + ask user. Probe `workiq ask -q "ping"`; if EULA prompt → run `workiq accept-eula` once, retry.
34
+ - Then query with the **narrowest available** hint:
35
+ - Have `one_sectionFileId`? Query: `Get full page bodies from OneNote section with sectionFileId <id> modified between <start> and <end>`.
36
+ - Have `one_sectionName` only? Query: `Get full page bodies from OneNote section <section> in notebook <notebook> modified between <start> and <end>`.
37
+ - Neither? Query: `Find OneNote pages or sections that mention <project> or <project-aliases>. Return page titles, section names, last modified dates, and direct links.`
38
+ 2. Apply retry pattern (max 2 retries, 3s/6s backoff). Throttling → narrow scope once (sectionFileId if available), then stop.
39
+ 3. **Do NOT attempt Graph `/me/onenote/*`** — workspace policy: OneNote via Graph repeatedly fails 401 here. Record `graph-skipped-by-policy` if Graph is the only remaining option.
40
+ 4. If WorkIQ exhausts → write evidence file with `❌ all paths failed` marker and `next_step: ask user to paste page text from <section>`.
41
+
42
+ ## Snapshot pass
43
+
44
+ Write `snapshot/pages/<page-title>.md` per page with full verbatim body (NOT title only). Header: `Page: <title>` / `Section: <section>` / `Last modified: <ts> by <author>`.
45
+
46
+ Write to: `<engagement-root>/<project>/Evidence/<alias>/OneNote/snapshot/<entity>.md`
47
+
48
+ Use template: `templates/snapshot/onenote-<kind>.template.md`
49
+
50
+ ## Stream pass
51
+
52
+ Page-edit events for the window. Each event: page, edit type (created/modified/renamed), editor, timestamp, brief diff summary.
53
+
54
+ Write to: `<engagement-root>/<project>/Evidence/<alias>/OneNote/stream/<YYYY-MM-DD>_onenote-stream.md` (date = Monday of the ISO week the events fall in).
55
+
56
+ Use template: `templates/weekly/onenote-summary.template.md`
57
+
58
+ If a week file already exists, MERGE (dedupe by event ID, append new events, keep existing).
59
+
60
+ ## Mutable hints to upsert (during the run, not at the end)
61
+
62
+ If discovered, immediately write to `m365Mutable.knownSections.<project>.<source>` with `discoveredOn` + `confidence`:
63
+
64
+ - `one_sectionFileId` — drive item ID of the project's section file
65
+ - `one_sectionName` — display name
66
+ - `one_sectionWebUrl` — direct link
67
+
68
+ ## Update run-log
69
+
70
+ After the pass:
71
+ - `sources.onenote.last_run = now`
72
+ - `sources.onenote.last_status = ok | partial | failed | skipped-auth`
73
+ - `sources.onenote.watermark_to = now` (stream only; snapshot has no watermark)
74
+ - `sources.onenote.items_pulled = <N>`
75
+ - `sources.onenote.errors = [...]` per `auth-and-retry.instructions.md` schema
76
+ - For each week touched, add to `weekly_files` index.
77
+
78
+ ## Stop conditions
79
+
80
+ - Hint missing AND fuzzy resolution returns 0 candidates → ask user once, persist answer to mutable, continue.
81
+ - Multiple plausible candidates → ask user to pick, persist answer.
82
+ - All paths failed → write evidence file with `❌ all paths failed` + actionable `next_step`, log to run-log errors, continue with rest of run.
@@ -0,0 +1,85 @@
1
+ ---
2
+ name: "pull-sharepoint"
3
+ version: "2.0.0"
4
+ description: "Pull SharePoint evidence (snapshot: folder tree + key file bodies; stream: file change events). WorkIQ-first; also walks local synced folder for metadata without auth."
5
+ ---
6
+
7
+ # Skill: pull-sharepoint
8
+
9
+ Pulls **sharepoint** evidence in two shapes per `snapshot-vs-stream.instructions.md`:
10
+
11
+ - **snapshot/** — tree.md (full folder tree) + files/<path>.md (key files with full extracted content)
12
+ - **stream/** — file change events (created/modified/renamed/deleted) with author + size + brief content summary
13
+
14
+ WorkIQ-first per `workiq-first.instructions.md`. Thoroughness per `evidence-thoroughness.instructions.md`; runtime detector + auto-retry + paste-prompt per `thoroughness-detector.instructions.md`. Citations per `citation-ledger.instructions.md`. Side-by-side mutable hints written immediately on discovery per `side-by-side-config.instructions.md`.
15
+
16
+ ## Inputs
17
+
18
+ - `<project>` — already-resolved project name.
19
+ - `<alias>` — current contributor.
20
+ - `<window>` — date range. For snapshot: ignored (always full re-fetch). For stream: `(from, to)`.
21
+ - (read) `<engagement-root>/.project-evidence/m365/m365-mutable.json m365Mutable.knownSections.<project>` — pinned hints.
22
+ - (read) `<engagement-root>/<project>/Evidence/<alias>/.settings.yml` — per-(project x user) overrides.
23
+
24
+ ## Resolution hints (pinned in mutable)
25
+
26
+ - `sharePoint.localFolder` — local OneDrive-synced path
27
+ - `sharePoint.siteUrl` — SP site URL
28
+ - `sharePoint.driveId` — Graph drive ID for direct access
29
+
30
+ ## Snapshot pass
31
+
32
+ Write `snapshot/tree.md` (full folder hierarchy, no truncation) and `snapshot/files/<relative-path>.md` for each file selected for body extraction. The selected set is the **union** of:
33
+
34
+ 1. **Curated key files** — anything matching `architecture`, `decision`, `adr`, `deliverable`, `proposal`, `statement of work`, `sow`, `business case`, `roadmap`, `plan` in the filename or top-level folder name. These are always extracted.
35
+ 2. **Top-N most-recently-modified files** under the project's SharePoint folder, where N = `sharepoint.snapshot.recent_n` from the user's `.settings.yml` (default **25**, configurable to 0 to disable). This captures the live working tail without exploding on large team sites.
36
+ 3. **User pins** — anything listed under `sharepoint.snapshot.always_include` in `.settings.yml` (relative paths or substrings).
37
+
38
+ For every selected file write: full filename (NO truncation), changed-by, change-type, size, last-modified-datetime, and a concise content summary (decisions, risks, actions, owners, dates, key context — same depth bar as the meetings transcript walk-through). Apply `path_excludes` from `.settings.yml` to skip noise (`_Archive`, `Old`, etc.) before counting toward N.
39
+
40
+ `snapshot/tree.md` always lists the full hierarchy regardless of which files got body extraction; mark each file with one of `[key]`, `[recent]`, `[pin]`, `[skip]`, or `[tree-only]` so the reader can see why a file was or wasn't expanded.
41
+
42
+ Write to: `<engagement-root>/<project>/Evidence/<alias>/sharepoint/snapshot/<entity>.md`
43
+
44
+ Use template: `templates/snapshot/sharepoint-<kind>.template.md`
45
+
46
+ ## Stream pass
47
+
48
+ File change events for the window with full filename, change type, author, timestamp, size, content summary. Apply `sharepoint.path_includes` / `path_excludes` / `author_filter` from .settings.yml.
49
+
50
+ Write to: `<engagement-root>/<project>/Evidence/<alias>/sharepoint/stream/<YYYY-MM-DD>_sharepoint-stream.md` (date = Monday of the ISO week the events fall in).
51
+
52
+ Use template: `templates/weekly/sharepoint-summary.template.md`
53
+
54
+ If a week file already exists, MERGE (dedupe by event ID, append new events, keep existing).
55
+
56
+ ## Tools (in order)
57
+
58
+ 1. **WorkIQ** — ````$WorkIQQuery`````
59
+ 2. **Host fallback** — `m365_search_files` / `m365_list_files`; `helpers/sharepoint-pull.ps1` (uses `az account get-access-token --resource https://graph.microsoft.com`); also walk local synced folder under `sharePoint.localFolder` for metadata (no auth needed)
60
+ 3. **Graph REST** — last resort, soft-fail per `az-auth-conditional.instructions.md`.
61
+ 4. **Ask user** — paste verbatim source content if all above fail.
62
+
63
+ Document which path succeeded under `## Source Basis` in each output file.
64
+
65
+ ## Mutable hints to upsert (during the run, not at the end)
66
+
67
+ If discovered, immediately write to `m365Mutable.knownSections.<project>.<source>` with `discoveredOn` + `confidence`:
68
+
69
+ - `sharePoint.localFolder` — local OneDrive-synced path
70
+ - `sharePoint.siteUrl` — SP site URL
71
+ - `sharePoint.driveId` — Graph drive ID for direct access
72
+
73
+ ## Update run-log
74
+
75
+ After successful pass:
76
+ - `sources.sharepoint.last_pulled = now`
77
+ - `sources.sharepoint.watermark = now` (stream only; snapshot has no watermark)
78
+ - `sources.sharepoint.item_count = <N>`
79
+ - For each week touched, add to `weekly_files` index.
80
+
81
+ ## Stop conditions
82
+
83
+ - Hint missing AND fuzzy resolution returns 0 candidates → ask user once, persist answer to mutable, continue.
84
+ - Multiple plausible candidates → ask user to pick, persist answer.
85
+ - WorkIQ fails AND host fallback fails AND Graph fails → write evidence file with `❌ all paths failed` marker, log to run-log errors, continue with rest of run.
@@ -0,0 +1,75 @@
1
+ ---
2
+ name: "pull-teams"
3
+ version: "2.0.0"
4
+ description: "Pull Teams chat + channel evidence (snapshot: chat roster; stream: messages with full message-by-message reproduction). WorkIQ-first."
5
+ ---
6
+
7
+ # Skill: pull-teams
8
+
9
+ Pulls **teams** evidence in two shapes per `snapshot-vs-stream.instructions.md`:
10
+
11
+ - **snapshot/** — chat roster + member list per chat the user is part of for this project
12
+ - **stream/** — messages with full message-by-message reproduction — sender, timestamp, verbatim text, reactions, attachments, replies — grouped by thread
13
+
14
+ WorkIQ-first per `workiq-first.instructions.md`. Thoroughness per `evidence-thoroughness.instructions.md`; runtime detector + auto-retry + paste-prompt per `thoroughness-detector.instructions.md`. Citations per `citation-ledger.instructions.md`. Side-by-side mutable hints written immediately on discovery per `side-by-side-config.instructions.md`.
15
+
16
+ ## Inputs
17
+
18
+ - `<project>` — already-resolved project name.
19
+ - `<alias>` — current contributor.
20
+ - `<window>` — date range. For snapshot: ignored (always full re-fetch). For stream: `(from, to)`.
21
+ - (read) `<engagement-root>/.project-evidence/m365/m365-mutable.json m365Mutable.knownSections.<project>` — pinned hints.
22
+ - (read) `<engagement-root>/<project>/Evidence/<alias>/.settings.yml` — per-(project x user) overrides.
23
+
24
+ ## Resolution hints (pinned in mutable)
25
+
26
+ - `teamsChatContext.chatIds` — list of pinned chat IDs (skip discovery if present)
27
+ - `teamsChatContext.chatHints` / `channelHints` / `participantHints` — fuzzy discovery terms
28
+
29
+ ## Snapshot pass
30
+
31
+ Write `snapshot/chat-roster.md` listing each chat (id, topic, members) and `snapshot/chats/<chat-id>.md` per chat with member list + tabs.
32
+
33
+ Write to: `<engagement-root>/<project>/Evidence/<alias>/teams/snapshot/<entity>.md`
34
+
35
+ Use template: `templates/snapshot/teams-<kind>.template.md`
36
+
37
+ ## Stream pass
38
+
39
+ Per `evidence-thoroughness.instructions.md`: every thread touched in window gets full message-by-message reproduction. Group by thread, not by day. If a thread has 30 messages, reproduce all 30.
40
+
41
+ Write to: `<engagement-root>/<project>/Evidence/<alias>/teams/stream/<YYYY-MM-DD>_teams-stream.md` (date = Monday of the ISO week the events fall in).
42
+
43
+ Use template: `templates/weekly/teams-summary.template.md`
44
+
45
+ If a week file already exists, MERGE (dedupe by event ID, append new events, keep existing).
46
+
47
+ ## Tools (in order)
48
+
49
+ 1. **WorkIQ** — ````$WorkIQQuery`````
50
+ 2. **Host fallback** — `m365_list_chats` + `m365_list_chat_messages` scoped by `chatIds` from mutable
51
+ 3. **Graph REST** — last resort, soft-fail per `az-auth-conditional.instructions.md`.
52
+ 4. **Ask user** — paste verbatim source content if all above fail.
53
+
54
+ Document which path succeeded under `## Source Basis` in each output file.
55
+
56
+ ## Mutable hints to upsert (during the run, not at the end)
57
+
58
+ If discovered, immediately write to `m365Mutable.knownSections.<project>.<source>` with `discoveredOn` + `confidence`:
59
+
60
+ - `teamsChatContext.chatIds` — list of pinned chat IDs (skip discovery if present)
61
+ - `teamsChatContext.chatHints` / `channelHints` / `participantHints` — fuzzy discovery terms
62
+
63
+ ## Update run-log
64
+
65
+ After successful pass:
66
+ - `sources.teams.last_pulled = now`
67
+ - `sources.teams.watermark = now` (stream only; snapshot has no watermark)
68
+ - `sources.teams.item_count = <N>`
69
+ - For each week touched, add to `weekly_files` index.
70
+
71
+ ## Stop conditions
72
+
73
+ - Hint missing AND fuzzy resolution returns 0 candidates → ask user once, persist answer to mutable, continue.
74
+ - Multiple plausible candidates → ask user to pick, persist answer.
75
+ - WorkIQ fails AND host fallback fails AND Graph fails → write evidence file with `❌ all paths failed` marker, log to run-log errors, continue with rest of run.
@@ -0,0 +1,89 @@
1
+ ---
2
+ name: "refresh-project"
3
+ version: "2.1.0"
4
+ description: "Incremental refresh for an already-bootstrapped project. Reads run-log watermarks, pulls only what is new since last run per source, splits stream output by ISO week, replaces snapshots in place. Builds State/ only on `full` profile (skipped on `standard`). Defaults to since-watermark (fallback 7d if first refresh)."
5
+ ---
6
+
7
+ # Skill: refresh-project
8
+
9
+ Run this when the user says any of: "refresh `<X>`", "do it all for `<X>`" (when project already bootstrapped), "weekly extract for `<X>`", "update `<X>`", "pull `<X>` since `<date>`".
10
+
11
+ ## Profile-aware behavior
12
+
13
+ As of Kushi v3.3.0:
14
+
15
+ - On `standard` profile (default) — Step 4 (build-state) is **skipped**.
16
+ - On `full` profile — Step 4 runs and `State/` is rebuilt if new evidence landed.
17
+
18
+ Profile is read from `kushi-install.json#profile` next to the agent file. Default `standard` if absent.
19
+
20
+ ## Inputs
21
+
22
+ - `<project>` — already-bootstrapped project (fuzzy-matched).
23
+ - `<window>` — one of:
24
+ - (default) since per-source watermark in run-log
25
+ - `last N days` — override window for all sources
26
+ - `since YYYY-MM-DD` — from date until today
27
+ - `YYYY-MM-DD..YYYY-MM-DD` — explicit range (backfill)
28
+ - (optional) `<source>` — limit to one source (otherwise all enabled).
29
+
30
+ ## Steps
31
+
32
+ ### Step 1 — Resolve project + read run-log
33
+
34
+ - Fuzzy-match `<project>` per `engagement-root-resolution.instructions.md`.
35
+ - Read `<engagement-root>/<project>/Evidence/run-log.yml`.
36
+ - For each source, compute effective window:
37
+ - If user supplied window override → use that.
38
+ - Else if `sources.<src>.watermark` exists → use `(watermark, today)`.
39
+ - Else (first refresh after bootstrap, or new source) → fallback to `last 7 days`.
40
+
41
+ ### Step 2 — Per-source dispatch
42
+
43
+ For each enabled source (or just the requested one), call its `pull-<source>` skill with the effective window.
44
+
45
+ Each `pull-*` skill is responsible for:
46
+ - Snapshot pass (always re-fetch known entities).
47
+ - Stream pass (incremental from watermark, bucketed by ISO week, append-only merge).
48
+ - Updating `sources.<src>.watermark`, `sources.<src>.last_pulled`, `sources.<src>.item_count` in run-log.
49
+ - Updating `weekly_files` index in run-log.
50
+
51
+ ### Step 3 — Consolidate (if multi-user)
52
+
53
+ If `Evidence/contributors.yml` lists more than one alias and any of them have new evidence in the window, dispatch `consolidate-evidence` for the same window.
54
+
55
+ ### Step 4 — Build state (FULL PROFILE ONLY)
56
+
57
+ If `kushi-install.json#profile` is `full` → dispatch `build-state` if any source had ANY new data this run (new snapshot diffs or new stream events). Otherwise skip with note "no new evidence — state unchanged".
58
+
59
+ If `standard` (or `core`) → **skip this step**. Note in the run summary: *"State/ rollup skipped (profile = `standard`). To enable, re-install with `npx github:gim-home/kushi --clawpilot --profile full --force`."*
60
+
61
+ ### Step 5 — Run summary
62
+
63
+ Display:
64
+ - Per-source table: items pulled, weeks affected, errors.
65
+ - Side-by-side mutable hints written this run (per `side-by-side-config.instructions.md`).
66
+ - New Open Questions opened/resolved/staled.
67
+
68
+ ## Watermark semantics
69
+
70
+ - Watermarks are stored in `Evidence/run-log.yml` per source (not per week).
71
+ - Snapshot pulls do NOT use watermarks — always full re-fetch.
72
+ - Stream pulls advance the watermark to `now` AFTER successful merge.
73
+ - Failed streams leave the watermark UNCHANGED so the next refresh retries from the same point.
74
+
75
+ ## Idempotency
76
+
77
+ Re-running refresh with the same window is safe:
78
+ - Snapshots replace in place (no harm).
79
+ - Stream events dedupe by event ID — duplicates are dropped.
80
+
81
+ ## Triggers
82
+
83
+ - "refresh `<X>`"
84
+ - "do it all for `<X>`" (when project already exists)
85
+ - "weekly extract for `<X>`"
86
+ - "update `<X>`"
87
+ - "pull `<X>` since `<date>`"
88
+ - "refresh `<X>` last `<N>` days"
89
+ - "backfill `<X>` from `<from>` to `<to>`"
@@ -0,0 +1,166 @@
1
+ ---
2
+ name: "self-check"
3
+ version: "2.0.0"
4
+ description: "Pre-commit / pre-push validator. Checks that Kushi's skills, instructions, prompts, agent definition, templates, and key docs are all internally consistent. Source of truth is the file system. Findings are warnings with concrete fixes — never blocking."
5
+ ---
6
+
7
+ # Skill: self-check
8
+
9
+ Validate Kushi's documentation surfaces against the file system before committing or pushing. The set of directories under `plugin/skills/` (each with a `SKILL.md`) is the canonical inventory; everything else must reference them correctly.
10
+
11
+ User triggers: "self-check", "run self-check", "pre-commit check", "validate kushi", "are all skills documented?", "check docs consistency".
12
+
13
+ ## Principles
14
+
15
+ - **Source of truth is the file system.** Never derive the skill / instruction / prompt list from any markdown file.
16
+ - **Fail with fixes, not just errors.** Every finding includes a concrete suggestion (snippet to paste, path to add, link to repair).
17
+ - **Non-blocking.** Findings are warnings. The user decides whether to commit.
18
+ - **Minimal noise.** Surface only gaps. Do not echo passing checks.
19
+ - **Deterministic.** A companion script (`run.ps1`) produces the same results as the agent walkthrough.
20
+
21
+ ## What gets checked
22
+
23
+ Checks split into **core** (always run) and **deep** (opt-in).
24
+
25
+ ### Core checks
26
+
27
+ | # | Check | Source of truth | Target | Failure shape |
28
+ |---|-------|-----------------|--------|---------------|
29
+ | C1 | Frontmatter completeness | `plugin/skills/<n>/SKILL.md` | each skill | missing `name`, `version`, or `description` |
30
+ | C2 | Skill name matches directory | `plugin/skills/<dir>/` | frontmatter `name:` | mismatch |
31
+ | C3 | Skills inventoried in agent | `plugin/skills/` | `plugin/agents/kushi.agent.md` "Skills" / verb routing | skill missing from agent |
32
+ | C4 | Prompts route to real skills | `plugin/prompts/*.prompt.md` | `plugin/skills/` | prompt names a skill that doesn't exist |
33
+ | C5 | Instructions referenced | `plugin/instructions/*.instructions.md` | any SKILL.md / agent.md | orphan instruction |
34
+ | C6 | Cross-links resolve | every `[...](path)` in plugin md | filesystem | broken relative link |
35
+ | C7 | Verbs table matches prompts | `plugin/prompts/` | `README.md` verbs table | verb missing/extra in README |
36
+ | C8 | Distribution layout | `plugin/` (post-install mirror) | `docs/reference/where-things-live.md` | top-level item missing from layout diagram |
37
+ | C9 | Profiles manifest valid | `plugin/plugin.json` `profiles{}` | filesystem | profile references skill/prompt/instruction that doesn't exist; `default_profile` not declared |
38
+
39
+ ### Deep checks (opt-in)
40
+
41
+ | # | Check | What it validates |
42
+ |---|-------|-------------------|
43
+ | D1 | Template references | every `templates/<x>` mentioned in a SKILL.md exists |
44
+ | D2 | Snapshot/stream coverage | each `pull-<source>` skill cites `snapshot-vs-stream.instructions.md` and writes both shapes (or explicitly states stream-only) |
45
+ | D3 | WorkIQ-first hygiene | each `pull-<source>` skill names WorkIQ as tool #1 and host fallback as tool #2 |
46
+ | D4 | Live install sync | if `~/.copilot/m-skills/kushi/` exists, its `SKILL.md` is byte-identical to `plugin/agents/kushi.agent.md` |
47
+ | D5 | skills-metadata.json sync | if `~/.copilot/m-skills/skills-metadata.json` lists `kushi`, its description matches the live `SKILL.md` frontmatter |
48
+ | D6 | Side-by-side rule cited | every SKILL.md that touches user config references `side-by-side-config.instructions.md` |
49
+ | D7 | Live install manifest | if `~/.copilot/m-skills/kushi/kushi-install.json` exists, its skill list matches the resolved profile chain from `plugin.json` (no missing, no extras) |
50
+
51
+ ## Execution flow (agent path)
52
+
53
+ 1. **Run `run.ps1`.** From the kushi repo root: `pwsh plugin/skills/self-check/run.ps1` (omit `-Deep` to skip D-checks). The script prints a JSON summary of findings.
54
+ 2. **If `run.ps1` is unavailable** (e.g. running outside the repo), perform the checks inline using `glob` + `grep` + `view` per the algorithm below.
55
+ 3. **Render findings** as a single results table per surface, followed by a per-finding fix block.
56
+ 4. **Offer deep checks** with an `m_ask_user` prompt:
57
+
58
+ | Label | Action |
59
+ |---|---|
60
+ | ✅ Run deep checks | Re-run with `-Deep` |
61
+ | ⏭️ Skip | Show final summary |
62
+
63
+ 5. **Final verdict.**
64
+ - All clear → `✅ Kushi is internally consistent. Safe to commit.`
65
+ - Any gaps → `⚠️ Found <N> gap(s) across <M> surface(s). Review findings above.`
66
+
67
+ ## Algorithm (per check)
68
+
69
+ ### C1 — Frontmatter completeness
70
+
71
+ For each `plugin/skills/<dir>/SKILL.md`: parse YAML frontmatter (text between leading `---` lines). Required keys: `name`, `version`, `description`.
72
+
73
+ > ⚠️ self-check C1 — Skill `<dir>` is missing required frontmatter key `<key>`. Add it before the first `---` separator.
74
+
75
+ ### C2 — Skill name matches directory
76
+
77
+ For each skill: `frontmatter.name` (case-insensitive) must equal directory name.
78
+
79
+ > ⚠️ self-check C2 — Directory `<dir>/` declares `name: "<name>"`. Rename one or the other so they match.
80
+
81
+ ### C3 — Skills inventoried in agent
82
+
83
+ `plugin/agents/kushi.agent.md` must contain a backtick-wrapped reference to every skill directory name. Look in any markdown table column or any inline `\`<name>\`` token.
84
+
85
+ > ⚠️ self-check C3 — Skill `<dir>` is not listed in the kushi agent. Suggested row for the routing table:
86
+ >
87
+ > `| <verb> | <dir> | <one-line description from frontmatter> |`
88
+
89
+ ### C4 — Prompts route to real skills
90
+
91
+ For each `plugin/prompts/*.prompt.md`: extract any reference of the form `` `<skill-name>` `` or `delegates to <skill-name>` (case-insensitive). Each must exist as a directory under `plugin/skills/`.
92
+
93
+ > ⚠️ self-check C4 — Prompt `<file>` references skill `<name>` which does not exist under `plugin/skills/`. Either create the skill or update the prompt.
94
+
95
+ ### C5 — Instructions referenced
96
+
97
+ For each `plugin/instructions/*.instructions.md`: at least one SKILL.md OR `plugin/agents/kushi.agent.md` must reference it by filename (with or without path).
98
+
99
+ > ⚠️ self-check C5 — Instruction `<file>` is not referenced anywhere. Either delete it or add a "## References" line to the relevant skill(s).
100
+
101
+ ### C6 — Cross-links resolve
102
+
103
+ For every markdown link with a relative target (`](./...)`, `](../...)`, or `](path/...)` not starting with `http`) inside `plugin/**/*.md`: target must exist on disk relative to the file containing it.
104
+
105
+ > ⚠️ self-check C6 — `<source-file>:<line>` links to `<target>` which does not exist. Update or remove the link.
106
+
107
+ ### C7 — Verbs table matches prompts
108
+
109
+ `README.md` contains a "Verbs" / "Quick start" table. Every `plugin/prompts/<verb>.prompt.md` must have a row in that table; every row in the table must have a corresponding prompt file.
110
+
111
+ > ⚠️ self-check C7 — Verb `<v>` exists as `plugin/prompts/<v>.prompt.md` but is missing from README's verbs table. Suggested row:
112
+ >
113
+ > `| \`<v>\` | <default window> | <one-line description> |`
114
+
115
+ ### C8 — Distribution layout matches docs
116
+
117
+ `docs/reference/where-things-live.md` contains an ASCII tree of `plugin/`. Every top-level subdirectory and notable file under `plugin/` must appear; every entry in the tree must exist on disk.
118
+
119
+ > ⚠️ self-check C8 — `plugin/<x>` exists but is missing from the docs/reference/where-things-live.md tree. Add an entry under section "1. This repo".
120
+
121
+ ### D-checks: see `run.ps1` for the exact regexes.
122
+
123
+ ## Validation rules
124
+
125
+ - **R1** Source of truth is always the file system; never the markdown.
126
+ - **R2** Match skill names case-insensitively; match directories case-sensitively (Windows is forgiving but git is not on case-only renames).
127
+ - **R3** Deep checks (D1–D6) are always opt-in. Never run them automatically.
128
+ - **R4** Findings must include an actionable fix snippet — never report a gap without telling the user how to repair it.
129
+ - **R5** Do not echo passing checks. Final summary table shows the count per surface; the body shows only gaps.
130
+ - **R6** If run.ps1 fails (missing PowerShell, etc.), fall back to the inline algorithm and document the fallback path used.
131
+
132
+ ## Output format
133
+
134
+ ```
135
+ ### Self-Check Results — Kushi v<version> @ <YYYY-MM-DD HH:mm>
136
+
137
+ | Surface | Core | Deep |
138
+ |----------------------------------|------|------|
139
+ | Frontmatter (C1, C2) | ✅ / ⚠️ N | n/a |
140
+ | Agent inventory (C3) | ✅ / ⚠️ N | n/a |
141
+ | Prompts (C4, C7) | ✅ / ⚠️ N | n/a |
142
+ | Instructions (C5, D6) | ✅ / ⚠️ N | ✅ / ⚠️ N |
143
+ | Cross-links (C6) | ✅ / ⚠️ N | n/a |
144
+ | Layout (C8) | ✅ / ⚠️ N | n/a |
145
+ | Templates (D1) | n/a | ✅ / ⚠️ N |
146
+ | Snapshot/Stream (D2) | n/a | ✅ / ⚠️ N |
147
+ | WorkIQ-first hygiene (D3) | n/a | ✅ / ⚠️ N |
148
+ | Live install sync (D4, D5) | n/a | ✅ / ⚠️ N |
149
+
150
+ <findings, one block per finding>
151
+ ```
152
+
153
+ ## Triggers (verb routing)
154
+
155
+ This skill is not invoked by `@Kushi <verb>` — it's a meta-skill. Triggers:
156
+
157
+ - "kushi self-check"
158
+ - "self-check kushi"
159
+ - "validate kushi"
160
+ - "pre-commit check"
161
+ - "are all kushi skills documented?"
162
+
163
+ ## References
164
+
165
+ - `instructions/citation-ledger.instructions.md` (findings cite source files / line numbers)
166
+ - `instructions/side-by-side-config.instructions.md` (D6 enforces this rule for skills that read/write user config)