kushi-agents 6.1.2 → 6.2.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 (86) hide show
  1. package/package.json +1 -1
  2. package/plugin/instructions/agentskills-compliance.instructions.md +144 -0
  3. package/plugin/instructions/dashboard-artifact.instructions.md +132 -0
  4. package/plugin/instructions/guided-tour.instructions.md +100 -0
  5. package/plugin/instructions/karpathy-state-layout.instructions.md +124 -0
  6. package/plugin/instructions/schema-evolve.instructions.md +73 -0
  7. package/plugin/instructions/skill-authoring.instructions.md +147 -0
  8. package/plugin/instructions/skill-evals.instructions.md +130 -0
  9. package/plugin/runners/bootstrap.mjs +55 -22
  10. package/plugin/runners/lib/runlog.mjs +153 -6
  11. package/plugin/runners/migrate-to-v550.mjs +192 -0
  12. package/plugin/runners/pull-email.mjs +194 -3
  13. package/plugin/runners/pull-meetings.mjs +207 -4
  14. package/plugin/runners/pull-onenote.mjs +239 -3
  15. package/plugin/runners/pull-sharepoint.mjs +284 -3
  16. package/plugin/runners/pull-state.mjs +297 -0
  17. package/plugin/runners/pull-teams.mjs +170 -3
  18. package/plugin/runners/refresh.mjs +9 -1
  19. package/plugin/runners/test/fixtures/email-abn-amro.json +13 -0
  20. package/plugin/runners/test/fixtures/email-novel-error.json +9 -0
  21. package/plugin/runners/test/fixtures/meetings-abn-amro.json +10 -0
  22. package/plugin/runners/test/fixtures/meetings-body-unavailable.json +10 -0
  23. package/plugin/runners/test/fixtures/onenote-abn-amro.json +30 -0
  24. package/plugin/runners/test/fixtures/onenote-partial.json +21 -0
  25. package/plugin/runners/test/fixtures/refresh-dir/email.json +7 -4
  26. package/plugin/runners/test/fixtures/refresh-dir/teams.json +6 -4
  27. package/plugin/runners/test/fixtures/sharepoint-abn-amro.json +12 -0
  28. package/plugin/runners/test/fixtures/teams-abn-amro.json +11 -0
  29. package/plugin/runners/test/integration/migrate-to-v550.integration.test.mjs +138 -0
  30. package/plugin/runners/test/integration/pull-email.integration.test.mjs +149 -0
  31. package/plugin/runners/test/integration/pull-meetings.integration.test.mjs +92 -0
  32. package/plugin/runners/test/integration/pull-onenote.integration.test.mjs +86 -0
  33. package/plugin/runners/test/integration/pull-sharepoint.integration.test.mjs +93 -0
  34. package/plugin/runners/test/integration/pull-teams.integration.test.mjs +91 -0
  35. package/plugin/runners/test/unit/runlog.test.mjs +1 -1
  36. package/plugin/skills/build-state/SKILL.md +195 -0
  37. package/plugin/skills/build-state/evals/evals.json +31 -0
  38. package/plugin/skills/dashboard/SKILL.md +132 -0
  39. package/plugin/skills/dashboard/evals/evals.json +33 -0
  40. package/plugin/skills/lint-state/.created-by-skill-creator +0 -0
  41. package/plugin/skills/lint-state/SKILL.md +98 -0
  42. package/plugin/skills/lint-state/evals/evals.json +34 -0
  43. package/plugin/skills/lint-state/lint.ps1 +218 -0
  44. package/plugin/skills/promote/.created-by-skill-creator +1 -0
  45. package/plugin/skills/promote/SKILL.md +125 -0
  46. package/plugin/skills/promote/evals/evals.json +35 -0
  47. package/plugin/skills/schema-evolve/.created-by-skill-creator +0 -0
  48. package/plugin/skills/schema-evolve/SKILL.md +106 -0
  49. package/plugin/skills/schema-evolve/evals/evals.json +37 -0
  50. package/plugin/skills/skill-checker/SKILL.md +136 -0
  51. package/plugin/skills/skill-checker/check-skill.ps1 +416 -0
  52. package/plugin/skills/skill-checker/evals/evals.json +41 -0
  53. package/plugin/skills/skill-creator/SKILL.md +134 -0
  54. package/plugin/skills/skill-creator/evals/evals.json +40 -0
  55. package/plugin/skills/skill-creator/generate-eval-review.ps1 +101 -0
  56. package/plugin/skills/skill-creator/optimize-description.ps1 +87 -0
  57. package/plugin/skills/skill-creator/scaffold.ps1 +180 -0
  58. package/plugin/skills/skill-creator/templates/evals-starter.template.json +27 -0
  59. package/plugin/skills/skill-creator/templates/gotchas-stub.template.md +9 -0
  60. package/plugin/skills/skill-creator/templates/skill-skeleton.template.md +28 -0
  61. package/plugin/skills/teach/.created-by-skill-creator +0 -0
  62. package/plugin/skills/teach/SKILL.md +79 -0
  63. package/plugin/skills/teach/evals/evals.json +59 -0
  64. package/plugin/skills/tour/SKILL.md +85 -0
  65. package/plugin/skills/tour/build-tour.ps1 +185 -0
  66. package/plugin/skills/tour/evals/evals.json +33 -0
  67. package/plugin/templates/state/00_overview.template.md +44 -0
  68. package/plugin/templates/state/01_decisions.template.md +41 -0
  69. package/plugin/templates/state/02_stakeholders.template.md +48 -0
  70. package/plugin/templates/state/03_architecture-and-solution.template.md +56 -0
  71. package/plugin/templates/state/04_workshops-and-key-meetings.template.md +43 -0
  72. package/plugin/templates/state/05_action-items.template.md +29 -0
  73. package/plugin/templates/state/06_risks-and-issues.template.md +43 -0
  74. package/plugin/templates/state/07_timeline-and-milestones.template.md +45 -0
  75. package/plugin/templates/state/08_artifacts-and-deliverables.template.md +55 -0
  76. package/plugin/templates/state/09_open-questions.template.md +62 -0
  77. package/plugin/templates/state/AGENTS.template.md +33 -0
  78. package/plugin/templates/state/CLAUDE.template.md +33 -0
  79. package/plugin/templates/state/README.md +41 -0
  80. package/plugin/templates/state/answers.README.md +7 -0
  81. package/plugin/templates/state/hot.template.md +12 -0
  82. package/plugin/templates/state/index.template.md +41 -0
  83. package/plugin/templates/state/log.template.md +14 -0
  84. package/plugin/templates/state/page.template.md +22 -0
  85. package/plugin/templates/state/review-queue.template.md +10 -0
  86. package/plugin/runners/test/integration/csc-pull.integration.test.mjs +0 -160
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kushi-agents",
3
- "version": "6.1.2",
3
+ "version": "6.2.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": {
@@ -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,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,124 @@
1
+ ---
2
+ applyTo: "**"
3
+ description: "v5.0.0 — Karpathy-style State/ layout. The State/ folder adopts the convention (index.md + log.md + CLAUDE.md + AGENTS.md + `[[wikilinks]]`) so external wiki tools (Understand-Anything, Obsidian, Foam, GitHub-pages wiki viewers) render it without custom work. Backward-compatible with v4.x State/ — v5 pages are distinguished by `kushi_state_page: true` front-matter."
4
+ ---
5
+
6
+ # Karpathy State Layout — HARD RULE (kushi v5.0.0+)
7
+
8
+ ## Why
9
+
10
+ Today `State/` is a kushi-private synthesis layout. Adopting the
11
+ Karpathy-pattern wiki convention (`index.md` + `log.md` + `[[wikilinks]]`)
12
+ makes State/ readable by any wiki tool — most importantly
13
+ Understand-Anything's `/understand-knowledge` skill, which already does
14
+ community clustering, entity extraction, and graph rendering for free
15
+ **if we adopt their conventions**.
16
+
17
+ ## Required files
18
+
19
+ Every v5.0.0+ project that has been touched by `build-state` has these under
20
+ `<engagement-root>/<project>/State/`:
21
+
22
+ | File | Purpose |
23
+ |---|---|
24
+ | `index.md` | Catalog of v5 State pages, grouped by category. Each entry is a `[[wikilink]]`. **Always regenerated** by `build-state` from the set of pages with `kushi_state_page: true` front-matter. |
25
+ | `log.md` | Chronological refresh log. **Appended** (never rewritten) — one entry per `refresh-project` or `bootstrap-project` run with: ISO timestamp, alias, mode (`bootstrap` / `refresh`), sources pulled, entities-added count, entities-updated count, link-entities edges-added count. |
26
+ | `CLAUDE.md` | Operating doc for AI agents reading the project — "this is a kushi project, use `[[wikilinks]]`, cite `Evidence/<alias>/<source>/weekly/...` for every claim." Written from `plugin/templates/state/CLAUDE.template.md` on first run; **preserved if user-edited** thereafter (mtime check; if hash diverges from template hash, do not overwrite). |
27
+ | `AGENTS.md` | **Copy** of `CLAUDE.md` for hosts that look for `AGENTS.md` (Codex, OpenAI agents SDK). NOT a symlink — Windows file-system compat. Written from `plugin/templates/state/AGENTS.template.md` (which is byte-identical to `CLAUDE.template.md`); preserved if user-edited. |
28
+
29
+ ## v5 State page convention
30
+
31
+ A v5 State page is any `State/<category>/<slug>.md` with `kushi_state_page: true`
32
+ in its front-matter.
33
+
34
+ ### Page categories (closed set)
35
+
36
+ | Category | Folder | Typical content |
37
+ |---|---|---|
38
+ | People | `State/people/` | Per-stakeholder page. Role, org, interactions, decisions touched. |
39
+ | Opportunities | `State/opportunities/` | Per-CRM-opportunity page. Stage, $ size, decisions, asks. |
40
+ | ADOWorkItems | `State/adoworkitems/` | Per-ADO work item that spans multiple weeks. State, owner, related meetings. |
41
+ | Decisions | `State/decisions/` | Per-cross-source decision. Date, decider, what changed, citations. |
42
+ | Risks | `State/risks/` | Per-risk page. Owner, status, mitigation, citations. |
43
+ | CustomerAsks | `State/customerasks/` | Per-ask page. Asker, ask text, status, evidence. |
44
+ | Meetings | `State/meetings/` | Per-recurring-meeting-series page. Attendees, cadence, recent decisions. |
45
+ | Artifacts | `State/artifacts/` | Per-document/deck/file page. Source link, key bullets, related decisions. |
46
+
47
+ Folder names are lowercase, no spaces. `build-state` creates them on demand.
48
+
49
+ ### Required front-matter
50
+
51
+ ```yaml
52
+ ---
53
+ kushi_state_page: true
54
+ category: opportunity # one of: people | opportunity | ado-work-item | decision | risk | customer-ask | meeting | artifact
55
+ entity_ids: ["crm://entity=opportunity/id=<guid>"]
56
+ related: ["[[ushak-smith]]", "[[northwind-weekly-sync]]"]
57
+ last_synthesized_iso: "2026-05-26T20:00:00Z"
58
+ synthesized_by_alias: "ushak"
59
+ ---
60
+ ```
61
+
62
+ - `entity_ids` MUST list at least one id that matches a node id in
63
+ `_graph/project-graph.json`. (Self-check D21.state enforces this.)
64
+ - `related` is a list of `[[slug]]` wikilinks to other State pages.
65
+ - `last_synthesized_iso` is the ISO timestamp of the producing `build-state`
66
+ run.
67
+
68
+ ### Wikilink rules
69
+
70
+ - `[[slug]]` resolves to `State/<category>/<slug>.md`. The category folder
71
+ is inferred from the target page's `category` front-matter.
72
+ - Slugs are **lowercase-kebab-case** derived from the page title (e.g.
73
+ "Northwind FY26 Renewal" → `northwind-fy26-renewal`). Producers MUST emit slugs
74
+ deterministically so two runs converge on the same filename.
75
+ - `[[slug|display text]]` is allowed and rendered the way every wiki tool
76
+ renders it.
77
+ - A wikilink whose target does not exist on disk is a **defect** flagged by
78
+ self-check D21.state. `build-state` MUST emit pages in dependency order so
79
+ every emitted wikilink resolves at end-of-run.
80
+
81
+ ## When to emit a v5 State page
82
+
83
+ `build-state` emits one page per **cross-source entity** in
84
+ `_graph/project-graph.json` — defined as: any node with ≥ 2 incoming/outgoing
85
+ edges OR present in ≥ 2 distinct weeks (per `weekly_refs`).
86
+
87
+ Nodes that fail both gates are NOT promoted to a State page; they remain
88
+ addressable via the graph and `weekly/` directly.
89
+
90
+ One file per cross-source entity. If two nodes legitimately share a slug
91
+ (name collision), append a short stable suffix derived from the source +
92
+ last 6 chars of the id (e.g. `ushak-smith-ado-9f3c2a`).
93
+
94
+ ## Backward compatibility
95
+
96
+ - Pages **without** `kushi_state_page: true` in front-matter are LEFT ALONE.
97
+ v4.x synthesis files (e.g. `State/00_overview.md`, `State/05_action-items.md`)
98
+ continue to live in `State/` and are produced by the v4.x synthesis path
99
+ inside `build-state` (which v5.0.0 retains for `full` profile parity).
100
+ - `State/index.md` regeneration only enumerates v5 pages (those with the
101
+ flag). Legacy synthesis files are not referenced from `State/index.md`;
102
+ their existing front-matter / cross-links remain valid.
103
+ - No migration. No deletion. Users may continue to use v4.x State files
104
+ indefinitely; v5 pages live alongside.
105
+
106
+ ## Self-check
107
+
108
+ `D21.state` enforces this layout:
109
+
110
+ - Every `State/<category>/*.md` with `kushi_state_page: true` has all required
111
+ front-matter fields.
112
+ - Every `entity_ids` value matches a node in `_graph/project-graph.json`.
113
+ - Every `[[wikilink]]` in a v5 page resolves to an existing v5 page on disk.
114
+ - `State/index.md` lists every v5 page that exists.
115
+
116
+ ## Cross-references
117
+
118
+ - `entity-graph.instructions.md` — source of node identity for `entity_ids`.
119
+ - `guided-tour.instructions.md` — `State/tour.md` is a sibling artifact that
120
+ uses the same wikilinks.
121
+ - `dashboard-artifact.instructions.md` — dashboard consumes `State/index.md`
122
+ to render the side panel's "State pages" section.
123
+ - `host-portability.instructions.md` — `CLAUDE.md` / `AGENTS.md` mirroring
124
+ rationale.
@@ -0,0 +1,73 @@
1
+ # Schema evolve
2
+
3
+ > Doctrine: `schema-evolve.instructions.md` — kushi v5.2.0+
4
+
5
+ ## Purpose
6
+
7
+ Allows users to teach kushi project-specific conventions that persist across runs. When a user says "from now on always do X for this project," kushi captures the rule and applies it in all future operations.
8
+
9
+ ## Storage location
10
+
11
+ Rules are stored in `Evidence/<alias>/State/CLAUDE.md` under the project's evidence tree.
12
+
13
+ **Decision rationale**: `CLAUDE.md` is the Karpathy-pattern file for agent-specific conventions (already present in the State layout since v5.0.0). Placing rules here means:
14
+ - They're versioned alongside evidence (git-tracked engagement roots get history).
15
+ - They're co-located with the State pages that apply them.
16
+ - They're readable by any agent (not kushi-specific format).
17
+
18
+ ## Rule format
19
+
20
+ Rules are appended to `CLAUDE.md` with structure:
21
+
22
+ ```markdown
23
+ ## Rule: <short-title>
24
+
25
+ - **Added**: 2026-05-29T14:30:00Z
26
+ - **Scope**: project | alias | global
27
+ - **Source**: user (natural language) | schema-evolve skill
28
+
29
+ <rule text as stated by the user>
30
+ ```
31
+
32
+ ## Scope levels
33
+
34
+ | Scope | Stored at | Applies to |
35
+ |-------|-----------|------------|
36
+ | `project` | `Evidence/<alias>/State/CLAUDE.md` | All operations on this project |
37
+ | `alias` | `Evidence/<alias>/State/CLAUDE.md` | Only this contributor's operations |
38
+ | `global` | `~/.kushi/conventions.md` | All projects (future — v5.3.0) |
39
+
40
+ v5.2.0 implements `project` scope only. `alias` and `global` are documented for forward compatibility.
41
+
42
+ ## How rules are applied
43
+
44
+ 1. At the start of `build-state`, `ask-project`, and `refresh-project`, the skill reads `Evidence/<alias>/State/CLAUDE.md`.
45
+ 2. Rules are parsed into a list and included as context for the operation.
46
+ 3. Rules affect preferences (formatting, naming, emphasis) but NEVER override hard doctrine (WorkIQ-only, verbatim-by-default, CSC format).
47
+
48
+ ## Conflict resolution
49
+
50
+ - Hard doctrine always wins over user rules.
51
+ - Later rules override earlier rules on the same topic.
52
+ - If a rule contradicts doctrine, it's logged as a warning but not applied.
53
+
54
+ ## CLI verb
55
+
56
+ `kushi remember <rule>` — captures a rule at project scope.
57
+
58
+ Auto-detection: when the user says "from now on...", "always...", "never...", "for this project..." in `ask-project`, the skill offers to persist it as a convention.
59
+
60
+ ## Examples
61
+
62
+ ```
63
+ > kushi remember "always use 'Northwind' not 'Healthcare Accelerator' in summaries"
64
+ > kushi remember "treat John Smith as the primary EM for this project"
65
+ > kushi remember "CRM entity 'opportunity' maps to our internal term 'deal'"
66
+ ```
67
+
68
+ ## References
69
+
70
+ - `karpathy-state-layout.instructions.md` — CLAUDE.md file in State layout
71
+ - `living-wiki.instructions.md` — rules interact with incremental State maintenance
72
+ - `build-state` skill — reads rules at start of run
73
+ - `ask-project` skill — reads rules + offers to capture new ones